text stringlengths 65 6.05M | lang stringclasses 8
values | type stringclasses 2
values | id stringlengths 64 64 |
|---|---|---|---|
from __future__ import print_function
import argparse
from six.moves import configparser
import logging
import logging.config
import sys
import six
from tabulate import tabulate
class BaseCommand(object):
"""Base class for command-line tools."""
default_config_section = 'caravan'
CHILD_POLICIES = [
... | Python | CL | bc4638f8497b22dde4c33b1f498dd2eab4b5e0e14e077b1ed992871664a389b7 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | Python | CL | cb98480a20208b94642cffeff349e2f4ce79643b2a44719737b532f8c30aa223 |
import torch
import torch.nn as nn
import torch.optim as optim
import os
from tqdm import tqdm
from torch.utils.data import DataLoader
from pytorch_pretrained_bert.modeling import BertModel
from src.EDU.dataset import RlatCollator, AugCollator
try:
torch.multiprocessing.set_start_method("spawn")
except RuntimeErr... | Python | CL | 6c5433b10a210ccc01aa739a7a0909d31f9fa9ac48a52c12fadb86ce29cc74d5 |
import sys
from enum import Enum, auto
from collections import namedtuple
from antlr4 import CommonTokenStream, ParseTreeWalker, FileStream, InputStream
if __name__ is not None and "." in __name__:
from .SPLListener import SPLListener
from .SPLParser import SPLParser
from .SPLLexer import SPLLexer
else:
... | Python | CL | 914584c8fd5aadda7fcab268b0f9b1b69cb6b6d7e75ec4da85d96eabeedcbc75 |
# -*- coding: utf-8 -*-
"""
proxy.py
~~~~~~~~
⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on
Network monitoring, controls & Application development, testing, debugging.
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE... | Python | CL | da52e977a1a9c6c0de4c529952ae506e50cd9e77bb22f56a22729869462a2c33 |
"""
D365API.TestAccess
~~~~~~~~~~~~~~~~~~
"""
import json
import os
import unittest
from D365API.Access import Access
class TestAccess(unittest.TestCase):
"""Test the Access module."""
@classmethod
def setUpClass(cls):
"""Prepare test class.
Get the Test Data from JSON (JavaScript Object... | Python | CL | 026bd71f764adecd2b105306fa133ee772b3f8f58b8d2a854ab79346fa4a8d99 |
"""
@description: 匹配接口
@author: Wu Jiang-Heng
@email: jiangh_wu@163.com
@time: 2019-05-29
@version: 0.0.1
"""
from os.path import join, exists
from os import mkdir
import pickle
import yaml
import logging
from time import time
from sementic_server.source.intent_extraction.recognizer import Recognizer
from sementic_ser... | Python | CL | 62c7045cb54bffe25d3a6cdb8e48121d9302767b4e8c1ae4510668fc40234776 |
import os
import time
from abc import ABC, abstractmethod
from common.commands import Compress, Upload, SendMsg, Download, Decompress
from common.configuration import AWSPathManager
from common.protocol import IOTask, AWSMsg, AWSIDRegistration
from common.resources import Folder, File, OSPath
from multipledispatch imp... | Python | CL | d1d17c1adaa74ff623fa2fc899023297b0a0f9e0df758c828355e0e16ae887e4 |
#!/usr/bin/env python2
import json
from SidechainTestFramework.sc_boostrap_info import SCNodeConfiguration, SCCreationInfo, MCConnectionInfo, \
SCNetworkConfiguration
from SidechainTestFramework.sc_test_framework import SidechainTestFramework
from test_framework.util import assert_equal, initialize_chain_clean, sta... | Python | CL | 9e2fffaccd76be944383c4593b0f7e12efbe479982501c2f2a5c92df045bbcda |
import sys
sys.path.append("../")
import numpy as np
from operation import *
class feature():
def __init__(self):
pass
def getKey(self, board, num):
pass
def updateScore(self, board, delta):
pass
def getScore(self, board):
pass
def setSymmetricBoards(self, rota... | Python | CL | 3e75e8a0c79232ea6a539b73d974b87ea493ae4ab171653c47e2ce8120751104 |
import torch
from torch.autograd import Variable
from torchtext import data
from torchtext import datasets
from torchtext.vocab import Vectors, GloVe
import spacy
import joblib
import matplotlib.pyplot as plt
from matplotlib import ticker
BOS_WORD = '<s>'
EOS_WORD = '</s>'
MAX_LEN = 20
MIN_FREQ = 5
def tokenize(tex... | Python | CL | 8c426838eeba3be90535815b53365a313995be85ee7f237878f46ba5dcea200c |
1, tab completion
2, a? provide information on a
a?? also include definition of function a if possible
*a*? provide names matching the string with wildcards
4, Ctrl+C: exit during running a program
5, paste: Ctrl+Shift+V / %paste / %cpaste(use #4 to quit this mode)
6, keyboard shortcuts: Ctrl+U/Ctrl+K <-> Ctrl+y
... | Python | CL | 828e09c10ac6a815b2acba6d1dfe6c64a3e7b6d0dae8fe7e8ea51248aa8b75b5 |
#flake8: noqa
'''
Generate trees for measuring and comparing L1 and UCT efficiencies with
respect to RECO objects.
Usage:
./makeEfficiencyTree_cfg.py
Optional arguments:
inputFiles=myFile.root outputFile=outputFile.root maxEvents=-1
Authors: L. Dodd, N. Woods, I. Ojalvo, S. Dasu, M. Cepeda, E. Friis (UW M... | Python | CL | 0cb9960cfa563dfcd96375520f64e8c850fc9a4bfed72123bf8c9888d952f3dd |
#=============================================
#utf-8 2020-03-10 16:16:19
#Finding the optimal parameters by minimizing AIC
import warnings
import itertools
import pandas as pd
import numpy as np
import statsmodels.api as sm
import matplotlib.pyplot as plt
from pandas import read_excel
plt.style.use('five... | Python | CL | 632ff643083a98370dee56cb10acedb2bd06b2992d074991684afce1698a8a4f |
import os.path as osp
from utils import (
is_,
arg,
parse_args,
mkdir_p,
time_stamp,
init_logging,
get_logger,
write_lines,
read_lines,
)
# TODO only do parts of pipeline
opts = parse_args(
arg('-name', default='fr-clean'),
arg('-f', '--file', default='train/french_clea... | Python | CL | f94e98d88cd19f8aa78adee02f423fbc44cf7ca7584e1833de2e4fcf5bb70b76 |
# -*- coding: utf-8 -*-
# (C) Copyright IBM Corp. 2020.
#
# 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... | Python | CL | 14a85488566b7fe4ba7d3f43b19578c2e7111f98d372312c8e373950290b7336 |
# Copyright 2014 Cloudera 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 writing... | Python | CL | 8996bbc748be0d2c0c673562cad61137e91dda8c9dae1abc3f810e988e5423c4 |
#!/usr/bin/env python
"""This script configures GigabitEthernet2 interfaces on network devices.
Copyright (c) 2018 Cisco and/or its affiliates.
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 wit... | Python | CL | c7d6f89bab510f9332522b3a628cb1e5739eb65211c5993374edc3cec56f04b4 |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... | Python | CL | d919f7ff237c0a5348a9f219da2a6fc3356e291655dfdc48af30b4ce5c2b1392 |
from decimal import Decimal
import os
import random
import re
import sys
DAMPING = 0.85
SAMPLES = 10000
def main():
if len(sys.argv) != 2:
sys.exit("Usage: python pagerank.py corpus")
corpus = crawl(sys.argv[1])
ranks = sample_pagerank(corpus, DAMPING, SAMPLES)
print(f"PageRank Results from S... | Python | CL | 4cef24119b83ded6a238d06468adb14043915108d082ae98da14b4edf926f6ea |
"""Config for TD3 on Reacher-v2.
- Author: Kyunghwan Kim
- Contact: kh.kim@medipixel.io
"""
agent = dict(
type="TD3Agent",
hyper_params=dict(
gamma=0.95,
tau=5e-3,
buffer_size=int(1e6),
batch_size=100,
initial_random_action=int(1e4),
policy_update_freq=2,
),... | Python | CL | 520c746ffbcac880d096c8199bf1a0c81cfe62d9b381e5c34a02e32305b7d3e6 |
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 25 23:15:02 2019
@author: ljp
"""
import numpy as np
from scipy.stats import multivariate_normal
import random
from scipy.ndimage import convolve
##### Function that creates plans from parameters #####
def unet_create_plans(number_of_plans, plan_size, num_mean, num... | Python | CL | b892d7febe320e44727b98b2d342d882eaac56c721e6c0aff60854753d9ebdb5 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import datetime
import numpy as np
import os
import lda
import time
### This script runs regular LDA on a patient record training set (90% of the
### original data). Writes out the herb counts, symptom counts, code list (for
### mapping symptoms/herbs to integers), and the wo... | Python | CL | 7d98c238da3c912384ea8d47c2e789feb9978150831a1c616742cd2600520c50 |
#!/usr/bin/python
import numpy as np
import h5py
import ipdb as pdb
import os
from etrack.io import dataformats
from etrack.io.dataformats import ClassAttr
##############################################################################
# I/O #
##... | Python | CL | c2c4f4a4727c6654256fed7b95c97a6bd5382f424d11aea4d1ece79a864e2c56 |
from django.db.models import Model, ManyToManyField, CharField, BooleanField
from django.contrib.auth.models import User
from capstoneproject.models.querysets.word_queryset import WordQuerySet
from capstoneproject.models.models.word_feature import WordFeature
class Word(Model):
"""A class representing the system'... | Python | CL | 5814bca2443a4c763fe9163376698fabad7f8f8fd60707504e4d257a75034004 |
#!/usr/bin/python3
# encoding=utf-8
# Copyright © 2016 Intel Corporation
# 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... | Python | CL | 99c9dba84edfec000f18301bc35e946b73a44ecfce4e3c9432552967c61997e4 |
#-------------------------------------------------------------------------------
#
# simple tool comparing XML documents - powered by Python miniDOM
#
# Project: EOxServer <http://eoxserver.org>
# Authors: Martin Paces <martin.paces@eox.at>
#
#----------------------------------------------------------------------------... | Python | CL | 0fd31dc9e670273799c8b4bb61f9dad6dd1fcc51d749873a89d84773feb688df |
#!/usr/bin/python
# A set is a collection which is unordered and unindexed. In Python sets are written with curly brackets
s = {"a", "b", "c"}
print(s)
for x in s:
print(x) # iterating the set
print("banana" in s) # check for presence of item
s.add("d") # add item to set
s.update(["e", "f", "g"]) # adding ... | Python | CL | c110c304baf1fdae85234831e1379488104a66d27dc10b5d65b3ec0768b1172c |
# -*- coding: UTF-8 -*-
import queue
import sys
from select import select
from absEvent import AbsEvent
import socket
class XtSelect:
def __init__(self, ip='0.0.0.0', port=8090):
self.ip = ip
self.port = port
self.server_socket = socket.socket()
self.output_list = []
self.... | Python | CL | e17bb54b20df582979456117fa387d906003ebf73a1c050b12ec7af7a689fb70 |
"""
username1: cat dog
username2: elephant fox tiger duck
username1: giraffe
hi this is joydeep
logfile
list username, message type
find the k most talkative users
number of words each user types
param k is also given
edge cases:
the file empty?
messages are sep by any whitespace
size of the input is m
no.... | Python | CL | 38e88c75e09a08e041342cef208eb67767c443c0d0c9a0d3e5e71ee6c677f63c |
import glob
import os
import argparse
import tqdm
from copy import deepcopy
import torch
import torch.nn.functional as F
from torch.utils import data
from torch.optim import SGD, lr_scheduler
from torch.backends import cudnn
from torchvision import transforms
from torchvision.datasets import CIFAR10
#from fast_adv.m... | Python | CL | ef9a366119ecac48c120745d0d1947d1393d32d423b503b9236811e5bca76df3 |
import os
import json
import pandas as pd
import numpy as np
import torch
from pathlib import Path
from torch.utils.data import Dataset, DataLoader
import pytorch_lightning as pl
from pytorch_lightning.callbacks import ModelCheckpoint, EarlyStopping
from pytorch_lightning.loggers import TensorBoardLogger
from sklearn.m... | Python | CL | 1f1d21706947ad7426f41e3a40f63e0bc78f4049c69e0314c351d6aeb06bf969 |
__author__ = 'Aubrey'
import copy
from copy import deepcopy
import numpy as np
from numpy.linalg import norm
import method
from preprocessing import NanLabelEncoding, NanLabelBinarizer
from data import data as data_lib
from sklearn.neighbors import KernelDensity
from sklearn.grid_search import GridSearchCV
from sklearn... | Python | CL | 6335db7e78adff5d04fe7d29c403a1ae2a8c6df6983cd517902bc727ab827724 |
import numpy as np
__all__ = ['svd_clean']
def svd_clean(arr, svd_num=[0], kind='ix'):
'''Clean a 2-D array using a Singular Value Decomposition.
Removes singular values according to either an index number that the user
provides, or a percentage of variance explained by the singular values.
t then t... | Python | CL | 65931fb5c30eabb711af557728a5df0e062aac31998218b3b63cf9fe1ce11fe8 |
"""
Computes plume volume metrics from SELFE outputs.
Reads *_salt.63.nc files. Only netcdf output files are supported.
Tuomas Karna 2013-11-08
"""
import sys
import numpy as np
import datetime
import traceback
import time as timeMod
from netCDF4 import Dataset as NetCDFFile
from crane.data import meshContainer
from... | Python | CL | 1bed8fbe0525bb625e77935b2f464473fa00d2c53eeb2df003964a6ec1f45086 |
import numpy as np
import tensorflow as tf
import os
import sys
sys.path.append("..")
import yaml
import random
import numpy as np
import tensorflow as tf
from tensorflow.contrib import learn
from model.adversarial_model import Adversarial_Network
from model.transfer_model import Transfer
from utils.data_loader import... | Python | CL | 62c702e598278eb57108fdda7c6cbafaee9edbf7de0cdd5e35abf693084ddf53 |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# 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 Licen... | Python | CL | 763b71425d98f7fc2f8970ee2b5f0a7c617c9969e9de69254576e1979f5ba03a |
from .craigstrategy import CRAIGStrategy
from .dataselectionstrategy import DataSelectionStrategy
from .glisterstrategy import GLISTERStrategy
from .randomstrategy import RandomStrategy
from .submodularselectionstrategy import SubmodularSelectionStrategy
from .gradmatchstrategy import GradMatchStrategy
from .fixedweigh... | Python | CL | 255a292cb1b4c5214a03d269b7eadc4b56b924acd1be5240ba8c0d8174ec0805 |
"""
Integration Test for querying multiple symbols
"""
import os
import numpy as np
import pandas as pd
import pymarketstore as pymkts
import pytest
client = pymkts.Client(f"http://127.0.0.1:{os.getenv('MARKETSTORE_PORT', 5993)}/rpc",
grpc=(os.getenv("USE_GRPC", "false") == "true"))
@pytest.m... | Python | CL | 1a86ff081b27aa250275e6c182bb7e7771a10e13f23b7eb7363441ac2d63cbc3 |
#! /usr/bin/env python3
# ReScience yaml to latex converter
# Released under the BSD two-clauses licence
def generate_latex_metadata(filename, article):
abstract = article.abstract.replace("&", "\&")
content = (
"% DO NOT EDIT - automatically generated from {filename}\n\n"
"\\def \\codeURL{{{... | Python | CL | 750b15f68ab4bd4c3a2287ab75232edf024ff0ae24e1a713345f156309b38459 |
# Copyright 2017 Inspur Corp.
# 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 ... | Python | CL | f1562c1e874966f01f6f9015b8b4f89090fd39cde3a18b814e1ee3bb376b22eb |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import Union
import networkx as nx
import numpy as np
from scipy.stats import rankdata
from . import assertions
def diagonal_augmentation(
graph: Union[nx.Graph, nx.DiGraph],
weight_column: str = 'weight'
) -> nx.G... | Python | CL | dba6a18701f2e9ba70f2f9130ef95acebabb8f9917ddf91013b109de6c309451 |
# -*- coding: utf-8 -*-
###############################################################################
# This file is part of metalibm (https://github.com/kalray/metalibm)
###############################################################################
# MIT License
#
# Copyright (c) 2018 Kalray
#
# Permission is hereb... | Python | CL | 78d1ebddcd7849708d31f792068e41bf5151663f4147bd38e68860698348c72c |
# Generated by Django 2.2.7 on 2019-12-02 19:49
import django.contrib.auth.models
from django.db import migrations, models
import usuario.models
class Migration(migrations.Migration):
initial = True
dependencies = [
('cliente', '0001_initial'),
]
operations = [
migrations.CreateMod... | Python | CL | dd2349785badc5600123206a95b49770db85d01c3ec410c3e0234014884e25a9 |
import datetime
import uuid
import pytest
from flask import current_app
from AIPscan.models import File, FileType
from AIPscan.Reporter.report_aips_by_puid import get_format_string_from_puid
EXPECTED_CSV_ORIGINAL = (
b"AIP Name,UUID,Count,Size\r\nTest AIP,111111111111-1111-1111-11111111,1,1.0 kB\r\n"
)
EXPECTED_... | Python | CL | 92a9c3f2dc0298d3b59852e0a2b714a3fcc8d27337a52833a1b4dd810729339e |
# -*- coding: utf-8 -*-
'''
Created on Wed Aug 19 12:51:57 2015
@author: Innerfunk
'''
# Initialize
import json
import pandas as pd
import rawpi
import util
TOP_FOLDER = 'AP_ITEM_DATASET'
PATCHES = [str(p) for p in util.PATCHES]
QUEUE_DICT = util.QUEUE_DICT
REGIONS = util.REGIONS
REGION_DICT = util.REGION_DICT
REV... | Python | CL | 2668b3cce5737004d21921c658d9f997b61a3210da4caac82e44f4b8cadd2da8 |
#!/usr/bin/env python
""" Index PubChem Bioassay json files with Elasticsearch or MongoDB"""
from __future__ import print_function
import argparse
import gzip
import json
import os
import struct
import sys
import time
from zipfile import ZipFile
from nosqlbiosets.dbutils import DBconnection
# Document type name for ... | Python | CL | eb758b780a1ab0f63b0fdae24d850f3bc16c38ee9cbd247473b039e6e9f7201b |
# -*- coding: utf-8 -*-
"""
@author: alexyang
@contact: alex.yang0326@gmail.com
@file: keras_han_model.py
@time: 2019/2/8 13:22
@desc:
"""
from keras.models import Model
from keras.layers import Input, Embedding, Dense, Bidirectional, GRU, Masking, TimeDistributed
from models.keras_base_model import KerasBase... | Python | CL | 2129a9a80af7af75197396ac39dcc5b6ae7cf1b5e36ef08c6ac1a5755e177929 |
def CpG(sequence, size=200):
"""
The Sequence Manipulation Suite: CpG Islands
Results for 1200 residue sequence "sample sequence" starting "taacatactt".
CpG islands search using window size of 200.
Range, value
32 to 231, the y-value is 1.75 and the %GC content is 50.5
33 to 232, the y-value... | Python | CL | 01918db2a3df953a5db0fb9f2f3b883b25526df3fef613cec11b340c9d3949b6 |
"""DECaLS"""
import numpy as np
from astropy import units, io, utils
from astropy.table import Table
from frb.surveys import dlsurvey
from frb.surveys import catalog_utils
# Dependencies
try:
from pyvo.dal import sia
except ImportError:
print("Warning: You need to install pyvo to retrieve DECaL images")
... | Python | CL | 8ddc56df8e6acb4883e6bba94b45abb7c0a8f612499ec11ad2e69a329532e349 |
import sys
import json
import lib.args
import lib.help
import lib.util
import lib.style
import lib.brayns
import lib.config
import lib.process
import traceback
try:
print(lib.style.box("SSCx portal movie maker version 0.1.0"))
args = lib.args.parse()
if "help" in args.flags:
lib.help.show()
... | Python | CL | bda0e2322e6bbe4994048f1bd1d1ba1aaf39d1604991fe5fe1404dd14a8b0ca0 |
"""
Copied from: https://github.com/jrieke/traingenerator
Update index.html from streamlit by
- adding tracking code for Google Analytics
- adding meta tags for search engines
- adding meta tags for social preview
WARNING: This changes your existing streamlit installation (specifically the file
static/index.html in st... | Python | CL | 57a8e3e897bf8e631c4792e84621efc7549b698c1ec19ba88b5bc69fd9ff0464 |
from comet_ml import Experiment as ex
from deoxys.experiment import Experiment
from deoxys.utils import read_file
from deoxys.model import model_from_full_config
import matplotlib.pyplot as plt
from deoxys.loaders.architecture import BaseModelLoader
from tensorflow.keras.models import Model as KerasModel
from tensor... | Python | CL | b26b895592b331d61a3692a879724ba5673001417fe6eca5b3e2225af4adb54a |
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | Python | CL | d695fec782f1f4463847d18b352689db9b3f0475f86b5f12d98c53cc8fd34051 |
from rassh.commands.ssh_bonaire_command_base import SSHBonaireCommandBase
from rassh.datatypes.well_formed_command import WellFormedCommand
from rassh.commands import bonaire_functions
class SSHBonaireESSID(SSHBonaireCommandBase):
def __init__(self, expect_manager):
SSHBonaireCommandBase.__init__(self, ex... | Python | CL | bce977ff23ef2d1c3554f78f9c11e84c88363bb71e109f65cf0eb824bb73971a |
from pyspark.sql.types import *
from pyspark.sql.functions import *
from itertools import chain
import numpy as np
from pyspark.ml.feature import Imputer
from pyspark.sql import Window
# fill missing value using mean or median
def fill_missing(df,strategy='mean', missingValue=np.nan):
"""
Fill missing value us... | Python | CL | b6c03659cb1b043fdaf5eb7f84e361af065beda932c0fad86e92c6945e20d4e3 |
import os
from my_app import utils
from my_app.app import app
from flask import jsonify, request, make_response
@app.route('/')
def home():
"""Create a Flask backend API for Whatsapp
The Whatsapp API should contain the following views:
1. GET messages between user1 and user 2
2. P... | Python | CL | cda68dd552ffe6c7971e17b965ce7b4ef00718325a7bbb6907fef3891c9ccb72 |
# The MIT License (MIT)
#
# Copyright (c) 2019 Looker Data Sciences, 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 restriction, including without limitation the rights
# to u... | Python | CL | 7511cd9b064f733619d4a85141b7f27bad2ba4684740df134a87e9acc3a31b70 |
import os
from setuptools import setup, find_packages
from openspending.version import __version__
PKG_ROOT = '.'
def files_in_pkgdir(pkg, dirname):
pkgdir = os.path.join(PKG_ROOT, *pkg.split('.'))
walkdir = os.path.join(pkgdir, dirname)
walkfiles = []
for dirpath, _, files in os.walk(walkdir):
... | Python | CL | 50f709a6d4c02b3ff579e87f7e3cc8011c7483b4e7f813f6a29917f017608c46 |
# 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 ... | Python | CL | 64bfa35de8cfb09ab25f359eaa11965cd2889c12cf3c92c2a61707e65cf513b2 |
import torch
import torch.nn as nn
from models.deep_sets import DeepSet
from models.layers import PsiSuffix
class SetToGraph(nn.Module):
def __init__(self, in_features, out_features, set_fn_feats, method, hidden_mlp, predict_diagonal, attention, cfg=None):
"""
SetToGraph model.
:param in_... | Python | CL | 64f3b3c273f215fae36cbf08bd5adbf39a0d65ca8d4ad97ea2c80f16fdd057ca |
# extract features from list of text instances based on configuration set of features
import nltk
import numpy
import re
import time
import csv
import math
import pickle
import gensim
import keras
from scipy.spatial.distance import cosine
from keras.layers import Input, Dense, LSTM, RepeatVector, Dropout
from keras.mo... | Python | CL | af6de0604463a1b706309589ae241099d2bdd984dc84babf51e714c96835efc0 |
import subprocess
import os
import re
import random, string
import email
import imaplib
import traceback
import datetime
import time
import common
import pool
date_regex = '([0-9]{4}-[0-9]{2}-[0-9]{2})(_([0-9]+))?'
def backup_disks(pool_to_backup, disks, scrub, approve_function):
settings = common.get_settings()... | Python | CL | 31c23fee5da5a32480cb38c234cc311a23b8d25897f31eaf5c97d39001e5b43f |
#!/usr/bin/env python
# coding: utf-8
import random
import numpy as np
import torch
import utils
import checkers
import numpy as np
import matplotlib.pyplot as plt
import cv2
import checkers_swig
import torch
import torch.nn as nn
import torch.nn.functional as F
from tqdm import trange
from IPython.display import clea... | Python | CL | f94778f631925607039e7a2590803d3e3c1fc7d6c82deb7daa047ef6ff09c376 |
from __future__ import absolute_import
from django.db import transaction, IntegrityError, DatabaseError
from django.test import TestCase
from .models import Counter, WithCustomPK
class ForceTests(TestCase):
def test_force_update(self):
c = Counter.objects.create(name="one", value=1)
# The normal... | Python | CL | 3ec179c5315f59b88e98e87db0123f6caa2a28589cc8c4057d11df8f2716b8b3 |
#! /usr/bin/env python
# -*- coding:utf-8 -*-
# CreateDate:
# Author:
import utils
import time
import datetime
import numpy as np
import pandas as pd
import redis
IS_INIT = True
def get_realdata():
"""
仿真产生真实数据
:return:
"""
realdata = list(dict())
for i in range(40):
t = time.time()... | Python | CL | eacab8abc2ac78eab92efd9fcfc8b7efc32f2c026eb703a761fac367914c6499 |
# -*- coding: utf-8 -*-
"""Auto File Organiser made in Python
FileOrganiser
=============
Provides
1. Rearranging files in folders based on their types
2. Script run infinitly so that new files automatically get organised
Use
> Give path of folder as argument while exc... | Python | CL | d27ae319f5938fb0be1825023893b81177efdd20d9bb25c344cbd51f2e36a8e7 |
from json.decoder import JSONDecodeError
import os
import sys
import cgi
import json
from http.server import BaseHTTPRequestHandler
# solve path problem
abs_path = os.path.abspath(__file__)
father_path = os.path.abspath(os.path.dirname(abs_path) + os.path.sep + ".")
project_path = os.path.abspath(os.path.dirname(fathe... | Python | CL | 5e075661937b43324bac2067b69051698e025e396e13b2ffc58f0da4c898d865 |
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
"""
Escriba una función qué reciba cómo parámetros: una cadena con el código alfanumérico del estudiante y cinco números
enteros (nota1, nota2, nota3, nota4, nota5) que representan las notas de los quices del semestre y retorne una cadena
... | Python | CL | 7bc28b4a00ba5966e01d7df26924783077e114c4b02dd5234101bd89cf689347 |
#!/usr/bin/env python
#Import the pandas library and call it pd
import pandas as pd
#Read the 'workouts.csv' that we exported from Training Peaks & list the column names
df = pd.read_csv('workouts.csv')
list(df.columns)
#Print the contents of the column called Title
print(df['Title'])
#Print the title o... | Python | CL | 03880723d051f795481d5cbac46df5e0c1b82709f74cfc420a4b938abfa4d0af |
import re
import sqlalchemy
import server.model.connection
def build_dicts(dim_table):
"""Returns dictionaries for cross-referencing ID fields to values.
Args:
dim_table: (str) Name of dimension table in scouting database.
Returns: A tuple containing two dictionaries. The keys of the first
... | Python | CL | 973d631a6d426718dabf1233b8ff8ea65a3d51dd13ea65ac9839c4be4045ca6c |
# coding: utf-8
"""
MessageMedia REST API
Australia’s Leading Messaging Solutions for Business and Enterprise.
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use thi... | Python | CL | ab2f3b80ec1347c5af0696010b1a0b7674e11123c13ffd99bed9355494a81dd5 |
#!/usr/bin/env python3
from utility import *
def encode_pgm(msg, infile, outfile):
'''LSB encodes a message
Args:
msg (bytes): bytes object to encode
infile (str): name of the raw PGM file on disk to use as the cover
outfile (str): name of the new PGM file to write
Returns:
... | Python | CL | 88a0628633741be6ba5b6da6ad0e6b273b609910a7e4b559451b646060c8ca20 |
from django.urls import include, path
from rest_framework import routers
from . import views
from rest_framework.authtoken.views import obtain_auth_token
router = routers.DefaultRouter()
router.register(r'sms', views.SmViewSet)
router.register(r'devices', views.DeviceViewSet)
router.register(r'college', views.CollegeV... | Python | CL | c85c405c6c496590ac9eae40e644dceac5105038aff9b2976a278a3c4619572e |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import asyncio
import copy
import json
import logging
import requests
import time
import aiohttp
from queue import Queue, Empty as QueueEmptyError
from aiohttp import ClientSession
from hello_proxy_server.proxy import Proxy
from hello_proxy_server.settings import *
__... | Python | CL | 4358dc3b29f38b4d839c4212983cd5f209432d6c0913a38eea0e5ba02ef97754 |
# Importing PyQt5 library to construct widgets for Graphic User Interface (GUI) application
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import (QLineEdit, QPushButton, QVBoxLayout, QHBoxLayout,
QWidget, QLabel,QMainWindow, QTableWidgetItem, QTableWidget, QMenu, QMes... | Python | CL | 02025d669917c1937ecf31a97327e13368ce89d8ddf266b32f40b980a0c87e18 |
#!/usr/bin/python
# this program is for running cmfid docker image
# for output. It will use multiprocessing to make
# 2 threads to call cmfid docker image and get results
# cuncurrently until all the jobs done in input file.
import os
import sys
import config
from util import get_args, split_input_file
import re
imp... | Python | CL | 8b1e89069e4f40038db3192e926a269d0f77202758a4f33cd18114eeaa38c0ca |
#!/usr/bin/env python3
import urllib, json, sys, os
import requests # 'pip install requests'
import boto3 # AWS SDK for Python (Boto3) 'pip install boto3'
# Step 1: Authenticate user in your own identity system.
# Step 2: Using the access keys for an IAM user in your AWS account,
# call "AssumeRole" to get temporary... | Python | CL | 2b614f5b667c1cb4c00c622997c3bc44afbf79d1059ab494460819e192ccd7d4 |
#!/usr/bin/python
# Copyright: 2017, CCX Technologies
import ctypes
import socket
import fcntl
# Generic MII registers.
MII_BMCR = 0x00 # Basic mode control register
MII_BMSR = 0x01 # Basic mode status register
MII_PHYSID1 = 0x02 # PHYS ID 1
MII_PHYSID2 = 0x03 # PHYS ID 2
MII_ADVERTISE = 0x04 # Advertisement con... | Python | CL | 5c9914c8a2c51631ba16ba128eb9e740e21d961267aad371c64abc1ebd242951 |
#
# PySNMP MIB module FOUNDRY-SN-AGENT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FOUNDRY-SN-AGENT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:40:54 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... | Python | CL | cb8ed3cbd1219bf9dbba6786f3c8900047ecb26a500d8e683cd3a297472fc5c8 |
from pyrocko import io, io_common
from pyrocko import model
from pyrocko.snuffling import Snuffling, Choice, Switch, Param
class ExportWaveforms(Snuffling):
'''
<html>
<head>
<style type="text/css">
body { margin-left:10px };
</style>
</head>
<h1 align="center">Export selected or ... | Python | CL | 610b1a4feb77e2901dc0c77c1972b8692e01c6a28f07d856773b83e6ca1c445c |
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2019-present MagicStack Inc. and the EdgeDB 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... | Python | CL | 35a9b2c2cce05fb73774535eace8e8264152ccbf7d1722aaa806a5346c1812a4 |
#!/usr/bin/env python
# coding: utf-8
# # Welcome to the final project!
# During this course we covered linear regression and SVM for data analysis. In this notebook we will be working with data about life expectancy across different countries. We use descriptive features based on statistical data to predict life expe... | Python | CL | 55f0809d3a9eca1b330988f98fd09559c73a6981ca851377c7817fb50517af16 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A utility script to help building Syzygy-instrumented Chrome binaries."""
import logging
import optparse
import os
import shuti... | Python | CL | 1e1374c083499bf3f51c072194adb01594287d37e054bd03c12fccfb8974c918 |
from pathlib import Path
from typing import Dict
from util import _get, _to_absolute_path, _error_if_ukn, _load_mod
from errors import FlootSpecSyntaxError
from spec.spec_item import SpecItem
class FunctionMapper(dict, SpecItem):
""" Used for transformers and comperators
transformers:
source... | Python | CL | c892ce4f084a379bef57ad7d60398b8400d5a5f129efd9b1d31dfa06765f7056 |
# vim: set ts=4 sw=4 et:
#
# Copyright (C) 2008 Novell, Inc.
#
# Authors: Vincent Untz <vuntz@gnome.org>
#
# 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 2 of the License, or
# ... | Python | CL | 372f805f3fadcf684f881da2318b6e7959ff0a83feac22490b8de7cf15c7421f |
from mopy.factories.basicroom import BasicRoom
from mopy.runners import Scheduler
from mopy.entity import Entity, Text, TextAlignment, Sprite, TextView
from mopy.camera import OrthoCamera
from mopy.components import HotSpot, HotSpotManager, Gfx, Cursor
from mopy.shapes import Rect
import mopy.monkey
import mopy.engine
... | Python | CL | bc07bc8026abc9cfe22f963417c8a6a42fa8fe9a1f203db463ca64307419bd02 |
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
import time
from webdriver_manager.chrome import ChromeDriverManager
test_url = "https://datastudio.google.com/u/0/reporting/fc733b10-9744-4a72-a502-92290f608571/page/70YCB" #This is the Data-studio link we will be testing
te... | Python | CL | b41beba84dae517a6dea8abf2173d5babd7e6923c6ee7c792a0094a38af3a51a |
"""
Author: Yaan Dalzell
Created: 24/01/2021
License: All contents are the intellectual property of Yaan Dalzell
Not to be used in any manner without written consent
Description: Scrapes data from the given url
Last Valid On 24/01/2021
"""
from selenium import webdriver as w... | Python | CL | 4fc0f19943ef163c7f7419ac94c720a8b5b26b5e3d46dad54c5d195ada45ad5b |
from django.shortcuts import render, redirect
from django.http import JsonResponse
from django.core.urlresolvers import reverse
from utils.mixin import LoginRequiredMixin
from django.views.generic import View
from django_redis import get_redis_connection
from apps.goods.models import GoodsSKU
# Create your views here... | Python | CL | a07579d8466270a5d9c73e46eaf40ecc6ae4605a21850e537a10686eac162475 |
import os
from fastapi import FastAPI
from fastapi_sqlalchemy import DBSessionMiddleware # middleware helper
from fastapi_sqlalchemy import db # an object to provide global access to a database session
from sqlalchemy.ext.declarative import declarative_base, declared_attr
from starlette.middleware.cors import CORSM... | Python | CL | 16f460adddb4141be229d2448fcc81d67ef85ce2d76b1192285283fba38f8fa3 |
# Exercício Python 107 - Exercitando módulos em Python
# Crie um módulo chamado moeda.py que tenha as funções incorporadas aumentar(), diminuir(), dobro() e metade().
# Faça também um programa que importe esse módulo e use algumas dessas funções.
def moeda(preco, moeda='R$'):
"""
Retorna o preço form... | Python | CL | 1d3efc1e8aebab0669eeb4580b7606eb65cee5da51a604ec89fbc3f9a6966e78 |
# Import generic packages
import time
# Import multi-threading capacity
from multiprocessing import Queue
from threading import Thread, Event
# Import GUI packages
import tkinter as tk
import tkinter.font as tkfont
import tkinter.ttk as ttk
class gui_manager(Thread):
def __init__(self, outbound_queue, in... | Python | CL | ae99aeb4ef8d1e85f1ec14ab492d706cf2cb64fa243f760dbd3e87c3f2548648 |
#!/usr/bin/python3
tf.contrib.seq2seq.sequence_loss(
logits,
targets,
weights,
average_across_timesteps=True,
average_across_batch=True,
sum_over_timesteps=False,
sum_over_batch=False,
softmax_loss_function=None,
name=None
)
| Python | CL | a169de2eba8e939fb632f7b744f5fd8e76700420c3a3733482e21146d7696457 |
#!/usr/bin/env python3
#encoding=utf-8
#----------------------------------
# Usage: python3 4-getattr-v-getattribute.py
# Description: compare the __getattr__ and __getattribute__
#----------------------------------
'''
To summarize the coding differences between __getattr__ and __getattribute__,
the following ex... | Python | CL | 6ac6522f1a1d822a8bee8cdb1e61945b7fd684b5f3455fbd062e350fb8e0c27f |
from abc import ABC, abstractmethod
class Env(ABC):
"""
An environment that an agent can interact with.
"""
def __init__(self):
"""
Creates the environment and allows an agent to interact with it.
Properties:
state_space (tuple): The dimensions of the input state.
... | Python | CL | 31af4f8f6ef142efc1012454ec5d3c987e3436bec2f29c741ffc870ee74f0758 |
import pandas as pd
import newspaper
from newspaper import Article
import torch
import numpy as np
from transformers import BertTokenizer
from transformers import BertForSequenceClassification
import pandas as pd
from textblob import TextBlob
from urllib.parse import urlparse
label_dict={'center': 5,
'left': 2,
'... | Python | CL | ba90bd86eaa017be897527cac85802790c996490894987dbec6a3700413d142e |
from pygame.rect import Rect
from pyplatformerengine.physics.CollisionDetectionFactory import CollisionDetectionFactory
"""
A basic physics component for moving a character around.
"""
class MotionlessPhysicsComponent:
"""
Initializes the object.
"""
def __init__(self, _id, desc... | Python | CL | 40540bebe8d6b93c747d085a98dffe5850f39139db56b401cc7b27c03e608d53 |
import numpy as np
from hamiltonians import hamiltonian_two_sites
from general_functions import (compute_eigensystem, compute_adiabatic_parameter, compute_parameters_interpolation, compute_period,
solve_system_unpack, sort_solution)
import matplotlib.pyplot as plt
import concurrent.futures
from scipy.constants import ... | Python | CL | 8835007c78d1437b05ca1b111e19c058da6201c7565b12ed55cb6d134f864db0 |
import requests
import time
import tempfile
from .config import url_request, url_response, app_key
from .errors import RuCaptchaError
class RotateCaptcha:
def __init__(self, rucaptcha_key, sleep_time=5):
'''
Инициализация нужных переменных, создание папки для изображений и кэша
После заве... | Python | CL | f8f609b18750bf29e97d2a1463ecf42e737b4891bf7015eab30c75a94fbc9366 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.