text stringlengths 2 999k |
|---|
class User:
'''
Class that generates new Usernames and passwords
'''
pass
users_list=[]
def __init__(self,name,password):
'''
A function to create username and password
'''
self.name = name
self.password= password
def save_user(self):
'''
... |
"""
Parser for parsing a regular expression.
Take a string representing a regular expression and return the root node of its
parse tree.
usage::
root_node = parse_regex('(hello|world)')
Remarks:
- The regex parser processes multiline, it ignores all whitespace and supports
multiple named groups with the same n... |
from __future__ import annotations
import os
from typing import Callable, Optional, Sequence, Tuple, Union
from qtpy.QtCore import (
QEasingCurve,
QObject,
QPoint,
QPropertyAnimation,
QRect,
QSize,
Qt,
QThread,
QTimer,
Signal,
)
from qtpy.QtWidgets import (
QApplication,
... |
# -*- coding: utf-8 -*-
from model.contact import Contact
import random
def test_delete_some_contact(app, db, check_ui):
if len(db.get_contact_list()) == 0:
app.contact.create(Contact(first_name="test_name1", midle_name="test_midle_name1", last_name="test_last_name1", nikname="test_nikname1"))
old_cont... |
def pascals_triangle(n):
'''
Pascal's triangle:
for x in pascals_triangle(5):
print('{0:^16}'.format(x))
[1]
[1, 1]
[1, 2, 1]
[1, 3, 3, 1]
[1, 4, 6, 4, 1]
'''
x=[[1]]
for i in range(n-1):
x.append([sum(i) for i in zip([0]+x[... |
import struct
import json, base64
from binascii import hexlify, unhexlify
import sys
from Crypto.Util.asn1 import DerSequence
from Crypto.PublicKey import RSA
from .avbtool3 import *
import os
import stat
# !/usr/bin/python3
# -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2019, ZITiS, Do not distribute without permission ... |
class Node:
def __init__(self, k, v):
self.key = k
self.val = v
self.prev = None
self.next = None
class LRUCache:
def __init__(self, capacity):
self.capacity = capacity
self.dic = dict()
self.head = Node(0, 0)
self.tail = Node(0, 0)
self.... |
#!/usr/bin/env python3
##############################################################################
# Author: @harmj0y
#
# Based on: https://github.com/sixdub/DomainTrustExplorer by @sixdub
#
# Description: Uses pyyed (yEd) library to transform PowerView's updated
# Get-DomainTrustMapping functionality ... |
import time
from membase.api.rest_client import RestConnection, Bucket
from membase.helper.rebalance_helper import RebalanceHelper
from memcached.helper.data_helper import MemcachedClientHelper
from basetestcase import BaseTestCase
from mc_bin_client import MemcachedError
from couchbase_helper.documentgenerator import ... |
import torch
from mp.agents.segmentation_semisup_domain_pred_agent import SegmentationSemisupDomainPredictionAgent
from mp.data.pytorch.domain_prediction_dataset_wrapper import DomainPredictionDatasetWrapper
from mp.eval.accumulator import Accumulator
from mp.eval.inference.predict import softmax
from mp.utils.domain_... |
# -*- coding: utf-8 -*-
"""
Function implementation test.
Usage: resilient-circuits selftest -l fn_tenable_io_assets
"""
import logging
from resilient_lib import RequestsCommon
from fn_tenable_io_assets.util.tenable_io_lib import call_tenable_io
from pprint import pformat
log = logging.getLogger(__name__)
log.setLev... |
import model
import template
from google.appengine.ext import webapp
class Page(webapp.RequestHandler):
def get(self):
template.render_standard_page(self, 'profile.html', { 'profile' : model.getProfile() }) |
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import sys
import matplotlib
import matplotlib.cm as cm
from matplotlib.lines import Line2D
from matplotlibconfig import *
x_i_list, y_i_list, z_i_list, x_f_list, y_f_list, z_f_list, ID_list, energy_i_list = np.genfromtxt(sys.a... |
"""First order optimizer."""
import time
from dowel import logger
import pyprind
import tensorflow as tf
from garage.np.optimizers import BatchDataset
from garage.tf.misc import tensor_utils
from garage.tf.optimizers.utils import LazyDict
class FirstOrderOptimizer:
"""First order optimier.
P... |
r"""
Sudoku Puzzles
This module provides algorithms to solve Sudoku puzzles, plus tools
for inputting, converting and displaying various ways of writing a
puzzle or its solution(s). Primarily this is accomplished with the
:class:`sage.games.sudoku.Sudoku` class, though the legacy top-level
:func:`sage.games.sudoku.su... |
import unittest
from quasimodo.data_structures.inputs import Inputs
from quasimodo.data_structures.generated_fact import GeneratedFact
from quasimodo.data_structures.multiple_scores import MultipleScore
from quasimodo.data_structures.multiple_source_occurrence import MultipleSourceOccurrence
from quasimodo.assertion_v... |
from pyramid.security import Allow
from schematics.transforms import (
blacklist,
whitelist
)
from schematics.types import StringType
from schematics.types.compound import ModelType
from schematics.types.serializable import serializable
from zope.interface import implementer
from openprocurement.api.models.com... |
from json_visitor import JsonDumper, JsonLoader
from binary_visitor import BinDumper, BinLoader
from visitor_ref import RefObj, Traversable
class TypeA(Traversable):
def __init__(self):
super().__init__()
self.version = RefObj(2)
self.a = RefObj(1)
self.b = RefObj("whateve... |
def helper(root, diameter):
if not root:
return 0
left = helper(root.left, diameter)
right = helper(root.right, diameter)
if left + right > diameter[0]:
diameter[0] = left + right
return max(left, right) + 1
# main function
def getDiameterTree(root):
answer = [0]
helper(ro... |
# Store the version of the package
__version__ = "2020.11.20-1"
|
"""Compressed Sparse Row matrix format"""
from __future__ import division, print_function, absolute_import
__docformat__ = "restructuredtext en"
__all__ = ['csr_matrix', 'isspmatrix_csr']
import numpy as np
from scipy._lib.six import xrange
from .base import spmatrix
from ._sparsetools import csr_tocsc, csr_tobs... |
#!/usr/bin/env python3
# Copyright (c) 2010 ArtForz -- public domain half-a-node
# Copyright (c) 2012 Jeff Garzik
# Copyright (c) 2010-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.
"""Bitcoin P2P ... |
# HOW THIS CHALLENGE WORKS
# 1. main.c will call func.c with different input arguments as sent by checker.py.
# 2. main.c also knows the expected output and will change the value of the global
# variable accordingly to an executable that returns 0 (success) only when called
# correctly with the current input
# 3. main.... |
def list_differences(list_one, list_two):
"""
Compares two lists and returns a list of differences
Parameters
----------
list_one: list
list_two: list
Returns
-------
A list of differences between the two given lists.
"""
difference_list = list(set([entry for entry in list... |
# ---------------------------------------------------------------
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the NVIDIA Source Code License
# for OSCAR. To view a copy of this license, see the LICENSE file.
# -----------------------------------------------------------... |
"""
Django settings for black_water_28585 project.
Generated by 'django-admin startproject' using Django 2.2.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
im... |
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
... |
from django.urls import path
from . import views
urlpatterns = [
path('', views.index ),
]
|
from akhet.urlgenerator import URLGenerator
import pyramid.threadlocal as threadlocal
from pyramid.exceptions import ConfigurationError
from .lib import helpers
def includeme(config):
"""Configure all application-specific subscribers."""
config.add_subscriber(create_url_generator, "pyramid.events.ContextFound... |
# 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 may ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: tower.py
import tensorflow as tf
from six.moves import zip
from ..utils import logger
from ..utils.argtools import call_only_once
from ..utils.naming import MOVING_SUMMARY_OPS_KEY
from ..utils.develop import HIDE_DOC
from .collection import CollectionGuard
from .... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Natural Language Toolkit: TGrep search
#
# Copyright (C) 2001-2019 NLTK Project
# Author: Will Roberts <wildwilhelm@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
'''
Unit tests for nltk.tgrep.
'''
import unittest
from nltk.tree impo... |
"""
Wrapper for graphical utils.
from psana.psana.detector.UtilsGraphics import *
from psana.psana.detector.UtilsGraphics import gr, fleximage, arr_median_limits
img = det.raw.image(evt)
arr = det.raw.calib(evt)
amin, amax = arr_median_limits(arr, nneg=1, npos=3)
flimg = fleximage(img, ar... |
import pytest
from functools import partial
from pynads import utils
def test_check_utils_iter():
assert utils._iter_but_not_str_or_map([])
assert utils._iter_but_not_str_or_map(set())
assert utils._iter_but_not_str_or_map(())
assert not utils._iter_but_not_str_or_map('')
assert not utils._iter_but... |
from abc import ABC, abstractmethod
from enum import Enum
class ALGO(Enum):
ImageMatching = 1
SemanticSegmentation = 2
class SensorAbstractClass(ABC):
"""
Abstract class which all sensor classes should inherit.
"""
def __init__(self):
"""
Initializing the basic data of the c... |
# -*- coding: utf-8 -*-
"""This module defines implementation of poly resistor templates in generic planar technology.
"""
from typing import Dict, Any, Tuple, List, Optional, Union, TYPE_CHECKING
import math
from bag.layout.util import BBox
from bag.layout.routing import TrackID, WireArray
from bag.layout.routing.... |
"""
Sublime Text package to format Python code using `black`
https://github.com/ambv/black formatter.
"""
import os
import sublime
import sublime_plugin
#: name of the plugin
PLUGIN_NAME = os.path.splitext(os.path.basename(__file__))[0]
#: settings filename
SETTINGS = "{}.sublime-settings".format(PLUGIN_NAME)
def lo... |
# 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 Jline3(MavenPackage):
"""JLine is a Java library for handling console input."""
homep... |
# -*- coding:utf-8 -*-
import scrapy
from report_crawler.spiders.__Global_function import get_localtime
from report_crawler.spiders.__Global_variable import now_time, end_time
class SYSU001_Spider(scrapy.Spider):
name = 'NWSUAF001'
start_urls = ['http://cie.nwsuaf.edu.cn/xzhd/index.htm']
domains = 'http:/... |
# Copyright 2019 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
""" Finetuning the library models for sequence classification on GLUE (Bert, XLM, XLNet, RoBERTa, Albert, XLM-RoBERTa)."""
import warnings
warnings.simplefilter(action="ignore", category=FutureWarning)
import os
import sys
import dataclasses
from dataclasses import dataclass, field
from typing import Callable, Dict,... |
voto=[]
while True:
n = int(input("digite um voto , 0 sai"))
if n==0:
break
voto.append(n)
cad1=0
cand2=0
cand3=0
cand4=0
votob=0
voton=0
for x in voto:
if x ==1:
cad1+=1
if x ==2:
cand2+=1
if x ==3:
cand3+=1
if x ==4:
cand4+=1
if x ==6:
vo... |
import json
import logging
import random
import re
from pathlib import Path
from typing import Optional
from discord.ext import commands
from bot.bot import Bot
log = logging.getLogger(__name__)
BUNNY_NAMES = json.loads(Path("bot/resources/holidays/easter/bunny_names.json").read_text("utf8"))
class BunnyNameGener... |
# coding: utf-8
from datetime import date, timedelta
import pandas as pd
from rescuetime.api.service import Service
from rescuetime.api.access import AnalyticApiKey
def get_apikey():
with open("apikey", "r") as fileo:
key = fileo.read()
return key
apikey = get_apikey()
def get_efficiency():
... |
import kfp
from kfp_server_api.rest import ApiException
_client = None
def _get_client(host=None):
global _client
if _client is None:
_client = kfp.Client()
return _client
def list_experiments(request):
c = _get_client()
experiments = [{"name": e.name,
"id": e.id}... |
# Copyright (c) 2015-2020, Swiss Federal Institute of Technology (ETH Zurich)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright... |
##############################################################################
#
# NAME: lfcmetrics.py
#
# FACILITY: SAM (Service Availability Monitoring)
#
# COPYRIGHT:
# Copyright (c) 2009, Members of the EGEE Collaboration.
# http://www.eu-egee.org/partners/
# Licensed under the Apa... |
#!/usr/bin/env python
# --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""
Demo script showing detections in sample i... |
"""
Remarks on Internal Packages Imports:
from snail.utils.GPLightCurve import GP_Interpolator, PhotGP, PhotBVColor
from snail.utils.SpecFPCA import FPCA_Parameterize, FPCA_Reconstruct
from snail.utils.SpecGSmooth import GSmooth, AutoGSmooth
from snail.utils.SyntheticPhot import SynPhot, Calculate_BmVof... |
# This module is very old and useless in this day and age! It will be
# removed in a few years (ie, 2009 or so...)
import warnings
warnings.warn("The regcheck module has been pending deprecation since build 210",
category=PendingDeprecationWarning)
import win32con
import regutil
import win32api
import os
impo... |
################################################################################
# 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... |
# 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, ... |
from dagster_mlflow import mlflow_tracking
from dagster_fusion import flight_fusion_io_manager, flight_fusion_resource
from .dataset_spec import dataset_properties
RESOURCES_LOCAL = {
"fusion_io_manager": flight_fusion_io_manager,
"fusion_client": flight_fusion_resource.configured({"host": "127.0.0.1", "port... |
"""
59.40%
其实是大数相加
"""
class Solution(object):
def addStrings(self, num1, num2):
"""
:type num1: str
:type num2: str
:rtype: str
"""
num1_index = len(num1) - 1
num2_index = len(num2) - 1
if num1_index < 0:
return num2
if num2_inde... |
import operator as op
import math
import random
import sys
def ncr(n, r):
r = min(r, n - r)
if r == 0:
return 1
numer = reduce(op.mul, xrange(n, n - r, -1))
denom = reduce(op.mul, xrange(1, r + 1))
return numer // denom
def run():
length = int(input("Length(-1 to quit): "))
if lengt... |
import os
import models.diff_token.args
def get_args():
parser = models.diff_token.args.get_args()
parser.add_argument('--dataset', type=str, default='ApacheDiffToken', choices=['ApacheDiffToken', 'SpringDiffToken'])
parser.add_argument('--mode', type=str, default='multichannel', choices=['rand', 'stati... |
# Copyright 2013 Google 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 by applicable law or ... |
# -*- coding: utf-8 -*-
from folium.elements import JSCSSMixin
from folium.features import GeoJson
from folium.map import Layer
from jinja2 import Template
class TimeSliderChoropleth(JSCSSMixin, Layer):
"""
Creates a TimeSliderChoropleth plugin to append into a map with Map.add_child.
Parameters
--... |
#!/usr/bin/env python3
#
# Copyright (c) 2020 unfoldingWord
# http://creativecommons.org/licenses/MIT/
# See LICENSE file for details.
#
# Contributors:
# Richard Mahn <rich.mahn@unfoldingword.org>
"""
This script generates the HTML and PDF SN-SQ documents
"""
import os
import re
import markdown2
import general_t... |
"""Interface to the base command ceph."""
from ceph.ceph_admin import CephAdmin
class CephCLI(CephAdmin):
"""Interface to the ceph CLI."""
|
from operator import itemgetter
class CatchTheBeatEasy:
def ableToCatchAll(self, x, y):
t, xx = 0, 0
for i, j in sorted(zip(x, y), key=itemgetter(1)):
if abs(i-xx) > j-t:
return 'Not able to catch'
else:
xx = i
t = j
re... |
from . import GIT
from . import functions
from . import root
from pathlib import Path
import datetime
import os
NONE, STAGED, CHANGED, UNTRACKED = 'none', 'staged', 'changed', 'untracked'
PREFIX = '_gitz_'
SAVE_FILE = Path('._gitz_save_.txt')
@root.run_in_root
def save(untracked=False, stash=True):
timestamp = d... |
from abc import abstractmethod
from math import ceil, log
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule, bias_init_with_prob
from mmcv.ops import CornerPool, batched_nms
from mmdet.core import multi_apply
from ..builder import HEADS, build_loss
from ..utils import ... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
SMS_CODE_REDIS_EXPIRES = 300 # 短信验证码有效期 300秒
SEND_SMS_CODE_INTERVAL = 60 # 短信是否发送过的标记 60秒 |
import os
from gen.javaLabeled.JavaLexer import JavaLexer
# try:
# import understand as und
# except ImportError as e:
# print(e)
from utilization.setup_understand import *
from antlr4 import *
from antlr4.TokenStreamRewriter import TokenStreamRewriter
from gen.javaLabeled.JavaParserLabeled import JavaParse... |
#!/usr/bin/env python
# encoding: utf-8
"""
This module generates documentation for a TextMate bundle by parsing the .tmCommand files.
FIXME: The formatting is slightly messed up (underlined links, extra table header, etc.)
FIXME: Also parse bash/ruby/perl scripts for docstring equivalents
FIXME: List tab-triggers
"""... |
"""
Script for training model on Keras.
"""
import argparse
import time
import logging
import os
import numpy as np
import random
import keras
from keras.models import load_model
from keras.callbacks import ModelCheckpoint
import mxnet as mx
from common.logger_utils import initialize_logging
from keras_.utils impo... |
# --------------------------------------------------------
# Pytorch Multi-GPU Faster R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Jiasen Lu, Jianwei Yang, based on code from Ross Girshick
# --------------------------------------------------------
from __future__ import absolute_import
... |
import uuid
from biolink_model_pydantic.model import ( #type: ignore
Protein,
Pathway,
ChemicalToPathwayAssociation,
Predicate,
)
from koza.cli_runner import koza_app #type: ignore
source_name="uniprot2reactome"
full_source_name="Reactome"
row = koza_app.get_row(source_name)
# Entities
protein = Pr... |
# -*- coding: utf-8 -*-
{
"A location that specifies the geographic area for this region. This can be a location from the location hierarchy, or a 'group location', or a location that has a boundary for the area.": "Uma localização que especifica a área geográfica para esta região. Pode ser uma localização da hierarq... |
"""imageNet URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Cl... |
#
# @lc app=leetcode id=572 lang=python3
#
# [572] Subtree of Another Tree
#
# https://leetcode.com/problems/subtree-of-another-tree/description/
#
# algorithms
# Easy (42.58%)
# Likes: 1444
# Dislikes: 55
# Total Accepted: 129.2K
# Total Submissions: 303.4K
# Testcase Example: '[3,4,5,1,2]\n[4,1,2]'
#
#
# Give... |
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
import src.config as con
FROM = con.MAIL
def sendMail(name, toaddr):
# instance of MIMEMultipart
filename = name.replace(" ", "_").lower()+'.pdf'... |
import torch
import torch.nn as nn
import torch.nn.functional as F
class cross_entropy_prob(nn.Module):
def __init__(self):
super(cross_entropy_prob, self).__init__()
def forward(self, pred, soft_targets):
pred = F.log_softmax(pred)
loss = torch.mean(torch.sum(- soft_targets * pred, 1... |
# Copyright 2015 NEC Corporation. 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 ... |
"""
Run the cross validation with greedy search for model selection using ICM-NMTF
on the Sanger dataset.
"""
import sys, os
project_location = os.path.dirname(__file__)+"/../../../../../"
sys.path.append(project_location)
import numpy, random
from BNMTF.code.models.nmtf_icm import nmtf_icm
from BNMTF.code.cross_val... |
# pyright: reportMissingImports=false
import os
import clr
import sys
import time
import platform
from PIL import Image
from .CypressFX import FX2
from .definitions import RSC_DIR, LIB_DIR, LED_WHITE
# load appropriate dll
(bits, linkage) = platform.architecture()
if bits == "64bit":
sys.path.append(os.path.join(... |
import os
import json
import sys
import traceback
import asyncio
import logging
from asyncio import subprocess, streams
PQPATH = os.path.dirname(__file__)
PROCESS_FILE = os.path.join(PQPATH, "cpubound.py")
LOGGER = logging.getLogger('pulsar.queue.cpubound')
class Stream:
'''Modify stream for remote logging
... |
# coding: utf-8
# Copyright (c) Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department
# Distributed under the terms of "New BSD License", see the LICENSE file.
from __future__ import print_function
import importlib
import inspect
import pkgutil
from six import with_metaclass
from... |
#
# 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"); you may not us... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from .layers.contrastive import ContrastiveLoss
from .layers.utils import l1norm, l2norm
from .layers.img_enc import EncoderImage
from .layers.txt_enc import EncoderText
class VisualSA(nn.Module):
"""
Build global image re... |
#!/home/michel/Desktop/Python-Django/Neighbourhood/virtual/bin/python3.6
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
|
#!/usr/bin/env python
#******************************************************************************
# $Id$
#
# Project: CFS OGC MapServer
# Purpose: Script to create WKT and PROJ.4 dictionaries for EPSG GCS/PCS
# codes.
# Author: Frank Warmerdam, warmerdam@pobox.com
#
#***************************... |
from datetime import datetime
from recurrence import Recurrence, Rule
import recurrence
def test_truthiness_with_single_rrule():
rule = Rule(
recurrence.DAILY
)
object = Recurrence(
rrules=[rule]
)
assert bool(object)
def test_truthiness_with_single_exrule():
rule = Rule(
... |
"""Hardening Importer - Import IronBank Hardening Manifests for builds.
This module provides tests for the models building argument strings for build
executors.
"""
import pytest
from hardening_importer.models import HardeningManifest
from .conftest import VALID_MANIFESTS
def test_build_args():
"""Test valid ... |
import sys
from .filter import SporFilter
def main(argv=None):
"""Run spor filter with specified command line args.
Args:
argv: Command-line arguments to use.
"""
return SporFilter().main(argv)
if __name__ == '__main__':
sys.exit(main())
|
# 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 may ... |
"""Console script for justice."""
import argparse
import pprint
import sys
from justice.justice import Justice
def main():
"""Console script for justice."""
pp = pprint.PrettyPrinter(indent=4)
parser = argparse.ArgumentParser()
parser.add_argument('-g', '--get', type=str, nargs='*')
parser.add_a... |
# 执行用时 : 432 ms
# 内存消耗 : 15.7 MB
# 方案:排序后 相邻两个最小的就是奇数
class Solution:
def arrayPairSum(self, nums: List[int]) -> int:
"""
:type nums: List[int]
:rtype: int
"""
nums.sort()
sum = 0
for i in range(0, len(nums), 2):
sum += nums[i]
return s... |
#!/usr/bin/env python
import urllib2
from threading import Thread
URL = 'http://localhost:8001'
class SiteRequest:
def __init__(self, x=10, suffixName='', tables=[]):
self.__x = x
self.__tables = tables
self.__suffixName = suffixName
def hit(self, hitCount):
for i in range(hi... |
import datetime
import os
import re
import unittest
from unittest import mock
from urllib.parse import parse_qsl, urljoin, urlparse
import pytz
from django.contrib.admin import AdminSite, ModelAdmin
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
from django.contrib.admin.models import ADDITION, DELETIO... |
# Licensed to the StackStorm, Inc ('StackStorm') 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"); you may not use th... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
# -*- coding: utf-8 -*-
"""
@author: 代码医生工作室
@公众号:xiangyuejiqiren (内有更多优秀文章及学习资料)
@来源: <PyTorch深度学习和图神经网络(卷 1)——基础知识>配套代码
@配套代码技术支持:bbs.aianaconda.com
Created on Sat Oct 19 20:03:44 2019
"""
from pathlib import Path #提升路径的兼容性
#引入矩阵运算相关库
import numpy as np
import pandas as pd
from scipy.sparse import ... |
from matrix_calculus import *
from matrix_calculus.matrix_massage import massage2canonical
from matrix_calculus.show_latex import show_latex
def main():
A = Variable("A")
B = Variable("B")
C = Variable("C")
D = Variable("D")
Y = Variable("Y")
X = Variable("X")
expr = Tr(A*X*B)
wrt = ... |
#
# This is the Robotics Language compiler
#
# Parameters.py: Definition of the parameters for this package
#
# Created on: 19 September, 2018
# Author: Gabriel Lopes
# Licence: license
# Copyright: copyright
#
from lxml import etree
def parse(text, parameters):
code = etree.Element("cpp")
co... |
"""implements splash screen
taken from http://code.activestate.com/recipes/534124-elegant-tkinter-splash-screen/
"""
import time
try:
import tkinter.tix as Tix
except ImportError: # Python 2
import Tix
class SplashScreen( object ):
def __init__( self, tkRoot, imageFilename, minSplashTime=0 ):
self._r... |
# Copyright (c) Materials Virtual Lab.
# Distributed under the terms of the BSD License.
import os
import unittest
from monty.serialization import loadfn
from atomate.qchem.drones import QChemDrone
from pymatgen.core.structure import Molecule
import numpy as np
from pymatgen.analysis.local_env import OpenBabelNN
from ... |
#!/usr/bin/env python3
# Copyright (c) 2021, AT&T Intellectual Property.
# All rights reserved.
#
# SPDX-License-Identifier: LGPL-2.1-only
from argparse import ArgumentParser
from vplaned import Controller
from vyatta import configd
import sys
arg_parser = ArgumentParser()
arg_parser.add_argument('--af', required=Tr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.