text
stringlengths
65
6.05M
lang
stringclasses
8 values
type
stringclasses
2 values
id
stringlengths
64
64
#!usr/bin/env python # Script by Steven Grove (@sigwo) # www.sigwo.com # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHO...
Python
CL
a04ae418a424a410378b58578d53aea63b5eeded44229a29065267dc4a6e606a
import xml.etree.ElementTree as ET import streamlit as st import pandas as pd import os # Pasta com os arquivox XML folder_name = 'data/' # Lista a pasta file_list = os.listdir(folder_name) # Cria a barra lateral com a opcao para escolher o arquivo equity = st.sidebar.selectbox('Qual fundo?', file_list) # Abre o ar...
Python
CL
fcf651de81c2aea149ecaaf6be42ca3f8a6814832dc0c5845d0679cffb7fd047
import numpy as np from utils import arglist from pysc2.lib import features from pysc2.lib import actions from collections import namedtuple FlatFeature = namedtuple('FlatFeatures', ['type', 'index', 'scale']) NUM_PLAYERS = features.SCREEN_FEATURES.player_id.scale # 17 ''' screen features: height_map, unit_hit_poin...
Python
CL
153ce0655435fe163e13eaa1e7c0d50f8eca413d8ff72e3e0bfbdea8d3cef13c
import os, sys, time import functools import numpy as np import math import argparse import paddle import paddle.fluid as fluid import paddle.fluid.layers as layers import paddle.fluid.optimizer as optimizer from paddle.fluid.framework import Program, program_guard from paddle.fluid.transpiler import memory_optimize fr...
Python
CL
02b5519f183de0c1275859ee5c30167f40234823551f7b8dd08e2bee1e8c9087
import os import shutil import tempfile from datetime import datetime from unittest import mock from django.conf import settings import pytest from freezegun import freeze_time from PIL import Image from waffle.testutils import override_switch from olympia import amo from olympia.activity.models import ActivityLog f...
Python
CL
8fa1a6fd9ef6b624b06955ed3d89b2d948f82a36375d65569637f6be58aa45e6
# 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 # distributed under the...
Python
CL
08ec121868e27138dfd71d1383c793f55ee8d3d694823843118e75299035e0e0
"""CNN-based image classification on SageMaker with TensorFlow and Keras""" # Dependencies: import argparse # TODO # TODO: Function definitions as needed? # Training script: if __name__ == "__main__": # Load arguments from CLI / environment variables? # Load images from container filesystem into trainin...
Python
CL
98c9304d0d57dd744403307e2d83be038fe78c54573f6ff212cfc0ca6abc06ce
import os.path import numpy as np import xarray as xr import time import tensorflow as tf from parflow_nn.preprocess_PF import create_feature_or_target_da from parflow_nn.predpp import PredPP def train_step(model, input, target, learning_rate): # prediction = model(input, training=True) loss_func = tf.keras....
Python
CL
ff848c09d4cacbc98994906684d98024cb87e5d60c97ac75677f7220e302977d
import time import sys """Step 03 (D): Function for Table To VCF""" def fnc_table_to_vcf(args): print("converting Table file to VCF") begin_time = time.time() """Assign some input variables. """ infile = args.inFile meta_header = args.vcfHeader outfile = args.outVCF samples = ar...
Python
CL
2fe6a9ef6f26d60efaa3f807daae0bf07b760e0686f2b32e47aef62e631a50b7
from robin_stocks.tda.helper import format_inputs, login_required, request_get from robin_stocks.tda.urls import URLS @login_required @format_inputs def get_hours_for_markets(markets, date, jsonify=None): """ Gets market hours for various markets. :param markets: The markets for which you're requesting marke...
Python
CL
7594ff10218442ff4ebd720e1d8bba83b7918c2459210dae8f19805bc3af5dcb
# This file is MACHINE GENERATED! Do not edit. # Generated by: tensorflow/python/tools/api/generator/create_python_api.py script. """Utilities for preprocessing sequence data. """ from __future__ import print_function from tensorflow.python.keras.preprocessing.sequence import TimeseriesGenerator from tensor...
Python
CL
97fab81953a93ee990aaaadd41639e7f35a09b7d8a639c596e7e35160ba7fa6a
import collections import decimal import json from django.core.exceptions import ValidationError class TransferService: """ Not used in current implementation. Service that distributes transactions to accounts. Init: transactions - list of transactions dicts [{id: ..., account_id: ......
Python
CL
3ce6d82bd68a54bf955b8ea169eb916528b64111276798be1cc51e2a34f44f49
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function import random import numpy as np import scipy.ndimage def get_batch_shape(batch): batch_shape = batch[0].shape return batch_shape[0], batch_shape[1] def apply_transform(x, transform_matrix, fill_mode='nearest', cval=...
Python
CL
fdf1e2e1f028b859dd89160e79f9b7c59fc0979307495b9eff18e6038527808f
## subset sum, dynamic programming - pseudocode ## given n items (each with increasing weight), and W upper bound ## compute the best set of items to put in the set S ## so that you get the highest weight thats still ## less than the max weight W ## 1. build look-up table M ## 2. work backwards from max weight to fi...
Python
CL
f05a040d65e08a57ae207809b73ac40a09ee35b0e8d6f653d62f778acbf670db
import FWCore.ParameterSet.Config as cms #-------------------------------------------------------------------------------- # Compute ratio of parton luminosities at LHC @ xxx TeV center-of-mass energy vs. TeVatron # for: # o gluon + gluon # o b + bbar # o u + ubar, d + dbar #------------------------------------...
Python
CL
521e978270614fdcb6014a992f0c5e9b2ae0ef5c6f7f4e1f7cde06d498bbc268
import argparse, json import boto3 from jinja2 import Environment, FileSystemLoader """ A bunch of free functions that we use in all scripts. """ def get_jinja_env(config): """ Get a jinja2 Environment object that we can use to find templates. """ return Environment(loader=FileSystemLoader('.')) def json...
Python
CL
082f55651155146ac1cb4aef5c23d06c58ad5d6ed7bfa6b222eed202fc341490
# coding: utf-8 # ## Задача №5 # ### Вариант 9 # # #### Решение задачи о нахождении локально минимального дерева посредством алгоритма Мелзака-Хванга # # Автор реализации: Михаил Кучеренко, # МГТУ им. Н.Э. Баумана, ИУ5-64, 2019г. # # Исходные тексты: # - Python-Notebook: https://github.com/SnipGhost/MDO/blob/m...
Python
CL
311b4d4f6d92cf5154a771146b18595b30204816b3cca74476070da99a9afb98
''' self.model -> train_warm : input trainX, trainY and then opt (old) -> pred_warm : input X, output Y_hat (old) -> train_ME : input trainX, trainY and then opt (new) -> pred_ME : ... -> get_meta_embedding : ?? -> assign_meta_embedding : ?? ''' import torch import torch.nn as nn import torch.nn.functional as F fro...
Python
CL
3b7d9818a4e998657423e53ea9d683055b26d93dac57e90f38dda14b161425b7
''' Asks if you want to encrypt or decrypt a message. If you encrypt, it shifts each letter by an inputted number (say, 3). If you decrypt, it does the exact same thing, but the number is negative, so it decrypts the message. Alternatively, decrypt and encrypt can be reversed, so that decrypt actually encrypts it and e...
Python
CL
b0915d9901db326d61822aba1b02d08f7f488694b73b7ccc6636445677f30c67
# Goal of this file is to run a basic Feathr script within spark so that Maven packages can be downloaded into the docker container to save time during actual run. # This can also serve as a sanity check import os import tempfile from datetime import datetime import pandas as pd from feathr import FeathrClient from fe...
Python
CL
52538d44d41b2bab2ea0e3e973901926cc5b389fdecef192e82338f34070635a
""" This module defines a few essential variables for the system. To use the configuration variables in different modules import the constant you want. The value of the variables has to be persistent, therefore we use pickle to keep it alive. The pickle files are inside bins/ folder. Functions in this module change c...
Python
CL
1e6c12afc04b9aecb643b6bae015d9309c4bb720974e0663729d4406cc58aef5
# -*- coding: utf-8 -*- """VEM BOLD Constrained File that contains function for BOLD data analysis with positivity and l2-norm=1 constraints. It imports functions from vem_tools.py in pyhrf/vbjde """ import time import copy import logging import os import os.path as op import numpy as np import pyhrf import pyhrf....
Python
CL
e4888a0457087619ea787680b82835c9560ca4a6ff3e3482a8ee49b031a40f9c
import numpy as np import torch.nn as nn import random import os import torch def create_features(dataframe, list_of_features=['u_in']): # u_in cumsum dataframe['u_in_cumsum'] = dataframe.groupby('breath_id')['u_in'].cumsum() # u_in shift change for lag in np.arange(1, 5, 1): dataframe[f'u_in...
Python
CL
394a8f92fa8ea95bc114c90004444a051a3611272001d7a24d459510cc82da30
# Flask REST-based application to retrieve named enties from a text string # using the spaCy library from flask import Flask,abort,jsonify,make_response,request, url_for import logging import jsons from googleapi import google logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)...
Python
CL
77ed7263dbb1b355e5a3d3dc6d3d0a12e708f57b6282a31027f69e7212d07a57
# This files contains your custom actions which can be used to run # custom Python code. # # See this guide on how to implement these action: # https://rasa.com/docs/rasa/core/actions/#custom-actions/ import requests import re from rasa_sdk.forms import FormAction, REQUESTED_SLOT from typing import Any, Text, Dict, Li...
Python
CL
d73e2d58c0fffd9bfae1c89a0119e3fe66ffaaa0c7af2796a62a9fb24ecc2504
from setuptools import setup, Extension from distutils.command.build_ext import build_ext from distutils.command.install_data import install_data import sys import os from subprocess import check_call #full_info = open("README.md").read() class clrmagic_build_ext(build_ext): def build_extension(self, ext): ...
Python
CL
bb9346512d1f5a85821601e75c215ddaf7a1e04219f66886abca6f6b5d22f073
# # This file is part of BDC-ODC. # Copyright (C) 2020 INPE. # # stac2odc is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. # __version__ = '0.0.1'
Python
CL
96a8d74828a8b96e213ae0efc21f9c79f8f524a57f5847034b6dca9495e37958
# -*- coding: utf-8 -*- # Generated by Django 1.11.10 on 2018-09-07 22:39 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): replaces = [('build', '0017_auto_20180904_1457'), ('...
Python
CL
dd4f920318cd82eb1efcc8e8f26b1c770d30e038c595178c9e2f581e6fb5b410
# Generated by Django 2.1.5 on 2019-03-02 17:57 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('sessions', '0001_initial'), migrations.swappable_dependency(set...
Python
CL
04b87d2371ed5e19fa162ba1ca12e46ede6f204a5efc5f404e2fa9600a75c1ab
#!/usr/bin/env python # -*- coding: utf-8 -*- # # This file is subject to the terms and conditions defined in # file 'LICENSE.md', which is part of this source code package. # import re from os.path import expanduser, isfile import logging import os import yaml from yaml import YAMLError KUBECONFIG_ENV_VAR = "KUBEC...
Python
CL
e6cd9f40fb21a2cc9ecc0a927178d69a41ea679b23e61f47b39e07162d4204b5
# -*- coding: utf-8 -*- # pylint: disable-msg=W0212,R0912,R0914 from decimal import Decimal from dss.dsl.safe_strings import safe_unicode from dss.dsl.Serializer import Serializer from dss.dsl import html from dss.dsl.xml.serializers import XmlSerializer from dss.dsl.xml.serializers import ( basic_default_visitor...
Python
CL
36c6b6b0b22a4e03da00e58b59d602644c910c99f2e89bb94076a73af29478c5
# cs146_p3 from heapq import heappop, heappush from math import sqrt def dijkstras_shortest_path(initial_position, destination, graph, adj, initial_xy, dest_xy): """ Searches for a minimal cost path through a graph using Dijkstra's algorithm. Args: initial_position: The initial cell from which the path...
Python
CL
9865eaf374aa25b368e19243b6621baf2ee541b6f412d2bbe84fcfbe9e4e6fee
# Generated by Django 2.0.7 on 2018-09-08 13:30 import datetime from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('intro', '0004_auto_20180908_1204'), ] operations = [ mi...
Python
CL
01368be299fd5196f2df430be7cdb49c5db3ea816f206aed47ea679f979cb47f
# # Author: Michele Van Dyne # Student/Editor: Michael Nelson # ID#: 799056112 # Code from Lab 6 Solution utilized for this program # Lab 7 - Ultima 0.1 (Topic: Threads) # # Description: Avatar class that describes the data and operations of the # main player in the Ultima 0.1 games. # import Std...
Python
CL
9d0038d61671423e07566056a51343e71c771590f1aff652dd2fd2a71ed952e3
# -*- coding: utf-8 -*- from .. import ENCODING from .. import sng from io import BytesIO import difflib import io import os import pkg_resources import pytest import sys import tempfile import unittest SIMPLE = """\ #Title=Mÿ nïcë=tïtlë #Description=I wröte ä söng ... --- Textüäl cöntents inclüdig newlines --- Möre ...
Python
CL
25e3bdebeae604bc670823b739dfbcf29e0642aca664e6137cb0ac59b6c6db02
""" Glossary: :userid: The User model instance's ID (a ``uuid.UUID`` instance). :principal: In the context of a user's principal, the user's email. """ import logging from pyramid.authorization import ACLAuthorizationPolicy from pyramid.authentication import AuthTktAuthenticationPolicy from pyramid.security...
Python
CL
a81e0f078bc0de4b8fc7033a8c2a8a79055730362ea6cd0b6b87d1839afcc0a3
''' Sample predictive model. You must supply at least 4 methods: - fit: trains the model. - predict: uses the model to perform predictions. - save: saves the model. - load: reloads the model. ''' import pickle import numpy as np # We recommend to use numpy arrays from os.path import isfile...
Python
CL
5ab28445789709644db19bdf3051d52d495de1e038cd84cfcf4a5f1cfd0cf7ed
#!/usr/bin/python from __future__ import absolute_import, division, print_function, unicode_literals """ Landscape from ElevationMap with model tanks and buildings. Demonstrates using a function to draw the various parts of the tank and the ElevationMap.pitch_roll() method to make models conform (aproximately) to...
Python
CL
cbcba716c78b45d01e9d9e17811547e6a96149eb63cb0b5024fe838bae77b7a1
# -*- coding: utf-8 -*- """ Abstract Factory pattern In Factory Method pattern, one Factory produce one product which in one kind of products, but Abstract Factory mapping to many products in different kinds of product family. """ class AbstractDecoder(object): """ Abstract Product """ pass clas...
Python
CL
a53f48673530c91c086b2e4c6a0769671d35133c3d5ef6e3b418b11906d0ff0f
#!/bin/env python import unittest from unittest.mock import Mock from pyats.topology import Device from genie.metaparser.util.exceptions import SchemaEmptyParserError,\ SchemaMissingKeyError from genie.libs.parser.iosxe.show_access_session import ShowAccessSession,\ ...
Python
CL
af5fd20378e6715b4c3b05b88c17dfdc63f8830ada30d596406fb46e93c2101b
#! /usr/bin/env python from miasm2.core.cpu import parse_ast from miasm2.arch.x86.arch import mn_x86, base_expr, variable from miasm2.core.bin_stream import bin_stream from miasm2.core import parse_asm from miasm2.expression.expression import * from elfesteem import * from pdb import pm from miasm2.core import asmbloc...
Python
CL
8be323c7f71f04081be85836b8ad4a93cc49d8eb4fddb9eac3dea798afb71b19
''' Author: Tam M Pham Created date: 13/02/2019 Modified date: 28/03/2019 Description: Using Gradient Boosting algorithm for bike prediction ''' import numpy as np import pandas as pd import time from common import Common import matplotlib.pyplot as plt import matplotlib.dates as mdates import ...
Python
CL
cbace6086994c74405f41bbc94f32cae3136e46e6cebc69c224937c11a012ebc
import argparse import datetime import multiprocessing as mp import os import utilities class ExecConfiguration: def __init__(self): self.config = None class DateConfig: def __init__(self, date_str): self.date_with_slash = date_str self.date_with_hyphen = date_str.replace('/', '-') ...
Python
CL
973f675eaf72f16c5158e2dbf6dbbc696d3c7ef60c3614fe19e7d192e49d0699
from googleapiclient import build from oauth2client import GoogleCredentials PROJECT_NAME = 'twittest-1140' def create_logging_client(): """Returns a client for accessing the logging api.""" credentials = GoogleCredentials.get_application_default() return build('logging', 'v1beta', credentials=credentials...
Python
CL
e9c948f76b305c8182aaa4da15924d00a19769cbef7d9a21221a08c93dbb5855
# -*- coding: utf-8 -*- # Generated by Django 1.9.9 on 2016-10-10 20:52 from __future__ import unicode_literals from django.conf import settings from django.db import migrations FIELD_MAPPINGS = { 'ProcessNextStepPlugin': [ ('button-type', 'button_type'), ('button-size', 'button_size'), ('...
Python
CL
69d92614b50cf5730c92aa108ad0caa6cb05ca3aa6f4eb46b5f8df0ace7237f1
# -*- coding: utf-8 -*- """Main component of the system. """ import uuid from typing import Set from diamond_eye.action import make_action from diamond_eye.utils import MetaSingleton class Application(metaclass=MetaSingleton): """Main component of the system. """ @staticmethod def issue_new_uuid(kn...
Python
CL
52c22a01c3b3a39237afdc36b7a824ee319f8ddfc7678d1cd3ae8d9833e50d3c
# Copyright 2016 The Chromium Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import contextlib import json import optparse import pickle import unittest from unittest import mock from blinkpy.common.checkout.baseline_copier import BaselineCopier from blin...
Python
CL
8ff07c19977a6d03a13aeb36d76af54c9e427b805b433a948f5ba28167abf3fc
import unittest import jsonschema class TestSchema(unittest.TestCase): def setUp(self): self.schema_dict = { 'title': 'test_schema', 'type': 'object', 'properties': { 'name': { 'type': 'string' }, 'va...
Python
CL
ec537ea0e848895252a778a7452d0b12052e97c95d66df032c5310e1ecd4f74a
# -*- coding: utf-8 -*- """ pip_services3_components.cache.MemoryCache ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Memory cache component implementation :copyright: Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details. :license: MIT, see LICENSE for more details. """ impor...
Python
CL
0a49e9ca29667cb0333f4828818a572f53ba55204e6b6cfc72da5369dbac1a74
################################################### # This file is part of py-smc2. # http://code.google.com/p/py-smc2/ # # py-smc2 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...
Python
CL
8dbbb662128f00aac881e6ed72d50d800aca1642fc0e9a2cf728b4d44b1cd94a
# FiberFBot.py # 纤程FBot机器人的实现。 # 外部通过创建纤程单元,即可不断执行。通过Message的方式进行执行和调用 # start by sk. 180413 from TYBotSDK2.FBot.fbotV4 import FBotV4 from TYBotUtilsSDK2.Log.log_and_monitor import CTYLB_Log, CTYLB_MainSys_MiscFunc, CSkBot_Common_Share from .NatsMsgProcWideLangComu import CAsyncNats_MultiLang_Proc_Comu # 异步NATs服务器通...
Python
CL
a76204ebc45d544ed467288438e0abfa7162b2064fd05f9c47763b9e8c401f96
# This file is a part of Arjuna # Copyright 2015-2021 Rahul Verma # Website: www.RahulVerma.net # 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...
Python
CL
4f4fc9bc9c5aa91f2849fc3801bf4b32c1a1ee0ca7fbf274ff904e9416c7ad31
from functools import wraps import logging from pyramid.httpexceptions import HTTPBadRequest, HTTPFound from pyramid.security import NO_PERMISSION_REQUIRED, remember from pyramid.response import Response from pyramid.view import view_config from .configuration import ( CONFIG_CLIENT_ID, CONFIG_CLIENT_SECRET, ...
Python
CL
6e9f82dd5a3436fc54ebe1002df2aff49622da8e0b409f668fea66eae6224f42
# Generated by Django 3.0.8 on 2020-07-11 11:27 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] ope...
Python
CL
7e36379a6051600c404fa959ce7bc41796c61eac0b0f174b2df0d35ac46a2a1b
# -*- coding: utf-8 -*- """Zope2-specific helpers and layers using ZServer """ from __future__ import absolute_import from plone.testing import Layer from plone.testing import zodb from plone.testing import zope from plone.testing._z2_testbrowser import Browser # noqa from plone.testing.zope import addRequestContaine...
Python
CL
1fcd674e74ad916edcaa6d24e825adb2c7e646b8f39df62dd64ba94ed2fb862f
# coding: utf-8 # <h1 align="center"> Desafio Lopes LABS </h1> # # <h2 align="right"> Bruno Ramalho Furlan </h2> # **Objetivo:** Criar um modelo para estimar a qualidade do vinho. # <h3 align="justified">Importando dados </h3> # # <p align="justified"> Verificando tipo de dados para cada coluna e quantidade de l...
Python
CL
5464601c135b42f9d630d2e9f57e931862cbfb0ea0e8d5543dc6f28a1d5855f9
# Course: CS261 - Data Structures # Student Name: Melanie Huynh # Assignment: Assignment 5, Min heaps # Description: Implementation of a MinHeap class, using a dynamic array to store the hash table. # Import pre-written DynamicArray and LinkedList classes from a5_include import * class MinHeapException(Exception): ...
Python
CL
b35ed7ec8b98e28c85a0fc5ec46fb682aa9fd540df4c4cc896c83a47e497d930
import json import os import sys from metaflow.exception import MetaflowException class ArgoClientException(MetaflowException): headline = "Argo Client error" class ArgoClient(object): def __init__(self, namespace=None): try: from kubernetes import client, config except (NameEr...
Python
CL
d56883b86675cb45988bc2beb28f8d2ad50ae3e4c009274ad82fb04b674a0e1f
# -*- coding: utf-8 -*- """ Created by: Andres Segura Tinoco Version: 1.2.0 Created on: Nov 23, 2020 Updated on: Dec 16, 2020 Description: Main class of the descriptive-engine solution. """ # Import Python import os import logging import pandas as pd import numpy as np import scipy.stats as ss from...
Python
CL
523fe11ace1ce4c036d8efe536b549e31dda77c28a17b3d3ba2c0b266d1f7b44
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # Author: kerlomz <kerlomz@gmail.com> import sys import random from tqdm import tqdm import tensorflow as tf from config import * from constants import RunMode _RANDOM_SEED = 0 class DataSets: """此类用于打包数据集为TFRecords格式""" def __init__(self, model: ModelConfig): ...
Python
CL
12617b97ea74f6237e8d512906ede9870ee4c023027de0ad86530e16cc34fe18
import pandas as pd import numpy as np from datetime import datetime import json import os import gc # df_train.shape = (184903890, 9) # test_supplement_partial_processed.shape = (57536872, 8) input_dir = '../data/input/' feature_dir = '../data/input/features/' config = 'feature_list.json' fmt = '%Y-%m-%d %H:%M:%S' #...
Python
CL
ee401790cf1a50b05299acab1e606170e3fb9f31d46660f85e191d38c7a4607a
# Generated by Django 3.2 on 2021-05-09 13:51 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='CheckList', ...
Python
CL
9db5e5f2b364b375918045d83cb616fcbf5fbbfd92a2bc74f2242c5ce3cfbe61
from typing import Dict, Union, Tuple, Iterable from pathlib import Path, WindowsPath from os import sep, utime import time import logging from tkinter import * from tkinter import ttk from tkinter import filedialog from tkinter import font as tkfont import toml import attr from attr.validators import instance_of from...
Python
CL
8be059cf15d2f2c8a57b082d8037c14bfa542e114d9668aec35dd66ab9e281cc
#!/usr/bin/env python # # Copyright 2011-2015 Jeff Bush # # 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 la...
Python
CL
359b3489b49577808f1fe6af26f937e8e46cc243e7899cca6a2bc461528d3f72
import numpy as np import math from numpy import linalg as LA from math import factorial def savitzky_golay(y, window_size, order, deriv=0, rate=1): r"""Smooth (and optionally differentiate) data with a Savitzky-Golay filter. The Savitzky-Golay filter removes high frequency noise from data. It has the ad...
Python
CL
15999abc1a67d7eb4baaa036f87bf93a6e0e0347ed3f6783565c3a952d295c9f
import keras.backend as K import matplotlib as mpl import numpy as np import skimage import tensorflow as tf from PIL import Image from keras.applications.inception_v3 import InceptionV3 as PTModel from keras.applications.inception_v3 import preprocess_input from keras.layers import BatchNormalization from keras.layers...
Python
CL
2172f1b970d95619f1ea36c053a93cb5e01d17340539635c06a643d861ff7ba9
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # File : select_protocol.py # Author : bssthu # Project : rtk_trans # Description : 编辑本文件,根据 config 决定使用的协议解析工具 # from rtk_protocol.base_protocol_handler import BaseProtocolHandler def select_protocol(config): """根据配置选择协议解析类 Args: ...
Python
CL
3d1df0ec038eb1fd22f29d95be8a7e57fdce3c0268ddca7338702dcca27124cc
# Generated by Django 2.0.6 on 2018-06-26 22:00 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), ('bookmark', '0001_initial...
Python
CL
0b90cf3ea8ab88911cd09cc7810e0375bf8be932ff7c99a25f8c41ae9318df5e
import socket import binascii import struct import sys import time import random import string import threading import queue #import RPi.GPIO as GPIO # DESCOMENTAR # Sensor constants. PATH_LENGTH = 50 FREQUENCY = 1 # Sensor data queue. QUEUE_SIZE = 10000 lectures_queue = queue.Queue(QUEUE_SIZE) class MovementSensor...
Python
CL
1688165cb9bb4dd8ca82a65b7e594fddac7295187118d2d1de49673683e1c01b
from PyQt5 import QtWidgets, uic from PyQt5.QtCore import QThread, QObject, pyqtSignal import sys import helpers import csv from datetime import datetime import time err= {} read_err_occured = False class Worker(QObject): finished = pyqtSignal() # give worker class a finished signal def __init...
Python
CL
5e643400606b7b33d7aa404446cff0f399fa7c367ed0640e67fe82d65658dcf6
import requests import logging from requests.exceptions import ConnectionError logger = logging.getLogger(__name__) class CrossrefUnwantedType(Exception): pass class CrossrefResponseException(Exception): pass class CrossrefNothingFoundException(Exception): pass class Crossref: ''' CrossR...
Python
CL
59580d62198310a3d6063be18198bb246f29b6afea0833b7be6b334ab61e4c4c
# Copyright 2023 Consoli Solutions, LLC. 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 also obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
Python
CL
921a31f160f38388fbf5a8bacc527cc54c4af3d84ef6ad6667315de37835b1bd
captions = ['Adapter Name', 'Dns Suffix', 'Description', 'Friendly Name', 'Physical Address (MAC)', 'Physical Address Length', 'Flags', 'Mtu', 'If Type', 'Oper Status', 'Ipv6IfIndex', 'ZoneIndices'] from pywingui.windows import * from pywingui.wtl import * from pywingui import comctl from pywingui.lib import form from...
Python
CL
9d1d98664b622b2895c3f518c1226f8912ff39d9d154610ecbcbf3f9019cb13f
#!/usr/bin/env python """ Create an HDF5 file from BOSS data TODO: - include comments in meta/attrs - platelist quantities """ from __future__ import division, print_function #from __future__ import absolute_import from mpi4py import MPI import h5py from h5boss.select import * import sys,os import time import opt...
Python
CL
1a4d59718e4627300461cd50f81b22e6832a380ad5fe278b1ec5048768f993a9
import argparse import json import logging import os import sys import traceback from datetime import datetime from django.conf import settings from django.template.loader import render_to_string from django.utils.html import strip_tags from AWS.db_reports import parse_dates from AWS.redshift_handler import upload_lo...
Python
CL
372228f2d230df7c7cd02e743473201d0b259a5299a4ccd7fb64b858990835cd
#! /usr/bin/env python # -*- coding: utf-8 -*- """ A Python wrapper for the multitaper library of German A. Prieto (see link_). .. _link: http://wwwprof.uniandes.edu.co/~gprieto/software/mwlib.html. :copyright: Lion Krischer (krischer@geophysik.uni-muenchen.de) and Moritz Beyreuther, 2010-2015 :license: G...
Python
CL
5cc2d04f907e2f62aac30906c539b68fcfbf4f7f319d5f6faf8d195cb1360a56
import logging import operator import os from re import match import yaml PGA_NAME_SEPARATOR = "--" __CONTAINER_CONF = None __PROPERTIES = {} __EVALUATED_INDIVIDUALS = [] # YAML command def parse_yaml(yaml_file_path): with open(yaml_file_path, mode="r", encoding="utf-8") as yaml_file: content = yaml.saf...
Python
CL
ebb06264f7468d53861c252324831539a030f71d42acc5ef142e3b8374a4c62c
#Goes through reddit picking up profiles, obtaining their submission locations, and creating links between multiple profiles based on that. End result is an adjacency matrix import os import sys import praw import json import time import copy from Digital_Library.lib import const_lib from Digital_Library.lib import ...
Python
CL
d3093aad15e98989a1d509ac0816b6d1cbd83cd1bab6e62a7ae194fab1d90741
#!/usr/bin/env python2.7 # -*- coding: utf-8 -*- """:synopsis: HTTP and HTTPS protocol client (requires sockets). """ class HTTPConnection: """ An :class:`HTTPConnection` instance represents one transaction with an HTTP server. It should be instantiated passing it a host and optional port number. If no port nu...
Python
CL
6787309c058a484b32e43864f564fb1319853ad0ec7a16c3237c958bc7f2c8d7
# ------------------------------------------------------------------------------ # Test ical Format # see also test_vevents.py, test_vutils.py and test_vcalendar.py # ------------------------------------------------------------------------------ import sys import datetime as dt import pytz from io import BytesIO from i...
Python
CL
ca956f3df2c2adae13c7b03f953f91b438807785611c2503cf6c72867b4b8168
""" Author: Andrew Garvey Partner: Sargon Morad Date: Aug 23, 2019 Client: Hospital for Sick Children Purpose: - Turn cleaned ED and DI data into usable ml data """ # clear variables for name in dir(): if not name.startswith('_'): del globals()[name] del name import numpy as np import scipy as sp impor...
Python
CL
47a1ad1d952e8a1a6bf75e7c5ed4fe5afe9db22383b2f747efcc870e3aee6b19
# © Copyright Databand.ai, an IBM Company 2022 import typing from datetime import datetime from typing import List import attr from airflow.models import BaseOperator, DagRun, TaskInstance from airflow.utils.net import get_hostname from dbnd._core.utils.uid_utils import source_md5 from dbnd_airflow.export_plugin.h...
Python
CL
907dfc1931bd80e9ff675e2112ec0fc201ccc7b50a0ead7650b7000fde94fa98
#Embedded file name: ACEStream\Core\ProxyService\HelperMessageHandler.pyo import sys, os import binascii from threading import Lock from time import sleep from ACEStream.Core.TorrentDef import * from ACEStream.Core.Session import * from ACEStream.Core.simpledefs import * from ACEStream.Core.DownloadConfig import Downlo...
Python
CL
f442e9d5a4cb95d0229b8b51baf218dce37a5be155acd863490ef1543cb15021
import json import pandas as pd from plotly.graph_objs import Scattergeo, Layout from plotly import offline from loguru import logger import itertools # Global constants filename = 'data/sample_br.json' # N_LINES=5000 N_LINES = None # Parse json file def parse_file(n_lines=None): """ Function to parse a json file...
Python
CL
b431186a401f992b73212732ed6be76dd3900031ec2cab17d29208e39662b99b
# coding: utf-8 import pprint import re import six from huaweicloudsdkcore.sdk_response import SdkResponse class ListJobInfoDetailResponse(SdkResponse): """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map ...
Python
CL
753dee295c4b238dd8631d5af9bf1d9bca964eded45a299938a117792a5e40f5
#!/usr/bin/env python3 # encoding=utf-8 from telegram import ReplyKeyboardRemove from telegram.ext import MessageHandler, Filters, ConversationHandler, CommandHandler, RegexHandler, CallbackQueryHandler from telegram.utils.request import Request import os import functions.misc as misc import pickle import config from ...
Python
CL
607546b92b203d98cbd5cb437068d0c7ffe4a43e0a20428980afa803accc6d6d
# encoding: utf-8 # module PyQt4.QtScript # from /usr/lib64/python2.6/site-packages/PyQt4/QtScript.so # by generator 1.136 # no doc # imports import PyQt4.QtCore as __PyQt4_QtCore # functions def qScriptConnect(*args, **kwargs): # real signature unknown pass def qScriptDisconnect(*args, **kwargs): # real signa...
Python
CL
c342e4960b87060b1c45a2af120c2bf247bc3cbc410cb184629d87370323c53b
import os import tarfile import urllib.request wayland_version = '1.18.0' protocols_version = '1.20' wayland_source = 'https://cgit.freedesktop.org/wayland/wayland/plain/protocol/wayland.xml?id={}'.format(wayland_version) protocols_source = 'https://wayland.freedesktop.org/releases/wayland-protocols-{}.tar.xz'.format...
Python
CL
8750f71c6fc2bdb25371ac0e045338bcad60ffae9279c8fa2adfa237ac3e1260
# Lesson 02 Exercise: Grid Printer # Jeremy Monroe p = '+' l = '|' def grid_printer(g_size): """ Prints a 4x4 grid where the length & width of each cell == g_size """ half_g = g_size // 2 m = '-' * (half_g) s = ' ' * (half_g) # This grid is always 2x2. So, loop twice for i in range(2): ...
Python
CL
56cd5616f7d39ce0ec0a7c9f5c53eed3ca23354df6248a316bf1149bc5f89dd8
import re class BaseReaction(object): url_path = '' def __init__(self, poolbot): """Make poolbot available to all reactions.""" self.poolbot = poolbot def match_request(self, message): """Return a boolean to indicate if the message should be processed by this handler."""...
Python
CL
52bb0da34ba335e778013d720b460a5a48363a47913525470a161dbd0c3501fc
############################################################################### # Author: Daniil Budanov # Contact: danbudanov@gmail.com # Summer Internship - 2016 ############################################################################### # Title: onlinevid.py # Project: Security System # Description: # class fo...
Python
CL
a9a0ed04a89839443a9392121080d69a50b46080bb04639ceb63f2b32293aae7
# -*-coding:Utf-8 -* # Copyright (c) 2010-2017 LE GOFF Vincent # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # ...
Python
CL
3f5ac11a7f1cfaa9f2b905d7a6a8243730a09ed22c37c0743060487d894abe00
# Lucas J. Koerner # 05/2018 # koerner.lucas@stthomas.edu # University of St. Thomas ''' The SCPI module includes the SCPI class, functions to convert return values, and builds a SCPI object (using the function init_instrument) from a CSV file of commands and lookups. ''' # standard library imports import warnings i...
Python
CL
7ce7220c56afbbd35f3cccff93f327acbca18111d21b6b4d43510edb2e15bb54
from subprocess import PIPE, Popen from time import sleep def call_bin(path, stdin=None, *args, **kwargs): """ params: path :: string el path del coso que queres ejecutar stdin :: string el string que se manda a stdin. Si es None no se manda nada todos los args que se pasan sera...
Python
CL
d7536d7f24172267b391f20b12a060d00a495f49258d449218d01563ab21b607
# -*- coding: UTF-8 -*- # This file is part of the jetson_stats package (https://github.com/rbonghi/docker-dropbox-app or http://rnext.it). # Copyright (c) 2020 Raffaello Bonghi. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "...
Python
CL
923a3cf8cd6459a27c4579eba7fa1510d713110822e0fea0463b6d6e9aefc7f7
#!/usr/bin/python # -*- coding: utf-8 -*- """ This module provides base classes that all controllers must inherit. """ from __future__ import print_function, division, absolute_import from PyQt4.QtCore import QObject class GAUDInspectBaseChildController(QObject): """ A base class that child controllers mu...
Python
CL
53dac5d37752f42398a4a60021e55959d002c52f4cb0dc526ac6d601e3524e8e
import sklearn import pandas as pd import numpy as np from sklearn import linear_model from sklearn.utils import shuffle # save our best model to later use so we don't have to re-train over and over again # esentially we want to save our model that have the high accuracy by using pickel import matplotlib.pyplot as pyp...
Python
CL
d878d8effd1382a31324ff785003e4fcd058d307aed8c02d26e0038572bc0bb5
# -*- coding: utf-8 -*- # Copyright 2017 Rooms For (Hong Kong) Limted T/A OSCG # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import models, api, fields class SupplierStock(models.Model): _inherit = "supplier.stock" # Using "display_name" field computed by name_get() metho...
Python
CL
6778ea1c35c083e31d7a834226592bf8b50eb6bbadb70e29e814d21b154c870f
import torch from torch import nn from einops.layers.torch import Rearrange, Reduce class Affine(nn.Module): """This functions as layer norm in MLP-Mixer.""" def __init__(self, emb_dim) -> None: super().__init__() self.g = nn.Parameter(torch.ones(1, 1, emb_dim)) self.b = nn.Parameter(...
Python
CL
4ab9c17b2b41e8d5b3d3e94ccb5dbdd34c4d21da077cac337af93514c1c3210b
#!/usr/bin/env python import rospy from std_msgs.msg import Int32 from geometry_msgs.msg import PoseStamped, Pose, PointStamped from styx_msgs.msg import TrafficLightArray, TrafficLight from styx_msgs.msg import Lane #from styx_msgs.msg import TLStatus from sensor_msgs.msg import Image from cv_bridge import CvBridge fr...
Python
CL
28d99b56d5bf86b3e209c2f2806ebfe057c085af3a97391632a295c16a7ada52