input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
<reponame>bbc/datalab-reclist<filename>reclist/reclist.py
import collections
import json
from reclist.abstractions import RecList, rec_test
from typing import List
import random
from reclist.utils.config import load_ndjson_from_bucket, BBC_SOUNDS_METADATA
class CoveoCartRecList(RecList):
@rec_test(test_type='stat... | |
load_parser_model(self, model_dir, terms_only=False,
heads_only=False, **parser_options):
"""Load the parsing model from model_dir and set parsing
options. In general, the default options should suffice but see
the set_parser_options() method for details. Note that the parser
does not allow loading multiple models... | |
# coding: utf-8
"""
Pdf4me
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class Text(object):
"... | |
Day Economizer Control Schedule Name',
'pyname': u'time_of_day_economizer_control_schedule_name',
'required-field': False,
'autosizable': False,
'autocalculatable': False,
'type': u'object-list'}),
(u'high humidity control',
{'name': u'High Humidity Control',
'pyname': u'high_humidity_control',
'default': u'No... | |
elif prereq not in prereq_list[2]:
dest = self.logic[edge][2]
traverse_result = self.traverse([dest],True)
new_nodes = traverse_result[0]
start_items_temp = self.items_collected[:] + prereq + traverse_result[1]
item_destinations_temp = self.item_destinations[:]
for x in new_nodes:
item_destinations_temp += self.... | |
object in one of the following ways:
$ObjectIdentifier - An object identifier is an opaque string provided by Amazon Cloud Directory. When creating objects, the system will provide you with the identifier of the created object. An object s identifier is immutable and no two objects will ever share the same object iden... | |
config.hidden_size)
self.apply(self.init_bert_weights)
def forward(self, input_tokens, input_ids, token_type_ids=None, attention_mask=None, output_all_encoded_layers=True):
if attention_mask is None:
attention_mask = torch.ones_like(input_tokens)
if token_type_ids is None:
token_type_ids = torch.zeros_like(inp... | |
/* tp_new */
PyObject_GC_Del, /* tp_free */
};
static PyTypeObject* make_type(char *type, PyTypeObject* base, char**fields, int num_fields)
{
_Py_IDENTIFIER(__module__);
_Py_IDENTIFIER(_ast);
PyObject *fnames, *result;
int i;
fnames = PyTuple_New(num_fields);
if (!fnames) return NULL;
for (i = 0; i < num_fiel... | |
direction:
self.echo("That's not a valid direction.")
return
room = self.room
if room.exits.get(direction.id, None):
self.echo("That exit already has a room linked to it.")
return
other_room = Rooms.get({"vnum": room_vnum})
if other_room.exits.get(direction.opposite_id, None):
self.echo(
"The other room a... | |
<reponame>DrAlaafeef/MONAI
# Copyright 2020 - 2021 MONAI Consortium
# 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 ... | |
kernel
ksize = 33 #
ctr = ksize/2.0
w2 = width/2.0
x0 = ctr-w2; x1 = ctr+w2; y0 = ctr-1; y1 = ctr+1
tht = rs.uniform(0,2*np.pi)
R = np.asarray([[np.cos(tht), -np.sin(tht)],[np.sin(tht), np.cos(tht)]])
origin = np.asarray([[ctr,ctr]])
bpts = (np.asarray([[x0,y0],[x1,y0],[x1,y1],[x0,y1]])-origin) @ R + origin
... | |
# -*- coding: utf-8 -*-
import logging
import json
import random
import math
import re
from ask_sdk_core.skill_builder import SkillBuilder
from ask_sdk_core.dispatch_components import (
AbstractRequestHandler, AbstractExceptionHandler,
AbstractRequestInterceptor, AbstractResponseInterceptor)
from ask_sdk_core.utils... | |
else:
uset0 = self.t0
if self.tfind > 0:
if tf is None:
randX[self.tfind] = randomGenInBound(self.tf)
else:
randX[self.tfind] = randomGenInBound(tf)
usetf = randX[self.tfind]
else:
usetf = self.tf
teval = np.linspace(uset0, usetf, self.N)
# interpolation for state variables
nPoint = self.N
dimx = self.dim... | |
**kw)
picture = details["avatar_url"] if "avatar_url" in details.keys() else ""
emails = []
for x in response.json():
emails.append(str(x["email"]))
# loop through the emails we got from github
for email in emails:
email_matches = UserEmail.objects.filter(email__iexact=email)
hireable = False
if "hireable" ... | |
<filename>sdk/python/pulumi_f5bigip/ltm/profile_http.py
# 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, Map... | |
<gh_stars>10-100
# program for Azul with control using XBox Joystick with help from <NAME>
# same program works on scooter robot -- lights are only on scooter
# Dec 30 2014
import time
import math
#azul
#leftPort = "COM9"
#rightPort = "COM8"
#scooter
leftPort = "COM9"
rightPort = "COM5"
i01 = Runtime.createAndStart(... | |
:class:`com.vmware.vapi.std.errors_client.AlreadyExists`
if a virtual machine with the specified name already exists.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument`
if any... | |
<filename>jasy/core/Project.py
#
# Jasy - Web Tooling Framework
# Copyright 2010-2012 Zynga Inc.
#
import os, re
import jasy.core.Cache
import jasy.core.Config as Config
import jasy.core.File as File
import jasy.core.Console as Console
import jasy.core.Util as Util
import jasy.vcs.Repository as Repository
import ja... | |
# -*- coding: cp1252 -*-
#!/usr/bin/tclsh
################################################################################
# #
# Copyright 1997 - 2019 by IXIA Keysight #
# 2018 - Keysight # #
# #
################################################################################
#############################... | |
126432118: 'L_A5_ROI',
126432132: 'L_33pr_ROI',
126432134: 'L_STSva_ROI',
126432148: 'L_a24pr_ROI',
126432150: 'L_TA2_ROI',
126432166: 'L_SFL_ROI',
126432168: 'L_Pir_ROI',
126432182: 'L_s6-8_ROI',
126432184: 'L_TA2_ROI',
126432216: 'L_TF_ROI',
126432232: 'L_TGd_ROI',
126432485: 'L_47l_ROI',
126432487: 'L_OP... | |
<reponame>jennyfothergill/foyer
import difflib
import glob
import os
import gmso
import mbuild as mb
import pytest
from pkg_resources import resource_filename
from foyer.exceptions import FoyerError
from foyer.general_forcefield import Forcefield
from foyer.tests.base_test import BaseTest
from foyer.tests.utils impor... | |
# -*- coding: utf-8 -*-
"""
.. codeauthor:: <NAME> <<EMAIL>>
.. affiliation::
Laboratory of Protein Design and Immunoengineering <lpdi.epfl.ch>
<NAME> <<EMAIL>>
.. func:: multiple_distributions
"""
# Standard Libraries
import itertools
# External Libraries
import numpy as np
import pandas as pd
import matplotlib.p... | |
<reponame>npang1/nativepython
# Copyright 2018 <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 a... | |
this part.
part.ref = part.ref # This adjusts the part reference if necessary.
part.hierarchy = self.hierarchy # Store hierarchy of part.
# Check the part does not have a conflicting hierarchical name
self.add_hierarchical_name(part.hierarchical_name)
part.skidl_trace = (
get_skidl_trace()
) # Store part inst... | |
2, 1, 1]
classy 1.9 0.53852 [1, 2, 2, 1, 3, 2, 2, 2, 2, 2]
clean 1.7 0.78102 [3, 1, 2, 1, 2, 1, 3, 2, 1, 1]
cleaner 0.7 0.78102 [1, 0, 1, 0, 0, 0, 2, 1, 2, 0]
clear 1.6 1.2 [2, 1, 1, 0, 3, 1, 2, 4, 2, 0]
cleared 0.4 0.4899 [0, 0, 1, 1, 0, 0, 0, 0, 1, 1]
clearly 1.7 0.78102 [2, 2, 2, 2, 1, 2, 0, 2, 1, 3]
clears 0.3 0.78... | |
# 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.
# -----------------------------------------------------... | |
<reponame>channelCS/Summaries
# Added support for python 3.6 with keras
from random import shuffle, seed
import numpy as np
import scipy.io
import h5py
from nltk.tokenize import word_tokenize
import json
import re
from tqdm import tqdm
seed(123)
import os
def download_vqa():
os.system('wget http://visualqa.org/data/m... | |
column=1, sticky=tk.W+tk.E+tk.N+tk.S, padx=9, pady=5)
Button_Woodys_Knob = tk.Button(master=back, text='Woodys_Knob', command=CMD_Woodys_Knob, width=14, height=3)
Button_Woodys_Knob.grid(row=1, column=2, sticky=tk.W+tk.E+tk.N+tk.S, padx=9, pady=5)
Button_ = tk.Button(master=back, text='', command='', width=14, heigh... | |
<reponame>ivanov-slk/newsarticles-app
# -*- coding: utf-8 -*-
"""
Created on Fri May 18 15:57:41 2018
@author: c14238a
"""
#import os
#path = "C://Work//Python//Articles//ModellingModule//"
##path = "D://Книги//Мои//Python//Articles//"
#os.chdir(path)
from abc import ABC, abstractmethod
import nltk
#import gensim
i... | |
<reponame>rootless4real/cozmo-python-sdk<filename>src/cozmo/event.py
# Copyright (c) 2016 Anki, 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 in the file LICENSE.txt or at
#
# http://www.... | |
fix_gamma=False, eps=self.eps)
scale5c_branch2b = bn5c_branch2b
res5c_branch2b_relu = mx.symbol.Activation(name='50_res5c_branch2b_relu', data=scale5c_branch2b, act_type='relu')
res5c_branch2c = mx.symbol.Convolution(name='50_res5c_branch2c', data=res5c_branch2b_relu, num_filter=2048, pad=(0, 0),
kernel=(1, 1), str... | |
the public attribute of the existing cluster
template.
* `registry_enabled` - (Optional) Indicates whether Docker registry is enabled
in the cluster. Changing this updates the registry enabled attribute of the
existing cluster template.
* `server_type` - (Optional) The server type for the cluster template. Chang... | |
<reponame>xxchenxx/ViT-pytorch-1
import os
import numpy as np
from torchvision import datasets
from dataset.customDataset import Custom_Dataset
def init_datasets(args, transform_train, transform_test):
print("employ dataset {}".format(args.dataset))
if args.dataset == "cifar10":
train_datasets = datas... | |
<gh_stars>10-100
# Exporters
from nyoka import skl_to_pmml, StatsmodelsToPmml, ExponentialSmoothingToPMML
# Nyoka preprocessings
from nyoka.preprocessing import Lag
# Pipeline/ DataFrameMapper
from sklearn.pipeline import Pipeline
from sklearn_pandas import DataFrameMapper
# Sklearn Preprocessing
from sklearn.prepro... | |
- mckin/mbkin)) + 4379181898291200*(1 - mckin/mbkin)**12*
(np.log(2) + np.log(1 - mckin/mbkin)) + 4076007766871040*
(1 - mckin/mbkin)**13*(np.log(2) + np.log(1 - mckin/mbkin)) +
3808925793953280*(1 - mckin/mbkin)**14*(np.log(2) +
np.log(1 - mckin/mbkin)) + 3570717547837440*(1 - mckin/mbkin)**15*
(np.log(2) + np.lo... | |
-10.750308156197313,
'爬坡': -12.359746068631413,
'天子': -12.359746068631413,
'农贸': -12.359746068631413,
'数以百万计': -12.359746068631413,
'推向': -11.261133779963304,
'讲学': -10.973451707511522,
'田园': -12.359746068631413,
'化': -8.5095984669213554,
'自动': -11.666598888071467,
'深山': -12.359746068631413,
'及其': -7.9409054608348155,
... | |
'''
Copyright (c) 2008 <NAME>, <<EMAIL>>
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, d... | |
language: Language = relationship('Language')
def __init__(self, user: 'User', send_mails, send_notifications, should_show_public_nickname=True,
language: 'Language' = None, keep_logged_in=False):
"""
Initializes a row in current settings-table
:param user:
:param send_mails:
:param send_notifications:
:param... | |
clients.
:rtype: dict
"""
clients = dict()
for client in self.list_clients(wid=wid):
clients[client['name']] = client
del clients[client['name']]['name']
return clients
def create_client(self, name, wid):
"""
Create a new client in the particular Toggl workspace.
:param name: The client name to create in T... | |
value}))
else:
pass # self.warn("Unknown definition type '" + type + "'", filename, lineno)
elif cmd == '>':
# > LABEL
temp = re.split(RE.ws, line)
typ = temp[0]
name = ''
fields = []
if len(temp) >= 2:
name = temp[1]
if len(temp) >= 3:
fields = temp[2:]
# Handle the label types.
if typ == 'begin':
# T... | |
209.9, 210.3, 210.4, 210.6, 211.1,
211.1, 210.8, 210.4, 210.3, 209.9, 209.3, 208.7, 208.3, 208.5,
208.8, 209. , 209.2, 209.6, 210.1, 210.7, 211.2, 210.8, 210.4,
210. , 209.6, 209.3, 209.2, 209. , 208.8, 208.9, 209.2, 209.5,
205.1, 205.4, 205.4, 205.5, 205.5, 205.6, 205.7, 205.9, 206.1,
206.4, 206.9, 207.4, 20... | |
str = None,
):
# 请求唯一ID,用于链路跟踪和问题排查
self.req_msg_id = req_msg_id
# 结果码,一般OK表示调用成功
self.result_code = result_code
# 异常信息的文本描述
self.result_msg = result_msg
# 套餐下单订单号
self.combo_order_id = combo_order_id
def validate(self):
pass
def to_map(self):
result = dict()
if self.req_msg_id is not None:
result['req... | |
valid year. Possibilities include: {*allowed_years,}."
)
renewables_list = ['GEO', 'WND', 'SUN', 'WAT', 'OBG', 'OBL', 'OBS']
inp = year
path_arg = path
prefix_arg = prefix
global_dict = generation(year=inp, path=path_arg, prefix=prefix_arg)
renewables_dict = dict()
counter = 0
for uni in global_dict:
d... | |
instance of TCL
pass
else:
self.tcl = tk.Tcl()
self.setup_shell()
self.log.debug("TCL Shell has been initialized.")
# TODO: This shouldn't be here.
class TclErrorException(Exception):
"""
this exception is deffined here, to be able catch it if we sucessfully handle all errors from shell command
"""
pass
d... | |
containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `DataIntgFlowJson` object
"""
if data_intg_flow_id is None:
raise ValueError('data_intg_flow_id must be provided')
headers = {}
sdk_headers... | |
<reponame>MRSD2018/reefbot-1
"""autogenerated by genpy from objdetect_msgs/DetectObject.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import sensor_msgs.msg
import std_msgs.msg
class DetectObject(genpy.Message):
_md5sum = "58706fab49b7608f7f3527c1... | |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import FancyBboxPatch, Rectangle
def _plot_single_scatter_category(muts, mut_counts, xcol, ycol,
marker_size_from_count, base_marker_size, colour, label, alpha,
hotspots_in_foreground, marker=None, ax=None, zorder=None):
... | |
'''
Created on Feb. 9, 2020
@author: cefect
Template for worker scripts
'''
#==========================================================================
# logger setup-----------------------
#==========================================================================
import logging, configparser, datetime, copy, shuti... | |
import src.machine_teaching as machine_teaching
import src.utils as utils
import numpy as np
from src.alignment_interface import Verifier
import src.mdp as mdp
import random
class SCOTVerificationTester(Verifier):
"""takes the machine teaching set of trajectories from SCOT and asks the agent being tested to fill in t... | |
# SeaIceConnector.py - implementation of class SeaIceConnector, the API for
# the SeaIce database. This class is capable of connecting to a local
# PostgreSQL database, or a foreign one specified by the environment variable
# DATABASE_URI.
#
# Copyright (c) 2013, <NAME>, all rights reserved.
#
# Redistribution and... | |
= self.test_db_util.get_user(common.test_user_2_email)
# The create_repository_review method takes a dict( component label=review contents ).
# If review_contents is empty, it marks that component as not applicable. The review
# contents dict should have the structure:
# {
# rating: 1-5,
# comment: <text>
# appr... | |
a[0] & a[1] & i & a[2] & i)
def test_mid_multi_reverse(self):
a = [qu.rand_matrix(2) for i in range(3)]
i = qu.eye(2)
dims = [2, 2, 2, 2, 2, 2]
inds = [5, 4, 1]
b = qu.ikron(a, dims, inds)
assert_allclose(b, i & a[2] & i & i & a[1] & a[0])
def test_auto(self):
a = qu.rand_matrix(2)
i = qu.eye(2)
b = qu.ikr... | |
are unconventional. Try rewriting to avoid them.')
# Remove escaped backslashes before looking for undefined escapes.
line = line.replace('\\\\', '')
if Search(r'("|\').*\\(%|\[|\(|{)', line):
error(filename, linenum, 'build/printf_format', 3,
'%, [, (, and { are undefined character escapes. Unescape them.')
#... | |
else:
self.status('cd requires 1 parameter: cd path')
def SysCOPY(self, cmd):
print('')
cs = str(cmd).split(' ')
if len(cs) > 2:
f1 = cs[1]
f2 = cs[2]
if not self.pathexists('./'+f1):
self.status('Cant find fromfile: '+f1)
return
if self.pathexists('./'+f2):
self.status('"'+f2+'" exists; remove or rena... | |
'b', 'c', 'μεαν']
dict1 = {_k: [_i] for _i, _k in enumerate(cols)}
st1 = Struct(dict1)
self.assertEqual(list(st1.keys()), cols)
st1.col_remove('aa')
self.assertEqual(list(st1.keys()), cols[1:])
with self.assertRaises(IndexError):
st1.col_remove('aa')
st1.col_remove(['b', 'c'])
self.assertEqual(list(st... | |
###############################################################################
#
#
# Package: RoadNarrows Robotics Laelaps Robotic Mobile Platform ROS Package
#
# Link: https://github.com/roadnarrows-robotics/laelaps
#
# ROS Node: laelaps_*
#
# File: Gauge.py
#
## \file
##
## $LastChangedDate$
## $Rev$
##
## \brief L... | |
"""
Base IO code for all datasets
"""
# Copyright (c) 2007 <NAME> <<EMAIL>>
# 2010 <NAME> <<EMAIL>>
# 2010 <NAME> <<EMAIL>>
# License: BSD 3 clause
import os
import csv
import shutil
from collections import namedtuple
from os import environ, listdir, makedirs
from os.path import dirname, exists, expanduse... | |
methods"
) from e
self.lon, self.lat = self.get_lon_lat()
self._set_component_type_params("point")
self.stokes = self.stokes * astropy_healpix.nside_to_pixel_area(self.nside)
self.coherency_radec = (
self.coherency_radec * astropy_healpix.nside_to_pixel_area(self.nside)
)
name_use = [
"nside" + str(self.nside... | |
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2021 Scipp contributors (https://github.com/scipp)
# @author <NAME>
from html import escape
from .._utils import value_to_string
import ipywidgets as ipw
class PlotWidgets:
"""
Widgets containing a slider for each of the input's dimensions, as well as
butto... | |
import struct
from btypes import BinaryRecordType, HorizontalAlignmentType, VerticalAlignmentType, ReadingOrderType, XFProperty, ColorType, \
PaletteColor, ThemeColor, SubscriptType, UnderlineType, FontFamilyType, CharacterSetType, FontSchemeType, FillType, GradientType, \
BorderType
from bprocessor import Unexpec... | |
<reponame>Spectavi/video-diff<gh_stars>1-10
import math
import numpy as np
import cv2
import common
import config
import findquads
import spatial_consistency
import Matlab
FILTER = True
USE_GPS_COORDINATES = False
if config.USE_MULTITHREADING:
import multiprocessing
class Globals:
r_quadsTree = None
r_harlocs ... | |
<filename>torcharrow/test/lib_test/test_column.py<gh_stars>0
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
from __future__ import annotations
import unittest
from dataclasses import dataclass
from typing import Union, List, Any
# @manual=//pytorch/torcharrow/csrc/velox:_torcharrow
import t... | |
import time
from enum import Enum, IntEnum
from pathlib import Path
from typing import TYPE_CHECKING, Dict, Iterator, List, Optional
from dataclassy import as_dict
from eth_typing import HexStr
from eth_utils import add_0x_prefix
from hexbytes import HexBytes
from tqdm import tqdm # type: ignore
from web3 import Web3
... | |
#!/usr/bin/env python
#
# Copyright 2015, <NAME> <<EMAIL>>
#
# This file is part of HISAT 2.
#
# HISAT 2 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) ... | |
"""Build macros for TF Lite."""
load(
"//tensorflow:tensorflow.bzl",
"clean_dep",
"if_oss",
"tf_binary_additional_srcs",
"tf_cc_shared_object",
)
load("//tensorflow/lite:special_rules.bzl", "tflite_copts_extra")
load("//tensorflow/lite/java:aar_with_jni.bzl", "aar_with_jni")
load("@build_bazel_rules_android//andr... | |
#!/usr/bin/env python
# r5fp.py
# 2018-08-25 <NAME> <<EMAIL>>
# Error estimates for Round5 via convolutions.
import sys
import numpy as np
import mpmath as mp
from mp_fft import mp_conv
# Recap of Round5
# ---------------
#
# q > p > t are powers of 2
# Rq = ring with coefficients mod q
# Rp = ring with coefficien... | |
import os
import glob
import pickle
import pcl
import torch
import torch.utils.data
import torch.nn as nn
import numpy as np
# global configurations:
from autolab_core import YamlConfig
from dexnet.grasping import GpgGraspSampler
from dexnet.grasping import RobotGripper
home_dir = os.environ['HOME']
yaml_config = Ya... | |
by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.get_build_records(id, callback=callback_function)
:param callback function: The callback function
for a... | |
"""
The MIT License (MIT)
Copyright © 2019 <NAME> & HC² (www.hc2.fr)
"""
from os import stat
import json
# ============================================================================
# ===( HttpResponse )=========================================================
# ====================================================... | |
<gh_stars>10-100
# -*- coding: future_fstrings -*-
# -*- coding: utf-8 -*-
"""LRU cache.
Copyright: (c) 2019 by <NAME>.
License: MIT, see LICENSE for more details.
"""
from __future__ import absolute_import
from __future__ import with_statement
import threading
import time
import weakref
from functools import tota... | |
cons8,
cons29,
cons50,
cons127,
cons19,
cons48,
cons150,
cons13,
cons139,
cons696,
)
rule1341 = ReplacementRule(pattern1341, replacement1341)
pattern1342 = Pattern(
Integral(
(x_ * WC("f", S(1))) ** WC("m", S(1))
* (d_ + x_ ** n_ * WC("e", S(1)))
* (a_ + x_ ** n2_ * WC("c", S(1)) + x_ ** n_ * WC("b", S... | |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
from six import with_metaclass
import numpy as np
import itertools
from slicerator import Slicerator, propagate_attr, index_attr
from .frame import Frame
from abc import ABCMeta, abstractmethod, abstractproperty
from warnin... | |
set by the parameter `ppi`.
ppi : numeric, default 122
Pixels per inch. Along with `plot_width` and `plot_height`,
determines the size of interactive plots.
fill_alpha : numeric, default 0.7
Transparency of scatterpoint area fill.
point_size : numeric, default 10
Size of scatterpoints.
colormap : str, d... | |
<filename>colour/plotting/diagrams.py<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
CIE Chromaticity Diagrams Plotting
==================================
Defines the *CIE* chromaticity diagrams plotting objects:
- :func:`CIE_1931_chromaticity_diagram_plot`
- :func:`CIE_1960_UCS_chromaticity_diagram... | |
<gh_stars>0
import math
import warnings
import torch
import torch.nn as nn
from mmcv.cnn import build_activation_layer, build_norm_layer, xavier_init
from mmcv.cnn.bricks.registry import (TRANSFORMER_LAYER,
TRANSFORMER_LAYER_SEQUENCE)
from mmcv.cnn.bricks.transformer import (BaseTransformerLayer,
TransformerLayerSeq... | |
"""
<NAME>
Project 1 Mal Syntax Checking
"""
import time
class MalChecking:
def __init__(self, file_name):
"""
initial set up of the language definition with the known syntax of MAL
:param file_name: name of the mall file to check
"""
# saved file name
self.file_name = file_name
try:
# open the Mal and log f... | |
# text details: https://wiki.cloudmodding.com/oot/Text_Format
import random
from TextBox import line_wrap
TABLE_START = 0xB849EC
TEXT_START = 0x92D000
TABLE_SIZE_LIMIT = 0x43A8
ENG_TEXT_SIZE_LIMIT = 0x39000
JPN_TEXT_SIZE_LIMIT = 0x3A150
# name of type, followed by number of additional bytes to read, follwed by a f... | |
<gh_stars>100-1000
## imports
import pickle
import random
import sys
## constants
shlist = sys.modules["mysqlsh.__shell_python_support__"].List
slices = [
slice(4, 4),
slice(2, 7),
slice(None, 3),
slice(3, None),
slice(None, None),
slice(-3, None),
slice(None, -3),
slice(1, -1),
slice(-4, 9),
slice(-4, -1),... | |
#!/usr/bin/env python
"""Get a dump of about:memory from all the processes running on your device.
You can then view these dumps using a recent Firefox nightly on your desktop by
opening about:memory and using the button at the bottom of the page to load the
memory-reports file that this script creates.
By default t... | |
<reponame>flatpolar/geotrimesh
import os
import sys
import subprocess
import gdal, ogr
import numpy as np
import json
import argparse
import time
def read_dem(filepath):
print(filepath)
# """
dem_dataset = gdal.Open(filepath)
dem_tmp_cols = dem_dataset.RasterXSize
dem_tmp_rows = dem_dataset.RasterYSize
dem_ge... | |
"""
lotsizing.py: solve the multi-item, multi-stage lot-sizing problem.
Approaches:
- mils_standard: standard formulation
- mils_echelon: echelon formulation
Copyright (c) by <NAME> and <NAME>, 2012
"""
import random
from pyscipopt import Model, quicksum, multidict
def mils_standard(T,K,P,f,g,c,d,h,a,M,UB,phi):
"... | |
changes to key dictionaries
if old_ru_key != new_ru_key:
del self.__russian_key_to_card_dict[old_ru_key]
self.__russian_key_to_card_dict[new_ru_key] = original
if old_en_key != new_en_key:
del self.__english_key_to_card_dict[old_en_key]
self.__english_key_to_card_dict[new_en_key] = original
if old_key != new_key... | |
<reponame>bbarker/agda-pkg
'''
apkg
~~~~
A package manager for Agda.
'''
# ----------------------------------------------------------------------------
import click
import git
import humanize
import os
import random
import requests
import subprocess
import time
import uuid
import re
from distutils.dir_util imp... | |
# Copyright (c) 2019, MD2K Center of Excellence
# - <NAME> <<EMAIL>>
# 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, th... | |
<gh_stars>1-10
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, Fraunhofer FKIE/US, <NAME>
# based on code of <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:
#
# * Redis... | |
<reponame>hailzam/synapse
# -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket Ltd
# Copyright 2017 Vector Creations Ltd
# Copyright 2018-2019 New Vector Ltd
# Copyright 2019 The Matrix.org Foundation C.I.C.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in co... | |
<filename>main/views.py
from datetime import date
from calendar import Calendar, month_name
from time import time
from functools import wraps
from os import environ
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
from django.shortcuts import render, reverse
from django.contrib.auth import au... | |
# <NAME>
# Time Log:
# First two hours:
# Initialize screen
# Read tile set
# Read map data
# Draw map on screen
# Smooth scrolling
# Active area
# 30 minutes - create player, game
# Initial levelload logic.
# 1 hour
# Controls, generator for active players
# can move guy around screen (at 60 steps/second)
# cam move g... | |
products')
StockLabels.append('Recovery losses')
StockLabels.append('Remelting losses')
StockLabels.append('Fabrication losses')
# shorten Stocklabels:
StockLabels[1] = 'Machinery, nonelectr.'
StockLabels[4] = 'Communication'
StockLabels[5] = 'Medical & optical'
Mylog.info('<p>Create plots.</p>')
Figurec... | |
batch_normalize = False, no_nonlinearity_end = False,
do_print=(not reuse_weights), return_bypass = True, use_3d=False)
encoded_input_main[t] = enc[-1]
reuse_weights = True
#reshape back to 3D
for t, inp in enumerate(encoded_input_main):
encoded_input_main[t] = tf.reshape(inp, shapes[t][0:4] + [-1])
for t, bypas... | |
a mask from categories 2 and 4 if :meth:`np.isfinite`
does not yield a Boolean array. Category 3 is included to
support RGB or RGBA ndarrays, which are assumed to have only
valid values and which are passed through unchanged.
All input arguments that are not passed unchanged are returned
as masked arrays if any m... | |
"""
Building Block
==============
"""
from __future__ import annotations
import os
import rdkit.Chem.AllChem as rdkit
import functools
import numpy as np
import typing
import pathlib
from collections import abc
from stk.utilities import typing as _typing
from .functional_groups import FunctionalGroup, FunctionalGr... | |
# -*- coding: utf-8 -*-
# Copyright 2017, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
# pylint: disable=invalid-name,missing-docstring
from test.python.common import QiskitTestCase
import json
import unittest
... | |
<reponame>chienerh/EPN_PointCloud
"""
Code taken from https://github.com/cattaneod/PointNetVlad-Pytorch/blob/master/evaluate.py
"""
from SPConvNets.options import opt as opt_oxford
from importlib import import_module
import torch.nn as nn
import numpy as np
import pickle
import torch
import os
import sys
from tqdm impo... | |
<reponame>python-lzh/chat
# -*- coding: utf-8 -*-
"""qa
QA based on NLU and Dialogue scene.
基于自然语言理解和对话场景的问答。
Available functions:
- All classes and functions: 所有类和函数
"""
import copy
import json
import sqlite3
from collections import deque
from py2neo import Graph, Node, Relationship, NodeSelector
from config import ... | |
<filename>taylor_based_methods.py
import math
import sympy
import numpy as np
from scipy.special import binom
import scipy
class Taylor_based_methods:
def __init__(self, tools):
self.tools = tools
# Taylorization (babbush2016exponential)
# Let us know calcula the cost of performing Phase Estimation.
# 1. We h... | |
return visitor.visitChildren(self)
def funcname(self):
localctx = LuaParser.FuncnameContext(self, self._ctx, self.state)
self.enterRule(localctx, 10, self.RULE_funcname)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 176
self.match(LuaParser.NAME)
self.state = 181
self._errHa... | |
the real value of the target.
It is performed as follows:
1) make a linear regression model using the desired variables (X)
2) obtain the predictions
3) determine the error (True house price - predicted house price)
4) observe the distribution of the error.
If the house price, in this case MEDV, is linearly e... | |
"""
The fusion strategy. The goal of the fusion strategy is to find a pair of
adjacent rows, or adjacent columns such that they can be viewed as a single
column, with a line drawn between them. When this fusion happens, an assumption
that we can count the number of points in the fused row or column is added.
When we m... | |
#!/usr/bin/env python
import os
from time import time
from typing import Generator, Tuple
import numpy as np
import click
import json
from .lib import *
from cloudvolume import CloudVolume
from cloudvolume.lib import Vec, yellow
from chunkflow.lib.aws.sqs_queue import SQSQueue
from chunkflow.lib.bounding_boxes impo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.