text stringlengths 65 6.05M | lang stringclasses 8
values | type stringclasses 2
values | id stringlengths 64 64 |
|---|---|---|---|
#!/usr/bin/python3
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.functional as F
from models.base import KGEModel
from utils.math_utils import householder_reflection, householder_rotation
class EKGEMod... | Python | CL | 4b8f30cbc7a11e42aeac35655d977ecf35e2ce976b4adf1b02fb34f02ad0ad47 |
#!/usr/bin/python
#
# Copyright (c) 2016-2017, Cray Inc.
# All rights reserved.
## @package set_gattr
# Exercise the PWR_GrpAttrSetValue() function.
import collections
import json
import os
import re
import sys
# Import common test code
from common import init, error_message, skip_test, skip_test_if_not_root
from p... | Python | CL | b7969fdb45375fdae83da5b5f8c49c1ca7d281a14c50a161a9f0e0c62f858722 |
import torch
torch.backends.cudnn.benchmark = True
import torch.nn.functional as F
import os
from core.network import Network
from core.optimizer import Optimizer
from core.buffer import ReplayBuffer
from .base import BaseAgent
from .utils import OU_Noise
class DDPG(BaseAgent):
"""Deep deterministic policy grad... | Python | CL | 8cd64a5dd4671c33050d27742457f30646d57308187a2f40cdcad466caeee90c |
"""Aiounifi errors."""
class AiounifiException(Exception):
"""Base error for aiounifi."""
class RequestError(AiounifiException):
"""Unable to fulfill request.
Raised when host or API cannot be reached.
"""
class ResponseError(AiounifiException):
"""Invalid response."""
class Unauthorized(Ai... | Python | CL | 89e8e516de546e3ee5d80124f40dd54e3dc47493f4b990e81898a0657744a167 |
#!/usr/bin/env python
"""
@package ion.agents.instrument.protocol_param_dict
@file ion/agents.instrument/protocol_param_dict.py
@author Edward Hunter
@brief A dictionary class that manages, matches and formats device parameters.
"""
__author__ = 'Edward Hunter'
__license__ = 'Apache 2.0'
import re
import logging
mi... | Python | CL | 6b1d7f16edb4e667c2dbaad7175d9f70fe31e227a1c9470e1ab9ac63b75e2da4 |
# -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-节点管理(BlueKing-BK-NODEMAN) available.
Copyright (C) 2017-2022 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance ... | Python | CL | f5e1a4d14c662958a826d7eaf15c2c8e8c3ee46deaf875ea98df3e39d48da353 |
# Copyright Contributors to the OpenCue Project
#
# 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... | Python | CL | 186e5ade2d669e796d3644d3901eda04a840929852dcc394e543275b218cd1b2 |
"""
Base algorithms actions module.
Created on 21.04.2020
@author: Ruslan Dolovanyuk
"""
import abc
class BaseAction(abc.ABC):
"""Base class for all actions."""
def __init__(self, index):
"""Initialization action.
index: id current item for order;
"""
self.index = index
... | Python | CL | 37c778052893079c803f2366a4fe81d85f06cb059c67310edd16d52cd342f760 |
#
# PySNMP MIB module NETSCREEN-USER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NETSCREEN-USER-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:10:44 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | Python | CL | be6e6737ddf281aa2128422ffc75d3dcf604769d9b155570ac46b0523db02cae |
# 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 | 51dcc24a4ae98b99fcd71f7179093d96115794c71dbf087e3cfdca717f473742 |
from .peaks import read_binary as read_peak
from .calibration import read_csv as read_calibration
from .housekeeping import read_csv as read_housekeeping
from .raw import read as read_raw
from .mie import makeMie_diameter as simulate_scattering_intensity
| Python | CL | 79c25cd011e097285c8c6628bf7130a3d0789b2b892fb3477b2c0e5486060645 |
import json
import logging
import os
import base64
import hashlib
from slugify import slugify
from search import settings
from search.indexing.strip_html import strip_html
from search.extraction.code_du_travail.cleaned_tags.data import CODE_DU_TRAVAIL_DICT
from search.extraction.fiches_ministere_travail.data import F... | Python | CL | dd60363a37e810cd77c92ebd8003a1bc7d61aee4764e62e7c9090be3cabe2ae6 |
from Constants import constant
from WatchYourBack.Piece import Piece
from Evaluation.Features import Features
from ErrorHandling.Errors import *
from copy import copy
import traceback, sys
'''
THIS CLASS IMPLEMENTS THE BOARD GAME AND ITS MECHANISMS
THIS USES AN OBJECT ORIENTED APPROACH TO REPRESENTING THE BOARD AND ... | Python | CL | be15e93031edd6f74124f8a03bc82d4944caf629e22681bc433b9982a3d68d4a |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as st
import seaborn as sns
def set_plot_details(axs, xticks=None, yticks=None, xlabel=None, xlabel_fontsize=None, ylabel=None,
ylabel_fontsize=None, title=None, title_fontsize=None, grid=False, legend=None):
"""
Function ... | Python | CL | 38d11a88b2665cd88924e691f6992d71db56c89b94216174b44b12368886d45d |
from serial import Serial
from packets import ArduinoToPiPacket, PiToArduinoPacket, PiToArduinoCmd, ArduinoToPiRsp
class ArduinoInterface: # NOTE: CALLBACKS WILL FAIL AFTER 2^32 PACKETS ARE SENT
def __init__(self, port, baudrate, timeout=3.0): # NOTE: REQUIRES TWO SECONDS TO START
self.serial_port = Serial(por... | Python | CL | 32115387390a4f8f8bb3a9d2b18685024f9d4bd4719fbf9822e0d5c8548c9787 |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** 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
from ... import _utilities, _tables
__a... | Python | CL | f9ce5b12e861c614dc30f8fe9d9353a6eb0b4e5b32841526a2112a738e096fb8 |
import socket
import binascii
class IpPacket(object):
"""
Represents the *required* data to be extracted from an IP packet.
"""
def __init__(self, protocol, ihl, source_address, destination_address, payload):
self.protocol = protocol
self.ihl = ihl
self.source_address = source_... | Python | CL | 727a1354dd1f98bd3e003e194d1f903c255a401201716bbc53e929ba327fecb0 |
import os.path as op
from sfepy.base.base import *
import sfepy.base.ioutils as io
from sfepy.fem import ProblemDefinition
from sfepy.solvers.generic import solve_direct
from application import Application
def assign_standard_hooks(obj, get, mod):
"""
Set standard hook function attributes from `mod` to `obj` ... | Python | CL | 7731e22d930ea6706b08335374544b17a6e76410dfa638dfc3cbe67812b70c12 |
""" This file handles anything that comes to applications
including apply for project, accept and deny applications.
"""
import cherrypy
import json
import requests
import psycopg2.extras
from datetime import date
class ApplicationHandler(object):
""" Object for project's applications """
# This is domain... | Python | CL | fb440f4ac580b62a701e5249a3993a89025b233da4eeac93544967a680a94c5a |
"""
A series of clustering algorithms for use on an adjacency matrix which is
stored in the form of a pandas DataFrame.
"""
import numpy as np
import pandas as pd
import pyximport; pyximport.install(reload_support=True)
import clustering_c
reload(clustering_c)
def _brute_force(adjacency, hessian):
"""
Use bru... | Python | CL | 07bcd69c38df1da2a58dc8fee495e13f46d7e9a62828cac3bcd5df547c8f6b27 |
"""
Crear utilidades matemáticas:
a. Escribir una función a la que se le pasa un número y devuelve una tupla con sus divisores.
b. Se define un número primo como aquel que no tiene más divisores que él mismo y la unidad.
Escribir una función que nos devuelva un True en caso de que ser un número prim... | Python | CL | 38be744729f6ccb47aa8e831b3a204e85d4b55a54c5e87ba2c75a1b2c32a8796 |
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 21 16:02:58 2016
@author: cs390mb
Assignment 2 : Activity Recognition
This is the starter script used to train an activity recognition
classifier on accelerometer data.
See the assignment details for instructions. Basically you will train
a decision tree classifier and... | Python | CL | e9a11301e63b102774c55e21bf6a296728677789820e9e06c4932f3816a033c9 |
from string import ascii_uppercase
from reflector import Reflector
from validation import Validator, TypeValidator, RangeValidator
class Rotor(Reflector):
"""
Generic Rotor class
This class simulates a rotor with custom wiring pattern in the Enigma machine. It provides functions for mainly
perform t... | Python | CL | fe569d968308aa13ecd9e200f0aadeabee25c42fa75f13766393247d3e1b9c2b |
#! /usr/bin/env python
import os
import argparse
import numpy as np
import pandas as pd
from scipy.io import mmread, mmwrite
from scipy.sparse import coo_matrix
from schpf import scHPF
from schpf import load_model, save_model, run_trials, max_pairwise_table
from schpf.preprocessing import load_and_filter, load_coo
... | Python | CL | c4b72bd330a7cb739a41bee1e84c2eb7fa353c2ae43ee3c7329c8700e106639c |
#------------------------------------------------------------------------------
# Copyright (C) 2009 Richard W. Lincoln
#
# 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 restrictio... | Python | CL | 7a618d73e2be6c72f633be0dd1a93db0d236059a337c563ec2f11b6e1a79134c |
# tracks taken from geneset comparison
# need to integrated
from RnaseqReport import *
class AnnotationsAssociated:
pass
##########################################################################
##########################################################################
#########################################... | Python | CL | d0b274fbde00c8b9abce8c7848b8556eacbf4eeeff137aaee8ce97394eeab42b |
############################
# Setup
############################
import DotsnBoxesGame as env #environnement du jeu
from math import log
from random import choice
from os import path
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from ... | Python | CL | b098adb1e1c3d9041de68232ddcb391c99a9b609865b1d04adace45e8f562ebc |
#!/usr/bin/env python
# coding:utf-8
"""
descriptor
"""
"""
definition(short version):
Descriptors are objects with any of __get__() , __set__() , or __delete__().
These descriptor objects can be used as attributes on other class definitions.
definition:
In general, a descriptor is an object attribute wit... | Python | CL | 539a02e0814b1431fe9aa11cdafc33e0c1f2d8202c2e36b215448cf82dacfea2 |
import os
from gensim.models import Word2Vec
import keras.backend as K
from keras.models import Sequential, Model, load_model
from keras.layers import Dense, LSTM, Input
from numpy.random import normal, randint
import numpy as np
from utils2 import get_timestamp, train_model, test_model
from gradient_reversal_keras_t... | Python | CL | b7f3b1f525e757596dd8ebc54e68e99c7deb4fae46e631d15aa7629fd5c2a10a |
import sqlite3
import json
import time
import location_database_utils
import pendulum
DB_PATH = '.taisteal.db'
def _connect():
db_connection = sqlite3.connect(DB_PATH)
db_connection.row_factory = sqlite3.Row
return db_connection, db_connection.cursor()
def _create_tables():
print('Creating databas... | Python | CL | c1349f5a1b1830a5da2987968256c12eedfb5c43c2bc6f18fd157363e4cf3b4f |
# follow Google coding standards for imports
import copy
import multiprocessing
import os
import time
import sys
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import torch
import torchvision
from sklearn import preprocessing
from torch.optim import lr_scheduler
from zmq.devices import device
fr... | Python | CL | 4a9790ef476c5393142b00a6a139c44fe748571dea78caba4a939da0f5e0f68b |
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 17 13:20:02 2017
@author: Weiyu_Lee
"""
import os
import sys
sys.path.append('./utility')
import tensorflow as tf
from tqdm import tqdm
import numpy as np
import model_zoo
import scipy.misc as misc
import random
from utils import (
read_data,
... | Python | CL | 0209b58a4498a0941680bcf05798bdbcd98f06b6ad0e9faba8da40f731b59ff2 |
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
plt.ioff() #turn of the interactive plotting
import matplotlib as matplotlib
import numpy.fft as fft
import corner
import h5py
import sys
import scipy.interpolate
import tools
import map_cosmo
import xs_class
import PS_function
import itertool... | Python | CL | 003d0dbc599329adf218a29eae88ef53e48023c558e701ef5de68ad7e85404dd |
from __future__ import absolute_import
"""
init for mapanalysistools
"""
# Use Semantic Versioning, http://semver.org/
version_info = (0, 1, 0, '')
__version__ = '%d.%d.%d%s' % version_info
import mapanalysistools.getTable
import mapanalysistools.analyzeMapData
#import mapanalysistoolsplotMapData # removed - is an o... | Python | CL | 69efda68472a0d523f1d226c18a92cc869d071c3eb565e5f813fab35f16d9d9f |
import scipy
from scipy import signal
import matplotlib.pyplot as plt
import numpy as np
def butterlowpass(x, fpass, fstop, gpass, gstop, fs, dt, checkflag, labelname='Signal[-]'):
'''
:param x: Input signal
:param fpass: 通過域端周波数[Hz]
:param fstop: 阻止域端周波数[Hz]
:param gpass: 通過域最大損失量[dB]
:param ... | Python | CL | 194f4198802ac992cd89f1b79c6f68963f6db88869f652766f0643a6d3cfd537 |
## Import relevant libraries and dependencies
import numpy as np
import torch
from torch.autograd import Variable
import torch.nn as nn
import random
# GPU check
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
## Good-Old Vanilla LSTM Model
class VanillaLSTM (nn.Module):
def __init__(self... | Python | CL | 5f4b42540b6fedfb766efd7bc0af9511028d72dfd7abef0dcfdbcf5baacf7ff7 |
# -*- coding: utf-8 -*-
from PyQt5 import QtCore, QtWidgets
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtWidgets.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtWidgets.QApplication.translate(con... | Python | CL | eb61f7b29ec92f48bf2ff4afba31b55b4dd23206f517b9bf13c55d7f4f86ab9a |
# -*- mode: python -*-
import sys
sys.setrecursionlimit(5000)
block_cipher = None
a = Analysis(["begin.py"],
pathex=["C:\\Users\\Administrator\\Desktop\\tieba"],
binaries=[],
datas=[(".\\scrapy","scrapy"),(".\\scrapy.cfg","."),(".\\tieba","tieba"),
... | Python | CL | 47158cc6ad0d6badaec8790d1d370ca0d4797e324c78df706173aac7b7fcb555 |
import itertools
import pickle
import tensorflow as tf
import numpy as np
from PIL import Image
from dependencies import facenet
from dependencies import detect_face
class FaceDetection:
MINSIZE = 20 # Minimum size of face
THRESHOLD = [0.6, 0.7, 0.7] # Three steps's threshold
FACTOR = 0.709 # Scale fac... | Python | CL | 1b5856066c6d2a73a8cdbfad4d05d74bf251c85031d90b425a47b16459056559 |
from .errors import MissingScriptError
# from .registry import Component, get_script
from .top import find_script
from .decorators import Component
from .util import autofill_args
from omnibelt import get_printer
prt = get_printer(__name__)
@Component('run_mode/default')
class Run_Mode:
'''
Run mo... | Python | CL | 4bc743756b7bbc714cd9150a6df03ba28732f07bf64825ff165d02bf35bca35f |
# Generated by Django 3.0.4 on 2020-08-18 09:30
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('main', '0145_invitations_date'),
]
operations = [
migrations.CreateModel(
name='Invitation',
... | Python | CL | bba18ad69aa37bc665ff4441083427dd94f2ead71ce0ad9f2384eccebbe735f2 |
from config import database_config as dbcfg
import pandas as pd
import pymysql
import config.database_config as dbc
import sys
from sqlalchemy import create_engine
import logging
def set_logger():
""" set scraper module logger
"""
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
... | Python | CL | 3e4140cdd22fbc2cd9d9cb8755c6337761d96e9cf48de14204bf829346df92db |
#!/usr/bin/env python
# _*_ coding: utf-8 _*_
################################################################################
#
# Copyright (c) 2014 All Rights Reserved
#
################################################################################
"""
This module realizes unit test for mini spider.
Author: weile... | Python | CL | b8681be4a3d405277aa4e67a810b7306977127ddd809ddea8499b37f8dfdf6e6 |
# Copyright (c) 2013 Mirantis 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 writ... | Python | CL | 8b2f48d14b5fe5ff89912fabd5d89d80d55613005bc4eded4271c9db6dd3b21f |
"""Rocket league item pipeline."""
from scrapy.exceptions import DropItem
from scrapy.spiders import Spider
from rlgpy.scraper.items import (
RlItem,
RlTrade,
RlAchievement
)
# Normal for pipeline class... pylint: disable=too-few-public-methods
class RlItemPipeline:
"""Rocket League item data pipeli... | Python | CL | 0c67d90d15895c549e74ed416cea10ddae3fc61a044383543b9a565d2e4eb668 |
import collections
import logging
import re
import mongoengine as me
import pymongo
import review
import rating
import section
import term
from rmc.shared import rmclogger
from rmc.shared import util
import user_course as _user_course
# TODO(david): Add usefulness
_SORT_MODES = [
{
'name': 'popular',
... | Python | CL | 40cd672e66df4b44b1e2231743ffe736d51160e49fa0f7b3acf69c95dfe68c4b |
import imath
##########################################################################
#
# Copyright 2010 Dr D Studios Pty Limited (ACN 127 184 954) (Dr. D Studios),
# its affiliates and/or its licensors.
#
# Copyright (c) 2010-2011, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in sourc... | Python | CL | 48911736fe1709737551c692d9ccfdeac2ae5be9b5f8247b5c2b5dee19741351 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from . import Dataset
from deepy.utils import FakeGenerator, StreamPickler
import logging as loggers
logging = loggers.getLogger(__name__)
class OnDiskDataset(Dataset):
"""
On-disk dataset.
The data should be dum... | Python | CL | 194e92c14d0eabc19ee55ae8ced5c3e1f22a09691ca84652d847d41432ec59eb |
# 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.
# --------------------------------------------------------------------... | Python | CL | e9add4033826760a29af7fdea6ec00a7649ac8ca3332af0c2aad8078b47b5264 |
import os
import sys
import matplotlib
from matplotlib import pyplot as plt
import numpy as np
import seaborn as sns
from lcdblib.plotting import results_table
from lcdblib.stats import fisher
import pybedtools
import pandas
import argh
from argh import arg
def plot(de_results, regions=None, peaks=None, selected=None... | Python | CL | b13462e6a7678cb447c33bda8c1d097b6a14532d9203c45a5c8f4f1f933e9566 |
import argparse
def get_argparse(answer_type="answer_extraction", return_parser=False):
parser = argparse.ArgumentParser()
# setup/logging parameters
parser.add_argument(
"--bert_config_file",
default=None,
type=str,
required=True,
help="The config json file corresp... | Python | CL | b87b6158ea922105726be4ad908c291478c24ea8a5207188117f0cc29deafef0 |
#--------------------------------------------------------------------------
# File and Version Information:
# $Id$
#
# Description:
# Module config...
#
#------------------------------------------------------------------------
"""Job configuration for pyana
This software was developed for the LUSI project. If you ... | Python | CL | 953a10cc3feb8ffdfd071e21543cc58add7fb5bd1b6c954131b0bc399a12c896 |
"""
Django settings for trip_1 project.
Generated by 'django-admin startproject' using Django 3.2.4.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
imp... | Python | CL | a13f453e78caa9f97e81a462073c031062662677fbca7e3014bd679405cc537d |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-08 02:37
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... | Python | CL | f7fdc26f12fc441425426d6bb784f3fe651c6a1fdc92949be74442521930793e |
# https://leetcode.com/problems/isomorphic-strings/?tab=Description
# Given two strings s and t, determine if they are isomorphic.
# Two strings are isomorphic if the characters in s can be replaced to get t.
# All occurrences of a character must be replaced with another character while
# preserving the order of chara... | Python | CL | cea3640d47891266b60ddba4e2ed58852c65d6870143ca9001908afb7146e6d2 |
# -*- coding: utf-8 -*-
"""
rater.views.core
~~~~~~~~~~~~~~~~~
This module implements the core views. These are usually language
independent view functions such as the overall index page.
:copyright: (c) 2009 by Rater Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more det... | Python | CL | 7a7bd7fb1ec733da639d167b6b0df419fc80968a9decb3e8e0d116ee13a7ea95 |
# This is the Twisted Clien EHA Now! client, version 5.0.
# NOTE: This should not be used as the basis for production code.
# It uses low-level Twisted APIs as a learning exercise.
import datetime
import time
from sources.ebilockorder import Ebilock_order as eb
from sources.hdlc import read_hdlc
from twisted.internet... | Python | CL | e9b4441de81c4b3ffdee0cd87fb8c8e185d84c0a88dcd05acfdd9fd3189e0ea3 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__copyright__ = """ This code is licensed under the 3-clause BSD license.
Copyright ETH Zurich, Laboratory of Physical Chemistry, Reiher Group.
See LICENSE.txt for details.
"""
"""
Utility functions for conversions between molecule/atom representations.
"""
from vtk impor... | Python | CL | d586b3434d60d55ee150bd205218a72aeb10ff9d1824a15bf87eba7c650fa3e6 |
# Generated by Django 3.0.1 on 2020-01-06 23:59
import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
from django.utils.timezone import utc
class Migration(migrations.Migration):
initial = True
dependencies = [
('equipment', '0004... | Python | CL | d6a4553722943a7dfced71e67a7a3374988621edca4b752486179a7c74746223 |
# Utility routines for processing reanalysis precipitation data for
# the Snow on Sea Ice project
import numpy as np
import xarray as xr
import pandas as pd
import glob
import os
import datetime as dt
import calendar
from precipitation.constants import filepath, vnamedict, arctic_mask_region
from precipitation.const... | Python | CL | 7f88980651c57d1312f81dbb0e050ea9f9058a00dcd8f75b17912a541d648934 |
import os
import tensorflow as tf
# tensorflow_hubから圧縮されたモデルデータをゲットする
os.environ["TFHUB_MODEL_LOAD_FORMAT"] = "COMPRESSED"
# 必要パッケージインポート
import IPython.display as display
import matplotlib.pyplot as plt
import matplotlib as mpl
mpl.rcParams["figure.figsize"] = (12, 12)
mpl.rcParams["axes.grid"] = False
import numpy ... | Python | CL | ab4128494536911015dfc6bac9a8b439c828d2ba82fea73939e078018f41ae20 |
#------------------------------------------
#--- This code create a client, which subcribe a topic "test/topic" on server "test.mosquitto.org"
#--- and loop forever waiting a mesage comming to print out
#--- Author: Minhnt27
#--- Date: 6th May 2020
#--- Version: 1.0
#--- Python Ver: 3.7
#--- ref from: https://pypi.org/... | Python | CL | 9e2aa5026b1d070796431e3fcb074a330e0978cebb072040598d687bdb30da04 |
# Generated by Django 2.2.7 on 2019-12-06 00:35
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('task', '0013_auto_201911... | Python | CL | c43e32ffcb70c78580e7007c6cc91fc35ae901bebf0e6a3172213fd59f714547 |
from abc import ABCMeta, abstractmethod
class BooknotStorage:
__metaclass__ = ABCMeta
@abstractmethod
def exists(self) -> bool:
raise NotImplementedError()
@abstractmethod
def init_store(self) -> None:
raise NotImplementedError()
@abstractmethod
def create_sphinx(self, p... | Python | CL | 18d132a8406794cea33439b98d4330279dda36011433c2856bff1aafdc00069e |
import pickle
from copy import deepcopy
# -----------------------------------------------------------------------------
# Automata classes
# -----------------------------------------------------------------------------
class State:
def __init__(self, abc):
self.next = {symb: set() for symb in abc}
... | Python | CL | 48511913ee282e59ccd1b11ff3dbdf58bfaf7b4fbf3920076b4c74d8c69f5e36 |
# Django settings for wardenclyffe project.
import os.path
import sys
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = ()
MANAGERS = ADMINS
WATCH_DIRECTORY = "/var/www/wardenclyffe/tmp/watch_dir/"
ALLOWED_HOSTS = [".ccnmtl.columbia.edu", "localhost"]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends... | Python | CL | 033137e360b4951aad824922071d2fc308c9c052decdd76ae5e034013a3568a2 |
from django.core.management import call_command
from django.test import TestCase
from integration.models import Channel, Category
class ImportCategoriesTestCase(TestCase):
csv_dir = 'integration/tests/'
def test_created_objects(self):
"""
Asserts the correct amount of created objects.
... | Python | CL | da50ea6910a4ba2ee45b7e54d0bf63dc437388d6688389c3ca71749c8486243f |
# coding=utf-8
#!/bin/bash
# 本程序的目的是在前端发布时,自动将.html文件中引用到的静态文件文件更新为:{原文件名}_hash.{ext}
# 参考:
# http://www.infoq.com/cn/articles/front-end-engineering-and-performance-optimization-part1
import hashlib
import re
import shutil
import os
import importlib
import sys
from bs4 import BeautifulSoup
import codecs
import loggi... | Python | CL | ff741bf847232793368c3e6bb8f24fe6b98b437c95debcccb4da6692a985a479 |
# Generated by Django 2.2.19 on 2021-02-25 18:41
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('course', '0040_auto_202... | Python | CL | 9f5e5b879137e76d83b6d0a4a9116b5b154da7e6a57b8a8fd1b6d557af36aaca |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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... | Python | CL | e3ea46fdbfeaec9e3e52290ec34928f3b9105e4b73a7a621ea91dcecfff5e7c2 |
"""
Character recognition software is widely used to digitise printed texts. Thus the texts can be edited, searched and stored on a computer.
When documents (especially pretty old ones written with a typewriter), are digitised character recognition softwares often make mistakes.
Your task is correct the errors in the... | Python | CL | 1a62f4bb81fde47e299e5ac0e99499d0713e030d094ea080b26ae37e3cdbc37a |
from setuptools import setup, find_packages
from os.path import join, dirname
setup(
name="pyinstagram",
version="3.0.0",
author="Oleg Yurchik",
author_email="oleg.yurchik@protonmail.com",
url="https://github.com/OlegYurchik/pyinstagram",
description="",
long_description=open(join(dirname(... | Python | CL | cced89ec6ff0721b45a6f63703cf826383160cd1c5fa1962681249dedaca2925 |
from selenium.common.exceptions import NoSuchElementException, ElementNotVisibleException, ElementNotSelectableException
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from selenium.webdriver.common.action_chains import ActionChains
from Basics.test_framework.utilities.... | Python | CL | b8586a8c1a056e27a1f5bb1a64cb69c8eebe3e4baaee2dbcb7a088e758ff0235 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Copyright (c) 2013 Guan Bo <guanbo2002@gmail.com>
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 limitatio... | Python | CL | 0d3a1517e32e01cba5651fb172a28f0e3b1d2df25ecafe8f2b39f586603311b9 |
from datetime import timedelta
from city_scrapers_core.constants import CITY_COUNCIL, COMMITTEE, FORUM
from city_scrapers_core.items import Meeting
from city_scrapers_core.spiders import LegistarSpider
class AlleCountySpider(LegistarSpider):
name = "alle_county"
agency = "Allegheny County Government"
tim... | Python | CL | ff90e1ad055a026c56373f6f1fd1ca160f65e809de2e3a9bdae6e6231e00c8a5 |
import urlparse, time, functools
import cyclone.web
import oauth2
from oauth2 import generate_verifier, Consumer, Error, MissingSignature
from twisted.python import log
from twisted.internet import defer
from cycloauth.utils import (generate_string, get_normalized_parameters,
NOnceLi... | Python | CL | 8b2c8df29597ab565064ffd28ee50542ee4bb9f297b3d22e3fc0072aa624a8dd |
# mypy: ignore-errors
import railroad
from pip._vendor import pyparsing
import typing
from typing import (
List,
NamedTuple,
Generic,
TypeVar,
Dict,
Callable,
Set,
Iterable,
)
from jinja2 import Template
from io import StringIO
import inspect
jinja2_template_source = """\
{% if not emb... | Python | CL | 9f19833a8605f4d5ee2da198cb4d6d2858e4351796265ac616e24d584893a3ce |
import torch
def my_imfilter(image, filter):
"""
Apply a filter to an image. Return the filtered image.
Args
- image: Torch tensor of shape (m, n, c)
- filter: Torch tensor of shape (k, j)
Returns
- filtered_image: Torch tensor of shape (m, n, c)
HINTS:
- You may not use any librar... | Python | CL | 8aef09c1345a4a9d1e6ab4f04cf284529afd54840c1e42e91002d5ffbd7ea418 |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: monitor.proto
import sys
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.proto... | Python | CL | 6664eb43f2d1441fefc0fab9f8439b0810741c036229be36510c393c6f57ecea |
# Copyright 2021 NREL
# 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, software
# distri... | Python | CL | 50b359f4a273417273ef52ff7ffff42906d3ac2830162f77d0637d81c963c4d0 |
# coding: utf-8
# flake8: noqa
"""
Модуль для конфигов сервиса Parse.
"""
from __future__ import absolute_import
from ..templates.config import create_conf
#
PARSER_DIR = ''
# DC, MPConv
SORT_CMD = 'sort -S 1024M'
# утилита распаковки архивов
ARCHIVE_UTIL_CMD = '7z'
# регулярное вырпжение, описывающее поддерживаем... | Python | CL | be9c03716f1ff8ead9cfd9cc83a4efd951f23592ca8013f4447d39dcc4f3cc9a |
#
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020 Intel 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | Python | CL | c30d8a481133542f5c87233e817c96fbdd327a4300a983564a3da72afed97f8d |
import kivy
from kivy.app import App
from kivy.lang import Builder
from kivy.core.window import Window
# screen
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.scrollview import ScrollView
from kivy.graphics import Color, Rectangle
from kivy.uix.filechooser import FileChooserIconView
# object
fro... | Python | CL | 26eaab66b93c678a6f20728046a139b7bdf20fe7bd47384a6c3c06053773efe1 |
import os
# from .department import Department
from pipe.am.element import Element
from pipe.am.environment import Department, Environment
from pipe.am import pipeline_io
from pipe.am.registry import Registry
'''
body module
'''
class Body(object):
'''
Abstract class describing bodies that make up a project.
''... | Python | CL | e1fc52f03cc637fdb770080d3d30f75fadb28e049b437030c42459a88f0b7070 |
## @file KeyWording.py
# @brief This module sends the proper keywords to the database
# and works on the number of occurances of each keyword per article.
import sqlite3
import sys
import re
import time
import PdfDownload
from collections import defaultdict
import math
connection = None
## @fn regexp(expr, item)
... | Python | CL | 574310d82725bd305c73b6deccd401ad6b9f6298835f296090dc963a794fdc9c |
import json
import re
from datetime import datetime
from typing import Any, Dict, Optional
from dateutil import parser
from django.conf import settings
from django.http import JsonResponse
from django.utils import timezone
from django.views.decorators.csrf import csrf_exempt
from rest_framework import status
from sent... | Python | CL | dce8b125ab929f51edceb2df796b47d79dff0557976905037ffe9af9cf50a504 |
from plenum.common.ledger import Ledger
from plenum.common.request import Request
from plenum.common.types import f
from plenum.server.consensus.utils import get_original_viewno
class ThreePcBatch:
def __init__(self, ledger_id, inst_id, view_no, pp_seq_no, pp_time, state_root, txn_root, valid_digests,
... | Python | CL | 1fc9f9e7e5eb3b4ee58b19bb7a64d377bda94aa8238801ef96011b86e0b61394 |
#! /usr/bin/env python
#
# This script tests the persistence of a redis database
import redis
import socket # because we might handle a socket timeout exception
import os
import sys
import subprocess
import random
import time
def check_super_user():
"""This function checks that the process has super user (root) ... | Python | CL | a117148acf1d011a5e9560792e88abf4f5b9bc3fe8d0501eb6db93dcc793f619 |
import nltk
import pandas as pd
# 1st, I will check the available data. This data contains the texts with their respective Author.
texts_with_author = pd.read_csv("data/train.csv")
texts_with_author.head()
# The ids are not important, we need to group and join all the texts by author
# The stop words inside this tex... | Python | CL | 6188039cd520157565fcb6f23cf9d935e809b24b6a6015f5789f8f0d0befaf12 |
#!/usr/bin/env python
import os
import psycopg2
import boto3
import re
from multiprocessing.pool import ThreadPool
# S3 legacy bucket name to use. It should exist and be accessible to your AWS credentials
S3_LEGACY_BUCKET_NAME = os.getenv(
'S3_LEGACY_BUCKET_NAME',
... | Python | CL | c7e64c6257aadcf8e8e0fa9caffa5c85bb06575e81b95553e2d7d895e2c90f25 |
'''
@author Ben DeMott
@file shapely_geom_ops.py
Geometric Operations that can be performed against Shapely Objects
'''
from shapely.geometry import *
point = Point(2, 2)
polygon = Polygon([[1, 1], [1, 3], [3, 3], [3, 1]])
polygon2 = Polygon([[2, 2], [2, 4], [4, 4], [4, 2]])
# increase the boundary of a point by 3 ... | Python | CL | 2287f42847288dca146ed614077aad8da5a206b6bf1149503944e59cc62cbad6 |
#!/usr/bin/env python3
import serial, time, struct
import csv
import math
from operator import itemgetter
import statistics
import sys
#Serial communication protocols for Lidar
Start_Scan = b"\xA5\x20" #Begins scanning
Force_Scan = b"\xA5\x21" #Overrides anything preventing a scan
Health = b"\xA5\x52"... | Python | CL | 8f71f9ea9ebfef7f9652e28cca5bfaafce3bb50284e1903295be29bc72ef109f |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
#
# 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 appl... | Python | CL | 9ca797c584875db637f8dcc3dea0fac0d9f836ee4519f01cb4f30159167e696f |
#example: python3 MLstarter.py -s SIGforPhoAll.dat -b QCDconstpt.dat -c 0,1,2,3,4,5 -d 1,2,3,4,5,6,7,8,9,10,11,12 -p test -f 0.2
#LOAD LIBRARIES
##-------------------------------------------------------------------------------
from __future__ import print_function
import copy, os, sys, time, logging
import numpy as np... | Python | CL | 2f63b8bc7cfd290e391d655d42c740c6ba1aeb4c886a23054a4c49788f7a3803 |
# -*- coding: utf-8 -*-
from __future__ import division
"""Documentation at https://github.com/oTree-org/otree/wiki"""
from otree.db import models
import otree.models
from otree.common import money_range
from otree import widgets
doc = """
Kaushik Basu's famous traveller's dilemma (<a href="http://www.jstor.o... | Python | CL | fd0b9e7be81b372be3bc27338c94dfe51a0cac0517c110ae440a58ceefcf3005 |
1
/rosout
/rosout_agg
the purpose of topic /rosout is a topic to convey the console log message to rosout node,it is similar to the cout, an standard output.
the purpose of topic /rosout_agg is to convey aggregate message to rosout
2
three new added
/turtle1/cmd_vel
/turtle1/color_sensor
/turtle1/pose
using rostopi... | Python | CL | 4a632e5fd5059796581570f7e9df2541a38bade0c6f3c68a457036c5241959f3 |
import tensorflow as tf
import numpy as np
from tensorflow.python.tools import inspect_checkpoint as chkp
from tf_tutorial_dataset_cap import IPI_CIFAR_Dataset
from tf_tutorial_basic_module import conv_relu, conv_relu_maxpool
# instead of use random generated data, here we will use real data (CIFAR)
# necessa... | Python | CL | ba2fe8f9e924a0798db86c00b554a913e5ec2db1ed9c45bb61ee2f652d31893f |
__author__ = 'abdul'
import traceback
import multiprocessing
import logging
import time
from mbs import mbs_logging
from mbs import persistence
from mbs.mbs import get_mbs
from mbs.date_utils import date_now, date_minus_seconds
from mbs.schedule import Schedule
from mbs.globals import State, EventType
from mbs.ta... | Python | CL | d3613af539321fc841df277ab61ef127af39a5421be638a71756e5a304441c96 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------------------------------------------------
# INFO:
# -----------------------------------------------------------------------------------------------------------------------
"""
Author: Evan Hub... | Python | CL | c2ab4680d4b8de672bab898e8ecb26e132a4bccf537027b587a3851f524b7829 |
from srm_helper import *
import pandas as pd
if __name__ == "__main__":
# params
tol = .5 # MS2 fragment tolerance for QqQ optimized transitions
ppmTol = 10 # m/z tolerance for HRMS data in ppm
numCores = 5 # number of CPU cores to use
# create srm_maker object
srm_maker = SRM_maker(ppm=ppm... | Python | CL | 79782fffab581adad13c6bbe6a50ea67690eef6684c1a14517a8cf79ada96654 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.