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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f74b9466425d36f82dd07f9f29402da81582f421 | 2,835 | py | Python | python/examples/bin_info.py | xavierholt/binaryninja-api | f52f7535c245f33d3c9f569b4a13abc05cf50998 | [
"MIT"
] | null | null | null | python/examples/bin_info.py | xavierholt/binaryninja-api | f52f7535c245f33d3c9f569b4a13abc05cf50998 | [
"MIT"
] | null | null | null | python/examples/bin_info.py | xavierholt/binaryninja-api | f52f7535c245f33d3c9f569b4a13abc05cf50998 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# Copyright (c) 2015-2020 Vector 35 Inc
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, mo... | 34.573171 | 94 | 0.709347 |
import sys
import os
import binaryninja.log as log
from binaryninja.binaryview import BinaryViewType
import binaryninja.interaction as interaction
from binaryninja.plugin import PluginCommand
from binaryninja import range
def get_bininfo(bv):
if bv is None:
filename = ""
if len(sys.argv) ... | true | true |
f74b9485023e1cf2238de16a01b02978d45009e2 | 1,275 | py | Python | indicators_transformer/EMA_FT.py | vd1371/gram | 065c33c854beea633a833e64a7b80ff727868f2d | [
"Apache-2.0"
] | null | null | null | indicators_transformer/EMA_FT.py | vd1371/gram | 065c33c854beea633a833e64a7b80ff727868f2d | [
"Apache-2.0"
] | 21 | 2020-02-12T07:25:55.000Z | 2020-03-18T21:10:00.000Z | indicators_transformer/EMA_FT.py | vd1371/gram | 065c33c854beea633a833e64a7b80ff727868f2d | [
"Apache-2.0"
] | 1 | 2021-12-04T13:09:46.000Z | 2021-12-04T13:09:46.000Z | # Adding parent directory to the PYTHONPATH
import sys
sys.path.insert(0,'..')
import numpy as np
from utils.GlobalVariables import *
class EMA_FT(object):
# Base class for all of the feature transformers
def __init__(self):
super(EMA_FT, self).__init__()
def transform(self, df, features):
# it construct a set... | 23.611111 | 85 | 0.711373 |
import sys
sys.path.insert(0,'..')
import numpy as np
from utils.GlobalVariables import *
class EMA_FT(object):
def __init__(self):
super(EMA_FT, self).__init__()
def transform(self, df, features):
df['EMA_FT'] = np.zeros(len(df))
df.loc[df[CLOSE] > features, 'EMA_FT'] = LONG
df.loc[df[CLOS... | true | true |
f74b94969e0495f80d10cfcaaa06199c3ccc54cf | 416 | py | Python | vscode-client/syntaxes/build_syntax.py | chrisjsewell/rst-language-server | 56580d878bdaf5e07bc1d189c4472723cbaac782 | [
"MIT"
] | 15 | 2020-03-04T21:28:39.000Z | 2021-11-25T11:11:08.000Z | vscode-client/syntaxes/build_syntax.py | chrisjsewell/rst-language-server | 56580d878bdaf5e07bc1d189c4472723cbaac782 | [
"MIT"
] | 7 | 2020-03-04T16:20:12.000Z | 2022-02-27T00:40:13.000Z | vscode-client/syntaxes/build_syntax.py | chrisjsewell/rst-language-server | 56580d878bdaf5e07bc1d189c4472723cbaac782 | [
"MIT"
] | 1 | 2020-05-24T19:21:07.000Z | 2020-05-24T19:21:07.000Z | #!/usr/bin/env python
import os
import plistlib
import yaml
if __name__ == "__main__":
in_path = os.path.join(
os.path.dirname(__file__), "restructuredtext.tmLanguage.yaml"
)
out_path = os.path.join(os.path.dirname(__file__), "restructuredtext.tmLanguage")
with open(in_path) as fp:
syn... | 26 | 85 | 0.673077 |
import os
import plistlib
import yaml
if __name__ == "__main__":
in_path = os.path.join(
os.path.dirname(__file__), "restructuredtext.tmLanguage.yaml"
)
out_path = os.path.join(os.path.dirname(__file__), "restructuredtext.tmLanguage")
with open(in_path) as fp:
syntax = yaml.safe_load(... | true | true |
f74b949ea03042f6706c8033522d7dd58c6249c1 | 22,285 | py | Python | mac_alias/alias.py | awesome-archive/Alfred3-workflow-recent-documents | c3c5309d872bc5e3da746e756c91e3ba602f9239 | [
"MIT"
] | 5 | 2018-12-22T14:49:13.000Z | 2022-01-13T07:21:46.000Z | mac_alias/alias.py | awesome-archive/Alfred3-workflow-recent-documents | c3c5309d872bc5e3da746e756c91e3ba602f9239 | [
"MIT"
] | null | null | null | mac_alias/alias.py | awesome-archive/Alfred3-workflow-recent-documents | c3c5309d872bc5e3da746e756c91e3ba602f9239 | [
"MIT"
] | 8 | 2018-07-17T03:55:48.000Z | 2021-12-22T06:37:53.000Z | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import division
import struct
import datetime
import io
import re
import os
import os.path
import stat
import sys
if sys.platform == 'darwin':
from . import osx
try:
long
except NameError:
long = int
from .utils import *
... | 36.652961 | 82 | 0.553601 |
from __future__ import unicode_literals
from __future__ import division
import struct
import datetime
import io
import re
import os
import os.path
import stat
import sys
if sys.platform == 'darwin':
from . import osx
try:
long
except NameError:
long = int
from .utils import *
ALIAS_KIND_FILE = 0
A... | true | true |
f74b94fee2175e9d9d3ba4e1389ccf57a4718e89 | 3,094 | py | Python | zhihu_user_info_spider/zhihu_user_info_spider/threadpool/ThreadPool.py | Yourrrrlove/spider_collection | 3b9f3cc8badc01e3f3e3035c14139d4d5fd1382f | [
"MIT"
] | 178 | 2021-10-29T18:42:04.000Z | 2022-03-30T16:44:37.000Z | zhihu_user_info_spider/zhihu_user_info_spider/threadpool/ThreadPool.py | xzmdc/spider_collection | af2d622a9cf9d859ef6f2a48afea346110995be6 | [
"MIT"
] | 20 | 2021-11-09T15:25:55.000Z | 2022-03-25T05:23:39.000Z | zhihu_user_info_spider/zhihu_user_info_spider/threadpool/ThreadPool.py | xzmdc/spider_collection | af2d622a9cf9d859ef6f2a48afea346110995be6 | [
"MIT"
] | 40 | 2021-11-02T01:30:01.000Z | 2022-03-19T12:15:24.000Z | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import queue
import threading
import contextlib
import time
import traceback
StopEvent = object()
class ThreadPool(object):
def __init__(self, max_num):
self.q = queue.Queue() # 存放任务的队列
self.max_num = max_num # 最大线程并发数
self.terminal = Fals... | 29.466667 | 97 | 0.559147 |
import queue
import threading
import contextlib
import time
import traceback
StopEvent = object()
class ThreadPool(object):
def __init__(self, max_num):
self.q = queue.Queue()
self.max_num = max_num
self.terminal = False
self.generate_list = []
self.free_list ... | true | true |
f74b9550a716d96101bb258c258c4c5f2a786002 | 40,423 | py | Python | sympy/utilities/autowrap.py | tachycline/sympy | abf6fec12012852c7e6fae38461da9723cadc8b9 | [
"BSD-3-Clause"
] | null | null | null | sympy/utilities/autowrap.py | tachycline/sympy | abf6fec12012852c7e6fae38461da9723cadc8b9 | [
"BSD-3-Clause"
] | null | null | null | sympy/utilities/autowrap.py | tachycline/sympy | abf6fec12012852c7e6fae38461da9723cadc8b9 | [
"BSD-3-Clause"
] | null | null | null | """Module for compiling codegen output, and wrap the binary for use in
python.
.. note:: To use the autowrap module it must first be imported
>>> from sympy.utilities.autowrap import autowrap
This module provides a common interface for different external backends, such
as f2py, fwrap, Cython, SWIG(?) etc. (Curren... | 36.748182 | 115 | 0.602899 |
from __future__ import print_function, division
import sys
import os
import shutil
import tempfile
from subprocess import STDOUT, CalledProcessError, check_output
from string import Template
from warnings import warn
from sympy.core.cache import cacheit
from sympy.core.compatibility import range, iterable
from sympy... | true | true |
f74b95b8da975e5589d8c375108eebd91ab2bef7 | 2,232 | py | Python | src/dcgan_utils.py | shahviraj/pgdgan | 97fb63547144f02d76ef0c384b9e2fbbb90c9d50 | [
"MIT"
] | 6 | 2019-02-21T07:44:20.000Z | 2021-08-30T05:22:10.000Z | src/dcgan_utils.py | peterjung73/pgdgan | dd5f64260e2959228cb16b463820a80ce62cd20c | [
"MIT"
] | 2 | 2020-06-20T09:08:20.000Z | 2020-06-20T09:10:42.000Z | src/dcgan_utils.py | shahviraj/pgdgan | 97fb63547144f02d76ef0c384b9e2fbbb90c9d50 | [
"MIT"
] | 6 | 2018-03-15T21:41:39.000Z | 2021-04-22T09:04:32.000Z | # Files of this project is modified versions of 'https://github.com/AshishBora/csgm', which
#comes with the MIT licence: https://github.com/AshishBora/csgm/blob/master/LICENSE
"""Utils for the DCGAN model
File based on : https://github.com/carpedm20/DCGAN-tensorflow/blob/master/utils.py
It comes with the following lic... | 31.43662 | 102 | 0.683244 |
from __future__ import division
import math
import json
import random
import pprint
import scipy.misc
import numpy as np
from time import gmtime, strftime
pp = pprint.PrettyPrinter()
get_stddev = lambda x, k_h, k_w: 1/math.sqrt(k_w*k_h*x.get_shape()[-1])
def get_image(image_path, image_size, is_crop=True, resiz... | true | true |
f74b963936bb5ec44b7f0d5042717eddbf16f55f | 5,199 | py | Python | dataset/cifar10.py | LYHTHU/MixMatch-pytorch | a738cc95aae88f76761aeeb405201bc7ae200e7d | [
"MIT"
] | 4 | 2020-02-16T10:02:01.000Z | 2022-02-13T18:14:36.000Z | dataset/cifar10.py | LYHTHU/MixMatch-pytorch | a738cc95aae88f76761aeeb405201bc7ae200e7d | [
"MIT"
] | null | null | null | dataset/cifar10.py | LYHTHU/MixMatch-pytorch | a738cc95aae88f76761aeeb405201bc7ae200e7d | [
"MIT"
] | null | null | null | import numpy as np
from PIL import Image
import torchvision
import torch
class TransformTwice:
def __init__(self, transform):
self.transform = transform
def __call__(self, inp):
out1 = self.transform(inp)
out2 = self.transform(inp)
return out1, out2
def get_cifar10(root, n_la... | 32.698113 | 130 | 0.640123 | import numpy as np
from PIL import Image
import torchvision
import torch
class TransformTwice:
def __init__(self, transform):
self.transform = transform
def __call__(self, inp):
out1 = self.transform(inp)
out2 = self.transform(inp)
return out1, out2
def get_cifar10(root, n_la... | true | true |
f74b964225387f7ccfcc4fbfec38ac9c3981dba0 | 3,233 | py | Python | tabacchi/config.py | sisco70/tabacchi | ff0d4a2b2b3a6bd0920d2635e9c0eb1484bbf4be | [
"Apache-2.0"
] | null | null | null | tabacchi/config.py | sisco70/tabacchi | ff0d4a2b2b3a6bd0920d2635e9c0eb1484bbf4be | [
"Apache-2.0"
] | null | null | null | tabacchi/config.py | sisco70/tabacchi | ff0d4a2b2b3a6bd0920d2635e9c0eb1484bbf4be | [
"Apache-2.0"
] | null | null | null | #
# Copyright (C) Francesco Guarnieri 2020 <francesco@guarnie.net>
#
# import os
from pathlib import Path
import configparser
from importlib import metadata
import logging
import logging.config
import logging.handlers
from appdirs import AppDirs
# Estraggo il percorso principale da __file__ e deduco il nome del packa... | 26.941667 | 85 | 0.73523 |
from pathlib import Path
import configparser
from importlib import metadata
import logging
import logging.config
import logging.handlers
from appdirs import AppDirs
BASE_PATH = Path(__file__).resolve().parent
PACKAGE_NAME = BASE_PATH.name
dirs = AppDirs(appname=PACKAGE_NAME)
RESOURCE_PATH = BASE_PATH / 'reso... | true | true |
f74b96797d3060069a0d9bbc54f8a537132dbd42 | 8,867 | py | Python | src/transformKinesis.py | onishtar/amazon-serverless-datalake-workshop | 2fe83c408a8f2e316fdea72b30ddc826f129a88d | [
"MIT-0"
] | 166 | 2018-11-24T21:40:12.000Z | 2022-03-17T23:50:55.000Z | src/transformKinesis.py | onishtar/amazon-serverless-datalake-workshop | 2fe83c408a8f2e316fdea72b30ddc826f129a88d | [
"MIT-0"
] | 3 | 2019-11-01T23:27:44.000Z | 2022-01-26T22:47:49.000Z | src/transformKinesis.py | onishtar/amazon-serverless-datalake-workshop | 2fe83c408a8f2e316fdea72b30ddc826f129a88d | [
"MIT-0"
] | 88 | 2018-11-19T01:59:57.000Z | 2022-01-29T16:11:23.000Z | """
For processing data sent to Firehose by Cloudwatch Logs subscription filters.
Cloudwatch Logs sends to Firehose records that look like this:
{
"messageType": "DATA_MESSAGE",
"owner": "123456789012",
"logGroup": "log_group_name",
"logStream": "log_stream_name",
"subscriptionFilters": [
"subscription_... | 38.552174 | 138 | 0.659862 |
import base64
import json
import gzip
import StringIO
import boto3
def transformLogEvent(log_event):
return log_event['message'] + '\n'
def processRecords(records):
for r in records:
data = base64.b64decode(r['data'])
striodata = StringIO.StringIO(data)
with gzip.GzipFile(fileobj=st... | true | true |
f74b9844575e29c73e234c5170608ceb96832573 | 1,473 | py | Python | chapter4/defined_cross.py | lvwuyunlifan/Tensorflow_to_learn_DL | c534f36b580990342219b300c418ae13c070b9a5 | [
"MIT"
] | null | null | null | chapter4/defined_cross.py | lvwuyunlifan/Tensorflow_to_learn_DL | c534f36b580990342219b300c418ae13c070b9a5 | [
"MIT"
] | null | null | null | chapter4/defined_cross.py | lvwuyunlifan/Tensorflow_to_learn_DL | c534f36b580990342219b300c418ae13c070b9a5 | [
"MIT"
] | null | null | null | #--*--coding: utf-8 --*--
import tensorflow as tf
from numpy.random import RandomState
bacth_size = 8
# 两个输入节点
x = tf.placeholder(tf.float32, shape=[None, 2], name='x-input')
# 回归问题一般只有一个输出节点
y_ = tf.placeholder(tf.float32, shape=[None, 1], name='y-output')
# 定义了一个单层的神经网络前向传播的过程, 这里就是简单的加权和
w1 = tf.Variable(tf.ran... | 27.277778 | 85 | 0.678208 |
import tensorflow as tf
from numpy.random import RandomState
bacth_size = 8
x = tf.placeholder(tf.float32, shape=[None, 2], name='x-input')
y_ = tf.placeholder(tf.float32, shape=[None, 1], name='y-output')
w1 = tf.Variable(tf.random_normal([2, 1], stddev=1, seed=1))
y = tf.matmul(x, w1)
loss_more = 10
loss_l... | true | true |
f74b98f600bcccc76c62e741256d47929439a5e6 | 39,004 | py | Python | python/google/appengine/ext/mapreduce/model.py | Khan/frankenserver | 08ea9863019eecdbc9e861b4d3ba0baec755f424 | [
"Apache-2.0"
] | 26 | 2015-01-20T08:02:38.000Z | 2020-06-10T04:57:41.000Z | python/google/appengine/ext/mapreduce/model.py | Khan/frankenserver | 08ea9863019eecdbc9e861b4d3ba0baec755f424 | [
"Apache-2.0"
] | 4 | 2016-02-28T05:53:54.000Z | 2017-01-03T07:39:50.000Z | python/google/appengine/ext/mapreduce/model.py | Khan/frankenserver | 08ea9863019eecdbc9e861b4d3ba0baec755f424 | [
"Apache-2.0"
] | 13 | 2016-02-28T00:14:23.000Z | 2021-05-03T15:47:36.000Z | #!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 30.980143 | 80 | 0.685494 |
__all__ = ["MapreduceState",
"MapperSpec",
"MapreduceControl",
"MapreduceSpec",
"ShardState",
"CountersMap",
"TransientShardState",
"QuerySpec",
"HugeTask"]
import cgi
import datetime
import ur... | true | true |
f74b990ac8710d382b661f071c3ab13e08fc970c | 270 | py | Python | Task/Largest-int-from-concatenated-ints/Python/largest-int-from-concatenated-ints-4.py | mullikine/RosettaCodeData | 4f0027c6ce83daa36118ee8b67915a13cd23ab67 | [
"Info-ZIP"
] | 5 | 2021-01-29T20:08:05.000Z | 2022-03-22T06:16:05.000Z | Task/Largest-int-from-concatenated-ints/Python/largest-int-from-concatenated-ints-4.py | seanwallawalla-forks/RosettaCodeData | 9ad63ea473a958506c041077f1d810c0c7c8c18d | [
"Info-ZIP"
] | null | null | null | Task/Largest-int-from-concatenated-ints/Python/largest-int-from-concatenated-ints-4.py | seanwallawalla-forks/RosettaCodeData | 9ad63ea473a958506c041077f1d810c0c7c8c18d | [
"Info-ZIP"
] | 1 | 2018-11-09T22:08:40.000Z | 2018-11-09T22:08:40.000Z | from itertools import permutations
def maxnum(x):
return max(int(''.join(n) for n in permutations(str(i) for i in x)))
for numbers in [(1, 34, 3, 98, 9, 76, 45, 4), (54, 546, 548, 60)]:
print('Numbers: %r\n Largest integer: %15s' % (numbers, maxnum(numbers)))
| 38.571429 | 78 | 0.637037 | from itertools import permutations
def maxnum(x):
return max(int(''.join(n) for n in permutations(str(i) for i in x)))
for numbers in [(1, 34, 3, 98, 9, 76, 45, 4), (54, 546, 548, 60)]:
print('Numbers: %r\n Largest integer: %15s' % (numbers, maxnum(numbers)))
| true | true |
f74b9951e59497a2bb4ccd057e9f94d3f5fd5663 | 3,549 | py | Python | web/web/settings.py | din-ge/dinge | 15a15a11234a865ec277cd04ddbd456ec82a4fba | [
"MIT"
] | null | null | null | web/web/settings.py | din-ge/dinge | 15a15a11234a865ec277cd04ddbd456ec82a4fba | [
"MIT"
] | null | null | null | web/web/settings.py | din-ge/dinge | 15a15a11234a865ec277cd04ddbd456ec82a4fba | [
"MIT"
] | null | null | null | """
Django settings for web project.
Generated by 'django-admin startproject' using Django 4.0.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""
import os
from pat... | 25.905109 | 91 | 0.685827 |
import os
from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = 'django-insecure-nl%lza$5$b8z2^*9%+f)d=kaq=#6nhiuh!1%=!_#r8dn_h%qd7'
DEBUG = True
ALLOWED_HOSTS = ['localhost','127.0.0.1', 'din.ge','www.din.ge', ]
# Application definition
INSTALLED_APPS = [
'django.co... | true | true |
f74b9aad0cb5e5f9ba862f55714a56c3e4ae5767 | 1,345 | py | Python | tests/test_bzr_helper.py | rkoval/SublimeDiffView | 57744b5626851085f49511c225b87c9465c0e7ad | [
"MIT"
] | 23 | 2015-12-14T12:10:49.000Z | 2020-11-28T10:26:52.000Z | tests/test_bzr_helper.py | rkoval/SublimeDiffView | 57744b5626851085f49511c225b87c9465c0e7ad | [
"MIT"
] | 59 | 2015-12-14T08:58:21.000Z | 2021-04-09T11:46:00.000Z | tests/test_bzr_helper.py | rkoval/SublimeDiffView | 57744b5626851085f49511c225b87c9465c0e7ad | [
"MIT"
] | 7 | 2016-01-09T11:47:07.000Z | 2020-03-16T15:11:32.000Z | import sys
import subprocess
from unittest import TestCase
from unittest.mock import patch
diffview = sys.modules["DiffView"]
BzrHelper = diffview.util.vcs.BzrHelper
class test_BzrHelper(TestCase):
def setUp(self):
self.dummy_process = DummyProcess()
def test_init(self):
bzr_helper = BzrHel... | 29.23913 | 75 | 0.637918 | import sys
import subprocess
from unittest import TestCase
from unittest.mock import patch
diffview = sys.modules["DiffView"]
BzrHelper = diffview.util.vcs.BzrHelper
class test_BzrHelper(TestCase):
def setUp(self):
self.dummy_process = DummyProcess()
def test_init(self):
bzr_helper = BzrHel... | true | true |
f74b9acce4849b4adffa0d80154ecef104e4092c | 3,089 | py | Python | tools/set_active_docs.py | CAM-Gerlach/praw | 04600016c886d65206e298d6b503984ed13705e5 | [
"BSD-2-Clause"
] | 1 | 2021-11-30T21:18:52.000Z | 2021-11-30T21:18:52.000Z | tools/set_active_docs.py | CAM-Gerlach/praw | 04600016c886d65206e298d6b503984ed13705e5 | [
"BSD-2-Clause"
] | 2 | 2020-09-15T12:57:44.000Z | 2022-02-10T00:01:27.000Z | tools/set_active_docs.py | CAM-Gerlach/praw | 04600016c886d65206e298d6b503984ed13705e5 | [
"BSD-2-Clause"
] | null | null | null | #!/usr/bin/env python3
import os
import re
import sys
import time
import packaging.version
import requests
PROJECT = "praw"
HEADERS = {"Authorization": f"token {os.environ.get('READTHEDOCS_TOKEN')}"}
def fetch_versions():
response = requests.get(
f"https://readthedocs.org/api/v3/projects/{PROJECT}/versi... | 32.515789 | 90 | 0.596309 |
import os
import re
import sys
import time
import packaging.version
import requests
PROJECT = "praw"
HEADERS = {"Authorization": f"token {os.environ.get('READTHEDOCS_TOKEN')}"}
def fetch_versions():
response = requests.get(
f"https://readthedocs.org/api/v3/projects/{PROJECT}/versions?active=true",
... | true | true |
f74b9addcce56532c673c476eb60649436086af8 | 123,936 | py | Python | tools/shared.py | shravanrn/emscripten_lp64 | 6df2bceb037107bf521305ac18264955ceb2685e | [
"MIT"
] | null | null | null | tools/shared.py | shravanrn/emscripten_lp64 | 6df2bceb037107bf521305ac18264955ceb2685e | [
"MIT"
] | null | null | null | tools/shared.py | shravanrn/emscripten_lp64 | 6df2bceb037107bf521305ac18264955ceb2685e | [
"MIT"
] | null | null | null | # Copyright 2011 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
from __future__ import print_function
from distutils.spawn import fi... | 40.018082 | 393 | 0.673937 |
from __future__ import print_function
from distutils.spawn import find_executable
from subprocess import PIPE, STDOUT
import atexit
import base64
import json
import logging
import math
import multiprocessing
import os
import re
import shlex
import shutil
import subprocess
import sys
import tempfile
from .toolcha... | true | true |
f74b9b25c8dd21a207137b8e84070656d555098a | 5,996 | py | Python | idaes/core/base/phases.py | OOAmusat/idaes-pse | ae7d3bb8e372bc32822dcdcb75e9fd96b78da539 | [
"RSA-MD"
] | null | null | null | idaes/core/base/phases.py | OOAmusat/idaes-pse | ae7d3bb8e372bc32822dcdcb75e9fd96b78da539 | [
"RSA-MD"
] | null | null | null | idaes/core/base/phases.py | OOAmusat/idaes-pse | ae7d3bb8e372bc32822dcdcb75e9fd96b78da539 | [
"RSA-MD"
] | 1 | 2022-03-17T11:08:43.000Z | 2022-03-17T11:08:43.000Z | #################################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energy Systems (IDAES), and is copyright (c) 2018-2021
# by the softwar... | 30.748718 | 86 | 0.643429 | true | true | |
f74b9b4c6bdc4a44c69840fd6a9974e75d8f6f08 | 1,010 | py | Python | catalog/bindings/gmd/abstract_curve_segment.py | NIVANorge/s-enda-playground | 56ae0a8978f0ba8a5546330786c882c31e17757a | [
"Apache-2.0"
] | null | null | null | catalog/bindings/gmd/abstract_curve_segment.py | NIVANorge/s-enda-playground | 56ae0a8978f0ba8a5546330786c882c31e17757a | [
"Apache-2.0"
] | null | null | null | catalog/bindings/gmd/abstract_curve_segment.py | NIVANorge/s-enda-playground | 56ae0a8978f0ba8a5546330786c882c31e17757a | [
"Apache-2.0"
] | null | null | null | from dataclasses import dataclass
from bindings.gmd.abstract_curve_segment_type import AbstractCurveSegmentType
__NAMESPACE__ = "http://www.opengis.net/gml"
@dataclass
class AbstractCurveSegment(AbstractCurveSegmentType):
"""A curve segment defines a homogeneous segment of a curve.
The attributes numDerivat... | 40.4 | 77 | 0.783168 | from dataclasses import dataclass
from bindings.gmd.abstract_curve_segment_type import AbstractCurveSegmentType
__NAMESPACE__ = "http://www.opengis.net/gml"
@dataclass
class AbstractCurveSegment(AbstractCurveSegmentType):
class Meta:
namespace = "http://www.opengis.net/gml"
| true | true |
f74b9b5eec747e14b16337f47d546aa1bb7b4a5f | 3,100 | py | Python | tests/contracts/KT1E7xh6tvnVMWx7QCZnuWXwcpCJ9UmMWcyK/test_micheline_coding_KT1E7x.py | juztin/pytezos-1 | 7e608ff599d934bdcf129e47db43dbdb8fef9027 | [
"MIT"
] | 1 | 2021-05-20T16:52:08.000Z | 2021-05-20T16:52:08.000Z | tests/contracts/KT1E7xh6tvnVMWx7QCZnuWXwcpCJ9UmMWcyK/test_micheline_coding_KT1E7x.py | juztin/pytezos-1 | 7e608ff599d934bdcf129e47db43dbdb8fef9027 | [
"MIT"
] | 1 | 2020-12-30T16:44:56.000Z | 2020-12-30T16:44:56.000Z | tests/contracts/KT1E7xh6tvnVMWx7QCZnuWXwcpCJ9UmMWcyK/test_micheline_coding_KT1E7x.py | juztin/pytezos-1 | 7e608ff599d934bdcf129e47db43dbdb8fef9027 | [
"MIT"
] | 1 | 2022-03-20T19:01:00.000Z | 2022-03-20T19:01:00.000Z | from unittest import TestCase
from tests import get_data
from pytezos.michelson.converter import build_schema, decode_micheline, encode_micheline
class MichelineCodingTestKT1E7x(TestCase):
@classmethod
def setUpClass(cls):
cls.maxDiff = None
cls.code = get_data(
path='contrac... | 46.268657 | 88 | 0.714839 | from unittest import TestCase
from tests import get_data
from pytezos.michelson.converter import build_schema, decode_micheline, encode_micheline
class MichelineCodingTestKT1E7x(TestCase):
@classmethod
def setUpClass(cls):
cls.maxDiff = None
cls.code = get_data(
path='contrac... | true | true |
f74b9ba2e9f643f1c1099bf73b23de4df3fc271a | 2,346 | py | Python | quickvision/datasets/classification.py | ramaneswaran/quickvision | ff494ea9c6ae09c129603b35236f314b25d56d27 | [
"Apache-2.0"
] | 47 | 2020-11-15T03:36:48.000Z | 2021-04-08T05:28:02.000Z | quickvision/datasets/classification.py | ramaneswaran/quickvision | ff494ea9c6ae09c129603b35236f314b25d56d27 | [
"Apache-2.0"
] | 78 | 2020-11-14T17:55:28.000Z | 2021-04-06T08:55:24.000Z | quickvision/datasets/classification.py | ramaneswaran/quickvision | ff494ea9c6ae09c129603b35236f314b25d56d27 | [
"Apache-2.0"
] | 15 | 2020-11-14T18:01:04.000Z | 2021-02-16T14:50:12.000Z | # Add code for Mapping using dataframe containaing id and target.
# Port from pytorch_cnn_trainer
# https://github.com/oke-aditya/pytorch_cnn_trainer
import torchvision
from torchvision import datasets
from torch.utils.data import Dataset
import os
import torch
from PIL import Image
__all__ = ["create_folder_dataset"... | 32.583333 | 102 | 0.696505 |
import torchvision
from torchvision import datasets
from torch.utils.data import Dataset
import os
import torch
from PIL import Image
__all__ = ["create_folder_dataset", "CSVSingleLabelDataset"]
def create_folder_dataset(root_dir, transforms, split: float = 0.8, **kwargs):
complete_dataset = datasets.ImageFo... | true | true |
f74b9c09f92d710ef184d51861c2f1aed7400e5a | 2,047 | py | Python | wb/main/pipeline_creators/local_profiling_pipeline_creator.py | apaniukov/workbench | 2f2653ecfd0143d2d53e33ad84379f13443fdfaa | [
"Apache-2.0"
] | 23 | 2022-03-17T12:24:09.000Z | 2022-03-31T09:13:30.000Z | wb/main/pipeline_creators/local_profiling_pipeline_creator.py | apaniukov/workbench | 2f2653ecfd0143d2d53e33ad84379f13443fdfaa | [
"Apache-2.0"
] | 18 | 2022-03-21T08:17:44.000Z | 2022-03-30T12:42:30.000Z | wb/main/pipeline_creators/local_profiling_pipeline_creator.py | apaniukov/workbench | 2f2653ecfd0143d2d53e33ad84379f13443fdfaa | [
"Apache-2.0"
] | 16 | 2022-03-17T12:24:14.000Z | 2022-03-31T12:15:12.000Z | """
OpenVINO DL Workbench
Class for creating ORM local profiling pipeline model and dependent models
Copyright (c) 2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
... | 47.604651 | 112 | 0.762091 |
from sqlalchemy.orm import Session
from wb.main.enumerates import PipelineTypeEnum, PipelineStageEnum
from wb.main.models import CreateProfilingScriptsJobModel, PipelineModel, ProfilingJobModel
from wb.main.pipeline_creators.profiling_pipeline_creator import ProfilingPipelineCreator
class LocalProfilingPipelineCrea... | true | true |
f74b9cc126b9390926d4e3cf653f6d81f33e70d6 | 768 | py | Python | the_project/urls.py | TomasTomecek/django-container | 4d07eb976a113dfd6e89865e490b4fd80310a2ec | [
"MIT"
] | null | null | null | the_project/urls.py | TomasTomecek/django-container | 4d07eb976a113dfd6e89865e490b4fd80310a2ec | [
"MIT"
] | null | null | null | the_project/urls.py | TomasTomecek/django-container | 4d07eb976a113dfd6e89865e490b4fd80310a2ec | [
"MIT"
] | null | null | null | """the_project URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... | 34.909091 | 79 | 0.705729 | from django.conf.urls import url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
]
| true | true |
f74b9d0b36e9e33eebe1b00cec1833eef505df9b | 12,999 | py | Python | site-packages/cinderclient/tests/unit/test_http.py | hariza17/freezer_libraries | e0bd890eba5e7438976fb3b4d66c41c128bab790 | [
"PSF-2.0"
] | null | null | null | site-packages/cinderclient/tests/unit/test_http.py | hariza17/freezer_libraries | e0bd890eba5e7438976fb3b4d66c41c128bab790 | [
"PSF-2.0"
] | 1 | 2018-09-10T23:44:02.000Z | 2018-09-12T16:28:07.000Z | site-packages/cinderclient/tests/unit/test_http.py | hariza17/freezer_libraries | e0bd890eba5e7438976fb3b4d66c41c128bab790 | [
"PSF-2.0"
] | 2 | 2018-09-07T23:17:23.000Z | 2019-01-11T16:10:08.000Z | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | 33.245524 | 79 | 0.582352 |
import json
import mock
import requests
import uuid
from cinderclient import client
from cinderclient import exceptions
from cinderclient.tests.unit import utils
fake_response = utils.TestResponse({
"status_code": 200,
"text": '{"hi": "there"}',
})
mock_request = mock.Mock(return_value=(fake_res... | true | true |
f74b9d2fb964324ada35ab18fd3e8fd7b6e30c7c | 165 | py | Python | echobot/urls.py | konata39/line_app | 621ba979541711febd9c3d2e7435ae48524c12e5 | [
"MIT"
] | null | null | null | echobot/urls.py | konata39/line_app | 621ba979541711febd9c3d2e7435ae48524c12e5 | [
"MIT"
] | null | null | null | echobot/urls.py | konata39/line_app | 621ba979541711febd9c3d2e7435ae48524c12e5 | [
"MIT"
] | null | null | null | from django.conf.urls import url
from . import views
urlpatterns = [
url('^callback/', views.callback),
url('^direct_callback/', views.direct_callback),
]
| 18.333333 | 52 | 0.69697 | from django.conf.urls import url
from . import views
urlpatterns = [
url('^callback/', views.callback),
url('^direct_callback/', views.direct_callback),
]
| true | true |
f74b9e72e6a6befd039f014158bc7af7a8feef12 | 1,550 | py | Python | webots_ros2_core/setup.py | zegangYang/webots_ros2 | c1b3a055f9b3d931066083e561c3dbee5b386c3a | [
"Apache-2.0"
] | null | null | null | webots_ros2_core/setup.py | zegangYang/webots_ros2 | c1b3a055f9b3d931066083e561c3dbee5b386c3a | [
"Apache-2.0"
] | null | null | null | webots_ros2_core/setup.py | zegangYang/webots_ros2 | c1b3a055f9b3d931066083e561c3dbee5b386c3a | [
"Apache-2.0"
] | null | null | null | """webots_ros2 package setup file."""
from setuptools import setup
package_name = 'webots_ros2_core'
data_files = []
data_files.append(('share/ament_index/resource_index/packages', ['resource/' + package_name]))
data_files.append(('share/' + package_name, ['package.xml']))
data_files.append(('share/' + package_name +... | 36.904762 | 105 | 0.68129 |
from setuptools import setup
package_name = 'webots_ros2_core'
data_files = []
data_files.append(('share/ament_index/resource_index/packages', ['resource/' + package_name]))
data_files.append(('share/' + package_name, ['package.xml']))
data_files.append(('share/' + package_name + '/launch', ['launch/robot_launch.py']... | true | true |
f74b9ef74ba97c485bcc4671087b4d4cabf82150 | 2,481 | py | Python | data/p4VQE/R4/benchmark/startQiskit92.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | data/p4VQE/R4/benchmark/startQiskit92.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | data/p4VQE/R4/benchmark/startQiskit92.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | # qubit number=3
# total number=11
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.566667 | 118 | 0.635631 |
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 |
f74b9f2c87c5f28efe847222aaacfb121a6966e1 | 3,089 | py | Python | hr_doc_expire/hooks.py | ronozoro/hr_doc_expire | 1c481565180249cf883ac49997c07123d21c0c49 | [
"MIT"
] | null | null | null | hr_doc_expire/hooks.py | ronozoro/hr_doc_expire | 1c481565180249cf883ac49997c07123d21c0c49 | [
"MIT"
] | null | null | null | hr_doc_expire/hooks.py | ronozoro/hr_doc_expire | 1c481565180249cf883ac49997c07123d21c0c49 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from . import __version__ as app_version
app_name = "hr_doc_expire"
app_title = "Employee Document Expire"
app_publisher = "Mostafa Mohamed"
app_description = "Manage employee documents within the company"
app_icon = "fa fa-book"
app_color = "grey"
app_em... | 26.401709 | 81 | 0.695371 |
from __future__ import unicode_literals
from . import __version__ as app_version
app_name = "hr_doc_expire"
app_title = "Employee Document Expire"
app_publisher = "Mostafa Mohamed"
app_description = "Manage employee documents within the company"
app_icon = "fa fa-book"
app_color = "grey"
app_email = "m.dev.odoo@gmail... | true | true |
f74ba174d7a445712a75ce74fcbf0c8c6865e15f | 342 | py | Python | api/router.py | JuanDM93/plerk-django-transactions | 1e42ac26cc9b03669ebed58015121b5bb683c280 | [
"MIT"
] | null | null | null | api/router.py | JuanDM93/plerk-django-transactions | 1e42ac26cc9b03669ebed58015121b5bb683c280 | [
"MIT"
] | null | null | null | api/router.py | JuanDM93/plerk-django-transactions | 1e42ac26cc9b03669ebed58015121b5bb683c280 | [
"MIT"
] | null | null | null | from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns
from .views import SummaryView, CompanyView
urlpatterns = [
path('summary/', SummaryView.as_view(), name='summary'),
path('companies/<int:pk>/', CompanyView.as_view(), name='companies'),
]
urlpatterns = format_suffix_... | 26.307692 | 73 | 0.766082 | from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns
from .views import SummaryView, CompanyView
urlpatterns = [
path('summary/', SummaryView.as_view(), name='summary'),
path('companies/<int:pk>/', CompanyView.as_view(), name='companies'),
]
urlpatterns = format_suffix_... | true | true |
f74ba17a204c79db66f94d065faba36b942caba9 | 1,649 | py | Python | custom_components/twcmanager/config_flow.py | jherby2k/twcmanager_ha | 017bc6047b7c2783254e7b2cd2d2f8f6b7d1a29f | [
"Apache-2.0"
] | null | null | null | custom_components/twcmanager/config_flow.py | jherby2k/twcmanager_ha | 017bc6047b7c2783254e7b2cd2d2f8f6b7d1a29f | [
"Apache-2.0"
] | 1 | 2021-10-16T16:24:14.000Z | 2021-10-16T17:40:58.000Z | custom_components/twcmanager/config_flow.py | jherby2k/twcmanager_ha | 017bc6047b7c2783254e7b2cd2d2f8f6b7d1a29f | [
"Apache-2.0"
] | null | null | null | """Config flow for TWCManager integration."""
from __future__ import annotations
import logging
from typing import Any
from aiohttp import ClientConnectorError
from twcmanager_client.client import TWCManagerClient
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.data_entry_flow im... | 28.929825 | 85 | 0.667677 | from __future__ import annotations
import logging
from typing import Any
from aiohttp import ClientConnectorError
from twcmanager_client.client import TWCManagerClient
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.data_entry_flow import FlowResult
from .const import DOMAIN
_L... | true | true |
f74ba190368bbe34b097108b2565fb0935464a41 | 1,047 | py | Python | pyinstaller/hook-googleapiclient.model.py | jorisfa/gcpdiag | eaa77fdab1314efb46041e116643576ae2666748 | [
"Apache-2.0"
] | 63 | 2021-09-28T16:29:19.000Z | 2022-03-30T02:01:15.000Z | pyinstaller/hook-googleapiclient.model.py | jorisfa/gcpdiag | eaa77fdab1314efb46041e116643576ae2666748 | [
"Apache-2.0"
] | 10 | 2021-10-06T11:59:44.000Z | 2022-03-24T16:41:38.000Z | pyinstaller/hook-googleapiclient.model.py | jorisfa/gcpdiag | eaa77fdab1314efb46041e116643576ae2666748 | [
"Apache-2.0"
] | 20 | 2021-09-28T18:38:29.000Z | 2022-03-24T10:19:56.000Z | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 43.625 | 74 | 0.758357 |
from PyInstaller.utils.hooks import collect_data_files, copy_metadata
datas = copy_metadata('google_api_python_client')
datas += collect_data_files('googleapiclient.discovery',
excludes=['*.txt', '**/__pycache__'])
| true | true |
f74ba281265cd54446c182571020a460b6715ad2 | 1,377 | py | Python | utils.py | bakwadunka/dunka3 | 265ec0964087bac524da9a3f3b07bc483a466c63 | [
"CC-BY-4.0"
] | 30 | 2020-04-30T15:17:31.000Z | 2022-03-31T08:47:13.000Z | utils.py | bakwadunka/dunka3 | 265ec0964087bac524da9a3f3b07bc483a466c63 | [
"CC-BY-4.0"
] | null | null | null | utils.py | bakwadunka/dunka3 | 265ec0964087bac524da9a3f3b07bc483a466c63 | [
"CC-BY-4.0"
] | 5 | 2020-06-05T21:15:42.000Z | 2022-03-31T08:47:19.000Z | import os
import pickle
import torch
import numpy as np
def save(toBeSaved, filename, mode='wb'):
dirname = os.path.dirname(filename)
if not os.path.exists(dirname):
os.makedirs(dirname)
file = open(filename, mode)
pickle.dump(toBeSaved, file)
file.close()
def load(filename, mode='rb'):
... | 26.480769 | 87 | 0.667393 | import os
import pickle
import torch
import numpy as np
def save(toBeSaved, filename, mode='wb'):
dirname = os.path.dirname(filename)
if not os.path.exists(dirname):
os.makedirs(dirname)
file = open(filename, mode)
pickle.dump(toBeSaved, file)
file.close()
def load(filename, mode='rb'):
... | true | true |
f74ba3baa400ff0da3c059ec80bcb82fcbfadf83 | 899 | py | Python | reflex-algos/components/Python/string-sink/string_sink.py | mlpiper/mlpiper | 0fd2b6773f970c831038db47bf4920ada21a5f51 | [
"Apache-2.0"
] | 7 | 2019-04-08T02:31:55.000Z | 2021-11-15T14:40:49.000Z | reflex-algos/components/Python/string-sink/string_sink.py | mlpiper/mlpiper | 0fd2b6773f970c831038db47bf4920ada21a5f51 | [
"Apache-2.0"
] | 31 | 2019-02-22T22:23:26.000Z | 2021-08-02T17:17:06.000Z | reflex-algos/components/Python/string-sink/string_sink.py | mlpiper/mlpiper | 0fd2b6773f970c831038db47bf4920ada21a5f51 | [
"Apache-2.0"
] | 8 | 2019-03-15T23:46:08.000Z | 2020-02-06T09:16:02.000Z | from parallelm.components import ConnectableComponent
from parallelm.mlops import mlops
class StringSink(ConnectableComponent):
def __init__(self, engine):
super(self.__class__, self).__init__(engine)
def _materialize(self, parent_data_objs, user_data):
expected_str_value = self._params.get(... | 42.809524 | 100 | 0.68743 | from parallelm.components import ConnectableComponent
from parallelm.mlops import mlops
class StringSink(ConnectableComponent):
def __init__(self, engine):
super(self.__class__, self).__init__(engine)
def _materialize(self, parent_data_objs, user_data):
expected_str_value = self._params.get(... | true | true |
f74ba4b75c7e6156bff108b0b731f34530de9040 | 965 | py | Python | utils.py | lalonderodney/D-Caps | 47050505170472abe1ea36e50903ea06054fcf07 | [
"Apache-2.0"
] | 11 | 2020-01-13T09:08:59.000Z | 2020-06-04T23:06:13.000Z | utils.py | lalonderodney/D-Caps | 47050505170472abe1ea36e50903ea06054fcf07 | [
"Apache-2.0"
] | 7 | 2020-09-25T22:42:37.000Z | 2022-02-09T23:40:33.000Z | utils.py | lalonderodney/D-Caps | 47050505170472abe1ea36e50903ea06054fcf07 | [
"Apache-2.0"
] | 2 | 2020-01-21T07:28:55.000Z | 2020-03-04T11:54:47.000Z | import os
import errno
import tensorflow as tf
from keras import backend as K
def safe_mkdir(dir_to_make: str) -> None:
'''
Attempts to make a directory following the Pythonic EAFP strategy which prevents race conditions.
:param dir_to_make: The directory path to attempt to make.
:return: None
''... | 31.129032 | 101 | 0.663212 | import os
import errno
import tensorflow as tf
from keras import backend as K
def safe_mkdir(dir_to_make: str) -> None:
try:
os.makedirs(dir_to_make)
except OSError as e:
if e.errno != errno.EEXIST:
print('ERROR: Unable to create directory: {}'.format(dir_to_make), e)
r... | true | true |
f74ba600f84b2112b3d8fe4718a5cb4691d55184 | 3,780 | py | Python | test/TestRulesCollection.py | slsh1o/ansible-lint | d835ee16a2ea72e20cb0168769af6797d3bf419a | [
"MIT"
] | 1 | 2020-05-14T20:42:37.000Z | 2020-05-14T20:42:37.000Z | test/TestRulesCollection.py | aakashgandham-nucleussoftware/ansible-lint | 7e653c6469712be948fb45c58f818f47161b2f9d | [
"MIT"
] | null | null | null | test/TestRulesCollection.py | aakashgandham-nucleussoftware/ansible-lint | 7e653c6469712be948fb45c58f818f47161b2f9d | [
"MIT"
] | null | null | null | # Copyright (c) 2013-2014 Will Thames <will@thames.id.au>
#
# 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... | 39.789474 | 86 | 0.763492 |
import collections
import os
import pytest
from ansiblelint import RulesCollection
@pytest.fixture
def test_rules_collection():
return RulesCollection([os.path.abspath('./test/rules')])
@pytest.fixture
def ematchtestfile():
return dict(path='test/ematchtest.yml', type='playbook')
@py... | true | true |
f74ba61d58d595b579032b0ac9cd2a95965f2f2a | 4,090 | py | Python | Lesson_5.py | verafes/python_training | 3cf989e5924d40f78f218de323c07efa85f2edcf | [
"Apache-2.0"
] | null | null | null | Lesson_5.py | verafes/python_training | 3cf989e5924d40f78f218de323c07efa85f2edcf | [
"Apache-2.0"
] | null | null | null | Lesson_5.py | verafes/python_training | 3cf989e5924d40f78f218de323c07efa85f2edcf | [
"Apache-2.0"
] | null | null | null | # Lesson 5. String function and methods
# All string methods returns new values. They do not change the original string.
print("--- Searchig position of a specified symbol")
# index() - Searches the string for a specified value and returns the position of where it was found
s = "programming language"
print(s[1:-1])
#... | 32.460317 | 100 | 0.69022 |
print("--- Searchig position of a specified symbol")
s = "programming language"
print(s[1:-1])
("g")
print(index)
last_index = s.rindex("g")
print(last_index)
print("\n--- Searchig a specified symbol")
i = s.find("P")
print(i)
last_i = s.rfind("a")
print(last_i)
print("\n--- Alphabetic symbol or digit")
s = "... | true | true |
f74ba7b4d3a3b75a573444f558a4d790e954d12d | 726 | py | Python | mmdet/datasets/__init__.py | maktu6/mmdetection | 4a0a42d4ab1f00732997e58da70c8145b9751bb0 | [
"Apache-2.0"
] | null | null | null | mmdet/datasets/__init__.py | maktu6/mmdetection | 4a0a42d4ab1f00732997e58da70c8145b9751bb0 | [
"Apache-2.0"
] | null | null | null | mmdet/datasets/__init__.py | maktu6/mmdetection | 4a0a42d4ab1f00732997e58da70c8145b9751bb0 | [
"Apache-2.0"
] | null | null | null | from .custom import CustomDataset
from .xml_style import XMLDataset
from .coco import CocoDataset
from .voc import VOCDataset
from .loader import GroupSampler, DistributedGroupSampler, build_dataloader
from .utils import to_tensor, random_scale, show_ann, get_dataset
from .concat_dataset import ConcatDataset
from .repe... | 40.333333 | 79 | 0.80303 | from .custom import CustomDataset
from .xml_style import XMLDataset
from .coco import CocoDataset
from .voc import VOCDataset
from .loader import GroupSampler, DistributedGroupSampler, build_dataloader
from .utils import to_tensor, random_scale, show_ann, get_dataset
from .concat_dataset import ConcatDataset
from .repe... | true | true |
f74ba7d33a4bd37467035582718a2ef271581b2b | 4,701 | py | Python | norm_module.py | antofuller/configaformers | 293253cd35d96c8a24c4004ba3d24fc6dc85a260 | [
"Apache-2.0"
] | 51 | 2021-11-03T19:52:07.000Z | 2021-12-14T16:56:30.000Z | norm_module.py | muddyrains/muddy-nets | 293253cd35d96c8a24c4004ba3d24fc6dc85a260 | [
"Apache-2.0"
] | null | null | null | norm_module.py | muddyrains/muddy-nets | 293253cd35d96c8a24c4004ba3d24fc6dc85a260 | [
"Apache-2.0"
] | 2 | 2021-11-04T01:46:26.000Z | 2021-11-06T08:39:35.000Z | import torch
from torch import nn
from utils import set_default
# This module is dedicated to Norm Macdonald
# Implementations from https://github.com/lucidrains/x-transformer
class RMSNorm(nn.Module):
def __init__(self, dim, eps=1e-8):
super().__init__()
self.scale = dim ** -0.5
self.eps... | 35.08209 | 144 | 0.582429 | import torch
from torch import nn
from utils import set_default
class RMSNorm(nn.Module):
def __init__(self, dim, eps=1e-8):
super().__init__()
self.scale = dim ** -0.5
self.eps = eps
self.g = nn.Parameter(torch.ones(dim))
def forward(self, x):
_norm = torch.norm(x,... | true | true |
f74ba8104e41c0a41eb3e26478ad7fc97565cdad | 316 | py | Python | caishen_dashboard/auth/utils.py | Kerem-Sami-Coop/caishen-dashboard-be2 | 686717fe1d289164cd85c3f58939443892259046 | [
"MIT"
] | null | null | null | caishen_dashboard/auth/utils.py | Kerem-Sami-Coop/caishen-dashboard-be2 | 686717fe1d289164cd85c3f58939443892259046 | [
"MIT"
] | 10 | 2021-04-12T19:19:58.000Z | 2021-05-19T14:37:57.000Z | caishen_dashboard/auth/utils.py | Kerem-Sami-Coop/caishen_dashboard | 686717fe1d289164cd85c3f58939443892259046 | [
"MIT"
] | null | null | null | from flask import session, redirect, url_for
from functools import wraps
def login_required(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if session.get("_user_id") is None:
return redirect(url_for("auth.login"))
return f(*args, **kwargs)
return decorated_function
| 26.333333 | 50 | 0.674051 | from flask import session, redirect, url_for
from functools import wraps
def login_required(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if session.get("_user_id") is None:
return redirect(url_for("auth.login"))
return f(*args, **kwargs)
return decorated_function
| true | true |
f74ba9c232376bbfb2f932b01444008e8cee6a60 | 31,684 | py | Python | mne/tests/test_cov.py | achilleas-k/mne-python | 0078e1af13a92ab47498dd167bc5ec73be864427 | [
"BSD-3-Clause"
] | 1 | 2019-03-22T04:47:45.000Z | 2019-03-22T04:47:45.000Z | mne/tests/test_cov.py | achilleas-k/mne-python | 0078e1af13a92ab47498dd167bc5ec73be864427 | [
"BSD-3-Clause"
] | 4 | 2016-06-04T15:28:08.000Z | 2016-12-22T14:23:13.000Z | mne/tests/test_cov.py | achilleas-k/mne-python | 0078e1af13a92ab47498dd167bc5ec73be864427 | [
"BSD-3-Clause"
] | null | null | null | # Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Denis Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import os.path as op
import itertools as itt
from numpy.testing import (assert_array_almost_equal, assert_array_equal,
assert_equal, assert_... | 42.586022 | 79 | 0.649445 |
import os.path as op
import itertools as itt
from numpy.testing import (assert_array_almost_equal, assert_array_equal,
assert_equal, assert_allclose)
import pytest
import numpy as np
from scipy import linalg
from mne.cov import (regularize, whiten_evoked,
_auto_low... | true | true |
f74baade0c5da5052cc740cfb45038c8b7fae270 | 362 | py | Python | prediction_api/config/urls.py | YusufBerki/PyImageClassification | eee9a5f76aed5ea81c3c0968a0d4d699f5510bab | [
"MIT"
] | 6 | 2021-08-09T15:56:01.000Z | 2022-03-01T14:31:40.000Z | prediction_api/config/urls.py | YusufBerki/PyImageClassification | eee9a5f76aed5ea81c3c0968a0d4d699f5510bab | [
"MIT"
] | 2 | 2021-08-07T10:59:48.000Z | 2021-08-09T23:21:21.000Z | prediction_api/config/urls.py | YusufBerki/PyImageClassification | eee9a5f76aed5ea81c3c0968a0d4d699f5510bab | [
"MIT"
] | null | null | null | from django.conf import settings
from django.urls import include, path
from django.conf.urls.static import static
urlpatterns = [
path('api/predict/', include('prediction.api.urls')),
]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_... | 27.846154 | 79 | 0.762431 | from django.conf import settings
from django.urls import include, path
from django.conf.urls.static import static
urlpatterns = [
path('api/predict/', include('prediction.api.urls')),
]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_... | true | true |
f74bab3132a689aa52d933180a0c9924fcef9d8b | 1,204 | py | Python | app/core/models.py | errnanee/recipe-app-api | cb9f30de88841c6819aa97a81b498ab19fd3b849 | [
"MIT"
] | null | null | null | app/core/models.py | errnanee/recipe-app-api | cb9f30de88841c6819aa97a81b498ab19fd3b849 | [
"MIT"
] | null | null | null | app/core/models.py | errnanee/recipe-app-api | cb9f30de88841c6819aa97a81b498ab19fd3b849 | [
"MIT"
] | null | null | null | from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, \
PermissionsMixin
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **extra_fields):
""" cria e salva um novo usuário"""
if... | 30.871795 | 76 | 0.664452 | from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, \
PermissionsMixin
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **extra_fields):
if not email:
raise ValueError('Us... | true | true |
f74bab8ad7c7a9c252f4cf9e62fa25593fe57400 | 18,629 | py | Python | optuna/samplers/_tpe/parzen_estimator.py | masap/optuna | f56cea87c4771d53b39f441e727d733dd1785557 | [
"MIT"
] | 1,300 | 2018-12-03T06:11:11.000Z | 2019-11-15T01:28:25.000Z | optuna/samplers/_tpe/parzen_estimator.py | masap/optuna | f56cea87c4771d53b39f441e727d733dd1785557 | [
"MIT"
] | 274 | 2018-12-04T09:54:07.000Z | 2019-11-15T02:23:18.000Z | optuna/samplers/_tpe/parzen_estimator.py | masap/optuna | f56cea87c4771d53b39f441e727d733dd1785557 | [
"MIT"
] | 148 | 2018-12-03T10:48:50.000Z | 2019-11-11T16:37:51.000Z | from typing import Callable
from typing import Dict
from typing import NamedTuple
from typing import Optional
from typing import Tuple
from typing import TYPE_CHECKING
import numpy as np
from optuna import distributions
from optuna._imports import _LazyImport
from optuna.distributions import BaseDistribution
if TYP... | 40.322511 | 99 | 0.592463 | from typing import Callable
from typing import Dict
from typing import NamedTuple
from typing import Optional
from typing import Tuple
from typing import TYPE_CHECKING
import numpy as np
from optuna import distributions
from optuna._imports import _LazyImport
from optuna.distributions import BaseDistribution
if TYP... | true | true |
f74baba64a377db4e2d4178d11cfe72c436c7065 | 2,118 | py | Python | others/paired/progressive/dataset.py | ericlearning/Progressive-Image-Translation-Network | 972c54dfdbc4c065328f7fc54b2b47c2cefcc609 | [
"MIT"
] | 2 | 2019-05-11T12:25:55.000Z | 2019-10-17T16:10:34.000Z | others/paired/progressive/dataset.py | ericlearning/Progressive-Image-Translation-Network | 972c54dfdbc4c065328f7fc54b2b47c2cefcc609 | [
"MIT"
] | null | null | null | others/paired/progressive/dataset.py | ericlearning/Progressive-Image-Translation-Network | 972c54dfdbc4c065328f7fc54b2b47c2cefcc609 | [
"MIT"
] | null | null | null | import os
import torch
import random
import numpy as np
from torchvision import datasets, transforms
from torch.utils.data import DataLoader
from PIL import Image
class Dataset():
def __init__(self, train_dir, basic_types = None, shuffle = True):
self.train_dir = train_dir
self.basic_types = basic_types
self.sh... | 32.090909 | 111 | 0.717186 | import os
import torch
import random
import numpy as np
from torchvision import datasets, transforms
from torch.utils.data import DataLoader
from PIL import Image
class Dataset():
def __init__(self, train_dir, basic_types = None, shuffle = True):
self.train_dir = train_dir
self.basic_types = basic_types
self.sh... | true | true |
f74babcaf33247edfe3fed1f2dffed5bc9bebed6 | 1,479 | py | Python | src/constants.py | AA-Turner/sphinx-themes.org | 07f700791c2b282dae9439f861abe52f0e6518f9 | [
"BSD-2-Clause"
] | 104 | 2018-01-29T00:44:35.000Z | 2022-03-31T08:11:56.000Z | src/constants.py | AA-Turner/sphinx-themes.org | 07f700791c2b282dae9439f861abe52f0e6518f9 | [
"BSD-2-Clause"
] | 60 | 2018-01-30T22:04:18.000Z | 2022-03-26T10:38:12.000Z | src/constants.py | AA-Turner/sphinx-themes.org | 07f700791c2b282dae9439f861abe52f0e6518f9 | [
"BSD-2-Clause"
] | 37 | 2018-01-30T14:25:23.000Z | 2022-03-31T23:03:23.000Z | from pathlib import Path
# -------------------------------------------------------------------------------
# Locations
# -------------------------------------------------------------------------------
_BASE = Path(__file__).parent.parent.relative_to(Path(".").resolve())
_PUBLIC = _BASE / "public"
_TEMPLATES = _BASE / ... | 29 | 81 | 0.47735 | from pathlib import Path
_BASE = Path(__file__).parent.parent.relative_to(Path(".").resolve())
_PUBLIC = _BASE / "public"
_TEMPLATES = _BASE / "src" / "templates"
FILES = {
"themes.json": _BASE / "themes.json",
}
TEMPLATES = {
"configuration": _TEMPLATES / "conf.template.py",
"preview-image": _TEMPLAT... | true | true |
f74bacc655df590f149543a23365689cfde98602 | 21,908 | py | Python | main_ardae.py | lim0606/pytorch-ardae-rl | 6e861d8f09ee27fa8f7b42d1eb209788c93395fa | [
"MIT"
] | 7 | 2020-09-13T20:36:24.000Z | 2022-03-31T09:30:36.000Z | main_ardae.py | lim0606/pytorch-ardae-rl | 6e861d8f09ee27fa8f7b42d1eb209788c93395fa | [
"MIT"
] | null | null | null | main_ardae.py | lim0606/pytorch-ardae-rl | 6e861d8f09ee27fa8f7b42d1eb209788c93395fa | [
"MIT"
] | null | null | null | """
PyTorch code for SAC-AR-DAE. Copied and modified from PyTorch code for SAC-NF (Mazoure et al., 2019): https://arxiv.org/abs/1905.06893
"""
import os
import sys
import argparse
import time
import datetime
import itertools
import random
import pickle
import glob
import gym
import numpy as np
import torch
from sac_a... | 45.832636 | 188 | 0.564223 |
import os
import sys
import argparse
import time
import datetime
import itertools
import random
import pickle
import glob
import gym
import numpy as np
import torch
from sac_ardae import SAC
from normalized_actions import NormalizedActions
from replay_memory import ReplayMemory
import pandas as pd
try:
import pyb... | true | true |
f74bae669b410cc7da2f38aecac51fb0faea63f1 | 8,617 | py | Python | lasagne/layers/corrmm.py | lkfo415579/deeplearning_basic_build | 73f8e03a8454571ddeab0152c6b471f89404468e | [
"MIT"
] | 60 | 2015-01-29T21:54:04.000Z | 2019-11-12T07:38:15.000Z | lasagne/layers/corrmm.py | lkfo415579/deeplearning_basic_build | 73f8e03a8454571ddeab0152c6b471f89404468e | [
"MIT"
] | 5 | 2015-06-15T00:21:47.000Z | 2017-09-14T10:24:40.000Z | lasagne/layers/corrmm.py | lkfo415579/deeplearning_basic_build | 73f8e03a8454571ddeab0152c6b471f89404468e | [
"MIT"
] | 20 | 2015-04-28T00:21:41.000Z | 2019-09-16T01:10:37.000Z | import theano
from .. import init
from .. import nonlinearities
from .base import Layer
from .conv import conv_output_length
from ..utils import as_tuple
from theano.sandbox.cuda.basic_ops import gpu_contiguous
from theano.sandbox.cuda.blas import GpuCorrMM
__all__ = [
"MMLayer",
"Conv2DMMLayer",
]
if n... | 39.527523 | 79 | 0.628873 | import theano
from .. import init
from .. import nonlinearities
from .base import Layer
from .conv import conv_output_length
from ..utils import as_tuple
from theano.sandbox.cuda.basic_ops import gpu_contiguous
from theano.sandbox.cuda.blas import GpuCorrMM
__all__ = [
"MMLayer",
"Conv2DMMLayer",
]
if n... | true | true |
f74baf96e92c9b15045da16364f2dfec8a0f8368 | 91 | py | Python | metamvc/__main__.py | danilocgsilva/MetaMVC | 8be57d8e4c153eb7fe94c48509042dd677987560 | [
"Apache-2.0"
] | null | null | null | metamvc/__main__.py | danilocgsilva/MetaMVC | 8be57d8e4c153eb7fe94c48509042dd677987560 | [
"Apache-2.0"
] | null | null | null | metamvc/__main__.py | danilocgsilva/MetaMVC | 8be57d8e4c153eb7fe94c48509042dd677987560 | [
"Apache-2.0"
] | null | null | null | from metamvc.DatabaseUserData import DatabaseUserData
def main():
DatabaseUserData()
| 15.166667 | 53 | 0.791209 | from metamvc.DatabaseUserData import DatabaseUserData
def main():
DatabaseUserData()
| true | true |
f74baf9ba3084c5852c42b7ecc0e5f4a2fca1424 | 338 | py | Python | aula022 - MODULOS e PACOTES/ex109-FormatandoMoedas/ex109.py | miradouro/CursoEmVideo-Python | cc7b05a9a4aad8e6ef3b29453d83370094d75e41 | [
"MIT"
] | null | null | null | aula022 - MODULOS e PACOTES/ex109-FormatandoMoedas/ex109.py | miradouro/CursoEmVideo-Python | cc7b05a9a4aad8e6ef3b29453d83370094d75e41 | [
"MIT"
] | null | null | null | aula022 - MODULOS e PACOTES/ex109-FormatandoMoedas/ex109.py | miradouro/CursoEmVideo-Python | cc7b05a9a4aad8e6ef3b29453d83370094d75e41 | [
"MIT"
] | null | null | null | import moeda
valor = float(input('Digite o preço: '))
p = 20
print(f'A metade de {moeda.moeda(valor)} é {moeda.metade(valor, True)}')
print(f'O dobro de {moeda.moeda(valor)} é {moeda.dobro(valor, True)}')
print(f'Aumentando {p}%, temos {moeda.aumentar(valor, p, True)}')
print(f'Diminuindo 10%, temos {moeda.diminuir(va... | 37.555556 | 72 | 0.689349 | import moeda
valor = float(input('Digite o preço: '))
p = 20
print(f'A metade de {moeda.moeda(valor)} é {moeda.metade(valor, True)}')
print(f'O dobro de {moeda.moeda(valor)} é {moeda.dobro(valor, True)}')
print(f'Aumentando {p}%, temos {moeda.aumentar(valor, p, True)}')
print(f'Diminuindo 10%, temos {moeda.diminuir(va... | true | true |
f74bb1af4a7fa8a1a2bfbc88d40da44f9244a6dd | 965 | py | Python | kubernetes/test/test_logs_api.py | woqer/python | 3a6fe8231cefe1fa39a0a69d4b2f33044ab32745 | [
"Apache-2.0"
] | 1 | 2019-07-12T05:38:06.000Z | 2019-07-12T05:38:06.000Z | kubernetes/test/test_logs_api.py | woqer/python | 3a6fe8231cefe1fa39a0a69d4b2f33044ab32745 | [
"Apache-2.0"
] | null | null | null | kubernetes/test/test_logs_api.py | woqer/python | 3a6fe8231cefe1fa39a0a69d4b2f33044ab32745 | [
"Apache-2.0"
] | 1 | 2021-05-18T12:25:56.000Z | 2021-05-18T12:25:56.000Z | # coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.11.3
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... | 18.207547 | 105 | 0.660104 |
from __future__ import absolute_import
import os
import sys
import unittest
import kubernetes.client
from kubernetes.client.rest import ApiException
from kubernetes.client.apis.logs_api import LogsApi
class TestLogsApi(unittest.TestCase):
def setUp(self):
self.api = kubernetes.client.apis.logs_api.... | true | true |
f74bb23e8946597cac4fb1e39ad6467e1e10131e | 1,598 | py | Python | multi-robot/src/multi-robot/src/drone_kinect.py | YanCHEN-fr/DGA_Challenge_Multi_Robot_Control | 5f410f09870dab0cfa0cc64e80de1ce1931e2654 | [
"Apache-2.0"
] | null | null | null | multi-robot/src/multi-robot/src/drone_kinect.py | YanCHEN-fr/DGA_Challenge_Multi_Robot_Control | 5f410f09870dab0cfa0cc64e80de1ce1931e2654 | [
"Apache-2.0"
] | null | null | null | multi-robot/src/multi-robot/src/drone_kinect.py | YanCHEN-fr/DGA_Challenge_Multi_Robot_Control | 5f410f09870dab0cfa0cc64e80de1ce1931e2654 | [
"Apache-2.0"
] | 1 | 2021-03-10T20:53:34.000Z | 2021-03-10T20:53:34.000Z | #!/usr/bin/env python
import rospy
import numpy as np
import cv2, cv_bridge
from sensor_msgs.msg import Image
class drone_camera:
def __init__(self, drone_N):
assert int(drone_N) in {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
rospy.init_node("drone{}_kinect_vision".format(drone_N), anonymous=False)
se... | 35.511111 | 120 | 0.653317 |
import rospy
import numpy as np
import cv2, cv_bridge
from sensor_msgs.msg import Image
class drone_camera:
def __init__(self, drone_N):
assert int(drone_N) in {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
rospy.init_node("drone{}_kinect_vision".format(drone_N), anonymous=False)
self.track_flag = False... | true | true |
f74bb2ae193fc02a3e6792bbe2853a9a4d811f4a | 262 | py | Python | baekjoon/python/axb.py | yskang/AlgorithmPracticeWithPython | f7129bd1924a7961489198f0ee052d2cd1e9cf40 | [
"MIT"
] | null | null | null | baekjoon/python/axb.py | yskang/AlgorithmPracticeWithPython | f7129bd1924a7961489198f0ee052d2cd1e9cf40 | [
"MIT"
] | null | null | null | baekjoon/python/axb.py | yskang/AlgorithmPracticeWithPython | f7129bd1924a7961489198f0ee052d2cd1e9cf40 | [
"MIT"
] | null | null | null | # A*B
# https://www.acmicpc.net/problem/10998
import sys
# testData = [
# '1 2'
# ]
# testData.reverse()
# rl = lambda: testData.pop()
rl = lambda: input()
line = rl()
a = int(line.split(' ')[0])
b = int(line.split(' ')[1])
print(a*b)
| 13.789474 | 40 | 0.530534 |
import sys
rl = lambda: input()
line = rl()
a = int(line.split(' ')[0])
b = int(line.split(' ')[1])
print(a*b)
| true | true |
f74bb331076da0e006627a400801994986c3924d | 20,182 | py | Python | test/functional/rpc_rawtransaction.py | nondracek/ClipCoin | 80a77d861f931d9f56368581bd1cdb0c1b9f8c59 | [
"MIT"
] | null | null | null | test/functional/rpc_rawtransaction.py | nondracek/ClipCoin | 80a77d861f931d9f56368581bd1cdb0c1b9f8c59 | [
"MIT"
] | null | null | null | test/functional/rpc_rawtransaction.py | nondracek/ClipCoin | 80a77d861f931d9f56368581bd1cdb0c1b9f8c59 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) 2014-2017 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 rawtransaction RPCs.
Test the following RPCs:
- createrawtransaction
- signrawtransacti... | 53.25066 | 233 | 0.646913 |
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
class multidict(dict):
def __init__(self, x):
dict.__init__(self, x)
self.x = x
def items(self):
return self.x
class RawTransactionsTest(BitcoinTestFramework):
def set_test_pa... | true | true |
f74bb44090a5cac164f0f897b4d822ad1e707a62 | 9,963 | py | Python | my_vim_files/python27/Lib/distutils/tests/test_archive_util.py | satsaeid/dotfiles | 401c3213b31dd941b44e553c6f0441187b01c19a | [
"MIT"
] | null | null | null | my_vim_files/python27/Lib/distutils/tests/test_archive_util.py | satsaeid/dotfiles | 401c3213b31dd941b44e553c6f0441187b01c19a | [
"MIT"
] | null | null | null | my_vim_files/python27/Lib/distutils/tests/test_archive_util.py | satsaeid/dotfiles | 401c3213b31dd941b44e553c6f0441187b01c19a | [
"MIT"
] | null | null | null | """Tests for distutils.archive_util."""
__revision__ = "$Id: test_archive_util.py 75659 2009-10-24 13:29:44Z tarek.ziade $"
import unittest
import os
import tarfile
from os.path import splitdrive
import warnings
from distutils.archive_util import (check_archive_formats, make_tarball,
... | 34.957895 | 84 | 0.573723 | __revision__ = "$Id: test_archive_util.py 75659 2009-10-24 13:29:44Z tarek.ziade $"
import unittest
import os
import tarfile
from os.path import splitdrive
import warnings
from distutils.archive_util import (check_archive_formats, make_tarball,
make_zipfile, make_archive,
... | true | true |
f74bb46c8152db30c377a45a264a7a27f758ca36 | 5,133 | gyp | Python | login_manager/login_manager.gyp | doitmovin/chromiumos-platform2 | 6462aaf43072307b5a40eb045a89e473381b5fda | [
"BSD-3-Clause"
] | null | null | null | login_manager/login_manager.gyp | doitmovin/chromiumos-platform2 | 6462aaf43072307b5a40eb045a89e473381b5fda | [
"BSD-3-Clause"
] | null | null | null | login_manager/login_manager.gyp | doitmovin/chromiumos-platform2 | 6462aaf43072307b5a40eb045a89e473381b5fda | [
"BSD-3-Clause"
] | 2 | 2021-01-26T12:37:19.000Z | 2021-05-18T13:37:57.000Z | {
'target_defaults': {
'defines': [
'OS_CHROMEOS',
'USE_CHEETS=<(USE_cheets)',
'USE_NSS_CERTS',
'USE_SYSTEMD=<(USE_systemd)',
],
'variables': {
'deps': [
'dbus-1',
'libbrillo-<(libbase_ver)',
'libchrome-<(libbase_ver)',
'libchromeos-ui-<(libbas... | 29.67052 | 83 | 0.548023 | {
'target_defaults': {
'defines': [
'OS_CHROMEOS',
'USE_CHEETS=<(USE_cheets)',
'USE_NSS_CERTS',
'USE_SYSTEMD=<(USE_systemd)',
],
'variables': {
'deps': [
'dbus-1',
'libbrillo-<(libbase_ver)',
'libchrome-<(libbase_ver)',
'libchromeos-ui-<(libbas... | true | true |
f74bb47d4c2b521576db557b52fc9ebbd1bec2be | 251 | py | Python | ABC/abc101-abc150/abc114/b.py | KATO-Hiro/AtCoder | cbbdb18e95110b604728a54aed83a6ed6b993fde | [
"CC0-1.0"
] | 2 | 2020-06-12T09:54:23.000Z | 2021-05-04T01:34:07.000Z | ABC/abc101-abc150/abc114/b.py | KATO-Hiro/AtCoder | cbbdb18e95110b604728a54aed83a6ed6b993fde | [
"CC0-1.0"
] | 961 | 2020-06-23T07:26:22.000Z | 2022-03-31T21:34:52.000Z | ABC/abc101-abc150/abc114/b.py | KATO-Hiro/AtCoder | cbbdb18e95110b604728a54aed83a6ed6b993fde | [
"CC0-1.0"
] | null | null | null | # -*- coding: utf-8 -*-
def main():
s = input()
ans = float('inf')
for i in range(len(s) - 3 + 1):
candidate = int(s[i:i + 3])
ans = min(ans, abs(753 - candidate))
print(ans)
if __name__ == '__main__':
main()
| 14.764706 | 44 | 0.482072 |
def main():
s = input()
ans = float('inf')
for i in range(len(s) - 3 + 1):
candidate = int(s[i:i + 3])
ans = min(ans, abs(753 - candidate))
print(ans)
if __name__ == '__main__':
main()
| true | true |
f74bb4c63b6d18dfbb79d83a8a4fbfeba82eb118 | 497 | py | Python | tests/test_news_article.py | Collin9726/Marekani | 10c5432eb8f6612e93a3fb03d2d4cd74f4db556d | [
"MIT"
] | 5 | 2021-10-31T22:04:03.000Z | 2022-01-08T17:42:07.000Z | tests/test_news_article.py | Collin9726/Marekani | 10c5432eb8f6612e93a3fb03d2d4cd74f4db556d | [
"MIT"
] | null | null | null | tests/test_news_article.py | Collin9726/Marekani | 10c5432eb8f6612e93a3fb03d2d4cd74f4db556d | [
"MIT"
] | null | null | null | import unittest
from app.models import NewsArticle
class ArticleTest(unittest.TestCase):
'''
Test Class to test the behaviour of the NewsArticle class
'''
def setUp(self):
'''
Set up method that will run before every Test
'''
self.new_article = NewsArticle("CNN", "John ... | 31.0625 | 133 | 0.651911 | import unittest
from app.models import NewsArticle
class ArticleTest(unittest.TestCase):
def setUp(self):
self.new_article = NewsArticle("CNN", "John Doe", "Christmas in the City", "/home", "/image", "30-05-2020", "Lorem", "Ipsum")
def test_instance(self):
self.assertTrue(isinstance(self.new_... | true | true |
f74bb51594c045c7c4e32e5175eb3df81e96ab5a | 2,756 | py | Python | utils/time_utils.py | faker2cumtb/sentimentanalysis | b4b185bd1d55471ac99664fe890c31fa8a48918b | [
"MIT"
] | 10 | 2019-03-22T07:46:19.000Z | 2021-04-18T12:29:47.000Z | utils/time_utils.py | faker2cumtb/sentimentanalysis | b4b185bd1d55471ac99664fe890c31fa8a48918b | [
"MIT"
] | 1 | 2019-09-21T03:33:26.000Z | 2019-09-21T03:33:26.000Z | utils/time_utils.py | faker2cumtb/sentimentanalysis | b4b185bd1d55471ac99664fe890c31fa8a48918b | [
"MIT"
] | 8 | 2019-04-09T09:59:22.000Z | 2021-12-26T14:08:22.000Z | # -*- coding: utf-8 -*-
#
# 格式为 "%Y-%m-%d %H:%M:%S", 如'2018-10-01 00:00:01'
#
# 常用函数
# (1) 时间戳转为struct_time对象
# time.localtime(ts))
# time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=8, tm_min=0, tm_sec=12,
# tm_wday=3, tm_yday=1, tm_isdst=0)
# (2)
# date_obj = datetime.date(int(... | 25.284404 | 95 | 0.630987 |
import time
import datetime
def datetime_to_string(dt):
return dt.strftime("%Y-%m-%d %H:%M:%S")
def string_to_datetime(str_time):
return time.strptime(str_time, "%Y-%m-%d %H:%M:%S")
def string_to_timestamp(str_time):
return time.mktime(string_to_datetime(str_time))
def timestamp_to_str... | true | true |
f74bb5646fe40f620e3daf9fc58096e5c4e2c5a8 | 3,584 | py | Python | tests/PySys/software_management_end_to_end/sm_mixed_install_remove_multiple/run.py | rina23q/thin-edge.io | 6913365ec2196d0c7f832ebf17bc83b27e60d858 | [
"Apache-2.0"
] | null | null | null | tests/PySys/software_management_end_to_end/sm_mixed_install_remove_multiple/run.py | rina23q/thin-edge.io | 6913365ec2196d0c7f832ebf17bc83b27e60d858 | [
"Apache-2.0"
] | null | null | null | tests/PySys/software_management_end_to_end/sm_mixed_install_remove_multiple/run.py | rina23q/thin-edge.io | 6913365ec2196d0c7f832ebf17bc83b27e60d858 | [
"Apache-2.0"
] | null | null | null | from pysys.basetest import BaseTest
import time
"""
Validate end to end behaviour for the dummy-plugin for multiple packages with mixed versions
When we install a bunch of packages
Then they are installed
When we deinstall them again
Then they are not installed
This test is currently skipped as it needs a speciali... | 32.288288 | 92 | 0.573661 | from pysys.basetest import BaseTest
import time
import json
import requests
import time
import sys
from environment_sm_management import SoftwareManagement
class PySysTest(SoftwareManagement):
def get_packages_with_action(self, act):
mgt = "::fruits"
action = [
{
... | true | true |
f74bb5e364977c6b86a7875d2fa785be4f988aa2 | 5,574 | py | Python | tengi/task.py | qzar02/tengi | 35f900b2ae8be88f6c62cc022adcb4dcac08aa5f | [
"MIT"
] | null | null | null | tengi/task.py | qzar02/tengi | 35f900b2ae8be88f6c62cc022adcb4dcac08aa5f | [
"MIT"
] | null | null | null | tengi/task.py | qzar02/tengi | 35f900b2ae8be88f6c62cc022adcb4dcac08aa5f | [
"MIT"
] | null | null | null | from urllib.parse import urlparse
from datetime import date
class TableNode:
def __init__(self, task, _id):
self.task = task
self.requires = []
self.id = _id
class GraphDependency:
def __init__(self, tasks):
nodes = {}
for task in tasks:
nodes[task.id] = T... | 27.594059 | 100 | 0.570506 | from urllib.parse import urlparse
from datetime import date
class TableNode:
def __init__(self, task, _id):
self.task = task
self.requires = []
self.id = _id
class GraphDependency:
def __init__(self, tasks):
nodes = {}
for task in tasks:
nodes[task.id] = T... | true | true |
f74bb62dc964b00d0c5f083ad035e85eb47c14fd | 3,964 | py | Python | script/eval_1_mean_plot.py | rezeck/grf_transport | 64d68dc18b950575c19e44d91ade87b01a1e9ab0 | [
"Apache-2.0"
] | null | null | null | script/eval_1_mean_plot.py | rezeck/grf_transport | 64d68dc18b950575c19e44d91ade87b01a1e9ab0 | [
"Apache-2.0"
] | null | null | null | script/eval_1_mean_plot.py | rezeck/grf_transport | 64d68dc18b950575c19e44d91ade87b01a1e9ab0 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats
import sys
def mean_confidence_interval(data, confidence=0.95):
a = 1.0 * np.array(data)
n = len(a)
m, se = np.mean(a), scipy.stats.sem(a)
h = se * scipy.stats.t.ppf((1 + confidence) / 2., n-1)
return m, m... | 32.227642 | 164 | 0.636226 |
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats
import sys
def mean_confidence_interval(data, confidence=0.95):
a = 1.0 * np.array(data)
n = len(a)
m, se = np.mean(a), scipy.stats.sem(a)
h = se * scipy.stats.t.ppf((1 + confidence) / 2., n-1)
return m, m-h, m+h
prefix = "e... | true | true |
f74bb64b4aa566bcf01bb0c7975fea625b199dc3 | 1,831 | py | Python | venv/Lib/site-packages/pyrogram/raw/base/bot_info.py | iamgeorgiy/heroku-userbot | 5a92417d16f8ead949d88cb38da213fc2da5d3a4 | [
"Apache-2.0"
] | null | null | null | venv/Lib/site-packages/pyrogram/raw/base/bot_info.py | iamgeorgiy/heroku-userbot | 5a92417d16f8ead949d88cb38da213fc2da5d3a4 | [
"Apache-2.0"
] | null | null | null | venv/Lib/site-packages/pyrogram/raw/base/bot_info.py | iamgeorgiy/heroku-userbot | 5a92417d16f8ead949d88cb38da213fc2da5d3a4 | [
"Apache-2.0"
] | null | null | null | # Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-2020 Dan <https://github.com/delivrance>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free... | 36.62 | 87 | 0.632987 | true | true | |
f74bb7018fb50beedc7e6d902b50f2da61e6dd08 | 34,038 | py | Python | electrum/address_synchronizer.py | phamels/electrum-nix | 3ca93e399939c36e54bf77c235033b8e77219bfe | [
"MIT"
] | 5 | 2018-10-31T18:47:54.000Z | 2021-09-20T02:04:42.000Z | electrum/address_synchronizer.py | project-mynt/electrum-mynt | ca1548e008854f2a3eff900a69365307cc20bd57 | [
"MIT"
] | null | null | null | electrum/address_synchronizer.py | project-mynt/electrum-mynt | ca1548e008854f2a3eff900a69365307cc20bd57 | [
"MIT"
] | 11 | 2018-10-31T19:46:05.000Z | 2019-09-25T20:18:37.000Z | # Electrum - lightweight Bitcoin client
# Copyright (C) 2018 The Electrum Developers
#
# 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 ... | 41.56044 | 109 | 0.571156 |
import threading
import asyncio
import itertools
from collections import defaultdict
from typing import TYPE_CHECKING
from . import bitcoin
from .bitcoin import COINBASE_MATURITY, TYPE_ADDRESS, TYPE_PUBKEY
from .util import PrintError, profiler, bfh, VerifiedTxInfo, TxMinedStatus
from .transacti... | true | true |
f74bb74c245f6868175909f6c217f1d9bef1c053 | 132,400 | py | Python | src/nifgen/metadata/attributes.py | WhiteLupus/nimi-python | 4e05b9a64f08ed2c929932d8d586c7114c46cf04 | [
"MIT"
] | 1 | 2019-09-18T14:28:47.000Z | 2019-09-18T14:28:47.000Z | src/nifgen/metadata/attributes.py | WhiteLupus/nimi-python | 4e05b9a64f08ed2c929932d8d586c7114c46cf04 | [
"MIT"
] | null | null | null | src/nifgen/metadata/attributes.py | WhiteLupus/nimi-python | 4e05b9a64f08ed2c929932d8d586c7114c46cf04 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# This file is generated from NI-FGEN API metadata version 19.6.0d0
attributes = {
1050002: {
'access': 'read-write',
'channel_based': False,
'codegen_method': 'no',
'documentation': {
'description': '\nSpecifies whether to validate attribute value... | 48.533724 | 971 | 0.638497 |
attributes = {
1050002: {
'access': 'read-write',
'channel_based': False,
'codegen_method': 'no',
'documentation': {
'description': '\nSpecifies whether to validate attribute values and function parameters. If enabled, NI-FGEN validates the parameter values that you p... | true | true |
f74bb92c85533fbf7b1bb2fea4d40653ba67bfa4 | 1,072 | py | Python | tests/micropython/heapalloc.py | learnforpractice/micropython-cpp | 004bc8382f74899e7b876cc29bfa6a9cc976ba10 | [
"MIT"
] | 198 | 2017-03-24T23:23:54.000Z | 2022-01-07T07:14:00.000Z | tests/micropython/heapalloc.py | learnforpractice/micropython-cpp | 004bc8382f74899e7b876cc29bfa6a9cc976ba10 | [
"MIT"
] | 509 | 2017-03-28T19:37:18.000Z | 2022-03-31T20:31:43.000Z | tests/micropython/heapalloc.py | learnforpractice/micropython-cpp | 004bc8382f74899e7b876cc29bfa6a9cc976ba10 | [
"MIT"
] | 187 | 2017-03-24T23:23:58.000Z | 2022-02-25T01:48:45.000Z | # check that we can do certain things without allocating heap memory
import micropython
# Check for stackless build, which can't call functions without
# allocating a frame on heap.
try:
def stackless(): pass
micropython.heap_lock(); stackless(); micropython.heap_unlock()
except RuntimeError:
print("SKIP"... | 24.363636 | 68 | 0.60541 |
import micropython
# allocating a frame on heap.
try:
def stackless(): pass
micropython.heap_lock(); stackless(); micropython.heap_unlock()
except RuntimeError:
print("SKIP")
raise SystemExit
def f1(a):
print(a)
def f2(a, b=2):
print(a, b)
def f3(a, b, c, d):
x1 = x2 = a
x3 = x4 =... | true | true |
f74bb9815c9a7ce29ad0c1bd1c39e0e73ce0f75a | 307 | py | Python | cmd/agent/dist/utils/subprocess_output.py | wowi42/datadog-agent | 0e097f06104b44ea10e2834578b55471fd0ec6fb | [
"Apache-2.0"
] | 1 | 2021-01-13T15:39:35.000Z | 2021-01-13T15:39:35.000Z | cmd/agent/dist/utils/subprocess_output.py | wowi42/datadog-agent | 0e097f06104b44ea10e2834578b55471fd0ec6fb | [
"Apache-2.0"
] | null | null | null | cmd/agent/dist/utils/subprocess_output.py | wowi42/datadog-agent | 0e097f06104b44ea10e2834578b55471fd0ec6fb | [
"Apache-2.0"
] | null | null | null | # Unless explicitly stated otherwise all files in this repository are licensed
# under the Apache License Version 2.0.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2018 Datadog, Inc.
from datadog_checks.utils.subprocess_output import get_subprocess_output
| 51.166667 | 83 | 0.81759 |
from datadog_checks.utils.subprocess_output import get_subprocess_output
| true | true |
f74bb9b14b44dec57aec08c1c936308c1bec4e78 | 8,423 | py | Python | deepcell/running.py | jizhouh/deepcell-tf | 491ece59f5024d73429477ebdcb437a6e67d766b | [
"Apache-2.0"
] | 250 | 2018-09-19T23:55:06.000Z | 2022-03-30T02:20:52.000Z | deepcell/running.py | jizhouh/deepcell-tf | 491ece59f5024d73429477ebdcb437a6e67d766b | [
"Apache-2.0"
] | 251 | 2018-09-21T17:09:43.000Z | 2022-02-28T19:04:50.000Z | deepcell/running.py | jizhouh/deepcell-tf | 491ece59f5024d73429477ebdcb437a6e67d766b | [
"Apache-2.0"
] | 64 | 2018-11-29T15:22:15.000Z | 2022-03-21T03:37:43.000Z | # Copyright 2016-2021 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
#
# Licensed under a modified Apache License, Version 2.0 (the "License");... | 38.113122 | 86 | 0.611421 |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import numpy as np
from tensorflow.keras import backend as K
from tensorflow.keras.models import Model
from deepcell.utils.data_utils import trim_padding
def get_cropped_input_shape... | true | true |
f74bba68812e092250ad527ef3e3893b572aba8f | 8,265 | py | Python | src/poliastro/twobody/angles.py | wumpus/poliastro | 6ef314f3b80528018ce489fd51d26db106daac91 | [
"MIT"
] | null | null | null | src/poliastro/twobody/angles.py | wumpus/poliastro | 6ef314f3b80528018ce489fd51d26db106daac91 | [
"MIT"
] | 1 | 2020-10-05T08:24:31.000Z | 2020-10-05T08:24:31.000Z | src/poliastro/twobody/angles.py | wumpus/poliastro | 6ef314f3b80528018ce489fd51d26db106daac91 | [
"MIT"
] | null | null | null | """Angles and anomalies.
"""
import numpy as np
from astropy import coordinates, units as u
from poliastro import constants
from poliastro.core.angles import (
D_to_M as D_to_M_fast,
D_to_nu as D_to_nu_fast,
E_to_M as E_to_M_fast,
E_to_nu as E_to_nu_fast,
F_to_M as F_to_M_fast,
F_to_nu as F_to... | 22.958333 | 101 | 0.616334 | import numpy as np
from astropy import coordinates, units as u
from poliastro import constants
from poliastro.core.angles import (
D_to_M as D_to_M_fast,
D_to_nu as D_to_nu_fast,
E_to_M as E_to_M_fast,
E_to_nu as E_to_nu_fast,
F_to_M as F_to_M_fast,
F_to_nu as F_to_nu_fast,
M_to_D as M_to_D... | true | true |
f74bbaf7bfecb372cbedc381abc8b93d38da4b9a | 4,330 | py | Python | GTSRB/eval_attribution_attack.py | jfc43/robust-attribution-regularization | fad85f40d4b1c2efcd851c32216b4549e7122421 | [
"Apache-2.0"
] | 13 | 2019-05-23T21:24:05.000Z | 2022-01-20T20:10:25.000Z | GTSRB/eval_attribution_attack.py | jfc43/robust-attribution-regularization | fad85f40d4b1c2efcd851c32216b4549e7122421 | [
"Apache-2.0"
] | 2 | 2019-09-27T11:05:35.000Z | 2020-02-18T05:52:26.000Z | GTSRB/eval_attribution_attack.py | jfc43/robust-attribution-regularization | fad85f40d4b1c2efcd851c32216b4549e7122421 | [
"Apache-2.0"
] | null | null | null | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from datetime import datetime
import numpy as np
import shutil
import json
import math
import os
import sys
import time
import tensorflow as tf
import gtsrb_input
from model import Model
os.environ["CUDA_VISI... | 34.365079 | 126 | 0.671594 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from datetime import datetime
import numpy as np
import shutil
import json
import math
import os
import sys
import time
import tensorflow as tf
import gtsrb_input
from model import Model
os.environ["CUDA_VISI... | true | true |
f74bbbcfb9c27a67616600af448dfed00af3d0a1 | 2,725 | py | Python | data/config.py | Ze-Yang/Context-Transformer | 493fb6b3eb9f546dc172601de787fe89a1489065 | [
"MIT"
] | 86 | 2020-03-25T10:33:56.000Z | 2022-03-24T04:11:43.000Z | data/config.py | Ze-Yang/Context-Transformer | 493fb6b3eb9f546dc172601de787fe89a1489065 | [
"MIT"
] | 16 | 2020-04-03T08:43:40.000Z | 2021-12-07T14:15:56.000Z | data/config.py | Ze-Yang/Context-Transformer | 493fb6b3eb9f546dc172601de787fe89a1489065 | [
"MIT"
] | 12 | 2020-03-29T04:26:20.000Z | 2021-12-21T04:33:52.000Z | # config.py
__all__ = ['VOCroot', 'COCOroot', 'VOC_300', 'VOC_SSD_300', 'VOC_512', 'COCO_300',
'COCO_SSD_300', 'COCO_512', 'COCO_mobile_300']
VOCroot = "data/VOCdevkit" # path to VOCdevkit root dir
COCOroot = "data/COCO" # path to COCO root dir
# RFB CONFIGS
VOC_300 = {
'feature_maps': [38, 19, ... | 20.036765 | 82 | 0.480734 |
__all__ = ['VOCroot', 'COCOroot', 'VOC_300', 'VOC_SSD_300', 'VOC_512', 'COCO_300',
'COCO_SSD_300', 'COCO_512', 'COCO_mobile_300']
VOCroot = "data/VOCdevkit"
COCOroot = "data/COCO"
VOC_300 = {
'feature_maps': [38, 19, 10, 5, 3, 1],
'min_dim': 300,
'steps': [8, 16, 32, 64, 100, 300],... | true | true |
f74bbc0710b4d01524928caac65e83db86300605 | 1,647 | py | Python | spirit/views/admin/user.py | benmurden/Spirit | 168f6a603c24fe9e547b7c077677fea9518c0f28 | [
"MIT"
] | 3 | 2017-12-01T08:17:38.000Z | 2021-01-29T15:40:06.000Z | spirit/views/admin/user.py | benmurden/Spirit | 168f6a603c24fe9e547b7c077677fea9518c0f28 | [
"MIT"
] | 9 | 2020-06-05T17:44:02.000Z | 2022-01-13T00:42:34.000Z | spirit/views/admin/user.py | benmurden/Spirit | 168f6a603c24fe9e547b7c077677fea9518c0f28 | [
"MIT"
] | 1 | 2020-11-08T21:47:32.000Z | 2020-11-08T21:47:32.000Z | #-*- coding: utf-8 -*-
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth import get_user_model
from django.contrib import messages
from django.utils.translation import ugettext as _
from spirit.utils.decorators import administrator_required
from spirit.forms.admin import UserE... | 30.5 | 86 | 0.72799 |
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth import get_user_model
from django.contrib import messages
from django.utils.translation import ugettext as _
from spirit.utils.decorators import administrator_required
from spirit.forms.admin import UserEditForm
User = get_u... | true | true |
f74bbd8fe4ef752a7a8149ce53064aba644ac9d2 | 3,778 | py | Python | mesonbuild/compilers/objcpp.py | inigomartinez/meson | e182dba61feb5b6872154e245014c58d99aa39d8 | [
"Apache-2.0"
] | null | null | null | mesonbuild/compilers/objcpp.py | inigomartinez/meson | e182dba61feb5b6872154e245014c58d99aa39d8 | [
"Apache-2.0"
] | null | null | null | mesonbuild/compilers/objcpp.py | inigomartinez/meson | e182dba61feb5b6872154e245014c58d99aa39d8 | [
"Apache-2.0"
] | null | null | null | # Copyright 2012-2017 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agree... | 48.435897 | 126 | 0.66702 |
import os.path, subprocess
import typing
from ..mesonlib import EnvironmentException, MachineChoice
from .clike import CLikeCompiler
from .compilers import Compiler, ClangCompiler, GnuCompiler
class ObjCPPCompiler(CLikeCompiler, Compiler):
def __init__(self, exelist, version, for_machine: MachineCh... | true | true |
f74bc013ee5fffe2b91c5cc7db97bcc8f3395642 | 111 | py | Python | dborm/ormbase.py | BuloZB/turhouse | e76db0cdc96d9c9acfc5bd99ed94d9ad1dfecfa1 | [
"Apache-2.0"
] | null | null | null | dborm/ormbase.py | BuloZB/turhouse | e76db0cdc96d9c9acfc5bd99ed94d9ad1dfecfa1 | [
"Apache-2.0"
] | null | null | null | dborm/ormbase.py | BuloZB/turhouse | e76db0cdc96d9c9acfc5bd99ed94d9ad1dfecfa1 | [
"Apache-2.0"
] | 1 | 2016-11-21T16:56:07.000Z | 2016-11-21T16:56:07.000Z | # -*- coding: utf-8 -*-
from sqlalchemy.ext.declarative import declarative_base
OrmBase = declarative_base()
| 18.5 | 55 | 0.747748 |
from sqlalchemy.ext.declarative import declarative_base
OrmBase = declarative_base()
| true | true |
f74bc0b244bc4d488c8c7f44c128310031163b8d | 42,069 | py | Python | tools/c7n_mailer/setup.py | tjstansell/cloud-custodian | 830a1131537560e5032bc67e52b66e259630e899 | [
"Apache-2.0"
] | 1 | 2021-08-22T12:30:03.000Z | 2021-08-22T12:30:03.000Z | tools/c7n_mailer/setup.py | tjstansell/cloud-custodian | 830a1131537560e5032bc67e52b66e259630e899 | [
"Apache-2.0"
] | 8 | 2021-06-02T04:42:28.000Z | 2022-03-10T19:25:52.000Z | tools/c7n_mailer/setup.py | tjstansell/cloud-custodian | 830a1131537560e5032bc67e52b66e259630e899 | [
"Apache-2.0"
] | null | null | null | # Automatically generated from poetry/pyproject.toml
# flake8: noqa
# -*- coding: utf-8 -*-
from setuptools import setup
packages = \
['c7n_mailer', 'c7n_mailer.azure_mailer']
package_data = \
{'': ['*'], 'c7n_mailer': ['msg-templates/*']}
install_requires = \
['Jinja2>=3.0,<4.0',
'boto3>=1.11.12,<2.0.0',
'datadog... | 764.890909 | 40,613 | 0.524448 |
from setuptools import setup
packages = \
['c7n_mailer', 'c7n_mailer.azure_mailer']
package_data = \
{'': ['*'], 'c7n_mailer': ['msg-templates/*']}
install_requires = \
['Jinja2>=3.0,<4.0',
'boto3>=1.11.12,<2.0.0',
'datadog>=0.34.0,<0.35.0',
'jsonpatch>=1.25,<2.0',
'jsonpointer>=2.0,<3.0',
'jsonschema>=3.2.0... | true | true |
f74bc1952016b9f6087ff50a16b6035a81ee2815 | 6,347 | py | Python | stomp/adapter/multicast.py | AaronDMarasco/stomp.py | 22f26087baf6206e531f0418125618bf553b3139 | [
"Apache-2.0"
] | null | null | null | stomp/adapter/multicast.py | AaronDMarasco/stomp.py | 22f26087baf6206e531f0418125618bf553b3139 | [
"Apache-2.0"
] | null | null | null | stomp/adapter/multicast.py | AaronDMarasco/stomp.py | 22f26087baf6206e531f0418125618bf553b3139 | [
"Apache-2.0"
] | null | null | null | """Multicast transport for stomp.py.
Obviously not a typical message broker, but convenient if you don't have a broker, but still want to use stomp.py
methods.
"""
import struct
from stomp.connect import BaseConnection
from stomp.protocol import *
from stomp.transport import *
from stomp.utils import *
MCAST_GRP = ... | 35.261111 | 113 | 0.600756 |
import struct
from stomp.connect import BaseConnection
from stomp.protocol import *
from stomp.transport import *
from stomp.utils import *
MCAST_GRP = '224.1.1.1'
MCAST_PORT = 5000
class MulticastTransport(Transport):
def __init__(self, encoding):
Transport.__init__(self, [], False, False, 0.0, 0.0, 0... | true | true |
f74bc2301b6e3b66aebd76da2052726ff352be45 | 1,011 | py | Python | anjou/config.py | donaldacmartin/anjou | 27f35fc6c6a901e2e5093351e7318ddf9dae1519 | [
"MIT"
] | null | null | null | anjou/config.py | donaldacmartin/anjou | 27f35fc6c6a901e2e5093351e7318ddf9dae1519 | [
"MIT"
] | null | null | null | anjou/config.py | donaldacmartin/anjou | 27f35fc6c6a901e2e5093351e7318ddf9dae1519 | [
"MIT"
] | null | null | null | """anjou.config
Reads and parses the configuration YAML.
Functions:
read_config(str) -> dict (throws ConfigException)
"""
from cerberus import Validator
from cerberus.validator import DocumentError
from yaml import safe_load
from anjou.model import CONFIG_SCHEMA, ConfigException
def _is_valid(config: dict) ->... | 27.324324 | 76 | 0.699308 |
from cerberus import Validator
from cerberus.validator import DocumentError
from yaml import safe_load
from anjou.model import CONFIG_SCHEMA, ConfigException
def _is_valid(config: dict) -> bool:
try:
validator = Validator()
return validator.validate(config, CONFIG_SCHEMA)
except DocumentErro... | true | true |
f74bc256a6ac39c2958fc3ff50df3ae3299ce9ec | 4,082 | py | Python | ProjectFiles/bin/Release/2.80/scripts/addons/uv_magic_uv/impl/flip_rotate_impl.py | BlazesRus/Bforartists | 126bdd9e47cc984fd97ba5299bfb92ec5278e754 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | 1 | 2019-07-08T15:51:14.000Z | 2019-07-08T15:51:14.000Z | ProjectFiles/bin/Release/2.80/scripts/addons/uv_magic_uv/impl/flip_rotate_impl.py | BlazesRus/Bforartists | 126bdd9e47cc984fd97ba5299bfb92ec5278e754 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null | ProjectFiles/bin/Release/2.80/scripts/addons/uv_magic_uv/impl/flip_rotate_impl.py | BlazesRus/Bforartists | 126bdd9e47cc984fd97ba5299bfb92ec5278e754 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null | # <pep8-80 compliant>
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# ... | 30.462687 | 76 | 0.562469 |
'MESH':
return False
if context.object.mode != 'EDIT':
return False
for space in context.area.spaces:
if space.type == 'VIEW_3D':
break
else:
return False
return True
def get_uv_layer(ops_obj, bm):
if not bm.loops.layers.uv:
ops_obj... | true | true |
f74bc32183279cfce49aace28f27ea2b52eacb02 | 6,480 | py | Python | mesh.py | weixiong-zheng-berkeley/BART-lite | ead39f757acab936af815352262080318163debb | [
"MIT"
] | null | null | null | mesh.py | weixiong-zheng-berkeley/BART-lite | ead39f757acab936af815352262080318163debb | [
"MIT"
] | null | null | null | mesh.py | weixiong-zheng-berkeley/BART-lite | ead39f757acab936af815352262080318163debb | [
"MIT"
] | null | null | null | import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import numpy as np
class Mesh(object):
def __init__(self, mesh_cells, domain_upper, mat_map):
assert type(mesh_cells) == int, "mesh_cells must be an int"
self._mesh_params = {'x_cell': mesh_cells,
... | 32.4 | 87 | 0.5375 | import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import numpy as np
class Mesh(object):
def __init__(self, mesh_cells, domain_upper, mat_map):
assert type(mesh_cells) == int, "mesh_cells must be an int"
self._mesh_params = {'x_cell': mesh_cells,
... | true | true |
f74bc3e5c81504c386b3c98a9dc3291466581761 | 490 | py | Python | Curso Python/Mundo 1/Modulo3/Desafios/Desafio1/des017.py | catabimbas/Curso-Python | 72549952db77fa9b0ea3746b83f94592e3fdeb30 | [
"MIT"
] | null | null | null | Curso Python/Mundo 1/Modulo3/Desafios/Desafio1/des017.py | catabimbas/Curso-Python | 72549952db77fa9b0ea3746b83f94592e3fdeb30 | [
"MIT"
] | null | null | null | Curso Python/Mundo 1/Modulo3/Desafios/Desafio1/des017.py | catabimbas/Curso-Python | 72549952db77fa9b0ea3746b83f94592e3fdeb30 | [
"MIT"
] | null | null | null | # Meu código
"""
from math import sqrt
co = float(input('Digite um valor pro cateto oposto: '))
ca = float(input('Digite um valor pro cateto adjacente: '))
co2 = co * co
ca2 = ca * ca
rqm = (ca2 + co2)
rq = sqrt(rqm)
print("O valor da hipotenusa é de {:.2f}".format(rq))
"""
# Código do curso
from math import hypot
co =... | 27.222222 | 59 | 0.677551 |
from math import hypot
co = float(input('Comprimento do cateto oposto: '))
ca = float(input('Comprimento do cateto adjacente'))
h1 = hypot(co, ca)
print('A hipotenusa vai medir {:.2f}'.format(h1))
| true | true |
f74bc584fa3f7f842ca2988f55f612e5139f9b02 | 7,270 | py | Python | runtime/test/specs/V1_2/unidirectional_sequence_lstm_1step.mod.py | riscv-android-src/platform-packages-modules-NeuralNetworks | 32a7fbe0cec3a17f9cdd8c6f11d94ae77e30add5 | [
"Apache-2.0"
] | null | null | null | runtime/test/specs/V1_2/unidirectional_sequence_lstm_1step.mod.py | riscv-android-src/platform-packages-modules-NeuralNetworks | 32a7fbe0cec3a17f9cdd8c6f11d94ae77e30add5 | [
"Apache-2.0"
] | null | null | null | runtime/test/specs/V1_2/unidirectional_sequence_lstm_1step.mod.py | riscv-android-src/platform-packages-modules-NeuralNetworks | 32a7fbe0cec3a17f9cdd8c6f11d94ae77e30add5 | [
"Apache-2.0"
] | null | null | null | #
# Copyright (C) 2019 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | 43.795181 | 91 | 0.601376 |
import copy
model = Model()
max_time = 1
n_batch = 2
n_input = 5
n_cell = 4
n_output = 3
input = Input("input", "TENSOR_FLOAT32", "{%d, %d, %d}" % (max_time, n_batch, n_input))
input_to_input_weights = Input("input_to_input_weights", "TENSOR_FLOAT32",
"{%d, %d}" % (... | true | true |
f74bc5edd5925ad3309ec5e6bb22fc3b7efa245d | 14,691 | py | Python | tensorflow/python/training/experimental/loss_scale.py | PaulWang1905/tensorflow | ebf12d22b4801fb8dab5034cc94562bf7cc33fa0 | [
"Apache-2.0"
] | 9 | 2019-12-29T01:47:37.000Z | 2021-12-21T13:47:41.000Z | tensorflow/python/training/experimental/loss_scale.py | PaulWang1905/tensorflow | ebf12d22b4801fb8dab5034cc94562bf7cc33fa0 | [
"Apache-2.0"
] | 1 | 2019-06-18T07:56:15.000Z | 2019-06-18T07:56:15.000Z | tensorflow/python/training/experimental/loss_scale.py | PaulWang1905/tensorflow | ebf12d22b4801fb8dab5034cc94562bf7cc33fa0 | [
"Apache-2.0"
] | 2 | 2021-01-26T08:23:41.000Z | 2021-07-13T16:23:18.000Z | # Copyright 2019 The TensorFlow 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 applica... | 36.91206 | 80 | 0.714791 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import abc
import six
from tensorflow.python.distribute import distribution_strategy_context
from tensorflow.python.distribute import reduce_util
from tensorflow.python.eager import context
from... | true | true |
f74bc697fa71927b9e9ee28d5a097581877b550e | 4,682 | py | Python | styleclip_mapper.py | quickgrid/Chunkmogrify | 998fb965a85e7286ab879086aa33ee93f95e9af4 | [
"MIT"
] | 13 | 2022-01-10T23:35:13.000Z | 2022-03-19T15:49:02.000Z | styleclip_mapper.py | bycloudai/Chunkmogrify | 10fb9ab3eef0fb50cec0e474ab48333032ee3c3b | [
"MIT"
] | null | null | null | styleclip_mapper.py | bycloudai/Chunkmogrify | 10fb9ab3eef0fb50cec0e474ab48333032ee3c3b | [
"MIT"
] | null | null | null | import math
import torch
from torch import nn
from torch.nn import functional as F
from torch.nn import Module
def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5):
rest_dim = [1] * (input.ndim - bias.ndim - 1)
input = input.cuda()
if input.ndim == 3:
return (
F.leaky_r... | 26.908046 | 93 | 0.572832 | import math
import torch
from torch import nn
from torch.nn import functional as F
from torch.nn import Module
def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5):
rest_dim = [1] * (input.ndim - bias.ndim - 1)
input = input.cuda()
if input.ndim == 3:
return (
F.leaky_r... | true | true |
f74bc6d75667c110776222ff403a0e8f56eaf904 | 17,834 | py | Python | collie/metrics.py | RomaKoks/collie_recs | bc8979c8dbf68deefb030336d50f07f788cf1667 | [
"BSD-3-Clause"
] | 13 | 2021-07-14T10:37:24.000Z | 2022-01-24T08:09:18.000Z | collie/metrics.py | RomaKoks/collie_recs | bc8979c8dbf68deefb030336d50f07f788cf1667 | [
"BSD-3-Clause"
] | 18 | 2021-07-13T22:06:11.000Z | 2022-01-27T16:27:37.000Z | collie/metrics.py | RomaKoks/collie_recs | bc8979c8dbf68deefb030336d50f07f788cf1667 | [
"BSD-3-Clause"
] | 11 | 2021-07-14T04:58:49.000Z | 2022-03-05T00:19:22.000Z | from typing import Any, Callable, Iterable, List, Optional, Tuple, Union
import warnings
import numpy as np
import pytorch_lightning
from scipy.sparse import csr_matrix
import torch
from torchmetrics import Metric
from torchmetrics.functional import auroc
from tqdm.auto import tqdm
import collie
from collie.interacti... | 33.148699 | 100 | 0.642593 | from typing import Any, Callable, Iterable, List, Optional, Tuple, Union
import warnings
import numpy as np
import pytorch_lightning
from scipy.sparse import csr_matrix
import torch
from torchmetrics import Metric
from torchmetrics.functional import auroc
from tqdm.auto import tqdm
import collie
from collie.interacti... | true | true |
f74bc794e8189aead66280086bf2852344d77126 | 1,938 | py | Python | OpenCV-Python/Intermediate/Custom Object Detection/objectDetectoin.py | mehulcparikh/ComputerVision | a5928eb00dd7bbec0f31c22b087af5d3c2a5e1dd | [
"MIT"
] | null | null | null | OpenCV-Python/Intermediate/Custom Object Detection/objectDetectoin.py | mehulcparikh/ComputerVision | a5928eb00dd7bbec0f31c22b087af5d3c2a5e1dd | [
"MIT"
] | null | null | null | OpenCV-Python/Intermediate/Custom Object Detection/objectDetectoin.py | mehulcparikh/ComputerVision | a5928eb00dd7bbec0f31c22b087af5d3c2a5e1dd | [
"MIT"
] | 1 | 2021-07-16T05:42:26.000Z | 2021-07-16T05:42:26.000Z | import cv2
################################################################
path = 'haarcascades/haarcascade_frontalface_default.xml' # PATH OF THE CASCADE
cameraNo = 1 # CAMERA NUMBER
objectName = 'Arduino' # OBJECT NAME TO DISPLAY
frameWidth= 640 # DISPLAY WIDTH... | 35.236364 | 89 | 0.603715 | import cv2
| true | true |
f74bc79549bda3c5f451d7162617180e056cf1ad | 941 | py | Python | sa/profiles/Eltex/LTE/get_config.py | prorevizor/noc | 37e44b8afc64318b10699c06a1138eee9e7d6a4e | [
"BSD-3-Clause"
] | 84 | 2017-10-22T11:01:39.000Z | 2022-02-27T03:43:48.000Z | sa/profiles/Eltex/LTE/get_config.py | prorevizor/noc | 37e44b8afc64318b10699c06a1138eee9e7d6a4e | [
"BSD-3-Clause"
] | 22 | 2017-12-11T07:21:56.000Z | 2021-09-23T02:53:50.000Z | sa/profiles/Eltex/LTE/get_config.py | prorevizor/noc | 37e44b8afc64318b10699c06a1138eee9e7d6a4e | [
"BSD-3-Clause"
] | 23 | 2017-12-06T06:59:52.000Z | 2022-02-24T00:02:25.000Z | # ---------------------------------------------------------------------
# Eltex.LTE.get_config
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# NOC module... | 33.607143 | 80 | 0.462274 |
from noc.core.script.base import BaseScript
from noc.sa.interfaces.igetconfig import IGetConfig
class Script(BaseScript):
name = "Eltex.LTE.get_config"
interface = IGetConfig
def execute_cli(self, **kwargs):
with self.profile.switch(self):
conf = self.cli("show running-config"... | true | true |
f74bc958ff9049dd0b620bdaae52e4f34c7db349 | 2,162 | py | Python | rpn/create_dataset/motion_planners/rrt_connect.py | cy5e/RPN | a45a6eb132489d565d8c28dcd441fbd4a2aa9be8 | [
"MIT"
] | null | null | null | rpn/create_dataset/motion_planners/rrt_connect.py | cy5e/RPN | a45a6eb132489d565d8c28dcd441fbd4a2aa9be8 | [
"MIT"
] | null | null | null | rpn/create_dataset/motion_planners/rrt_connect.py | cy5e/RPN | a45a6eb132489d565d8c28dcd441fbd4a2aa9be8 | [
"MIT"
] | null | null | null | from .smoothing import smooth_path
from .rrt import TreeNode, configs
from .utils import irange, argmin, RRT_ITERATIONS, RRT_RESTARTS, RRT_SMOOTHING
def rrt_connect(q1, q2, distance, sample, extend, collision, iterations=RRT_ITERATIONS):
if collision(q1) or collision(q2):
return None
root1, root2 = Tr... | 33.78125 | 88 | 0.599907 | from .smoothing import smooth_path
from .rrt import TreeNode, configs
from .utils import irange, argmin, RRT_ITERATIONS, RRT_RESTARTS, RRT_SMOOTHING
def rrt_connect(q1, q2, distance, sample, extend, collision, iterations=RRT_ITERATIONS):
if collision(q1) or collision(q2):
return None
root1, root2 = Tr... | true | true |
f74bca3e225f60a21d329b3d25b2768235ba98a8 | 5,510 | py | Python | reading-datastore-backups/dsexport/crc32c.py | davidwtbuxton/google-cloud-demos | 50cef03efc86c075a2a2e4b7f614586137ac97b0 | [
"Apache-2.0"
] | null | null | null | reading-datastore-backups/dsexport/crc32c.py | davidwtbuxton/google-cloud-demos | 50cef03efc86c075a2a2e4b7f614586137ac97b0 | [
"Apache-2.0"
] | null | null | null | reading-datastore-backups/dsexport/crc32c.py | davidwtbuxton/google-cloud-demos | 50cef03efc86c075a2a2e4b7f614586137ac97b0 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 33.192771 | 80 | 0.742105 |
import array
CRC_TABLE = (
0x00000000, 0xf26b8303, 0xe13b70f7, 0x1350f3f4,
0xc79a971f, 0x35f1141c, 0x26a1e7e8, 0xd4ca64eb,
0x8ad958cf, 0x78b2dbcc, 0x6be22838, 0x9989ab3b,
0x4d43cfd0, 0xbf284cd3, 0xac78bf27, 0x5e133c24,
0x105ec76f, 0xe235446c, 0xf165b798, 0x030e349b,
0xd... | true | true |
f74bca5dd25b9d571c23f42faebb11252995b56c | 1,119 | py | Python | main/codeSamples/DataStructures/graph.py | JKUATSES/dataStructuresAlgorithms | 3989994e807fe74d33f6dfb6652633db5fc0c9b0 | [
"MIT"
] | null | null | null | main/codeSamples/DataStructures/graph.py | JKUATSES/dataStructuresAlgorithms | 3989994e807fe74d33f6dfb6652633db5fc0c9b0 | [
"MIT"
] | 1 | 2021-10-30T11:21:31.000Z | 2021-10-30T11:21:31.000Z | main/codeSamples/DataStructures/graph.py | JKUATSES/dataStructuresAlgorithms | 3989994e807fe74d33f6dfb6652633db5fc0c9b0 | [
"MIT"
] | null | null | null | class Graph:
graph_dict={}
def addEdge(self,node,neighbour):
if node not in self.graph_dict:
self.graph_dict[node]=[neighbour]
else:
self.graph_dict[node].append(neighbour)
def show_edges(self):
for node in self.graph_dict:
... | 26.023256 | 55 | 0.50849 | class Graph:
graph_dict={}
def addEdge(self,node,neighbour):
if node not in self.graph_dict:
self.graph_dict[node]=[neighbour]
else:
self.graph_dict[node].append(neighbour)
def show_edges(self):
for node in self.graph_dict:
... | true | true |
f74bcb05e4f6f81ea227d282c717279b6d38cb2a | 1,571 | py | Python | biostar/accounts/migrations/0011_logger.py | Oribyne/biostar-central-fork | 89a459bc66d438518cf968c3f2e3ce1f50573b9e | [
"MIT"
] | 477 | 2015-01-01T00:18:54.000Z | 2022-03-21T10:29:29.000Z | biostar/accounts/migrations/0011_logger.py | coreydipsy/biostar-central | 2b2f09199a6332877885ef54d9ac588ed0765770 | [
"MIT"
] | 247 | 2015-01-02T08:12:03.000Z | 2022-02-24T15:20:58.000Z | biostar/accounts/migrations/0011_logger.py | coreydipsy/biostar-central | 2b2f09199a6332877885ef54d9ac588ed0765770 | [
"MIT"
] | 251 | 2015-01-01T16:05:57.000Z | 2022-03-25T21:32:44.000Z | # Generated by Django 2.2.7 on 2020-01-23 23:37
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('accounts', '0010_watched... | 42.459459 | 251 | 0.590707 |
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('accounts', '0010_watched_tags'),
]
operations = [
migr... | true | true |
f74bcd5ba44dec5443b293f83896a801e3d87b46 | 387 | py | Python | website/games/wsgi.py | KiOui/bussen | 8d7d222ebd6eef9a008258456987ccc0490e4d67 | [
"MIT"
] | null | null | null | website/games/wsgi.py | KiOui/bussen | 8d7d222ebd6eef9a008258456987ccc0490e4d67 | [
"MIT"
] | null | null | null | website/games/wsgi.py | KiOui/bussen | 8d7d222ebd6eef9a008258456987ccc0490e4d67 | [
"MIT"
] | null | null | null | """
WSGI config for games project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTING... | 22.764706 | 78 | 0.782946 |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "games.settings")
application = get_wsgi_application()
| true | true |
f74bce29fa5725538d6b43fe81ed9c4921d1e50c | 4,295 | py | Python | backend/api/models.py | guillaumevincent/iswn | d539fbd1c933da0516bc26e79037bb3f812fe2fb | [
"MIT"
] | null | null | null | backend/api/models.py | guillaumevincent/iswn | d539fbd1c933da0516bc26e79037bb3f812fe2fb | [
"MIT"
] | null | null | null | backend/api/models.py | guillaumevincent/iswn | d539fbd1c933da0516bc26e79037bb3f812fe2fb | [
"MIT"
] | null | null | null | import uuid
from django.db import models
from django.contrib.auth.models import (
BaseUserManager, AbstractBaseUser
)
from django.db.models.signals import post_save
class MyUserManager(BaseUserManager):
def create_user(self, email, password=None):
if not email:
raise ValueError('Users must... | 29.217687 | 98 | 0.687544 | import uuid
from django.db import models
from django.contrib.auth.models import (
BaseUserManager, AbstractBaseUser
)
from django.db.models.signals import post_save
class MyUserManager(BaseUserManager):
def create_user(self, email, password=None):
if not email:
raise ValueError('Users must... | true | true |
f74bcea9ca5c760856a4a0cd5cba00c3a50473b0 | 568 | py | Python | primo.py | MrInternauta/Python-apuntes | c001c8f055955091af7f995ab2fd53b3c9d11a57 | [
"MIT"
] | null | null | null | primo.py | MrInternauta/Python-apuntes | c001c8f055955091af7f995ab2fd53b3c9d11a57 | [
"MIT"
] | null | null | null | primo.py | MrInternauta/Python-apuntes | c001c8f055955091af7f995ab2fd53b3c9d11a57 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
def run():
number = int(raw_input('Ingresa un numero: '))
state = is_prime(number)
if state == True:
print('Es primo')
else:
print('No es primo')
def is_prime(number):
if number < 2:
return False
elif number == 2:
return True
elif numb... | 21.037037 | 50 | 0.492958 |
def run():
number = int(raw_input('Ingresa un numero: '))
state = is_prime(number)
if state == True:
print('Es primo')
else:
print('No es primo')
def is_prime(number):
if number < 2:
return False
elif number == 2:
return True
elif number > 2 and number % 2 =... | true | true |
f74bceb2687b918249ccc13a682b5c07ef3b2c04 | 1,231 | py | Python | src/wxExtra/logpanel.py | Derfies/panda3d-editor | 66a271c248b53f6b57d93cc0d2a7b4cbb0d37e4c | [
"MIT"
] | 43 | 2015-01-29T12:28:21.000Z | 2022-02-27T09:06:36.000Z | src/wxExtra/logpanel.py | Derfies/panda3d-editor | 66a271c248b53f6b57d93cc0d2a7b4cbb0d37e4c | [
"MIT"
] | 2 | 2022-02-15T01:26:35.000Z | 2022-02-15T19:34:10.000Z | src/wxExtra/logpanel.py | Derfies/panda3d-editor | 66a271c248b53f6b57d93cc0d2a7b4cbb0d37e4c | [
"MIT"
] | 19 | 2015-02-25T16:24:29.000Z | 2022-02-23T07:52:17.000Z | import logging
import wx
class LogPanel(wx.Panel):
"""
Simple wxPanel containing a text control which will display the root
logger's stream.
"""
class CustomConsoleHandler(logging.StreamHandler):
def __init__(self, text_ctrl, *args, **kwargs):
super().__init__(*args, *... | 27.977273 | 77 | 0.610073 | import logging
import wx
class LogPanel(wx.Panel):
class CustomConsoleHandler(logging.StreamHandler):
def __init__(self, text_ctrl, *args, **kwargs):
super().__init__(*args, **kwargs)
self.text_ctrl = text_ctrl
def emit(self, record):
msg = self.format... | true | true |
f74bd084e2ec0281ff856c34a75c853453b15ce0 | 449 | py | Python | test_haystack/test_app_using_appconfig/tests.py | sgaist/django-haystack | 471706a46d1c0d81ad4be5b8d7fd86d055dbe0f1 | [
"BSD-3-Clause"
] | 1 | 2019-04-21T17:23:23.000Z | 2019-04-21T17:23:23.000Z | test_haystack/test_app_using_appconfig/tests.py | sgaist/django-haystack | 471706a46d1c0d81ad4be5b8d7fd86d055dbe0f1 | [
"BSD-3-Clause"
] | 4 | 2015-09-25T13:14:49.000Z | 2020-04-24T19:56:19.000Z | test_haystack/test_app_using_appconfig/tests.py | sgaist/django-haystack | 471706a46d1c0d81ad4be5b8d7fd86d055dbe0f1 | [
"BSD-3-Clause"
] | 1 | 2019-07-22T14:24:11.000Z | 2019-07-22T14:24:11.000Z | # encoding: utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
from django.test import TestCase
from .models import MicroBlogPost
class AppConfigTests(TestCase):
def test_index_collection(self):
from haystack import connections
unified_index = connections[... | 24.944444 | 82 | 0.761693 |
from __future__ import absolute_import, division, print_function, unicode_literals
from django.test import TestCase
from .models import MicroBlogPost
class AppConfigTests(TestCase):
def test_index_collection(self):
from haystack import connections
unified_index = connections['default'].get_un... | true | true |
f74bd12d7d4e22137523ec857496b79106d59c37 | 4,636 | py | Python | test/test_md019.py | jackdewinter/pymarkdown | 7ae408ba0b24506fa07552ffe520750bbff38c53 | [
"MIT"
] | 20 | 2021-01-14T17:39:09.000Z | 2022-03-14T08:35:22.000Z | test/test_md019.py | jackdewinter/pymarkdown | 7ae408ba0b24506fa07552ffe520750bbff38c53 | [
"MIT"
] | 304 | 2020-08-15T23:24:00.000Z | 2022-03-31T23:34:03.000Z | test/test_md019.py | jackdewinter/pymarkdown | 7ae408ba0b24506fa07552ffe520750bbff38c53 | [
"MIT"
] | 3 | 2021-08-11T10:26:26.000Z | 2021-11-02T20:41:27.000Z | """
Module to provide tests related to the MD019 rule.
"""
from test.markdown_scanner import MarkdownScanner
import pytest
# pylint: disable=too-many-lines
@pytest.mark.rules
def test_md019_good_single_spacing():
"""
Test to make sure this rule does not trigger with a document that
contains an Atx Headi... | 28.617284 | 109 | 0.690035 | from test.markdown_scanner import MarkdownScanner
import pytest
@pytest.mark.rules
def test_md019_good_single_spacing():
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md019/single_spacing.md",
]
expected_return_code = 0
expected_output =... | true | true |
f74bd1e625ba2a1ef8849f7948361e4d8d607b03 | 2,175 | py | Python | src/pipeline/validation/loocv/bagging_logistic_regression.py | RausellLab/tiresias | 2acca303a0f6b4b1be784f597a59c1a883dbe43d | [
"Apache-2.0"
] | 6 | 2019-07-03T16:11:15.000Z | 2021-07-12T18:42:44.000Z | src/pipeline/validation/loocv/bagging_logistic_regression.py | RausellLab/tiresias | 2acca303a0f6b4b1be784f597a59c1a883dbe43d | [
"Apache-2.0"
] | null | null | null | src/pipeline/validation/loocv/bagging_logistic_regression.py | RausellLab/tiresias | 2acca303a0f6b4b1be784f597a59c1a883dbe43d | [
"Apache-2.0"
] | 5 | 2019-10-16T09:40:58.000Z | 2020-01-30T20:32:49.000Z | import ray
import mlflow
import torch
from src.models import Bagging
from src.models import LogisticRegression
from src.evaluation import loocv
from src.utils import data_loaders
from src.utils import data_savers
from src.utils import mlflow as u_mlflow
RUN_NAME = "Bagging Logistic Regression"
MODEL_NAME = "bagging-l... | 31.071429 | 85 | 0.662069 | import ray
import mlflow
import torch
from src.models import Bagging
from src.models import LogisticRegression
from src.evaluation import loocv
from src.utils import data_loaders
from src.utils import data_savers
from src.utils import mlflow as u_mlflow
RUN_NAME = "Bagging Logistic Regression"
MODEL_NAME = "bagging-l... | true | true |
f74bd1fe3afe67ec44bf89577577b15d5af67c71 | 7,119 | py | Python | kerasy/initializers.py | iwasakishuto/Keras-Imitation | 8ac0cd7c8912d49d13b19a0182ad534c0781fbfe | [
"MIT"
] | 4 | 2020-04-25T08:50:36.000Z | 2020-04-26T04:49:16.000Z | kerasy/initializers.py | iwasakishuto/Keras-Imitation | 8ac0cd7c8912d49d13b19a0182ad534c0781fbfe | [
"MIT"
] | null | null | null | kerasy/initializers.py | iwasakishuto/Keras-Imitation | 8ac0cd7c8912d49d13b19a0182ad534c0781fbfe | [
"MIT"
] | null | null | null | # coding: utf-8
import re
import numpy as np
from scipy import stats
from abc import ABCMeta, abstractmethod
from .utils import mk_class_get
from .utils import handleKeyError
from .utils import handleRandomState
class KerasyAbstInitializer(metaclass=ABCMeta):
def __init__(self):
self.name = re.sub(r"([a-z... | 35.068966 | 102 | 0.613007 |
import re
import numpy as np
from scipy import stats
from abc import ABCMeta, abstractmethod
from .utils import mk_class_get
from .utils import handleKeyError
from .utils import handleRandomState
class KerasyAbstInitializer(metaclass=ABCMeta):
def __init__(self):
self.name = re.sub(r"([a-z])([A-Z])", r"\... | true | true |
f74bd296354288d8bb977b9299a8c55a8605514e | 1,367 | py | Python | app/esper/caption_metadata.py | DanFu09/esper | ccc5547de3637728b8aaab059b6781baebc269ec | [
"Apache-2.0"
] | 4 | 2018-12-27T07:21:38.000Z | 2019-01-04T10:35:02.000Z | app/esper/caption_metadata.py | DanFu09/esper | ccc5547de3637728b8aaab059b6781baebc269ec | [
"Apache-2.0"
] | null | null | null | app/esper/caption_metadata.py | DanFu09/esper | ccc5547de3637728b8aaab059b6781baebc269ec | [
"Apache-2.0"
] | null | null | null | from operator import itemgetter, attrgetter
from query.models import Video
from esper.prelude import collect
from rekall.interval_list import Interval, IntervalList
import os
import json
import re
CAPTION_METADATA_DIR = '/app/data/subs/meta'
def clean_speaker(speaker):
speaker = speaker.lower()
speaker = re.s... | 39.057143 | 204 | 0.625457 | from operator import itemgetter, attrgetter
from query.models import Video
from esper.prelude import collect
from rekall.interval_list import Interval, IntervalList
import os
import json
import re
CAPTION_METADATA_DIR = '/app/data/subs/meta'
def clean_speaker(speaker):
speaker = speaker.lower()
speaker = re.s... | true | true |
f74bd2be6117b394c1ad74affa44e0f66e398293 | 13,471 | py | Python | mindmappings/costModel/timeloop/model_cnn.py | kartik-hegde/mindmappings | e96f2a287da2a93c4af0794a3bab1211bc95ba0a | [
"MIT"
] | 17 | 2021-03-30T07:11:44.000Z | 2022-03-08T11:06:39.000Z | mindmappings/costModel/timeloop/model_cnn.py | kartik-hegde/mindmappings | e96f2a287da2a93c4af0794a3bab1211bc95ba0a | [
"MIT"
] | 1 | 2022-01-12T03:20:31.000Z | 2022-01-30T17:24:30.000Z | mindmappings/costModel/timeloop/model_cnn.py | kartik-hegde/mindmappings | e96f2a287da2a93c4af0794a3bab1211bc95ba0a | [
"MIT"
] | 4 | 2021-05-25T00:30:41.000Z | 2022-02-09T13:57:21.000Z | import random
import itertools
import subprocess as sp
import os
import shutil
from subprocess import STDOUT
import os, sys
import numpy as np
from mindmappings.parameters import Parameters
from mindmappings.costModel.timeloop.timeloop import Timeloop
from mindmappings.utils.utils import factors, replicate
examples = ... | 42.22884 | 139 | 0.584738 | import random
import itertools
import subprocess as sp
import os
import shutil
from subprocess import STDOUT
import os, sys
import numpy as np
from mindmappings.parameters import Parameters
from mindmappings.costModel.timeloop.timeloop import Timeloop
from mindmappings.utils.utils import factors, replicate
examples = ... | true | true |
f74bd3e6890ab791f72de5b1af4dc31306531daf | 9,712 | py | Python | twisted/python/logfile.py | ioggstream/twisted | 34f9b1e3f097685839000c656332c66ee85be5d8 | [
"Unlicense",
"MIT"
] | 3 | 2018-11-25T01:09:55.000Z | 2021-08-24T01:56:36.000Z | twisted/python/logfile.py | ioggstream/twisted | 34f9b1e3f097685839000c656332c66ee85be5d8 | [
"Unlicense",
"MIT"
] | 1 | 2022-03-04T17:40:22.000Z | 2022-03-04T17:40:22.000Z | twisted/python/logfile.py | ioggstream/twisted | 34f9b1e3f097685839000c656332c66ee85be5d8 | [
"Unlicense",
"MIT"
] | 3 | 2018-11-09T03:38:09.000Z | 2020-02-24T06:26:10.000Z | # -*- test-case-name: twisted.test.test_logfile -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
A rotating, browsable log file.
"""
# System Imports
import os, glob, time, stat
from twisted.python import threadable
class BaseLogFile:
"""
The base class for a log file that ... | 29.975309 | 86 | 0.57187 |
import os, glob, time, stat
from twisted.python import threadable
class BaseLogFile:
synchronized = ["write", "rotate"]
def __init__(self, name, directory, defaultMode=None):
self.directory = directory
self.name = name
self.path = os.path.join(directory, name)
if def... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.