text stringlengths 2 999k |
|---|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from frappe import _
def get_data():
return [
{
"module_name": "Employee Document Expire",
"color": "grey",
"icon": "fa fa-book",
"type": "module",
"label": _("Employee Document Expire")
}
]
|
# -*- coding:utf-8 -*-
from extensions import celery
from tasks.worker import sse_worker, job_worker, grains_worker
@celery.task
def event_to_mysql(product):
sse_worker(product)
@celery.task
def job(period_id, product_id, user):
job_worker(period_id, product_id, user)
@celery.task
def grains(minion_list, ... |
# Copyright 2017 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... |
import os
import pytest
import astrodata
import gemini_instruments
from astrodata import testing
from gempy.utils import logutils
from recipe_system.reduction.coreReduce import Reduce
from recipe_system.utils.reduce_utils import normalize_ucals
@pytest.fixture(scope='module')
def get_master_arc(path_to_inputs, chan... |
import os
import resampy
import traceback
import sklearn.decomposition
import soundfile as sf
import numpy as np
from numbers import Real
import warnings
import keras
from edgel3.models import load_embedding_model
from edgel3.edgel3_exceptions import EdgeL3Error
from edgel3.edgel3_warnings import EdgeL3Warning
L3_TARG... |
def get_breadcrumb(cat3):
"""包装指定类别的面包屑"""
cat1 = cat3.parent.parent
# 给一级类别定义URL属性
cat1.url = cat1.goodschannel_set.all()[0].url
# 包装面包屑导航数据
breadcrumb = {
'cat1': cat3.parent.parent,
'cat2': cat3.parent,
'cat3': cat3
}
return breadcrumb
|
# this code allows the user to input their answers to the question given
from django.db import models
# Create your models here.
class Newbalance(models.Model):
username=models.CharField(max_length=200)
realname=models.CharField(max_length=200)
accountNumber=models.IntegerField(default=0)
balance=model... |
# This macro provides an example to convert a program to another program with joint splitting
# The joints extracted take into account the rounding effect.
from robodk.robolink import * # API to communicate with RoboDK
from robodk.robomath import * # Robot toolbox
from robodk.robodialogs import *
from robodk.robofile... |
"""firmwareupdate.py"""
# _author_ = Brian Shorland <bshorland@bluecatnetworks.com>
# _version_ = 1.03
import sys
import re
import os
import argparse
import requests
import urllib3
urllib3.disable_warnings()
def get_firmware_filename(chassis):
"""Given a chassis or idrac parameter
extract the release from th... |
import argparse
import os
from typing import Optional
from typing import Sequence
from all_repos import cli
from all_repos.config import load_config
def main(argv: Optional[Sequence[str]] = None) -> int:
parser = argparse.ArgumentParser(
description='List all cloned repository names.',
usage='all... |
""" Copyright chriskeraly
Copyright (c) 2019 Lumerical Inc. """
import numpy as np
import scipy as sp
import scipy.optimize as spo
from lumopt.optimizers.minimizer import Minimizer
class ScipyOptimizers(Minimizer):
""" Wrapper for the optimizers in SciPy's optimize package:
https://docs.scipy.o... |
alt=float(input('Qual a altura da parede?'))
larg=float(input('Qual a largura da parede?'))
area=alt*larg
print('A altura da parede é {}M e a largura é {}M, logo a área é {}m².'.format(alt,larg,area))
tinta=area/2
print('Você precisará usar {}L de tinta.'.format(tinta))
|
import unittest, datetime
from utils.generate_contacts import generate_unique_number, unique_numbers_array, dates_array
class TestGenerateContacts(unittest.TestCase):
def test_generate_unique_number(self):
numbers = [i for i in range(1000000000, 1000001000)]
self.assertNotIn(generate_unique_number(... |
import os
def map_path(directory_name):
return os.path.join(os.path.dirname(__file__), directory_name).replace('\\', '/')
DEBUG = True
SERVE_STATIC_MEDIA = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', #... |
#### 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 = Static()
result.template = "object/static/structure/general/shared_streetlamp_medium_red_style_01.iff"
result.att... |
# 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 ... |
from canvasapi.canvas_object import CanvasObject
from canvasapi.collaboration import Collaboration
from canvasapi.discussion_topic import DiscussionTopic
from canvasapi.folder import Folder
from canvasapi.exceptions import RequiredFieldMissing
from canvasapi.license import License
from canvasapi.paginated_list import P... |
from abc import ABCMeta, abstractmethod
class Book(object, metaclass=ABCMeta):
def __init__(self, title, author):
self.title = title
self.author = author
@abstractmethod
def display(self): pass
# Write MyBook class
class MyBook(Book):
def __init__(self, title, author, price):
... |
#!/bin/python
import json
import logging
import os
import sys
LOG = logging.getLogger(__name__)
LOG_FORMAT = '%(asctime)s %(levelname)-8s %(name)s:%(funcName)s [%(lineno)3d] %(message)s' # noqa
class TagGenExeception(Exception):
pass
def read_config(stream, env):
config = {}
try:
config['tag... |
from django.utils.deprecation import MiddlewareMixin
from online_users.models import OnlineUserActivity
class OnlineNowMiddleware(MiddlewareMixin):
"""Updates the OnlineUserActivity database whenever an authenticated user makes an HTTP request."""
@staticmethod
def process_request(request):
user... |
from nmigen import *
from nmigen.hdl.rec import *
from enum import Enum, unique
class SequencerControls(Record):
def __init__(self, name=None):
super().__init__(
Layout([
("dataBusSource", DataBusSource, DIR_FANOUT),
("dataBusDest", DataBusDestinatio... |
# -*- coding: utf-8 -*-
import sys
import uuid
from datetime import datetime
from decimal import Decimal
from elasticsearch.serializer import (
JSONSerializer,
Deserializer,
DEFAULT_SERIALIZERS,
TextSerializer,
)
from elasticsearch.exceptions import SerializationError, ImproperlyConfigured
from .test... |
"""Emoji
Available Commands:
.emoji shrug
.emoji apple
.emoji :/
.emoji -_-"""
import asyncio
from uniborg.util import admin_cmd
@borg.on(admin_cmd(pattern="emoji (.*)"))
async def _(event):
if event.fwd_from:
return
animation_interval = 0.3
animation_ttl = range(0, 16)
input_str = event.patt... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: target_info.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf... |
import unittest
class BuildDataTest(unittest.TestCase):
|
"""Tests for the apply_de_morgans transformation."""
import unittest
from tt.errors import InvalidArgumentTypeError
from tt.expressions import BooleanExpression
from tt.transformations import apply_de_morgans
class TestApplyDeMorgans(unittest.TestCase):
def assert_apply_de_morgans_transformation(self, original... |
'''
Module for using jyserver in Flask. This module provides to new
decorators.
Decorators
-----------
* @use
Link an application object to the Flask app
* @task
Helper that wraps a function inside a separate thread so that
it can execute concurrently.
Example
-------------
```html
<p id="time">TIME</... |
#!/usr/bin/env python
#
# Take a list of spliced genes (argv[1]) and a BED file for enriched bins (argv[2])
# and output a list for each spliced gene of: gene_name, is_clip_bound, clip_regions
#
import sys
clip_genes = {}
with open(sys.argv[2]) as f:
for line in f:
cols = line.strip().split('\t')
... |
'''
'''
import threading
import sys
from net import http_server_monitor
from http.server import HTTPServer,BaseHTTPRequestHandler
sys.path.append("..")
from util import csv2html
from hander import analyser
from hander import report_form
import time
class AnalyseThread(threading.Thread):
def __init__(self,name,de... |
from __future__ import print_function
import torch
x = torch.empty(5,3)
print(x)
print("x - ", x.dtype)
y = torch.rand(5,3)
print(y)
print("y - ", y.dtype)
z = torch.zeros(5,3, dtype=torch.long)
print(z)
print("z - ", z.dtype)
a = torch.tensor([5.5, 3])
print(a)
print("a - ", a.dtype)
b = x.new_ones(2,2) # new_* m... |
# tictactoe_ai.py
# A main game loop to play the computer
# in Connect Four
# Copyright 2018 David Kopec
#
# 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/LIC... |
# Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES.
# 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 requ... |
# Copyright 2011 OpenStack 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 l... |
import requests
from bs4 import BeautifulSoup
# tag = input("請輸入定位元素,class前面加上.,id前面加上# ")
res = requests.get('https://www.ptt.cc/bbs/nb-shopping/index.html')
soup = BeautifulSoup(res.text, "lxml")
search_page = int(input('請問要翻幾頁搜尋: ')) - 1
search_class = '[' + input('請問要找買or賣 (徵/賣)')
search_region = input('請輸入您要找的地... |
import torch
import torch_tensorrt.fx.tracer.acc_tracer.acc_ops as acc_ops
from parameterized import param, parameterized
from torch.testing._internal.common_utils import run_tests
from torch_tensorrt.fx.tools.common_fx2trt import AccTestCase
class TestClampConverter(AccTestCase):
@parameterized.expand(
[... |
# Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
from builtins import object
from bluebottle.activities.documents import ActivityDocument, activity
from bluebottle.funding.models import Funding, Donation
from bluebottle.initiatives.models import Initiative
from bluebottle.members.models import Member
SCORE_MAP = {
'open': 1,
'succeeded': 0.5,
'partially_... |
import os
import warnings
from pathlib import Path
import torch
from torchaudio._internal import module_utils as _mod_utils # noqa: F401
_LIB_DIR = Path(__file__).parent / 'lib'
def _get_lib_path(lib: str):
suffix = 'pyd' if os.name == 'nt' else 'so'
path = _LIB_DIR / f'{lib}.{suffix}'
return path
de... |
# flake8: noqa: F811, F401
import asyncio
import sys
from typing import Dict, List, Optional, Tuple
import aiosqlite
import pytest
from chia.consensus.block_header_validation import validate_finished_header_block
from chia.consensus.block_record import BlockRecord
from chia.consensus.blockchain import Blockchain
from... |
import string
import random
# generates a random string with numAlph alphabets and numNum numbers
def randomCode(numAlph,numNum):
code =""
for i in range(numAlph):
code += random.choice(string.ascii_uppercase)
for i in range(numNum):
code += random.choice(string.digits)
finalCode = ""... |
# Copyright 2018-2020 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fil... |
# -*- coding: utf-8 -*-
from collections import OrderedDict
from datetime import timedelta
from gluon import current, Field
from gluon.html import *
from gluon.storage import Storage
from gluon.validators import IS_EMPTY_OR, IS_NOT_EMPTY
from s3 import FS, IS_ONE_OF, S3DateTime, S3Represent, s3_auth_user_represent_... |
def read_pts(filename):
"""A helper function to read the 68 ibug landmarks from a .pts file."""
lines = open(filename).read().splitlines()
lines = lines[3:71]
landmarks = []
ibug_index = 1 # count from 1 to 68 for all ibug landmarks
for l in lines:
coords = l.split()
landmarks.... |
# Generated by Django 3.0.8 on 2020-08-05 06:05
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('blogapp', '0011_auto_20200805_1115'),
]
operations = [
migrations.AddField(
model_name='postdetails... |
# -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hs_tools_resource', '0009_auto_20160929_1543'),
]
operations = [
migrations.AlterField(
model_name='toolicon',
name='url',
fiel... |
# coding=utf-8
"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class AddOnResultTestCase(Integr... |
import sys
import os
import nest_asyncio
from trader.objects import WhatToShow
nest_asyncio.apply()
# in order to get __main__ to work, we follow: https://stackoverflow.com/questions/16981921/relative-imports-in-python-3
PACKAGE_PARENT = '../..'
SCRIPT_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), ... |
from tests.system.action.base import BaseActionTestCase
class MotionCommentSectionActionTest(BaseActionTestCase):
def test_update_correct_all_fields(self) -> None:
self.create_model("meeting/222", {"name": "name_xQyvfmsS"})
self.create_model(
"motion_comment_section/111", {"name": "nam... |
import base64
import datetime
import io
import dash
from dash.dependencies import Input, Output, State
import dash_core_components as dcc
import dash_html_components as html
import dash_table
import pandas as pd
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, externa... |
import os
import calendar
from datetime import datetime, timedelta
from django import forms
from django.conf import settings
from django.http import JsonResponse, Http404
from django.shortcuts import get_object_or_404, render, redirect
from django.views.decorators.http import require_http_methods
from django.contrib.a... |
import numpy as np
import matplotlib.pyplot as plt
import causality
CONFIG = {
'alpha': .7
}
def pretty_scatter(x, y, x_label=None, y_label=None, fname=None):
plt.scatter(x, y, alpha=CONFIG['alpha'])
if x_label:
plt.xlabel(x_label)
if y_label:
plt.ylabel(y_label)
if fname:
... |
import torch
import torch.nn as nn
from torch.nn.utils.rnn import pack_padded_sequence
import numpy as np
import matplotlib.pyplot as plt
class BiLSTM(nn.Module):
def __init__(self, embeddings, batch_size, hidden_size, device, num_layers=1):
super().__init__()
self.emb = nn.Embedding.from_pre... |
from pacfish.api.BaseAdapter import BaseAdapter
|
#!/usr/bin/env python
import cgi
import os
# INITIAL SETUP:
# 1. mkdir data
# 2. chmod o-xr data
# 3. echo 0 > data/count
# 4. change data_dir below
data_dir = '/home/bansheeweb/download.banshee-project.org/metrics/data/';
uploaded = False
form = cgi.FieldStorage()
if form.file:
# Read the current count
f =... |
'''OpenGL extension EXT.draw_buffers2
This module customises the behaviour of the
OpenGL.raw.GL.EXT.draw_buffers2 to provide a more
Python-friendly API
Overview (from the spec)
This extension builds upon the ARB_draw_buffers extension and provides
separate blend enables and color write masks for each c... |
from .utils.utilities import (
get_pokemon_info,
choose_best_moveset,
randomly_choose_moveset,
manually_choose_moveset,
choose_first_four_moves_for_now,
)
from .move import Move
class Pokemon:
"""
A pokemon is a class that represents a pokemon.
"""
def __init__(self, poke_id):
... |
#!/usr/bin/env python
import isambard_dev,sys,subprocess,re, os
from ast import literal_eval
def pymol_align_protein2model(mobile,target,out_pdb,ampal_out=True):
pymol_command = ['pymol','-qc','align_protein2model.py','--',mobile,target,out_pdb]
if ampal_out == True:
subprocess.check_output(pymol_command)
protei... |
"""Functions to plot ICA specific data (besides topographies)
"""
from __future__ import print_function
# Authors: Denis Engemann <denis.engemann@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Teon Brooks <teon.brooks@gmail.com>
#
# License: Simplified BSD
from functools... |
import logging
class DuplicateLogFilter(logging.Filter):
"""
This filter prevents duplicate messages from being printed repeatedly.
Adapted from https://stackoverflow.com/a/44692178/1483986
"""
def filter(self, record):
# add other fields if you need more granular comparison, depends on you... |
import os
import tarfile
import fnmatch
import shutil
def extract_directory(fname):
directory = os.path.abspath(os.path.dirname(fname))
tar = tarfile.open(fname)
tar.extractall(directory)
tar.close()
return directory
def find_mefd(directory):
mefd_files = []
for tmpsess in os.listdir(dire... |
from django import forms
from django.contrib.auth import authenticate
from django.contrib.auth.hashers import make_password
from users.models import User, Avatar
class RegistrationForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(RegistrationForm, self).__init__(*args, **kwargs)
f... |
from django.apps import AppConfig
class ProducersConfig(AppConfig):
name = 'producers'
|
# Copyright 2012, Nachi Ueno, NTT MCL, 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 applic... |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Script to generate list of seed nodes for chainparams.cpp.
This script expects two text files in the dir... |
"""
Provides a base module for defining generic modeling logic
"""
import time
from MySQLdb import OperationalError
from flickipedia.config import log, schema
from flickipedia.mysqlio import DataIOMySQL
NUM_SQL_RETRIES = 5
RET_TYPE_ALLROWS = 'allrows'
RET_TYPE_COUNT = 'count'
RET_TYPE_FIRSTROW = 'firstrow'
class B... |
import numpy as np
from PIL import Image, ImageDraw
from keras.preprocessing import image
from keras.applications.vgg16 import preprocess_input
import cv2
import cfg
from network import East
from preprocess import resize_image
from nms import nms
import os
def sigmoid(x):
"""`y = 1 / (1 + exp(-x))`"""
return ... |
# -*- coding: UTF-8 -*-
# !/usr/bin/python
# @time :2019/5/18 23:51
# @author :Mo
# @function :classify text of bert and (text-cnn、r-cnn or avt-cnn)
from __future__ import division, absolute_import
from keras.objectives import sparse_categorical_crossentropy, categorical_crossentropy
from conf.path_con... |
from flask import Flask,render_template,jsonify,request
import keras
from keras.models import load_model
from preprocessing import detect_and_resize
import cv2 as cv
import pickle
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from keras.preprocessing.image import img_to_array
app = Flask(__nam... |
import os
import json
class GDocMappings:
def __init__(self, path):
self.path = path
if os.path.exists(path):
with open(path) as json_file:
data = json.load(json_file)
self.title_to_id = data['title_to_id']
self.id_to_title = data['id_to_t... |
# $Id: dlm_generated.py 65381 2017-01-20 09:23:53Z vboxsync $
import sys, cPickle, re
sys.path.append( "../glapi_parser" )
import apiutil
# A routine that can create call strings from instance names
def InstanceCallString( params ):
output = ''
for index in range(0,len(params)):
if index > 0:
output += ", "
... |
from setuptools import setup, find_packages
from codecs import open
from os import path
import maybe
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:
long_description = f.read()
setup(
name='python-may... |
from django.shortcuts import render
def index(request):
return render(request, "logicielsapplicatifs/index.html")
|
import csv
import os
from collections import defaultdict
from scipy import stats
import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import scipy
import numpy as np
from matplotlib import rc, rcParams
rc('axes', linewidth=1)
rc('font', weight='bold', size=20)
from correlation i... |
from typing import Dict
from typing import Optional
from typing import Tuple
import torch
import torch.nn.functional as F
from typeguard import check_argument_types
from espnet.nets.pytorch_backend.nets_utils import make_pad_mask
from espnet2.lm.abs_model import AbsLM
from espnet2.torch_utils.device_funcs import forc... |
# coding=utf-8
import json
import time
import falcon
from ..db import db
from ..vpn import Keys
from ..vpn import disconnect_client
class GenerateOVPN(object):
def on_post(self, req, res):
"""
@api {post} /ovpn Get OVPN file data.
@apiName GenerateOVPN
@apiGroup VPN
@apiP... |
from __future__ import absolute_import
from clims.services.substance import SubstanceBase
from clims.services.project import ProjectBase
from clims.services.extensible import FloatField, TextField
from clims.services.container import PlateBase
from clims.services.workbatch import WorkBatchBase
from clims.configuration.... |
def partition( nums, left, right):
low = left
while left < right:
if nums[left] < nums[right]:
nums[left], nums[low] = nums[low], nums[left]
low += 1
left += 1
nums[low], nums[right] = nums[right], nums[low]
return low
def find_kth_element( nums, k):
if num... |
from game.shared.color import Color
FRAME_RATE = 12
MAX_X = 900
MAX_Y = 600
CELL_SIZE = 15
FONT_SIZE = 20
PLAYER_SIZE = 25
GEM_SIZE = 25
ROCK_SIZE = 27
CENTER = "center"
COLS = 60
ROWS = 40
CAPTION = "Greed"
WHITE = Color(255, 255, 255)
DEFAULT_ARTIFACTS = 20
DEFAULT_ARTIFACTS2 = 20
INIT_NUM_ROCKS = 20
INIT_NUM_GEMS ... |
# Copyright 2018 The TensorFlow Probability 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 law o... |
import os
import logging
import boto3
from botocore.exceptions import ClientError
from PIL import Image
import smtplib
import imghdr
from email.message import EmailMessage
import hybrid
#upload
def upload_file(file_name, bucket, object_name=None):
if object_name is None:
object_name = file_name
# Up... |
import socket
s = socket.socket()
ip = "192.168.43.34"
port = 1234
s.connect((ip, port))
s.recv(100)
s.send(b'Im client')
|
#! /n/local_linux/epd/bin/python2.7
#
# /usr/local/bin/python -> python3.2
# NOTE: this uses python before vers 3
# newer versions use print as function not statement
#
# for vers 3 lanl machines /usr/bin/env python
# for sgi /usr/lanl/bin/python
#---------------------------------------------------------------... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import platform
import sympy
import mpmath
import numpy
from mathics.version import __version__
version_info = {
"mathics": __version__,
"sympy": sympy.__version__,
"mpmath": mpmath.__version__,
"numpy": numpy.__version__,
"python": platfo... |
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import base64
import binascii
import time
import logging
logging.Logger.manager.emittedNoHandlerWarning = 1
from logging.config import fileConfig
try:
from logging.config import dictConf... |
#
# -------------------------------------------------------------------------
# Copyright (c) 2019 AT&T Intellectual Property
#
# 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
#
# ... |
import torch.nn as nn
import torch
import numpy as np
from time import time
from ..utils import *
from ..utils import *
class CQT1992(nn.Module):
"""
This alogrithm uses the method proposed in [1], which would run extremely slow if low frequencies (below 220Hz)
are included in the frequency bins.
Plea... |
""" Test script that uses two GPUs, one per sub-process,
via the Python multiprocessing module. Each GPU fits a logistic regression model. """
# These imports will not trigger any theano GPU binding
from multiprocessing import Process, Manager
import numpy as np
import os
def f(shared_args,private_args):
""" B... |
from specialDelimiter import parse_string_by_keys
import pytest
@pytest.fixture
def data():
text = "AAA Version : 1.0.0.21 BBB Info : XXX00001 CCC Data : A1.01.010203 DDD Version : EEE Info : 0.1.0.4 FFF Data : 1.0.0.11"
keys = ["AAA Version", "BBB Info", "CCC Data",
"DDD Version", "EEE Info", "F... |
# Copyright 2021 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... |
import datetime
import jinja2
from pptxtpl.PptxDocument import PptxDocument
data = {"product": "Pptx-tpl", "version": "1.0.0"}
jinja_env = jinja2.Environment()
jinja_env.globals["now"] = datetime.datetime.now
doc = PptxDocument("sample/sample.pptx")
doc.render(data, jinja_env)
doc.save("sample/output.pptx")
|
# Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM 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... |
from __future__ import print_function
from builtins import object
from builtins import str
from typing import Dict
from empire.server.common import helpers
from empire.server.common.module_models import PydanticModule
from empire.server.utils import data_util
from empire.server.utils.module_util import handle_error_m... |
# -*- coding: utf-8 -*-
#
# Microchip Peripheral I/O documentation build configuration file, created by
# sphinx-quickstart on Tue Jun 20 16:56:25 2017.
#
# 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
# autogene... |
#!/bin/sh
""":"
python_cmd="python"
python3 -c "from FWCore.PythonFramework.CmsRun import CmsRun" 2>/dev/null && python_cmd="python3"
exec ${python_cmd} $0 ${1+"$@"}
"""
import sys, os
sys.path.insert(0, os.path.join( os.path.dirname(os.path.abspath(__file__)), '..', 'python'))
import FWCore.ParameterSet.Config a... |
from . import boreholes
from . import gfunction
from . import heat_transfer
from . import load_aggregation
from . import media
from . import networks
from . import pipes
from . import utilities
|
"""Example of constrained optimization of the Rosenbrock function.
Global minimum at f(1., 1.) = 0.
"""
import logging
import numpy as np
import matplotlib.pyplot as plt
from modestga import con_minimize
from modestga.benchmark.functions.rosenbrock import rosenbrock_2par
from modestga.benchmark.functions.rosenbrock im... |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... |
internal = input()
cites_dict = {}
while internal.lower() != 'ready'.lower():
pair = internal.split(':')
city_name = pair[0]
if city_name not in cites_dict:
cites_dict[city_name] = {}
for transport in pair[1].split(','):
transport = transport.split('-')
transport_type = transpor... |
from xnd_tools.kernel_generator.readers import PrototypeReader
def test_PrototypeReader():
source = '''
int foo ();
int foo (void);
int foo( void /* hello */);
int foo (int a, float * a, long, double *);
int foo (int a , float *a , long, double*);
int foo (int a, float * a, long, doub... |
import os
from airflow.models import DagBag
FILE_DIR = os.path.abspath(os.path.dirname(__file__))
def test_dag_loads_with_no_errors(tmpdir):
tmp_directory = str(tmpdir)
dag_bag = DagBag(dag_folder=tmp_directory, include_examples=False)
dag_bag.process_file(
os.path.join(FILE_DIR, 'refresh_all_ima... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.