text stringlengths 1 927k |
|---|
#!/usr/bin/env python3
# Copyright (c) 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 account RPCs.
RPCs tested are:
- getaccountaddress
- getaddressesbyaccount
- listaddr... |
from bson.json_util import dumps
from ..app import app
from json import dumps as pretty
class glo:
patient_id = []
g = glo()
userid = ['1k33224', '60961d77a7090edb5b69c62c']
patient = {
'name': 'Abhishek shrivastava',
'age': 19,
'gender': 'M',
'mobile': '9022930339'
}
patient2 = {
'name': ... |
# Generated by Django 3.2.8 on 2021-11-05 00:54
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('main', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='project',
name='created_date',
),
] |
# Define here the models for your spider middleware
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/spider-middleware.html
from scrapy import signals
# useful for handling different item types with a single interface
from itemadapter import is_item, ItemAdapter
class NewsScraperChallengeSpiderM... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import pytest
import numpy as np
asdf = pytest.importorskip('asdf', minversion='2.0.0.dev0')
from asdf import util
from asdf.tests import helpers
from ..subarray import Subarray
def test1(tmpdir, ret=False):
subarray = Subarr... |
# Copyright 2017 Battelle Energy Alliance, 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 agreed t... |
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 9 18:52:56 2019
@author: Emmanuel-Temitope
"""
import os
import time
#location of directory
source = [r'source', '"Another source"']
#targer directory
target_dir = r'target'
if not os.path.exists(target_dir):
os.mkdir(target_dir)
today = target_dir + os.sep ... |
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 5 22:53:44 2020
@author: Emmett
"""
import tensorflow as tf
import os
from tensorflow.python.keras.layers import Layer
from tensorflow.python.keras import backend as K
class AttentionLayer(Layer):
"""
This class implements Bahdanau attention (https://arxiv.org/... |
from __future__ import absolute_import
import cbapi.six
__title__ = 'cbapi'
__author__ = 'Carbon Black Developer Network'
__license__ = 'MIT'
__copyright__ = 'Copyright 2018 Carbon Black'
__version__ = '1.3.6'
# New API as of cbapi 0.9.0
from cbapi.response.rest_api import CbEnterpriseResponseAPI, CbResponseAPI
from... |
import asyncio
import itertools
import logging
import time
from .telegrambaseclient import TelegramBaseClient
from .. import errors, utils
from ..tl import TLObject, TLRequest, types, functions
__log__ = logging.getLogger(__name__)
_NOT_A_REQUEST = TypeError('You can only invoke requests, not types!')
class UserMet... |
'''
A script to try and reset from a stage error
without having to turn off the dobot
'''
import sys
import os
sys.path.append(os.path.abspath('..'))
import connecting
#connect
bot = connecting.connect()
bot.reset_pose(1,45,45) # 0 is false, will try to automatically reset?
bot.clear_alarms_state()
bot.serial.close(... |
# Copyright (c) Microsoft Corporation
# All rights reserved.
#
# MIT License
#
# 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 ... |
# coding: utf8
from __future__ import unicode_literals
from collections import OrderedDict
from .symbols import NOUN, VERB, ADJ, PUNCT, PROPN
from .errors import Errors
from .lookups import Lookups
from .parts_of_speech import NAMES as UPOS_NAMES
class Lemmatizer(object):
"""
The Lemmatizer supports simple ... |
#!/usr/bin/env python3
import argparse
import copy
import datetime
#from firecloud import fiss
import json
import operator
import subprocess
import sys
import time
#print(fiss.meth_list(args=argparse.Namespace()))
import firecloud.api as fapi
SEL_NAMESPACE='um1-encode-y2s1'
SEL_WORKSPACE='selection-sim'
#dir(fapi)... |
from __future__ import unicode_literals
from django.apps.registry import apps as global_apps
from django.db import migrations
from .exceptions import InvalidMigrationPlan
from .loader import MigrationLoader
from .recorder import MigrationRecorder
from .state import ProjectState
class MigrationExecutor(object):
... |
from unittest import TestCase
from unittest.mock import patch
from dataclasses import dataclass
import yaml
from ..conf import (
get_config,
Namespace,
)
SRC = 'bat.conf'
EXAMPLE_CONFIG_YAML = '''
default: example
example:
bat:
key: value
remote_host:
api_key: example_api_... |
from . import clans, databases, entries, proteins, proteomes, structures, taxa
from . import utils |
import datetime
import python_jwt as jwt
import jwcrypto.jwk as jwk
def run():
key = jwk.JWK.generate(kty='RSA', size=2048)
# User API
payload = { "iss": "fusionauth.io",
"aud": "238d4793-70de-4183-9707-48ed8ecd19d9",
"sub": "19016b73-3ffa-4b26-80d8-aa9287738677",
... |
from sqlalchemy import Column, ForeignKey, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from pprint import pprint
# Create an engine that stores data in the local directory's
... |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ...testing import assert_equal
from ..io import DataGrabber
def test_DataGrabber_inputs():
input_map = dict(base_directory=dict(),
ignore_exception=dict(nohash=True,
usedefault=True,
),
raise_on_empty=dict(usedefault=True,
),
sort_... |
import os
from typing import List, Tuple, Dict
import face_recognition
from matplotlib import pyplot, patches
from PIL import Image
import numpy as np
from balticlsc.access.ftp import upload_file, get_connection
from balticlsc.configs.credential.ftp import FTPCredential
from balticlsc.scheme.api import init_baltic... |
#coding:utf-8
import torch
from learner_util import get_ner_BIO
class Metric(object):
def __call__(self,
predictions,
gold_labels,
mask=None):
"""
metric的抽象类
:params predictions 预测结果的tensor
:params gold_labels 实际结果的tensor
... |
(lambda a:print("Best student: {1} {2}\nBest mark: {0}".format(*max([line.split()for line in open(a,'r')],key=lambda x:int(x[0]))))if __import__('os').path.isfile(a)else print("ERROR: File not found! " + a))(__import__('sys').argv[1]) |
import re
import sys
import json
import getopt
import collections
from datetime import datetime
from collections import defaultdict
### Given RPI ColdStart input, the Entity strings JSON file, and the String strings JSON file, produces the events JSON file. ###
def main(argv):
opts, _ = getopt.getopt(argv,"hi:e:s:... |
"""
@Author: huuuuusy
@GitHub: https://github.com/huuuuusy
系统: Ubuntu 18.04
IDE: VS Code 1.36
工具: python == 3.7.3
"""
"""
思路:
代码简单,但是关键是理解题意:
注意题目中的独有两个字:
s1 = 'ab',s2 = 'a',因为ab是s1独有,所以最长子序列为ab;
s1 = 'ab', s2 = 'ab', 因为ab是两个串都有,ab排除,a也是两个串都有,排除,b也是两个串都有,排除。所以最长特殊序列不存在,返回-1;
通过以上分析,我们可以得出... |
# ******************************************************************************
# pysimm.apps.random_walk module
# ******************************************************************************
#
# psuedo random walk algorithm written using pysimm tools
#
# *************************************************************... |
from django.db import transaction
from django.http import JsonResponse, HttpResponseNotAllowed
from django.views.decorators.csrf import csrf_exempt
from .models import Photo
def list_photos(request):
if request.method == 'GET':
photos = Photo.objects.all().order_by('unsplash_id')
return JsonRespo... |
from enum import Enum, auto
class Constraints(Enum):
not_empty = auto()
greater_than_0 = auto()
not_null = auto()
is_email = auto()
is_uri = auto()
after_now = auto()
before_now = auto() |
#!/usr/bin/env python
# -*- coding: utf-8; py-indent-offset:4 -*-
###############################################################################
#
# Copyright (C) 2015, 2016, 2017 Daniel Rodriguez
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Li... |
#
# Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
#
from abc import ABCMeta, abstractmethod, abstractproperty
from eventlet import greenthread
from neutron.common import exceptions as n_exc
from neutron.extensions import loadbalancer
from neutron.plugins.common import constants
from vnc_api.vnc_api im... |
import numpy as np
import networkx as nx
from opensfm import io
from opensfm import pygeometry
from opensfm import reconstruction
from opensfm import pysfm
def test_track_triangulator_equirectangular():
"""Test triangulating tracks of spherical images."""
tracks_manager = pysfm.TracksManager()
tracks_man... |
from ..remote import RemoteModel
class DeviceViewerOpenServicesGridRemote(RemoteModel):
"""
| ``id:`` none
| ``attribute type:`` string
| ``DeviceID:`` none
| ``attribute type:`` string
| ``DataSourceID:`` none
| ``attribute type:`` string
| ``ipaddress:`` none
| ``at... |
"""
Unit tests for the sas_gen
"""
import os.path
import warnings
warnings.simplefilter("ignore")
import unittest
import numpy as np
from sas.sascalc.calculator import sas_gen
def find(filename):
return os.path.join(os.path.dirname(__file__), 'data', filename)
class sas_gen_test(unittest.TestCase):
def ... |
#!/usr/bin/env python
# Helpful little script that spits out a comma-separated list of
# language codes for Qt icons that should be included
# in binary transfer distributions
import glob
import os
import re
import sys
if len(sys.argv) != 3:
sys.exit("Usage: %s $QTDIR/translations $FreedomcoinDIR/src/qt/locale"%sy... |
#!/usr/bin/env python
"""
Copyright (c) 2017-2019 ARM Limited. All rights reserved.
SPDX-License-Identifier: Apache-2.0
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/licen... |
import os
import os.path as osp
import cv2
import logging
import argparse
import motmetrics as mm
import torch
from tracker.multitracker import JDETracker
from utils import visualization as vis
from utils.log import logger
from utils.timer import Timer
from utils.evaluation import Evaluator
from utils.parse_config imp... |
import datetime as dt
import sys
import matplotlib
import taiga_stats.constants as c
matplotlib.use("TkAgg") # Reference: https://stackoverflow.com/a/48374671/265508
DOT_HEADER_FMT = """digraph {:s} {{
labelloc="t";
//labelfontsize="40"
label="{:s}";
//size="7.5,10"
ratio="compress"
//orientation=land... |
# Copyright (c) 2012-2022, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
def validate_listenertls_mode(listenertls_mode):
"""
Validate Mode for ListernerTls
Property: ListenerTls.Mode
"""
VALID_LISTENERTLS_MODE = ("STRICT", "PERMISSIVE", "DISABLED")
... |
import argparse
from .base import BaseRunner
from .terminal import Terminal
__all__ = (
'BaseRunner',
'Terminal',
)
__version__ = '1.4.1'
lang_map = {
'python': 'ai.backend.kernel.python.Runner',
'c': 'ai.backend.kernel.c.Runner',
'cpp': 'ai.backend.kernel.cpp.Runner',
'golang': 'ai.backend... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
__version__ = '1.13.45'
# -----------------------------------------------------------------------------
import asyncio
import concurrent
import socket
import time
import math
import random
import certifi
import a... |
import urllib.request
from bs4 import BeautifulSoup
from time import sleep
import json
import hashlib
import os
from PIL import Image
import glob
files = glob.glob("tmp/*.json")
rows = []
rows.append(["ID", "Original", "Thubmnail", "Width", "Height"])
for file in sorted(files):
filename = file.split("/")[-1]
... |
# import Kratos
from KratosMultiphysics import *
from KratosMultiphysics.IgaApplication import *
import run_cpp_unit_tests
import KratosMultiphysics.kratos_utilities as kratos_utilities
# Import Kratos "wrapper" for unittests
import KratosMultiphysics.KratosUnittest as KratosUnittest
# Import Iga test factory tests
f... |
#!/usr/bin/env python3
# Copyright (c) 2019 Pieter Wuille
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Utility functions related to output descriptors"""
INPUT_CHARSET = "0123456789()[],'/*abcdefgh@:$%{}IJKLMNOPQRSTUVWXYZ&+-... |
import logging
import sys
import os
logging.basicConfig(
level=logging.getLevelName(os.getenv("LOG_LEVEL") or "INFO"),
format="[%(asctime)s] [%(levelname)s] %(message)s",
handlers=[logging.StreamHandler(sys.stdout)],
)
logger = logging.getLogger() |
#
# Privilege Escalation Exploit for hackTheBox October
#
# From IppSec https://youtu.be/K05mJazHhF4
#
from subprocess import call
import struct
# libc base address using:
# ldd /usr/local/bin/ovrflw | grep libc
libc_base_addr = 0xb75e0000
# readelf -s /lib/i386-linux-gnu/libc.so.6 | grep system
system_off = 0x... |
"""Support for performing EdgeTPU classification on images."""
import logging
import voluptuous as vol
from homeassistant.components.image_processing import (
CONF_ENTITY_ID, CONF_NAME, CONF_SOURCE, PLATFORM_SCHEMA,
ImageProcessingEntity)
from homeassistant.core import split_entity_id
from homeassistant.helpe... |
from __future__ import unicode_literals, division, absolute_import
import logging
from datetime import datetime, timedelta
from flexget.utils.simple_persistence import SimplePersistence
from flexget.event import event
log = logging.getLogger('db_vacuum')
VACUUM_INTERVAL = timedelta(weeks=24) # 6 months
# Run after t... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Mikhail Yohman (@FragmentedPacket)
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
"metadata_ver... |
# Some notes about static linking:
# There are two ways of linking to static library: using the -l command line
# option or specifying the full path to the library file as one of the inputs.
# When using the -l option, the library search paths will be searched for a
# dynamic version of the library, if that is not foun... |
import sys
class SimpleProgressBar:
def __init__(self):
self.displayed = False
def update(self, percent):
self.displayed = True
bar_size = 40
percent *= 100.0
if percent > 100:
percent = 100.0
dots = int(bar_size * percent / 100)
plus = percent / 100 * bar_size - dots
if plus > 0.8:
plus = '='
... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
from allennlp.predictors.predictor import Predictor
# ## Instantiate AllenNLP `Predictor`
# 1. Load the same model that is used in the [demo](https://demo.allennlp.org/coreference-resolution) (*don't get alarmed by the warning - we don't need to fine-tune the model t... |
#!"f:\opencv projects\tesseract ocr\venv\scripts\python.exe"
# EASY-INSTALL-ENTRY-SCRIPT: 'future==0.18.2','console_scripts','futurize'
import re
import sys
# for compatibility with easy_install; see #2198
__requires__ = 'future==0.18.2'
try:
from importlib.metadata import distribution
except ImportError:
try... |
# Copyright 2010 ITA Software, 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 wr... |
"""Manually build a mesh from points and faces"""
from vedo import Mesh, printc, show
verts = [(50,50,50), (70,40,50), (50,40,80), (80,70,50)]
faces = [(0,1,2), (2,1,3), (1,0,3)]
# (the first triangle face is formed by vertex 0, 1 and 2)
# Build the polygonal Mesh object:
mesh = Mesh([verts, faces])
mesh.backColor('v... |
"""Tests for the statsd component.""" |
from django.dispatch import receiver
from django.db.models.signals import post_save
from .models import Profile
from django.contrib.auth.models import User
@receiver(post_save, sender=User)
def create_user_profile(sender, instance, created, **kwargs):
if created:
Profile.objects.create(user=instance)
@re... |
import ast
import json
import readline
from cliff.command import Command
import call_server as server
class EnvironmentShell(Command):
def get_parser(self, prog_name):
parser = super(EnvironmentShell, self).get_parser(prog_name)
parser.add_argument(dest='env_name',
h... |
from functools import partial
from typing import List, Union, Callable
import torch
from pytorch_toolbelt.modules import ABN, ACT_RELU, ACT_SWISH
from pytorch_toolbelt.modules import encoders as E
from pytorch_toolbelt.modules.decoders import DecoderModule
from pytorch_toolbelt.modules.encoders import EncoderModule
fr... |
# Copyright 2004-2019 Tom Rothamel <pytom@bishoujo.us>
#
# 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, m... |
from __future__ import absolute_import, division, print_function, unicode_literals
from echomesh.base import MakeEmptyProject
from echomesh.base import Platform
import getpass
import os
import os.path
import sys
ECHOMESH_EXTERNALS_OVERRIDE_SYSTEM_PACKAGES = True
# If this is True, you want Echomesh to use its own ex... |
import logging
import os
import select
import SimpleHTTPServer
import socket
import SocketServer
import threading
HERE = os.path.dirname(__file__)
logger = logging.getLogger(__name__)
class ThisDirHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def translate_path(self, path):
path = path.split('?', 1... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-06-10 08:47
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
... |
# 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 ... |
# /usr/bin/env python
# coding=utf-8
from pylinux.common.file_config.rc_local_file_config import RcLocalFileConfig
from pylinux.common.modifier.rc_local_modifier import RcLocalModifier
from pylinux.common.acessor.rc_local_accessor import RcLocalAccessor
from pylinux.system_file.base_system_file import BaseSystemFile
f... |
from django.shortcuts import render
from mcstatus import MinecraftServer
from MinecraftServer.models import MCServer, Admin
# Create your views here.
def index(request):
server = []
status = []
servers = MCServer.objects.all()
for srv in servers:
server.append(srv)
try:
if s... |
# listbox.py Extension to ugui providing the Listbox class
# Released under the MIT License (MIT). See LICENSE.
# Copyright (c) 2021 Peter Hinch
# 12 Sep 21 Support for scrolling.
from gui.core.ugui import Widget, display
from gui.core.colors import *
dolittle = lambda *_ : None
# Behaviour has issues compared to ... |
# Copyright 2014 Cloudbase Solutions Srl
#
# 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... |
from rest_framework import serializers
from django.contrib.auth import get_user_model
from .models import BorrowedBook
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = get_user_model()
fields = ['id', 'email', 'first_name', 'last_name', 'phone']
class BorrowedBookSerializer(s... |
#!/usr/bin/env python
"""
Distutils setup file, used to install or test 'setuptools'
"""
import io
import os
import sys
import textwrap
# Allow to run setup.py from another directory.
os.chdir(os.path.dirname(os.path.abspath(__file__)))
src_root = None
from distutils.util import convert_path
command_ns = {}
init_p... |
"""utilization URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/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')
Class-b... |
import setuptools
setuptools.setup(
name='z5-tracker',
version='1.2.1',
author='Feneg',
description='Helper program for Ocarina of Time randomiser',
url='https://www.github.com/feneg/z5-tracker',
packages=setuptools.find_packages(),
include_package_data=True,
classifiers=[
'Deve... |
"""
This module contains all forms used in the teacher Views
"""
from django import forms
from django.forms import HiddenInput, MultipleHiddenInput
from django.urls import reverse_lazy
from django_addanother.widgets import AddAnotherWidgetWrapper
from django_select2.forms import ModelSelect2MultipleWidget
from stea... |
# -*- coding: utf-8 -*-
from cms.models import Page
from cms.test_utils.util.context_managers import (UserLoginContext,
SettingsOverride)
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import r... |
# 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 Xrootd(CMakePackage):
"""The XROOTD project aims at giving high performance, scalable fau... |
"""
provide global explanation methods
author: Xiaoqi
date: 2019.10.29
"""
from .feature_importance import *
from .shap_explainer import ShapExplainer
class GlobalExplainer(object):
def __init__(self, x_train, y_train, model):
"""
Initialize a feature global explainer
:param x_train: inpu... |
# Copyright 2017 The Abseil 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 or agreed to in ... |
#!/usr/bin/env python
from anti_viral_protocol import main
main.run() |
import asyncio
import sys
from urllib.parse import urlparse, parse_qsl
from .log import logger
_NOTSET = object()
IS_PY38 = sys.version_info >= (3, 8)
# NOTE: never put here anything else;
# just this basic types
_converters = {
bytes: lambda val: val,
bytearray: lambda val: val,
str: lambda val:... |
# Import libraries
import numpy as np
print('imported numpy')
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
from sklearn.externals import joblib
import pandas as pd
#Otsustuspuud
from sklearn.tree import DecisionTreeClassifier
print('imported all')
data_tabl... |
config = {
"interfaces": {
"google.ads.googleads.v6.services.SearchTermViewService": {
"retry_codes": {
"retry_policy_1_codes": [
"UNAVAILABLE",
"DEADLINE_EXCEEDED"
],
"no_retry_codes": []
},
"retry_params": {
"retry_policy_1_params": {
... |
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import re
from pants.testutil.pants_integration_test import (
ensure_daemon,
run_pants_with_workdir,
temporary_workdir,
)
from pants.util.contextutil import overwrite_file_con... |
import sys
sys.path = [sys.argv[7] + '/lib/vista'] + sys.path
from OSEHRAHelper import ConnectToMUMPS,PROMPT
VistA=ConnectToMUMPS(sys.argv[1],sys.argv[3],sys.argv[4])
if (sys.argv[5] and sys.argv[6]):
VistA.login(sys.argv[5],sys.argv[6])
if VistA.type=='cache':
try:
VistA.ZN(sys.argv[4])
except IndexError,n... |
import math
import os
import queue
import random
import threading
import time
from pprint import pprint
from networkx import DiGraph
from Node import Switch
class my_thread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.flow_queue = []
def run(self) -> None:
... |
'''
Crie uma tupla preenchida com os 20 times do brasileirão da série A na ordem de colocação.
Depois mostre:
a: Os 5 primeiros colocados
b: Os últimos 4 colocados
c: times em ordem alfabética
d: em que posição está o time da Chapecoense?
'''
times = ('Corinthians', 'Palmeiras', 'Santos', 'Grêmio', 'Cruzeiro', 'Flamen... |
import io
import json
import zipfile
from functools import cached_property
from typing import Callable, Dict, KeysView, List, NamedTuple, Set, Union
import requests
from django.contrib import messages
from django.contrib.auth.mixins import UserPassesTestMixin
from django.core.exceptions import ObjectDoesNotExist, Susp... |
import PyQt4
from PyQt4 import QtCore, QtGui
from PyQt4.Qt import Qt
from PyQt4.QtCore import QObject, QTimer, pyqtSignal, pyqtSlot
from PyGLWidget import PyGLWidget
from OpenGL.GL import *
from OpenGL.GLU import *
from CellModeller.Regulation import ModuleRegulator
from CellModeller.Simulator import Simulator
from Ce... |
#!/usr/bin/env python
from kubetools.dev import dev
from kubetools.main import run_cli
# Import click command groups
from kubetools.dev import ( # noqa: F401, I100, I202
container,
environment,
logs,
scripts,
)
run_cli(dev) |
#!/usr/bin/env python3
# Copyright 2020 Stanford University
#
# 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 applicab... |
# Lab 10 MNIST and NN
import tensorflow as tf
import random
# import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
tf.set_random_seed(777) # reproducibility
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
# Check out https://www.tensorflow.org/get_started/mnist/b... |
#!/usr/bin/env python3
"""
Description:
Usage:
$> roslaunch turtle_nodes.launch
$> ./executive_step_06.py
Output:
[INFO] : State machine starting in initial state 'RESET' with userdata:
[INFO] : State machine transitioning 'RESET':'succeeded'-->'SPAWN'
[INFO] : State machine transition... |
__all__ = ["RigidBodyBase", "Cylinder", "Sphere"]
from .rigid_body import RigidBodyBase
from .cylinder import Cylinder
from .sphere import Sphere |
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
ROOT_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
import time
import json
import numpy as np
import cv2
import random
... |
import yaml, pytest
def pytest_collect_file(parent, path):
if path.ext == ".yml" and path.basename.startswith("test"):
return YamlFile.from_parent(parent, fspath=path)
class YamlException(Exception):
"""Custom exception for error reporting."""
class YamlFile(pytest.File):
def collect(self):
... |
import json
import os
files = os.listdir()
for file in files:
if file.endswith('.ipynb'):
answers = ''
with open(file) as data:
nb = json.load(data)
for cell in nb['cells']:
if cell['cell_type'] == 'markdown':
if 'source' in cell and len(cell['sour... |
import os
subj_name = r'GaHi_subj01/'
mprage_file_name = r'20181224_160154T1ws002a1001.nii'
first_charmed_file_name = r'f20181224_160154ep2dadvdiffD59d155000s005a001_01.nii'
# for aal
#atlas_template = r'C:\Users\Admin\my_scripts\aal\origin\AAL_highres_template.nii'
#atlas_template = atlas_template.replace('C:', '/mnt... |
import unittest
import jref.pointer as error
from jref.pointer import Pointer
class TestPointer(unittest.TestCase):
def setUp(self):
self.sentinel = object()
def check_pointer_is_sentinel(self, pointer, document):
self.check_pointer_equal(document, pointer, self.sentinel)
def check_poi... |
# -*- coding: utf-8 -*-
"""Rigid body related equations.
"""
from pysph.base.reduce_array import parallel_reduce_array
from pysph.sph.equation import Equation
from pysph.sph.integrator_step import IntegratorStep
import numpy as np
import numpy
from math import sqrt
def skew(vec):
import sympy as S
x, y, z = v... |
import insightconnect_plugin_runtime
from .schema import CalculateInput, CalculateOutput, Input, Output, Component
from insightconnect_plugin_runtime.exceptions import PluginException
from simpleeval import simple_eval
class Calculate(insightconnect_plugin_runtime.Action):
_result = None
def __init__(self):
... |
# api/urls.py
from django.contrib import admin
from django.urls import include, path
from rest_framework.urlpatterns import format_suffix_patterns
from api import view
urlpatterns = [
path('model', view.graph),
path('analyse', view.graph_analysis),
path('export', view.graph_export),
path('import', vie... |
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.