hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 417k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 1
class | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f71be0c7310b1e5a59e2faa1aa48d7c69c065244 | 41,236 | py | Python | pyscf/fci/selected_ci.py | crisely09/pyscf | cb92f7974bd9c87c0ef5b2b52abf5d3219b3d6b6 | [
"Apache-2.0"
] | 1 | 2020-04-07T21:12:08.000Z | 2020-04-07T21:12:08.000Z | pyscf/fci/selected_ci.py | crisely09/pyscf | cb92f7974bd9c87c0ef5b2b52abf5d3219b3d6b6 | [
"Apache-2.0"
] | 2 | 2019-09-16T17:58:31.000Z | 2019-09-22T17:26:01.000Z | pyscf/fci/selected_ci.py | crisely09/pyscf | cb92f7974bd9c87c0ef5b2b52abf5d3219b3d6b6 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# Copyright 2014-2019 The PySCF Developers. 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
#
# U... | 42.599174 | 105 | 0.607964 |
import ctypes
import numpy
from pyscf import lib
from pyscf.lib import logger
from pyscf import ao2mo
from pyscf.fci import cistring
from pyscf.fci import direct_spin1
from pyscf.fci import rdm
from pyscf import __config__
libfci = lib.load_library('libfci')
def contract_2e(eri, civec_strs, norb, n... | true | true |
f71be110a2784a6f4b942989944478aaf8facaaa | 18,030 | py | Python | ultra/tests/test_evaluate.py | MCZhi/SMARTS | 3ef5650b04ac6fb7145cf4e23d5534d73e0929fc | [
"MIT"
] | 2 | 2021-12-13T12:41:54.000Z | 2021-12-16T03:10:24.000Z | ultra/tests/test_evaluate.py | MCZhi/SMARTS | 3ef5650b04ac6fb7145cf4e23d5534d73e0929fc | [
"MIT"
] | null | null | null | ultra/tests/test_evaluate.py | MCZhi/SMARTS | 3ef5650b04ac6fb7145cf4e23d5534d73e0929fc | [
"MIT"
] | null | null | null | # MIT License
#
# Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved.
#
# 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 th... | 35.916335 | 101 | 0.59279 |
import glob
import os
import pickle
import re
import shutil
import time
import unittest
import dill
import gym
import ray
from ultra.baselines.agent_spec import BaselineAgentSpec
from ultra.baselines.sac.sac.policy import SACPolicy
from ultra.evaluate import collect_evaluations, evaluate, evaluat... | true | true |
f71be12c5aef84eac371279bc150835aa8551c7d | 27 | py | Python | tess_py_api/TessPyWrap/__init__.py | orel98/tess_py_api | 538cbf64fa795318366ac2ceeec8b15d5cf9ae84 | [
"MIT"
] | 3 | 2022-03-16T09:11:33.000Z | 2022-03-19T19:43:50.000Z | tess_py_api/TessPyWrap/__init__.py | orel98/tess_py_api | 538cbf64fa795318366ac2ceeec8b15d5cf9ae84 | [
"MIT"
] | null | null | null | tess_py_api/TessPyWrap/__init__.py | orel98/tess_py_api | 538cbf64fa795318366ac2ceeec8b15d5cf9ae84 | [
"MIT"
] | null | null | null | from .CpyAPI import CpyAPI
| 13.5 | 26 | 0.814815 | from .CpyAPI import CpyAPI
| true | true |
f71be1fb130e1061491a135bc6bfa210726ceb66 | 650 | py | Python | PythonDesafios/d076.py | adaatii/Python-Curso-em-Video- | 30b37713b3685469558babb93b557b53210f010c | [
"MIT"
] | null | null | null | PythonDesafios/d076.py | adaatii/Python-Curso-em-Video- | 30b37713b3685469558babb93b557b53210f010c | [
"MIT"
] | null | null | null | PythonDesafios/d076.py | adaatii/Python-Curso-em-Video- | 30b37713b3685469558babb93b557b53210f010c | [
"MIT"
] | null | null | null | # Crie um programa que tenha uma tupla única com nomes de produtos
# e seus respectivos preços, na sequência. No final, mostre uma
# listagem de preços, organizando os dados em forma tabular.
listagem = ('Lápis', 1.75,
'Borracha', 2,
'Caderno', 15.90,
'Estojo', 10,
'Comp... | 28.26087 | 66 | 0.543077 |
listagem = ('Lápis', 1.75,
'Borracha', 2,
'Caderno', 15.90,
'Estojo', 10,
'Compasso', 7.95,
'Mochila', 150.45,
'Canetas', 22.30,
'Livro', 34.50)
print('-'*40)
print(f'{"LISTAGEM DE PREÇOS":^40}')
print('-'*40)
for i in range(0, len(... | true | true |
f71be2a3c566dab4f1526507df28e4b0c96bd528 | 4,961 | py | Python | NMT/dataset.py | MISStingting/NMTmodel | 970115d6f9fcd015d7daf3ad0e4844055e2af5d3 | [
"Apache-2.0"
] | null | null | null | NMT/dataset.py | MISStingting/NMTmodel | 970115d6f9fcd015d7daf3ad0e4844055e2af5d3 | [
"Apache-2.0"
] | null | null | null | NMT/dataset.py | MISStingting/NMTmodel | 970115d6f9fcd015d7daf3ad0e4844055e2af5d3 | [
"Apache-2.0"
] | null | null | null | import tensorflow as tf
# tf.enable_eager_execution()
class Dataset(object):
def get_dataset(self, params, mode):
if mode == tf.estimator.ModeKeys.TRAIN:
features_path = params["train_features_file"]
labels_path = params["train_labels_file"]
elif mode == tf.estimator.Mod... | 48.637255 | 118 | 0.504939 | import tensorflow as tf
class Dataset(object):
def get_dataset(self, params, mode):
if mode == tf.estimator.ModeKeys.TRAIN:
features_path = params["train_features_file"]
labels_path = params["train_labels_file"]
elif mode == tf.estimator.ModeKeys.EVAL:
featu... | true | true |
f71be2a65e952c2d97ca924e09c67df982278f0e | 66,367 | py | Python | tools/run_tests/run_tests.py | jtcho/grpc | 99673fcbe341a981c27d2becd572468863bff33b | [
"Apache-2.0"
] | 1 | 2017-09-07T00:48:20.000Z | 2017-09-07T00:48:20.000Z | tools/run_tests/run_tests.py | jtcho/grpc | 99673fcbe341a981c27d2becd572468863bff33b | [
"Apache-2.0"
] | null | null | null | tools/run_tests/run_tests.py | jtcho/grpc | 99673fcbe341a981c27d2becd572468863bff33b | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# Copyright 2015 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 35.096245 | 135 | 0.566773 |
from __future__ import print_function
import argparse
import ast
import collections
import glob
import itertools
import json
import logging
import multiprocessing
import os
import os.path
import pipes
import platform
import random
import re
import socket
import subprocess
import sys
import tempfile
impo... | true | true |
f71be3b444baa4607d29128c718bb04ae6b2c311 | 32,709 | py | Python | ryu/lib/ofctl_v1_4.py | vinaykothiyal/ryu | 32551989c649311854215df29860ccb272c105c0 | [
"Apache-2.0"
] | null | null | null | ryu/lib/ofctl_v1_4.py | vinaykothiyal/ryu | 32551989c649311854215df29860ccb272c105c0 | [
"Apache-2.0"
] | null | null | null | ryu/lib/ofctl_v1_4.py | vinaykothiyal/ryu | 32551989c649311854215df29860ccb272c105c0 | [
"Apache-2.0"
] | null | null | null | # Copyright (C) 2016 Nippon Telegraph and Telephone 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 by applicab... | 33.965732 | 78 | 0.575897 |
import logging
from ryu.ofproto import ether
from ryu.ofproto import ofproto_v1_4
from ryu.ofproto import ofproto_v1_4_parser
from ryu.lib import ofctl_utils
LOG = logging.getLogger(__name__)
DEFAULT_TIMEOUT = 1.0
UTIL = ofctl_utils.OFCtlUtil(ofproto_v1_4)
str_to_int = ofctl_utils.str_to_int
def to... | true | true |
f71be3d981254befffd5928f1197ba90e0eb5617 | 15,646 | py | Python | venv/Lib/site-packages/pooch/downloaders.py | Terrathaw/ba21_loma_2_py | eebf5104dd054cef1ab61f0b257933ff679e75ec | [
"MIT"
] | 4 | 2021-03-29T19:15:29.000Z | 2021-06-08T05:34:00.000Z | venv/Lib/site-packages/pooch/downloaders.py | Terrathaw/ba21_loma_2_py | eebf5104dd054cef1ab61f0b257933ff679e75ec | [
"MIT"
] | 1 | 2021-06-08T06:03:51.000Z | 2021-06-08T06:03:51.000Z | venv/Lib/site-packages/pooch/downloaders.py | Terrathaw/ba21_loma_2_py | eebf5104dd054cef1ab61f0b257933ff679e75ec | [
"MIT"
] | 1 | 2021-01-31T18:58:54.000Z | 2021-01-31T18:58:54.000Z | # Copyright (c) 2018 The Pooch Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
#
# This code is part of the Fatiando a Terra project (https://www.fatiando.org)
#
"""
The classes that actually handle the downloads.
"""
import sys
import ftplib
import reques... | 35.803204 | 85 | 0.592612 |
import sys
import ftplib
import requests
from .utils import parse_url
try:
from tqdm import tqdm
except ImportError:
tqdm = None
try:
import paramiko
except ImportError:
paramiko = None
def choose_downloader(url):
known_downloaders = {
"ftp": FTPDownloader,
"https": HTTPD... | true | true |
f71be436acf919b617f27f823476c8b4531b4b98 | 7,043 | py | Python | homeassistant/auth/providers/trusted_networks.py | petewill/home-assistant | 5859dba4344f05fb8774aa1207e47ac28f627a67 | [
"Apache-2.0"
] | 3 | 2020-01-21T18:09:09.000Z | 2022-01-17T08:06:03.000Z | homeassistant/auth/providers/trusted_networks.py | petewill/home-assistant | 5859dba4344f05fb8774aa1207e47ac28f627a67 | [
"Apache-2.0"
] | 39 | 2016-12-16T12:40:34.000Z | 2017-02-13T17:53:42.000Z | homeassistant/auth/providers/trusted_networks.py | petewill/home-assistant | 5859dba4344f05fb8774aa1207e47ac28f627a67 | [
"Apache-2.0"
] | 6 | 2020-04-10T06:21:11.000Z | 2021-07-01T08:53:38.000Z | """Trusted Networks auth provider.
It shows list of users if access from trusted network.
Abort login flow if not access from trusted network.
"""
from ipaddress import ip_network, IPv4Address, IPv6Address, IPv4Network, IPv6Network
from typing import Any, Dict, List, Optional, Union, cast
import voluptuous as vol
im... | 34.18932 | 87 | 0.609115 | from ipaddress import ip_network, IPv4Address, IPv6Address, IPv4Network, IPv6Network
from typing import Any, Dict, List, Optional, Union, cast
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.core import callback
from homeassistant.exceptions import HomeAssistantError
f... | true | true |
f71be5558aa2a08dbbb15648b144ea54b9b317ff | 854 | py | Python | graphgallery/nn/layers/tensorflow/dropout/dropout.py | EdisonLeeeee/GraphGallery | 4eec9c5136bda14809bd22584b26cc346cdb633b | [
"MIT"
] | 300 | 2020-08-09T04:27:41.000Z | 2022-03-30T07:43:41.000Z | graphgallery/nn/layers/tensorflow/dropout/dropout.py | EdisonLeeeee/GraphGallery | 4eec9c5136bda14809bd22584b26cc346cdb633b | [
"MIT"
] | 5 | 2020-11-05T06:16:50.000Z | 2021-12-11T05:05:22.000Z | graphgallery/nn/layers/tensorflow/dropout/dropout.py | EdisonLeeeee/GraphGallery | 4eec9c5136bda14809bd22584b26cc346cdb633b | [
"MIT"
] | 51 | 2020-09-23T15:37:12.000Z | 2022-03-05T01:28:56.000Z | import tensorflow as tf
import tensorflow.keras.backend as K
from tensorflow.keras.layers import Layer, Dropout
class SparseDropout(Layer):
def __init__(self, p=0.5):
super().__init__()
self.p = p
def call(self, x, training=None):
if training is None:
training ... | 26.6875 | 69 | 0.591335 | import tensorflow as tf
import tensorflow.keras.backend as K
from tensorflow.keras.layers import Layer, Dropout
class SparseDropout(Layer):
def __init__(self, p=0.5):
super().__init__()
self.p = p
def call(self, x, training=None):
if training is None:
training ... | true | true |
f71be5cc21797fff7f87730b2e377bc2fe651fa1 | 14,118 | py | Python | clinica/pipelines/deeplearning_prepare_data/deeplearning_prepare_data_pipeline.py | Raelag0112/clinica | d301b1abfdf4d3b62dc4b329622340795ae51ef8 | [
"MIT"
] | null | null | null | clinica/pipelines/deeplearning_prepare_data/deeplearning_prepare_data_pipeline.py | Raelag0112/clinica | d301b1abfdf4d3b62dc4b329622340795ae51ef8 | [
"MIT"
] | null | null | null | clinica/pipelines/deeplearning_prepare_data/deeplearning_prepare_data_pipeline.py | Raelag0112/clinica | d301b1abfdf4d3b62dc4b329622340795ae51ef8 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Use hash instead of parameters for iterables folder names
# Otherwise path will be too long and generate OSError
from nipype import config
import clinica.pipelines.engine as cpe
cfg = dict(execution={"parameterize_dirs": False})
config.update_config(cfg)
class DeepLearningPrepareData(cpe... | 35.741772 | 116 | 0.541507 |
from nipype import config
import clinica.pipelines.engine as cpe
cfg = dict(execution={"parameterize_dirs": False})
config.update_config(cfg)
class DeepLearningPrepareData(cpe.Pipeline):
def check_custom_dependencies(self):
def get_input_fields(self):
return ["input_nifti"]
def get_outpu... | true | true |
f71be64382d9c7cd419601ae2aa3d28d776baa3a | 2,261 | py | Python | scripts/xml2txt.py | o8r/pytorch_cpp | 70ba1e64270da6d870847c074ce33afb154f1ef8 | [
"MIT"
] | 181 | 2020-03-26T12:33:25.000Z | 2022-03-28T04:04:25.000Z | scripts/xml2txt.py | o8r/pytorch_cpp | 70ba1e64270da6d870847c074ce33afb154f1ef8 | [
"MIT"
] | 11 | 2020-07-26T13:18:50.000Z | 2022-01-09T10:04:10.000Z | scripts/xml2txt.py | o8r/pytorch_cpp | 70ba1e64270da6d870847c074ce33afb154f1ef8 | [
"MIT"
] | 38 | 2020-05-04T05:06:55.000Z | 2022-03-29T19:10:51.000Z | import os
import glob
import argparse
import xml.etree.ElementTree as ET
parser = argparse.ArgumentParser()
# Define parameter
parser.add_argument('--input_dir', type=str)
parser.add_argument('--output_dir', type=str)
parser.add_argument('--class_list', type=str)
args = parser.parse_args()
# Set Class Names
def s... | 27.91358 | 101 | 0.632906 | import os
import glob
import argparse
import xml.etree.ElementTree as ET
parser = argparse.ArgumentParser()
parser.add_argument('--input_dir', type=str)
parser.add_argument('--output_dir', type=str)
parser.add_argument('--class_list', type=str)
args = parser.parse_args()
def set_class_names(class_list):
f =... | true | true |
f71be6b44b2393e0c5756152ad6854307836bc3b | 20,079 | py | Python | tests/test_data/test_datasets/test_kitti_dataset.py | ammaryasirnaich/mmdetection3d | 5e549546abbb2a7b43aab59e40e87599f61dcc4a | [
"Apache-2.0"
] | null | null | null | tests/test_data/test_datasets/test_kitti_dataset.py | ammaryasirnaich/mmdetection3d | 5e549546abbb2a7b43aab59e40e87599f61dcc4a | [
"Apache-2.0"
] | null | null | null | tests/test_data/test_datasets/test_kitti_dataset.py | ammaryasirnaich/mmdetection3d | 5e549546abbb2a7b43aab59e40e87599f61dcc4a | [
"Apache-2.0"
] | null | null | null | # Copyright (c) OpenMMLab. All rights reserved.
import math
import os
import tempfile
import numpy as np
import pytest
import torch
from mmdet3d.core.bbox import LiDARInstance3DBoxes, limit_period
from mmdet3d.datasets import KittiDataset
def _generate_kitti_dataset_config():
data_root = 'tests/data/kitti'
... | 41.91858 | 79 | 0.619852 |
import math
import os
import tempfile
import numpy as np
import pytest
import torch
from mmdet3d.core.bbox import LiDARInstance3DBoxes, limit_period
from mmdet3d.datasets import KittiDataset
def _generate_kitti_dataset_config():
data_root = 'tests/data/kitti'
ann_file = 'tests/data/kitti/kitti_infos_train.... | true | true |
f71be6eab3547a134de4d6606f48330f24f83fbe | 8,080 | py | Python | scripts/build_load_data.py | millingermarkus/pypsa-eur | 2e39a21299036c0cec86fe4707de06a42ec15d62 | [
"MIT"
] | null | null | null | scripts/build_load_data.py | millingermarkus/pypsa-eur | 2e39a21299036c0cec86fe4707de06a42ec15d62 | [
"MIT"
] | null | null | null | scripts/build_load_data.py | millingermarkus/pypsa-eur | 2e39a21299036c0cec86fe4707de06a42ec15d62 | [
"MIT"
] | null | null | null | # SPDX-FileCopyrightText: : 2020 @JanFrederickUnnewehr, The PyPSA-Eur Authors
#
# SPDX-License-Identifier: MIT
"""
This rule downloads the load data from `Open Power System Data Time series <https://data.open-power-system-data.org/time_series/>`_. For all countries in the network, the per country load timeseries with... | 35.752212 | 415 | 0.653713 |
import logging
logger = logging.getLogger(__name__)
from _helpers import configure_logging
import pandas as pd
import numpy as np
import dateutil
from pandas import Timedelta as Delta
def load_timeseries(fn, years, countries, powerstatistics=True):
logger.info(f"Retrieving load data from '{fn}'.")
patt... | true | true |
f71be7330e1eaec34340d30bcdded8315ca8fdf3 | 5,076 | py | Python | tests/unit/driver/generic/test_generic_sync_driver.py | haccht/scrapli | 89589ee78c36296ee67813fcbedebee9b41b6bca | [
"MIT"
] | 1 | 2020-02-09T17:43:43.000Z | 2020-02-09T17:43:43.000Z | tests/unit/driver/generic/test_generic_sync_driver.py | haccht/scrapli | 89589ee78c36296ee67813fcbedebee9b41b6bca | [
"MIT"
] | null | null | null | tests/unit/driver/generic/test_generic_sync_driver.py | haccht/scrapli | 89589ee78c36296ee67813fcbedebee9b41b6bca | [
"MIT"
] | null | null | null | import pytest
from scrapli.driver.generic.base_driver import ReadCallback
from scrapli.exceptions import ScrapliValueError
def test_get_prompt(monkeypatch, sync_generic_driver):
# stupid test w/ the patch, but want coverage and in the future maybe the driver actually
# does something to the prompt it gets fr... | 35.496503 | 100 | 0.731678 | import pytest
from scrapli.driver.generic.base_driver import ReadCallback
from scrapli.exceptions import ScrapliValueError
def test_get_prompt(monkeypatch, sync_generic_driver):
monkeypatch.setattr("scrapli.channel.sync_channel.Channel.get_prompt", lambda x: "scrapli>")
assert sync_generic_driver.g... | true | true |
f71be7afa0a994c58e2f0076275e35e23af1c2a5 | 16,119 | py | Python | utils_twc/kg.py | daiki-kimura/commonsense-rl | 5513926957b6501ce9cfa46f77f8f2c1c4892fa5 | [
"Apache-2.0"
] | null | null | null | utils_twc/kg.py | daiki-kimura/commonsense-rl | 5513926957b6501ce9cfa46f77f8f2c1c4892fa5 | [
"Apache-2.0"
] | null | null | null | utils_twc/kg.py | daiki-kimura/commonsense-rl | 5513926957b6501ce9cfa46f77f8f2c1c4892fa5 | [
"Apache-2.0"
] | null | null | null | import sys
import networkx as nx
import logging
import json
import requests
from pathlib import Path
import numpy as np
import matplotlib.pyplot as plt
from collections import defaultdict
from utils_twc.generic import escape_entities
# Logging formatting
FORMAT = '%(asctime)s %(message)s'
logging.basicConfig(format=FO... | 37.927059 | 136 | 0.578262 | import sys
import networkx as nx
import logging
import json
import requests
from pathlib import Path
import numpy as np
import matplotlib.pyplot as plt
from collections import defaultdict
from utils_twc.generic import escape_entities
FORMAT = '%(asctime)s %(message)s'
logging.basicConfig(format=FORMAT, level='INFO', ... | true | true |
f71be86a3b944cd3f5b50d8b2127cb921b32bfb6 | 1,048 | py | Python | lhc/io/bed/__main__.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 5668b5785296b314ea1321057420bcd077dba9ea | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | lhc/io/bed/__main__.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 5668b5785296b314ea1321057420bcd077dba9ea | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | lhc/io/bed/__main__.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 5668b5785296b314ea1321057420bcd077dba9ea | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | import argparse
from .iterator import BedEntryIterator
from lhc.io.bed.tools import depth, sort, filter
from lhc.io.txt.tools import compress
def iter_bed(fname):
it = BedEntryIterator(fname)
for entry in it:
yield entry
it.close()
def main():
args = get_parser().parse_args()
args.func(... | 23.818182 | 55 | 0.719466 | import argparse
from .iterator import BedEntryIterator
from lhc.io.bed.tools import depth, sort, filter
from lhc.io.txt.tools import compress
def iter_bed(fname):
it = BedEntryIterator(fname)
for entry in it:
yield entry
it.close()
def main():
args = get_parser().parse_args()
args.func(... | true | true |
f71be8fe9b1bed16fe43ad8a1ea794cdbcec63d2 | 7,605 | py | Python | tests/test_bootstrap.py | itewk/home-assistant | 769cf19052f8c9ef374d8ba8ae7705ccc7bf4cf4 | [
"Apache-2.0"
] | 23 | 2017-11-15T21:03:53.000Z | 2021-03-29T21:33:48.000Z | tests/test_bootstrap.py | itewk/home-assistant | 769cf19052f8c9ef374d8ba8ae7705ccc7bf4cf4 | [
"Apache-2.0"
] | 6 | 2021-02-08T20:59:36.000Z | 2022-03-12T00:52:11.000Z | tests/test_bootstrap.py | itewk/home-assistant | 769cf19052f8c9ef374d8ba8ae7705ccc7bf4cf4 | [
"Apache-2.0"
] | 10 | 2018-01-01T00:12:51.000Z | 2021-12-21T23:08:05.000Z | """Test the bootstrapping."""
# pylint: disable=protected-access
import asyncio
import logging
import os
from unittest.mock import Mock, patch
from homeassistant import bootstrap
import homeassistant.config as config_util
import homeassistant.util.dt as dt_util
from tests.common import (
MockModule,
get_test_... | 32.224576 | 86 | 0.682446 |
import asyncio
import logging
import os
from unittest.mock import Mock, patch
from homeassistant import bootstrap
import homeassistant.config as config_util
import homeassistant.util.dt as dt_util
from tests.common import (
MockModule,
get_test_config_dir,
mock_coro,
mock_integration,
patch_yaml_... | true | true |
f71beb6536594f288089770f787a036271ea7c72 | 1,832 | py | Python | lite/tests/unittest_py/op/common/test_unique_with_counts_op_base.py | 714627034/Paddle-Lite | 015ba88a4d639db0b73603e37f83e47be041a4eb | [
"Apache-2.0"
] | 808 | 2018-04-17T17:43:12.000Z | 2019-08-18T07:39:13.000Z | lite/tests/unittest_py/op/common/test_unique_with_counts_op_base.py | 714627034/Paddle-Lite | 015ba88a4d639db0b73603e37f83e47be041a4eb | [
"Apache-2.0"
] | 728 | 2018-04-18T08:15:25.000Z | 2019-08-16T07:14:43.000Z | lite/tests/unittest_py/op/common/test_unique_with_counts_op_base.py | 714627034/Paddle-Lite | 015ba88a4d639db0b73603e37f83e47be041a4eb | [
"Apache-2.0"
] | 364 | 2018-04-18T17:05:02.000Z | 2019-08-18T03:25:38.000Z | # Copyright (c) 2021 PaddlePaddle Authors. 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 appli... | 34.566038 | 125 | 0.68559 |
import sys
sys.path.append('..')
from program_config import TensorConfig, ProgramConfig, OpConfig, CxxConfig, TargetType, PrecisionType, DataLayoutType, Place
import numpy as np
from functools import partial
from typing import Optional, List, Callable, Dict, Any, Set
import unittest
import hypothesis
imp... | true | true |
f71bebf8420c687bf788c8fe852634cda08565c9 | 54,956 | py | Python | scikit-learn-master/sklearn/linear_model/ridge.py | lqkweb/learnMLflow | 13c5decaebba95b1b90f92021be35e343b4764af | [
"Apache-2.0"
] | 2 | 2019-02-21T10:43:16.000Z | 2019-07-30T04:56:37.000Z | scikit-learn-master/sklearn/linear_model/ridge.py | lqkweb/learnMLflow | 13c5decaebba95b1b90f92021be35e343b4764af | [
"Apache-2.0"
] | null | null | null | scikit-learn-master/sklearn/linear_model/ridge.py | lqkweb/learnMLflow | 13c5decaebba95b1b90f92021be35e343b4764af | [
"Apache-2.0"
] | null | null | null | """
Ridge regression
"""
# Author: Mathieu Blondel <mathieu@mblondel.org>
# Reuben Fletcher-Costin <reuben.fletchercostin@gmail.com>
# Fabian Pedregosa <fabian@fseoane.net>
# Michael Eickenberg <michael.eickenberg@nsup.org>
# License: BSD 3 clause
from abc import ABCMeta, abstractmethod
impor... | 38.32357 | 79 | 0.619951 |
from abc import ABCMeta, abstractmethod
import warnings
import numpy as np
from scipy import linalg
from scipy import sparse
from scipy.sparse import linalg as sp_linalg
from .base import LinearClassifierMixin, LinearModel, _rescale_data
from .sag import sag_solver
from ..base import RegressorMixin
from ..uti... | true | true |
f71bec5753bc8e9f3a6c6cc2541b07d58772b075 | 1,201 | py | Python | tests/tests/test_design/test_randomcodons.py | klavinslab/coral | 17f59591211562a59a051f474cd6cecba4829df9 | [
"MIT"
] | 34 | 2015-12-26T22:13:51.000Z | 2021-11-17T11:46:37.000Z | tests/tests/test_design/test_randomcodons.py | klavinslab/coral | 17f59591211562a59a051f474cd6cecba4829df9 | [
"MIT"
] | 13 | 2015-09-11T23:27:51.000Z | 2018-06-25T20:44:28.000Z | tests/tests/test_design/test_randomcodons.py | klavinslab/coral | 17f59591211562a59a051f474cd6cecba4829df9 | [
"MIT"
] | 14 | 2015-10-08T17:08:48.000Z | 2022-02-22T04:25:54.000Z | '''
Tests for RandomCodons class of analysis module.
'''
from nose.tools import assert_equal, assert_not_equal, assert_raises
from coral import design, reaction, RNA
def test_randomcodons():
'''
This test is pretty basic right now - not sure how much checking
can be done for a random DNA base generator.... | 32.459459 | 70 | 0.757702 |
from nose.tools import assert_equal, assert_not_equal, assert_raises
from coral import design, reaction, RNA
def test_randomcodons():
reference_seq = RNA('AUGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAG')
reference_peptide = reaction.translate(reference_seq)
output = design.random_codons(reference_peptide)
... | true | true |
f71bec9bd1ce0214c2dc30775d89387898d9b1fb | 328 | py | Python | truck_app/migrations/0010_remove_truck_likes.py | Svetloni89/truck_project | e365d2a84f32e62f8dbc5c371a3355dbbe93557d | [
"MIT"
] | null | null | null | truck_app/migrations/0010_remove_truck_likes.py | Svetloni89/truck_project | e365d2a84f32e62f8dbc5c371a3355dbbe93557d | [
"MIT"
] | null | null | null | truck_app/migrations/0010_remove_truck_likes.py | Svetloni89/truck_project | e365d2a84f32e62f8dbc5c371a3355dbbe93557d | [
"MIT"
] | null | null | null | # Generated by Django 3.1.3 on 2020-11-14 08:22
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('truck_app', '0009_auto_20201112_1114'),
]
operations = [
migrations.RemoveField(
model_name='truck',
name='likes',
)... | 18.222222 | 49 | 0.591463 |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('truck_app', '0009_auto_20201112_1114'),
]
operations = [
migrations.RemoveField(
model_name='truck',
name='likes',
),
]
| true | true |
f71bedbe0e1dd8d7b00f8bfa2461591aca993afa | 2,299 | py | Python | example/exampleapp/models.py | jphilip/django-treewidget | e2eff61f98ea7a520f29a4ed7395ec75d134246b | [
"MIT"
] | null | null | null | example/exampleapp/models.py | jphilip/django-treewidget | e2eff61f98ea7a520f29a4ed7395ec75d134246b | [
"MIT"
] | null | null | null | example/exampleapp/models.py | jphilip/django-treewidget | e2eff61f98ea7a520f29a4ed7395ec75d134246b | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from mptt.models import MPTTModel
from treebeard.mp_tree import MP_Node
from treebeard.al_tree import AL_Node
from treebeard.ns_tree import NS_Node
from treewidget.fields import TreeForeignKey, TreeManyToManyField
from django.u... | 35.921875 | 97 | 0.702044 |
from __future__ import unicode_literals
from django.db import models
from mptt.models import MPTTModel
from treebeard.mp_tree import MP_Node
from treebeard.al_tree import AL_Node
from treebeard.ns_tree import NS_Node
from treewidget.fields import TreeForeignKey, TreeManyToManyField
from django.utils.encoding import py... | true | true |
f71bf0329ac143d3243fa730424a4eebdde5ed63 | 2,519 | py | Python | letsencrypt/constants.py | felixonmars/certbot | 324ebf468db402dbe44ba780ed2df682ab99af86 | [
"Apache-2.0"
] | null | null | null | letsencrypt/constants.py | felixonmars/certbot | 324ebf468db402dbe44ba780ed2df682ab99af86 | [
"Apache-2.0"
] | null | null | null | letsencrypt/constants.py | felixonmars/certbot | 324ebf468db402dbe44ba780ed2df682ab99af86 | [
"Apache-2.0"
] | null | null | null | """Let's Encrypt constants."""
import os
import logging
from acme import challenges
SETUPTOOLS_PLUGINS_ENTRY_POINT = "letsencrypt.plugins"
"""Setuptools entry point group name for plugins."""
CLI_DEFAULTS = dict(
config_files=[
"/etc/letsencrypt/cli.ini",
# http://freedesktop.org/wiki/Software/x... | 27.086022 | 73 | 0.710599 | import os
import logging
from acme import challenges
SETUPTOOLS_PLUGINS_ENTRY_POINT = "letsencrypt.plugins"
CLI_DEFAULTS = dict(
config_files=[
"/etc/letsencrypt/cli.ini",
os.path.join(os.environ.get("XDG_CONFIG_HOME", "~/.config"),
"letsencrypt", "cli.ini"),
],... | true | true |
f71bf03d595623a0ca93dde19a49a3566fbf4da1 | 2,082 | py | Python | scraper.py | Luisf718/web_scraping | df599a1ea77a1475a05d97884f57a4c3761adec5 | [
"MIT"
] | null | null | null | scraper.py | Luisf718/web_scraping | df599a1ea77a1475a05d97884f57a4c3761adec5 | [
"MIT"
] | null | null | null | scraper.py | Luisf718/web_scraping | df599a1ea77a1475a05d97884f57a4c3761adec5 | [
"MIT"
] | null | null | null | import requests
import lxml.html as html
import os
import datetime
#El text-fill es un h2 pero la libreria no identifica el h2 como tal sino como text-fill
HOME_URL = 'https://www.larepublica.co/'
XPATH_LINK_TO_ARTICLE = '//text-fill/a/@href'
XPATH_TITLE = '//div[@class="mb-auto"]/text-fill/span//text()'
XPATH_SUMMAR... | 30.617647 | 88 | 0.548511 | import requests
import lxml.html as html
import os
import datetime
HOME_URL = 'https://www.larepublica.co/'
XPATH_LINK_TO_ARTICLE = '//text-fill/a/@href'
XPATH_TITLE = '//div[@class="mb-auto"]/text-fill/span//text()'
XPATH_SUMMARY = '//div[@class="lead"]/p//text()'
XPATH_BODY = '//div[@class="html-content"]/p//text(... | true | true |
f71bf0555abfc8db7bc79d24972ecc0523d5c881 | 5,928 | py | Python | scaffold_generator/defaults.py | iamswaroopp/django-scaffold-generator | c9aa7269c3a3d9a618dbf41aac8e23649be64d48 | [
"MIT"
] | 6 | 2021-05-20T14:46:23.000Z | 2022-01-24T07:07:55.000Z | scaffold_generator/defaults.py | iamswaroopp/django-scaffold-generator | c9aa7269c3a3d9a618dbf41aac8e23649be64d48 | [
"MIT"
] | null | null | null | scaffold_generator/defaults.py | iamswaroopp/django-scaffold-generator | c9aa7269c3a3d9a618dbf41aac8e23649be64d48 | [
"MIT"
] | null | null | null | DEFAULT_SETTINGS = {
'CREATE_HTML_VIEW_RESOURCES': True,
'CREATE_REST_VIEW_RESOURCES': True,
'DEFAULT_MODEL_IMPORTS': [],
'DEFAULT_FORM_IMPORTS': [
'django.forms',
],
'FIELDS': {},
'MODEL_EXTRA_IMPORT_CLASSES': [
'django.db.models',
],
'MODEL_PARENT_CLASSES': ['django... | 31.531915 | 103 | 0.624494 | DEFAULT_SETTINGS = {
'CREATE_HTML_VIEW_RESOURCES': True,
'CREATE_REST_VIEW_RESOURCES': True,
'DEFAULT_MODEL_IMPORTS': [],
'DEFAULT_FORM_IMPORTS': [
'django.forms',
],
'FIELDS': {},
'MODEL_EXTRA_IMPORT_CLASSES': [
'django.db.models',
],
'MODEL_PARENT_CLASSES': ['django... | true | true |
f71bf0a388d2199024ab2f51328c979f5c521f72 | 9,018 | py | Python | test/functional/wallet_abandonconflict.py | SbercoinCom/sbercoin.com | 8fb386e59e4db8a6abb3a2c638a2ecc918f6b9dd | [
"MIT"
] | 1 | 2021-05-17T06:06:57.000Z | 2021-05-17T06:06:57.000Z | test/functional/wallet_abandonconflict.py | SbercoinCom/sbercoin.com | 8fb386e59e4db8a6abb3a2c638a2ecc918f6b9dd | [
"MIT"
] | null | null | null | test/functional/wallet_abandonconflict.py | SbercoinCom/sbercoin.com | 8fb386e59e4db8a6abb3a2c638a2ecc918f6b9dd | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) 2014-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the abandontransaction RPC.
The abandontransaction RPC marks a transaction and all its in-wallet... | 47.714286 | 138 | 0.66833 |
from decimal import Decimal
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
assert_raises_rpc_error,
connect_nodes,
disconnect_nodes,
wait_until,
)
from test_framework.sbercoinconfig import *
class AbandonConflictTest(BitcoinTestFr... | true | true |
f71bf12d2f88d3050797e3faff333cb5b247f6af | 4,243 | py | Python | BPR-example/tSNE_matlab/tsne_p.py | jsirait/selection-bias-code | 5b89b2d9bc3c996e27dde4773be105698fd72db9 | [
"BSD-3-Clause"
] | null | null | null | BPR-example/tSNE_matlab/tsne_p.py | jsirait/selection-bias-code | 5b89b2d9bc3c996e27dde4773be105698fd72db9 | [
"BSD-3-Clause"
] | null | null | null | BPR-example/tSNE_matlab/tsne_p.py | jsirait/selection-bias-code | 5b89b2d9bc3c996e27dde4773be105698fd72db9 | [
"BSD-3-Clause"
] | null | null | null | # Generated with SMOP 0.41
from libsmop import *
# tsne_p.m
@function
def tsne_p(P=None,labels=None,no_dims=None,*args,**kwargs):
varargin = tsne_p.varargin
nargin = tsne_p.nargin
#TSNE_P Performs symmetric t-SNE on affinity matrix P
# mappedX = tsne_p(P, labels, no_dims)
# The f... | 27.732026 | 130 | 0.607825 |
from libsmop import *
@function
def tsne_p(P=None,labels=None,no_dims=None,*args,**kwargs):
varargin = tsne_p.varargin
nargin = tsne_p.nargin
# The low-dimensional data representation is returned in mappedX.
# (C) Laurens van der Maaten, 2010
# University of... | true | true |
f71bf176600708ef5ff1a1e657e714c9aea3da7b | 664 | py | Python | dags/externaltasksensor_dag.py | vannguyen3007/Apache-Airflow | 1c8a6f3c9c0022807cbae4c4f83de33b8454ae24 | [
"Apache-2.0"
] | null | null | null | dags/externaltasksensor_dag.py | vannguyen3007/Apache-Airflow | 1c8a6f3c9c0022807cbae4c4f83de33b8454ae24 | [
"Apache-2.0"
] | null | null | null | dags/externaltasksensor_dag.py | vannguyen3007/Apache-Airflow | 1c8a6f3c9c0022807cbae4c4f83de33b8454ae24 | [
"Apache-2.0"
] | null | null | null | import pprint as pp
import airflow.utils.dates
from airflow import DAG
from airflow.sensors.external_task_sensor import ExternalTaskSensor
from airflow.operators.dummy_operator import DummyOperator
from datetime import datetime, timedelta
default_args = {
"owner": "airflow",
"start_date": airflow.util... | 30.181818 | 104 | 0.733434 | import pprint as pp
import airflow.utils.dates
from airflow import DAG
from airflow.sensors.external_task_sensor import ExternalTaskSensor
from airflow.operators.dummy_operator import DummyOperator
from datetime import datetime, timedelta
default_args = {
"owner": "airflow",
"start_date": airflow.util... | true | true |
f71bf1d55740e24cffa947f3eb30e8b50f0271f3 | 198 | py | Python | store_debug/store_debug/main.py | ruber0id/band-services-set | 471bb4bf561ca5ec9e0e3a7bda75574b0c718fde | [
"Apache-2.0"
] | 4 | 2018-08-27T05:36:37.000Z | 2018-08-29T09:41:50.000Z | store_debug/store_debug/main.py | ruber0id/band-services-set | 471bb4bf561ca5ec9e0e3a7bda75574b0c718fde | [
"Apache-2.0"
] | null | null | null | store_debug/store_debug/main.py | ruber0id/band-services-set | 471bb4bf561ca5ec9e0e3a7bda75574b0c718fde | [
"Apache-2.0"
] | 2 | 2020-05-20T14:50:59.000Z | 2020-08-31T14:44:57.000Z | import asyncio
import ujson
from band import logger, expose
"""
Listen events and write to output
"""
@expose.listener()
async def broadcast(**params):
logger.info('Broadcast', params=params)
| 16.5 | 43 | 0.737374 | import asyncio
import ujson
from band import logger, expose
@expose.listener()
async def broadcast(**params):
logger.info('Broadcast', params=params)
| true | true |
f71bf5092e429695b0035e78d005436c626887d2 | 26,148 | py | Python | python/mtap/deployment.py | benknoll-umn/mtap | 67d506aa4ffc960acca1988ec12c5391c15ad736 | [
"Apache-2.0"
] | 3 | 2020-03-06T21:24:24.000Z | 2021-03-21T06:38:00.000Z | python/mtap/deployment.py | benknoll-umn/mtap | 67d506aa4ffc960acca1988ec12c5391c15ad736 | [
"Apache-2.0"
] | 40 | 2019-10-14T17:02:54.000Z | 2022-03-09T13:35:54.000Z | python/mtap/deployment.py | benknoll-umn/mtap | 67d506aa4ffc960acca1988ec12c5391c15ad736 | [
"Apache-2.0"
] | 2 | 2019-10-14T15:42:46.000Z | 2020-03-05T23:29:01.000Z | # Copyright 2020 Regents of the University of Minnesota.
#
# 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... | 40.728972 | 105 | 0.618594 |
import argparse
import logging
import os
import pathlib
import shutil
import subprocess
import sys
import threading
import time
from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple, Union
import grpc
from mtap import utilities, _config
__all__ = [
'Deployment', 'GlobalSettings', '... | true | true |
f71bf509bb30658310cb6206ecdb34d8c4c8f548 | 6,084 | py | Python | sphinx/testing/path.py | Symaxion/sphinx | f4f7936b5c3671153c2646387c8258b1c4e25e3c | [
"BSD-2-Clause"
] | 8 | 2019-04-27T01:19:45.000Z | 2020-09-21T03:31:01.000Z | sphinx/testing/path.py | JoeyCluett/sphinx | ff5031c96e90027510ad2d0251972e12da46402c | [
"BSD-2-Clause"
] | 12 | 2021-03-09T03:01:16.000Z | 2022-03-11T23:59:36.000Z | sphinx/testing/path.py | JoeyCluett/sphinx | ff5031c96e90027510ad2d0251972e12da46402c | [
"BSD-2-Clause"
] | 5 | 2019-04-27T01:19:47.000Z | 2020-09-20T15:15:19.000Z | """
sphinx.testing.path
~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os
import shutil
import sys
if False:
# For type annotation
import builtins # NOQA
from typing import Any, Callable, IO, List # ... | 27.160714 | 78 | 0.534845 | import os
import shutil
import sys
if False:
import builtins
from typing import Any, Callable, IO, List
FILESYSTEMENCODING = sys.getfilesystemencoding() or sys.getdefaultencoding()
class path(str):
@property
def parent(self):
return self.__class__(os.path.dirname(self))
... | true | true |
f71bf51348a8a1504b096c6228f4179dd5875c54 | 1,538 | py | Python | consort/tools/ClefSpannerExpression.py | josiah-wolf-oberholtzer/consort | 6c7d511835d5ad883ad1ad52ae9cd48c4a7b5571 | [
"MIT"
] | 9 | 2015-02-11T09:35:40.000Z | 2019-04-29T23:57:49.000Z | consort/tools/ClefSpannerExpression.py | josiah-wolf-oberholtzer/consort | 6c7d511835d5ad883ad1ad52ae9cd48c4a7b5571 | [
"MIT"
] | 2 | 2016-02-07T18:54:47.000Z | 2017-08-10T01:38:01.000Z | consort/tools/ClefSpannerExpression.py | josiah-wolf-oberholtzer/consort | 6c7d511835d5ad883ad1ad52ae9cd48c4a7b5571 | [
"MIT"
] | 1 | 2019-05-13T12:37:15.000Z | 2019-05-13T12:37:15.000Z | from abjad import attach
from abjad import inspect
from abjad import iterate
from abjad.tools import abctools
from abjad.tools import scoretools
class ClefSpannerExpression(abctools.AbjadValueObject):
r'''A clef spanner expression.
'''
### CLASS VARIABLES ###
__slots__ = ()
### INITIALIZER ###
... | 31.387755 | 67 | 0.605982 | from abjad import attach
from abjad import inspect
from abjad import iterate
from abjad.tools import abctools
from abjad.tools import scoretools
class ClefSpannerExpression(abctools.AbjadValueObject):
leaves = list(iterate(music).by_leaf())
weights = []
weighted_pitches = []
for lea... | true | true |
f71bf52008d28c422bd88b5ecd34e9e1fab1fa11 | 2,202 | py | Python | models/ModelUtil/util.py | Easonyesheng/StereoCameraToolk | 660e43019d0687e96e6da3aca48c1c423ae5abff | [
"MIT"
] | 27 | 2020-10-16T07:21:35.000Z | 2022-03-11T02:56:13.000Z | models/ModelUtil/util.py | Easonyesheng/StereoCamera | 9319b7f4e5ce36833de722a15e1074e82b8b4f84 | [
"MIT"
] | null | null | null | models/ModelUtil/util.py | Easonyesheng/StereoCamera | 9319b7f4e5ce36833de722a15e1074e82b8b4f84 | [
"MIT"
] | 6 | 2021-02-01T09:54:40.000Z | 2022-03-11T03:16:39.000Z | """Utility """
import numpy as np
import cv2
import os
import logging
def check_string_is_empty(string):
"""name
check string empty or not
Args:
Returns:
"""
if string == '':
return True
return False
def check_numpy_array(array):
"""name
check array empty or no... | 18.504202 | 108 | 0.583106 |
import numpy as np
import cv2
import os
import logging
def check_string_is_empty(string):
if string == '':
return True
return False
def check_numpy_array(array):
try:
array.all()
except AttributeError:
return False
return True
def after_cv_imshow():
k = cv2.wait... | true | true |
f71bf5a6846601e2c447085faeecf596137b1330 | 4,935 | py | Python | airflow/api/common/experimental/trigger_dag.py | IGIT-CN/airflow | a6e5bcd59198afe5716813e84ebc4c59eade532c | [
"Apache-2.0"
] | 2 | 2020-03-24T14:47:18.000Z | 2020-03-24T14:48:17.000Z | airflow/api/common/experimental/trigger_dag.py | IGIT-CN/airflow | a6e5bcd59198afe5716813e84ebc4c59eade532c | [
"Apache-2.0"
] | 1 | 2021-09-29T17:37:13.000Z | 2021-09-29T17:37:13.000Z | airflow/api/common/experimental/trigger_dag.py | IGIT-CN/airflow | a6e5bcd59198afe5716813e84ebc4c59eade532c | [
"Apache-2.0"
] | null | null | null | #
# 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... | 34.270833 | 104 | 0.680446 |
import json
from datetime import datetime
from typing import List, Optional, Union
from airflow.exceptions import DagNotFound, DagRunAlreadyExists
from airflow.models import DagBag, DagModel, DagRun
from airflow.utils import timezone
from airflow.utils.state import State
from airflow.utils.types impor... | true | true |
f71bf6d7e4ee3f8699dd771f06d36619668ab2db | 8,225 | py | Python | authors/apps/notify/tests/test_mail_list_model.py | andela/Ah-backend-valkyrie | f0eb64c27e1fe37d5c81e4b9a8762dcf3c336a79 | [
"BSD-3-Clause"
] | null | null | null | authors/apps/notify/tests/test_mail_list_model.py | andela/Ah-backend-valkyrie | f0eb64c27e1fe37d5c81e4b9a8762dcf3c336a79 | [
"BSD-3-Clause"
] | 46 | 2019-01-08T13:16:41.000Z | 2021-04-30T20:47:08.000Z | authors/apps/notify/tests/test_mail_list_model.py | andela/Ah-backend-valkyrie | f0eb64c27e1fe37d5c81e4b9a8762dcf3c336a79 | [
"BSD-3-Clause"
] | 3 | 2019-01-07T08:21:59.000Z | 2019-09-20T06:43:18.000Z | import json
from authors.apps.authentication.tests.base import BaseTestMethods
from authors.apps.authentication.models import User
from rest_framework.reverse import reverse
from rest_framework import status
class NotificationTests(BaseTestMethods):
def test_create_mail_list(self):
user = self.register_... | 39.927184 | 92 | 0.646565 | import json
from authors.apps.authentication.tests.base import BaseTestMethods
from authors.apps.authentication.models import User
from rest_framework.reverse import reverse
from rest_framework import status
class NotificationTests(BaseTestMethods):
def test_create_mail_list(self):
user = self.register_... | true | true |
f71bf861822822818626a562f2930b021abda1d2 | 596 | py | Python | x2py/__init__.py | jaykang920/x2py | b8bd473f94ff4b9576e984cc384f4159ab71278d | [
"MIT"
] | null | null | null | x2py/__init__.py | jaykang920/x2py | b8bd473f94ff4b9576e984cc384f4159ab71278d | [
"MIT"
] | 1 | 2019-06-05T09:35:09.000Z | 2020-07-02T09:46:46.000Z | x2py/__init__.py | jaykang920/x2py | b8bd473f94ff4b9576e984cc384f4159ab71278d | [
"MIT"
] | null | null | null | # Copyright (c) 2017, 2018 Jae-jun Kang
# See the file LICENSE for details.
"""Import core names of x2py."""
__version__ = '0.4.3'
from x2py.buffer_transform import BufferTransform
from x2py.builtin_events import *
from x2py.case import Case
from x2py.config import Config
from x2py.coroutine import Coroutine, Corouti... | 27.090909 | 54 | 0.798658 |
__version__ = '0.4.3'
from x2py.buffer_transform import BufferTransform
from x2py.builtin_events import *
from x2py.case import Case
from x2py.config import Config
from x2py.coroutine import Coroutine, CoroutineHandler
from x2py.event import Event
from x2py.event_factory import EventFactory
from x2py.event_sink imp... | true | true |
f71bf97329b821d2dc2e07b818ab784fb1ed22a7 | 2,815 | py | Python | test/lint/check-doc.py | BakedInside/beanscore | daa9b2ddbfd3305881749bda7f32146738154260 | [
"MIT"
] | null | null | null | test/lint/check-doc.py | BakedInside/beanscore | daa9b2ddbfd3305881749bda7f32146738154260 | [
"MIT"
] | null | null | null | test/lint/check-doc.py | BakedInside/beanscore | daa9b2ddbfd3305881749bda7f32146738154260 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) 2015-2020 The Beans Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
This checks if all command line args are documented.
Return value is 0 to indicate no error.
Author: @... | 42.014925 | 130 | 0.722913 |
from subprocess import check_output
import re
FOLDER_GREP = 'src'
FOLDER_TEST = 'src/test/'
REGEX_ARG = r'(?:ForceSet|SoftSet|Get|Is)(?:Bool)?Args?(?:Set)?\("(-[^"]+)"'
REGEX_DOC = r'AddArg\("(-[^"=]+?)(?:=|")'
CMD_ROOT_DIR = '$(git rev-parse --show-toplevel)/{}'.format(FOLDER_GREP)
CMD_GREP_ARGS = r"git grep --... | true | true |
f71bf97c41d24bf4383061ccf726c43fc54c6be9 | 4,880 | py | Python | py3status/modules/file_status.py | JackDoan/py3status | e7f56fc0bec8c1a625328c3549b88f66ee8b41ab | [
"BSD-3-Clause"
] | null | null | null | py3status/modules/file_status.py | JackDoan/py3status | e7f56fc0bec8c1a625328c3549b88f66ee8b41ab | [
"BSD-3-Clause"
] | null | null | null | py3status/modules/file_status.py | JackDoan/py3status | e7f56fc0bec8c1a625328c3549b88f66ee8b41ab | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Display if files or directories exists.
Configuration parameters:
cache_timeout: refresh interval for this module (default 10)
format: display format for this module
(default '\?color=path [\?if=path ●|■]')
format_path: format for paths (default '{basename}')
format_... | 30.310559 | 87 | 0.565369 |
from glob import glob
from os.path import basename, expanduser
STRING_NO_PATHS = "missing paths"
class Py3status:
cache_timeout = 10
format = u"\?color=path [\?if=path \u25cf|\u25a0]"
format_path = u"{basename}"
format_path_separator = u" "
paths = None
thresholds = [(0, "bad"), (1, "... | true | true |
f71bfb7e6138d20826c27d50c937e36b4fb9c103 | 454 | py | Python | lesson_4_transformation/lesson_4_affine_transformation.py | DewMaple/opencv-learning | 51991a5b9badf24cda740c1377f6be30dea91e1d | [
"MIT"
] | null | null | null | lesson_4_transformation/lesson_4_affine_transformation.py | DewMaple/opencv-learning | 51991a5b9badf24cda740c1377f6be30dea91e1d | [
"MIT"
] | null | null | null | lesson_4_transformation/lesson_4_affine_transformation.py | DewMaple/opencv-learning | 51991a5b9badf24cda740c1377f6be30dea91e1d | [
"MIT"
] | 1 | 2018-09-10T15:51:23.000Z | 2018-09-10T15:51:23.000Z | import cv2
import numpy as np
from utils import find_image
image_path = find_image('girls_01.jpg')
img = cv2.imread(image_path)
rows, cols, channel = img.shape
pts_src = np.float32([[50, 50], [200, 50], [50, 200]])
pts_dst = np.float32([[10, 100], [200, 80], [100, 650]])
M = cv2.getAffineTransform(pts_src, pts_dst)... | 23.894737 | 56 | 0.707048 | import cv2
import numpy as np
from utils import find_image
image_path = find_image('girls_01.jpg')
img = cv2.imread(image_path)
rows, cols, channel = img.shape
pts_src = np.float32([[50, 50], [200, 50], [50, 200]])
pts_dst = np.float32([[10, 100], [200, 80], [100, 650]])
M = cv2.getAffineTransform(pts_src, pts_dst)... | true | true |
f71bfbbb90ec970a284d4548547ab11e37b35557 | 21,393 | py | Python | androidtv/constants.py | deviant-aut/python-androidtv | 4bd5421e107949784b292a5f4a0397875a18e908 | [
"MIT"
] | 10 | 2022-01-17T14:46:04.000Z | 2022-03-19T16:19:06.000Z | androidtv/constants.py | deviant-aut/python-androidtv | 4bd5421e107949784b292a5f4a0397875a18e908 | [
"MIT"
] | 5 | 2022-01-18T20:33:18.000Z | 2022-03-30T15:57:24.000Z | androidtv/constants.py | deviant-aut/python-androidtv | 4bd5421e107949784b292a5f4a0397875a18e908 | [
"MIT"
] | 7 | 2022-01-25T01:26:47.000Z | 2022-03-13T05:54:53.000Z | """Constants used throughout the code.
**Links**
* `ADB key event codes <https://developer.android.com/reference/android/view/KeyEvent>`_
* `MediaSession PlaybackState property <https://developer.android.com/reference/android/media/session/PlaybackState.html>`_
"""
import re
import sys
if sys.version_info[0] == 3... | 34.338684 | 179 | 0.72865 |
import re
import sys
if sys.version_info[0] == 3 and sys.version_info[1] >= 5:
from enum import IntEnum, unique
else:
IntEnum = object
def unique(cls):
"""A class decorator that does nothing."""
return cls
@unique
class DeviceEnum(IntEnum):
BASETV = 0
ANDROIDTV = 1
FIRET... | true | true |
f71bfc3874575acdd3b3cfdfd9209ae815ab7e10 | 7,497 | py | Python | tf/experiment6.py | wichtounet/frameworks | e0cac9d4ffbbf0b1e9d2491eb70bf2c6154f313b | [
"MIT"
] | 20 | 2016-12-01T17:39:04.000Z | 2019-08-25T12:50:05.000Z | tf/experiment6.py | wichtounet/frameworks | e0cac9d4ffbbf0b1e9d2491eb70bf2c6154f313b | [
"MIT"
] | 4 | 2017-10-08T13:56:21.000Z | 2019-01-21T12:49:09.000Z | tf/experiment6.py | wichtounet/frameworks | e0cac9d4ffbbf0b1e9d2491eb70bf2c6154f313b | [
"MIT"
] | 7 | 2018-05-09T01:29:20.000Z | 2019-02-09T10:49:39.000Z | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import keras
from keras.preprocessing.image import ImageDataGenerator, array_to_img, img_to_array, load_img
import argparse
import gzip
import os
import sys
import time
import os
import math
import numpy
from... | 35.870813 | 213 | 0.652528 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import keras
from keras.preprocessing.image import ImageDataGenerator, array_to_img, img_to_array, load_img
import argparse
import gzip
import os
import sys
import time
import os
import math
import numpy
from... | true | true |
f71bfd19f426d8f03872939dfd8bb1e2d6d2dcdf | 332 | py | Python | week1/the_real_deal/is_prime.py | sevgo/Programming101 | ac25c4d9695563b449a629c60ec77a739c9f5be3 | [
"BSD-3-Clause"
] | null | null | null | week1/the_real_deal/is_prime.py | sevgo/Programming101 | ac25c4d9695563b449a629c60ec77a739c9f5be3 | [
"BSD-3-Clause"
] | 1 | 2021-09-16T05:44:31.000Z | 2021-09-16T05:44:31.000Z | week1/the_real_deal/is_prime.py | sevgo/Programming101 | ac25c4d9695563b449a629c60ec77a739c9f5be3 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python3
from sum_of_divisors import sum_of_divisors
def is_prime(n):
# If N is prime it could only be devided
# to 1 and N, so sum of divisors has to be
# equal to N + 1
return n + 1 == sum_of_divisors(n)
if __name__ == "__main__":
number = int(input("Number: "))
print (is_pri... | 22.133333 | 46 | 0.653614 |
from sum_of_divisors import sum_of_divisors
def is_prime(n):
return n + 1 == sum_of_divisors(n)
if __name__ == "__main__":
number = int(input("Number: "))
print (is_prime(number))
| true | true |
f71bfd37000184d8a9e59d68561043e6514fa6d5 | 4,211 | py | Python | src/data_imputation_paper/imputation/dl.py | se-jaeger/data-imputation-paper | 498d2d871302d917f58ecf6a9576e3a3451c5faa | [
"Apache-2.0"
] | 2 | 2022-01-18T09:59:01.000Z | 2022-02-02T10:01:45.000Z | src/data_imputation_paper/imputation/dl.py | se-jaeger/data-imputation-paper | 498d2d871302d917f58ecf6a9576e3a3451c5faa | [
"Apache-2.0"
] | null | null | null | src/data_imputation_paper/imputation/dl.py | se-jaeger/data-imputation-paper | 498d2d871302d917f58ecf6a9576e3a3451c5faa | [
"Apache-2.0"
] | null | null | null | import logging
from typing import Dict, List, Optional, Tuple
import pandas as pd
from autokeras import StructuredDataClassifier, StructuredDataRegressor
from tensorflow.keras import Model
from ._base import BaseImputer
logger = logging.getLogger()
class AutoKerasImputer(BaseImputer):
def __init__(
se... | 37.265487 | 139 | 0.654001 | import logging
from typing import Dict, List, Optional, Tuple
import pandas as pd
from autokeras import StructuredDataClassifier, StructuredDataRegressor
from tensorflow.keras import Model
from ._base import BaseImputer
logger = logging.getLogger()
class AutoKerasImputer(BaseImputer):
def __init__(
se... | true | true |
f71bfd5b0f2615891de5ac70368d3a37c96767b7 | 17,386 | py | Python | HER_mod/rl_modules/get_path_costs.py | schrammlb2/policy-guided-sst | 8dce6619b9c771c39915c60fe9c54270ea1e621e | [
"Apache-2.0"
] | null | null | null | HER_mod/rl_modules/get_path_costs.py | schrammlb2/policy-guided-sst | 8dce6619b9c771c39915c60fe9c54270ea1e621e | [
"Apache-2.0"
] | null | null | null | HER_mod/rl_modules/get_path_costs.py | schrammlb2/policy-guided-sst | 8dce6619b9c771c39915c60fe9c54270ea1e621e | [
"Apache-2.0"
] | null | null | null | import numpy as np
import matplotlib.pyplot as plt
import pickle
import os
from scipy import stats
from HER_mod.rl_modules.tsp import generate_path
from HER_mod.rl_modules.hyperparams import NUM_GOALS, NUM_AGENTS
gd_step_list = [0,2,5, 10, 20, 40]
# NUM_AGENTS = 3
N=200
def get_path_costs(train_pos_agent, train_vel_a... | 44.352041 | 195 | 0.673588 | import numpy as np
import matplotlib.pyplot as plt
import pickle
import os
from scipy import stats
from HER_mod.rl_modules.tsp import generate_path
from HER_mod.rl_modules.hyperparams import NUM_GOALS, NUM_AGENTS
gd_step_list = [0,2,5, 10, 20, 40]
N=200
def get_path_costs(train_pos_agent, train_vel_agent, perm_searc... | true | true |
f71bfd9867454fe2f4dc8062137be298a7bcf44a | 40,230 | py | Python | python/ccxt/async_support/coinbasepro.py | dgdiginex/ccxt | cccd590576cbf48d26cf9e3f65cc54fdd466a139 | [
"MIT"
] | 1 | 2021-02-08T21:56:13.000Z | 2021-02-08T21:56:13.000Z | python/ccxt/async_support/coinbasepro.py | yucelalbar/ccxt | 672510401fba809172fac8272e1af463c778358a | [
"MIT"
] | null | null | null | python/ccxt/async_support/coinbasepro.py | yucelalbar/ccxt | 672510401fba809172fac8272e1af463c778358a | [
"MIT"
] | 2 | 2020-10-13T03:24:08.000Z | 2020-10-15T06:25:07.000Z | # -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.base.exchange import Exchange
# -----------------------------------------------------------------------------
try... | 39.402547 | 187 | 0.492667 |
rt.base.exchange import Exchange
try:
basestring
except NameError:
basestring = str
import hashlib
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import AuthenticationError
from ccxt.base.errors import PermissionDenied
from ccxt.base.errors import ArgumentsRequired
from ccxt.base.err... | true | true |
f71bff11a394180fe27dbab6c598aaf8b04768c6 | 10,059 | py | Python | mlflow/spacy.py | Roffild/mlflow | 8351d82e6ad4103bc58159175b29b406abb1e052 | [
"Apache-2.0"
] | null | null | null | mlflow/spacy.py | Roffild/mlflow | 8351d82e6ad4103bc58159175b29b406abb1e052 | [
"Apache-2.0"
] | null | null | null | mlflow/spacy.py | Roffild/mlflow | 8351d82e6ad4103bc58159175b29b406abb1e052 | [
"Apache-2.0"
] | null | null | null | """
The ``mlflow.spacy`` module provides an API for logging and loading spaCy models.
This module exports spacy models with the following flavors:
spaCy (native) format
This is the main flavor that can be loaded back into spaCy.
:py:mod:`mlflow.pyfunc`
Produced for use by generic pyfunc-based deployment tools ... | 43.357759 | 100 | 0.617457 |
from __future__ import absolute_import
import logging
import os
import pandas as pd
import yaml
import mlflow
from mlflow import pyfunc
from mlflow.exceptions import MlflowException
from mlflow.models import Model, ModelSignature
from mlflow.models.utils import ModelInputExample
from mlflow.tracking.artifact_utils ... | true | true |
f71bff714d7bf1d24454e59616e23e72f9782452 | 629 | py | Python | December Month Challenge/2LinkedListRandomNodeReservoirSampling.py | adesh-gadge/LeetCodePractice | 4b142c102e64ec93465af7f4193762e8fd2866ec | [
"MIT"
] | null | null | null | December Month Challenge/2LinkedListRandomNodeReservoirSampling.py | adesh-gadge/LeetCodePractice | 4b142c102e64ec93465af7f4193762e8fd2866ec | [
"MIT"
] | null | null | null | December Month Challenge/2LinkedListRandomNodeReservoirSampling.py | adesh-gadge/LeetCodePractice | 4b142c102e64ec93465af7f4193762e8fd2866ec | [
"MIT"
] | null | null | null | import random
class Solution:
def __init__(self, head: ListNode):
"""
@param head The linked list's head.
Note that the head is guaranteed to be not null, so it contains at least one node.
"""
self.head = head
def getRandom(self) -> int:
"""
Re... | 23.296296 | 90 | 0.497615 | import random
class Solution:
def __init__(self, head: ListNode):
self.head = head
def getRandom(self) -> int:
scope = 1
chosen_value = 0
curr = self.head
while curr:
if random.random() < 1/scope:
chosen_value = curr.val
... | true | true |
f71bff92a942ff8d052d7208bd78c572f2d01c55 | 132 | py | Python | artistapp/artist/admin.py | fallprojects/ArtistApp | 5564a1f7f4fc95261beb462abfa4ca53f3e5c17f | [
"MIT"
] | null | null | null | artistapp/artist/admin.py | fallprojects/ArtistApp | 5564a1f7f4fc95261beb462abfa4ca53f3e5c17f | [
"MIT"
] | null | null | null | artistapp/artist/admin.py | fallprojects/ArtistApp | 5564a1f7f4fc95261beb462abfa4ca53f3e5c17f | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import *
# Register your models here.
admin.site.register([Content,Profile,Comment])
| 22 | 46 | 0.787879 | from django.contrib import admin
from .models import *
admin.site.register([Content,Profile,Comment])
| true | true |
f71c00b21518c6757cb661f74b98f03394d9f8a6 | 749 | py | Python | parqueo/urls.py | gersonjuarez/Laboratorio | 3ed5dc57136ec593e3edb8ef8ca3b29abeb7dabc | [
"bzip2-1.0.6"
] | null | null | null | parqueo/urls.py | gersonjuarez/Laboratorio | 3ed5dc57136ec593e3edb8ef8ca3b29abeb7dabc | [
"bzip2-1.0.6"
] | null | null | null | parqueo/urls.py | gersonjuarez/Laboratorio | 3ed5dc57136ec593e3edb8ef8ca3b29abeb7dabc | [
"bzip2-1.0.6"
] | null | null | null | """parqueo URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based... | 34.045455 | 77 | 0.708945 | from django.contrib import admin
from django.urls import path
urlpatterns = [
path('admin/', admin.site.urls),
]
| true | true |
f71c0110baa8d07d6722fcdc95decbbb7f63ec63 | 2,576 | py | Python | arviz/plots/backends/matplotlib/distplot.py | StanczakDominik/arviz | ec33b4cc7d4a6d5ba95a87a43ef226a49c2cb287 | [
"Apache-2.0"
] | null | null | null | arviz/plots/backends/matplotlib/distplot.py | StanczakDominik/arviz | ec33b4cc7d4a6d5ba95a87a43ef226a49c2cb287 | [
"Apache-2.0"
] | null | null | null | arviz/plots/backends/matplotlib/distplot.py | StanczakDominik/arviz | ec33b4cc7d4a6d5ba95a87a43ef226a49c2cb287 | [
"Apache-2.0"
] | null | null | null | """Matplotlib distplot."""
import warnings
import matplotlib.pyplot as plt
import numpy as np
from . import backend_show
from ...kdeplot import plot_kde
from ...plot_utils import matplotlib_kwarg_dealiaser
from ....numeric_utils import get_bins
def plot_dist(
values,
values2,
color,
kind,
cumulati... | 24.301887 | 91 | 0.588898 | import warnings
import matplotlib.pyplot as plt
import numpy as np
from . import backend_show
from ...kdeplot import plot_kde
from ...plot_utils import matplotlib_kwarg_dealiaser
from ....numeric_utils import get_bins
def plot_dist(
values,
values2,
color,
kind,
cumulative,
label,
rotated,... | true | true |
f71c01c109a11f63936b4d9b8326f9b1b1a2d93f | 452 | py | Python | cookies/ex2/main.py | acandreani/ads_web_exercicios | a97ee7ebd0dba9e308b8e2d2318e577903f83f72 | [
"MIT"
] | 1 | 2019-03-13T14:33:28.000Z | 2019-03-13T14:33:28.000Z | cookies/ex2/main.py | acandreani/ads_web_exercicios | a97ee7ebd0dba9e308b8e2d2318e577903f83f72 | [
"MIT"
] | 1 | 2021-06-23T20:56:49.000Z | 2021-06-23T20:56:49.000Z | cookies/ex2/main.py | acandreani/ads_web_exercicios | a97ee7ebd0dba9e308b8e2d2318e577903f83f72 | [
"MIT"
] | 1 | 2019-04-24T13:10:58.000Z | 2019-04-24T13:10:58.000Z | from flask import Flask, render_template, request, session,redirect, url_for, escape, request, make_response
app = Flask(__name__)
# configure a chave secreta
app.secret_key = "segredo"
@app.route('/')
def index():
return render_template("index.html")
# use cookies.get(key) instead of cookies[key] t... | 22.6 | 110 | 0.679204 | from flask import Flask, render_template, request, session,redirect, url_for, escape, request, make_response
app = Flask(__name__)
app.secret_key = "segredo"
@app.route('/')
def index():
return render_template("index.html")
if __name__== "__main__":
app.run(host="0.0.0.0",debug= Tr... | true | true |
f71c0215c62089a43b38c7a560870eff98f3266c | 540 | py | Python | Exercicios-Python/exercicios-curso-em-video/d004.py | PedroGoes16/Estudos | 142a697a1d375590bb76847a74ed2b8f9fa44a9d | [
"MIT"
] | null | null | null | Exercicios-Python/exercicios-curso-em-video/d004.py | PedroGoes16/Estudos | 142a697a1d375590bb76847a74ed2b8f9fa44a9d | [
"MIT"
] | null | null | null | Exercicios-Python/exercicios-curso-em-video/d004.py | PedroGoes16/Estudos | 142a697a1d375590bb76847a74ed2b8f9fa44a9d | [
"MIT"
] | null | null | null | n = input('Digite algo: ')
print('É composto por número e letras? ',n.isalnum())
print('É composto somente por letras maiúsculas? ',n.isupper())
print('É composto somente por letras? ',n.isalpha())
print('É composto somente por números? ',n.isnumeric())
print('É um número decimal? ',n.isdecimal())
print('É composto som... | 49.090909 | 63 | 0.709259 | n = input('Digite algo: ')
print('É composto por número e letras? ',n.isalnum())
print('É composto somente por letras maiúsculas? ',n.isupper())
print('É composto somente por letras? ',n.isalpha())
print('É composto somente por números? ',n.isnumeric())
print('É um número decimal? ',n.isdecimal())
print('É composto som... | true | true |
f71c027cc59d99ded5c1d7d4bb2ac9fc391c9882 | 9,319 | py | Python | squares.py | IAmUnStTV/Tetris-Python | 4a676b6f72ceabce796592611f2541665e4010be | [
"Apache-2.0"
] | 16 | 2019-03-20T12:33:53.000Z | 2021-10-16T12:13:39.000Z | squares.py | IAmUnStTV/Tetris-Python | 4a676b6f72ceabce796592611f2541665e4010be | [
"Apache-2.0"
] | 2 | 2019-04-01T14:07:07.000Z | 2021-07-15T14:08:58.000Z | squares.py | IAmUnStTV/Tetris-Python | 4a676b6f72ceabce796592611f2541665e4010be | [
"Apache-2.0"
] | 12 | 2019-03-30T11:32:30.000Z | 2021-09-15T02:49:00.000Z | from random import randrange
from pygame import Rect, draw
from clock import Clock
class Squares:
"""method for malipulating squares in the game"""
def __init__(self, st, status, screen):
self.st = st
self.status = status
self.screen = screen
self.empty_line = ['none' for i in r... | 35.166038 | 95 | 0.570877 | from random import randrange
from pygame import Rect, draw
from clock import Clock
class Squares:
def __init__(self, st, status, screen):
self.st = st
self.status = status
self.screen = screen
self.empty_line = ['none' for i in range(st.square_num_x)]
self.squares = [self.em... | true | true |
f71c030abc2d29b0f256a337f0e78e71b90e4000 | 3,839 | py | Python | spirit/topic/views.py | BinaryTree0/fer3 | 85c3bbf2f328e69ad4d7c01b6e2c8d4ef1d9e0a3 | [
"MIT"
] | null | null | null | spirit/topic/views.py | BinaryTree0/fer3 | 85c3bbf2f328e69ad4d7c01b6e2c8d4ef1d9e0a3 | [
"MIT"
] | 5 | 2021-06-08T21:03:58.000Z | 2022-03-12T00:18:43.000Z | spirit/topic/views.py | BinaryTree0/fer3 | 85c3bbf2f328e69ad4d7c01b6e2c8d4ef1d9e0a3 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, redirect, get_object_or_404
from django.http import HttpResponsePermanentRedirect
from djconfig import config
from ..core.utils.views import is_post, post_data
from ..core.utils.paginator import pag... | 29.75969 | 75 | 0.64496 |
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, redirect, get_object_or_404
from django.http import HttpResponsePermanentRedirect
from djconfig import config
from ..core.utils.views import is_post, post_data
from ..core.utils.paginator import paginate, yt_paginate
from... | true | true |
f71c03b58cbe884de8ef7d23450e58f05962f59e | 1,242 | py | Python | src/alocacao/camada_servicos/unit_of_work.py | ralphribeiro/APWP-T2 | 1ed5552a32ae9320eadbbd0489c2082a6f8750a8 | [
"MIT"
] | null | null | null | src/alocacao/camada_servicos/unit_of_work.py | ralphribeiro/APWP-T2 | 1ed5552a32ae9320eadbbd0489c2082a6f8750a8 | [
"MIT"
] | null | null | null | src/alocacao/camada_servicos/unit_of_work.py | ralphribeiro/APWP-T2 | 1ed5552a32ae9320eadbbd0489c2082a6f8750a8 | [
"MIT"
] | null | null | null | from __future__ import annotations
import abc
from alocacao.adapters import repository
from alocacao.config import DEFAULT_SESSION_FACTORY
class AbstractUOW(abc.ABC):
produtos: repository.AbstractRepository
def __enter__(self) -> AbstractUOW:
return self
def __exit__(self, *args):
self.... | 23 | 64 | 0.661031 | from __future__ import annotations
import abc
from alocacao.adapters import repository
from alocacao.config import DEFAULT_SESSION_FACTORY
class AbstractUOW(abc.ABC):
produtos: repository.AbstractRepository
def __enter__(self) -> AbstractUOW:
return self
def __exit__(self, *args):
self.... | true | true |
f71c045146eab77490951be322d1c2d7585e636d | 1,143 | py | Python | ISMLnextGen/ipTest.py | Ravenclaw-OIer/ISML_auto_voter | 9c53bd87530697d374163f571186542c3fc9734b | [
"MIT"
] | 128 | 2020-11-16T09:28:17.000Z | 2022-03-14T10:38:52.000Z | ISMLnextGen/ipTest.py | Ravenclaw-OIer/ISML_auto_voter | 9c53bd87530697d374163f571186542c3fc9734b | [
"MIT"
] | 7 | 2020-11-27T14:45:19.000Z | 2022-02-15T09:47:12.000Z | ISMLnextGen/ipTest.py | Ravenclaw-OIer/ISML_auto_voter | 9c53bd87530697d374163f571186542c3fc9734b | [
"MIT"
] | 11 | 2020-12-11T12:24:38.000Z | 2022-02-20T12:42:31.000Z | #coding:utf-8
#访问这个服务器会获得一些'ip:端口'字符串。仅用于测试
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
@tornado.gen.coroutine
def get(self, *args, **kwargs):
self.write('''
<!DOCTYPE html><html>
<head><meta charset="utf-8" />
... | 30.891892 | 59 | 0.451444 |
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
@tornado.gen.coroutine
def get(self, *args, **kwargs):
self.write('''
<!DOCTYPE html><html>
<head><meta charset="utf-8" />
<title>html<br>标签换行符详细介绍... | true | true |
f71c05e483d33dc4be29042dc38a37ccadce4386 | 6,756 | py | Python | Sensors/softskin.py | zhaocy14/SmartWalker | b025a7b4a2b305838a22fe4e6116ddb951c4d7bf | [
"MIT"
] | 2 | 2021-11-13T14:16:06.000Z | 2022-01-12T06:07:32.000Z | Sensors/softskin.py | zhaocy14/SmartWalker | b025a7b4a2b305838a22fe4e6116ddb951c4d7bf | [
"MIT"
] | null | null | null | Sensors/softskin.py | zhaocy14/SmartWalker | b025a7b4a2b305838a22fe4e6116ddb951c4d7bf | [
"MIT"
] | 3 | 2021-08-30T04:40:39.000Z | 2022-01-09T11:34:04.000Z | import serial
import serial.tools.list_ports
import numpy as np
import math
import threading
import re
import os
import sys
import time
import matplotlib.pyplot as plt
pwd = os.path.abspath(os.path.abspath(__file__))
father_path = os.path.abspath(os.path.dirname(pwd) + os.path.sep + "..")
sys.path.append(father_path)
... | 36.518919 | 93 | 0.558467 | import serial
import serial.tools.list_ports
import numpy as np
import math
import threading
import re
import os
import sys
import time
import matplotlib.pyplot as plt
pwd = os.path.abspath(os.path.abspath(__file__))
father_path = os.path.abspath(os.path.dirname(pwd) + os.path.sep + "..")
sys.path.append(father_path)
... | true | true |
f71c0620c464a57b3ebe69ac3d9aba39ae33da92 | 1,518 | py | Python | olass/models/base_query.py | ufbmi/olass-client | 2fc949d4d59959e7e3ba5ec737b20d8db856b54b | [
"MIT"
] | null | null | null | olass/models/base_query.py | ufbmi/olass-client | 2fc949d4d59959e7e3ba5ec737b20d8db856b54b | [
"MIT"
] | 1 | 2016-08-12T20:52:09.000Z | 2016-08-12T20:59:35.000Z | olass/models/base_query.py | ufbmi/olass-client | 2fc949d4d59959e7e3ba5ec737b20d8db856b54b | [
"MIT"
] | 1 | 2016-06-28T16:43:09.000Z | 2016-06-28T16:43:09.000Z | """
Goal: Provides paginate() function
"""
from sqlalchemy import orm
from olass.models.pagination import Pagination
class BaseQuery(orm.Query):
"""
@see: flask-sqlalchemy/flask_sqlalchemy/__init__.py
"""
def paginate(self, page=None, per_page=None, error_out=True):
"""Returns ``per_page`` it... | 30.36 | 79 | 0.597497 | from sqlalchemy import orm
from olass.models.pagination import Pagination
class BaseQuery(orm.Query):
def paginate(self, page=None, per_page=None, error_out=True):
if page is None:
page = 1
if per_page is None:
per_page = 20
if error_out and page < 1:
... | true | true |
f71c06f54e6701786b0f29d7880b93fa9b637655 | 649 | py | Python | gui.py | eduardokimmel/ofx_to_xlsx | f36dc430ca2424055feba8f04c7f48cd4741d82c | [
"MIT"
] | null | null | null | gui.py | eduardokimmel/ofx_to_xlsx | f36dc430ca2424055feba8f04c7f48cd4741d82c | [
"MIT"
] | null | null | null | gui.py | eduardokimmel/ofx_to_xlsx | f36dc430ca2424055feba8f04c7f48cd4741d82c | [
"MIT"
] | null | null | null | from tkinter.filedialog import askopenfilename
from tkinter import *
import cli
import gettext
window = Tk()
window.title("ofx_to_xlsx")
def close_window():
window.destroy()
def callback():
ofx = askopenfilename()
cli.run(ofx)
gettext.install('ofx_to_xlsx')
t = gettext.translation('gui_i18n', 'locale'... | 19.088235 | 71 | 0.702619 | from tkinter.filedialog import askopenfilename
from tkinter import *
import cli
import gettext
window = Tk()
window.title("ofx_to_xlsx")
def close_window():
window.destroy()
def callback():
ofx = askopenfilename()
cli.run(ofx)
gettext.install('ofx_to_xlsx')
t = gettext.translation('gui_i18n', 'locale'... | true | true |
f71c071affad74a0e7aea1a05a898c897c918ab8 | 691 | py | Python | emtract/model_inference.py | dvamossy/EmTract | 68a00e3d63fbc2c401b0d2b297bf96ffb75940e8 | [
"MIT"
] | 16 | 2021-12-02T18:59:56.000Z | 2022-03-31T11:42:12.000Z | emtract/model_inference.py | dvamossy/EmTract | 68a00e3d63fbc2c401b0d2b297bf96ffb75940e8 | [
"MIT"
] | null | null | null | emtract/model_inference.py | dvamossy/EmTract | 68a00e3d63fbc2c401b0d2b297bf96ffb75940e8 | [
"MIT"
] | 1 | 2021-12-09T06:05:22.000Z | 2021-12-09T06:05:22.000Z | import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
from emtract.model import Model, ModelType
import pandas as pd
class ModelInference:
MODEL_BASE_PATH = 'build/models/'
DATA_BASE_PATH = './emtract/data/'
def __init__(self, model_type):
if model_type == 'twitter':
self.model = Model(... | 27.64 | 62 | 0.662808 | import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
from emtract.model import Model, ModelType
import pandas as pd
class ModelInference:
MODEL_BASE_PATH = 'build/models/'
DATA_BASE_PATH = './emtract/data/'
def __init__(self, model_type):
if model_type == 'twitter':
self.model = Model(... | true | true |
f71c07a140ce757dc105e33553450a64b401d600 | 147 | py | Python | students/k33422/Alexandrin_Anton/Lr2/homework/main/admin.py | aytakr/ITMO_ICT_WebDevelopment_2021-2022 | 57c0eef5e1f413c7f031ee001d59e5122f990f26 | [
"MIT"
] | 7 | 2021-09-02T08:20:58.000Z | 2022-01-12T11:48:07.000Z | students/k33422/Alexandrin_Anton/Lr2/homework/main/admin.py | aytakr/ITMO_ICT_WebDevelopment_2021-2022 | 57c0eef5e1f413c7f031ee001d59e5122f990f26 | [
"MIT"
] | 76 | 2021-09-17T23:01:50.000Z | 2022-03-18T16:42:03.000Z | students/k33422/Alexandrin_Anton/Lr2/homework/main/admin.py | aytakr/ITMO_ICT_WebDevelopment_2021-2022 | 57c0eef5e1f413c7f031ee001d59e5122f990f26 | [
"MIT"
] | 60 | 2021-09-04T16:47:39.000Z | 2022-03-21T04:41:27.000Z | from django.contrib import admin
from .models import *
admin.site.register(Student)
admin.site.register(Homework)
admin.site.register(Assignment)
| 21 | 32 | 0.816327 | from django.contrib import admin
from .models import *
admin.site.register(Student)
admin.site.register(Homework)
admin.site.register(Assignment)
| true | true |
f71c0829da8f53bf5fb8a4964502e266c6e624a6 | 1,918 | py | Python | tests/test_rabbitmq_consumer_command.py | LaEmma/sparrow_cloud | fb9f76ea70b3ba5782c33f3b3379e2ffe4bab08c | [
"MIT"
] | null | null | null | tests/test_rabbitmq_consumer_command.py | LaEmma/sparrow_cloud | fb9f76ea70b3ba5782c33f3b3379e2ffe4bab08c | [
"MIT"
] | null | null | null | tests/test_rabbitmq_consumer_command.py | LaEmma/sparrow_cloud | fb9f76ea70b3ba5782c33f3b3379e2ffe4bab08c | [
"MIT"
] | null | null | null | import os
import unittest
from django.conf.urls import url
from django.http import HttpResponse
def task(*args, **kwargs):
print('*'*10)
def detail(request, question_id):
return HttpResponse("You're looking at question %s." % question_id)
urlpatterns = [
url(r'^/ssss/xxx/$', detail),
url(r'^/ssuuu... | 31.442623 | 88 | 0.606361 | import os
import unittest
from django.conf.urls import url
from django.http import HttpResponse
def task(*args, **kwargs):
print('*'*10)
def detail(request, question_id):
return HttpResponse("You're looking at question %s." % question_id)
urlpatterns = [
url(r'^/ssss/xxx/$', detail),
url(r'^/ssuuu... | true | true |
f71c08e2095d6c92591d4e24b87dfa59366adf76 | 1,108 | py | Python | manage.py | cjmabry/PoliChart | 787d987669de4891b1b1ac5f8ebc0ecd38ac2785 | [
"BSD-3-Clause"
] | null | null | null | manage.py | cjmabry/PoliChart | 787d987669de4891b1b1ac5f8ebc0ecd38ac2785 | [
"BSD-3-Clause"
] | null | null | null | manage.py | cjmabry/PoliChart | 787d987669de4891b1b1ac5f8ebc0ecd38ac2785 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
import os
from flask.ext.script import Manager
from polichart import create_app, polling
from polichart.extensions import db
from polichart.utils import MALE
from flask import url_for
app = create_app()
manager = Manager(app)
@app.context_processor
def override_url_for():
return dict(u... | 21.307692 | 58 | 0.617329 |
import os
from flask.ext.script import Manager
from polichart import create_app, polling
from polichart.extensions import db
from polichart.utils import MALE
from flask import url_for
app = create_app()
manager = Manager(app)
@app.context_processor
def override_url_for():
return dict(url_for=dated_url_for)
... | true | true |
f71c093c62e3d49d16d3c9cbf3b0a2a8b7fd68d6 | 2,128 | py | Python | integrationtest/vm/installation/upgrade/test_zs_upgd_1.3_latest_on_cos7.py | bgerxx/woodpecker | fdc51245945cc9be4d1f028988079213eb99b2ad | [
"Apache-2.0"
] | null | null | null | integrationtest/vm/installation/upgrade/test_zs_upgd_1.3_latest_on_cos7.py | bgerxx/woodpecker | fdc51245945cc9be4d1f028988079213eb99b2ad | [
"Apache-2.0"
] | null | null | null | integrationtest/vm/installation/upgrade/test_zs_upgd_1.3_latest_on_cos7.py | bgerxx/woodpecker | fdc51245945cc9be4d1f028988079213eb99b2ad | [
"Apache-2.0"
] | null | null | null | '''
@author: MengLai
'''
import os
import tempfile
import uuid
import time
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstacklib.utils.ssh as ssh
import zstackwoodpecker.operations.scenario_operations ... | 33.777778 | 75 | 0.740132 | import os
import tempfile
import uuid
import time
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstacklib.utils.ssh as ssh
import zstackwoodpecker.operations.scenario_operations as scen_ops
test_stub = tes... | true | true |
f71c0a5782bf191b5540c2eb75fdf8f2a7d65eb4 | 4,189 | py | Python | tools/ISM_ticket_creation/ISM_ticket_creation.py | thahasinab/risksense_tools | 55399f21c680735e3c557484ec8788a33c1525e7 | [
"Apache-2.0"
] | null | null | null | tools/ISM_ticket_creation/ISM_ticket_creation.py | thahasinab/risksense_tools | 55399f21c680735e3c557484ec8788a33c1525e7 | [
"Apache-2.0"
] | null | null | null | tools/ISM_ticket_creation/ISM_ticket_creation.py | thahasinab/risksense_tools | 55399f21c680735e3c557484ec8788a33c1525e7 | [
"Apache-2.0"
] | null | null | null | import requests
import json
import time
import os
import toml
import zipfile
import csv
import pandas as pd
from datetime import date
from datetime import datetime
import logging
def incident_create(ism_url,ism_key,ism_attachment_url,final_directory,tag_name_list,flag_AH,assignee,assignee_desc,profile_link):
Patch... | 46.544444 | 1,031 | 0.627596 | import requests
import json
import time
import os
import toml
import zipfile
import csv
import pandas as pd
from datetime import date
from datetime import datetime
import logging
def incident_create(ism_url,ism_key,ism_attachment_url,final_directory,tag_name_list,flag_AH,assignee,assignee_desc,profile_link):
Patch... | true | true |
f71c0b020116ae97bd345db15ac8c2ee8e6c6d43 | 28,999 | py | Python | venv/Lib/site-packages/pip/_internal/cli/cmdoptions.py | EkremBayar/bayar | aad1a32044da671d0b4f11908416044753360b39 | [
"MIT"
] | 38,667 | 2015-01-01T00:15:34.000Z | 2022-03-31T22:57:03.000Z | venv/Lib/site-packages/pip/_internal/cli/cmdoptions.py | EkremBayar/bayar | aad1a32044da671d0b4f11908416044753360b39 | [
"MIT"
] | 1,192 | 2015-01-03T07:59:34.000Z | 2022-03-31T13:22:26.000Z | venv/Lib/site-packages/pip/_internal/cli/cmdoptions.py | EkremBayar/bayar | aad1a32044da671d0b4f11908416044753360b39 | [
"MIT"
] | 11,269 | 2015-01-01T08:41:17.000Z | 2022-03-31T16:12:52.000Z | """
shared options and groups
The principle here is to define options once, but *not* instantiate them
globally. One reason being that options with action='append' can carry state
between parses. pip parses general options twice internally, and shouldn't
pass on state. To be consistent, all options will follow this de... | 28.291707 | 82 | 0.626746 |
import os
import textwrap
import warnings
from functools import partial
from optparse import SUPPRESS_HELP, Option, OptionGroup, OptionParser, Values
from textwrap import dedent
from typing import Any, Callable, Dict, Optional, Tuple
from pip._vendor.packaging.utils import canonicalize_name
from pip._internal.cli... | true | true |
f71c0e613c8658e9c5d1b5f8b68e473cd366b6c5 | 8,773 | py | Python | src/sst/elements/memHierarchy/tests/testsuite_default_memHierarchy_sdl.py | sudhanshu2/sst-elements | d658e5e4b26e5725488f9e93528506ddb22072ee | [
"BSD-3-Clause"
] | null | null | null | src/sst/elements/memHierarchy/tests/testsuite_default_memHierarchy_sdl.py | sudhanshu2/sst-elements | d658e5e4b26e5725488f9e93528506ddb22072ee | [
"BSD-3-Clause"
] | null | null | null | src/sst/elements/memHierarchy/tests/testsuite_default_memHierarchy_sdl.py | sudhanshu2/sst-elements | d658e5e4b26e5725488f9e93528506ddb22072ee | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from sst_unittest import *
from sst_unittest_support import *
import os.path
################################################################################
# Code to support a single instance module initialize, must be called setUp method
module_init = 0
module_sema = threading.Semaphore()
... | 40.428571 | 140 | 0.619514 |
from sst_unittest import *
from sst_unittest_support import *
import os.path
| true | true |
f71c0f38bd33c235f501fe3157c2816cd7eb598d | 2,430 | py | Python | data/p4VQE/R4/benchmark/startQiskit_noisy62.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | data/p4VQE/R4/benchmark/startQiskit_noisy62.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | data/p4VQE/R4/benchmark/startQiskit_noisy62.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | # qubit number=3
# total number=10
import numpy as np
from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ
import networkx as nx
from qiskit.visualization import plot_histogram
from typing import *
from pprint import pprint
from math import log2
from collectio... | 27 | 118 | 0.631687 |
import numpy as np
from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ
import networkx as nx
from qiskit.visualization import plot_histogram
from typing import *
from pprint import pprint
from math import log2
from collections import Counter
from qiskit.tes... | true | true |
f71c0f815fea461fc753f56d6e32829a423105fd | 431 | py | Python | project/tasks/sample_tasks.py | idjemaoune/django-celery | 411e854fc63a4d42be2a6e8861c4dc6b89969161 | [
"MIT"
] | null | null | null | project/tasks/sample_tasks.py | idjemaoune/django-celery | 411e854fc63a4d42be2a6e8861c4dc6b89969161 | [
"MIT"
] | null | null | null | project/tasks/sample_tasks.py | idjemaoune/django-celery | 411e854fc63a4d42be2a6e8861c4dc6b89969161 | [
"MIT"
] | null | null | null | # project/tasks/sample_tasks.py
import time
from celery import shared_task
@shared_task
def send_email(email_id, message):
time.sleep(10)
print(f"Email is sent to {email_id}. Message sent was - {message}")
@shared_task
def get_micro_app_status(app):
print(f"La micro app {app}. est UP")
@shared_task
... | 17.958333 | 71 | 0.716937 |
import time
from celery import shared_task
@shared_task
def send_email(email_id, message):
time.sleep(10)
print(f"Email is sent to {email_id}. Message sent was - {message}")
@shared_task
def get_micro_app_status(app):
print(f"La micro app {app}. est UP")
@shared_task
def create_task(task_type):
... | true | true |
f71c0fb67deffb5ad5e92f615b5c852fabdd95ff | 9,938 | py | Python | docs/_downloads/d923ca53b1bfbeb3c222ae46d65d485e/transfer_learning_tutorial.py | pleiades-s/PyTorch-tutorials-kr | 3d749ea2fe67363b5d46340b742308b744fa0419 | [
"BSD-3-Clause"
] | 2 | 2021-01-18T04:59:05.000Z | 2021-03-20T00:56:24.000Z | docs/_downloads/d923ca53b1bfbeb3c222ae46d65d485e/transfer_learning_tutorial.py | pleiades-s/PyTorch-tutorials-kr | 3d749ea2fe67363b5d46340b742308b744fa0419 | [
"BSD-3-Clause"
] | null | null | null | docs/_downloads/d923ca53b1bfbeb3c222ae46d65d485e/transfer_learning_tutorial.py | pleiades-s/PyTorch-tutorials-kr | 3d749ea2fe67363b5d46340b742308b744fa0419 | [
"BSD-3-Clause"
] | 1 | 2022-02-27T10:47:39.000Z | 2022-02-27T10:47:39.000Z | # -*- coding: utf-8 -*-
"""
컴퓨터 비전(Vision)을 위한 전이학습(Transfer Learning)
=======================================================
**Author**: `Sasank Chilamkurthy <https://chsasank.github.io>`_
**번역**: `박정환 <http://github.com/9bow>`_
이 튜토리얼에서는 전이학습(Transfer Learning)을 이용하여 이미지 분류를 위한
합성곱 신경망을 어떻게 학습시키는지 배워보겠습니다. 전이학습에 ... | 29.229412 | 88 | 0.553934 |
from __future__ import print_function, division
import torch
import torch.nn as nn
import torch.optim as optim
from torch.optim import lr_scheduler
import numpy as np
import torchvision
from torchvision import datasets, models, transforms
import matplotlib.pyplot as plt
import time
import os
import copy
plt.ion()... | true | true |
f71c100fdfb127051c66f6dd3ec6cfe317c4ad61 | 3,783 | py | Python | my3b1b/old/MicoaelPrimo.py | Micoael/3b1b-styled-video-code | 036b339573e48f807e215bc7c7be9c6fe32b601d | [
"Apache-2.0"
] | 7 | 2020-03-02T23:56:39.000Z | 2020-06-08T15:05:46.000Z | my3b1b/old/MicoaelPrimo.py | Micoael/3b1b-styled-video-code | 036b339573e48f807e215bc7c7be9c6fe32b601d | [
"Apache-2.0"
] | null | null | null | my3b1b/old/MicoaelPrimo.py | Micoael/3b1b-styled-video-code | 036b339573e48f807e215bc7c7be9c6fe32b601d | [
"Apache-2.0"
] | null | null | null | from manimlib.imports import *
class StartingScene(Scene):
def construct(_):
e = Text("Manim homework by mp",font="Consolas",color=BLUE)
_.play(Write(e),run_time=3)
_.wait()
_.play(Uncreate(e))
A = Dot().move_to(np.array([0-2,0,0]))
B = Dot().m... | 49.12987 | 133 | 0.576791 | from manimlib.imports import *
class StartingScene(Scene):
def construct(_):
e = Text("Manim homework by mp",font="Consolas",color=BLUE)
_.play(Write(e),run_time=3)
_.wait()
_.play(Uncreate(e))
A = Dot().move_to(np.array([0-2,0,0]))
B = Dot().m... | true | true |
f71c111b67dac5359468b1d2de3970e43bfa4ea3 | 5,551 | py | Python | leetcode_python/Array/longest-arithmetic-subsequence.py | yennanliu/Python_basics | 6a597442d39468295946cefbfb11d08f61424dc3 | [
"Unlicense"
] | null | null | null | leetcode_python/Array/longest-arithmetic-subsequence.py | yennanliu/Python_basics | 6a597442d39468295946cefbfb11d08f61424dc3 | [
"Unlicense"
] | null | null | null | leetcode_python/Array/longest-arithmetic-subsequence.py | yennanliu/Python_basics | 6a597442d39468295946cefbfb11d08f61424dc3 | [
"Unlicense"
] | null | null | null | """
1027. Longest Arithmetic Subsequence
Medium
Given an array nums of integers, return the length of the longest arithmetic subsequence in nums.
Recall that a subsequence of an array nums is a list nums[i1], nums[i2], ..., nums[ik] with 0 <= i1 < i2 < ... < ik <= nums.length - 1, and that a sequence seq is arithmet... | 31.361582 | 248 | 0.503513 |
class Solution:
def longestArithSeqLength(self, A):
dp = {}
for i in range(len(A)):
for j in range(i + 1, len(A)):
dp[j, A[j] - A[i]] = dp.get((i, A[j] - A[i]), 1) + 1
return max(dp.values())
# IDEA : HASH TABLE
# https://leetcode.com/prob... | true | true |
f71c1149bd0ccd4c108d6852f0e7e33eb102e6e2 | 1,820 | py | Python | tests/util/test_i18n.py | zsluedem/MonkTrader | 760942a59919b34c876467bc0eb4afb30689cbc1 | [
"MIT"
] | 2 | 2018-11-17T06:39:36.000Z | 2019-01-18T13:14:15.000Z | tests/util/test_i18n.py | zsluedem/MonkTrader | 760942a59919b34c876467bc0eb4afb30689cbc1 | [
"MIT"
] | 37 | 2018-11-04T15:05:04.000Z | 2019-03-09T09:26:30.000Z | tests/util/test_i18n.py | zsluedem/MonkTrader | 760942a59919b34c876467bc0eb4afb30689cbc1 | [
"MIT"
] | null | null | null | #
# MIT License
#
# Copyright (c) 2018 WillQ
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... | 37.142857 | 79 | 0.737363 |
import os
from unittest.mock import MagicMock, patch
from monkq.utils.i18n import LazyTranslation
def test_lazytranslation_not_setting() -> None:
with patch("monkq.utils.i18n.gettext", MagicMock()) as mockg:
mockg.find.return_value = None
trans = LazyTranslation()
... | true | true |
f71c138dfb3853f24c17b2b530c0d786d88a9cf0 | 5,959 | py | Python | modelEpochs.py | JDMusc/Online-Bullying-Image-Classifcation | 9196c60c554cf160d68cb9e9c41fda124abebf63 | [
"MIT"
] | null | null | null | modelEpochs.py | JDMusc/Online-Bullying-Image-Classifcation | 9196c60c554cf160d68cb9e9c41fda124abebf63 | [
"MIT"
] | null | null | null | modelEpochs.py | JDMusc/Online-Bullying-Image-Classifcation | 9196c60c554cf160d68cb9e9c41fda124abebf63 | [
"MIT"
] | null | null | null | import copy
import numpy as np
from numpy import log10
import os
from toolz import pipe as p
from tensorboardX import SummaryWriter
import torch
import torch.nn as nn
import numpy as np
import preprocessing as pp
def findParam(model, name_filter):
if callable(name_filter):
fn = name_filter
else:
... | 27.587963 | 80 | 0.614365 | import copy
import numpy as np
from numpy import log10
import os
from toolz import pipe as p
from tensorboardX import SummaryWriter
import torch
import torch.nn as nn
import numpy as np
import preprocessing as pp
def findParam(model, name_filter):
if callable(name_filter):
fn = name_filter
else:
... | true | true |
f71c143502daacb5d0cac62a6b711503065c58e7 | 505 | py | Python | functions/l3Consume.py | yuklia/serverless-lambda-chaining | dd24129933489c2f1a522b37d8f4c3e16eb47285 | [
"MIT"
] | null | null | null | functions/l3Consume.py | yuklia/serverless-lambda-chaining | dd24129933489c2f1a522b37d8f4c3e16eb47285 | [
"MIT"
] | null | null | null | functions/l3Consume.py | yuklia/serverless-lambda-chaining | dd24129933489c2f1a522b37d8f4c3e16eb47285 | [
"MIT"
] | null | null | null | import json
def handler(event, context):
message_from_publisher = json.loads(event['Records'][0]['Sns']['Message'])
my_param = message_from_publisher['myParamFromConsumerPublisher']
print("👷 Received paramater from ConsumerPublisher: '{0}'".format(my_param))
body = {
"message": "Go Serve... | 24.047619 | 80 | 0.637624 | import json
def handler(event, context):
message_from_publisher = json.loads(event['Records'][0]['Sns']['Message'])
my_param = message_from_publisher['myParamFromConsumerPublisher']
print("👷 Received paramater from ConsumerPublisher: '{0}'".format(my_param))
body = {
"message": "Go Serve... | true | true |
f71c145bb6baf46c8e813d23d04f55fadd9b6a4e | 112 | py | Python | test/nohtml.py | eaybek/nohtml | 9df8fc032891591516d8a719ebc15440d8cc7a0c | [
"MIT"
] | null | null | null | test/nohtml.py | eaybek/nohtml | 9df8fc032891591516d8a719ebc15440d8cc7a0c | [
"MIT"
] | null | null | null | test/nohtml.py | eaybek/nohtml | 9df8fc032891591516d8a719ebc15440d8cc7a0c | [
"MIT"
] | null | null | null | import unittest
class NohtmlTest(unittest.TestCase):
pass
if __name__ == "__main__":
unittest.main()
| 12.444444 | 36 | 0.705357 | import unittest
class NohtmlTest(unittest.TestCase):
pass
if __name__ == "__main__":
unittest.main()
| true | true |
f71c154fa91e7b9687d0c58c927b63ccf6253ccb | 3,682 | py | Python | ReUseModel/TestFAEModel.py | Eggiverse/FAE | 1b953ba6dfcced83e5929eeaa8f525ec4acde5ed | [
"MIT"
] | null | null | null | ReUseModel/TestFAEModel.py | Eggiverse/FAE | 1b953ba6dfcced83e5929eeaa8f525ec4acde5ed | [
"MIT"
] | null | null | null | ReUseModel/TestFAEModel.py | Eggiverse/FAE | 1b953ba6dfcced83e5929eeaa8f525ec4acde5ed | [
"MIT"
] | null | null | null |
import os
import csv
import numpy as np
from FAE.FeatureAnalysis.Normalizer import Normalizer
from FAE.DataContainer.DataContainer import DataContainer
from FAE.FeatureAnalysis.Classifier import Classifier
from FAE.Func.Metric import EstimateMetirc
from FAE.FeatureAnalysis.FeatureSelector import FeatureSelecto... | 32.875 | 111 | 0.69962 |
import os
import csv
import numpy as np
from FAE.FeatureAnalysis.Normalizer import Normalizer
from FAE.DataContainer.DataContainer import DataContainer
from FAE.FeatureAnalysis.Classifier import Classifier
from FAE.Func.Metric import EstimateMetirc
from FAE.FeatureAnalysis.FeatureSelector import FeatureSelecto... | true | true |
f71c159e39dcb104058740ebee5fb752312a3553 | 160 | py | Python | cranes/__init__.py | annehulsey/high-resolution_post-earthquake_recovery_simulation_of_safety_cordons | 8b8bedceee0343d22143f48992136fc2fc34e191 | [
"MIT"
] | null | null | null | cranes/__init__.py | annehulsey/high-resolution_post-earthquake_recovery_simulation_of_safety_cordons | 8b8bedceee0343d22143f48992136fc2fc34e191 | [
"MIT"
] | null | null | null | cranes/__init__.py | annehulsey/high-resolution_post-earthquake_recovery_simulation_of_safety_cordons | 8b8bedceee0343d22143f48992136fc2fc34e191 | [
"MIT"
] | null | null | null | from .base import *
from .mapping import *
from .community_damage_sampling import *
from .downtime_logistics import *
from .analysis_and_visualization import *
| 26.666667 | 41 | 0.8125 | from .base import *
from .mapping import *
from .community_damage_sampling import *
from .downtime_logistics import *
from .analysis_and_visualization import *
| true | true |
f71c1615d02213bb8e244cd957fa6b17a89b9787 | 2,153 | py | Python | plugins/zscaler/icon_zscaler/actions/lookup_url/schema.py | lukaszlaszuk/insightconnect-plugins | 8c6ce323bfbb12c55f8b5a9c08975d25eb9f8892 | [
"MIT"
] | 46 | 2019-06-05T20:47:58.000Z | 2022-03-29T10:18:01.000Z | plugins/zscaler/icon_zscaler/actions/lookup_url/schema.py | lukaszlaszuk/insightconnect-plugins | 8c6ce323bfbb12c55f8b5a9c08975d25eb9f8892 | [
"MIT"
] | 386 | 2019-06-07T20:20:39.000Z | 2022-03-30T17:35:01.000Z | plugins/zscaler/icon_zscaler/actions/lookup_url/schema.py | lukaszlaszuk/insightconnect-plugins | 8c6ce323bfbb12c55f8b5a9c08975d25eb9f8892 | [
"MIT"
] | 43 | 2019-07-09T14:13:58.000Z | 2022-03-28T12:04:46.000Z | # GENERATED BY KOMAND SDK - DO NOT EDIT
import insightconnect_plugin_runtime
import json
class Component:
DESCRIPTION = "Look up the categorization of a given set of URLs"
class Input:
URLS = "urls"
class Output:
URL_CATEGORIZATION = "url_categorization"
class LookupUrlInput(insightconnect_p... | 21.53 | 72 | 0.533674 |
import insightconnect_plugin_runtime
import json
class Component:
DESCRIPTION = "Look up the categorization of a given set of URLs"
class Input:
URLS = "urls"
class Output:
URL_CATEGORIZATION = "url_categorization"
class LookupUrlInput(insightconnect_plugin_runtime.Input):
schema = json... | true | true |
f71c1852ffabfd6520c29aa0e5896783707f3f65 | 9,759 | py | Python | pyhtmlcv.py | lietu/pyhtmlcv | 68e75d5b761f4cbf4315d9c573fdc39872abbc20 | [
"BSD-3-Clause"
] | 3 | 2017-02-15T14:02:57.000Z | 2019-04-30T23:33:55.000Z | pyhtmlcv.py | lietu/pyhtmlcv | 68e75d5b761f4cbf4315d9c573fdc39872abbc20 | [
"BSD-3-Clause"
] | null | null | null | pyhtmlcv.py | lietu/pyhtmlcv | 68e75d5b761f4cbf4315d9c573fdc39872abbc20 | [
"BSD-3-Clause"
] | 1 | 2017-06-01T15:58:09.000Z | 2017-06-01T15:58:09.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
PyHtmlCv is a tool to that can be used to generate HTML CVs from a
simple JSON configuration.
:copyright: (c) 2012-2019 Janne Enberg
:license: BSD
"""
from argparse import ArgumentParser, ArgumentTypeError
import codecs
from datetime import datetime
from jinja2 import... | 28.043103 | 86 | 0.544216 |
from argparse import ArgumentParser, ArgumentTypeError
import codecs
from datetime import datetime
from jinja2 import Environment, FileSystemLoader
import json
try:
from pathlib import Path
except ImportError:
from pathlib2 import Path
import re
import sass
import six
import shutil
import sys
from time imp... | true | true |
f71c190a14841ef42f527cfad6bd4742ebd5bc55 | 929 | py | Python | nlpaug/util/audio/loader.py | lucidworks/nlpaug | 8e47fa39200db17f4dc1d61567af1419bc389071 | [
"MIT"
] | 1 | 2021-06-09T20:07:30.000Z | 2021-06-09T20:07:30.000Z | nlpaug/util/audio/loader.py | lucidworks/nlpaug | 8e47fa39200db17f4dc1d61567af1419bc389071 | [
"MIT"
] | null | null | null | nlpaug/util/audio/loader.py | lucidworks/nlpaug | 8e47fa39200db17f4dc1d61567af1419bc389071 | [
"MIT"
] | null | null | null | try:
import librosa
except ImportError:
# No installation required if not using this function
pass
class AudioLoader:
@staticmethod
def load_audio(file_path):
try:
import librosa
except ModuleNotFoundError:
raise ModuleNotFoundError(
"Missed ... | 28.151515 | 89 | 0.634015 | try:
import librosa
except ImportError:
pass
class AudioLoader:
@staticmethod
def load_audio(file_path):
try:
import librosa
except ModuleNotFoundError:
raise ModuleNotFoundError(
"Missed librosa library. Install import librosa by `pip insta... | true | true |
f71c191c5eb6a1641c149fff6ae72d57a8d19cda | 4,286 | py | Python | dataset/DeepFakes/faceswap-master/lib/training_data.py | MrThiago/FaceForensics | 1806e70d0dd2294a12a8afd1c3f59d6ecac639bf | [
"MIT"
] | 1,930 | 2018-04-20T14:52:01.000Z | 2022-03-30T13:53:31.000Z | dataset/DeepFakes/faceswap-master/lib/training_data.py | chrisgorgo/FaceForensics | a815daa9ebb7c12240a4b7162c431af0e1b959fa | [
"MIT"
] | 68 | 2019-02-14T09:09:02.000Z | 2022-03-23T08:55:23.000Z | dataset/DeepFakes/faceswap-master/lib/training_data.py | chrisgorgo/FaceForensics | a815daa9ebb7c12240a4b7162c431af0e1b959fa | [
"MIT"
] | 499 | 2018-04-20T11:27:11.000Z | 2022-03-29T16:29:50.000Z | import cv2
import numpy
from random import shuffle
from .utils import BackgroundGenerator
from .umeyama import umeyama
class TrainingDataGenerator():
def __init__(self, random_transform_args, coverage, scale=5, zoom=1): #TODO thos default should stay in the warp function
self.random_transform_args = rando... | 40.819048 | 187 | 0.617592 | import cv2
import numpy
from random import shuffle
from .utils import BackgroundGenerator
from .umeyama import umeyama
class TrainingDataGenerator():
def __init__(self, random_transform_args, coverage, scale=5, zoom=1):
self.random_transform_args = random_transform_args
self.coverage = coverage
... | true | true |
f71c1b0d0a31e515a655f2a67f62120cc4232d70 | 1,106 | py | Python | setup.py | albertosottile/SmartGadget-gatt | b5b4002f3635afcb97de5106676cc7142b1e9ca5 | [
"MIT"
] | 2 | 2021-06-14T18:08:16.000Z | 2021-08-29T06:48:10.000Z | setup.py | albertosottile/SmartGadget-gatt | b5b4002f3635afcb97de5106676cc7142b1e9ca5 | [
"MIT"
] | null | null | null | setup.py | albertosottile/SmartGadget-gatt | b5b4002f3635afcb97de5106676cc7142b1e9ca5 | [
"MIT"
] | 1 | 2021-08-29T06:48:11.000Z | 2021-08-29T06:48:11.000Z | #!/usr/bin/env python3
import setuptools
def read(fname):
with open(fname, 'r') as f:
return f.read()
setuptools.setup(
name="smartgadget",
version="0.1",
author="Alberto Sottile",
author_email="alby128@gmail.com",
description=' '.join([
'Interact with a Sensirion SHT31 Smart ... | 30.722222 | 65 | 0.621157 |
import setuptools
def read(fname):
with open(fname, 'r') as f:
return f.read()
setuptools.setup(
name="smartgadget",
version="0.1",
author="Alberto Sottile",
author_email="alby128@gmail.com",
description=' '.join([
'Interact with a Sensirion SHT31 Smart Gadget',
'Deve... | true | true |
f71c1b1f9c2288ed03520cd964f1b666fcfab9a4 | 1,302 | py | Python | CV_A4_/A4_compute_descriptors.py | pseudowasabi/computer-vision-exercises | 34b7c8402c32dbb00e484f90780ebb6546a3f8dc | [
"MIT"
] | null | null | null | CV_A4_/A4_compute_descriptors.py | pseudowasabi/computer-vision-exercises | 34b7c8402c32dbb00e484f90780ebb6546a3f8dc | [
"MIT"
] | null | null | null | CV_A4_/A4_compute_descriptors.py | pseudowasabi/computer-vision-exercises | 34b7c8402c32dbb00e484f90780ebb6546a3f8dc | [
"MIT"
] | null | null | null | '''
Computer vision assignment 4 by Yoseob Kim
A4_compute_descriptors.py
Compute similarity-reflected image descriptors with L1, L2 norm distances by using SIFT descriptors.
* Status: (working on it)
* GitHub Link: https://github.com/pseudowasabi/computer-vision-exercises/tree/master/CV_A4_
'''
import cv2
impo... | 22.842105 | 100 | 0.669739 |
import cv2
import numpy as np
import math
import time
import operator
import random
img = cv2.imread('ukbench00000.jpg', cv2.IMREAD_GRAYSCALE)
for i in range(1000):
offset = '00' if i < 10 else '0' if i < 100 else ''
offset += str(i)
f = open('./sift/sift100'+offset, 'rb')
sift_des = np.f... | true | true |
f71c1c5ae6f65d71e66399bf4776b2b7437ab5a8 | 713 | py | Python | audiophiler/util.py | Mstrodl/audiophiler | 2e3a8299b58ab92a851cae726cc9184a2dad05f8 | [
"MIT"
] | 5 | 2017-05-08T05:07:22.000Z | 2021-06-01T18:48:30.000Z | audiophiler/util.py | Mstrodl/audiophiler | 2e3a8299b58ab92a851cae726cc9184a2dad05f8 | [
"MIT"
] | 34 | 2017-09-11T19:18:40.000Z | 2021-08-28T21:38:15.000Z | audiophiler/util.py | Mstrodl/audiophiler | 2e3a8299b58ab92a851cae726cc9184a2dad05f8 | [
"MIT"
] | 20 | 2017-09-09T22:02:11.000Z | 2021-08-28T17:45:59.000Z | # File: util.py
# Audiophiler utility functions
# Credit to Liam Middlebrook and Ram Zallan
# https://github.com/liam-middlebrook/gallery
from functools import wraps
from flask import session
from audiophiler.models import Tour
def audiophiler_auth(func):
@wraps(func)
def wrapped_function(*args, **kwargs):
... | 27.423077 | 68 | 0.652174 |
from functools import wraps
from flask import session
from audiophiler.models import Tour
def audiophiler_auth(func):
@wraps(func)
def wrapped_function(*args, **kwargs):
uuid = str(session["userinfo"].get("sub", ""))
uid = str(session["userinfo"].get("preferred_username", ""))
auth... | true | true |
f71c1c8decca6e84cea60dec4d962fc15cc6ae66 | 4,251 | py | Python | qutip/hardware_info.py | kiuthed/qutip | b6fb8e5bbd9ffeae117b54e56313e8617038deab | [
"BSD-3-Clause"
] | null | null | null | qutip/hardware_info.py | kiuthed/qutip | b6fb8e5bbd9ffeae117b54e56313e8617038deab | [
"BSD-3-Clause"
] | null | null | null | qutip/hardware_info.py | kiuthed/qutip | b6fb8e5bbd9ffeae117b54e56313e8617038deab | [
"BSD-3-Clause"
] | null | null | null | # This file is part of QuTiP: Quantum Toolbox in Python.
#
# Copyright (c) 2011 and later, Paul D. Nation and Robert J. Johansson.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
... | 36.646552 | 79 | 0.638908 | true | true | |
f71c1cb01d78b077e343818c4290f9abafc4925e | 1,900 | py | Python | cron_descriptor/GetText.py | nathmo/cron-descriptor | 2475065be9e203ed5cea49ec6ca365384f433cb6 | [
"MIT"
] | 3 | 2018-12-11T18:51:36.000Z | 2019-10-16T19:10:19.000Z | cron_descriptor/GetText.py | nathmo/cron-descriptor | 2475065be9e203ed5cea49ec6ca365384f433cb6 | [
"MIT"
] | 2 | 2019-04-14T04:14:31.000Z | 2019-10-15T03:23:54.000Z | cron_descriptor/cron_descriptor/GetText.py | michaelblyons/SublimeSyntax-Crontab | 54f1fa7ff0c9d18aea3790555dba6e533ce3749b | [
"MIT"
] | 2 | 2019-04-11T06:13:54.000Z | 2019-10-04T02:49:58.000Z | # The MIT License (MIT)
#
# Copyright (c) 2016 Adam Schubert
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mod... | 36.538462 | 80 | 0.7 |
import gettext
import os
import logging
logger = logging.getLogger(__name__)
class GetText(object):
def __init__(self, locale_code):
try:
filename = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'locale', '{}.mo'.format(l... | true | true |
f71c1cd7ddd442ab1b3e8652cdd667ec554c98f4 | 23,533 | py | Python | adnmtf/nmtf_core.py | Advestis/adnmtf | 7b36da64669894506071a75d8bd341edb0e75b9f | [
"MIT"
] | null | null | null | adnmtf/nmtf_core.py | Advestis/adnmtf | 7b36da64669894506071a75d8bd341edb0e75b9f | [
"MIT"
] | null | null | null | adnmtf/nmtf_core.py | Advestis/adnmtf | 7b36da64669894506071a75d8bd341edb0e75b9f | [
"MIT"
] | null | null | null | """Non-negative matrix and tensor factorization core functions
"""
# Author: Paul Fogel
# License: MIT
# Jan 4, '20
from typing import Tuple
import numpy as np
from .nmtf_utils import EPSILON, sparse_opt
import logging
logger = logging.getLogger(__name__)
# TODO (pcotte): typing
# TODO (pcotte): docstrings (with ... | 31.169536 | 119 | 0.470658 |
from typing import Tuple
import numpy as np
from .nmtf_utils import EPSILON, sparse_opt
import logging
logger = logging.getLogger(__name__)
# TODO (pcotte): typing
# TODO (pcotte): docstrings (with parameters and returns)
def ntf_stack(m, mmis, n_blocks):
n, p = m.shape
mmis = mmis.astype(np.int)
... | true | true |
f71c1d13e2b4281f5e462dfbd3127b8ee3404a3a | 6,928 | py | Python | actions.py | prateekralhan/Chatbot-Development-using-RASA-Framework-and-Zomato-API---PGD-IIITB-Assignment | 5e33586df2bbe146d950f33e018e9e990031e347 | [
"Apache-2.0"
] | 1 | 2020-05-21T10:20:03.000Z | 2020-05-21T10:20:03.000Z | actions.py | prateekralhan/Chatbot-Development-using-RASA-Framework-and-Zomato-API---PGD-IIITB-Assignment | 5e33586df2bbe146d950f33e018e9e990031e347 | [
"Apache-2.0"
] | null | null | null | actions.py | prateekralhan/Chatbot-Development-using-RASA-Framework-and-Zomato-API---PGD-IIITB-Assignment | 5e33586df2bbe146d950f33e018e9e990031e347 | [
"Apache-2.0"
] | 1 | 2021-12-06T03:10:37.000Z | 2021-12-06T03:10:37.000Z | from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
# importing the necessary libraries
# from rasa_core.actions.action import Action
from rasa_sdk import Action
#from rasa_sdk.forms import ( BooleanFormField, EntityFormField, FormAction, FreeTextFormField )
... | 32.679245 | 177 | 0.705831 | from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from rasa_sdk import Action
from rasa_sdk.events import SlotSet
import zomatopy
import json
zomato_config={ "user_key":"<Enter your Zomato API key here >"}
result_of_last_query = ""
class ActionSearc... | true | true |
f71c1d88fc7cda064575b3b49230553d31ba1b56 | 9,193 | py | Python | services/ui/paths/label.py | sbworth/getnoc | a9a5647df31822062db3db7afe7ae1c005d166f7 | [
"BSD-3-Clause"
] | 84 | 2017-10-22T11:01:39.000Z | 2022-02-27T03:43:48.000Z | services/ui/paths/label.py | sbworth/getnoc | a9a5647df31822062db3db7afe7ae1c005d166f7 | [
"BSD-3-Clause"
] | 22 | 2017-12-11T07:21:56.000Z | 2021-09-23T02:53:50.000Z | services/ui/paths/label.py | sbworth/getnoc | a9a5647df31822062db3db7afe7ae1c005d166f7 | [
"BSD-3-Clause"
] | 23 | 2017-12-06T06:59:52.000Z | 2022-02-24T00:02:25.000Z | # ----------------------------------------------------------------------
# Label REST API
# ----------------------------------------------------------------------
# Copyright (C) 2007-2021 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# Third-party m... | 44.843902 | 94 | 0.657892 |
from fastapi import APIRouter
from noc.main.models.label import Label
from ..models.label import DefaultLabelItem, FormLabelItem, LabelLabelItem
from ..utils.ref import get_reference
from ..utils.rest.document import DocumentResourceAPI
from ..utils.rest.op import FilterExact, FuncFilter, FilterBool
router =... | true | true |
f71c1e7d575a6e860d1fb2e06dd08a3844470ff2 | 51,171 | py | Python | dojo/engagement/views.py | pabloalexsandroalmeida83/django-DefectDojo | 094fbbf0d994c2f9b5c7ff071a28d4d5ed1f3a1c | [
"BSD-3-Clause"
] | null | null | null | dojo/engagement/views.py | pabloalexsandroalmeida83/django-DefectDojo | 094fbbf0d994c2f9b5c7ff071a28d4d5ed1f3a1c | [
"BSD-3-Clause"
] | null | null | null | dojo/engagement/views.py | pabloalexsandroalmeida83/django-DefectDojo | 094fbbf0d994c2f9b5c7ff071a28d4d5ed1f3a1c | [
"BSD-3-Clause"
] | null | null | null | import logging
import csv
import re
from openpyxl import Workbook
from openpyxl.styles import Font
from tempfile import NamedTemporaryFile
from datetime import datetime
import operator
from django.contrib.auth.models import User
from django.conf import settings
from django.contrib import messages
from django.core.exce... | 40.547544 | 182 | 0.643431 | import logging
import csv
import re
from openpyxl import Workbook
from openpyxl.styles import Font
from tempfile import NamedTemporaryFile
from datetime import datetime
import operator
from django.contrib.auth.models import User
from django.conf import settings
from django.contrib import messages
from django.core.exce... | true | true |
f71c1eaf10e717ab23c28074e182c01dfdc1b475 | 5,366 | py | Python | distributed/distributed/db.py | Yuanmessi/Bold-Falcon | 00fcaba0b3d9c462b9d20ecb256ff85db5d119e2 | [
"BSD-3-Clause"
] | 71 | 2016-11-13T03:26:45.000Z | 2022-02-22T08:13:04.000Z | distributed/distributed/db.py | Yuanmessi/Bold-Falcon | 00fcaba0b3d9c462b9d20ecb256ff85db5d119e2 | [
"BSD-3-Clause"
] | 3 | 2021-07-01T08:09:05.000Z | 2022-01-28T03:38:36.000Z | distributed/distributed/db.py | Yuanmessi/Bold-Falcon | 00fcaba0b3d9c462b9d20ecb256ff85db5d119e2 | [
"BSD-3-Clause"
] | 36 | 2016-12-13T11:37:56.000Z | 2021-11-11T12:20:10.000Z | # Copyright (C) 2014-2016 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import json
from datetime import datetime
from flask.ext.sqlalchemy import SQLAlchemy
from sqlalchemy.inspection import inspect
db = SQLAlchemy(sessi... | 34.619355 | 77 | 0.660268 |
import json
from datetime import datetime
from flask.ext.sqlalchemy import SQLAlchemy
from sqlalchemy.inspection import inspect
db = SQLAlchemy(session_options=dict(autoflush=True))
ALEMBIC_VERSION = "4b86bc0d40aa"
class Serializer(object):
def to_dict(self):
ret = {}
for key in inspect(self)... | true | true |
f71c1f3f5d963f1a9f0cad8f49f08a8a8952fb0f | 7,941 | py | Python | CTFd/config.py | mayoneko/CTFd | 825190ba3aef10f9cdc736f4d6f8ea2a5c8590ac | [
"Apache-2.0"
] | 2 | 2019-06-19T07:11:28.000Z | 2019-06-21T05:30:07.000Z | CTFd/config.py | mayoneko/CTFd | 825190ba3aef10f9cdc736f4d6f8ea2a5c8590ac | [
"Apache-2.0"
] | null | null | null | CTFd/config.py | mayoneko/CTFd | 825190ba3aef10f9cdc736f4d6f8ea2a5c8590ac | [
"Apache-2.0"
] | null | null | null | import os
''' GENERATE SECRET KEY '''
if not os.getenv('SECRET_KEY'):
# Attempt to read the secret from the secret file
# This will fail if the secret has not been written
try:
with open('.ctfd_secret_key', 'rb') as secret:
key = secret.read()
except (OSError, IOError):
key... | 37.107477 | 122 | 0.679008 | import os
if not os.getenv('SECRET_KEY'):
try:
with open('.ctfd_secret_key', 'rb') as secret:
key = secret.read()
except (OSError, IOError):
key = None
if not key:
key = os.urandom(64)
try:
with open('.ctfd_secret_key', '... | true | true |
f71c20b62ca77df8f80354e21bf08002ca39890b | 984 | py | Python | src/jsm/api/mixins/infos.py | charbonnierg/jetstream.py | 4d8dc56fc6953d0a28d207b9b162c6f8d0080d37 | [
"Apache-2.0"
] | 8 | 2021-07-26T10:54:10.000Z | 2021-12-06T08:41:02.000Z | src/jsm/api/mixins/infos.py | charbonnierg/jetstream.py | 4d8dc56fc6953d0a28d207b9b162c6f8d0080d37 | [
"Apache-2.0"
] | 3 | 2021-08-09T10:25:39.000Z | 2021-12-06T08:40:41.000Z | src/jsm/api/mixins/infos.py | charbonnierg/jetstream.py | 4d8dc56fc6953d0a28d207b9b162c6f8d0080d37 | [
"Apache-2.0"
] | 3 | 2021-08-22T01:55:11.000Z | 2021-09-13T13:51:42.000Z | # Copyright 2021 - Guillaume Charbonnier
# Licensed under the Apache License, Version 2.0 (the "License");
# http://www.apache.org/licenses/LICENSE-2.0
from __future__ import annotations
from typing import Optional, Union
from jsm.models.account_info import IoNatsJetstreamApiV1AccountInfoResponse
from jsm.models.erro... | 32.8 | 76 | 0.729675 |
from __future__ import annotations
from typing import Optional, Union
from jsm.models.account_info import IoNatsJetstreamApiV1AccountInfoResponse
from jsm.models.errors import IoNatsJetstreamApiV1ErrorResponse
from .request_reply import BaseJetStreamRequestReplyMixin, JetStreamResponse
class AccountInfosMixin(B... | true | true |
f71c21777d66133ec1da30715a6556ddee5fd447 | 467 | py | Python | integration/keeper_secrets_manager_cli/keeper_secrets_manager_cli/exception.py | Keeper-Security/secrets-manager | 0044dec7f323ae2e531f52ef2435bd7205949fe9 | [
"MIT"
] | 9 | 2022-01-10T18:39:45.000Z | 2022-03-06T03:51:41.000Z | integration/keeper_secrets_manager_cli/keeper_secrets_manager_cli/exception.py | Keeper-Security/secrets-manager | 0044dec7f323ae2e531f52ef2435bd7205949fe9 | [
"MIT"
] | 10 | 2022-01-27T00:51:05.000Z | 2022-03-30T08:42:01.000Z | integration/keeper_secrets_manager_cli/keeper_secrets_manager_cli/exception.py | Keeper-Security/secrets-manager | 0044dec7f323ae2e531f52ef2435bd7205949fe9 | [
"MIT"
] | 6 | 2021-12-17T18:59:26.000Z | 2022-03-28T16:47:28.000Z | import click
from colorama import Fore, Style
class KsmCliException(click.ClickException):
in_a_shell = False
def colorize(self):
if KsmCliException.in_a_shell is False:
return str(self.message)
else:
return Fore.RED + str(self.message) + Style.RESET_ALL
def form... | 19.458333 | 65 | 0.663812 | import click
from colorama import Fore, Style
class KsmCliException(click.ClickException):
in_a_shell = False
def colorize(self):
if KsmCliException.in_a_shell is False:
return str(self.message)
else:
return Fore.RED + str(self.message) + Style.RESET_ALL
def form... | true | true |
f71c235a81782aee7af143ed9a0e3681bf47b496 | 5,934 | py | Python | simple_distillation_mgr/VLE_data_ethanol_water.py | ykholod/kettlebell-simple-distillation-mgr | 172900253be790f9fe7712ba5f20bcbb12a2a635 | [
"MIT"
] | null | null | null | simple_distillation_mgr/VLE_data_ethanol_water.py | ykholod/kettlebell-simple-distillation-mgr | 172900253be790f9fe7712ba5f20bcbb12a2a635 | [
"MIT"
] | null | null | null | simple_distillation_mgr/VLE_data_ethanol_water.py | ykholod/kettlebell-simple-distillation-mgr | 172900253be790f9fe7712ba5f20bcbb12a2a635 | [
"MIT"
] | null | null | null | #!/usr/bin/python
# -*- coding: utf-8 -*-
""" VLE data for ethanol-water mixture, isobaric, 1.01 bar """
__author__ = "Yaroslav Kholod"
__copyright__ = "Copyright 2019, The Kettlebell project"
__credits__ = "Yaroslav Kholod"
__license__ = "MIT"
__version__ = "0.1.0"
__maintainer__ = "Yaroslav Kholod"
__email__ = "pret... | 26.373333 | 62 | 0.731378 |
__author__ = "Yaroslav Kholod"
__copyright__ = "Copyright 2019, The Kettlebell project"
__credits__ = "Yaroslav Kholod"
__license__ = "MIT"
__version__ = "0.1.0"
__maintainer__ = "Yaroslav Kholod"
__email__ = "pretorian.yaroslav@gmail.com"
__status__ = "Development"
vle_data_dew = {}
0] = 78.21
vle_data... | true | true |
f71c249886014075a96d3e57f520b3963e70bc00 | 675 | py | Python | pytest/testSigning.py | RomanValov/ArmoryDB | 625eff9712161676ad83deb03616e6edb48283ca | [
"MIT"
] | 505 | 2016-02-04T15:54:46.000Z | 2022-03-27T18:43:01.000Z | pytest/testSigning.py | jimmysong/BitcoinArmory | 1c7190176897a2e0f3e4e198ab2f199059bb2402 | [
"MIT"
] | 528 | 2016-02-06T19:50:12.000Z | 2022-01-15T10:21:16.000Z | pytest/testSigning.py | jimmysong/BitcoinArmory | 1c7190176897a2e0f3e4e198ab2f199059bb2402 | [
"MIT"
] | 208 | 2015-01-02T10:31:40.000Z | 2021-12-14T07:37:36.000Z | import sys
sys.path.append('..')
import unittest
import random
from armoryengine.ALL import *
class SigningTester(unittest.TestCase):
def testLowSig(self):
sbdPrivKey = SecureBinaryData(b'\x01'*32)
pub = CryptoECDSA().ComputePublicKey(sbdPrivKey).toBinStr()
for i in range(100):
msg = ... | 28.125 | 82 | 0.657778 | import sys
sys.path.append('..')
import unittest
import random
from armoryengine.ALL import *
class SigningTester(unittest.TestCase):
def testLowSig(self):
sbdPrivKey = SecureBinaryData(b'\x01'*32)
pub = CryptoECDSA().ComputePublicKey(sbdPrivKey).toBinStr()
for i in range(100):
msg = ... | true | true |
f71c26869793672d4719326ffb01b5d7f0f78eb2 | 12,414 | py | Python | texar/torch/modules/decoders/rnn_decoders_test.py | wwt17/texar-pytorch | 9fb3ae8f7b541da5c808357033a93fba1817bfbd | [
"Apache-2.0"
] | 19 | 2020-07-29T15:25:45.000Z | 2022-01-19T17:49:42.000Z | texar/torch/modules/decoders/rnn_decoders_test.py | wwt17/texar-pytorch | 9fb3ae8f7b541da5c808357033a93fba1817bfbd | [
"Apache-2.0"
] | 3 | 2021-02-16T10:26:23.000Z | 2021-06-08T16:50:40.000Z | texar/torch/modules/decoders/rnn_decoders_test.py | wwt17/texar-pytorch | 9fb3ae8f7b541da5c808357033a93fba1817bfbd | [
"Apache-2.0"
] | 1 | 2019-10-06T07:54:30.000Z | 2019-10-06T07:54:30.000Z | """
Unit tests for RNN decoders.
"""
import unittest
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from texar.torch.hyperparams import HParams
from texar.torch.modules.decoders.decoder_helpers import get_helper
from texar.torch.modules.decoders.rnn_decoders import (
Attent... | 39.160883 | 86 | 0.617931 |
import unittest
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from texar.torch.hyperparams import HParams
from texar.torch.modules.decoders.decoder_helpers import get_helper
from texar.torch.modules.decoders.rnn_decoders import (
AttentionRNNDecoder, AttentionRNNDecoderOut... | true | true |
f71c2776956637e7ed8b7da0a4acf3481ed4e4c7 | 3,001 | py | Python | huaweicloud-sdk-vss/huaweicloudsdkvss/v3/model/delete_domains_request.py | huaweicloud/huaweicloud-sdk-python-v3 | 7a6270390fcbf192b3882bf763e7016e6026ef78 | [
"Apache-2.0"
] | 64 | 2020-06-12T07:05:07.000Z | 2022-03-30T03:32:50.000Z | huaweicloud-sdk-vss/huaweicloudsdkvss/v3/model/delete_domains_request.py | huaweicloud/huaweicloud-sdk-python-v3 | 7a6270390fcbf192b3882bf763e7016e6026ef78 | [
"Apache-2.0"
] | 11 | 2020-07-06T07:56:54.000Z | 2022-01-11T11:14:40.000Z | huaweicloud-sdk-vss/huaweicloudsdkvss/v3/model/delete_domains_request.py | huaweicloud/huaweicloud-sdk-python-v3 | 7a6270390fcbf192b3882bf763e7016e6026ef78 | [
"Apache-2.0"
] | 24 | 2020-06-08T11:42:13.000Z | 2022-03-04T06:44:08.000Z | # coding: utf-8
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class DeleteDomainsRequest:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The k... | 26.324561 | 79 | 0.553149 |
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class DeleteDomainsRequest:
sensitive_list = []
openapi_types = {
'domain_name': 'str'
}
attribute_map = {
'domain_name': 'domain_name'
}
def __init__(self, domain_name=No... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.