input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
return outputs
def GenerateDescription(self, verb, message, fallback):
"""Generate and return a description of a build step.
|verb| is the short summary, e.g. ACTION or RULE.
|message| is a hand-written description, or None if not available.
|fallback| is the gyp-level name of the step, usable as a fallback.
""... | |
NPY neurons in the Arc play a critical role in the control of energy homeostasis.",
{"entities": [(15, 18, NT), (34, 37, LABEL), (66, 95, FUNC)]}),
("In addition, NAc dysfunction is associated with many mental disorders,",
{"entities": [(13, 16, LABEL), (48, 69, FUNC)]}),
("The median number of whole-brain labe... | |
<reponame>Zacharias030/ProGraML
# Copyright 2019 the ProGraML authors.
#
# Contact <NAME> <<EMAIL>>.
#
# 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... | |
<reponame>guiferviz/recipipe<gh_stars>1-10
from unittest import TestCase
from unittest.mock import MagicMock
from tests.fixtures import TransformerMock
from tests.fixtures import RecipipeTransformerMock
from tests.fixtures import create_df_3dtypes
import recipipe as r
class RecipipeTest(TestCase):
def test_no_er... | |
<filename>lrs/tests/test_AgentProfile.py
import hashlib
import urllib
import base64
import json
import ast
from django.test import TestCase
from django.conf import settings
from django.core.urlresolvers import reverse
from adl_lrs.views import register
class AgentProfileTests(TestCase):
testagent = '{"mbox":"mailt... | |
self.has_list_ancestor = True
self.ylist_key_names = []
self._child_container_classes = OrderedDict([("pir", ("pir", PlatformQos.Nodes.Node.Interfaces.Interface.Output.SkywarpQosPolicyClass.QosShowPclassSt.Shape.Pir)), ("pbs", ("pbs", PlatformQos.Nodes.Node.Interfaces.Interface.Output.SkywarpQosPolicyClass.QosShowPcl... | |
# coding=utf-8
# Copyright 2021 The Google Research 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 l... | |
<gh_stars>0
"""
Implementation of an async json-rpc client.
"""
from __future__ import annotations
import asyncio
from datetime import datetime
import json
import logging
import os
from pathlib import Path
import re
from typing import Any, Final
from aiohttp import ClientConnectorError, ClientError, ClientSession, TC... | |
'''OpenGL extension EXT.direct_state_access
This module customises the behaviour of the
OpenGL.raw.GL.EXT.direct_state_access to provide a more
Python-friendly API
Overview (from the spec)
This extension introduces a set of new "direct state access"
commands (meaning no selector is involved) to access (update a... | |
if not isinstance(v, list):
levels[d] = [v]
# Ensure each dimension specified by levels is valid
bad = [dim for dim in levels.keys() if dim not in dims]
if bad:
raise KeyError(f'Dimensions {bad} specified in *levels not found in *dims')
# Ensure each level is valid
bad = {k: v for k, vs in levels.items() ... | |
from collections import namedtuple
import os
import subprocess
import re
import boto3
import json
STAGE_VARIABLE_ALIAS = "lambdaAlias"
INTEGRATION_URI_APPENDER = ":${{stageVariables.{0}}}".format(STAGE_VARIABLE_ALIAS)
_INTEGRATION = namedtuple(
"INTEGRATION", [
"rest_api_id",
"resource_id",
"http_method",
"path"
... | |
<reponame>tommac7/hydroshare
"""
This model supports user labeling of resources in various ways.
For a User u, this instantiates a subobject u.ulabels (like u.uaccess)
that contains all the labeling functions.
Functions include:
* u.ulabels.label_resource(r, label)
instantiates a label for a resource. Resources... | |
<reponame>sammdu/bot-tac-toe<filename>python/tictactoe.py<gh_stars>0
"""
The TicTacToe game class and peripheral functions.
--------------------------------------------------------------------------------
MIT License
Copyright (c) 2021 Mu "<NAME>
Permission is hereby granted, free of charge, to any person obtaining ... | |
<gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import types
import random
try:
from rest_framework_filters import MethodFilter
except ImportError:
from edw.rest.filters.common import MethodFilter
from django.core.exceptions import (
ObjectDoesNotExist,
MultipleObjectsReturned,
)
fr... | |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import matplotlib.animation as animation
from collections import deque
import scipy.ndimage.filters
import serial
import sys
from pynput import keyboard
import os
import threading
import math
import random
import time
import json
from termco... | |
<reponame>TuftsCompArchLab/HotGauge<filename>examples/floorplans.py
#!/usr/bin/env python
import sys
import os
import json
import copy
from collections import defaultdict
import itertools
import math
from HotGauge.utils import Floorplan, FloorplanElement
from HotGauge.configuration import mcpat_to_flp_name, MISSING_PO... | |
= other.basis_matrix()
psi = X * phi
# Now psi is a matrix that defines an R-module morphism from other to some
# R-module, whose kernel defines the long sought for intersection of self and other.
L = psi.integer_kernel()
# Finally the kernel of the intersection has basis the linear combinations of
# the basis ... | |
"""
usernames = request.GET.get('username')
user_email = request.GET.get('email')
search_usernames = []
if usernames:
search_usernames = usernames.strip(',').split(',')
elif user_email:
user_email = user_email.strip('')
try:
user = User.objects.get(email=user_email)
except (UserNotFound, User.DoesNotExist):
... | |
<filename>usienarl/agent.py
#
# Copyright (C) 2019 <NAME>
# University of Siena - Artificial Intelligence Laboratory - SAILab
#
#
# USienaRL is licensed under a BSD 3-Clause.
#
# You should have received a copy of the license along with this
# work. If not, see <https://opensource.org/licenses/BSD-3-Clause>.
# Import ... | |
old i+j
# lij is the smallest i+j of the end point of any search path in the current
# pass.
# oij is the value of lij of the previous pass. These values will be used
# to eliminate any entries in P that are no longer nessecary.
flij = Me+Ne
foij = Mb+Nb
# the length of the longest LCS sofar
max_len_lcs = 0
... | |
# WS2812 LED Matrix Gamecontrol (Tetris, Snake, Pong)
# by <NAME>
# https://hackaday.io/project/11064-raspberry-pi-retro-gaming-led-display
# ported from
# Tetromino (a Tetris clone)
# By <NAME> <EMAIL>
# http://inventwithpython.com/pygame
# Released under a "Simplified BSD" license
import random, time, sys, socket, t... | |
<reponame>commodo/bch-gateway<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import time
import logging
import simplejson as json
import platform
import socket
import decimal
import yaml
import serial
import paho.mqtt.client
import appdirs
if platform.system() == 'Linux':
import fcntl
class ... | |
change layers widget to prevent recursion
self.w_layers.unobserve(self._on_change_layers, names="value")
self.w_layers.value = len(self.model.structure) - 2
self.w_layers.observe(self._on_change_layers, names="value")
self.w_layers.disabled = False
self.do_fit_button.disabled = False
self.to_code_button.disabled ... | |
animation frame to a static display list so set to false
incAnimFrame = False
animFrame_setting = ""
#END------------------------------------------Static/Dynamic Display List Settings-------------------------------------------
#testString = obj.obj_props.sort_Method
#-----------------------------------... | |
__author__ = "<NAME>"
__copyright__ = "Copyright 2019, Bluegem Engine"
__credits__ = ["<NAME>"]
__license__ = "GPL"
__version__ = "1.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Production"
'''
IMPORTANT NOTE
This python FBX importer Only works for
the FBX-ASCII format of Version 6.1.0 from 2006
'... | |
SlideShow61 = 0x803D
SlideShow62 = 0x803E
SlideShow63 = 0x803F
SlideShow64 = 0x8040
SlideShow65 = 0x8041
SlideShow66 = 0x8042
SlideShow67 = 0x8043
SlideShow68 = 0x8044
SlideShow69 = 0x8045
SlideShow70 = 0x8046
SlideShow71 = 0x8047
SlideShow72 = 0x8048
SlideShow73 = 0x8049
SlideShow74 = 0x804A
SlideShow75 ... | |
import abc
import struct
from datetime import datetime, timezone
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from nanotime import nanotime
from hashkernel import BitMask, utf8_decode, utf8_encode
from hashkernel.files.buffer import FileBytes
from hashkernel.typings import is_NamedTuple, is_su... | |
self.wv.get_normalized_weights(deepcopy=True)
H_postgEmbd_vocab_size = self.POSTagsEmbeddings.len()+1
H_postgEmbd_embedding_size = pembds
H_dptpsEmbd_vocab_size = self.DPTypesEmbeddings.len()+1
H_dptpsEmbd_embedding_size = dtembds
#Dence and Dropout Params
H_dense_out_dim = dod
H_dense_actv_func = d_actvf... | |
import os
import csv
import re
import glob
import json
from luigi import Parameter, IntParameter, WrapperTask
from collections import OrderedDict
from lib.timespan import get_timespan
from tasks.base_tasks import ColumnsTask, RepoFileUnzipTask, TableTask, CSV2TempTableTask, MetaWrapper
from tasks.meta import current_... | |
line in page.lines]
if page.lines
else [],
words=[DocumentWord._from_generated(word) for word in page.words]
if page.words
else [],
selection_marks=[
DocumentSelectionMark._from_generated(mark)
for mark in page.selection_marks
]
if page.selection_marks
else [],
spans=prepare_document_spans(page.spans),
)
... | |
thing here is that we don't know which of
# these edges will be removed by merge_edges - one
# of them will get deleted, and then deleted by our
# delete handler.
# the other one will get modified, so by the time we get
# control again after trigrid, we won't know what to update
# so - save the nodes...
saved_no... | |
"ratio that would be suggested if neither provided (v1)"
# nested option --------
vis_nested = cow.patch(g0,cow.patch(g1,g2)+\
cow.layout(ncol=1, rel_heights = [1,2])) +\
cow.layout(nrow=1)
default_w_n, default_h_n = vis_nested._default_size(None,None)
static_aspect_ratio_n = default_h_n / default_w_n
# provi... | |
<gh_stars>0
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.base.exchange import Exchange
import hashlib
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import ... | |
<filename>utils/augmentation.py
import random
import numbers
import math
import collections
import torchvision
from torchvision import transforms
import torchvision.transforms.functional as F
from PIL import ImageOps, Image, ImageFilter
import numpy as np
from joblib import Parallel, delayed
class Padding:
def __ini... | |
# Copyright 2019 <NAME>
#
# 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, softwa... | |
= random.choice(icy_images)
self.image.set_colorkey(BLACK)
self.rect = self.image.get_rect()
self.rect.x = x
self.rect.y = y
# Applying the sprites spawning on platform if wing pow is not initiated
if not self.game.player.has_wings:
if random.randrange(100) < POW_SPAWN_RATIO and not game.player.has_bubble and ... | |
<reponame>OP2/PyOP2<filename>pyop2/types/dataset.py
import numbers
import numpy as np
from petsc4py import PETSc
from pyop2 import (
caching,
datatypes as dtypes,
exceptions as ex,
mpi,
utils
)
from pyop2.types.set import ExtrudedSet, GlobalSet, MixedSet, Set, Subset
class DataSet(caching.ObjectCached):
"""Py... | |
from datetime import datetime
from zcrmsdk.src.com.zoho.crm.api import ParameterMap, HeaderMap
from zcrmsdk.src.com.zoho.crm.api.profiles import Profile
from zcrmsdk.src.com.zoho.crm.api.roles import Role
from zcrmsdk.src.com.zoho.crm.api.users import *
from zcrmsdk.src.com.zoho.crm.api.users import User as ZCRMUser
... | |
# 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 use... | |
= 0.5 * self.img_size * np.array([f, 1, 1])
cam_trans = np.array([cam[1], cam[2], tz])
return cam_trans, cam_for_render, f
def get_depth_loss(self, verts, cams, f = 5.0, is_sigmoid = True):
"""
verts : N x 6890 x 3, where N is batch_size;
cams : N x 3, where 3 = S, tx, ty;
"""
# proj_vert2d: N x 6890 x 2;
# ... | |
#!/usr/bin/env python
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from pprint import pprint as pp # for debugging
import sys
import os
import shlex
import subprocess
import time
import socket
import logging
#sys.path.insert(0, os.path.dirname(__file__... | |
<reponame>GQMai/mbed-cloud-sdk-python
#!/usr/bin/env python3
"""Generate Foundation SDK code from the SDK Foundation Definition file."""
import sys
import argparse
import os
import shutil
import yaml
import logging
import copy
import functools
import subprocess
import re
from collections import defaultdict
import jinj... | |
sym_t("v_out_flag" ,self.v_wei_ik.value)
self.v_out_inb = sym_t("v_out_inb" ,self.v_in_inb.value)
self.v_gemm_in = sym_t("v_gemm_in" ,vseq(1))
self.v_gemm_im = sym_t("v_gemm_im" ,vseq(1))
self.v_co_sub_m_index = sym_t("v_co_sub_m_index" ,self.v_gemm_im.value)
self.v_co_sub_n_index = sym_t("v_co_sub_n_index" ,self... | |
from os import getcwd, listdir
from sys import path
from time import sleep, time
from json import loads
from PyQt5.QtCore import pyqtSignal, QObject
from foo.pictureR import pictureFind
from foo.pictureR import bootyCount
from foo.win import toast
from common import schedule_data
from common2 import adb
class BattleS... | |
" "), justify='center',
fill=POICOLOR, tag="#POI")
def unselect_allpoint(self):
""" Calling process that remove additionnal highlight on all selected nodes. """
FillMapWithNodes(self).node_selection_inactiveall()
def delete_point(self, n):
""" KnownPoint deletion process. """
FillMapWithNodes(self).delete_poin... | |
initialization_vector=b'\x39\x48\x74\x32\x49\x28\x34\xA3',
derivation_data=b'\xFA\xD9\x8B\x6A\xCA\x6D\x87\xDD'
)
)
args = (utils.BytearrayStream(), )
self.assertRaisesRegex(
ValueError,
"invalid payload missing template attribute",
payload.write,
*args
)
def test_equal_on_equal(self):
"""
Test that the e... | |
- sD2
eHD = I_HD - sHD
eH2 = I_H2 - sH2
eD2 = np.multiply(wMat_D2, eD2)
eHD = np.multiply(wMat_HD, eHD)
eH2 = np.multiply(wMat_H2, eH2)
eD2 = clean_mat(eD2)
eHD = clean_mat(eHD)
eH2 = clean_mat(eH2)
# choosing norm
if norm=='' or norm.lower()=='absolute' or norm =='a' or norm =='A':
E=np.sum(np.abs(eD2)... | |
<filename>source/pydwf-examples/DigitalOutShowStatusDuringPulsePlayback.py
#! /usr/bin/env python3
"""DigitalOut instrument demo.
Show the behavior of status, run_status, and repeat_status before, during, and after Pulse-mode playback is active.
"""
from typing import Optional, Tuple
import argparse
import time
imp... | |
<gh_stars>10-100
# Python imports.
from collections import defaultdict
import Queue
import random
import os
import sys
import cPickle
# Other imports.
from ActionAbstractionClass import ActionAbstraction
from OptionClass import Option
from simple_rl.planning.ValueIterationClass import ValueIteration
from simple_rl.mdp... | |
modifier)
@keyword
def click_link(self, locator, modifier=False):
self.base(locator, f'Clicked link "{locator}"', f" {locator}", modifier)
@keyword
def click_element(self, locator, modifier=False, action_chain=False):
self.base(locator, f'Clicked "{locator}"', f" {locator}", modifier, action_chain)
@keyword
... | |
= False
os.system("rm -rf ip_test_log")
print "\nTerminating switches..."
print "\nTerminating routers..."
print "\nTerminating UMLs..."
print "\nCleaning the interprocess message queues"
# batch_ipcrm.clean_ipc_queues()
if brute_force:
# since we are working on remote machines, we don't care about
# the proc... | |
<filename>masakari/hacking/checks.py<gh_stars>10-100
# Copyright (c) 2016, NTT Data
# 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/L... | |
self.dir == 'down':
self.x_exp = k.x - 26
self.y_exp = k.y
def draw_explosion_little(self, screen, elf):
if self.allow_explosion_little and elf:
if self.frame_l == 0:
screen.blit(EXPLOSION_1_IMG,(self.x_exp, self.y_exp))
if self.frame_l == 1:
screen.blit(EXPLOSION_2_IMG,(self.x_exp, self.y_exp))
i... | |
unnormalized_shape = shape[:-normalized_ndim]
# test that LN normalizes to mean 0 and stddev 1
ln = nn.LayerNorm(normalized_shape, eps=0).to(device, dtype)
ln.weight.data.fill_(1)
ln.bias.data.fill_(0)
output = ln(x)
out_reshaped = output.view(*(unnormalized_shape + [-1]))
mean = out_reshaped.mean(-1)
var = ou... | |
"browse-folder": TT("Browse"),
"in": TT("In"),
"opt-download_dir": TT("Temporary Download Folder"),
"explain-download_dir": TT(
"Location to store unprocessed downloads.<br /><i>Can only be changed when queue is empty.</i>"
),
"opt-download_free": TT("Minimum Free Space for Temporary Download Folder"),
"explain-... | |
<filename>summarization_utils.py
import ast
import hashlib
import json
import os
from collections import defaultdict
from typing import Tuple, Sequence, Dict, Optional, Union, Any, Set
import compress_pickle
import matplotlib.pyplot as plt
import numpy as np
import pandas
import pandas as pd
from filelock import FileL... | |
<filename>lib/DiskSpaceMonitor.py<gh_stars>0
# BSD Licence
# Copyright (c) 2012, Science & Technology Facilities Council (STFC)
# All rights reserved.
#
# See the LICENSE file in the source distribution of this software for
# the full license text.
"""
A disk space monitor
See doc string for class DiskSpaceMonitor fo... | |
27, "[?2l", "Pound sterling: #\n"]
data += [14, "Hash: #\n\n"]
data += [27, "<Push <RETURN>"]
write_test(filename, data)
def create_vt52_character_set2(filename):
# Behaviour of this checked with the 'vt102' emulator.
data = [27, "[2J", 27, "[HTest of character set for VT52 mode with graphics\n\n"]
# Set G0=UK, ... | |
<gh_stars>1-10
from dea.models import Journal
from decimal import Decimal
from product.attributes import get_product_attributes_data
from django_extensions.db.fields import AutoSlugField
from django.contrib.postgres.fields import HStoreField
from django.db import models
from django.db.models import Sum
from django.db.m... | |
False
>>> is_numpy_array(np.int64(3))
False
>>> is_numpy_array(3.5)
False
>>> is_numpy_array(np.float64(3.5))
False
>>> is_numpy_array('hi')
False
>>> is_numpy_array(None)
False
>>> is_numpy_array(None, allow_none=True)
True
"""
import numpy as np
return is_instance(arg, np.ndarray, allow_... | |
<filename>auv_nav/process.py
# -*- coding: utf-8 -*-
"""
Copyright (c) 2020, University of Southampton
All rights reserved.
Licensed under the BSD 3-Clause License.
See LICENSE.md file in the project root for full license information.
"""
import copy
import json
import threading
import time
from pathlib import Path
i... | |
# Copyright (c) 2017-2019 Soft8Soft LLC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distribute... | |
id='Filtro_Tipo', className='Dropdown2', style={
'background-color': '#c9c9c9',
'border-radius': '14px',
'border-color': 'transparent',
'margin-bottom': '1vh',
'margin-top': '1vh',
'cursor': 'pointer'
}),
]),
# RODAPÉ DO MODAL:
dbc.ModalFooter(
# TEREMOS UM BOTÃO EM SEU RODAPÉ:
dbc.Button(
"Fechar", id... | |
<reponame>DarkCode01/rich
from collections.abc import Mapping, Sequence
from contextlib import contextmanager
from dataclasses import dataclass, field, replace
from enum import Enum
from functools import wraps
import inspect
from itertools import chain
import os
from operator import itemgetter
import platform
import re... | |
"""Miscellaneous visualization tools.
These functions are similar to matplotlib functions like
:func:`~matplotlib.pyplot.scatter` and :func:`~matplotlib.pyplot.pcolormesh`.
When called, these functions default to creating plots on the current axis.
After plotting, functions like :func:`~matplotlib.pyplot.xlabel` and
:... | |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from d... | |
<reponame>AvocadoManYT/Test<filename>bot/cogs/img.py
import discord
import aiohttp
import datetime
import io
from datetime import datetime
from discord.ext import commands
import PIL
from PIL import Image, ImageFont, ImageDraw, ImageFilter
err_color = discord.Color.red()
class Images(commands.Cog):
""" Category for ... | |
<reponame>EldritchJS/inference_results_v0.5
"""
mlperf inference benchmarking tool
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
# import array
# import collections
import json
import logging
import os
import sys
# import threading
im... | |
<gh_stars>1-10
import itertools
import typing
from abc import abstractmethod, ABC, ABCMeta
from collections import Counter
from dataclasses import dataclass, astuple, replace, field
from enum import unique, Enum, auto, EnumMeta
from functools import lru_cache
from typing import Tuple, Union, List, Generator, Dict, Gene... | |
-> bool:
return self.get_shortname(schema).name in {'id', '__type__'}
def generic(self, schema: s_schema.Schema) -> bool:
return self.get_source(schema) is None
def get_referrer(self, schema: s_schema.Schema) -> Optional[so.Object]:
return self.get_source(schema)
def is_exclusive(self, schema: s_schema.Schema)... | |
in state %s"%(time.time()-start_t, ))
Trace.trace(self.trace_level+4,"process_write_request: next write volume returned %s" % (v,))
# volume clerk returned error
if v["status"][0] != e_errors.OK:
rq.ticket["reject_reason"] = (v["status"][0],v["status"][1])
if v['status'][0] == e_errors.BROKEN: # too many volumes ... | |
#!/usr/bin/python
#-*-coding: utf-8 -*-
'''
Axile -- Outil de conception/simulation de parapentes Nervures
Classe ParamGeneraux
@author: <NAME>
@copyright: 2013 Nervures. All rights reserved.
@license: LGPL
@contact: <EMAIL>
@deffield creation: 08 Jan 2013
__updated__ = "2019-02-06"
'''
import sys, os
from spleen.ut... | |
<reponame>rboixaderg/guillotina
from collections import namedtuple
from guillotina import configure
from guillotina import schema
from guillotina.component import get_adapter
from guillotina.component import query_adapter
from guillotina.exceptions import ValueDeserializationError
from guillotina.fields.interfaces impo... | |
#end def read_text
def write_text(self):
c=''
if self.filetype=='xsf': # only write structure/datagrid if present
if self.periodicity=='molecule' and 'elem' in self:
c += self.write_coord()
elif 'primvec' in self:
c += ' {0}\n'.format(self.periodicity.upper())
c += self.write_vec('primvec',self.primvec)
if '... | |
import pickle
import os
import tensorflow as tf
import numpy as np
from collections import defaultdict
from tqdm import tqdm
from capreolus.extractor import Extractor
from capreolus import Dependency, ConfigOption, get_logger
from capreolus.utils.common import padlist
from capreolus.utils.exceptions import MissingDoc... | |
<filename>pydra/engine/tests/test_graph.py
from ..graph import DiGraph
from .utils import DOT_FLAG
import pytest
class ObjTest:
def __init__(self, name):
self.name = name
self.state = None
A = ObjTest("a")
B = ObjTest("b")
C = ObjTest("c")
D = ObjTest("d")
E = ObjTest("e")
def test_no_edges():
"""a, b"""
gra... | |
really care that much
t = get_mtime(p.strValue)
except OSError:
return h
hasher = sha_hash()
hasher.update(h)
hasher.update(str(t))
return hasher.digest()
class File(Path):
"""File is a VisTrails Module that represents a file stored on a
file system local to the machine where VisTrails is running."""
_setti... | |
<filename>third_party/frc971/control_loops/python/drivetrain.py
#!/usr/bin/python
from third_party.frc971.control_loops.python import control_loop
from third_party.frc971.control_loops.python import controls
import numpy
import sys
from matplotlib import pylab
import glog
class DrivetrainParams(object):
def __init__... | |
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['APIKeyHeader'] # ... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of Karesansui Core.
#
# Copyright (C) 2009-2012 HDE, Inc.
#
# 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 restric... | |
<gh_stars>0
from __future__ import print_function
import time
import numpy as np
import tqdm
import global_vars as Global
from datasets import MirroredDataset
from utils.iterative_trainer import IterativeTrainerConfig
from utils.logger import Logger
from termcolor import colored
from torch.utils.data.dataloader impo... | |
financial model storing input financial parameters
:return: float, LCOE in US dollars per kWh
"""
years = financials.analysis_years # length of financial life
if financials.third_party_ownership:
discount_pct = financials.owner_discount_pct
federal_tax_pct = financials.owner_tax_pct
else:
discount_pct = financ... | |
import os
import scipy as sp
import gzip
import h5py
import sys
from ldpred import sum_stats_parsers
from ldpred import reporting
from ldpred import util
from ldpred import plinkfiles
from plinkio import plinkfile
import time
def _verify_coord_data_(data_dict):
"""
Verify that merged data is ok
"""
num_snps = len... | |
then the global context is used.
>>> Single = FPSort(8, 24)
>>> Double = FPSort(11, 53)
>>> Single
FPSort(8, 24)
>>> x = Const('x', Single)
>>> eq(x, FP('x', FPSort(8, 24)))
True
"""
ctx = _get_ctx(ctx)
return FPSortRef(Z3_mk_fpa_sort(ctx.ref(), ebits, sbits), ctx)
def _to_float_str(val, exp=0):
if isinsta... | |
<gh_stars>0
"Functions implementing widget editing"
import re, html, json
from ... import skilift
from ....skilift import fromjson, editsection, editpage, editwidget, versions
from .. import utils
from ... import FailPage, ValidateError, ServerError, GoTo
from ....ski.project_class_definition import SectionData
... | |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | |
j*deg, **fmtspec)
ret += 'ret.v{i}.v{k} = vec_ld(0, buf);\n\n'.\
format(i=i, k=k, **fmtspec)
ret += 'return ret;'
return ret
# Load 1 for every supported types
if deg == 1:
if aligned:
return 'return vec_ld(0, {in0});'.format(**fmtspec)
else:
return 'return *(({ppc_typ}*) {in0});'.\
format(ppc_typ=ppc_vec_... | |
<gh_stars>0
# Copyright (c) 2011, <NAME> 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 notice, this
# list of conditions and the ... | |
raise Exception("Expected source_model_tag_ to be a str, received: {}".format(type(source_model_tag_)))
if spaces_ is not None and not isinstance(spaces_, (bytes, str, list)):
raise Exception("Expected spaces_ to be a Sequence, received: {}".format(type(spaces_)))
if users_ is not None and not isinstance(users_, (... | |
b c2.')
>>> s.makeMeasures(inPlace=True)
>>> s.measure(2).leftBarline = bar.Repeat(direction='start')
>>> s.measure(2).rightBarline = bar.Repeat(direction='end', times=3)
>>> s.measure(4).leftBarline = bar.Repeat(direction='start')
>>> s.measure(4).rightBarline = bar.Repeat(direction='end', times=2)
processInner... | |
<filename>seam_carving.py
import numpy as np
import cv2
class SeamCarver:
def __init__(self, filename, out_height, out_width, protect_mask='', object_mask=''):
# initialize parameter
self.filename = filename
self.out_height = out_height
self.out_width = out_width
# read in image and store as np.floa... | |
atom = res.atoms[atomname]
aname = atom.name
rname = atom.resname
return rname, aname
def getGroup(self, resname, atomname):
"""
Get the group/type associated with the input
fields. If not found, return a null string.
Parameters:
resname: The residue name (string)
atomname: The atom name (string)
"""
gro... | |
"""
Checks a sample if it matches PHE defined recipes for VOC/VUIs. Outputs to stdout
a tab delimited list of the following:
- PHE name for the matching VOC/VUI. "none" if no match. "multiple" if multiple matches.
- pangolin name for the matching VOC/VUI. "none" if no match. "multiple" if multiple matches.
- confidenc... | |
md5hash="323",
artifactfile=self.test_file,
)
Artifact.objects.create(
project=self.project,
revision=self.revision1,
md5hash="324",
artifactfile=self.test_file,
)
self.revision1.delete()
with self.assertRaises(Revision.DoesNotExist):
Revision.objects.get(revision="1")
with self.assertRaises(Artifact.Does... | |
self.api_client.select_header_accept(
['application/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basicAuth'] # n... | |
grids (e.g., travel time, azimuth and take off angle)
"""
__valid_grid_type__ = ['TIME', 'TIME2D', 'ANGLE', 'ANGLE2D']
def __init__(self, network_code, data_or_dims, origin, spacing, seed,
seed_label, phase='P', value=0,
grid_units=__default_grid_units__,
grid_type='TIME', float_type="FLOAT", model_id=None):
se... | |
"grafana",
"image": "x",
"cpu": 64,
"memoryReservation": 128,
"links": ["loki"],
"portMappings": [
{"containerPort": 3000, "hostPort": 0, "protocol": "tcp"}
],
"essential": True,
"entryPoint": [],
"environment": [],
"mountPoints": [
{"sourceVolume": "grafana", "containerPath": "/var/lib/grafana"}
],
"volu... | |
<reponame>fusion-research/TrajectoryNet<gh_stars>10-100
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time
import math
import numpy as np
import tensorflow as tf
from sklearn import preprocessing
import os
import inspect
import sys
import datetime
im... | |
pulumi.Input[str],
value: pulumi.Input[str]):
pulumi.set(__self__, "key", key)
pulumi.set(__self__, "value", value)
@property
@pulumi.getter
def key(self) -> pulumi.Input[str]:
return pulumi.get(self, "key")
@key.setter
def key(self, value: pulumi.Input[str]):
pulumi.set(self, "key", value)
@property
@pu... | |
self.Label64_5.place(relx=0.25, rely=0.625, height=21, width=200)
self.Label64_5.configure(activebackground="#f9f9f9")
self.Label64_5.configure(activeforeground="black")
self.Label64_5.configure(background="#86bad8")
self.Label64_5.configure(disabledforeground="#a3a3a3")
self.Label64_5.configure(foreground="#... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.