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 958k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f717953473fd5d44045b712a4f139e641a8c661b | 27,730 | py | Python | InstallOpenface/fix_sklearn/label.py | s123600g/openfaceInstallscript | 962b4b89c5626318b5701d7297d49df3423b0fe4 | [
"MIT"
] | null | null | null | InstallOpenface/fix_sklearn/label.py | s123600g/openfaceInstallscript | 962b4b89c5626318b5701d7297d49df3423b0fe4 | [
"MIT"
] | null | null | null | InstallOpenface/fix_sklearn/label.py | s123600g/openfaceInstallscript | 962b4b89c5626318b5701d7297d49df3423b0fe4 | [
"MIT"
] | null | null | null | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Olivier Grisel <olivier.grisel@ensta.org>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# Joel Nothman <joel.nothman@gmail.com>
# Hamzeh Alsalhi <ha258@cornell.edu>
# Licens... | 33.329327 | 87 | 0.588136 |
from collections import defaultdict
import itertools
import array
import numpy as np
import scipy.sparse as sp
from ..base import BaseEstimator, TransformerMixin
from ..utils.fixes import sparse_min_max
from ..utils import column_or_1d
from ..utils.validation import check_array
from ..utils.validation import check_... | true | true |
f71795db955b211e36055a00f084863a0bec4fd7 | 2,307 | py | Python | third_party/webrtc/src/chromium/src/tools/perf/metrics/network.py | bopopescu/webrtc-streaming-node | 727a441204344ff596401b0253caac372b714d91 | [
"MIT"
] | 20 | 2015-08-26T06:46:00.000Z | 2019-02-27T09:05:58.000Z | third_party/webrtc/src/chromium/src/tools/perf/metrics/network.py | bopopescu/webrtc-streaming-node | 727a441204344ff596401b0253caac372b714d91 | [
"MIT"
] | 1 | 2021-05-05T11:11:31.000Z | 2021-05-05T11:11:31.000Z | third_party/webrtc/src/chromium/src/tools/perf/metrics/network.py | bopopescu/webrtc-streaming-node | 727a441204344ff596401b0253caac372b714d91 | [
"MIT"
] | 7 | 2016-02-09T09:28:14.000Z | 2020-07-25T19:03:36.000Z | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.value import scalar
from metrics import Metric
NETWORK_DATA_NOT_FOUND = 'Network data could not be found.'
# This is experimental. crbug.... | 33.434783 | 79 | 0.715648 |
from telemetry.value import scalar
from metrics import Metric
NETWORK_DATA_NOT_FOUND = 'Network data could not be found.'
class NetworkMetric(Metric):
def __init__(self, platform):
super(NetworkMetric, self).__init__()
self._network_snd = None
self._network_rcv = None
self._platform = platform
... | true | true |
f71796820dbd5571d7b35348bcdbcfdd286b0af9 | 13,935 | py | Python | utils.py | ravana69/MusicPlayer-1 | 70feb663579c6be63b0e4481bdfd6b41ffe51110 | [
"MIT"
] | 1 | 2021-07-27T04:27:13.000Z | 2021-07-27T04:27:13.000Z | utils.py | ravana69/MusicPlayer-1 | 70feb663579c6be63b0e4481bdfd6b41ffe51110 | [
"MIT"
] | null | null | null | utils.py | ravana69/MusicPlayer-1 | 70feb663579c6be63b0e4481bdfd6b41ffe51110 | [
"MIT"
] | 1 | 2021-09-17T03:43:21.000Z | 2021-09-17T03:43:21.000Z | #MIT License
#Copyright (c) 2021 SUBIN
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distr... | 34.32266 | 158 | 0.560603 |
import os
from config import Config
import ffmpeg
from pyrogram import emoji
from pyrogram.methods.messages.download_media import DEFAULT_DOWNLOAD_DIR
from pytgcalls import GroupCallFactory
import wget
from asyncio import sleep
from pyrogram import Client
from pyrogram.utils import MAX_CHANNEL_ID
from youtube_dl im... | true | true |
f7179710e50c234d4e503175eb8befff0a20a20a | 221 | py | Python | Zadaniy/zadanie2.py | Dmitry-15/8_laba | f72089ebd16bc890efbfaaee1114fcf3a26d3caf | [
"MIT"
] | null | null | null | Zadaniy/zadanie2.py | Dmitry-15/8_laba | f72089ebd16bc890efbfaaee1114fcf3a26d3caf | [
"MIT"
] | null | null | null | Zadaniy/zadanie2.py | Dmitry-15/8_laba | f72089ebd16bc890efbfaaee1114fcf3a26d3caf | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
words = {
1: 'one',
2: 'two',
3: 'three',
4: 'four'
}
dict_items = words.items()
new_words = dict(zip(words.values(), words.keys()))
print(new_words)
| 11.05 | 51 | 0.542986 |
words = {
1: 'one',
2: 'two',
3: 'three',
4: 'four'
}
dict_items = words.items()
new_words = dict(zip(words.values(), words.keys()))
print(new_words)
| true | true |
f71797118e1465fafc143bceac6272f0b436e3c9 | 9,129 | py | Python | python/ngraph_bridge/__init__.in.py | avijit-chakroborty/ngraph-bridge | b691d57412a40582ea93c6e564d80c750b7f2e8e | [
"Apache-2.0"
] | null | null | null | python/ngraph_bridge/__init__.in.py | avijit-chakroborty/ngraph-bridge | b691d57412a40582ea93c6e564d80c750b7f2e8e | [
"Apache-2.0"
] | null | null | null | python/ngraph_bridge/__init__.in.py | avijit-chakroborty/ngraph-bridge | b691d57412a40582ea93c6e564d80c750b7f2e8e | [
"Apache-2.0"
] | null | null | null | # ==============================================================================
# Copyright 2018-2020 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://ww... | 41.684932 | 131 | 0.6969 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import importlib
import os
import sys
import time
import getpass
from platform import system
import numpy as np
import tensorflow as tf
tf.compat.v1.disable_eager_execution()
from tensorflow.core.framework i... | false | true |
f71797e9f253734c08819653230015e46d247936 | 1,856 | py | Python | a3/clean_data.py | CornellDataScience/IntSys-Education | bcd1e519af59a03a1062b8dc2c538231752147de | [
"MIT"
] | 1 | 2021-12-02T21:23:35.000Z | 2021-12-02T21:23:35.000Z | a3/clean_data.py | CornellDataScience/IntSys-Education | bcd1e519af59a03a1062b8dc2c538231752147de | [
"MIT"
] | null | null | null | a3/clean_data.py | CornellDataScience/IntSys-Education | bcd1e519af59a03a1062b8dc2c538231752147de | [
"MIT"
] | 12 | 2020-03-03T00:36:10.000Z | 2021-11-30T19:16:38.000Z | import pickle
import numpy as np
from PIL import Image
def load_pickle_file(path_to_file):
"""
Loads the data from a pickle file and returns that object
"""
## Look up: https://docs.python.org/3/library/pickle.html
## The code should look something like this:
# with open(path_to_file, 'rb') as... | 40.347826 | 94 | 0.72306 | import pickle
import numpy as np
from PIL import Image
def load_pickle_file(path_to_file):
pass
## cleaning datasets and visualising them, so we purposely won't give you too much starter
## That being said, the task shouldn't be too hard, so we won't send you down any rabbit hole.
if __... | true | true |
f71797fd5d4ce71e2b817579238f917ae5a8107c | 623 | py | Python | setup.py | kmedian/pdtweak | 27955bb6bb9c5d14eb9126846bb31a945be10245 | [
"MIT"
] | null | null | null | setup.py | kmedian/pdtweak | 27955bb6bb9c5d14eb9126846bb31a945be10245 | [
"MIT"
] | null | null | null | setup.py | kmedian/pdtweak | 27955bb6bb9c5d14eb9126846bb31a945be10245 | [
"MIT"
] | null | null | null | from setuptools import setup
def read(fname):
import os
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(name='pdtweak',
version='0.1.1',
description='pandas utility functions',
long_description=read('README.md'),
long_description_content_type='text/markdown',... | 25.958333 | 70 | 0.626003 | from setuptools import setup
def read(fname):
import os
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(name='pdtweak',
version='0.1.1',
description='pandas utility functions',
long_description=read('README.md'),
long_description_content_type='text/markdown',... | true | true |
f717984864aea902725da624719b1fb9774e58e4 | 6,794 | py | Python | library/f5bigip_ltm_monitor_mssql.py | erjac77/ansible-role-f5 | c45b5d9d5f34a8ac6d19ded836d0a6b7ee7f8056 | [
"Apache-2.0"
] | 1 | 2020-02-21T06:48:14.000Z | 2020-02-21T06:48:14.000Z | library/f5bigip_ltm_monitor_mssql.py | erjac77/ansible-role-f5 | c45b5d9d5f34a8ac6d19ded836d0a6b7ee7f8056 | [
"Apache-2.0"
] | null | null | null | library/f5bigip_ltm_monitor_mssql.py | erjac77/ansible-role-f5 | c45b5d9d5f34a8ac6d19ded836d0a6b7ee7f8056 | [
"Apache-2.0"
] | 1 | 2021-03-29T03:55:34.000Z | 2021-03-29T03:55:34.000Z | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2016 Eric Jacob <erjac77@gmail.com>
#
# 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
#... | 35.570681 | 120 | 0.662644 |
ANSIBLE_METADATA = {
"metadata_version": "1.1",
"status": ["preview"],
"supported_by": "community",
}
DOCUMENTATION = """
---
module: f5bigip_ltm_monitor_mssql
short_description: BIG-IP ltm monitor mssql module
description:
- Configures a Microsoft Windows Structured Query Language (MSSQL) monitor.
v... | true | true |
f7179886d96e9c4fe729b281b4c4f32c905628b2 | 1,086 | py | Python | test_1_lineral/personTest.py | NoOneZero/Neuro | a3cf1e2a701ee0096f093d332237dc30f8f83a50 | [
"Apache-2.0"
] | null | null | null | test_1_lineral/personTest.py | NoOneZero/Neuro | a3cf1e2a701ee0096f093d332237dc30f8f83a50 | [
"Apache-2.0"
] | null | null | null | test_1_lineral/personTest.py | NoOneZero/Neuro | a3cf1e2a701ee0096f093d332237dc30f8f83a50 | [
"Apache-2.0"
] | null | null | null | from common.person import Person
from random import randint
class PersonTest(Person):
def __init__(self, position: list = [0, 0], color: list = [255, 255, 255], size: int = 20, default_position_range=None) -> None:
self.color2 = [randint(2, 50), randint(100, 200), randint(10,50)]
self.color3 = [ra... | 51.714286 | 132 | 0.639963 | from common.person import Person
from random import randint
class PersonTest(Person):
def __init__(self, position: list = [0, 0], color: list = [255, 255, 255], size: int = 20, default_position_range=None) -> None:
self.color2 = [randint(2, 50), randint(100, 200), randint(10,50)]
self.color3 = [ra... | true | true |
f717991fd1d5e7f5581e44f8809e73280ace6c29 | 530 | py | Python | infra/apps/catalog/migrations/0005_node.py | datosgobar/infra.datos.gob.ar | 9f6ae7f0fc741aad79d074e7b2eb2a7dddf8b2cf | [
"MIT"
] | 1 | 2019-07-01T19:38:52.000Z | 2019-07-01T19:38:52.000Z | infra/apps/catalog/migrations/0005_node.py | datosgobar/infra.datos.gob.ar | 9f6ae7f0fc741aad79d074e7b2eb2a7dddf8b2cf | [
"MIT"
] | 77 | 2019-05-27T18:16:30.000Z | 2021-09-20T21:25:24.000Z | infra/apps/catalog/migrations/0005_node.py | datosgobar/infra.datos.gob.ar | 9f6ae7f0fc741aad79d074e7b2eb2a7dddf8b2cf | [
"MIT"
] | 3 | 2019-12-09T16:38:18.000Z | 2020-10-30T02:10:20.000Z | # Generated by Django 2.2.2 on 2019-07-18 13:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('catalog', '0004_auto_20190718_1315'),
]
operations = [
migrations.CreateModel(
name='Node',
fields=[
... | 25.238095 | 114 | 0.586792 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('catalog', '0004_auto_20190718_1315'),
]
operations = [
migrations.CreateModel(
name='Node',
fields=[
('id', models.AutoField(auto_created=True, prim... | true | true |
f71799bb2d2c6c8ba977cf1ec8011ac88bd817c0 | 8,867 | py | Python | infra/ci/build.py | DarthFudd/oss-fuzz | 35e7ac7e18cf87b58dd7d1bf88b1f9846adb92db | [
"Apache-2.0"
] | 1 | 2021-02-22T11:57:12.000Z | 2021-02-22T11:57:12.000Z | infra/ci/build.py | DarthFudd/oss-fuzz | 35e7ac7e18cf87b58dd7d1bf88b1f9846adb92db | [
"Apache-2.0"
] | null | null | null | infra/ci/build.py | DarthFudd/oss-fuzz | 35e7ac7e18cf87b58dd7d1bf88b1f9846adb92db | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# Copyright 2019 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 or... | 33.714829 | 80 | 0.721101 |
from __future__ import print_function
import enum
import os
import re
import sys
import subprocess
import yaml
CANARY_PROJECT = 'skcms'
DEFAULT_ARCHITECTURES = ['x86_64']
DEFAULT_ENGINES = ['afl', 'honggfuzz', 'libfuzzer']
DEFAULT_SANITIZERS = ['address', 'undefined']
LANGUAGES_WITH_COVERAGE_SUPPORT = ['c', 'c++',... | true | true |
f7179a9aff5fcbff9e7d9219b960c35806a5e4f8 | 2,214 | py | Python | generate_embeddings.py | yangfengKAUST/cnn-text-classification-tf | 5f552df9887e57a4bc5638b3d36d7393254d2644 | [
"Apache-2.0"
] | null | null | null | generate_embeddings.py | yangfengKAUST/cnn-text-classification-tf | 5f552df9887e57a4bc5638b3d36d7393254d2644 | [
"Apache-2.0"
] | null | null | null | generate_embeddings.py | yangfengKAUST/cnn-text-classification-tf | 5f552df9887e57a4bc5638b3d36d7393254d2644 | [
"Apache-2.0"
] | null | null | null | import numpy as np
import pickle
import argparse
import re
"""
Convert pre-trained Glove embeddings into npy file
Run using:
python3 generate_embeddings.py -d data/glove.6B.300d.txt --npy_output data/embeddings.npy --dict_output data/vocab.pckl --dict_whitelist data/polaritydata.vocab
"""
def parse_args():
parser... | 29.131579 | 160 | 0.590786 | import numpy as np
import pickle
import argparse
import re
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('--dataset', '-d', type=str, required=True)
parser.add_argument('--npy_output', type=str, required=True)
parser.add_argument('--dict_output', type=str, required=True)
... | true | true |
f7179ad7cc757ce856fb3920524110f510a8a74a | 2,256 | py | Python | SWIM-Executables/Windows/pyinstaller-2.0 for windows/PyInstaller/hooks/django-import-finder.py | alexsigaras/SWIM | 1a35df8acb26bdcb307a1b8f60e9feba68ed1715 | [
"MIT"
] | 47 | 2020-03-08T08:43:28.000Z | 2022-03-18T18:51:55.000Z | SWIM-Executables/Windows/pyinstaller-2.0 for windows/PyInstaller/hooks/django-import-finder.py | alexsigaras/SWIM | 1a35df8acb26bdcb307a1b8f60e9feba68ed1715 | [
"MIT"
] | null | null | null | SWIM-Executables/Windows/pyinstaller-2.0 for windows/PyInstaller/hooks/django-import-finder.py | alexsigaras/SWIM | 1a35df8acb26bdcb307a1b8f60e9feba68ed1715 | [
"MIT"
] | 16 | 2020-03-08T08:43:30.000Z | 2022-01-10T22:05:57.000Z | # Copyright (C) 2009, Lorenzo Berni
# Based on previous work under copyright (c) 2001, 2002 McMillan Enterprises, Inc.
#
# 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... | 38.237288 | 96 | 0.724734 |
import os
import PyInstaller.compat as compat
from hookutils import logger
if not compat.getenv("DJANGO_SETTINGS_MODULE"):
compat.setenv("DJANGO_SETTINGS_MODULE", "settings")
from django.conf import settings
hiddenimports = (list(settings.AUTHENTICATION_BACKENDS) +
[settings.DEFAULT_FILE_STORA... | true | true |
f7179b68d16205b5ace838040622bc3f19f99fa8 | 10,342 | py | Python | src/.history/Test/HiwinRT605_test_20190619131630.py | SamKaiYang/2019_Hiwin_Shaking | d599f8c87dc4da89eae266990d12eb3a8b0f3e16 | [
"MIT"
] | null | null | null | src/.history/Test/HiwinRT605_test_20190619131630.py | SamKaiYang/2019_Hiwin_Shaking | d599f8c87dc4da89eae266990d12eb3a8b0f3e16 | [
"MIT"
] | null | null | null | src/.history/Test/HiwinRT605_test_20190619131630.py | SamKaiYang/2019_Hiwin_Shaking | d599f8c87dc4da89eae266990d12eb3a8b0f3e16 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# license removed for brevity
#策略 機械手臂 四點來回跑
import rospy
import os
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv import *
from ROS_Socket.msg import *
import math
import enum
import Hiwin_RT605_ROS as ArmTask
pos_feedback_times = 0
mode_feedback_times = 0
msg_feedback ... | 30.871642 | 145 | 0.579288 | import rospy
import os
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv import *
from ROS_Socket.msg import *
import math
import enum
import Hiwin_RT605_ROS as ArmTask
pos_feedback_times = 0
mode_feedback_times = 0
msg_feedback = 1
Arm_state_flag = 0
Strategy_flag = 0
arm_move_times = 1
def Arm... | true | true |
f7179b7c95704c49d4aaa9e728e5e82df649b8d6 | 596 | py | Python | configs/revbifpn/fcn_s1_512x1024_120k_cityscapes.py | gupta-abhay/mmsegmentation | 03e80db237d12b4d049fe65c6612f2bc741f8135 | [
"Apache-2.0"
] | null | null | null | configs/revbifpn/fcn_s1_512x1024_120k_cityscapes.py | gupta-abhay/mmsegmentation | 03e80db237d12b4d049fe65c6612f2bc741f8135 | [
"Apache-2.0"
] | null | null | null | configs/revbifpn/fcn_s1_512x1024_120k_cityscapes.py | gupta-abhay/mmsegmentation | 03e80db237d12b4d049fe65c6612f2bc741f8135 | [
"Apache-2.0"
] | null | null | null | _base_ = [
'../_base_/models/fcn_hr18.py',
'../_base_/datasets/cityscapes.py',
'../_base_/default_runtime.py',
'../_base_/schedules/schedule_120k.py',
]
model = dict(
pretrained=None,
backbone=dict(
type='RevBiFPN_S',
arch='revbifpn_s1',
strict=False,
classes=Non... | 23.84 | 72 | 0.567114 | _base_ = [
'../_base_/models/fcn_hr18.py',
'../_base_/datasets/cityscapes.py',
'../_base_/default_runtime.py',
'../_base_/schedules/schedule_120k.py',
]
model = dict(
pretrained=None,
backbone=dict(
type='RevBiFPN_S',
arch='revbifpn_s1',
strict=False,
classes=Non... | true | true |
f7179e36f8aee9aeb3010facd15317bf9a7987b3 | 1,075 | py | Python | fewshot/data/compress_tiered_imagenet.py | renmengye/inc-few-shot-attractor-public | c560d5a81480cb22d903fa746ab0cfc2eb964e4c | [
"MIT"
] | 122 | 2019-09-20T05:35:29.000Z | 2022-03-22T06:30:33.000Z | fewshot/data/compress_tiered_imagenet.py | renmengye/inc-few-shot-attractor-public | c560d5a81480cb22d903fa746ab0cfc2eb964e4c | [
"MIT"
] | 10 | 2019-11-10T10:24:06.000Z | 2021-10-06T13:13:26.000Z | fewshot/data/compress_tiered_imagenet.py | renmengye/inc-few-shot-attractor-public | c560d5a81480cb22d903fa746ab0cfc2eb964e4c | [
"MIT"
] | 28 | 2019-10-21T11:38:06.000Z | 2022-01-26T16:55:28.000Z | import cv2
import numpy as np
import six
import sys
import pickle as pkl
from tqdm import tqdm
def compress(path, output):
with np.load(path, mmap_mode="r", encoding='latin1') as data:
images = data["images"]
array = []
for ii in tqdm(six.moves.xrange(images.shape[0]), desc='compress'):
im = imag... | 23.888889 | 71 | 0.633488 | import cv2
import numpy as np
import six
import sys
import pickle as pkl
from tqdm import tqdm
def compress(path, output):
with np.load(path, mmap_mode="r", encoding='latin1') as data:
images = data["images"]
array = []
for ii in tqdm(six.moves.xrange(images.shape[0]), desc='compress'):
im = imag... | true | true |
f7179eb378b819138f77c19337426397d15ce820 | 10,249 | py | Python | rl4net/envs/power_allocation/test_pa_rb_env.py | bupt-ipcr/RL4Net | b1b694361c688f5e0055148a0cdcb4c6253cd7bd | [
"MIT"
] | 17 | 2020-03-19T02:51:48.000Z | 2021-06-15T00:42:29.000Z | vvlab/envs/power_allocation/test_pa_rb_env.py | LampV/Reinforcement-Learning | 0652b9e8c2de428d3508074c6fd640cc14f84a2c | [
"MIT"
] | 13 | 2021-04-05T13:10:25.000Z | 2022-03-12T00:51:15.000Z | rl4net/envs/power_allocation/test_pa_rb_env.py | bupt-ipcr/RL4Net | b1b694361c688f5e0055148a0cdcb4c6253cd7bd | [
"MIT"
] | 12 | 2020-03-31T05:29:25.000Z | 2022-03-08T11:54:07.000Z | from .pa_rb_env import (
PAEnv,
Node
)
import numpy as np
from pathlib import Path
log2 = np.log2
cues = {
0: Node(0.1, 0, 'cue'),
1: Node(-0.1, 0, 'cue'),
}
devices = {
0: {
't_device': Node(0, 0.5, 't_device'),
'r_devices': {
0: Node(0, 0.6, 'r_device')
}
... | 30.502976 | 89 | 0.530296 | from .pa_rb_env import (
PAEnv,
Node
)
import numpy as np
from pathlib import Path
log2 = np.log2
cues = {
0: Node(0.1, 0, 'cue'),
1: Node(-0.1, 0, 'cue'),
}
devices = {
0: {
't_device': Node(0, 0.5, 't_device'),
'r_devices': {
0: Node(0, 0.6, 'r_device')
}
... | true | true |
f717a0e970b2703e99561e27a1e128a2f7e5f983 | 488 | py | Python | tests/testFlip.py | FrankRogalski/Riccchard | 8a1abf6855f874f71df9d101e15c1968394ab38e | [
"MIT"
] | null | null | null | tests/testFlip.py | FrankRogalski/Riccchard | 8a1abf6855f874f71df9d101e15c1968394ab38e | [
"MIT"
] | null | null | null | tests/testFlip.py | FrankRogalski/Riccchard | 8a1abf6855f874f71df9d101e15c1968394ab38e | [
"MIT"
] | null | null | null | import unittest
import commands.flip as flip
import pandas as pd
class TestFlip(unittest.TestCase):
def test_use(self):
cycles = 50000
series = pd.Series(flip.use(None) for _ in range(cycles))
self.assertAlmostEqual(len(series[series == "Heads"]) / cycles, 0.4998, delta=0.01)
self.a... | 44.363636 | 91 | 0.67623 | import unittest
import commands.flip as flip
import pandas as pd
class TestFlip(unittest.TestCase):
def test_use(self):
cycles = 50000
series = pd.Series(flip.use(None) for _ in range(cycles))
self.assertAlmostEqual(len(series[series == "Heads"]) / cycles, 0.4998, delta=0.01)
self.a... | true | true |
f717a0f6acd973f0aa1fdd12d14ebe4d62f6382a | 714 | py | Python | src/detection/dataset/__init__.py | inzva/Traffic-Anomaly-Detection | 09bbfd55f5d375832afcc1994d3b549082830594 | [
"MIT"
] | 4 | 2020-05-31T13:19:58.000Z | 2021-03-11T18:51:06.000Z | src/detection/dataset/__init__.py | inzva/Traffic-Anomaly-Detection | 09bbfd55f5d375832afcc1994d3b549082830594 | [
"MIT"
] | null | null | null | src/detection/dataset/__init__.py | inzva/Traffic-Anomaly-Detection | 09bbfd55f5d375832afcc1994d3b549082830594 | [
"MIT"
] | 3 | 2020-05-31T13:19:58.000Z | 2021-03-16T08:43:23.000Z | 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... | 42 | 96 | 0.802521 | 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 |
f717a12c03c3130be9f4f39624e011168ba2f2d9 | 419 | py | Python | opencv_py/opencv_morphology/blackhat_operation.py | yinleiCoder/interesting-python | 8448b0731870feed033d845c085576a7d4a3154b | [
"Apache-2.0"
] | null | null | null | opencv_py/opencv_morphology/blackhat_operation.py | yinleiCoder/interesting-python | 8448b0731870feed033d845c085576a7d4a3154b | [
"Apache-2.0"
] | null | null | null | opencv_py/opencv_morphology/blackhat_operation.py | yinleiCoder/interesting-python | 8448b0731870feed033d845c085576a7d4a3154b | [
"Apache-2.0"
] | null | null | null | import cv2
import numpy as np
"""
黑帽:
黑帽= 原图 - 闭运算
morphologyEx(img, MORPH_BLACKHAT, kernel)
保留噪点
"""
img = cv2.imread(r'E:\PycharmProjects\funnyPython\opencv_py\data\imgs\dotinj.png')
# kernel = np.ones((7, 7), np.uint8)# 手动创建
kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (7, 7))
print(kernel)
res = cv2.morpholo... | 23.277778 | 82 | 0.725537 | import cv2
import numpy as np
img = cv2.imread(r'E:\PycharmProjects\funnyPython\opencv_py\data\imgs\dotinj.png')
kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (7, 7))
print(kernel)
res = cv2.morphologyEx(img, cv2.MORPH_BLACKHAT, kernel)
cv2.imshow('img', img)
cv2.imshow('res', res)
cv2.waitKey(0) | true | true |
f717a22f1c27c859185f0569c6622ab8d155e4ac | 1,915 | py | Python | src/trainer.py | Chicco94/crypto-bot | edbc22477544a25d8eb0c90cdd5f03345f11db68 | [
"MIT"
] | null | null | null | src/trainer.py | Chicco94/crypto-bot | edbc22477544a25d8eb0c90cdd5f03345f11db68 | [
"MIT"
] | null | null | null | src/trainer.py | Chicco94/crypto-bot | edbc22477544a25d8eb0c90cdd5f03345f11db68 | [
"MIT"
] | null | null | null | from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
import pandas as pd
import sqlalchemy
from config.config import symbol,backward_steps
import joblib
from df_functions import *
def prepare_single_dataset(df,remove_from_heads:int,remove_from_tails:int,label:int):
... | 33.017241 | 85 | 0.681462 | from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
import pandas as pd
import sqlalchemy
from config.config import symbol,backward_steps
import joblib
from df_functions import *
def prepare_single_dataset(df,remove_from_heads:int,remove_from_tails:int,label:int):
... | true | true |
f717a46b3c38e7a991236ce1bb31333e778f6d48 | 300 | py | Python | backend/app/main.py | alldevic/base-fastapi-postgresql | 7e3a2916910155cd83b10cd7fec42eba7b1d3a95 | [
"MIT"
] | 3 | 2021-06-17T00:06:15.000Z | 2022-01-26T03:53:51.000Z | backend/app/main.py | alldevic/base-fastapi-postgresql | 7e3a2916910155cd83b10cd7fec42eba7b1d3a95 | [
"MIT"
] | null | null | null | backend/app/main.py | alldevic/base-fastapi-postgresql | 7e3a2916910155cd83b10cd7fec42eba7b1d3a95 | [
"MIT"
] | null | null | null | from .routes.users import router as user_router
from .application import app
import sys
sys.path.extend(["./"])
ROUTERS = (user_router,)
for r in ROUTERS:
app.include_router(r)
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8888, log_level="info")
| 16.666667 | 65 | 0.693333 | from .routes.users import router as user_router
from .application import app
import sys
sys.path.extend(["./"])
ROUTERS = (user_router,)
for r in ROUTERS:
app.include_router(r)
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8888, log_level="info")
| true | true |
f717a4b4672f82239831e0aa4b03a4aaca187963 | 11,669 | py | Python | tests/test_storage.py | civviGH/otterwiki | 2ef84aa31f48da144cb0ef7a0116106b982f41d2 | [
"MIT"
] | 3 | 2018-07-15T20:20:31.000Z | 2022-01-09T07:41:39.000Z | tests/test_storage.py | civviGH/otterwiki | 2ef84aa31f48da144cb0ef7a0116106b982f41d2 | [
"MIT"
] | 3 | 2018-07-04T21:38:41.000Z | 2022-03-06T17:03:23.000Z | tests/test_storage.py | civviGH/otterwiki | 2ef84aa31f48da144cb0ef7a0116106b982f41d2 | [
"MIT"
] | 2 | 2021-04-29T13:17:56.000Z | 2022-03-07T09:17:19.000Z | #!/usr/bin/env python
import tempfile
import unittest
from pprint import pprint
import otterwiki.storage
class TestStorage(unittest.TestCase):
def setUp(self):
self.tempdir = tempfile.TemporaryDirectory()
self.path = '/tmp/xxx' # self.tempdir.name
self.path = self.tempdir.name
se... | 43.70412 | 115 | 0.646756 |
import tempfile
import unittest
from pprint import pprint
import otterwiki.storage
class TestStorage(unittest.TestCase):
def setUp(self):
self.tempdir = tempfile.TemporaryDirectory()
self.path = '/tmp/xxx' self.path = self.tempdir.name
self.storage = otterwiki.storage.GitStorage(... | true | true |
f717a54cab0f7211990d1d0fff0102426e318378 | 4,412 | py | Python | TTY_Utils/StatusLine.py | paul-ollis/cleversheep3 | 86e6ca76ea4e8524f16e2348d38484dcfafb07d0 | [
"Apache-2.0"
] | null | null | null | TTY_Utils/StatusLine.py | paul-ollis/cleversheep3 | 86e6ca76ea4e8524f16e2348d38484dcfafb07d0 | [
"Apache-2.0"
] | null | null | null | TTY_Utils/StatusLine.py | paul-ollis/cleversheep3 | 86e6ca76ea4e8524f16e2348d38484dcfafb07d0 | [
"Apache-2.0"
] | null | null | null | import sys
import time
from cleversheep3.TTY_Utils import RichTerm, registerForWinch
class Status:
"""A fairly general purpose status line for a simple terminal.
"""
def __init__(self, startActive=True):
self.setTerm(RichTerm.RichTerminal(sys.stdout))
self.spinner = None
self.pre... | 29.026316 | 75 | 0.486174 | import sys
import time
from cleversheep3.TTY_Utils import RichTerm, registerForWinch
class Status:
def __init__(self, startActive=True):
self.setTerm(RichTerm.RichTerminal(sys.stdout))
self.spinner = None
self.prevLine = None
self.leftFields = []
self.leftFieldsByName = {}... | true | true |
f717a6a6f7df269ba5f932fb06f6150bdffcbc05 | 2,958 | py | Python | etk/unit_tests/test_filter_results.py | linqyd/etk | dcf0cae4076619f5261573d47b4f5f26baaf15b7 | [
"MIT"
] | null | null | null | etk/unit_tests/test_filter_results.py | linqyd/etk | dcf0cae4076619f5261573d47b4f5f26baaf15b7 | [
"MIT"
] | null | null | null | etk/unit_tests/test_filter_results.py | linqyd/etk | dcf0cae4076619f5261573d47b4f5f26baaf15b7 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import unittest
import sys, os
sys.path.append('../../')
from etk.core import Core
import json
import codecs
class TestExtractionsFilterResults(unittest.TestCase):
def test_filter_results(self):
doc = {
"url":"http:www.testurl.com",
"doc_id": "19B0EAB211CD... | 36.518519 | 129 | 0.373563 | import unittest
import sys, os
sys.path.append('../../')
from etk.core import Core
import json
import codecs
class TestExtractionsFilterResults(unittest.TestCase):
def test_filter_results(self):
doc = {
"url":"http:www.testurl.com",
"doc_id": "19B0EAB211CD1D3C63063FAB0B2937043EA1... | true | true |
f717a6c9a05c6c18f54f5308390fe72e04c86105 | 10,727 | py | Python | dataset/cs_labels.py | ChunGaoY/DSPnet | 8fad61059d85ad0cd1f7790c37b5e0478dccb158 | [
"MIT"
] | 33 | 2018-04-18T06:52:16.000Z | 2021-09-26T20:57:56.000Z | dataset/cs_labels.py | ChunGaoY/DSPnet | 8fad61059d85ad0cd1f7790c37b5e0478dccb158 | [
"MIT"
] | 4 | 2018-07-09T07:09:15.000Z | 2020-04-12T12:43:36.000Z | dataset/cs_labels.py | liangfu/dspnet | 8fad61059d85ad0cd1f7790c37b5e0478dccb158 | [
"MIT"
] | 10 | 2018-04-19T08:17:01.000Z | 2021-09-26T20:57:57.000Z | #!/usr/bin/python
#
# Cityscapes labels
#
from collections import namedtuple
#--------------------------------------------------------------------------------
# Definitions
#--------------------------------------------------------------------------------
# a label and all meta information
Label = namedtuple( 'Label... | 58.617486 | 199 | 0.430223 |
from collections import namedtuple
Label = namedtuple( 'Label' , [
'name' ,
'id' ,
'trainId' , ... | true | true |
f717a7d323d2826aa7fc0c90ce4ba34258907b10 | 1,050 | py | Python | 0301-0400/0391-Perfect Rectangle/0391-Perfect Rectangle.py | jiadaizhao/LeetCode | 4ddea0a532fe7c5d053ffbd6870174ec99fc2d60 | [
"MIT"
] | 49 | 2018-05-05T02:53:10.000Z | 2022-03-30T12:08:09.000Z | 0301-0400/0391-Perfect Rectangle/0391-Perfect Rectangle.py | jolly-fellow/LeetCode | ab20b3ec137ed05fad1edda1c30db04ab355486f | [
"MIT"
] | 11 | 2017-12-15T22:31:44.000Z | 2020-10-02T12:42:49.000Z | 0301-0400/0391-Perfect Rectangle/0391-Perfect Rectangle.py | jolly-fellow/LeetCode | ab20b3ec137ed05fad1edda1c30db04ab355486f | [
"MIT"
] | 28 | 2017-12-05T10:56:51.000Z | 2022-01-26T18:18:27.000Z | import math
class Solution:
def isRectangleCover(self, rectangles: 'List[List[int]]') -> 'bool':
area = 0
x1 = y1 = math.inf
x2 = y2 = -math.inf
table = set()
for rec in rectangles:
x1 = min(x1, rec[0])
y1 = min(y1, rec[1])
x2 = max(x2, rec... | 37.5 | 93 | 0.414286 | import math
class Solution:
def isRectangleCover(self, rectangles: 'List[List[int]]') -> 'bool':
area = 0
x1 = y1 = math.inf
x2 = y2 = -math.inf
table = set()
for rec in rectangles:
x1 = min(x1, rec[0])
y1 = min(y1, rec[1])
x2 = max(x2, rec... | true | true |
f717a8e5702adf2484d162a384d9cd7e1c5d590d | 2,944 | py | Python | tests/test_sftp.py | lfbos/qftplib | 2a1b79c7f36cc2dfd139a7a3d179fb23f7c6dc1f | [
"MIT"
] | null | null | null | tests/test_sftp.py | lfbos/qftplib | 2a1b79c7f36cc2dfd139a7a3d179fb23f7c6dc1f | [
"MIT"
] | null | null | null | tests/test_sftp.py | lfbos/qftplib | 2a1b79c7f36cc2dfd139a7a3d179fb23f7c6dc1f | [
"MIT"
] | null | null | null | import os
import tempfile
import time
import unittest
from qftplib.client import FTPClient
class FTPTest(unittest.TestCase):
host = os.environ.get('SFTP_HOST_TEST')
user = os.environ.get('SFTP_USER_TEST')
password = os.environ.get('SFTP_PASS_TEST')
dir = os.environ.get('SFTP_DIR_TEST')
port = 22
... | 35.047619 | 117 | 0.605978 | import os
import tempfile
import time
import unittest
from qftplib.client import FTPClient
class FTPTest(unittest.TestCase):
host = os.environ.get('SFTP_HOST_TEST')
user = os.environ.get('SFTP_USER_TEST')
password = os.environ.get('SFTP_PASS_TEST')
dir = os.environ.get('SFTP_DIR_TEST')
port = 22
... | true | true |
f717a96bf2f36b05dfb39bd231a309d8afe03392 | 723 | py | Python | django-rest-framework-quick-start/tutorial/quickstart/views.py | madhikarma/python-django-demo | d18ca7e25d01f12813cd6e011ae253e792ac2d03 | [
"MIT"
] | null | null | null | django-rest-framework-quick-start/tutorial/quickstart/views.py | madhikarma/python-django-demo | d18ca7e25d01f12813cd6e011ae253e792ac2d03 | [
"MIT"
] | null | null | null | django-rest-framework-quick-start/tutorial/quickstart/views.py | madhikarma/python-django-demo | d18ca7e25d01f12813cd6e011ae253e792ac2d03 | [
"MIT"
] | null | null | null | from django.contrib.auth.models import User, Group
from rest_framework import viewsets
from rest_framework import permissions
from tutorial.quickstart.serializers import UserSerializer, GroupSerializer
class UserViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows users to be viewed or edited.
"""... | 31.434783 | 75 | 0.763485 | from django.contrib.auth.models import User, Group
from rest_framework import viewsets
from rest_framework import permissions
from tutorial.quickstart.serializers import UserSerializer, GroupSerializer
class UserViewSet(viewsets.ModelViewSet):
queryset = User.objects.all().order_by('-date_joined')
serializer_... | true | true |
f717a97ac0ae713afc793d70fe3a8c677d331876 | 767 | py | Python | yatube/posts/migrations/0004_auto_20210318_1753.py | Rusich90/yatube | 8593443fe64b0422b2ebbedc9966d347a668e0a3 | [
"BSD-3-Clause"
] | 1 | 2021-06-06T11:15:57.000Z | 2021-06-06T11:15:57.000Z | yatube/posts/migrations/0004_auto_20210318_1753.py | Rusich90/yatube | 8593443fe64b0422b2ebbedc9966d347a668e0a3 | [
"BSD-3-Clause"
] | null | null | null | yatube/posts/migrations/0004_auto_20210318_1753.py | Rusich90/yatube | 8593443fe64b0422b2ebbedc9966d347a668e0a3 | [
"BSD-3-Clause"
] | 1 | 2021-06-06T11:15:58.000Z | 2021-06-06T11:15:58.000Z | # Generated by Django 2.2 on 2021-03-18 17:53
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('posts', '0003_auto_20210307_1711'),
]
operations = [
migrations.AlterField(
model_name='post',
... | 30.68 | 222 | 0.636245 |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('posts', '0003_auto_20210307_1711'),
]
operations = [
migrations.AlterField(
model_name='post',
name='group',
field=mode... | true | true |
f717aa4a2dd6cc01429db2f797d20ef18a428275 | 8,080 | py | Python | neutron/services/trunk/rpc/server.py | knodir/neutron | ac4e28478ac8a8a0c9f5c5785f6a6bcf532c66b8 | [
"Apache-2.0"
] | null | null | null | neutron/services/trunk/rpc/server.py | knodir/neutron | ac4e28478ac8a8a0c9f5c5785f6a6bcf532c66b8 | [
"Apache-2.0"
] | 5 | 2019-08-14T06:46:03.000Z | 2021-12-13T20:01:25.000Z | neutron/services/trunk/rpc/server.py | knodir/neutron | ac4e28478ac8a8a0c9f5c5785f6a6bcf532c66b8 | [
"Apache-2.0"
] | 2 | 2020-03-15T01:24:15.000Z | 2020-07-22T20:34:26.000Z | # Copyright 2016 Hewlett Packard Enterprise Development LP
#
# 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... | 41.865285 | 78 | 0.664604 |
import collections
from neutron_lib.api.definitions import portbindings
from neutron_lib.db import api as db_api
from neutron_lib.plugins import directory
from neutron_lib import rpc as n_rpc
from oslo_log import helpers as log_helpers
from oslo_log import log as logging
import oslo_messaging
from neutron.api.rpc.ca... | true | true |
f717aaa141f06ebfe41236718707dffb420687d5 | 11,262 | py | Python | mars/worker/service.py | wdkwyf/mars | 3f750e360e64380eab779301a5103994d4886b6a | [
"Apache-2.0"
] | null | null | null | mars/worker/service.py | wdkwyf/mars | 3f750e360e64380eab779301a5103994d4886b6a | [
"Apache-2.0"
] | null | null | null | mars/worker/service.py | wdkwyf/mars | 3f750e360e64380eab779301a5103994d4886b6a | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright 1999-2018 Alibaba Group Holding Ltd.
#
# 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 require... | 42.659091 | 109 | 0.665335 |
import os
import logging
try:
from pyarrow import plasma
except ImportError: plasma = None
from ..config import options
from .. import resource
from ..utils import parse_readable_size, readable_size
from ..compat import six
from .status import StatusActor
from .quota import QuotaActor, MemQuotaActor
from .c... | true | true |
f717ac92ce24bf53f59cb78906005b06e6b861f3 | 483 | py | Python | final_project/machinetranslation/tests/test_translator.py | BrunoYH/xzceb-flask_eng_fr | a86a32ef56fcae1a8a9e281f17eb73dca05aec10 | [
"Apache-2.0"
] | null | null | null | final_project/machinetranslation/tests/test_translator.py | BrunoYH/xzceb-flask_eng_fr | a86a32ef56fcae1a8a9e281f17eb73dca05aec10 | [
"Apache-2.0"
] | null | null | null | final_project/machinetranslation/tests/test_translator.py | BrunoYH/xzceb-flask_eng_fr | a86a32ef56fcae1a8a9e281f17eb73dca05aec10 | [
"Apache-2.0"
] | null | null | null | import unittest
from translator import english_to_french, french_to_english
class TestEnglishToFrench(unittest.TestCase):
def testE2F(self):
self.assertEqual(english_to_french("Hello"), "Bonjour")
self.assertNotEqual(english_to_french("Null"), "")
class FrenchEnglishToEnglish(unittest.TestCase):... | 30.1875 | 63 | 0.73913 | import unittest
from translator import english_to_french, french_to_english
class TestEnglishToFrench(unittest.TestCase):
def testE2F(self):
self.assertEqual(english_to_french("Hello"), "Bonjour")
self.assertNotEqual(english_to_french("Null"), "")
class FrenchEnglishToEnglish(unittest.TestCase):... | true | true |
f717ad7f8ee5170fed096dfbfb9360232cb0abc4 | 157,342 | py | Python | tests/test_cadquery.py | RubenRubens/cadquery | 94030ad5e4d5489b29cb021282ecc8db34172471 | [
"Apache-2.0"
] | 1 | 2021-09-01T20:16:29.000Z | 2021-09-01T20:16:29.000Z | tests/test_cadquery.py | RubenRubens/cadquery | 94030ad5e4d5489b29cb021282ecc8db34172471 | [
"Apache-2.0"
] | null | null | null | tests/test_cadquery.py | RubenRubens/cadquery | 94030ad5e4d5489b29cb021282ecc8db34172471 | [
"Apache-2.0"
] | null | null | null | """
This module tests cadquery creation and manipulation functions
"""
# system modules
import math, os.path, time, tempfile
from random import choice
from random import random
from random import randrange
from itertools import product
from pytest import approx, raises
# my modules
from cadquery import *
from c... | 33.749893 | 164 | 0.528441 | import math, os.path, time, tempfile
from random import choice
from random import random
from random import randrange
from itertools import product
from pytest import approx, raises
from cadquery import *
from cadquery import exporters
from cadquery import occ_impl
from tests import (
BaseTest,
writeStringTo... | true | true |
f717ae14e4c0f23eb4e044fafbe02e361dc9be71 | 6,397 | py | Python | src/datadog_api_client/v2/model/incident_service_update_data.py | DataDog/datadog-api-client-python | de2fc57dbde9acf4b8c8eef94ac29911227a62a2 | [
"Apache-2.0"
] | 32 | 2021-01-07T15:09:56.000Z | 2022-01-30T05:49:23.000Z | src/datadog_api_client/v2/model/incident_service_update_data.py | DataDog/datadog-api-client-python | de2fc57dbde9acf4b8c8eef94ac29911227a62a2 | [
"Apache-2.0"
] | 228 | 2020-09-03T14:03:54.000Z | 2022-03-31T20:16:12.000Z | src/datadog_api_client/v2/model/incident_service_update_data.py | DataDog/datadog-api-client-python | de2fc57dbde9acf4b8c8eef94ac29911227a62a2 | [
"Apache-2.0"
] | 12 | 2020-09-15T21:36:03.000Z | 2022-03-31T17:13:17.000Z | # Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from datadog_api_client.v2.model_utils import ( # noqa: F401
ApiTypeError,
Mo... | 41.810458 | 110 | 0.612318 |
from datadog_api_client.v2.model_utils import ( ApiTypeError,
ModelComposed,
ModelNormal,
ModelSimple,
cached_property,
change_keys_js_to_python,
convert_js_args_to_python_args,
date,
datetime,
file_type,
none_type,
)
def lazy_import():
from datadog_api_client.v2.mod... | true | true |
f717ae4b52146d6d410534878463dfe84c747e04 | 1,598 | py | Python | configs/lesa/lesa_mask_rcnn_r50_dconv_c3-c5_8x1_20e.py | Chenglin-Yang/LESA_detection | 3238bd9c6f3eb4a2a746837043cd9b3b56c77216 | [
"Apache-2.0"
] | 4 | 2021-07-18T08:09:09.000Z | 2022-01-06T06:19:00.000Z | configs/lesa/lesa_mask_rcnn_r50_dconv_c3-c5_8x1_20e.py | Chenglin-Yang/LESA_detection | 3238bd9c6f3eb4a2a746837043cd9b3b56c77216 | [
"Apache-2.0"
] | null | null | null | configs/lesa/lesa_mask_rcnn_r50_dconv_c3-c5_8x1_20e.py | Chenglin-Yang/LESA_detection | 3238bd9c6f3eb4a2a746837043cd9b3b56c77216 | [
"Apache-2.0"
] | 1 | 2022-01-06T06:18:53.000Z | 2022-01-06T06:18:53.000Z | _base_ = [
'../_base_/models/mask_rcnn_r50_fpn.py',
'../_base_/datasets/coco_instance_1024.py',
'../_base_/schedules/schedule_20e.py',
'../_base_/default_runtime.py',
]
optimizer = dict(lr=0.01)
model = dict(
pretrained=\
'./checkpoints/lesa_pretrained_imagenet/'+\
'lesa_resnet50_pre... | 28.535714 | 98 | 0.570088 | _base_ = [
'../_base_/models/mask_rcnn_r50_fpn.py',
'../_base_/datasets/coco_instance_1024.py',
'../_base_/schedules/schedule_20e.py',
'../_base_/default_runtime.py',
]
optimizer = dict(lr=0.01)
model = dict(
pretrained=\
'./checkpoints/lesa_pretrained_imagenet/'+\
'lesa_resnet50_pre... | true | true |
f717aeda2009266b9983c6e194696efc982f1189 | 1,312 | py | Python | injectable/testing/clear_injectables_util.py | mt3o/injectable | 0ffc5c758b63d9391134cd822158e1846999b404 | [
"MIT"
] | 71 | 2018-02-05T04:12:27.000Z | 2022-02-15T23:08:16.000Z | injectable/testing/clear_injectables_util.py | Euraxluo/injectable | 74e640f0911480fb06fa97c1a468c3863541c0fd | [
"MIT"
] | 104 | 2018-02-06T23:37:36.000Z | 2021-08-25T04:50:15.000Z | injectable/testing/clear_injectables_util.py | Euraxluo/injectable | 74e640f0911480fb06fa97c1a468c3863541c0fd | [
"MIT"
] | 13 | 2019-02-10T18:52:50.000Z | 2022-01-26T17:12:35.000Z | from typing import Union, Set
from injectable import InjectionContainer
from injectable.common_utils import get_dependency_name
from injectable.container.injectable import Injectable
from injectable.constants import DEFAULT_NAMESPACE
def clear_injectables(
dependency: Union[type, str], namespace: str = None
) ->... | 36.444444 | 86 | 0.747713 | from typing import Union, Set
from injectable import InjectionContainer
from injectable.common_utils import get_dependency_name
from injectable.container.injectable import Injectable
from injectable.constants import DEFAULT_NAMESPACE
def clear_injectables(
dependency: Union[type, str], namespace: str = None
) ->... | true | true |
f717afa83d677a0b51cae1b85b8a1bc081942f7a | 5,143 | py | Python | setup.py | lead-ratings/python-nvd3 | 2e677886d7b36f3aca641bbb2cc1117c3589b849 | [
"MIT"
] | null | null | null | setup.py | lead-ratings/python-nvd3 | 2e677886d7b36f3aca641bbb2cc1117c3589b849 | [
"MIT"
] | null | null | null | setup.py | lead-ratings/python-nvd3 | 2e677886d7b36f3aca641bbb2cc1117c3589b849 | [
"MIT"
] | null | null | null | #! /usr/bin/env python
# coding=utf-8
import os
from setuptools import setup, find_packages
from fnmatch import fnmatchcase
from distutils.util import convert_path
def read(*parts):
return open(os.path.join(os.path.dirname(__file__), *parts)).read()
# Provided as an attribute, so you can append to these instea... | 36.735714 | 88 | 0.569512 |
import os
from setuptools import setup, find_packages
from fnmatch import fnmatchcase
from distutils.util import convert_path
def read(*parts):
return open(os.path.join(os.path.dirname(__file__), *parts)).read()
standard_exclude = ('*.py', '*.pyc', '*$py.class', '*~', '.*', '*.bak')
standard_exclude_directorie... | true | true |
f717afcac3389e0e78ff975905922f94ec7b01ce | 55,864 | py | Python | lib/arrow/arrow.py | matke-84/script.module.arrow | 7aa0903bc846541e4d620f10aca52957ba1e0e5b | [
"Apache-2.0"
] | null | null | null | lib/arrow/arrow.py | matke-84/script.module.arrow | 7aa0903bc846541e4d620f10aca52957ba1e0e5b | [
"Apache-2.0"
] | null | null | null | lib/arrow/arrow.py | matke-84/script.module.arrow | 7aa0903bc846541e4d620f10aca52957ba1e0e5b | [
"Apache-2.0"
] | null | null | null | """
Provides the :class:`Arrow <arrow.arrow.Arrow>` class, an enhanced ``datetime``
replacement.
"""
import calendar
import sys
from datetime import date
from datetime import datetime as dt_datetime
from datetime import time as dt_time
from datetime import timedelta
from datetime import tzinfo as dt_tzinfo
from math... | 32.47907 | 132 | 0.551751 |
import calendar
import sys
from datetime import date
from datetime import datetime as dt_datetime
from datetime import time as dt_time
from datetime import timedelta
from datetime import tzinfo as dt_tzinfo
from math import trunc
from time import struct_time
from typing import (
Any,
ClassVar,
Generator,
... | true | true |
f717aff2b542befa776d914dfd5cc573bbed5908 | 2,681 | py | Python | make/photon/prepare/main.py | gaohuag/harbor | ebe2df06c84c3b6be33901e71d9bf14e80a4c003 | [
"Apache-2.0"
] | 1 | 2019-10-24T07:11:38.000Z | 2019-10-24T07:11:38.000Z | make/photon/prepare/main.py | gaohuag/harbor | ebe2df06c84c3b6be33901e71d9bf14e80a4c003 | [
"Apache-2.0"
] | null | null | null | make/photon/prepare/main.py | gaohuag/harbor | ebe2df06c84c3b6be33901e71d9bf14e80a4c003 | [
"Apache-2.0"
] | null | null | null | # pylint: disable=no-value-for-parameter
import click
from utils.misc import delfile
from utils.configs import validate, parse_yaml_config
from utils.cert import prepare_ca, SSL_CERT_KEY_PATH, SSL_CERT_PATH, get_secret_key
from utils.db import prepare_db
from utils.jobservice import prepare_job_service
from utils.reg... | 40.621212 | 128 | 0.806043 |
import click
from utils.misc import delfile
from utils.configs import validate, parse_yaml_config
from utils.cert import prepare_ca, SSL_CERT_KEY_PATH, SSL_CERT_PATH, get_secret_key
from utils.db import prepare_db
from utils.jobservice import prepare_job_service
from utils.registry import prepare_registry
from utils.... | true | true |
f717b0f7dc65a5798b28471eda50f0d297865349 | 3,637 | py | Python | dendropy/dataio/nexmlyielder.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 5668b5785296b314ea1321057420bcd077dba9ea | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | dendropy/dataio/nexmlyielder.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 5668b5785296b314ea1321057420bcd077dba9ea | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | dendropy/dataio/nexmlyielder.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 5668b5785296b314ea1321057420bcd077dba9ea | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | #! /usr/bin/env python
##############################################################################
## DendroPy Phylogenetic Computing Library.
##
## Copyright 2010-2015 Jeet Sukumaran and Mark T. Holder.
## All rights reserved.
##
## See "LICENSE.rst" for terms and conditions of usage.
##
## If you use this wo... | 40.865169 | 103 | 0.607369 |
import sys
if not (sys.version_info.major >= 3 and sys.version_info.minor >= 4):
from dendropy.utility.filesys import pre_py34_open as open
from dendropy.dataio import ioservice
from dendropy.dataio import nexmlreader
from dendropy.dataio import xmlprocessing
class NexmlTreeDataYielder(
ioservice.TreeDa... | true | true |
f717b173935cbd0d7770fed38f1c470436bb75f4 | 970 | py | Python | tests/testNextRule.py | andersonjwan/tltk-mtl-ext | a4f0314df6c55d532b7f9d169b6d08bff3811ef3 | [
"BSD-3-Clause"
] | 1 | 2020-12-11T21:32:46.000Z | 2020-12-11T21:32:46.000Z | tests/testNextRule.py | andersonjwan/tltk-mtl-ext | a4f0314df6c55d532b7f9d169b6d08bff3811ef3 | [
"BSD-3-Clause"
] | null | null | null | tests/testNextRule.py | andersonjwan/tltk-mtl-ext | a4f0314df6c55d532b7f9d169b6d08bff3811ef3 | [
"BSD-3-Clause"
] | null | null | null | import tltk_mtl as MTL
import tltk_mtl_ext as MTLE
def testNextRule():
preds = {}
preds['pred1'] = MTL.Predicate('pred1', 1, 2)
preds['pred2'] = MTL.Predicate('pred2', 2, 4)
preds['pred3'] = MTL.Predicate('pred3', 4, 8)
assert isinstance(MTLE.parse_mtl('next pred1', preds), MTL.Next), printFail(1)
printPass(1)... | 34.642857 | 100 | 0.689691 | import tltk_mtl as MTL
import tltk_mtl_ext as MTLE
def testNextRule():
preds = {}
preds['pred1'] = MTL.Predicate('pred1', 1, 2)
preds['pred2'] = MTL.Predicate('pred2', 2, 4)
preds['pred3'] = MTL.Predicate('pred3', 4, 8)
assert isinstance(MTLE.parse_mtl('next pred1', preds), MTL.Next), printFail(1)
printPass(1)... | true | true |
f717b362c8813b8acd724ce809248566680836c5 | 591 | py | Python | data & result/history.py | robinzixuan/Dialog_Act_Bert_Classification | 014cc8df0545e5bf85a22127e63e8490f3aa9012 | [
"MIT"
] | null | null | null | data & result/history.py | robinzixuan/Dialog_Act_Bert_Classification | 014cc8df0545e5bf85a22127e63e8490f3aa9012 | [
"MIT"
] | null | null | null | data & result/history.py | robinzixuan/Dialog_Act_Bert_Classification | 014cc8df0545e5bf85a22127e63e8490f3aa9012 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 30 20:49:32 2019
@author: rluo
"""
import keras
import matplotlib.pyplot as plt
from keras.models import load_model
import pickle
history = pickle.load(open('history.p','rb'))
plt.plot(history['loss'])
#plt.plot(history['val_loss'])
plt.title('mod... | 19.7 | 48 | 0.683587 |
import keras
import matplotlib.pyplot as plt
from keras.models import load_model
import pickle
history = pickle.load(open('history.p','rb'))
plt.plot(history['loss'])
plt.title('model loss')
plt.ylabel('loss')
plt.xlabel('Epoch')
plt.legend(['train', 'test'], loc='upper left');
plt.plot(history['acc'])
plt.title('mod... | true | true |
f717b38081c7eaa8fa44370f116ae44f650ba3cb | 689 | py | Python | examples/seq2seq/paraphrasing/predict.py | liorshk/simpletransformers | 226cf4d11edf5157c1beafcc44aaa78f65ccc985 | [
"Apache-2.0"
] | 3,151 | 2019-10-05T11:14:44.000Z | 2022-03-31T17:02:54.000Z | examples/seq2seq/paraphrasing/predict.py | liorshk/simpletransformers | 226cf4d11edf5157c1beafcc44aaa78f65ccc985 | [
"Apache-2.0"
] | 1,165 | 2019-10-05T14:48:55.000Z | 2022-03-31T11:12:58.000Z | examples/seq2seq/paraphrasing/predict.py | liorshk/simpletransformers | 226cf4d11edf5157c1beafcc44aaa78f65ccc985 | [
"Apache-2.0"
] | 739 | 2019-10-06T15:11:54.000Z | 2022-03-28T11:07:36.000Z | import logging
from simpletransformers.seq2seq import Seq2SeqModel
logging.basicConfig(level=logging.INFO)
transformers_logger = logging.getLogger("transformers")
transformers_logger.setLevel(logging.ERROR)
model = Seq2SeqModel(encoder_decoder_type="bart", encoder_decoder_name="outputs")
while True:
original ... | 23.758621 | 81 | 0.593614 | import logging
from simpletransformers.seq2seq import Seq2SeqModel
logging.basicConfig(level=logging.INFO)
transformers_logger = logging.getLogger("transformers")
transformers_logger.setLevel(logging.ERROR)
model = Seq2SeqModel(encoder_decoder_type="bart", encoder_decoder_name="outputs")
while True:
original ... | true | true |
f717b4377f6a9a74d53a66640675d4744b9f7a3a | 2,171 | py | Python | app.py | dennisfarmer/Ensemble-Video-Downloader | fa3cb334f9140b5fecdfcb1c2ee6020743a484a7 | [
"MIT"
] | null | null | null | app.py | dennisfarmer/Ensemble-Video-Downloader | fa3cb334f9140b5fecdfcb1c2ee6020743a484a7 | [
"MIT"
] | 1 | 2021-08-02T19:08:13.000Z | 2021-08-03T02:35:49.000Z | app.py | dennisfarmer/Ensemble-Video-Downloader | fa3cb334f9140b5fecdfcb1c2ee6020743a484a7 | [
"MIT"
] | 1 | 2021-08-03T04:44:13.000Z | 2021-08-03T04:44:13.000Z | from PyQt5.QtWidgets import QApplication,QWidget,QTextEdit,QVBoxLayout,QPushButton
from link_converter import convert_url
import pyperclip
import sys
class LinkConverter(QWidget):
def __init__(self,parent=None):
super().__init__(parent)
self.setWindowTitle("Ensemblevideo Link Converter - Dennis Fa... | 39.472727 | 624 | 0.738369 | from PyQt5.QtWidgets import QApplication,QWidget,QTextEdit,QVBoxLayout,QPushButton
from link_converter import convert_url
import pyperclip
import sys
class LinkConverter(QWidget):
def __init__(self,parent=None):
super().__init__(parent)
self.setWindowTitle("Ensemblevideo Link Converter - Dennis Fa... | true | true |
f717b45b3fbcc04aefd659d8153dad422e2f094b | 3,280 | py | Python | test/optimization/test_vertex_cover.py | kareem1925/qiskit-aqua | 7056f9bdd9ece32c41e162faecdcd24cf483da6f | [
"Apache-2.0"
] | null | null | null | test/optimization/test_vertex_cover.py | kareem1925/qiskit-aqua | 7056f9bdd9ece32c41e162faecdcd24cf483da6f | [
"Apache-2.0"
] | null | null | null | test/optimization/test_vertex_cover.py | kareem1925/qiskit-aqua | 7056f9bdd9ece32c41e162faecdcd24cf483da6f | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... | 36.043956 | 90 | 0.655488 |
import unittest
from test.optimization import QiskitOptimizationTestCase
import numpy as np
from qiskit import BasicAer
from qiskit.aqua import aqua_globals, QuantumInstance
from qiskit.optimization.applications.ising import vertex_cover
from qiskit.optimization.applications.ising.common import random_graph, sample... | true | true |
f717b6f0791909056e625635779049e23c7cb669 | 1,651 | py | Python | scripts/test.py | JIC-Image-Analysis/find-plasmodesmata-dockerised | 940afd85687b8383203f65da586da58a234e2deb | [
"MIT"
] | null | null | null | scripts/test.py | JIC-Image-Analysis/find-plasmodesmata-dockerised | 940afd85687b8383203f65da586da58a234e2deb | [
"MIT"
] | null | null | null | scripts/test.py | JIC-Image-Analysis/find-plasmodesmata-dockerised | 940afd85687b8383203f65da586da58a234e2deb | [
"MIT"
] | null | null | null | """Functional test."""
import os
import os.path
from jicbioimage.core.image import MicroscopyCollection
from jicbioimage.core.io import (
AutoName,
DataManager,
FileBackend,
_md5_hexdigest_from_file,
)
from plasmodesmata_analysis import plasmodesmata_analysis
def test_plasmodesmata_analysis():
o... | 30.018182 | 75 | 0.69473 |
import os
import os.path
from jicbioimage.core.image import MicroscopyCollection
from jicbioimage.core.io import (
AutoName,
DataManager,
FileBackend,
_md5_hexdigest_from_file,
)
from plasmodesmata_analysis import plasmodesmata_analysis
def test_plasmodesmata_analysis():
output_dir = "/output/tm... | true | true |
f717b71efc824a722853352eee8071fc691d8c22 | 2,118 | py | Python | airflow/providers/amazon/aws/example_dags/example_s3_bucket.py | jpsalado92/airflow | 6776586904ab2a15727dcfc1c8d03c7a32a78444 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 27 | 2019-02-25T14:20:36.000Z | 2022-03-22T09:35:13.000Z | airflow/providers/amazon/aws/example_dags/example_s3_bucket.py | sdwivedi565/airflow | 78e4d16d970dbcb599d9c7f8df2a1a4273649ae8 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 200 | 2019-01-09T15:33:06.000Z | 2022-01-12T09:13:42.000Z | airflow/providers/amazon/aws/example_dags/example_s3_bucket.py | MatrixManAtYrService/airflow-challenge | cef498efe9f4818e5f8e85c179ca730e84b31f4a | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 14 | 2019-06-25T17:08:29.000Z | 2022-03-29T13:25:53.000Z | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 34.721311 | 100 | 0.742682 | import os
from datetime import datetime
from airflow.decorators import task
from airflow.models.dag import DAG
from airflow.providers.amazon.aws.hooks.s3 import S3Hook
from airflow.providers.amazon.aws.operators.s3 import S3CreateBucketOperator, S3DeleteBucketOperator
BUCKET_NAME = os.environ.get('BUCKET_NAME', 'test... | true | true |
f717b89a3172f1c4b9bc6e5d62033e37e8a5b95c | 753 | py | Python | modulos/utils.py | oliverfaustino/NRPG-DataManager | 71064cb79be304f712aabcceebd6647121d2cb6c | [
"MIT"
] | null | null | null | modulos/utils.py | oliverfaustino/NRPG-DataManager | 71064cb79be304f712aabcceebd6647121d2cb6c | [
"MIT"
] | null | null | null | modulos/utils.py | oliverfaustino/NRPG-DataManager | 71064cb79be304f712aabcceebd6647121d2cb6c | [
"MIT"
] | null | null | null | import pyperclip
import pandas as pd
from modulos.conecao import *
def copiar(objeto): # função para copiar os objetos para área de transferência
global copiar # para resolver o porblema UnboundLocalError: local variable 'copiar' referenced before assignment:
opcao = int(input('Deseja copiar para área de tr... | 25.965517 | 131 | 0.654714 | import pyperclip
import pandas as pd
from modulos.conecao import *
def copiar(objeto): global copiar opcao = int(input('Deseja copiar para área de transferência? "1" para sim e qualquer tecla para não\n\nR: '))
if opcao == 1:
copiar = pyperclip.copy(objeto)
print('\nCop... | true | true |
f717b8e1b7a02ea373928b5f35b6948527803150 | 5,822 | py | Python | tests/admin_views/test_templatetags.py | downstreamimpact/django | 6686238cdc5c826ca5aab39d771798ff98e90ae8 | [
"CNRI-Python-GPL-Compatible",
"BSD-3-Clause"
] | 7 | 2020-01-13T18:26:41.000Z | 2021-04-20T04:22:26.000Z | tests/admin_views/test_templatetags.py | downstreamimpact/django | 6686238cdc5c826ca5aab39d771798ff98e90ae8 | [
"CNRI-Python-GPL-Compatible",
"BSD-3-Clause"
] | null | null | null | tests/admin_views/test_templatetags.py | downstreamimpact/django | 6686238cdc5c826ca5aab39d771798ff98e90ae8 | [
"CNRI-Python-GPL-Compatible",
"BSD-3-Clause"
] | 4 | 2019-11-07T01:22:16.000Z | 2020-09-16T22:02:16.000Z | import datetime
from django.contrib.admin import ModelAdmin
from django.contrib.admin.templatetags.admin_list import date_hierarchy
from django.contrib.admin.templatetags.admin_modify import submit_row
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from django.test import R... | 44.442748 | 118 | 0.643422 | import datetime
from django.contrib.admin import ModelAdmin
from django.contrib.admin.templatetags.admin_list import date_hierarchy
from django.contrib.admin.templatetags.admin_modify import submit_row
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from django.test import R... | true | true |
f717b91705d7d8a081fb14e5a9579959e466aa1f | 28,392 | py | Python | allennlp/models/semantic_parsing/atis/atis_semantic_parser.py | ljch2018/allennlp | 63ba3fb28897578d4798039d1713e2b7995eb753 | [
"Apache-2.0"
] | null | null | null | allennlp/models/semantic_parsing/atis/atis_semantic_parser.py | ljch2018/allennlp | 63ba3fb28897578d4798039d1713e2b7995eb753 | [
"Apache-2.0"
] | null | null | null | allennlp/models/semantic_parsing/atis/atis_semantic_parser.py | ljch2018/allennlp | 63ba3fb28897578d4798039d1713e2b7995eb753 | [
"Apache-2.0"
] | null | null | null | import logging
from typing import Any, Dict, List, Tuple
import difflib
import sqlparse
from overrides import overrides
import torch
from allennlp.common.util import pad_sequence_to_length
from allennlp.data import Vocabulary
from allennlp.data.fields.production_rule_field import ProductionRuleArray
from allennlp.sem... | 54.705202 | 112 | 0.61151 | import logging
from typing import Any, Dict, List, Tuple
import difflib
import sqlparse
from overrides import overrides
import torch
from allennlp.common.util import pad_sequence_to_length
from allennlp.data import Vocabulary
from allennlp.data.fields.production_rule_field import ProductionRuleArray
from allennlp.sem... | true | true |
f717ba6db19fac8fe6c6bc3c5388211b577e2db4 | 871 | py | Python | tests/unit/fake_data_root/kubernetes/var/lib/juju/agents/unit-containerd-2/charm/hooks/relations/untrusted-container-runtime/requires.py | KellenRenshaw/hotsos | e3fc51ab7f8af606a5846a3486a7fda23d761583 | [
"Apache-2.0"
] | 6 | 2021-10-01T19:46:14.000Z | 2022-03-31T17:05:08.000Z | tests/unit/fake_data_root/kubernetes/var/lib/juju/agents/unit-containerd-2/charm/hooks/relations/untrusted-container-runtime/requires.py | KellenRenshaw/hotsos | e3fc51ab7f8af606a5846a3486a7fda23d761583 | [
"Apache-2.0"
] | 111 | 2021-10-01T18:18:17.000Z | 2022-03-29T12:23:20.000Z | tests/unit/fake_data_root/kubernetes/var/lib/juju/agents/unit-containerd-2/charm/hooks/relations/untrusted-container-runtime/requires.py | KellenRenshaw/hotsos | e3fc51ab7f8af606a5846a3486a7fda23d761583 | [
"Apache-2.0"
] | 10 | 2021-09-29T14:47:54.000Z | 2022-03-18T14:52:16.000Z | from charms.reactive import (
Endpoint,
set_flag,
clear_flag
)
from charms.reactive import (
when,
when_not
)
class ContainerRuntimeRequires(Endpoint):
@when('endpoint.{endpoint_name}.changed')
def changed(self):
set_flag(self.expand_name('endpoint.{endpoint_name}.available'))
... | 24.885714 | 74 | 0.626866 | from charms.reactive import (
Endpoint,
set_flag,
clear_flag
)
from charms.reactive import (
when,
when_not
)
class ContainerRuntimeRequires(Endpoint):
@when('endpoint.{endpoint_name}.changed')
def changed(self):
set_flag(self.expand_name('endpoint.{endpoint_name}.available'))
... | true | true |
f717ba7e0a6e1a58c6c5756909c027da10c010bb | 878 | py | Python | read_exif.py | kiyoon/camera-tools | 2e269141597dd27ec7d41e49285e01ef566cb54c | [
"MIT"
] | 1 | 2021-11-14T23:30:47.000Z | 2021-11-14T23:30:47.000Z | read_exif.py | kiyoon/camera-tools | 2e269141597dd27ec7d41e49285e01ef566cb54c | [
"MIT"
] | null | null | null | read_exif.py | kiyoon/camera-tools | 2e269141597dd27ec7d41e49285e01ef566cb54c | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import argparse
class Formatter(argparse.ArgumentDefaultsHelpFormatter, argparse.RawDescriptionHelpFormatter):
pass
parser = argparse.ArgumentParser(
description='''Read EXIF data
Author: Kiyoon Kim (yoonkr33@gmail.com)''',
formatter_class=Formatter)
parser.add_argument('i... | 24.388889 | 94 | 0.671982 |
import argparse
class Formatter(argparse.ArgumentDefaultsHelpFormatter, argparse.RawDescriptionHelpFormatter):
pass
parser = argparse.ArgumentParser(
description='''Read EXIF data
Author: Kiyoon Kim (yoonkr33@gmail.com)''',
formatter_class=Formatter)
parser.add_argument('input_files', type=str, ... | true | true |
f717bcdd89a1615aae5c49e9f6e2cbe27aa71630 | 458 | py | Python | ProjectShop/ProductApp/urls.py | kolyasalubov/ProjectShop | 41a62d27276542bf65aab51663220ffe88858024 | [
"MIT"
] | 3 | 2021-08-30T09:15:52.000Z | 2022-03-24T14:40:11.000Z | ProjectShop/ProductApp/urls.py | kolyasalubov/ProjectShop | 41a62d27276542bf65aab51663220ffe88858024 | [
"MIT"
] | 150 | 2021-08-30T12:37:17.000Z | 2021-11-17T07:09:19.000Z | ProjectShop/ProductApp/urls.py | kolyasalubov/ProjectShop | 41a62d27276542bf65aab51663220ffe88858024 | [
"MIT"
] | null | null | null | from django.urls import path
from ProductApp.views import (
HomePageView,
CategoriesView,
ProductDetailView,
CategoryDetailView,
)
urlpatterns = [
path("categories/<slug:slug>/", CategoryDetailView.as_view(), name="category-detail"),
path("categories/", CategoriesView.as_view(), name="categor... | 26.941176 | 90 | 0.696507 | from django.urls import path
from ProductApp.views import (
HomePageView,
CategoriesView,
ProductDetailView,
CategoryDetailView,
)
urlpatterns = [
path("categories/<slug:slug>/", CategoryDetailView.as_view(), name="category-detail"),
path("categories/", CategoriesView.as_view(), name="categor... | true | true |
f717bdb31e80489aaefa7fbd595c263379b27f37 | 15,376 | py | Python | src/hub/dataload/sources/chembl/chembl_upload.py | ravila4/mychem.info | 9b63b5f0957b5e7b252ca8122734a363905036b3 | [
"Apache-2.0"
] | null | null | null | src/hub/dataload/sources/chembl/chembl_upload.py | ravila4/mychem.info | 9b63b5f0957b5e7b252ca8122734a363905036b3 | [
"Apache-2.0"
] | null | null | null | src/hub/dataload/sources/chembl/chembl_upload.py | ravila4/mychem.info | 9b63b5f0957b5e7b252ca8122734a363905036b3 | [
"Apache-2.0"
] | null | null | null | """
Chembl uploader
"""
# pylint: disable=E0401, E0611
import os
import glob
import pymongo
import biothings.hub.dataload.storage as storage
from biothings.hub.dataload.uploader import ParallelizedSourceUploader
from hub.dataload.uploader import BaseDrugUploader
from hub.datatransform.keylookup import MyChemKeyLookup
f... | 40.569921 | 95 | 0.280437 | import os
import glob
import pymongo
import biothings.hub.dataload.storage as storage
from biothings.hub.dataload.uploader import ParallelizedSourceUploader
from hub.dataload.uploader import BaseDrugUploader
from hub.datatransform.keylookup import MyChemKeyLookup
from .chembl_parser import load_data
SRC_META = {
... | true | true |
f717bdc2664f609c84cf83efbdea10b954fadfe4 | 2,307 | py | Python | tools/test_cate_attr_predictor.py | engahmed1190/mmfashion | 34ba2d8a9f2daadb4a04d24287664cebde4b14f9 | [
"Apache-2.0"
] | 6 | 2021-02-04T06:25:28.000Z | 2021-07-16T05:49:13.000Z | tools/test_cate_attr_predictor.py | engahmed1190/mmfashion | 34ba2d8a9f2daadb4a04d24287664cebde4b14f9 | [
"Apache-2.0"
] | null | null | null | tools/test_cate_attr_predictor.py | engahmed1190/mmfashion | 34ba2d8a9f2daadb4a04d24287664cebde4b14f9 | [
"Apache-2.0"
] | 2 | 2021-07-16T19:27:20.000Z | 2021-12-15T09:52:54.000Z | from __future__ import division
import argparse
from mmcv import Config
from mmcv.runner import load_checkpoint
from mmfashion.apis import get_root_logger, init_dist, test_cate_attr_predictor
from mmfashion.datasets.utils import get_dataset
from mmfashion.models import build_predictor
def parse_args():
parser =... | 29.576923 | 79 | 0.638058 | from __future__ import division
import argparse
from mmcv import Config
from mmcv.runner import load_checkpoint
from mmfashion.apis import get_root_logger, init_dist, test_cate_attr_predictor
from mmfashion.datasets.utils import get_dataset
from mmfashion.models import build_predictor
def parse_args():
parser =... | true | true |
f717bedbafbc1c240de6e34e3435337fe00e3c60 | 4,260 | py | Python | app/interfaces/Rubric.py | u8sand/FAIRshake | 8f6f3dde42de29b88e9a43bdd43f848382e3bad7 | [
"Apache-2.0"
] | null | null | null | app/interfaces/Rubric.py | u8sand/FAIRshake | 8f6f3dde42de29b88e9a43bdd43f848382e3bad7 | [
"Apache-2.0"
] | 8 | 2018-06-05T17:01:43.000Z | 2018-06-22T01:19:39.000Z | app/interfaces/Rubric.py | u8sand/FAIRshake | 8f6f3dde42de29b88e9a43bdd43f848382e3bad7 | [
"Apache-2.0"
] | 1 | 2018-06-06T17:22:28.000Z | 2018-06-06T17:22:28.000Z | from ..ioc import interface, model
from ..types import HTTPResponse, UUID, Timestamp, Optional, List
from ..util.generate_spec import generate_spec
@model
class CriterionModel:
'''
type: object
required:
- user
- name
properties:
id:
type: string
description: Criterion ID
example: d29... | 22.303665 | 90 | 0.621831 | from ..ioc import interface, model
from ..types import HTTPResponse, UUID, Timestamp, Optional, List
from ..util.generate_spec import generate_spec
@model
class CriterionModel:
id: UUID
name: str
kind: str
@model
class RubricModel:
id: UUID
user: UUID
name: str
criteria: List[CriterionModel]
descripti... | true | true |
f717c0006f023d6f8d6d6a2811a17dfa5060ba8c | 72,241 | py | Python | mne/bem.py | jdammers/mne-python | 1dc1502215a53385cda15c6c336fcc4341dc4d3b | [
"BSD-3-Clause"
] | null | null | null | mne/bem.py | jdammers/mne-python | 1dc1502215a53385cda15c6c336fcc4341dc4d3b | [
"BSD-3-Clause"
] | null | null | null | mne/bem.py | jdammers/mne-python | 1dc1502215a53385cda15c6c336fcc4341dc4d3b | [
"BSD-3-Clause"
] | 1 | 2021-04-12T12:45:31.000Z | 2021-04-12T12:45:31.000Z | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Matti Hamalainen <msh@nmr.mgh.harvard.edu>
# Eric Larson <larson.eric.d@gmail.com>
# Lorenzo De Santis <lorenzo.de-santis@u-psud.fr>
#
# License: BSD (3-clause)
from functools import partial
import glob
import os
impor... | 37.822513 | 79 | 0.584087 |
from functools import partial
import glob
import os
import os.path as op
import shutil
from copy import deepcopy
import numpy as np
from scipy import linalg
from .transforms import _ensure_trans, apply_trans
from .io import Info
from .io.constants import FIFF
from .io.write import (start_file, start_block, write_flo... | true | true |
f717c05e56131daf3f0bdbca7cbed9fe45f2de19 | 930 | py | Python | src/augment/basic_augmentation/noise.py | TencentYoutuResearch/SelfSupervisedLearning-DSM | 655a0a23a47bf2559f3d435384ae59a8871a5ff5 | [
"Apache-2.0"
] | 27 | 2021-01-07T11:09:33.000Z | 2021-08-31T02:46:23.000Z | src/augment/basic_augmentation/noise.py | TencentYoutuResearch/SelfSupervisedLearning-DSM | 655a0a23a47bf2559f3d435384ae59a8871a5ff5 | [
"Apache-2.0"
] | null | null | null | src/augment/basic_augmentation/noise.py | TencentYoutuResearch/SelfSupervisedLearning-DSM | 655a0a23a47bf2559f3d435384ae59a8871a5ff5 | [
"Apache-2.0"
] | 3 | 2021-01-08T08:31:06.000Z | 2021-11-26T04:10:23.000Z | import torch
import torch.nn as nn
"""
usage
z_rand = generate_noise([1,nzx,nzy], device=opt.device)
z_rand = z_rand.expand(1,3,Z_opt.shape[2],Z_opt.shape[3])
z_prev1 = 0.95*Z_opt +0.05*z_rand
"""
def upsampling(im, sx, sy):
m = nn.Upsample(size=[round(sx), round(sy)], mode='... | 32.068966 | 90 | 0.609677 | import torch
import torch.nn as nn
def upsampling(im, sx, sy):
m = nn.Upsample(size=[round(sx), round(sy)], mode='bilinear', align_corners=True)
return m(im)
def generate_noise(size, num_samp=1, device='cuda', type='gaussian', scale=1):
if type == 'gaussian':
noise = torch.randn(num_samp, size... | true | true |
f717c11ea68b58ce09246f3ab62dcc7714c8c8ca | 1,921 | py | Python | recipes/pneumothorax/binary_classification/train_example_deit.py | lbolanos/HugsVision | c9b1708928916bc413a795590d731308ea8c582b | [
"MIT"
] | 154 | 2021-08-14T00:09:15.000Z | 2022-03-16T02:42:01.000Z | recipes/pneumothorax/binary_classification/train_example_deit.py | lbolanos/HugsVision | c9b1708928916bc413a795590d731308ea8c582b | [
"MIT"
] | 36 | 2021-08-13T23:42:15.000Z | 2022-03-31T03:57:23.000Z | recipes/pneumothorax/binary_classification/train_example_deit.py | lbolanos/HugsVision | c9b1708928916bc413a795590d731308ea8c582b | [
"MIT"
] | 12 | 2021-09-04T00:49:35.000Z | 2022-02-24T13:20:54.000Z | import argparse
from hugsvision.nnet.VisionClassifierTrainer import VisionClassifierTrainer
from hugsvision.dataio.VisionDataset import VisionDataset
from torchvision.datasets import ImageFolder
from transformers import DeiTFeatureExtractor, DeiTForImageClassification
parser = argparse.ArgumentParser(descrip... | 32.559322 | 103 | 0.724623 | import argparse
from hugsvision.nnet.VisionClassifierTrainer import VisionClassifierTrainer
from hugsvision.dataio.VisionDataset import VisionDataset
from torchvision.datasets import ImageFolder
from transformers import DeiTFeatureExtractor, DeiTForImageClassification
parser = argparse.ArgumentParser(descrip... | true | true |
f717c1795cee9e960f89d88b04da89c0fcbb68f9 | 1,593 | py | Python | algorithms/LinkedList/reverseLinkedList.py | gadodia/Algorithms | 714d43ce89b684d8e5c4bb77a654938957957f33 | [
"MIT"
] | null | null | null | algorithms/LinkedList/reverseLinkedList.py | gadodia/Algorithms | 714d43ce89b684d8e5c4bb77a654938957957f33 | [
"MIT"
] | null | null | null | algorithms/LinkedList/reverseLinkedList.py | gadodia/Algorithms | 714d43ce89b684d8e5c4bb77a654938957957f33 | [
"MIT"
] | null | null | null | '''
This problem was recently asked by Google:
Given a singly-linked list, reverse the list. This can be done iteratively or recursively. Can you get both solutions?
Example:
Input: 4 -> 3 -> 2 -> 1 -> 0 -> NULL
Output: 0 -> 1 -> 2 -> 3 -> 4 -> NULL
'''
class ListNode(object):
def __init__(self, x):
self.... | 23.426471 | 118 | 0.591337 | class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
def printList(self):
node = self
output = ''
while node != None:
output += str(node.val)
output += " "
node = node.next
print(output)
... | true | true |
f717c2255fe90f0a652e062275efe541f399cc62 | 22,811 | py | Python | utils/exp_utils.py | NoeSamaille/medical-detection-toolkit | 232d3d1444ccaac04e15a00d8030390560236871 | [
"Apache-2.0"
] | 1 | 2021-04-01T02:15:49.000Z | 2021-04-01T02:15:49.000Z | utils/exp_utils.py | NoeSamaille/medical-detection-toolkit | 232d3d1444ccaac04e15a00d8030390560236871 | [
"Apache-2.0"
] | 2 | 2021-06-02T02:14:01.000Z | 2021-09-06T06:03:25.000Z | utils/exp_utils.py | NoeSamaille/medical-detection-toolkit | 232d3d1444ccaac04e15a00d8030390560236871 | [
"Apache-2.0"
] | 3 | 2020-06-28T14:57:00.000Z | 2021-09-06T08:26:26.000Z | #!/usr/bin/env python
# Copyright 2018 Division of Medical Image Computing, German Cancer Research Center (DKFZ).
#
# 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... | 44.903543 | 287 | 0.639691 | from typing import Iterable, Tuple, Any, Union
import os, sys
import subprocess
from multiprocessing import Process
import importlib.util
import pickle
import logging
from torch.utils.tensorboard import SummaryWriter
from collections import OrderedDict
import numpy as np
import torch
import pandas as pd
def split_o... | true | true |
f717c2aceaf306d0f7eae56f9df7f70d7fb7e56b | 2,488 | py | Python | usort/util.py | thatch/usort | 2ca1ff63d6cfc79e76ea95b69d162f4579c3fa3c | [
"MIT"
] | null | null | null | usort/util.py | thatch/usort | 2ca1ff63d6cfc79e76ea95b69d162f4579c3fa3c | [
"MIT"
] | null | null | null | usort/util.py | thatch/usort | 2ca1ff63d6cfc79e76ea95b69d162f4579c3fa3c | [
"MIT"
] | null | null | null | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from contextlib import contextmanager
from contextvars import ContextVar
from pathlib import Path
from time import monotonic
from typing impor... | 30.716049 | 86 | 0.658762 |
from contextlib import contextmanager
from contextvars import ContextVar
from pathlib import Path
from time import monotonic
from typing import Callable, Generator, List, Optional, Tuple
import libcst as cst
TIMINGS: ContextVar[List[Tuple[str, float]]] = ContextVar("TIMINGS")
@contextmanager
def timed(msg: str) ->... | true | true |
f717c2b8fff53fa6c6659e99b4b2a067e7f9823a | 2,440 | py | Python | model/experiment/gaussian_naive_bayes_model.py | theBraindonor/chicago-crime-arrests | 64cdb82fbe828d1316cf945b67ddc205ef190293 | [
"CC-BY-4.0"
] | 1 | 2019-04-29T10:32:26.000Z | 2019-04-29T10:32:26.000Z | model/experiment/gaussian_naive_bayes_model.py | theBraindonor/chicago-crime-arrests | 64cdb82fbe828d1316cf945b67ddc205ef190293 | [
"CC-BY-4.0"
] | 4 | 2020-03-24T16:54:17.000Z | 2021-06-01T23:33:48.000Z | model/experiment/gaussian_naive_bayes_model.py | theBraindonor/chicago-crime-arrests | 64cdb82fbe828d1316cf945b67ddc205ef190293 | [
"CC-BY-4.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Experiment with a gaussian naive bayes model with a variety of balancing techniques on the cleaned data set
"""
__author__ = "John Hoff"
__email__ = "john.hoff@braindonor.net"
__copyright__ = "Copyright 2019, John Hoff"
__license__ = "Creative Commons Attribution-... | 26.813187 | 111 | 0.697951 |
__author__ = "John Hoff"
__email__ = "john.hoff@braindonor.net"
__copyright__ = "Copyright 2019, John Hoff"
__license__ = "Creative Commons Attribution-ShareAlike 4.0 International License"
__version__ = "1.0"
from imblearn.combine import SMOTEENN
from imblearn.over_sampling import SMOTE
from imblearn.under_sampling... | true | true |
f717c597ce99c986760a12c223c014567cf34f38 | 96,886 | py | Python | ThirdParty/ZopeInterface/zope/interface/tests/test_registry.py | OpenGeoscience/VTK | a373e975b9284a022f43a062ebf5042bb17b4e44 | [
"BSD-3-Clause"
] | 3 | 2016-02-01T02:29:51.000Z | 2020-09-04T17:19:24.000Z | ThirdParty/ZopeInterface/zope/interface/tests/test_registry.py | OpenGeoscience/VTK | a373e975b9284a022f43a062ebf5042bb17b4e44 | [
"BSD-3-Clause"
] | 7 | 2021-02-08T20:22:15.000Z | 2022-03-11T23:19:41.000Z | ThirdParty/ZopeInterface/zope/interface/tests/test_registry.py | OpenGeoscience/VTK | a373e975b9284a022f43a062ebf5042bb17b4e44 | [
"BSD-3-Clause"
] | 6 | 2017-02-13T09:11:02.000Z | 2021-06-29T11:22:18.000Z | ##############################################################################
#
# Copyright (c) 2001, 2002, 2009 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution... | 39.464766 | 80 | 0.630783 | import unittest
class _SilencePy3Deprecations(unittest.TestCase):
def failUnless(self, expr):
return self.assertTrue(expr)
def failIf(self, expr):
return self.assertFalse(expr)
class ComponentsTests(_SilencePy3Deprecations):
def _getTargetClass(self):
from zo... | true | true |
f717c69030d602486ed1591a2382be46b01ff559 | 3,373 | py | Python | hw/ip/otbn/dv/otbnsim/sim/csr.py | Jacob-Levy/opentitan | 13ed3e95572168f7db0e3178d06a72e72ee5a745 | [
"Apache-2.0"
] | 2 | 2019-11-21T14:05:14.000Z | 2020-07-10T12:40:54.000Z | hw/ip/otbn/dv/otbnsim/sim/csr.py | Jacob-Levy/opentitan | 13ed3e95572168f7db0e3178d06a72e72ee5a745 | [
"Apache-2.0"
] | null | null | null | hw/ip/otbn/dv/otbnsim/sim/csr.py | Jacob-Levy/opentitan | 13ed3e95572168f7db0e3178d06a72e72ee5a745 | [
"Apache-2.0"
] | null | null | null | # Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
from .flags import FlagGroups
from .wsr import WSRFile
class CSRFile:
'''A model of the CSR file'''
def __init__(self) -> None:
self.flags = FlagGroups()
... | 31.820755 | 79 | 0.555885 |
from .flags import FlagGroups
from .wsr import WSRFile
class CSRFile:
def __init__(self) -> None:
self.flags = FlagGroups()
self._known_indices = set()
self._known_indices.add(0x7c0) self._known_indices.add(0x7c1) self._known_indices.add(0x7c8) for idx in range... | true | true |
f717c7a5b3ca5f9a8a20ce7a7c9f7a50b5ae1c68 | 14,021 | py | Python | tests/ci/sync_requirements.py | lolwww/rally | fcb1fb6c608e29dd62549cf6b3cec2e90529932f | [
"Apache-2.0"
] | null | null | null | tests/ci/sync_requirements.py | lolwww/rally | fcb1fb6c608e29dd62549cf6b3cec2e90529932f | [
"Apache-2.0"
] | null | null | null | tests/ci/sync_requirements.py | lolwww/rally | fcb1fb6c608e29dd62549cf6b3cec2e90529932f | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# 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 applicab... | 36.136598 | 79 | 0.57799 |
import collections
import logging
import re
import sys
import textwrap
import requests
LOG = logging.getLogger(__name__)
if not LOG.handlers:
LOG.addHandler(logging.StreamHandler())
LOG.setLevel(logging.INFO)
GLOBAL_REQUIREMENTS_LOCATIONS = (
"https://raw.githubusercontent.com/openstack/requirements/... | true | true |
f717c8b4305af7242c263a306f933192f7a5b976 | 491 | py | Python | route/api_raw.py | susemeee/openNAMU | 0f3d8acb5f0fe179cc8dbbfea1846da3ca0cd4e1 | [
"BSD-3-Clause"
] | null | null | null | route/api_raw.py | susemeee/openNAMU | 0f3d8acb5f0fe179cc8dbbfea1846da3ca0cd4e1 | [
"BSD-3-Clause"
] | null | null | null | route/api_raw.py | susemeee/openNAMU | 0f3d8acb5f0fe179cc8dbbfea1846da3ca0cd4e1 | [
"BSD-3-Clause"
] | 1 | 2020-01-04T09:43:35.000Z | 2020-01-04T09:43:35.000Z | from .tool.func import *
def api_raw_2(conn, name):
curs = conn.cursor()
if acl_check(name, 'render') != 1:
curs.execute("select data from data where title = ?", [name])
data = curs.fetchall()
if data:
json_data = { "title" : name, "data" : render_set(title = name, data = d... | 30.6875 | 108 | 0.545825 | from .tool.func import *
def api_raw_2(conn, name):
curs = conn.cursor()
if acl_check(name, 'render') != 1:
curs.execute("select data from data where title = ?", [name])
data = curs.fetchall()
if data:
json_data = { "title" : name, "data" : render_set(title = name, data = d... | true | true |
f717ca0d2a58ad1a206f65fb4972fcfb0f68141c | 634 | py | Python | rates/migrations/0003_rating.py | Gichimu/irater | 2da90230368b2aa5b97b9ab84455703e510e51ef | [
"MIT"
] | null | null | null | rates/migrations/0003_rating.py | Gichimu/irater | 2da90230368b2aa5b97b9ab84455703e510e51ef | [
"MIT"
] | 16 | 2020-01-11T08:20:30.000Z | 2022-02-10T09:18:48.000Z | rates/migrations/0003_rating.py | Gichimu/irater | 2da90230368b2aa5b97b9ab84455703e510e51ef | [
"MIT"
] | null | null | null | # Generated by Django 2.2 on 2020-01-15 06:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rates', '0002_auto_20200113_0757'),
]
operations = [
migrations.CreateModel(
name='Rating',
fields=[
(... | 27.565217 | 114 | 0.572555 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rates', '0002_auto_20200113_0757'),
]
operations = [
migrations.CreateModel(
name='Rating',
fields=[
('id', models.AutoField(auto_created=True, prim... | true | true |
f717cc90445df76a8ce5da7e005a9d1637cd561b | 857 | py | Python | setup.py | treamology/sphinx-variations | 1f02e3bf32610ef32cf24748d4f91bab0263c173 | [
"MIT"
] | null | null | null | setup.py | treamology/sphinx-variations | 1f02e3bf32610ef32cf24748d4f91bab0263c173 | [
"MIT"
] | 2 | 2019-10-14T12:17:54.000Z | 2019-11-29T09:06:54.000Z | setup.py | treamology/sphinx-variations | 1f02e3bf32610ef32cf24748d4f91bab0263c173 | [
"MIT"
] | 1 | 2019-10-16T10:45:39.000Z | 2019-10-16T10:45:39.000Z | import setuptools
from variations import __version__
with open('README.md', 'r') as fh:
long_description = fh.read()
setuptools.setup(
name='sphinx-variations',
version=__version__,
author='D. Lawrence',
author_email='trea@treamous.com',
description='Create multiple variations of your Sphinx H... | 30.607143 | 80 | 0.662777 | import setuptools
from variations import __version__
with open('README.md', 'r') as fh:
long_description = fh.read()
setuptools.setup(
name='sphinx-variations',
version=__version__,
author='D. Lawrence',
author_email='trea@treamous.com',
description='Create multiple variations of your Sphinx H... | true | true |
f717cd31d8d75e9ba8cc375f6e83f9427f97fd2e | 1,947 | py | Python | apps/sumo/tests/test_json_decorator.py | storagebot/kitsune | 613ba2ca09104f330ab77088b452391169096249 | [
"BSD-3-Clause"
] | 2 | 2019-08-19T17:08:47.000Z | 2019-10-05T11:37:02.000Z | apps/sumo/tests/test_json_decorator.py | taliasman/kitsune | f8085205eef143011adb4c52d1f183da06c1c58e | [
"BSD-3-Clause"
] | null | null | null | apps/sumo/tests/test_json_decorator.py | taliasman/kitsune | f8085205eef143011adb4c52d1f183da06c1c58e | [
"BSD-3-Clause"
] | null | null | null | import json
from django import http
from django.core.exceptions import PermissionDenied
from django.test import RequestFactory, TestCase
from nose.tools import eq_
from sumo.decorators import json_view
rf = RequestFactory()
JSON = 'application/json'
class JsonViewTests(TestCase):
def test_object(self):
... | 24.037037 | 51 | 0.539291 | import json
from django import http
from django.core.exceptions import PermissionDenied
from django.test import RequestFactory, TestCase
from nose.tools import eq_
from sumo.decorators import json_view
rf = RequestFactory()
JSON = 'application/json'
class JsonViewTests(TestCase):
def test_object(self):
... | false | true |
f717cd7177718b946f4674840996c1bb04bd9abb | 7,798 | py | Python | frame_finder.py | myddrin/frame_finder | 88f8002157ed7d37e3c1d8f24e98be4f51198578 | [
"MIT"
] | null | null | null | frame_finder.py | myddrin/frame_finder | 88f8002157ed7d37e3c1d8f24e98be4f51198578 | [
"MIT"
] | 2 | 2016-04-04T19:26:59.000Z | 2016-05-25T12:40:50.000Z | frame_finder.py | myddrin/frame_finder | 88f8002157ed7d37e3c1d8f24e98be4f51198578 | [
"MIT"
] | null | null | null | #!/usr/bin/python
"""
This python script was created to find missing files in given folders.
Copyright (c) 2016 Thomas Richard
Following MIT license (see copying.txt)
The software is provided "as is", without warranty of any kind, express or
implied, including but not limited to the warranties of merchantability,
f... | 36.439252 | 78 | 0.543473 |
"""
This python script was created to find missing files in given folders.
Copyright (c) 2016 Thomas Richard
Following MIT license (see copying.txt)
The software is provided "as is", without warranty of any kind, express or
implied, including but not limited to the warranties of merchantability,
fitness for a parti... | false | true |
f717cdb73df096844f350cf4219a8fcdfd000791 | 1,017 | py | Python | lib/misc.py | ngreenberg/twitch-plays-wikipedia | ee72ce2605eed77fb13a89678bd4ba647d83ff9f | [
"MIT"
] | null | null | null | lib/misc.py | ngreenberg/twitch-plays-wikipedia | ee72ce2605eed77fb13a89678bd4ba647d83ff9f | [
"MIT"
] | null | null | null | lib/misc.py | ngreenberg/twitch-plays-wikipedia | ee72ce2605eed77fb13a89678bd4ba647d83ff9f | [
"MIT"
] | null | null | null | import time
import os
def pp(message, mtype='INFO'):
mtype = mtype.upper()
print '[%s] [%s] %s' % (time.strftime('%H:%M:%S', time.gmtime()),
mtype, message)
def ppi(channel, message, username):
print '[%s %s] <%s> %s' % (time.strftime('%H:%M:%S', time.gmtime()),
... | 33.9 | 76 | 0.462144 | import time
import os
def pp(message, mtype='INFO'):
mtype = mtype.upper()
print '[%s] [%s] %s' % (time.strftime('%H:%M:%S', time.gmtime()),
mtype, message)
def ppi(channel, message, username):
print '[%s %s] <%s> %s' % (time.strftime('%H:%M:%S', time.gmtime()),
... | false | true |
f717ce0bca4aa3ca6519610187210bdcf31b9d6a | 2,934 | py | Python | musicplayer/buttons.py | Gabe-Corral/Music_Player | 9352266aa86e5927e4a603b6238cea4745cc6b26 | [
"MIT"
] | null | null | null | musicplayer/buttons.py | Gabe-Corral/Music_Player | 9352266aa86e5927e4a603b6238cea4745cc6b26 | [
"MIT"
] | null | null | null | musicplayer/buttons.py | Gabe-Corral/Music_Player | 9352266aa86e5927e4a603b6238cea4745cc6b26 | [
"MIT"
] | null | null | null | import tkinter as tk
from PIL import ImageTk, Image
from file_import import FileImport
class Buttons:
def __init__(self, parent, player):
self.player = player
self.parent = parent
#clean these up
unskip_img = ImageTk.PhotoImage(Image.open("assets/unskip.png").resize((25,25)))
... | 44.454545 | 98 | 0.673142 | import tkinter as tk
from PIL import ImageTk, Image
from file_import import FileImport
class Buttons:
def __init__(self, parent, player):
self.player = player
self.parent = parent
unskip_img = ImageTk.PhotoImage(Image.open("assets/unskip.png").resize((25,25)))
unskip_btn = t... | true | true |
f717ce9240361f4597c503f589f1095a203484a7 | 20,067 | py | Python | tests/wallet/did_wallet/test_did.py | Starcoder0x/chia-blockchain | 5b2f5772780d0370f76b0134db6a7fdc7af42862 | [
"Apache-2.0"
] | 1 | 2022-03-04T13:12:39.000Z | 2022-03-04T13:12:39.000Z | tests/wallet/did_wallet/test_did.py | zcomputerwiz/experiments-blockchain | 841754b44494451a9e3e537575eeec431fe533d1 | [
"Apache-2.0"
] | null | null | null | tests/wallet/did_wallet/test_did.py | zcomputerwiz/experiments-blockchain | 841754b44494451a9e3e537575eeec431fe533d1 | [
"Apache-2.0"
] | null | null | null | import asyncio
import pytest
import pytest_asyncio
from chia.simulator.simulator_protocol import FarmNewBlockProtocol
from chia.types.peer_info import PeerInfo
from chia.util.ints import uint16, uint32, uint64
from tests.setup_nodes import self_hostname, setup_simulators_and_wallets
from chia.wallet.did_wallet.did_wall... | 43.623913 | 119 | 0.695819 | import asyncio
import pytest
import pytest_asyncio
from chia.simulator.simulator_protocol import FarmNewBlockProtocol
from chia.types.peer_info import PeerInfo
from chia.util.ints import uint16, uint32, uint64
from tests.setup_nodes import self_hostname, setup_simulators_and_wallets
from chia.wallet.did_wallet.did_wall... | true | true |
f717cec2bb576f4d7ab0e2542c02f2f63a1c8e21 | 582 | py | Python | src/models/gender.py | evdhout/learn_students | 4fe10df13065ae7c46930cb69fa46851c1dca9e6 | [
"MIT"
] | null | null | null | src/models/gender.py | evdhout/learn_students | 4fe10df13065ae7c46930cb69fa46851c1dca9e6 | [
"MIT"
] | null | null | null | src/models/gender.py | evdhout/learn_students | 4fe10df13065ae7c46930cb69fa46851c1dca9e6 | [
"MIT"
] | null | null | null | class Gender:
NEUTRAL = 1
FEMALE = 2
MALE = 3
GENDER_STRINGS = {NEUTRAL: "neutral",
FEMALE: "female",
MALE: "male"
}
def __init__(self, gender: int = 1):
self.gender: int = gender
def __str__(self):
return self.... | 24.25 | 50 | 0.512027 | class Gender:
NEUTRAL = 1
FEMALE = 2
MALE = 3
GENDER_STRINGS = {NEUTRAL: "neutral",
FEMALE: "female",
MALE: "male"
}
def __init__(self, gender: int = 1):
self.gender: int = gender
def __str__(self):
return self.... | true | true |
f717cfc7cab0f458b15996bf3bf047fcffdef11f | 3,950 | py | Python | test/functional/feature_minchainwork.py | bontecoin/bontecoin-core | a7c368cf25339b9495e94651ee2a036e4f3068ae | [
"MIT"
] | null | null | null | test/functional/feature_minchainwork.py | bontecoin/bontecoin-core | a7c368cf25339b9495e94651ee2a036e4f3068ae | [
"MIT"
] | null | null | null | test/functional/feature_minchainwork.py | bontecoin/bontecoin-core | a7c368cf25339b9495e94651ee2a036e4f3068ae | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) 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 logic for setting nMinimumChainWork on command line.
Nodes don't consider themselves out of "initial b... | 43.888889 | 108 | 0.702278 |
import time
from test_framework.test_framework import BontecoinTestFramework
from test_framework.util import connect_nodes, assert_equal
REGTEST_WORK_PER_BLOCK = 2
class MinimumChainWorkTest(BontecoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 3
... | true | true |
f717cfc9fd68c709b7614798b5f73cd888527fbd | 2,681 | py | Python | data/LSSVM.py | tejas-9er/SVM-vs-LSSVM | e44f63458680c39df370ddfcdf22e8c450d23128 | [
"MIT"
] | 5 | 2019-12-16T03:29:24.000Z | 2022-02-14T01:26:28.000Z | data/LSSVM.py | tejas-9er/SVM-vs-LSSVM | e44f63458680c39df370ddfcdf22e8c450d23128 | [
"MIT"
] | null | null | null | data/LSSVM.py | tejas-9er/SVM-vs-LSSVM | e44f63458680c39df370ddfcdf22e8c450d23128 | [
"MIT"
] | 5 | 2019-06-18T06:59:35.000Z | 2020-12-19T11:10:56.000Z | import numpy as np
import scipy
from scipy.sparse import linalg
from sklearn.metrics import accuracy_score
class LSSVM:
def __init__(self, kernel = 'linear', C = 1.0,gamma = 1.0, d = 2.0):
kernels = {
'rbf':self.rbf,
'poly':self.polynomial,
'linear':self.linear
}... | 33.098765 | 145 | 0.564342 | import numpy as np
import scipy
from scipy.sparse import linalg
from sklearn.metrics import accuracy_score
class LSSVM:
def __init__(self, kernel = 'linear', C = 1.0,gamma = 1.0, d = 2.0):
kernels = {
'rbf':self.rbf,
'poly':self.polynomial,
'linear':self.linear
}... | true | true |
f717cfcf1da0e79443c3060c50aa0097551bd7be | 1,034 | py | Python | p56_Merge_Intervals.py | bzhou26/leetcode_sol | 82506521e2cc412f96cd1dfc3c8c3ab635f67f73 | [
"MIT"
] | null | null | null | p56_Merge_Intervals.py | bzhou26/leetcode_sol | 82506521e2cc412f96cd1dfc3c8c3ab635f67f73 | [
"MIT"
] | null | null | null | p56_Merge_Intervals.py | bzhou26/leetcode_sol | 82506521e2cc412f96cd1dfc3c8c3ab635f67f73 | [
"MIT"
] | null | null | null | '''
- Leetcode problem: 56
- Difficulty: Medium
- Brief problem description:
Given a collection of intervals, merge all overlapping intervals.
Example 1:
Input: [[1,3],[2,6],[8,10],[15,18]]
Output: [[1,6],[8,10],[15,18]]
Explanation: Since intervals [1,3] and [2,6] overlaps, merge them into [1,6].
Example 2:
Inpu... | 22.478261 | 112 | 0.597679 |
class Solution:
def merge(self, intervals: List[List[int]]) -> List[List[int]]:
hp = []
for i in intervals:
heapq.heappush(hp, i)
result = []
while hp:
inter = heapq.heappop(hp)
if result and inter[0] <= result[-1][1]:
result[-1]... | true | true |
f717cff9e873f6d4ee6ab179e6d452349b4cd40a | 1,032 | py | Python | env/Lib/site-packages/OpenGL/raw/EGL/EXT/device_query.py | 5gconnectedbike/Navio2 | 8c3f2b5d8bbbcea1fc08739945183c12b206712c | [
"BSD-3-Clause"
] | 210 | 2016-04-09T14:26:00.000Z | 2022-03-25T18:36:19.000Z | env/Lib/site-packages/OpenGL/raw/EGL/EXT/device_query.py | 5gconnectedbike/Navio2 | 8c3f2b5d8bbbcea1fc08739945183c12b206712c | [
"BSD-3-Clause"
] | 72 | 2016-09-04T09:30:19.000Z | 2022-03-27T17:06:53.000Z | env/Lib/site-packages/OpenGL/raw/EGL/EXT/device_query.py | 5gconnectedbike/Navio2 | 8c3f2b5d8bbbcea1fc08739945183c12b206712c | [
"BSD-3-Clause"
] | 64 | 2016-04-09T14:26:49.000Z | 2022-03-21T11:19:47.000Z | '''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.EGL import _types as _cs
# End users want this...
from OpenGL.raw.EGL._types import *
from OpenGL.raw.EGL import _errors
from OpenGL.constant import Constant as _C
import ctype... | 39.692308 | 115 | 0.814922 | from OpenGL import platform as _p, arrays
from OpenGL.raw.EGL import _types as _cs
from OpenGL.raw.EGL._types import *
from OpenGL.raw.EGL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_EXTENSION_NAME = 'EGL_EXT_device_query'
def _f( function ):
return _p.createFunction( function,_p.PLATF... | true | true |
f717d0d34b30202c5d6aa299b38730b144f81368 | 238 | py | Python | chapter1-cam.py | gcruchon/test-opencv | fdf7cb7a86f5606ca6df6170107a0264fbc43e9c | [
"CC0-1.0"
] | null | null | null | chapter1-cam.py | gcruchon/test-opencv | fdf7cb7a86f5606ca6df6170107a0264fbc43e9c | [
"CC0-1.0"
] | null | null | null | chapter1-cam.py | gcruchon/test-opencv | fdf7cb7a86f5606ca6df6170107a0264fbc43e9c | [
"CC0-1.0"
] | null | null | null | import cv2
import numpy as np
cap = cv2.VideoCapture(0)
kernel = np.ones((5, 5), np.uint8)
while True:
success, img = cap.read()
cv2.imshow("Cam", cv2.Canny(img, 100, 100))
if cv2.waitKey(1) & 0xFF == ord('q'):
break
| 21.636364 | 47 | 0.609244 | import cv2
import numpy as np
cap = cv2.VideoCapture(0)
kernel = np.ones((5, 5), np.uint8)
while True:
success, img = cap.read()
cv2.imshow("Cam", cv2.Canny(img, 100, 100))
if cv2.waitKey(1) & 0xFF == ord('q'):
break
| true | true |
f717d2356d90cde15cbb3d0d6e7bc7ef270af89b | 320 | py | Python | Beecrowd/1187.py | Gugarauj07/Algorithms | 21c0fe96c1c870a01644d398c446182ced37eb19 | [
"MIT"
] | null | null | null | Beecrowd/1187.py | Gugarauj07/Algorithms | 21c0fe96c1c870a01644d398c446182ced37eb19 | [
"MIT"
] | null | null | null | Beecrowd/1187.py | Gugarauj07/Algorithms | 21c0fe96c1c870a01644d398c446182ced37eb19 | [
"MIT"
] | null | null | null | O = input()
soma = count = 0
for linha in range(12):
for coluna in range(12):
num = float(input())
if linha <= 4 and (10 - linha) >= coluna > linha:
soma += num
count += 1
if O == "S":
print(f"{soma:.1f}")
elif O == "M":
media = soma / count
print(f"{media:.1f}")
| 22.857143 | 57 | 0.484375 | O = input()
soma = count = 0
for linha in range(12):
for coluna in range(12):
num = float(input())
if linha <= 4 and (10 - linha) >= coluna > linha:
soma += num
count += 1
if O == "S":
print(f"{soma:.1f}")
elif O == "M":
media = soma / count
print(f"{media:.1f}")
| true | true |
f717d265ddfccca7c0bcef14a21dd104634baabd | 189 | py | Python | Lesson/lesson-oo-415.py | v-v-tarasov/python-my-lesson | 57f8985cdfe9d9439452d6d3d0f89cf4bfbf2d14 | [
"MIT"
] | null | null | null | Lesson/lesson-oo-415.py | v-v-tarasov/python-my-lesson | 57f8985cdfe9d9439452d6d3d0f89cf4bfbf2d14 | [
"MIT"
] | null | null | null | Lesson/lesson-oo-415.py | v-v-tarasov/python-my-lesson | 57f8985cdfe9d9439452d6d3d0f89cf4bfbf2d14 | [
"MIT"
] | null | null | null | def isPointInSquare(x, y):
return 1.0 >= x >= -1.0 and 1.0 >= y >= -1.0
x = float(input())
y = float(input())
if isPointInSquare(x, y) == True:
print('YES')
else:
print('NO')
| 17.181818 | 48 | 0.544974 | def isPointInSquare(x, y):
return 1.0 >= x >= -1.0 and 1.0 >= y >= -1.0
x = float(input())
y = float(input())
if isPointInSquare(x, y) == True:
print('YES')
else:
print('NO')
| true | true |
f717d32ab2f0db9bf60e9f86574ade09c2ab6e47 | 208 | py | Python | 3_Django/PROJECT_NAME/APP_NAME/urls.py | kevinbeirne1/CS50-course | b6247cdea50890369a5e0fd60017980643bf6e37 | [
"MIT"
] | 1 | 2021-08-31T20:52:41.000Z | 2021-08-31T20:52:41.000Z | 3_Django/PROJECT_NAME/APP_NAME/urls.py | kevinbeirne1/CS50-course | b6247cdea50890369a5e0fd60017980643bf6e37 | [
"MIT"
] | null | null | null | 3_Django/PROJECT_NAME/APP_NAME/urls.py | kevinbeirne1/CS50-course | b6247cdea50890369a5e0fd60017980643bf6e37 | [
"MIT"
] | null | null | null | from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name="index"),
path('<str:name>', views.greet, name="greet"),
# path('david/', views.david, name="david"),
] | 26 | 50 | 0.629808 | from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name="index"),
path('<str:name>', views.greet, name="greet"),
] | true | true |
f717d4456b785afc6a7d4ab258496baf58e1cea9 | 2,004 | py | Python | diary/forms.py | j3ygh/ctdb | 3c4b90c5265125fc37aa9ac569b7f39ffd5b13c9 | [
"MIT"
] | 1 | 2021-12-27T02:18:19.000Z | 2021-12-27T02:18:19.000Z | diary/forms.py | j3ygh/ctdb | 3c4b90c5265125fc37aa9ac569b7f39ffd5b13c9 | [
"MIT"
] | null | null | null | diary/forms.py | j3ygh/ctdb | 3c4b90c5265125fc37aa9ac569b7f39ffd5b13c9 | [
"MIT"
] | 1 | 2022-03-14T06:52:48.000Z | 2022-03-14T06:52:48.000Z | from django import forms
from django.utils.translation import gettext_lazy as _
from .models import Diary
class DiaryModelForm(forms.ModelForm):
class Meta:
widgets = {
'date': forms.DateInput(attrs={'type': 'date'}),
'daily_record': forms.Textarea(attrs={'rows': 4, 'class': 'cked... | 42.638298 | 122 | 0.586826 | from django import forms
from django.utils.translation import gettext_lazy as _
from .models import Diary
class DiaryModelForm(forms.ModelForm):
class Meta:
widgets = {
'date': forms.DateInput(attrs={'type': 'date'}),
'daily_record': forms.Textarea(attrs={'rows': 4, 'class': 'cked... | true | true |
f717d534a0b8a9554184e8b7505e68a755c8fbed | 2,086 | py | Python | app/models/Config.py | samousli/ikiru | 4a4a002db398dd7ba1b112ea406c92b0a8cb6c37 | [
"MIT"
] | null | null | null | app/models/Config.py | samousli/ikiru | 4a4a002db398dd7ba1b112ea406c92b0a8cb6c37 | [
"MIT"
] | null | null | null | app/models/Config.py | samousli/ikiru | 4a4a002db398dd7ba1b112ea406c92b0a8cb6c37 | [
"MIT"
] | null | null | null | from ast import literal_eval
import enum
import logging
from . import db
from .Base import Base
LOG = logging.getLogger(__name__)
class ValueType(enum.Enum):
Int = (1, int, int)
Bool = (2, bool, lambda b: b == 'True')
Float = (3, float, float)
Text = (4, str, lambda s: s)
Tuple = (5, tuple, lite... | 31.606061 | 87 | 0.645733 | from ast import literal_eval
import enum
import logging
from . import db
from .Base import Base
LOG = logging.getLogger(__name__)
class ValueType(enum.Enum):
Int = (1, int, int)
Bool = (2, bool, lambda b: b == 'True')
Float = (3, float, float)
Text = (4, str, lambda s: s)
Tuple = (5, tuple, lite... | true | true |
f717d61c108d4a173265538f31a31ca0754a90ee | 2,281 | py | Python | Lectures/lec_05/genSymbolImg.py | diable201/ComputerVision | 5ee153363fa6757d3cd8b1add3e5d48b01a499e2 | [
"MIT"
] | 1 | 2021-02-23T08:44:02.000Z | 2021-02-23T08:44:02.000Z | Lectures/lec_05/genSymbolImg.py | diable201/ComputerVision | 5ee153363fa6757d3cd8b1add3e5d48b01a499e2 | [
"MIT"
] | 1 | 2021-02-23T09:12:44.000Z | 2021-02-27T17:05:58.000Z | Lectures/lec_05/genSymbolImg.py | diable201/ComputerVision | 5ee153363fa6757d3cd8b1add3e5d48b01a499e2 | [
"MIT"
] | 1 | 2021-02-28T14:15:57.000Z | 2021-02-28T14:15:57.000Z | import cv2
import numpy as np
from random import randint, uniform
import string, random
def addNoise(image):
row,col = image.shape
s_vs_p = 0.4
amount = 0.01
out = np.copy(image)
# Salt mode
num_salt = np.ceil(amount * image.size * s_vs_p)
coords = [np.random.randint(0, i - 1, int(num_... | 22.145631 | 96 | 0.551074 | import cv2
import numpy as np
from random import randint, uniform
import string, random
def addNoise(image):
row,col = image.shape
s_vs_p = 0.4
amount = 0.01
out = np.copy(image)
num_salt = np.ceil(amount * image.size * s_vs_p)
coords = [np.random.randint(0, i - 1, int(num_salt))
... | true | true |
f717d65f584bd26a05f750dc31f00fd352a9f051 | 7,242 | py | Python | filer/admin/clipboardadmin.py | haricot/django-filer | f3b90fbbb90a3c99ade104b1c3190621773fa7e1 | [
"BSD-3-Clause"
] | null | null | null | filer/admin/clipboardadmin.py | haricot/django-filer | f3b90fbbb90a3c99ade104b1c3190621773fa7e1 | [
"BSD-3-Clause"
] | 11 | 2019-11-02T20:57:52.000Z | 2020-09-27T09:08:33.000Z | filer/admin/clipboardadmin.py | haricot/django-filer | f3b90fbbb90a3c99ade104b1c3190621773fa7e1 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.conf.urls import url
from django.contrib import admin
from django.forms.models import modelform_factory
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
from .. import settings as filer_settings
from ..... | 38.521277 | 90 | 0.543496 | from __future__ import absolute_import
from django.conf.urls import url
from django.contrib import admin
from django.forms.models import modelform_factory
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
from .. import settings as filer_settings
from ..models import Clipboard,... | true | true |
f717d6a1554caa5ee66a91c8ac8b847a9b74aadc | 1,083 | py | Python | indico/modules/events/reminders/blueprint.py | uxmaster/indico | ecd19f17ef6fdc9f5584f59c87ec647319ce5d31 | [
"MIT"
] | 1 | 2019-11-03T11:34:16.000Z | 2019-11-03T11:34:16.000Z | indico/modules/events/reminders/blueprint.py | NP-compete/indico | 80db7ca0ef9d1f3240a16b9ff2d84bf0bf26c549 | [
"MIT"
] | null | null | null | indico/modules/events/reminders/blueprint.py | NP-compete/indico | 80db7ca0ef9d1f3240a16b9ff2d84bf0bf26c549 | [
"MIT"
] | null | null | null | # This file is part of Indico.
# Copyright (C) 2002 - 2019 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from indico.modules.events.reminders.controllers import (RHAddRem... | 47.086957 | 112 | 0.710988 |
from __future__ import unicode_literals
from indico.modules.events.reminders.controllers import (RHAddReminder, RHDeleteReminder, RHEditReminder,
RHListReminders, RHPreviewReminder)
from indico.web.flask.wrappers import IndicoBlueprint
_bp = IndicoBlueprint('... | true | true |
f717d74e6dbd251d84df1d67ed85b3b52ba68270 | 2,105 | py | Python | labellab-flask/api/models/User.py | darkshredder/LabelLab | fc762e6eea52b9023e38ba5f32bbcaa7cbc17dbe | [
"Apache-2.0"
] | 70 | 2019-01-25T19:16:00.000Z | 2022-03-23T14:37:28.000Z | labellab-flask/api/models/User.py | darkshredder/LabelLab | fc762e6eea52b9023e38ba5f32bbcaa7cbc17dbe | [
"Apache-2.0"
] | 350 | 2019-01-30T10:50:34.000Z | 2022-03-31T19:58:44.000Z | labellab-flask/api/models/User.py | darkshredder/LabelLab | fc762e6eea52b9023e38ba5f32bbcaa7cbc17dbe | [
"Apache-2.0"
] | 140 | 2019-01-30T08:53:35.000Z | 2022-03-25T15:37:12.000Z | from datetime import datetime
from flask import current_app, jsonify
from flask_bcrypt import Bcrypt
import json
from api.extensions import db, Base, ma
class User(db.Model):
"""
This model holds information about a user registered
"""
__tablename__ = "user"
id = db.Column(db.Integer, primary_key... | 33.951613 | 94 | 0.560095 | from datetime import datetime
from flask import current_app, jsonify
from flask_bcrypt import Bcrypt
import json
from api.extensions import db, Base, ma
class User(db.Model):
__tablename__ = "user"
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80), nullable=False)
username =... | true | true |
f717d76a526f8cc95d2243ac714a7311f53a0737 | 4,588 | py | Python | Project2/program1/clean.py | Sandeep-AnilKumar/Data-Science-Projects | b7d890f855ffc6edd0544ff3bd115fa85d19fd4f | [
"MIT"
] | null | null | null | Project2/program1/clean.py | Sandeep-AnilKumar/Data-Science-Projects | b7d890f855ffc6edd0544ff3bd115fa85d19fd4f | [
"MIT"
] | null | null | null | Project2/program1/clean.py | Sandeep-AnilKumar/Data-Science-Projects | b7d890f855ffc6edd0544ff3bd115fa85d19fd4f | [
"MIT"
] | null | null | null | import sys
import re
import string
# dictionary to store clean data.
cleaned_data = {}
# list of professors
professors = []
# list of courses
courses = []
def createdict(profname, course_list):
new_course_list = []
is_course_match = False
profname = profname.title()
prof_courses = course_list.split('... | 35.022901 | 104 | 0.549259 | import sys
import re
import string
cleaned_data = {}
professors = []
courses = []
def createdict(profname, course_list):
new_course_list = []
is_course_match = False
profname = profname.title()
prof_courses = course_list.split('|')
prof_courses = [course.strip() for course in prof_courses]
if... | true | true |
f717d7ca70131a15c0bee7dca10a57ff4d0cb3db | 9,967 | py | Python | spacy_pytorch_transformers/pipeline/tok2vec.py | tamuhey/spacy-pytorch-transformers | 1b4a58505ee3618a6288a47d4b5716981e39e581 | [
"MIT"
] | 1 | 2021-01-11T19:35:46.000Z | 2021-01-11T19:35:46.000Z | spacy_pytorch_transformers/pipeline/tok2vec.py | tamuhey/spacy-pytorch-transformers | 1b4a58505ee3618a6288a47d4b5716981e39e581 | [
"MIT"
] | null | null | null | spacy_pytorch_transformers/pipeline/tok2vec.py | tamuhey/spacy-pytorch-transformers | 1b4a58505ee3618a6288a47d4b5716981e39e581 | [
"MIT"
] | null | null | null | from typing import Any, List
from thinc.neural.ops import get_array_module
from spacy.pipeline import Pipe
from spacy.tokens import Doc
from spacy.vocab import Vocab
from spacy.util import minibatch
from ..wrapper import PyTT_Wrapper
from ..model_registry import get_model_function
from ..activations import Activations... | 40.681633 | 88 | 0.631685 | from typing import Any, List
from thinc.neural.ops import get_array_module
from spacy.pipeline import Pipe
from spacy.tokens import Doc
from spacy.vocab import Vocab
from spacy.util import minibatch
from ..wrapper import PyTT_Wrapper
from ..model_registry import get_model_function
from ..activations import Activations... | true | true |
f717d7dbab9408394ce847244ea76b8cf45150f2 | 10,895 | py | Python | tau.py | cradesto/pystella | f6f44ed12d9648585a52a09e15d494daa4c70c59 | [
"MIT"
] | 1 | 2019-08-08T13:11:57.000Z | 2019-08-08T13:11:57.000Z | tau.py | cradesto/pystella | f6f44ed12d9648585a52a09e15d494daa4c70c59 | [
"MIT"
] | null | null | null | tau.py | cradesto/pystella | f6f44ed12d9648585a52a09e15d494daa4c70c59 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import argparse
import logging
import numpy as np
import pystella as ps
from pystella.model.sn_tau import StellaTauDetail
mpl_logger = logging.getLogger('matplotlib')
mpl_logger.setLevel(logging.WARNING)
__author__ = 'bakl'
# todo Show filters
# todo show valuse for filters
# todo compute SE... | 33.626543 | 110 | 0.534832 |
import argparse
import logging
import numpy as np
import pystella as ps
from pystella.model.sn_tau import StellaTauDetail
mpl_logger = logging.getLogger('matplotlib')
mpl_logger.setLevel(logging.WARNING)
__author__ = 'bakl'
def plot_tau_moments(tau, moments=None, xlim=None):
import matplotlib.pyplot as plt
... | true | true |
f717d82ecf5183dae516e756dfbcb6f492d9702a | 1,019 | py | Python | tests/__init__.py | dolfinus/pexpect | 3453ea9b8b326179cf720351001e64c7ea6b07bc | [
"0BSD"
] | 2,132 | 2015-01-02T12:48:45.000Z | 2022-03-28T05:32:54.000Z | tests/__init__.py | dolfinus/pexpect | 3453ea9b8b326179cf720351001e64c7ea6b07bc | [
"0BSD"
] | 1,274 | 2015-09-22T20:06:16.000Z | 2018-08-31T22:14:00.000Z | tests/__init__.py | dolfinus/pexpect | 3453ea9b8b326179cf720351001e64c7ea6b07bc | [
"0BSD"
] | 517 | 2015-01-07T02:09:44.000Z | 2022-03-26T14:18:23.000Z |
'''
PEXPECT LICENSE
This license is approved by the OSI and FSF as GPL-compatible.
http://opensource.org/licenses/isc-license.txt
Copyright (c) 2012, Noah Spurrier <noah@noah.org>
PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY
PURPOSE WITH OR WITHOUT FEE IS HEREBY GR... | 39.192308 | 76 | 0.750736 |
pass
| true | true |
f717da674668d80ac70707def8bcf6d62e7209d0 | 2,410 | py | Python | git_nit/tests/test_parse_review_id.py | dhellmann/git-nit | 9fce9eb8806d6997182107eb5d755a1220fa5e88 | [
"Apache-2.0"
] | 8 | 2018-04-27T07:03:50.000Z | 2018-10-02T08:05:40.000Z | git_nit/tests/test_parse_review_id.py | dhellmann/git-nit | 9fce9eb8806d6997182107eb5d755a1220fa5e88 | [
"Apache-2.0"
] | null | null | null | git_nit/tests/test_parse_review_id.py | dhellmann/git-nit | 9fce9eb8806d6997182107eb5d755a1220fa5e88 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
#
# 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... | 33.013699 | 74 | 0.554357 |
from git_nit import cmd
import testscenarios.testcase
import testtools
class ParseReviewIDTest(testscenarios.testcase.WithScenarios,
testtools.TestCase):
scenarios = [
('fragment with patchset', {
'url': 'https://review.openstack.org/#/c/564559/5/',
'revi... | true | true |
f717da9d442484cb8be34d4f36e19f573b0849be | 10,841 | py | Python | happybase_mock/table.py | evgenia-ch/happybase-mock | 6fbf4a4f9685829b32ad8dc3de3e01b2a9fba964 | [
"MIT"
] | null | null | null | happybase_mock/table.py | evgenia-ch/happybase-mock | 6fbf4a4f9685829b32ad8dc3de3e01b2a9fba964 | [
"MIT"
] | null | null | null | happybase_mock/table.py | evgenia-ch/happybase-mock | 6fbf4a4f9685829b32ad8dc3de3e01b2a9fba964 | [
"MIT"
] | 3 | 2018-05-15T14:10:23.000Z | 2020-08-12T13:45:28.000Z | import struct
import time
import six
from six import iteritems
from .batch import Batch
def _check_table_existence(method):
def wrap(table, *args, **kwargs):
if not table._exists():
raise IOError('TableNotFoundException: %s' % table.name)
return method(table, *args, **kwargs)
retu... | 33.984326 | 85 | 0.54091 | import struct
import time
import six
from six import iteritems
from .batch import Batch
def _check_table_existence(method):
def wrap(table, *args, **kwargs):
if not table._exists():
raise IOError('TableNotFoundException: %s' % table.name)
return method(table, *args, **kwargs)
retu... | true | true |
f717dab203ae844f0e1a238ee942846c22823c19 | 38,297 | py | Python | test/terra/backends/qasm_simulator/qasm_snapshot.py | ares201005/qiskit-aer | fb3bab00ab810e73ad333b0f538fa6c3c53f054e | [
"Apache-2.0"
] | null | null | null | test/terra/backends/qasm_simulator/qasm_snapshot.py | ares201005/qiskit-aer | fb3bab00ab810e73ad333b0f538fa6c3c53f054e | [
"Apache-2.0"
] | null | null | null | test/terra/backends/qasm_simulator/qasm_snapshot.py | ares201005/qiskit-aer | fb3bab00ab810e73ad333b0f538fa6c3c53f054e | [
"Apache-2.0"
] | null | null | null | # This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... | 44.844262 | 85 | 0.589733 |
import logging
import itertools as it
import numpy as np
from qiskit import QuantumCircuit
from qiskit.compiler import assemble
from qiskit.quantum_info import DensityMatrix, Pauli, Operator
from qiskit.providers.aer import QasmSimulator
from qiskit.providers.aer import AerError
from test.terra.reference.ref_snapsho... | true | true |
f717dab74980995a0147cf18b683ffeabedb256b | 9,351 | py | Python | samoyed_ts/nmt.py | oshiooshi/cirneco | f71f1cd583bf6e290d7b8e74f148f06cadd39d63 | [
"MIT"
] | null | null | null | samoyed_ts/nmt.py | oshiooshi/cirneco | f71f1cd583bf6e290d7b8e74f148f06cadd39d63 | [
"MIT"
] | null | null | null | samoyed_ts/nmt.py | oshiooshi/cirneco | f71f1cd583bf6e290d7b8e74f148f06cadd39d63 | [
"MIT"
] | 13 | 2021-07-01T07:58:30.000Z | 2021-09-09T16:52:22.000Z | import torch
# import torchtext
import torch.nn as nn
# from torchtext.vocab import Vocab, build_vocab_from_iterator
# from torchtext.utils import unicode_csv_reader
# from torchtext.data.datasets_utils import _RawTextIterableDataset
from torch import Tensor
from typing import Iterable, List
# import sentencepiece as s... | 39.791489 | 127 | 0.634371 | import torch
import torch.nn as nn
from torch import Tensor
from typing import Iterable, List
import math
import vocab
SEED = 1234
torch.manual_seed(SEED)
torch.cuda.manual_seed(SEED)
UNK_IDX, PAD_IDX, SOS_IDX, EOS_IDX = 0, 1, 2, 3
special_symbols = ['<unk>', '<pad>', '<sos>', '<eos>', '<blk>', '</blk>', '<sep>']
MA... | true | true |
f717dbb4e70ad1e7af8abf4d384448d348389a87 | 9,237 | py | Python | neo/io/pynnio.py | lkoelman/python-neo | 6b0454519b4ead6605d3ce4100a07c33f57df830 | [
"BSD-3-Clause"
] | null | null | null | neo/io/pynnio.py | lkoelman/python-neo | 6b0454519b4ead6605d3ce4100a07c33f57df830 | [
"BSD-3-Clause"
] | 8 | 2018-06-02T11:46:10.000Z | 2018-09-04T15:51:45.000Z | src/neo/neo/io/pynnio.py | grg2rsr/SeqPeelSort | 58a207976fb33a50ea8e42b70d7da73b03474f42 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Module for reading/writing data from/to legacy PyNN formats.
PyNN is available at http://neuralensemble.org/PyNN
Classes:
PyNNNumpyIO
PyNNTextIO
Supported: Read/Write
Authors: Andrew Davison, Pierre Yger
"""
from itertools import chain
import numpy
import quantities as pq
import... | 36.800797 | 105 | 0.590343 |
from itertools import chain
import numpy
import quantities as pq
import warnings
from neo.io.baseio import BaseIO
from neo.core import Segment, AnalogSignal, SpikeTrain
try:
unicode
PY2 = True
except NameError:
PY2 = False
UNITS_MAP = {
'spikes': pq.ms,
'v': pq.mV,
'gsyn': pq.UnitQuantity('m... | true | true |
f717dc0c491e0e926111b82f4d9a35f3ae57502b | 397 | py | Python | class_book/wsgi.py | 3crabs/class-book | f5de12be816aa9be889d8413007be8eb4abdf45f | [
"WTFPL"
] | 1 | 2020-11-19T14:49:41.000Z | 2020-11-19T14:49:41.000Z | class_book/wsgi.py | 3crabs/class-book | f5de12be816aa9be889d8413007be8eb4abdf45f | [
"WTFPL"
] | null | null | null | class_book/wsgi.py | 3crabs/class-book | f5de12be816aa9be889d8413007be8eb4abdf45f | [
"WTFPL"
] | null | null | null | """
WSGI config for class_book 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_SE... | 23.352941 | 78 | 0.788413 |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'class_book.settings')
application = get_wsgi_application()
| true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.