hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 417k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 1
class | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c3b8c1a040c940ae6e79c7eb41f1a4ba4854214 | 16,712 | py | Python | src/Nvidia-StyleGAN/results/00013-sgan-custom_dataset-1gpu/src/train.py | vignesh-pagadala/phishing-detection-gan | 193154f71e7abb37314cbf4aba580062fa87a672 | [
"Apache-2.0"
] | 1 | 2022-03-09T07:40:31.000Z | 2022-03-09T07:40:31.000Z | src/Nvidia-StyleGAN/results/00014-sgan-custom_dataset-1gpu/src/train.py | vignesh-pagadala/phishing-detection-gan | 193154f71e7abb37314cbf4aba580062fa87a672 | [
"Apache-2.0"
] | null | null | null | src/Nvidia-StyleGAN/results/00014-sgan-custom_dataset-1gpu/src/train.py | vignesh-pagadala/phishing-detection-gan | 193154f71e7abb37314cbf4aba580062fa87a672 | [
"Apache-2.0"
] | 2 | 2021-07-02T20:16:05.000Z | 2022-03-09T07:40:39.000Z | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain ... | 86.14433 | 302 | 0.622487 |
import copy
import dnnlib
from dnnlib import EasyDict
import config
from metrics import metric_base
if 1:
desc = 'sgan' train = EasyDict(run_func_name='training.training_loop.training_loop') G = EasyDic... | true | true |
1c3b8ca5afcb581835c8a7ef7d06ea1ed3df160d | 539 | py | Python | cgbeacon2/constants/__init__.py | Clinical-Genomics/cgbeacon2 | 968771c80d65b265141a0a67c6c58c565536fa49 | [
"MIT"
] | null | null | null | cgbeacon2/constants/__init__.py | Clinical-Genomics/cgbeacon2 | 968771c80d65b265141a0a67c6c58c565536fa49 | [
"MIT"
] | 169 | 2020-04-08T08:34:17.000Z | 2022-03-31T12:25:30.000Z | cgbeacon2/constants/__init__.py | Clinical-Genomics/cgbeacon2 | 968771c80d65b265141a0a67c6c58c565536fa49 | [
"MIT"
] | 1 | 2020-10-26T15:50:56.000Z | 2020-10-26T15:50:56.000Z | from .consent_codes import CONSENT_CODES
from .variant_constants import CHROMOSOMES
from .query_errors import (
NO_MANDATORY_PARAMS,
NO_SECONDARY_PARAMS,
NO_POSITION_PARAMS,
INVALID_COORDINATES,
BUILD_MISMATCH,
)
from .oauth_errors import (
MISSING_PUBLIC_KEY,
MISSING_TOKEN_CLAIMS,
INVAL... | 25.666667 | 55 | 0.795918 | from .consent_codes import CONSENT_CODES
from .variant_constants import CHROMOSOMES
from .query_errors import (
NO_MANDATORY_PARAMS,
NO_SECONDARY_PARAMS,
NO_POSITION_PARAMS,
INVALID_COORDINATES,
BUILD_MISMATCH,
)
from .oauth_errors import (
MISSING_PUBLIC_KEY,
MISSING_TOKEN_CLAIMS,
INVAL... | true | true |
1c3b8d49c184ec6f47976fcb0921813004ec198e | 5,294 | py | Python | ethereum_private/init_chain_admin.py | alesiong/dpass-pc-backend | b787621133eb4d250380bfd394e8e6a5f1292640 | [
"MIT"
] | null | null | null | ethereum_private/init_chain_admin.py | alesiong/dpass-pc-backend | b787621133eb4d250380bfd394e8e6a5f1292640 | [
"MIT"
] | null | null | null | ethereum_private/init_chain_admin.py | alesiong/dpass-pc-backend | b787621133eb4d250380bfd394e8e6a5f1292640 | [
"MIT"
] | null | null | null | """
Init the ethereum private chain. This script should be run only once for each unique private chain.
This script is for administrator, as it will deploy the factory contract to the chain.
Chain initialization for end user is run when the server starts.
You need to have `geth` in PATH.
This script may not work on win... | 41.359375 | 125 | 0.635436 | import argparse
import getpass
import json
import os
import subprocess
from pathlib import Path
import time
from web3 import Web3, IPCProvider
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[... | true | true |
1c3b8e5da1c72d325d541aeb4ff0e38fc1ef4c49 | 1,278 | py | Python | PythonBaseDemo/fileIOdemo/12.7/test.py | CypHelp/TestNewWorldDemo | ee6f73df05756f191c1c56250fa290461fdd1b9a | [
"Apache-2.0"
] | null | null | null | PythonBaseDemo/fileIOdemo/12.7/test.py | CypHelp/TestNewWorldDemo | ee6f73df05756f191c1c56250fa290461fdd1b9a | [
"Apache-2.0"
] | null | null | null | PythonBaseDemo/fileIOdemo/12.7/test.py | CypHelp/TestNewWorldDemo | ee6f73df05756f191c1c56250fa290461fdd1b9a | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
#########################################################################
# 网站: <a href="http://www.crazyit.org">疯狂Java联盟</a> #
# author yeeku.H.lee kongyeeku@163.com #
# #
# version 1.0 ... | 37.588235 | 73 | 0.241002 | import os, sys
fd = os.open("f1.txt",os.O_RDWR|os.O_CREAT)
print(fd)
| true | true |
1c3b8f17dd7de87e6422c0c380a155afbb757940 | 943 | py | Python | hippoapi/scripts/paramiko_transport.py | like-ycy/hippo_api | 708751a6bf9bfc69a4139dac90820f09e0ba042a | [
"MIT"
] | null | null | null | hippoapi/scripts/paramiko_transport.py | like-ycy/hippo_api | 708751a6bf9bfc69a4139dac90820f09e0ba042a | [
"MIT"
] | null | null | null | hippoapi/scripts/paramiko_transport.py | like-ycy/hippo_api | 708751a6bf9bfc69a4139dac90820f09e0ba042a | [
"MIT"
] | null | null | null | import paramiko
from paramiko.ssh_exception import AuthenticationException
"""
transport模式
"""
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
# 1、密码连接
ssh.connect(hostname='192.168.174.23', username='root', password='123.com')
# 2、秘钥连接
# pkey = RSAKey.from_p... | 24.179487 | 79 | 0.630965 | import paramiko
from paramiko.ssh_exception import AuthenticationException
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
ssh.connect(hostname='192.168.174.23', username='root', password='123.com')
while True:
cli = ssh.get_transport(... | true | true |
1c3b90aabb486e78ca185ec99144aefce7e93bab | 2,351 | py | Python | google/cloud/mediatranslation_v1beta1/services/speech_translation_service/transports/base.py | vam-google/python-media-translation | 6b7cf38268b8b42373db97d2f70d2089e4c57462 | [
"Apache-2.0"
] | null | null | null | google/cloud/mediatranslation_v1beta1/services/speech_translation_service/transports/base.py | vam-google/python-media-translation | 6b7cf38268b8b42373db97d2f70d2089e4c57462 | [
"Apache-2.0"
] | null | null | null | google/cloud/mediatranslation_v1beta1/services/speech_translation_service/transports/base.py | vam-google/python-media-translation | 6b7cf38268b8b42373db97d2f70d2089e4c57462 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 32.652778 | 78 | 0.682263 |
import abc
import typing
from google import auth
from google.auth import credentials
from google.cloud.mediatranslation_v1beta1.types import media_translation
class SpeechTranslationServiceTransport(metaclass=abc.ABCMeta):
AUTH_SCOPES = ("https://www.googleapis.com/auth/cloud-platform",)
def __init__(
... | true | true |
1c3b911492a60c6d7276ed012bdfeccdc209cf10 | 21,229 | py | Python | venv/Lib/site-packages/PyOpenGL-3.0.1/OpenGL/GL/images.py | temelkirci/Motion_Editor | a8b8d4c4d2dcc9be28385600f56066cef92a38ad | [
"MIT"
] | 1 | 2022-03-02T17:07:20.000Z | 2022-03-02T17:07:20.000Z | venv/Lib/site-packages/PyOpenGL-3.0.1/OpenGL/GL/images.py | temelkirci/RealTime_6DOF_Motion_Editor | a8b8d4c4d2dcc9be28385600f56066cef92a38ad | [
"MIT"
] | null | null | null | venv/Lib/site-packages/PyOpenGL-3.0.1/OpenGL/GL/images.py | temelkirci/RealTime_6DOF_Motion_Editor | a8b8d4c4d2dcc9be28385600f56066cef92a38ad | [
"MIT"
] | null | null | null | """Image-handling routines
### Unresolved:
Following methods are not yet resolved due to my not being sure how the
function should be wrapped:
glCompressedTexImage3D
glCompressedTexImage2D
glCompressedTexImage1D
glCompressedTexSubImage3D
glCompressedTexSubImage2D
... | 34.801639 | 103 | 0.68218 | from OpenGL.raw import GL as simple
from OpenGL import images, arrays, wrapper, platform
import ctypes
def asInt( value ):
if isinstance( value, float ):
return int(round(value,0))
return value
images.COMPONENT_COUNTS.update( {
simple.GL_BITMAP : 1,
simple.GL_RED : 1,
simple.GL_GREEN ... | true | true |
1c3b911fd355be54f104f5f1f71cbc02840658dd | 40,479 | py | Python | nova/tests/compute/test_compute_mgr.py | bopopescu/nova-40 | d8d5e4c4e30d0e605001ebab9f19005d2ea96f99 | [
"Apache-2.0"
] | null | null | null | nova/tests/compute/test_compute_mgr.py | bopopescu/nova-40 | d8d5e4c4e30d0e605001ebab9f19005d2ea96f99 | [
"Apache-2.0"
] | null | null | null | nova/tests/compute/test_compute_mgr.py | bopopescu/nova-40 | d8d5e4c4e30d0e605001ebab9f19005d2ea96f99 | [
"Apache-2.0"
] | 1 | 2020-07-24T09:44:17.000Z | 2020-07-24T09:44:17.000Z | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | 45.635851 | 79 | 0.618148 |
import time
import mox
from oslo.config import cfg
from nova.compute import power_state
from nova.compute import task_states
from nova.compute import utils as compute_utils
from nova.compute import vm_states
from nova.conductor import rpcapi as conductor_rpcapi
from nova import context
from nova import db
from nova... | true | true |
1c3b91be38d7610a2ed63edb3407d29e0df7c1fa | 2,801 | py | Python | rgw/v2/lib/nfs_ganesha/nfslib.py | rpratap-bot/ceph-qe-scripts | 8a7090d6707a8e7b927eabfc9c9212f343a35bc4 | [
"MIT"
] | null | null | null | rgw/v2/lib/nfs_ganesha/nfslib.py | rpratap-bot/ceph-qe-scripts | 8a7090d6707a8e7b927eabfc9c9212f343a35bc4 | [
"MIT"
] | null | null | null | rgw/v2/lib/nfs_ganesha/nfslib.py | rpratap-bot/ceph-qe-scripts | 8a7090d6707a8e7b927eabfc9c9212f343a35bc4 | [
"MIT"
] | null | null | null | import os, sys
import logging
sys.path.append(os.path.abspath(os.path.join(__file__, "../../../")))
from v2.lib.nfs_ganesha.write_io_info import IOInfo
import v2.utils.utils as utils
import v2.lib.manage_data as manage_date
log = logging.getLogger()
dir_info = {'basedir': 0,
'files': 10,
'subd... | 26.67619 | 92 | 0.49875 | import os, sys
import logging
sys.path.append(os.path.abspath(os.path.join(__file__, "../../../")))
from v2.lib.nfs_ganesha.write_io_info import IOInfo
import v2.utils.utils as utils
import v2.lib.manage_data as manage_date
log = logging.getLogger()
dir_info = {'basedir': 0,
'files': 10,
'subd... | true | true |
1c3b93a07647ff7f7f0a8577a0848b269271d644 | 3,507 | py | Python | temboo/core/Library/Labs/GoodCitizen/EcoByZip.py | jordanemedlock/psychtruths | 52e09033ade9608bd5143129f8a1bfac22d634dd | [
"Apache-2.0"
] | 7 | 2016-03-07T02:07:21.000Z | 2022-01-21T02:22:41.000Z | temboo/core/Library/Labs/GoodCitizen/EcoByZip.py | jordanemedlock/psychtruths | 52e09033ade9608bd5143129f8a1bfac22d634dd | [
"Apache-2.0"
] | null | null | null | temboo/core/Library/Labs/GoodCitizen/EcoByZip.py | jordanemedlock/psychtruths | 52e09033ade9608bd5143129f8a1bfac22d634dd | [
"Apache-2.0"
] | 8 | 2016-06-14T06:01:11.000Z | 2020-04-22T09:21:44.000Z | # -*- coding: utf-8 -*-
###############################################################################
#
# EcoByZip
# Returns a host of eco-conscious environmental information for a specified location based on zip code.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache Li... | 37.709677 | 194 | 0.682635 |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class EcoByZip(Choreography):
def __init__(self, temboo_session):
super(EcoByZip, self)._... | true | true |
1c3b93e3b4d64425f75c0f00fe5ccfbefb2f3147 | 43 | py | Python | docs/source/plots/var_plot_irf.py | madhushree14/statsmodels | 04f00006a7aeb1c93d6894caa420698400da6c33 | [
"BSD-3-Clause"
] | 6,931 | 2015-01-01T11:41:55.000Z | 2022-03-31T17:03:24.000Z | docs/source/plots/var_plot_irf.py | madhushree14/statsmodels | 04f00006a7aeb1c93d6894caa420698400da6c33 | [
"BSD-3-Clause"
] | 6,137 | 2015-01-01T00:33:45.000Z | 2022-03-31T22:53:17.000Z | docs/source/plots/var_plot_irf.py | madhushree14/statsmodels | 04f00006a7aeb1c93d6894caa420698400da6c33 | [
"BSD-3-Clause"
] | 2,608 | 2015-01-02T21:32:31.000Z | 2022-03-31T07:38:30.000Z | from var_plots import plot_irf
plot_irf()
| 10.75 | 30 | 0.813953 | from var_plots import plot_irf
plot_irf()
| true | true |
1c3b953f96fe6a07f40d66ce24e0c53ff7627cbb | 687 | py | Python | tests/test_validators.py | rhblind/django-timberjack | 7a3208b8aa85d6c29f9978a26f6fa920363aa65d | [
"MIT"
] | null | null | null | tests/test_validators.py | rhblind/django-timberjack | 7a3208b8aa85d6c29f9978a26f6fa920363aa65d | [
"MIT"
] | 1 | 2020-02-11T23:41:38.000Z | 2020-02-11T23:41:38.000Z | tests/test_validators.py | rhblind/django-timberjack | 7a3208b8aa85d6c29f9978a26f6fa920363aa65d | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from django.test import TestCase
from mongoengine import ValidationError
from timberjack.validators import validate_ip_address
class ValidateIPAddressTestCase(TestCase):
def test_validate_valid_ip_address(self):
values = ['127.0.0.1', '1.1.1.1', '255.0.0.0', '0.0.0.0', 'fe80::1',... | 36.157895 | 102 | 0.646288 |
from django.test import TestCase
from mongoengine import ValidationError
from timberjack.validators import validate_ip_address
class ValidateIPAddressTestCase(TestCase):
def test_validate_valid_ip_address(self):
values = ['127.0.0.1', '1.1.1.1', '255.0.0.0', '0.0.0.0', 'fe80::1', '::1', '1:2:3:4:5:6:7:8... | true | true |
1c3b9569eb9997c66926e02d8ea3de077756c3c3 | 976 | py | Python | out/fibo.py | FardaleM/metalang | 171557c540f3e2c051ec39ea150afb740c1f615f | [
"BSD-2-Clause"
] | 22 | 2017-04-24T10:00:45.000Z | 2021-04-01T10:11:05.000Z | out/fibo.py | FardaleM/metalang | 171557c540f3e2c051ec39ea150afb740c1f615f | [
"BSD-2-Clause"
] | 12 | 2017-03-26T18:34:21.000Z | 2019-03-21T19:13:03.000Z | out/fibo.py | FardaleM/metalang | 171557c540f3e2c051ec39ea150afb740c1f615f | [
"BSD-2-Clause"
] | 7 | 2017-10-14T13:33:33.000Z | 2021-03-18T15:18:50.000Z | import sys
char_ = None
def readchar_():
global char_
if char_ == None:
char_ = sys.stdin.read(1)
return char_
def skipchar():
global char_
char_ = None
return
def stdinsep():
while True:
c = readchar_()
if c == '\n' or c == '\t' or c == '\r' or c == ' ':
... | 16.827586 | 59 | 0.445697 | import sys
char_ = None
def readchar_():
global char_
if char_ == None:
char_ = sys.stdin.read(1)
return char_
def skipchar():
global char_
char_ = None
return
def stdinsep():
while True:
c = readchar_()
if c == '\n' or c == '\t' or c == '\r' or c == ' ':
... | true | true |
1c3b962c436cc4031f7d176f27436338c96a5f33 | 109 | py | Python | raspy/components/potentiometers/__init__.py | cyrusbuilt/RasPy | 1e34840cc90ea7f19317e881162209d3d819eb09 | [
"MIT"
] | null | null | null | raspy/components/potentiometers/__init__.py | cyrusbuilt/RasPy | 1e34840cc90ea7f19317e881162209d3d819eb09 | [
"MIT"
] | null | null | null | raspy/components/potentiometers/__init__.py | cyrusbuilt/RasPy | 1e34840cc90ea7f19317e881162209d3d819eb09 | [
"MIT"
] | null | null | null | """This package provides objects for interfacing with potentiometers."""
__all__ = (
"potentiometer"
)
| 15.571429 | 72 | 0.715596 |
__all__ = (
"potentiometer"
)
| true | true |
1c3b969f3970cd9cd64fcb8ab6a8f3889957e301 | 13,060 | py | Python | Utils/request_contributor_review.py | ryantoddtq/content | 50027658da7189e37e9514fc03057d1c1bc3209f | [
"MIT"
] | 2 | 2020-07-27T10:35:41.000Z | 2020-12-14T15:44:18.000Z | Utils/request_contributor_review.py | Axonius/content | e058add82b7422338015cf14591512b9aad4d3e9 | [
"MIT"
] | 30 | 2022-03-16T14:07:34.000Z | 2022-03-31T17:37:51.000Z | Utils/request_contributor_review.py | Axonius/content | e058add82b7422338015cf14591512b9aad4d3e9 | [
"MIT"
] | 1 | 2022-01-23T17:30:09.000Z | 2022-01-23T17:30:09.000Z | import argparse
import requests
import os
import sys
from pathlib import Path
import json
import sendgrid
from sendgrid.helpers.mail import *
REPO_OWNER = "demisto"
REPO_NAME = "content"
PACKS_FOLDER = "Packs"
CONTENT_REPO_FULL_PATH = os.environ.get('GITHUB_WORKSPACE') or os.path.abspath(
os.path.join(__file__, '.... | 44.121622 | 120 | 0.638515 | import argparse
import requests
import os
import sys
from pathlib import Path
import json
import sendgrid
from sendgrid.helpers.mail import *
REPO_OWNER = "demisto"
REPO_NAME = "content"
PACKS_FOLDER = "Packs"
CONTENT_REPO_FULL_PATH = os.environ.get('GITHUB_WORKSPACE') or os.path.abspath(
os.path.join(__file__, '.... | true | true |
1c3b9740aebd671c6731655fdc43f882dd7cb058 | 785 | py | Python | lesson-2/task5.py | GintoGloss/GeekUniversity-Python | b30da872bd5c68905ab66485ca06bdf3008b3995 | [
"Unlicense"
] | null | null | null | lesson-2/task5.py | GintoGloss/GeekUniversity-Python | b30da872bd5c68905ab66485ca06bdf3008b3995 | [
"Unlicense"
] | null | null | null | lesson-2/task5.py | GintoGloss/GeekUniversity-Python | b30da872bd5c68905ab66485ca06bdf3008b3995 | [
"Unlicense"
] | null | null | null | # 5. Реализовать структуру «Рейтинг», представляющую собой не возрастающий набор натуральных чисел. У пользователя
# необходимо запрашивать новый элемент рейтинга. Если в рейтинге существуют элементы с одинаковыми значениями,
# то новый элемент с тем же значением должен разместиться после них.
rating_list = [7, 5, 3, ... | 37.380952 | 114 | 0.743949 |
rating_list = [7, 5, 3, 3, 2]
rating_len = len(rating_list)
new_elem = input("Введите новый элемент рейтинга: ")
while (not new_elem.isdecimal()) or int(new_elem) == 0:
new_elem = input("Нужно ввести натуральное число! ")
new_elem = int(new_elem)
for index, elem in enumerate(rating_list[::-1]):
if elem >= ne... | true | true |
1c3b974fc9bd283a772dd33492c5eb9514f396f6 | 1,202 | py | Python | __init__.py | analyzeDFIR/analyzeEVTX-parser | b67f8698eee1223017f9d10e7bcdddb108324dd7 | [
"MIT"
] | null | null | null | __init__.py | analyzeDFIR/analyzeEVTX-parser | b67f8698eee1223017f9d10e7bcdddb108324dd7 | [
"MIT"
] | null | null | null | __init__.py | analyzeDFIR/analyzeEVTX-parser | b67f8698eee1223017f9d10e7bcdddb108324dd7 | [
"MIT"
] | null | null | null | ## -*- coding: UTF-8 -*-
## __init__.py
##
## Copyright (c) 2018 analyzeDFIR
##
## 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 right... | 48.08 | 81 | 0.755408 |
from .evtx import EVTX, EVTXChunk, EVTXRecord
| true | true |
1c3b98dc295b3ff99d75165f474884a35f9f607a | 4,153 | py | Python | hardnet/pytorch_sift.py | empty16/hardnet.pytorch | 39242bc1db52ec13a3b07d92ff2559809ac0a557 | [
"BSD-3-Clause"
] | 3 | 2020-03-02T05:00:38.000Z | 2021-12-19T08:46:32.000Z | hardnet/pytorch_sift.py | empty16/hardnet.pytorch | 39242bc1db52ec13a3b07d92ff2559809ac0a557 | [
"BSD-3-Clause"
] | null | null | null | hardnet/pytorch_sift.py | empty16/hardnet.pytorch | 39242bc1db52ec13a3b07d92ff2559809ac0a557 | [
"BSD-3-Clause"
] | 1 | 2020-12-04T09:34:50.000Z | 2020-12-04T09:34:50.000Z | import torch
import math
import torch.nn.init
import torch.nn as nn
from torch.autograd import Variable
import torch.backends.cudnn as cudnn
import numpy as np
import torch.nn.functional as F
from Utils import L2Norm
def getPoolingKernel(kernel_size = 25):
step = 1. / float(np.floor( kernel_size / 2.))
x_coef ... | 41.118812 | 129 | 0.601974 | import torch
import math
import torch.nn.init
import torch.nn as nn
from torch.autograd import Variable
import torch.backends.cudnn as cudnn
import numpy as np
import torch.nn.functional as F
from Utils import L2Norm
def getPoolingKernel(kernel_size = 25):
step = 1. / float(np.floor( kernel_size / 2.))
x_coef ... | true | true |
1c3b9971b39385d358dbaa6778a6751566f1fb76 | 6,699 | py | Python | large_cohort/processes/q_ffl.py | garyxcheng/federated | ba7133ead6127af71ea9356e26bfd05c02f8324a | [
"Apache-2.0"
] | 330 | 2020-09-14T23:10:16.000Z | 2022-03-30T19:49:19.000Z | large_cohort/processes/q_ffl.py | garyxcheng/federated | ba7133ead6127af71ea9356e26bfd05c02f8324a | [
"Apache-2.0"
] | 52 | 2020-09-30T06:10:51.000Z | 2022-03-31T19:25:16.000Z | large_cohort/processes/q_ffl.py | garyxcheng/federated | ba7133ead6127af71ea9356e26bfd05c02f8324a | [
"Apache-2.0"
] | 119 | 2020-09-24T04:54:46.000Z | 2022-03-31T21:46:57.000Z | # Copyright 2021, Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | 46.520833 | 80 | 0.753247 |
from typing import Any, Callable, Optional
import tensorflow as tf
import tensorflow_federated as tff
DEFAULT_SERVER_OPTIMIZER_FN = lambda: tf.keras.optimizers.SGD(learning_rate=1.0)
def build_keras_output_to_loss_fn(
metric_builder=Callable[[], tf.keras.metrics.Metric]):
def output_to_loss_fn(output):
... | true | true |
1c3b9a147a8ab5ee9b8b9425ba2e1e83038eb05c | 59 | py | Python | detcon/__init__.py | isaaccorley/detcon-pytorch | a5e03faf0c27bdbe64b72625873c0b2d3a696f04 | [
"MIT"
] | 5 | 2021-10-30T05:10:42.000Z | 2022-03-26T08:44:17.000Z | detcon/__init__.py | isaaccorley/detcon-pytorch | a5e03faf0c27bdbe64b72625873c0b2d3a696f04 | [
"MIT"
] | 2 | 2021-12-20T08:52:50.000Z | 2021-12-28T15:14:48.000Z | detcon/__init__.py | isaaccorley/detcon-pytorch | a5e03faf0c27bdbe64b72625873c0b2d3a696f04 | [
"MIT"
] | 1 | 2022-02-01T11:02:40.000Z | 2022-02-01T11:02:40.000Z | from . import datasets, losses
from .models import DetConB
| 19.666667 | 30 | 0.79661 | from . import datasets, losses
from .models import DetConB
| true | true |
1c3b9a41211bbbc44d403ed53a0a4be53c4080f8 | 580 | py | Python | Set Perspective View.py | TSRChapman/LandArchTools | c8e2dd713e85c04a1d81ea959a7c8ce8ad8a7666 | [
"BSD-3-Clause"
] | null | null | null | Set Perspective View.py | TSRChapman/LandArchTools | c8e2dd713e85c04a1d81ea959a7c8ce8ad8a7666 | [
"BSD-3-Clause"
] | null | null | null | Set Perspective View.py | TSRChapman/LandArchTools | c8e2dd713e85c04a1d81ea959a7c8ce8ad8a7666 | [
"BSD-3-Clause"
] | null | null | null | '''
Copyright <2021> <Thomas Chapman>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM... | 41.428571 | 118 | 0.768966 |
import rhinoscriptsyntax as rs
rs.Command("_setview _w _p")
| true | true |
1c3b9b2da3dc917c8474a8fa1acb20b854120495 | 490 | py | Python | lists/migrations/0001_initial.py | luizppa/tdd-project | 9ded60b138c45bc24f670096bfedad4364ed1212 | [
"MIT"
] | null | null | null | lists/migrations/0001_initial.py | luizppa/tdd-project | 9ded60b138c45bc24f670096bfedad4364ed1212 | [
"MIT"
] | null | null | null | lists/migrations/0001_initial.py | luizppa/tdd-project | 9ded60b138c45bc24f670096bfedad4364ed1212 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2022-01-26 21:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Item'... | 21.304348 | 114 | 0.597959 | from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Item',
fields=[
('id', models.AutoField(auto_create... | true | true |
1c3b9d7214b7179f554910b926d12afb4f426760 | 5,455 | py | Python | packages/python/plotly/plotly/validators/bar/_marker.py | labaran1/plotly.py | 7ec751e8fed4a570c11ea4bea2231806389d62eb | [
"MIT"
] | null | null | null | packages/python/plotly/plotly/validators/bar/_marker.py | labaran1/plotly.py | 7ec751e8fed4a570c11ea4bea2231806389d62eb | [
"MIT"
] | null | null | null | packages/python/plotly/plotly/validators/bar/_marker.py | labaran1/plotly.py | 7ec751e8fed4a570c11ea4bea2231806389d62eb | [
"MIT"
] | null | null | null | import _plotly_utils.basevalidators
class MarkerValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="marker", parent_name="bar", **kwargs):
super(MarkerValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
dat... | 48.274336 | 74 | 0.550504 | import _plotly_utils.basevalidators
class MarkerValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="marker", parent_name="bar", **kwargs):
super(MarkerValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
dat... | true | true |
1c3b9e7b099769d60c76419175e7191bea797836 | 84 | py | Python | Dependencies/dcmtk/__init__.py | tclarke/coan | 3f3b179a98afaf5b0f16fea452dbe43fe18ab0ad | [
"MIT"
] | 1 | 2016-05-08T08:14:24.000Z | 2016-05-08T08:14:24.000Z | Dependencies/dcmtk/__init__.py | tclarke/coan | 3f3b179a98afaf5b0f16fea452dbe43fe18ab0ad | [
"MIT"
] | null | null | null | Dependencies/dcmtk/__init__.py | tclarke/coan | 3f3b179a98afaf5b0f16fea452dbe43fe18ab0ad | [
"MIT"
] | 2 | 2015-12-03T07:01:44.000Z | 2021-04-21T07:35:38.000Z | __doc__ = """DICOM I/O Library."""
package = {'downloadLocation':'dcmtk-3.5.4.zip'}
| 28 | 48 | 0.654762 | __doc__ = """DICOM I/O Library."""
package = {'downloadLocation':'dcmtk-3.5.4.zip'}
| true | true |
1c3ba0254b9dd006118668e7ac0f5ea277646eb6 | 2,189 | py | Python | uwsgi_tasks/utils.py | zanachka/uwsgi_tasks | cad3e72c8bd66979c6ac23a1cc68caff176435ab | [
"MIT"
] | 92 | 2015-01-21T06:25:18.000Z | 2022-02-23T22:29:05.000Z | uwsgi_tasks/utils.py | zanachka/uwsgi_tasks | cad3e72c8bd66979c6ac23a1cc68caff176435ab | [
"MIT"
] | 17 | 2015-04-30T21:02:05.000Z | 2021-03-09T17:30:00.000Z | uwsgi_tasks/utils.py | zanachka/uwsgi_tasks | cad3e72c8bd66979c6ac23a1cc68caff176435ab | [
"MIT"
] | 13 | 2015-04-30T20:54:36.000Z | 2022-02-12T17:06:15.000Z | # -*- coding: utf-8 -*-
import six
from importlib import import_module
def import_by_path(dotted_path):
"""Import a dotted module path and return the attribute/class designated
by the last name in the path. Raise ImportError if the import failed.
Adapted from Django 1.7
"""
try:
if not d... | 25.16092 | 79 | 0.638191 | import six
from importlib import import_module
def import_by_path(dotted_path):
try:
if not dotted_path.count('.'):
dotted_path = '.'.join(['__main__', dotted_path])
module_path, class_name = dotted_path.rsplit('.', 1)
except ValueError:
msg = '"{}" doesn\'t look like a m... | true | true |
1c3ba176fbd1c0dd6f9f2e8c9fd3ac6065d5c80f | 8,368 | py | Python | nova/virt/libvirt/lvm.py | changbai1980/nova | 2739b6273161b82832f1ccdece1da3527097961c | [
"Apache-2.0"
] | 1 | 2019-05-11T22:40:48.000Z | 2019-05-11T22:40:48.000Z | nova/virt/libvirt/lvm.py | changbai1980/nova | 2739b6273161b82832f1ccdece1da3527097961c | [
"Apache-2.0"
] | null | null | null | nova/virt/libvirt/lvm.py | changbai1980/nova | 2739b6273161b82832f1ccdece1da3527097961c | [
"Apache-2.0"
] | null | null | null | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright (c) 2011 Piston Cloud Computing, Inc
# Copyright (c) 2011 OpenStack Foundation
# (c) Cop... | 35.012552 | 78 | 0.573136 |
from oslo.config import cfg
import six
from nova import exception
from nova.i18n import _
from nova.i18n import _LE
from nova.i18n import _LW
from nova.openstack.common import log as logging
from nova.openstack.common import processutils
from nova.openstack.common import units
from nova.virt.libvirt import utils
CO... | true | true |
1c3ba1c6237da82256774388a9e211c332d00c98 | 1,843 | py | Python | src/max_damage_player.py | cjyu81/MuTrainer | 4bc456b2c920585fd7210105af8a79952d0ec6a5 | [
"MIT"
] | null | null | null | src/max_damage_player.py | cjyu81/MuTrainer | 4bc456b2c920585fd7210105af8a79952d0ec6a5 | [
"MIT"
] | null | null | null | src/max_damage_player.py | cjyu81/MuTrainer | 4bc456b2c920585fd7210105af8a79952d0ec6a5 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import asyncio
import time
from poke_env.player.player import Player
from poke_env.player.random_player import RandomPlayer
class MaxDamagePlayer(Player):
def choose_move(self, battle):
# If the player can attack, it will
if battle.available_moves:
... | 34.12963 | 86 | 0.655453 | import asyncio
import time
from poke_env.player.player import Player
from poke_env.player.random_player import RandomPlayer
class MaxDamagePlayer(Player):
def choose_move(self, battle):
if battle.available_moves:
best_move = max(battle.available_moves, key=lambda... | true | true |
1c3ba2386427f1f11255eabaa7bd9f3ff079e2ff | 604 | py | Python | exercises/fr/solution_02_06.py | tuanducdesign/spacy-course | f8d092c5fa2997fccb3f367d174dce8667932b3d | [
"MIT"
] | null | null | null | exercises/fr/solution_02_06.py | tuanducdesign/spacy-course | f8d092c5fa2997fccb3f367d174dce8667932b3d | [
"MIT"
] | null | null | null | exercises/fr/solution_02_06.py | tuanducdesign/spacy-course | f8d092c5fa2997fccb3f367d174dce8667932b3d | [
"MIT"
] | null | null | null | import spacy
nlp = spacy.blank("fr")
# Importe les classes Doc et Span
from spacy.tokens import Doc, Span
words = ["Elle", "aime", "David", "Bowie"]
spaces = [True, True, True, False]
# Crée un doc à partir des mots et des espaces
doc = Doc(nlp.vocab, words=words, spaces=spaces)
print(doc.text)
# Crée un span pour... | 24.16 | 51 | 0.698675 | import spacy
nlp = spacy.blank("fr")
from spacy.tokens import Doc, Span
words = ["Elle", "aime", "David", "Bowie"]
spaces = [True, True, True, False]
doc = Doc(nlp.vocab, words=words, spaces=spaces)
print(doc.text)
span = Span(doc, 2, 4, label="PER")
print(span.text, span.label_)
doc.ents = [span]
print([(ent.te... | true | true |
1c3ba262bbd3967017630478ef1f6306fe297aaa | 20,382 | py | Python | TF/esp_tf_utils.py | Rahul-chunduru/meanfield-theory-of-activation-functions | 97abc52b25d7a57dc75ce21dcccc419f58a393d4 | [
"Apache-2.0"
] | 6 | 2018-06-12T08:35:43.000Z | 2019-03-16T05:06:11.000Z | TF/esp_tf_utils.py | Rahul-chunduru/meanfield-theory-of-activation-functions | 97abc52b25d7a57dc75ce21dcccc419f58a393d4 | [
"Apache-2.0"
] | 1 | 2019-04-26T05:40:08.000Z | 2019-05-07T01:54:49.000Z | TF/esp_tf_utils.py | Rahul-chunduru/meanfield-theory-of-activation-functions | 97abc52b25d7a57dc75ce21dcccc419f58a393d4 | [
"Apache-2.0"
] | 2 | 2019-09-24T16:28:10.000Z | 2020-03-26T16:38:29.000Z | """
Helper functions for FFN with ESP
=================================================================
Author: Mirco Milletari <mirco@bambu.life> (2018)
Tensorflow implementation of a Feed Forward Deep network with ESP
activation, as defined in
"Expectation propagation: a probabilistic view of Deep Feed Forward Netw... | 38.529301 | 168 | 0.61883 |
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.python.framework import ops
def one_hot_econding(vect, N_classes, N_ch):
C = tf.constant(N_classes, name="C")
one_hot_matrix = tf.one_hot(vect-1, C, axis=0)
if N_ch != 0:
one_hot_matrix= tf.expand_... | true | true |
1c3ba32c797e288fa66e9565e66e9de634959d0c | 314 | py | Python | tests/test_rpc.py | laoshan-tech/xray-rpc | 95034a012c32b4c915a9612cd21970fd40f08bfd | [
"MIT"
] | 1 | 2021-05-27T22:04:09.000Z | 2021-05-27T22:04:09.000Z | tests/test_rpc.py | laoshan-tech/xray-rpc | 95034a012c32b4c915a9612cd21970fd40f08bfd | [
"MIT"
] | 1 | 2021-04-11T15:38:43.000Z | 2021-04-12T02:49:44.000Z | tests/test_rpc.py | laoshan-tech/xray-rpc | 95034a012c32b4c915a9612cd21970fd40f08bfd | [
"MIT"
] | null | null | null | class TestRPC(object):
def test_import(self):
from xray_rpc.app.stats.command import command_pb2_grpc as stats_command_pb2_grpc
from xray_rpc.core import config_pb2
assert issubclass(stats_command_pb2_grpc.StatsServiceStub, object)
assert issubclass(config_pb2.Config, object)
| 39.25 | 89 | 0.761146 | class TestRPC(object):
def test_import(self):
from xray_rpc.app.stats.command import command_pb2_grpc as stats_command_pb2_grpc
from xray_rpc.core import config_pb2
assert issubclass(stats_command_pb2_grpc.StatsServiceStub, object)
assert issubclass(config_pb2.Config, object)
| true | true |
1c3ba5e8ee78c0e5bcaca6f4cc049fae77128149 | 1,422 | py | Python | tools/scripts/dearimgui_update.py | mingw4/Cinder | 447f1366bb4c4a4821055043fc4945da4139c1c9 | [
"BSD-2-Clause"
] | 3,494 | 2015-01-02T08:42:09.000Z | 2022-03-31T14:16:23.000Z | tools/scripts/dearimgui_update.py | mingw4/Cinder | 447f1366bb4c4a4821055043fc4945da4139c1c9 | [
"BSD-2-Clause"
] | 1,284 | 2015-01-02T07:31:47.000Z | 2022-03-30T02:06:43.000Z | tools/scripts/dearimgui_update.py | mingw4/Cinder | 447f1366bb4c4a4821055043fc4945da4139c1c9 | [
"BSD-2-Clause"
] | 780 | 2015-01-02T22:14:29.000Z | 2022-03-30T00:16:56.000Z | import glob, os, shutil, sys
# "Usage: dearimgui_update.py SOURCE DEST"
im_path = os.path.abspath(sys.argv[1])
ci_path = os.path.abspath(sys.argv[2])
def copy_files(src_dir, target_dir, extension):
files = glob.iglob(os.path.join(src_dir, extension))
for src in files:
if os.path.isfile(src):
... | 39.5 | 109 | 0.642053 | import glob, os, shutil, sys
im_path = os.path.abspath(sys.argv[1])
ci_path = os.path.abspath(sys.argv[2])
def copy_files(src_dir, target_dir, extension):
files = glob.iglob(os.path.join(src_dir, extension))
for src in files:
if os.path.isfile(src):
print( src + ' => ' + target_dir )
... | true | true |
1c3ba6a84ec6f5569244fd31ac44b46e8d472e9d | 5,358 | py | Python | server/openslides/core/apps.py | danilobuerger/OpenSlides | 97950d5baa0e22027ea5c1f59a452f831c197cd2 | [
"MIT"
] | null | null | null | server/openslides/core/apps.py | danilobuerger/OpenSlides | 97950d5baa0e22027ea5c1f59a452f831c197cd2 | [
"MIT"
] | 2 | 2021-11-02T15:53:58.000Z | 2022-03-02T12:19:49.000Z | server/openslides/core/apps.py | danilobuerger/OpenSlides | 97950d5baa0e22027ea5c1f59a452f831c197cd2 | [
"MIT"
] | null | null | null | import sys
from typing import Any, Dict
from django.apps import AppConfig
from django.conf import settings
from django.db.models.signals import post_migrate, pre_delete
from openslides.utils import logging
from openslides.utils.schema_version import schema_version_handler
class CoreAppConfig(AppConfig):
name = ... | 32.871166 | 87 | 0.636991 | import sys
from typing import Any, Dict
from django.apps import AppConfig
from django.conf import settings
from django.db.models.signals import post_migrate, pre_delete
from openslides.utils import logging
from openslides.utils.schema_version import schema_version_handler
class CoreAppConfig(AppConfig):
name = ... | true | true |
1c3ba6e4bbe2444723334607b77450a25f2d8124 | 3,343 | py | Python | nizkctf/subrepo.py | MrMugiwara/2018 | 675a26bea30f67898d6ce00de5206476cb3d4146 | [
"MIT"
] | 1 | 2021-07-07T15:12:16.000Z | 2021-07-07T15:12:16.000Z | nizkctf/subrepo.py | MrMugiwara/2018 | 675a26bea30f67898d6ce00de5206476cb3d4146 | [
"MIT"
] | null | null | null | nizkctf/subrepo.py | MrMugiwara/2018 | 675a26bea30f67898d6ce00de5206476cb3d4146 | [
"MIT"
] | null | null | null | # -*- encoding: utf-8 -*-
from __future__ import unicode_literals, division, print_function,\
absolute_import
import os
import subprocess
import base64
import pysodium
from .settings import Settings
from .localsettings import LocalSettings
from .repohost import RepoHost
SUBREPO_NAME = 'submiss... | 31.242991 | 79 | 0.584505 |
from __future__ import unicode_literals, division, print_function,\
absolute_import
import os
import subprocess
import base64
import pysodium
from .settings import Settings
from .localsettings import LocalSettings
from .repohost import RepoHost
SUBREPO_NAME = 'submissions'
class SubRepo(obje... | true | true |
1c3ba750dca70b3fc9c0e5f11c889842c4731140 | 829 | py | Python | design_pattern/abstract_factory.py | ischaojie/learn-py | b24ec70c776fbc7176bdffbbd1b9ce46e6a25916 | [
"MIT"
] | null | null | null | design_pattern/abstract_factory.py | ischaojie/learn-py | b24ec70c776fbc7176bdffbbd1b9ce46e6a25916 | [
"MIT"
] | null | null | null | design_pattern/abstract_factory.py | ischaojie/learn-py | b24ec70c776fbc7176bdffbbd1b9ce46e6a25916 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
抽象工厂模式
将组件的实现通过一个工厂暴露出来,从而统一行为。
"""
from typing import Type
class Pet:
"""
宠物类
"""
def __init__(self, name: str):
self.name = name
def speak(self):
raise NotImplementedError
def __str__(self):
return self.name
class Dog(Pet):
def sp... | 15.351852 | 43 | 0.55006 | from typing import Type
class Pet:
def __init__(self, name: str):
self.name = name
def speak(self):
raise NotImplementedError
def __str__(self):
return self.name
class Dog(Pet):
def speak(self):
return "woof {}".format(self.name)
class Cat(Pet):
def speak(sel... | true | true |
1c3ba7ebb306911a1f12655bba992630fc3e9222 | 1,754 | py | Python | patronclient/tests/unit/v2/test_cloudpipe.py | casbin/openstack-patron | b41b1262f3a52c8cc9f6b6bdf87be5a1abcf6d25 | [
"Apache-2.0"
] | null | null | null | patronclient/tests/unit/v2/test_cloudpipe.py | casbin/openstack-patron | b41b1262f3a52c8cc9f6b6bdf87be5a1abcf6d25 | [
"Apache-2.0"
] | null | null | null | patronclient/tests/unit/v2/test_cloudpipe.py | casbin/openstack-patron | b41b1262f3a52c8cc9f6b6bdf87be5a1abcf6d25 | [
"Apache-2.0"
] | null | null | null | #
# 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
# ... | 38.130435 | 78 | 0.68016 |
import six
from patronclient.tests.unit.fixture_data import client
from patronclient.tests.unit.fixture_data import cloudpipe as data
from patronclient.tests.unit import utils
from patronclient.v2 import cloudpipe
class CloudpipeTest(utils.FixturedTestCase):
data_fixture_class = data.Fixture
scenarios = [... | true | true |
1c3ba838ed53f1489f869377b5e50e8cfdf3e5bf | 4,379 | py | Python | ipodio/database.py | sourcery-ai-bot/ipodio | e32ab2d1928a2b47500dd0ce0cbd17f71102dbe2 | [
"BSD-3-Clause"
] | 9 | 2015-06-02T23:31:20.000Z | 2021-05-17T17:26:32.000Z | ipodio/database.py | sourcery-ai-bot/ipodio | e32ab2d1928a2b47500dd0ce0cbd17f71102dbe2 | [
"BSD-3-Clause"
] | null | null | null | ipodio/database.py | sourcery-ai-bot/ipodio | e32ab2d1928a2b47500dd0ce0cbd17f71102dbe2 | [
"BSD-3-Clause"
] | 3 | 2015-10-07T21:51:38.000Z | 2021-01-23T12:22:58.000Z | #-*- coding: utf-8 -*-
"""
Database
Stores all the tracks contained within the iPod indexed in a convenient way for
fast retrieval, iteration, addition and removal.
Intended as a very thin wrapper around gpod.Database in order to provide a
cleaner interface, extra functionality and resolve some flaws.
# Create t... | 27.540881 | 79 | 0.675953 |
import gpod
from collections import defaultdict
from .track import Track
def first(iterable):
for item in iterable:
return item
class Playlist(object):
def __init__(self, playlist):
self.__playlist = playlist
@classmethod
def create(cls, name, database, internal_class=gpod.Playli... | true | true |
1c3ba95195b1da46d7bee9e066627e9b38457b92 | 10,388 | py | Python | mqtt2influxdb/mqtt2influxdb.py | tvecera/bch-mqtt2influxdb | 6e3f6b898144ce89307e61858364d005f8f6a35d | [
"MIT"
] | 15 | 2018-01-14T16:27:11.000Z | 2020-06-08T00:44:16.000Z | mqtt2influxdb/mqtt2influxdb.py | tvecera/bch-mqtt2influxdb | 6e3f6b898144ce89307e61858364d005f8f6a35d | [
"MIT"
] | 11 | 2018-05-03T07:42:34.000Z | 2020-06-24T10:01:22.000Z | mqtt2influxdb/mqtt2influxdb.py | tvecera/bch-mqtt2influxdb | 6e3f6b898144ce89307e61858364d005f8f6a35d | [
"MIT"
] | 10 | 2020-08-07T11:22:24.000Z | 2022-01-13T15:54:17.000Z | #!/usr/bin/env python3
import os
import sys
import logging
import json
from datetime import datetime
import paho.mqtt.client
from paho.mqtt.client import topic_matches_sub
import influxdb
import jsonpath_ng
import requests
import base64
from requests.auth import HTTPBasicAuth
import http.client as http_client
import b... | 45.561404 | 181 | 0.503273 |
import os
import sys
import logging
import json
from datetime import datetime
import paho.mqtt.client
from paho.mqtt.client import topic_matches_sub
import influxdb
import jsonpath_ng
import requests
import base64
from requests.auth import HTTPBasicAuth
import http.client as http_client
import builtins
import py_expre... | true | true |
1c3ba9851458fc1035a3f92f164555d9d272be19 | 1,176 | py | Python | astroplpython/data/PowerFrequencyMeasurement.py | brianthomas/astroplpython | 2bb3aad304b308a272916b3ef90db9d0fd1ce508 | [
"MIT"
] | null | null | null | astroplpython/data/PowerFrequencyMeasurement.py | brianthomas/astroplpython | 2bb3aad304b308a272916b3ef90db9d0fd1ce508 | [
"MIT"
] | null | null | null | astroplpython/data/PowerFrequencyMeasurement.py | brianthomas/astroplpython | 2bb3aad304b308a272916b3ef90db9d0fd1ce508 | [
"MIT"
] | null | null | null | '''
Created on Jul 11, 2014
@author: thomas
'''
from astroplpython.data.Measurement import x_y
import collections
class p_f(x_y):
'''
An individual measurement of Power P at frequency f; P(f)
'''
@property
def power(self):
return self.x
@property
def frequency (self):
... | 24.5 | 89 | 0.570578 | from astroplpython.data.Measurement import x_y
import collections
class p_f(x_y):
@property
def power(self):
return self.x
@property
def frequency (self):
return self.y
def __str__(self):
return "p_f(p:" + str(self.power) + " f:" + str(self.frequency) + ")"
... | true | true |
1c3baaba6660298a8f8cc9c03fba5f4c5a2d7874 | 2,084 | py | Python | Codes/Mathematical/random_number_generator.py | datta-agni/Python-Codes | 4c887a81f06da4732762e35ca6c2bb34bf1d7d41 | [
"MIT"
] | null | null | null | Codes/Mathematical/random_number_generator.py | datta-agni/Python-Codes | 4c887a81f06da4732762e35ca6c2bb34bf1d7d41 | [
"MIT"
] | null | null | null | Codes/Mathematical/random_number_generator.py | datta-agni/Python-Codes | 4c887a81f06da4732762e35ca6c2bb34bf1d7d41 | [
"MIT"
] | null | null | null | # Program to generate a random number between 0 and 9
# importing the random module
import random
def randomization_generators(
low=int(input("Enter the starting point of generation: ")),
high=int(input("Enter the end point for the generation: ")),
mean=int(
input(
"Enter the mean for ... | 36.561404 | 246 | 0.662188 | import random
def randomization_generators(
low=int(input("Enter the starting point of generation: ")),
high=int(input("Enter the end point for the generation: ")),
mean=int(
input(
"Enter the mean for generating random numbers from a probability distribution: "
)
),
si... | true | true |
1c3bab1eca9dc99992fd701b30452ebb318e68c1 | 20,440 | py | Python | pyathena/classic/rst_handler.py | changgoo/pyathena-1 | c461ac3390d773537ce52393e3ebf68a3282aa46 | [
"MIT"
] | 1 | 2019-10-03T13:59:14.000Z | 2019-10-03T13:59:14.000Z | pyathena/classic/rst_handler.py | changgoo/pyathena-1 | c461ac3390d773537ce52393e3ebf68a3282aa46 | [
"MIT"
] | 3 | 2020-09-23T23:36:17.000Z | 2022-01-11T06:16:56.000Z | pyathena/classic/rst_handler.py | changgoo/pyathena-1 | c461ac3390d773537ce52393e3ebf68a3282aa46 | [
"MIT"
] | 2 | 2019-06-10T04:26:16.000Z | 2019-12-04T22:27:02.000Z | import struct
import numpy as np
import glob
import os
import sys
#writer
def parse_misc_info(rstfile):
fp=open(rstfile,'rb')
search_block=['par','time','data','star','user']
start={}
size={}
start['par']=0
iblock=0
while 1:
block=search_block[iblock]
size[block]=fp.tell(... | 30.598802 | 92 | 0.509883 | import struct
import numpy as np
import glob
import os
import sys
def parse_misc_info(rstfile):
fp=open(rstfile,'rb')
search_block=['par','time','data','star','user']
start={}
size={}
start['par']=0
iblock=0
while 1:
block=search_block[iblock]
size[block]=fp.tell()-start[b... | true | true |
1c3bab33a17d606bd8b00a0e94074be567b1c6ca | 2,300 | py | Python | render/deleters.py | VCL3D/BlenderScripts | d9671801d2a7686226c9fcf297d89a4388158733 | [
"MIT"
] | 11 | 2021-05-11T17:26:59.000Z | 2022-03-25T08:13:59.000Z | render/deleters.py | VCL3D/BlenderScripts | d9671801d2a7686226c9fcf297d89a4388158733 | [
"MIT"
] | null | null | null | render/deleters.py | VCL3D/BlenderScripts | d9671801d2a7686226c9fcf297d89a4388158733 | [
"MIT"
] | 2 | 2021-05-15T01:56:01.000Z | 2021-05-15T13:49:57.000Z | import bpy
import os
def delete_cameras_lights():
bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.select_by_type(type='CAMERA')
bpy.ops.object.delete(use_global=False)
# bpy.ops.object.select_by_type(type='LAMP')
bpy.ops.object.select_by_type(type='LIGHT')
bpy.ops.object.delete(use_globa... | 36.507937 | 105 | 0.691304 | import bpy
import os
def delete_cameras_lights():
bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.select_by_type(type='CAMERA')
bpy.ops.object.delete(use_global=False)
bpy.ops.object.select_by_type(type='LIGHT')
bpy.ops.object.delete(use_global=False)
bpy.ops.object.select_by_type(ty... | true | true |
1c3bac77eb0f911fbab4afc2653d0aed9119694d | 10,143 | py | Python | client/intelligent_collab/icollab.py | Rajpratik71/stacks-usecase | 19272c2d7f9ece306024b4bc9c97a0f9354c5f89 | [
"Apache-2.0"
] | 15 | 2019-09-19T09:32:11.000Z | 2021-03-25T15:45:11.000Z | client/intelligent_collab/icollab.py | Rajpratik71/stacks-usecase | 19272c2d7f9ece306024b4bc9c97a0f9354c5f89 | [
"Apache-2.0"
] | 8 | 2019-11-01T12:13:15.000Z | 2020-04-06T19:18:13.000Z | client/intelligent_collab/icollab.py | Rajpratik71/stacks-usecase | 19272c2d7f9ece306024b4bc9c97a0f9354c5f89 | [
"Apache-2.0"
] | 21 | 2019-09-19T16:57:41.000Z | 2021-09-23T04:57:25.000Z | #!/usr/bin/python3
"""Runner for Intelligent Collaboration App"""
import sys
import subprocess
import json
import requests
import re
import time
import yaml
import os
import tarfile
import shutil
import threading
MODELS_DIR = os.environ.get("MODELS_DIR", "./saved_models")
# Format for models lists is [(file_url, di... | 34.5 | 95 | 0.618062 |
import sys
import subprocess
import json
import requests
import re
import time
import yaml
import os
import tarfile
import shutil
import threading
MODELS_DIR = os.environ.get("MODELS_DIR", "./saved_models")
TAR_MODELS = [("https://tfhub.dev/tensorflow/ssd_mobilenet_v2/2\
?tf-hub-format=compressed", "ssd_mobilenet_v... | true | true |
1c3bacb5a940d60298ac8eeb273dc21d6fefc628 | 9,048 | py | Python | scalability/generate_report.py | zhiiker/ic | 370af58ea1231cdbb8d2e4f593a089dfd1c803cd | [
"Apache-2.0"
] | 941 | 2021-05-10T08:14:14.000Z | 2022-03-31T11:40:24.000Z | scalability/generate_report.py | zhiiker/ic | 370af58ea1231cdbb8d2e4f593a089dfd1c803cd | [
"Apache-2.0"
] | 3 | 2022-02-16T12:24:20.000Z | 2022-03-23T12:05:41.000Z | scalability/generate_report.py | zhiiker/ic | 370af58ea1231cdbb8d2e4f593a089dfd1c803cd | [
"Apache-2.0"
] | 122 | 2021-05-10T08:21:23.000Z | 2022-03-25T20:34:12.000Z | #!/usr/bin/env python3
import json
import os
import sys
import pybars
import report
def add_file(base, path, alt):
content = ""
try:
for p in path:
content += open(os.path.join(base, p)).read()
except Exception:
content += alt
return content
def generate_report(githash,... | 41.695853 | 133 | 0.461649 | import json
import os
import sys
import pybars
import report
def add_file(base, path, alt):
content = ""
try:
for p in path:
content += open(os.path.join(base, p)).read()
except Exception:
content += alt
return content
def generate_report(githash, timestamp):
source... | true | true |
1c3bae3498469302a5a347b215e67a7b1cc21b18 | 87 | py | Python | makahiki/apps/widgets/ask_admin/__init__.py | justinslee/Wai-Not-Makahiki | 4b7dd685012ec64758affe0ecee3103596d16aa7 | [
"MIT"
] | 1 | 2015-07-22T11:31:20.000Z | 2015-07-22T11:31:20.000Z | makahiki/apps/widgets/ask_admin/__init__.py | justinslee/Wai-Not-Makahiki | 4b7dd685012ec64758affe0ecee3103596d16aa7 | [
"MIT"
] | null | null | null | makahiki/apps/widgets/ask_admin/__init__.py | justinslee/Wai-Not-Makahiki | 4b7dd685012ec64758affe0ecee3103596d16aa7 | [
"MIT"
] | null | null | null | """The ask_admin widget implements a "send feedback" button and corresponding form."""
| 43.5 | 86 | 0.770115 | true | true | |
1c3baf888f5130998962f4ec6d561434293266db | 9,714 | py | Python | archive/scripts/STIPS_Input_from_Sims/wingtips.py | benw1/WINGS | 32d4bfd073da0b86d2340cde25a5601d0a1ec95e | [
"RSA-MD"
] | 4 | 2022-01-04T18:24:56.000Z | 2022-01-27T08:23:37.000Z | scratch/test_phat/wingtips.py | benw1/WINGS | 32d4bfd073da0b86d2340cde25a5601d0a1ec95e | [
"RSA-MD"
] | null | null | null | scratch/test_phat/wingtips.py | benw1/WINGS | 32d4bfd073da0b86d2340cde25a5601d0a1ec95e | [
"RSA-MD"
] | null | null | null | #! /usr/bin/env python
'''
WFIRST Infrared Nearby Galaxies Test Image Product Simulator
Produces input files for the WFIRST STIPS simulator
'''
import time
import numpy as np
from astropy import wcs
from astropy.io import fits, ascii
from astropy.table import Table
class WingTips:
'''
Initialize WingTips objec... | 34.692857 | 122 | 0.561149 | import time
import numpy as np
from astropy import wcs
from astropy.io import fits, ascii
from astropy.table import Table
class WingTips:
def __init__(self,infile=[],center=[0,0]):
if len(infile)==0:
self.tab = np.array([])
else:
if isinstance(infile,str):
in... | true | true |
1c3bb0e2e1d90d4d7e41b9417c279b9e455b1708 | 30,144 | py | Python | python-sc2/sc2/units.py | manaccac/sc2_bot | 3aa8b3711378b71fd0a44662cdd7148846e39530 | [
"MIT"
] | 9 | 2020-04-28T12:12:23.000Z | 2022-03-14T03:45:45.000Z | python-sc2/sc2/units.py | manaccac/sc2_bot | 3aa8b3711378b71fd0a44662cdd7148846e39530 | [
"MIT"
] | 5 | 2021-03-30T05:10:49.000Z | 2022-01-13T04:32:05.000Z | python-sc2/sc2/units.py | manaccac/sc2_bot | 3aa8b3711378b71fd0a44662cdd7148846e39530 | [
"MIT"
] | 4 | 2020-04-28T12:14:58.000Z | 2022-02-22T07:15:28.000Z | from __future__ import annotations
import random
import warnings
import math
from itertools import chain
from typing import Any, Dict, Iterable, List, Optional, Set, Tuple, Union, Generator, TYPE_CHECKING
from .ids.unit_typeid import UnitTypeId
from .position import Point2, Point3
from .unit import Unit
import numpy a... | 41.236662 | 211 | 0.640293 | from __future__ import annotations
import random
import warnings
import math
from itertools import chain
from typing import Any, Dict, Iterable, List, Optional, Set, Tuple, Union, Generator, TYPE_CHECKING
from .ids.unit_typeid import UnitTypeId
from .position import Point2, Point3
from .unit import Unit
import numpy a... | true | true |
1c3bb115a47bdc77dc8dabb9c45848ab2475a739 | 4,164 | py | Python | openGaussBase/testcase/TOOLS/SERVER_TOOLS/gs_om/Opengauss_Function_Tools_gs_om_Case0021.py | opengauss-mirror/Yat | aef107a8304b94e5d99b4f1f36eb46755eb8919e | [
"MulanPSL-1.0"
] | null | null | null | openGaussBase/testcase/TOOLS/SERVER_TOOLS/gs_om/Opengauss_Function_Tools_gs_om_Case0021.py | opengauss-mirror/Yat | aef107a8304b94e5d99b4f1f36eb46755eb8919e | [
"MulanPSL-1.0"
] | null | null | null | openGaussBase/testcase/TOOLS/SERVER_TOOLS/gs_om/Opengauss_Function_Tools_gs_om_Case0021.py | opengauss-mirror/Yat | aef107a8304b94e5d99b4f1f36eb46755eb8919e | [
"MulanPSL-1.0"
] | null | null | null | """
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W... | 35.896552 | 84 | 0.632565 |
import os
import unittest
from yat.test import Node
from yat.test import macro
from testcase.utils.Constant import Constant
from testcase.utils.Logger import Logger
from testcase.utils.CommonSH import CommonSH
class Tools(unittest.TestCase):
def setUp(self):
self.log = Logger()
self.log.info('---... | true | true |
1c3bb29f89d89209a3b9f7d405e87b11f19a59db | 16,143 | py | Python | annotation/typed.py | raabf/typeannotations | 7a3bffbb3b7e690b6f064f70a586820e3a741c5f | [
"Apache-2.0"
] | 84 | 2015-01-15T13:25:21.000Z | 2021-09-29T08:02:32.000Z | annotation/typed.py | raabf/typeannotations | 7a3bffbb3b7e690b6f064f70a586820e3a741c5f | [
"Apache-2.0"
] | 4 | 2015-04-05T18:16:37.000Z | 2017-02-11T11:59:43.000Z | annotation/typed.py | raabf/typeannotations | 7a3bffbb3b7e690b6f064f70a586820e3a741c5f | [
"Apache-2.0"
] | 4 | 2015-02-12T04:21:07.000Z | 2019-07-30T16:54:01.000Z | # Written by Manuel Cerón
# Copyright Manuel Cerón. 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 b... | 31.966337 | 103 | 0.634702 |
__author__ = ('Manuel Cerón <ceronman@gmail.com>')
__all__ = ['AnyType', 'Interface', 'only', 'optional', 'options', 'predicate',
'typechecked', 'typedef', 'union']
import functools
import inspect
EMPTY_ANNOTATION = inspect.Signature.empty
class UnionMeta(type):
def __new__(mcls, name, bases, name... | true | true |
1c3bb400a73babd821204f687e96422e40b4cfe7 | 6,137 | py | Python | tests/test_api.py | FollowTheProcess/pytoil | b13acb14f015ae5399d7697bdc3e0e475dff03ec | [
"Apache-2.0"
] | 6 | 2021-05-08T20:31:03.000Z | 2022-03-08T01:25:43.000Z | tests/test_api.py | FollowTheProcess/pytoil | b13acb14f015ae5399d7697bdc3e0e475dff03ec | [
"Apache-2.0"
] | 116 | 2021-07-08T11:21:22.000Z | 2022-03-30T14:04:51.000Z | tests/test_api.py | FollowTheProcess/pytoil | b13acb14f015ae5399d7697bdc3e0e475dff03ec | [
"Apache-2.0"
] | null | null | null | """
Tests for the API module.
Author: Tom Fleet
Created: 19/06/2021
"""
import httpx
import pytest
from pytest_httpx import HTTPXMock
from pytoil.api import API
from pytoil.api.models import Repository, RepoSummaryInfo
def test_api_init():
api = API(username="me", token="sometoken")
assert api.username =... | 26.226496 | 88 | 0.675411 |
import httpx
import pytest
from pytest_httpx import HTTPXMock
from pytoil.api import API
from pytoil.api.models import Repository, RepoSummaryInfo
def test_api_init():
api = API(username="me", token="sometoken")
assert api.username == "me"
assert api.token == "sometoken"
assert api.baseurl == "htt... | true | true |
1c3bb4a8700b7b6ceeb2282618fdb0a9777458d7 | 7,392 | py | Python | util/esum_cxx.py | yut23/Microphysics | 3c4985213c5e5b1ad2602b0bba2ce164b847361a | [
"BSD-3-Clause"
] | 16 | 2017-08-17T11:12:01.000Z | 2021-06-10T23:11:08.000Z | util/esum_cxx.py | Youhichka/Microphysics | 6f28333d40c9e15fdfbb1c4dc208e887fb5549c3 | [
"BSD-3-Clause"
] | 533 | 2017-06-08T13:52:11.000Z | 2022-01-28T16:13:29.000Z | util/esum_cxx.py | Youhichka/Microphysics | 6f28333d40c9e15fdfbb1c4dc208e887fb5549c3 | [
"BSD-3-Clause"
] | 34 | 2017-08-16T16:29:20.000Z | 2021-09-09T16:19:15.000Z | import os
import re
import argparse
module_start = """
// NOTE: THIS FILE IS AUTOMATICALLY GENERATED
// DO NOT EDIT BY HAND
// Re-run esum_cxx.py to update this file
// Fortran 2003 implementation of the msum routine
// provided by Raymond Hettinger:
// https://code.activestate.com/recipes/393090/
// This routine ... | 24.805369 | 113 | 0.552489 | import os
import re
import argparse
module_start = """
// NOTE: THIS FILE IS AUTOMATICALLY GENERATED
// DO NOT EDIT BY HAND
// Re-run esum_cxx.py to update this file
// Fortran 2003 implementation of the msum routine
// provided by Raymond Hettinger:
// https://code.activestate.com/recipes/393090/
// This routine ... | true | true |
1c3bb4c51056c6275e8d40ff8c2a85830d4c3984 | 8,686 | py | Python | tools/xctoolrunner/xctoolrunner.py | michaeleisel/rules_apple | 424c73847eba4d2a093fa59df1aa22b5629b0fda | [
"Apache-2.0"
] | null | null | null | tools/xctoolrunner/xctoolrunner.py | michaeleisel/rules_apple | 424c73847eba4d2a093fa59df1aa22b5629b0fda | [
"Apache-2.0"
] | null | null | null | tools/xctoolrunner/xctoolrunner.py | michaeleisel/rules_apple | 424c73847eba4d2a093fa59df1aa22b5629b0fda | [
"Apache-2.0"
] | null | null | null | # Lint as: python2, python3
# Copyright 2018 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... | 28.019355 | 80 | 0.677872 |
import argparse
import os
import re
import sys
from build_bazel_rules_apple.tools.wrapper_common import execute
_PATH_PREFIX = "[ABSOLUTE]"
_PATH_PREFIX_LEN = len(_PATH_PREFIX)
def _apply_realpath(argv):
for i, arg in enumerate(argv):
if arg.startswith(_PATH_PREFIX):
arg = arg[_PATH_PREFIX_LEN:]
... | true | true |
1c3bb5d7b8ef35ba870c07dc260cf6862e87d7c9 | 544 | py | Python | backend/todo/migrations/0006_auto_20190403_0603.py | Bhunesh2000/todoWithDjango | e5fa52a087180b66ae283e6b36fe790323d7b920 | [
"MIT"
] | null | null | null | backend/todo/migrations/0006_auto_20190403_0603.py | Bhunesh2000/todoWithDjango | e5fa52a087180b66ae283e6b36fe790323d7b920 | [
"MIT"
] | 11 | 2019-04-03T09:49:17.000Z | 2022-02-10T08:23:26.000Z | backend/todo/migrations/0006_auto_20190403_0603.py | Bhunesh2000/todoWithDjango | e5fa52a087180b66ae283e6b36fe790323d7b920 | [
"MIT"
] | 1 | 2019-10-21T19:26:29.000Z | 2019-10-21T19:26:29.000Z | # Generated by Django 2.2 on 2019-04-03 06:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('todo', '0005_auto_20190403_0445'),
]
operations = [
migrations.AddField(
model_name='todo',
name='completed',
... | 22.666667 | 64 | 0.573529 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('todo', '0005_auto_20190403_0445'),
]
operations = [
migrations.AddField(
model_name='todo',
name='completed',
field=models.BooleanField(default=False, n... | true | true |
1c3bb5ef3ecbbd63192d2619e582be5c16041aec | 569 | py | Python | asgi_tortoise_orm/middleware.py | erm/asgi-tortoise-orm | 6f192c6418d6f0d7144e7fd7c2f01f0498ff4020 | [
"MIT"
] | 1 | 2019-05-27T08:51:18.000Z | 2019-05-27T08:51:18.000Z | asgi_tortoise_orm/middleware.py | erm/asgi-tortoise-orm | 6f192c6418d6f0d7144e7fd7c2f01f0498ff4020 | [
"MIT"
] | null | null | null | asgi_tortoise_orm/middleware.py | erm/asgi-tortoise-orm | 6f192c6418d6f0d7144e7fd7c2f01f0498ff4020 | [
"MIT"
] | 1 | 2018-11-14T10:15:42.000Z | 2018-11-14T10:15:42.000Z | from tortoise import Tortoise
class TortoiseMiddleware:
def __init__(self, app):
self.app = app
def __call__(self, scope):
return _TortoiseResponder(self.app, scope)
class _TortoiseResponder:
def __init__(self, app, scope):
self.app = app
self.scope = scope
async de... | 23.708333 | 56 | 0.615114 | from tortoise import Tortoise
class TortoiseMiddleware:
def __init__(self, app):
self.app = app
def __call__(self, scope):
return _TortoiseResponder(self.app, scope)
class _TortoiseResponder:
def __init__(self, app, scope):
self.app = app
self.scope = scope
async de... | true | true |
1c3bb64903af96d443a57b5692c22d59027102c2 | 2,892 | py | Python | tests/unit/modules/test_win_certutil.py | nevins-b/salt | 56363bc41ca36e757103df3504d1bb07e3a7251b | [
"Apache-2.0"
] | null | null | null | tests/unit/modules/test_win_certutil.py | nevins-b/salt | 56363bc41ca36e757103df3504d1bb07e3a7251b | [
"Apache-2.0"
] | null | null | null | tests/unit/modules/test_win_certutil.py | nevins-b/salt | 56363bc41ca36e757103df3504d1bb07e3a7251b | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import
# Import Salt Libs
import salt.modules.win_certutil as certutil
# Import Salt Testing Libs
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.unit import TestCase
from tests.support.mock import (
MagicMock,... | 41.314286 | 103 | 0.649032 |
from __future__ import absolute_import
import salt.modules.win_certutil as certutil
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.unit import TestCase
from tests.support.mock import (
MagicMock,
patch
)
class CertUtilTestCase(TestCase, LoaderModuleMockMixin):
def setup_load... | true | true |
1c3bb65200aaa36dc133fe48545071a401c25379 | 13,259 | py | Python | ORIGINAL/discord/ext/tasks/__init__.py | DiEVeXx/discord.py | 812e5eb5ee611689dab272534a5c65d0102e5957 | [
"MIT"
] | null | null | null | ORIGINAL/discord/ext/tasks/__init__.py | DiEVeXx/discord.py | 812e5eb5ee611689dab272534a5c65d0102e5957 | [
"MIT"
] | null | null | null | ORIGINAL/discord/ext/tasks/__init__.py | DiEVeXx/discord.py | 812e5eb5ee611689dab272534a5c65d0102e5957 | [
"MIT"
] | null | null | null | import asyncio
import datetime
import aiohttp
import websockets
from ORIGINAL import discord
import inspect
import logging
from ORIGINAL.discord.backoff import ExponentialBackoff
log = logging.getLogger(__name__)
class Loop:
"""A background task helper that abstracts the loop and reconnection logic for you.
... | 32.900744 | 112 | 0.598386 | import asyncio
import datetime
import aiohttp
import websockets
from ORIGINAL import discord
import inspect
import logging
from ORIGINAL.discord.backoff import ExponentialBackoff
log = logging.getLogger(__name__)
class Loop:
def __init__(self, coro, seconds, hours, minutes, count, reconnect, loop):
self.... | true | true |
1c3bb731700e025c1b8f1ddb272dc096b4d17c18 | 4,309 | py | Python | mlflow/store/gcs_artifact_repo.py | 0wu/mlflow | 2b5a21af05defcfa80255c081b5d9f07443f3f64 | [
"Apache-2.0"
] | null | null | null | mlflow/store/gcs_artifact_repo.py | 0wu/mlflow | 2b5a21af05defcfa80255c081b5d9f07443f3f64 | [
"Apache-2.0"
] | null | null | null | mlflow/store/gcs_artifact_repo.py | 0wu/mlflow | 2b5a21af05defcfa80255c081b5d9f07443f3f64 | [
"Apache-2.0"
] | null | null | null | import os
from six.moves import urllib
from mlflow.entities.file_info import FileInfo
from mlflow.store.artifact_repo import ArtifactRepository
from mlflow.utils.file_utils import build_path, get_relative_path, TempDir
class GCSArtifactRepository(ArtifactRepository):
"""
Stores artifacts on Google Cloud Sto... | 39.53211 | 94 | 0.660246 | import os
from six.moves import urllib
from mlflow.entities.file_info import FileInfo
from mlflow.store.artifact_repo import ArtifactRepository
from mlflow.utils.file_utils import build_path, get_relative_path, TempDir
class GCSArtifactRepository(ArtifactRepository):
def __init__(self, artifact_uri, client=Non... | true | true |
1c3bb868be6fb7c76207db8e6603eead6f143d93 | 221 | py | Python | Exercise 028.py | sayan-datapython/Learn_Python_Full_Course_for_Beginners | 1cca3df62cfd7ae5a0c85c019b0f5fe4f6f4740c | [
"MIT"
] | null | null | null | Exercise 028.py | sayan-datapython/Learn_Python_Full_Course_for_Beginners | 1cca3df62cfd7ae5a0c85c019b0f5fe4f6f4740c | [
"MIT"
] | null | null | null | Exercise 028.py | sayan-datapython/Learn_Python_Full_Course_for_Beginners | 1cca3df62cfd7ae5a0c85c019b0f5fe4f6f4740c | [
"MIT"
] | 1 | 2020-09-30T14:25:51.000Z | 2020-09-30T14:25:51.000Z | import random
player = int(input('Enter any number between 1 to 5: '))
if player == random.randint(0,5):
print('Your Win, right number {}'.format(player))
else:
print('Not the number, PC win {}'.format(player))
| 24.555556 | 56 | 0.665158 | import random
player = int(input('Enter any number between 1 to 5: '))
if player == random.randint(0,5):
print('Your Win, right number {}'.format(player))
else:
print('Not the number, PC win {}'.format(player))
| true | true |
1c3bb8db1a9efd72cb6495569f020bdb0f2f5985 | 1,358 | py | Python | dolphin/task_manager/resources.py | ThisIsClark/dolphin | 204cffd3faa1c83fde90942537737fe441406cd1 | [
"Apache-2.0"
] | null | null | null | dolphin/task_manager/resources.py | ThisIsClark/dolphin | 204cffd3faa1c83fde90942537737fe441406cd1 | [
"Apache-2.0"
] | null | null | null | dolphin/task_manager/resources.py | ThisIsClark/dolphin | 204cffd3faa1c83fde90942537737fe441406cd1 | [
"Apache-2.0"
] | null | null | null | # Copyright 2020 The SODA Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | 27.16 | 74 | 0.669367 |
from oslo_log import log
LOG = log.getLogger(__name__)
class StoragePoolTask:
def __init__(self, context, storage_id):
self.storage_id = storage_id
self.context = context
def sync(self):
LOG.info('Pool sync func...')
pass
def remove(self):
... | true | true |
1c3bb9b1864c1ec80b70dee70f1b782a1a0c9ca5 | 397 | py | Python | packages/grid/backend/grid/core/celery_config.py | leosole/PySyft | 01606f08f5ec5510840644e198301cd25c3ccfa5 | [
"Apache-1.1"
] | null | null | null | packages/grid/backend/grid/core/celery_config.py | leosole/PySyft | 01606f08f5ec5510840644e198301cd25c3ccfa5 | [
"Apache-1.1"
] | null | null | null | packages/grid/backend/grid/core/celery_config.py | leosole/PySyft | 01606f08f5ec5510840644e198301cd25c3ccfa5 | [
"Apache-1.1"
] | null | null | null | worker_send_task_event = False
task_ignore_result = True
task_time_limit = 600 # Rasswanth: should modify after optimizing PC
task_acks_late = True
broker_pool_limit = 500
worker_prefetch_multiplier = 1
task_routes = {
"grid.worker.msg_without_reply": "main-queue",
"delivery_mode": "transient",
}
accept_conten... | 28.357143 | 69 | 0.775819 | worker_send_task_event = False
task_ignore_result = True
task_time_limit = 600 task_acks_late = True
broker_pool_limit = 500
worker_prefetch_multiplier = 1
task_routes = {
"grid.worker.msg_without_reply": "main-queue",
"delivery_mode": "transient",
}
accept_content = ["application/syft"]
task_serializer = "syf... | true | true |
1c3bb9f80d17be7bc27d33f99a830fdbfd84454a | 3,921 | py | Python | equivalence/tables/node.py | Shurik412/equivalence_rastr_win3 | c37119f9cc59dcf96d236cd8f3ec090dc65a5db6 | [
"MIT"
] | null | null | null | equivalence/tables/node.py | Shurik412/equivalence_rastr_win3 | c37119f9cc59dcf96d236cd8f3ec090dc65a5db6 | [
"MIT"
] | null | null | null | equivalence/tables/node.py | Shurik412/equivalence_rastr_win3 | c37119f9cc59dcf96d236cd8f3ec090dc65a5db6 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Модуль переменных таблицы узлов RastrWin3
from dataclasses import dataclass
@dataclass(frozen=True)
class Node:
"""
Параметры таблицы узлов
"""
table: str = 'node'
table_name: str = '"Узлы"'
sel: str = 'sel' # отметка узла
sta: str = 'sta' # S, состояние узла
... | 44.05618 | 115 | 0.644223 | from dataclasses import dataclass
@dataclass(frozen=True)
class Node:
table: str = 'node'
table_name: str = '"Узлы"'
sel: str = 'sel' sta: str = 'sta' tip: str = 'tip' ny: str = 'ny' name: str = 'name' nsx: str = 'nsx' na: str = 'na' npa: str = 'npa' sta_r: str = '... | true | true |
1c3bba37f01fac3d2024abcc3b5f5d44e94bdb92 | 370 | py | Python | tests/config.py | balexander85/tweet_capture | 81caf672c4ac47de84f0aa2ce5a8d89b69e5349c | [
"MIT"
] | null | null | null | tests/config.py | balexander85/tweet_capture | 81caf672c4ac47de84f0aa2ce5a8d89b69e5349c | [
"MIT"
] | 2 | 2022-02-14T23:56:05.000Z | 2022-02-23T02:10:48.000Z | tests/config.py | balexander85/tweet_capture | 81caf672c4ac47de84f0aa2ce5a8d89b69e5349c | [
"MIT"
] | null | null | null | """config.py
Module containing the paths for chromedriver and conf directory
"""
from configparser import ConfigParser
from pathlib import Path
BASE_DIR = Path.cwd()
CONFIG_PATH = str(BASE_DIR.joinpath("tests", "conf", "config.ini"))
config = ConfigParser()
config.read(CONFIG_PATH)
# Selenium config
CHROME_DRIVER_P... | 23.125 | 67 | 0.772973 | from configparser import ConfigParser
from pathlib import Path
BASE_DIR = Path.cwd()
CONFIG_PATH = str(BASE_DIR.joinpath("tests", "conf", "config.ini"))
config = ConfigParser()
config.read(CONFIG_PATH)
CHROME_DRIVER_PATH = config.get("default", "CHROME_DRIVER_PATH")
| true | true |
1c3bbb7ca9541a8bea721a842cf1ed28423a4111 | 9,768 | py | Python | pkgcore/test/test_plugin.py | pombreda/pkgcore | b438fc573af1a031d7ce12adbbf299bab5338451 | [
"BSD-3-Clause"
] | 1 | 2021-07-05T13:10:18.000Z | 2021-07-05T13:10:18.000Z | pkgcore/test/test_plugin.py | vapier/pkgcore | 35a7e4f4f0fc61dd9c4dc72d35a57e2e9d5b832f | [
"BSD-3-Clause"
] | 8 | 2015-03-24T14:21:44.000Z | 2015-03-24T14:21:44.000Z | pkgcore/test/test_plugin.py | vapier/pkgcore | 35a7e4f4f0fc61dd9c4dc72d35a57e2e9d5b832f | [
"BSD-3-Clause"
] | null | null | null | # Copyright: 2011 Brian Harring <ferringb@gmail.com>
# Copyright: 2006 Marien Zwart <marienz@gentoo.org>
# License: BSD/GPL2
import logging
import os
import shutil
import sys
import tempfile
from snakeoil import lists
from snakeoil.osutils import pjoin
from pkgcore import plugin
from pkgcore.test import silence_logg... | 32.778523 | 79 | 0.627662 |
import logging
import os
import shutil
import sys
import tempfile
from snakeoil import lists
from snakeoil.osutils import pjoin
from pkgcore import plugin
from pkgcore.test import silence_logging, TestCase
class LowPlug(object):
priority = 1
class ModulesTest(TestCase):
def setUp(self):
... | true | true |
1c3bbb94848eda13cf7e65df610d7865e1377e94 | 1,825 | py | Python | column_self_define.py | xiaojinchuan/flask-sqlalchemy-usage | db7f41351ca06d7007cb87ef78beaaf631ae4e21 | [
"MIT"
] | null | null | null | column_self_define.py | xiaojinchuan/flask-sqlalchemy-usage | db7f41351ca06d7007cb87ef78beaaf631ae4e21 | [
"MIT"
] | null | null | null | column_self_define.py | xiaojinchuan/flask-sqlalchemy-usage | db7f41351ca06d7007cb87ef78beaaf631ae4e21 | [
"MIT"
] | null | null | null | """
在mysql5.7中使用JSON列
为JSON列中某些内容创建虚拟列,并为此虚拟列建立索引,以方便查询
"""
from sqlalchemy.schema import CreateColumn
from sqlalchemy.ext.compiler import compiles
@compiles(CreateColumn, 'mysql')
def mysql_genereted_column(element, compiler, **kwargs):
"""
如果字段定义中含有generated_with, 将根据info中的generate方法修改创建列的过程
mysql 指此函数... | 30.932203 | 114 | 0.693151 |
from sqlalchemy.schema import CreateColumn
from sqlalchemy.ext.compiler import compiles
@compiles(CreateColumn, 'mysql')
def mysql_genereted_column(element, compiler, **kwargs):
column = element.element
if 'generated_with' not in column.info:
return compiler.visit_create_column(element, **kwargs)
... | true | true |
1c3bbbe31941967bac1f78f34bcb108e8f5aa6f8 | 237 | py | Python | tests/apps/page_parts/pages/without.py | T4rk1n/dazzler | 69c49422dc19c910445ab265b1d3481041de8f43 | [
"MIT"
] | 15 | 2019-12-19T11:57:30.000Z | 2021-11-15T23:34:41.000Z | tests/apps/page_parts/pages/without.py | T4rk1n/dazzler | 69c49422dc19c910445ab265b1d3481041de8f43 | [
"MIT"
] | 196 | 2019-09-21T15:10:14.000Z | 2022-03-31T11:07:48.000Z | tests/apps/page_parts/pages/without.py | T4rk1n/dazzler | 69c49422dc19c910445ab265b1d3481041de8f43 | [
"MIT"
] | 7 | 2019-10-30T19:38:15.000Z | 2021-12-01T04:54:16.000Z | from dazzler.components import core
from dazzler.system import Page
page = Page(
__name__,
core.Container([
core.Text('Without', identity='without'),
]),
include_app_footer=False,
include_app_header=False,
)
| 19.75 | 49 | 0.687764 | from dazzler.components import core
from dazzler.system import Page
page = Page(
__name__,
core.Container([
core.Text('Without', identity='without'),
]),
include_app_footer=False,
include_app_header=False,
)
| true | true |
1c3bbc27ea91e63e86a79cac8a61c37bf33b24ed | 17,777 | py | Python | tacker/vnfm/monitor_drivers/zabbix/zabbix.py | qubitn1nja/tacker | 5b40d877a7050cbbec6bdf8ccd77eb7cf224f1b1 | [
"Apache-2.0"
] | 1 | 2020-10-13T05:20:38.000Z | 2020-10-13T05:20:38.000Z | tacker/vnfm/monitor_drivers/zabbix/zabbix.py | qubitn1nja/tacker | 5b40d877a7050cbbec6bdf8ccd77eb7cf224f1b1 | [
"Apache-2.0"
] | null | null | null | tacker/vnfm/monitor_drivers/zabbix/zabbix.py | qubitn1nja/tacker | 5b40d877a7050cbbec6bdf8ccd77eb7cf224f1b1 | [
"Apache-2.0"
] | 1 | 2020-02-08T08:15:53.000Z | 2020-02-08T08:15:53.000Z | # 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 applicable law or agreed to ... | 42.630695 | 79 | 0.504922 |
import json
import requests
import time
import copy
from oslo_log import log as logging
from tacker.vnfm.monitor_drivers import abstract_driver
from tacker.vnfm.monitor_drivers.zabbix import zabbix_api as zapi
LOG = logging.getLogger(__name__)
class VNFMonitorZabbix(abstract_driver.VNFMonitorAbstractDriver):
... | true | true |
1c3bbd283dbda4b1f40e22b50b367a2c196bb93f | 278 | py | Python | examples/advanced/convexHull.py | CommanderPho/vedo | a0784a47d1b1a92f71b81f153c12856ccf7ec242 | [
"MIT"
] | 1 | 2022-03-22T21:49:29.000Z | 2022-03-22T21:49:29.000Z | examples/advanced/convexHull.py | CommanderPho/vedo | a0784a47d1b1a92f71b81f153c12856ccf7ec242 | [
"MIT"
] | null | null | null | examples/advanced/convexHull.py | CommanderPho/vedo | a0784a47d1b1a92f71b81f153c12856ccf7ec242 | [
"MIT"
] | null | null | null | """Create the Convex Hull of a Mesh or a set of input points"""
from vedo import *
settings.defaultFont = 'Bongas'
settings.useDepthPeeling = True
spid = Mesh(dataurl+"spider.ply").c("brown")
ch = ConvexHull(spid.points()).alpha(0.2)
show(spid, ch, __doc__, axes=1).close()
| 23.166667 | 63 | 0.708633 | from vedo import *
settings.defaultFont = 'Bongas'
settings.useDepthPeeling = True
spid = Mesh(dataurl+"spider.ply").c("brown")
ch = ConvexHull(spid.points()).alpha(0.2)
show(spid, ch, __doc__, axes=1).close()
| true | true |
1c3bbf598e20b126cffd55cf727b8673e654f30c | 499 | py | Python | tests/contrib/test_uv.py | ZacheryGuan/python-pinyin | c16f4bc72ebbb4deabb31f867ec6db913a8a6327 | [
"MIT"
] | 1 | 2020-12-06T20:48:01.000Z | 2020-12-06T20:48:01.000Z | tests/contrib/test_uv.py | ZacheryGuan/python-pinyin | c16f4bc72ebbb4deabb31f867ec6db913a8a6327 | [
"MIT"
] | null | null | null | tests/contrib/test_uv.py | ZacheryGuan/python-pinyin | c16f4bc72ebbb4deabb31f867ec6db913a8a6327 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pypinyin import lazy_pinyin
from pypinyin.contrib.uv import V2UMixin
from pypinyin.converter import DefaultConverter
from pypinyin.core import Pinyin
class MyConverter(V2UMixin, DefaultConverter):
pass
my_pinyin = Pinyin(MyConverter())
def ... | 23.761905 | 60 | 0.719439 | from __future__ import unicode_literals
from pypinyin import lazy_pinyin
from pypinyin.contrib.uv import V2UMixin
from pypinyin.converter import DefaultConverter
from pypinyin.core import Pinyin
class MyConverter(V2UMixin, DefaultConverter):
pass
my_pinyin = Pinyin(MyConverter())
def test_v2u():
assert l... | true | true |
1c3bbf68330d376d9e95e148de4b54a17025e527 | 57,123 | py | Python | monai/transforms/croppad/array.py | davidiommi/MONAI_0_7_0 | c288dd065ab18aaf018ea01b54f3ec515e6444dd | [
"Apache-2.0"
] | null | null | null | monai/transforms/croppad/array.py | davidiommi/MONAI_0_7_0 | c288dd065ab18aaf018ea01b54f3ec515e6444dd | [
"Apache-2.0"
] | null | null | null | monai/transforms/croppad/array.py | davidiommi/MONAI_0_7_0 | c288dd065ab18aaf018ea01b54f3ec515e6444dd | [
"Apache-2.0"
] | null | null | null | # Copyright 2020 - 2021 MONAI Consortium
# 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 wri... | 47.761706 | 120 | 0.633825 |
from itertools import chain
from math import ceil
from typing import Any, Callable, List, Optional, Sequence, Tuple, Union
import numpy as np
import torch
from torch.nn.functional import pad as pad_pt
from monai.config import IndexSelection
from monai.config.type_definitions import NdarrayOrTensor
from monai.data.ut... | true | true |
1c3bc0ca4ddaa841443813539b0429a144605411 | 320 | py | Python | audit_tools/users/apps.py | diegoauyon/audit_tools | c92e24b038a240222e275041585112c55a388587 | [
"MIT"
] | null | null | null | audit_tools/users/apps.py | diegoauyon/audit_tools | c92e24b038a240222e275041585112c55a388587 | [
"MIT"
] | null | null | null | audit_tools/users/apps.py | diegoauyon/audit_tools | c92e24b038a240222e275041585112c55a388587 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class UsersConfig(AppConfig):
name = "audit_tools.users"
verbose_name = _("Users")
def ready(self):
try:
import audit_tools.users.signals # noqa F401
except ImportError:
pass
| 22.857143 | 57 | 0.6625 | from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class UsersConfig(AppConfig):
name = "audit_tools.users"
verbose_name = _("Users")
def ready(self):
try:
import audit_tools.users.signals except ImportError:
pass
| true | true |
1c3bc0eb348601d75e6d8e8eee9dd1263abeeef7 | 2,553 | py | Python | tests/functional/test_help.py | kpinc/pip | 9ab837e30dc11be72a4cbbf103e6b4cdfbb3cbb0 | [
"MIT"
] | 1 | 2018-07-24T14:56:11.000Z | 2018-07-24T14:56:11.000Z | tests/functional/test_help.py | kpinc/pip | 9ab837e30dc11be72a4cbbf103e6b4cdfbb3cbb0 | [
"MIT"
] | null | null | null | tests/functional/test_help.py | kpinc/pip | 9ab837e30dc11be72a4cbbf103e6b4cdfbb3cbb0 | [
"MIT"
] | 1 | 2019-06-28T05:23:31.000Z | 2019-06-28T05:23:31.000Z | import pytest
from mock import Mock
from pip._internal.basecommand import ERROR, SUCCESS
from pip._internal.commands import commands_dict as commands
from pip._internal.commands.help import HelpCommand
from pip._internal.exceptions import CommandError
def test_run_method_should_return_success_when_finds_command_name... | 28.054945 | 79 | 0.680376 | import pytest
from mock import Mock
from pip._internal.basecommand import ERROR, SUCCESS
from pip._internal.commands import commands_dict as commands
from pip._internal.commands.help import HelpCommand
from pip._internal.exceptions import CommandError
def test_run_method_should_return_success_when_finds_command_name... | true | true |
1c3bc2d48eb7393dec3dbdb31c36e7909183d803 | 1,644 | py | Python | helpers/decorators.py | mfmviip/Arabic | 6687885cc795817677f892939860e4f196d11433 | [
"Apache-2.0"
] | null | null | null | helpers/decorators.py | mfmviip/Arabic | 6687885cc795817677f892939860e4f196d11433 | [
"Apache-2.0"
] | null | null | null | helpers/decorators.py | mfmviip/Arabic | 6687885cc795817677f892939860e4f196d11433 | [
"Apache-2.0"
] | null | null | null | # Calls Music 1 - Telegram bot for streaming audio in group calls
# Copyright (C) 2021 MFMVIP
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at y... | 33.55102 | 74 | 0.725061 |
from typing import Callable
from pyrogram import Client
from pyrogram.types import Message
from helpers.admins import get_administrators
from config import SUDO_USERS
def errors(func: Callable) -> Callable:
async def decorator(client: Client, message: Message):
try:
return await func(cli... | true | true |
1c3bc40597cbe01e2e381244860e4ccd246e1bc1 | 7,468 | py | Python | hyou/view.py | endast/hyou | e95455fde1c56707529283b17a333a2b8596edae | [
"Apache-2.0"
] | 1 | 2021-07-06T23:38:10.000Z | 2021-07-06T23:38:10.000Z | hyou/view.py | endast/hyou | e95455fde1c56707529283b17a333a2b8596edae | [
"Apache-2.0"
] | null | null | null | hyou/view.py | endast/hyou | e95455fde1c56707529283b17a333a2b8596edae | [
"Apache-2.0"
] | null | null | null | # Copyright 2017 Google Inc. 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 applicable law or a... | 35.226415 | 79 | 0.595474 |
from __future__ import (
absolute_import, division, print_function, unicode_literals)
import six
from . import py3
from . import util
class View(util.CustomMutableFixedList):
def __init__(self, worksheet, api, start_row, end_row, start_col, end_col):
self._worksheet = worksheet
self._api =... | true | true |
1c3bc42d40ce6c3bf59f9f7448c64b5915065d1e | 1,245 | py | Python | tests/operators/test_zype_operator.py | Dminor7/airflow-provider-zype | 949b2665509ac12c3691ebd47e8ac3f641bd73de | [
"Apache-2.0"
] | null | null | null | tests/operators/test_zype_operator.py | Dminor7/airflow-provider-zype | 949b2665509ac12c3691ebd47e8ac3f641bd73de | [
"Apache-2.0"
] | null | null | null | tests/operators/test_zype_operator.py | Dminor7/airflow-provider-zype | 949b2665509ac12c3691ebd47e8ac3f641bd73de | [
"Apache-2.0"
] | null | null | null | """
Unittest module to test Operators.
Requires the unittest, pytest, and requests-mock Python libraries.
Run test:
python -m unittest tests.operators.test_zype_operator.TestZypeOperator
"""
import json
import logging
import os
import unittest
from unittest import mock
# Import Operator
from zype_provider.ope... | 23.055556 | 111 | 0.682731 |
import json
import logging
import os
import unittest
from unittest import mock
from zype_provider.operators.zype_operator import ZypeOperator
log = logging.getLogger(__name__)
@mock.patch.dict("os.environ", AIRFLOW_CONN_CONN_ZYPE="zype://:<YOUR_API_KEY>@")
class TestZypeOperator(unittest.TestCase):
def test_... | true | true |
1c3bc49c607f819f24310097910301e35f2df79c | 2,032 | py | Python | pykeyvi/tests/dictionary_compiler_test.py | jsdelivrbot/keyvi-1 | c56fb92da5eed655bf20e46d56f1e117b2556e3e | [
"Apache-2.0"
] | 147 | 2015-10-06T19:10:01.000Z | 2021-08-19T07:52:02.000Z | pykeyvi/tests/dictionary_compiler_test.py | jsdelivrbot/keyvi-1 | c56fb92da5eed655bf20e46d56f1e117b2556e3e | [
"Apache-2.0"
] | 148 | 2015-10-06T09:24:56.000Z | 2018-12-08T08:42:54.000Z | pykeyvi/tests/dictionary_compiler_test.py | jsdelivrbot/keyvi-1 | c56fb92da5eed655bf20e46d56f1e117b2556e3e | [
"Apache-2.0"
] | 34 | 2015-10-09T06:55:52.000Z | 2021-01-05T18:43:57.000Z | # -*- coding: utf-8 -*-
# Usage: py.test tests
import os
import pykeyvi
import shutil
import tempfile
import test_tools
from pytest import raises
def test_compiler_no_compile_edge_case():
c = pykeyvi.KeyOnlyDictionaryCompiler({"memory_limit_mb":"10"})
c.Add("abc")
c.Add("abd")
del c
def test_compile... | 27.459459 | 94 | 0.643701 |
import os
import pykeyvi
import shutil
import tempfile
import test_tools
from pytest import raises
def test_compiler_no_compile_edge_case():
c = pykeyvi.KeyOnlyDictionaryCompiler({"memory_limit_mb":"10"})
c.Add("abc")
c.Add("abd")
del c
def test_compiler_no_compile_edge_case_empty():
c = pykeyvi... | true | true |
1c3bc5a85717b0debece6004bd124e39021b7f9a | 1,504 | py | Python | rdmo/views/views.py | m6121/rdmo | db3990c7525138c6ce9634fc3e5b6b8ee9b915c8 | [
"Apache-2.0"
] | 77 | 2016-08-09T11:40:20.000Z | 2022-03-06T11:03:26.000Z | rdmo/views/views.py | m6121/rdmo | db3990c7525138c6ce9634fc3e5b6b8ee9b915c8 | [
"Apache-2.0"
] | 377 | 2016-07-01T13:59:36.000Z | 2022-03-30T13:53:19.000Z | rdmo/views/views.py | m6121/rdmo | db3990c7525138c6ce9634fc3e5b6b8ee9b915c8 | [
"Apache-2.0"
] | 47 | 2016-06-23T11:32:19.000Z | 2022-03-01T11:34:37.000Z | import logging
from django.conf import settings
from django.utils.translation import gettext_lazy as _
from django.views.generic import ListView, TemplateView
from rdmo.core.exports import XMLResponse
from rdmo.core.utils import get_model_field_meta, render_to_format
from rdmo.core.views import CSRFViewMixin, ModelPe... | 34.181818 | 105 | 0.724734 | import logging
from django.conf import settings
from django.utils.translation import gettext_lazy as _
from django.views.generic import ListView, TemplateView
from rdmo.core.exports import XMLResponse
from rdmo.core.utils import get_model_field_meta, render_to_format
from rdmo.core.views import CSRFViewMixin, ModelPe... | true | true |
1c3bc63ed82243be89e16b8f67010dc1fd4599a0 | 21,647 | py | Python | pyIndego/indego_async_client.py | MagaliDB/pyIndego | 3764eb01b5ef6a2903c7eaede578208b32e755a1 | [
"MIT"
] | null | null | null | pyIndego/indego_async_client.py | MagaliDB/pyIndego | 3764eb01b5ef6a2903c7eaede578208b32e755a1 | [
"MIT"
] | null | null | null | pyIndego/indego_async_client.py | MagaliDB/pyIndego | 3764eb01b5ef6a2903c7eaede578208b32e755a1 | [
"MIT"
] | null | null | null | """API for Bosch API server for Indego lawn mower."""
import asyncio
import logging
from socket import error as SocketError
from typing import Any
import aiohttp
from aiohttp import (
ClientOSError,
ClientResponseError,
ServerTimeoutError,
TooManyRedirects,
)
from aiohttp.helpers import BasicAuth
from ... | 35.603618 | 127 | 0.571396 | import asyncio
import logging
from socket import error as SocketError
from typing import Any
import aiohttp
from aiohttp import (
ClientOSError,
ClientResponseError,
ServerTimeoutError,
TooManyRedirects,
)
from aiohttp.helpers import BasicAuth
from aiohttp.web_exceptions import HTTPGatewayTimeout
from... | true | true |
1c3bc64c5a559fb9951515855548dfdd9a4e1a71 | 207 | py | Python | 2014-1-bcc-ip-L5-DanilloMoraes/2014-1-bcc-ip-LISTA5/Q5.py | DanilloMLS/lista_de_exercicios | 4eb9ecfafec6804472218c9020d2a3715760a5a5 | [
"MIT"
] | null | null | null | 2014-1-bcc-ip-L5-DanilloMoraes/2014-1-bcc-ip-LISTA5/Q5.py | DanilloMLS/lista_de_exercicios | 4eb9ecfafec6804472218c9020d2a3715760a5a5 | [
"MIT"
] | null | null | null | 2014-1-bcc-ip-L5-DanilloMoraes/2014-1-bcc-ip-LISTA5/Q5.py | DanilloMLS/lista_de_exercicios | 4eb9ecfafec6804472218c9020d2a3715760a5a5 | [
"MIT"
] | null | null | null | def inserir(v,valor,p):
u=[]
pos=p-1
if pos<0:
pos=0
for i in range(0,len(v)):
if i==pos:
u.append(valor)
u.append(v[i])
return u
| 15.923077 | 30 | 0.400966 | def inserir(v,valor,p):
u=[]
pos=p-1
if pos<0:
pos=0
for i in range(0,len(v)):
if i==pos:
u.append(valor)
u.append(v[i])
return u
| true | true |
1c3bc73806d3e8bea7d8c6d8f48e0c8eb5dfd69f | 2,185 | bzl | Python | apple/bundling/clang_support.bzl | pwnartist/rules_apple | cc8a1f2b576c2b757940f93388d04a7789d9824e | [
"Apache-2.0"
] | null | null | null | apple/bundling/clang_support.bzl | pwnartist/rules_apple | cc8a1f2b576c2b757940f93388d04a7789d9824e | [
"Apache-2.0"
] | null | null | null | apple/bundling/clang_support.bzl | pwnartist/rules_apple | cc8a1f2b576c2b757940f93388d04a7789d9824e | [
"Apache-2.0"
] | null | null | null | # Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | 34.140625 | 75 | 0.748741 |
load("@build_bazel_rules_apple//apple/bundling:bundling_support.bzl",
"bundling_support")
load("@build_bazel_rules_apple//apple/bundling:binary_support.bzl",
"binary_support")
load("@build_bazel_rules_apple//apple/bundling:file_support.bzl",
"file_support")
load("@build_bazel_rules_apple//apple/bundling:p... | true | true |
1c3bc7749ef232c26ea63157494ddbc0cefeeb54 | 69,606 | py | Python | nipype/interfaces/afni/preprocess.py | dmordom/nipype | e815741ad68d63b7134b6db6225aabb0c38511ac | [
"BSD-3-Clause"
] | 1 | 2018-04-18T12:13:37.000Z | 2018-04-18T12:13:37.000Z | nipype/interfaces/afni/preprocess.py | ito-takuya/nipype | 9099a5809487b55868cdec82a719030419cbd6ba | [
"BSD-3-Clause"
] | null | null | null | nipype/interfaces/afni/preprocess.py | ito-takuya/nipype | 9099a5809487b55868cdec82a719030419cbd6ba | [
"BSD-3-Clause"
] | 1 | 2021-09-08T14:31:47.000Z | 2021-09-08T14:31:47.000Z | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft = python sts = 4 ts = 4 sw = 4 et:
"""Afni preprocessing interfaces
Change directory to provide relative paths for doctests
>>> import os
>>> filepath = os.path.dirname( os.path.realpath( __file__ ) )
>>> datadir = o... | 35.934951 | 202 | 0.592061 | import warnings
import os
import re
from ..base import (Directory, TraitedSpec,
traits, isdefined, File, InputMultiPath, Undefined)
from ...utils.filemanip import (load_json, save_json, split_filename)
from nipype.utils.filemanip import fname_presuffix
from .base import AFNICommand, AFNICommandInp... | true | true |
1c3bcce09af9641bcb3f62c534a49d3b56c740a5 | 3,282 | py | Python | models/.ipynb_checkpoints/position_encoding-checkpoint.py | jaehyek/deformable-DETR-2 | 930f36b9c491e35ce7870f2711c28243152ee058 | [
"MIT"
] | 12 | 2021-03-16T15:33:06.000Z | 2022-03-03T00:31:52.000Z | models/position_encoding.py | ver0z/Deformable-DETR | 7f1f4ffd1d716f681c7cbb2570e2c7a3d4bcf417 | [
"Apache-2.0"
] | 3 | 2021-07-15T20:55:13.000Z | 2022-01-20T11:56:05.000Z | models/position_encoding.py | ver0z/Deformable-DETR | 7f1f4ffd1d716f681c7cbb2570e2c7a3d4bcf417 | [
"Apache-2.0"
] | 6 | 2021-03-16T15:26:15.000Z | 2021-12-29T01:55:15.000Z |
"""
Various positional encodings for the transformer.
"""
import math
import torch
from torch import nn
from util.misc import NestedTensor
class PositionEmbeddingSine(nn.Module):
"""
This is a more standard version of the position embedding, very similar to the one
used by the Attention is all you need ... | 36.466667 | 103 | 0.618221 |
import math
import torch
from torch import nn
from util.misc import NestedTensor
class PositionEmbeddingSine(nn.Module):
def __init__(self, num_pos_feats=64, temperature=10000, normalize=False, scale=None):
super().__init__()
self.num_pos_feats = num_pos_feats
self.temperature = temperat... | true | true |
1c3bcd602197858f1701e139a57d06f0ab74f495 | 62,326 | py | Python | rcnn/lib/python3.6/site-packages/tensorflow/compiler/xla/xla_data_pb2.py | dreamingweaver/making_passportImage | 68f23411780ff82abe934dfae5fc04acb80f2c49 | [
"MIT"
] | 1 | 2019-01-12T13:17:32.000Z | 2019-01-12T13:17:32.000Z | rcnn/lib/python3.6/site-packages/tensorflow/compiler/xla/xla_data_pb2.py | dreamingweaver/making_passportImage | 68f23411780ff82abe934dfae5fc04acb80f2c49 | [
"MIT"
] | null | null | null | rcnn/lib/python3.6/site-packages/tensorflow/compiler/xla/xla_data_pb2.py | dreamingweaver/making_passportImage | 68f23411780ff82abe934dfae5fc04acb80f2c49 | [
"MIT"
] | null | null | null | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: tensorflow/compiler/xla/xla_data.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.prot... | 39.723391 | 6,055 | 0.744794 |
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf i... | true | true |
1c3bce0e68d6cb50bf6de6908d0001125204b025 | 817 | py | Python | v2/goalnet/core/modules/logger.py | DaniloZZZ/GoalNet | d24102a5f0700fbf42c0868b321d6f6a097ee97b | [
"Apache-2.0"
] | null | null | null | v2/goalnet/core/modules/logger.py | DaniloZZZ/GoalNet | d24102a5f0700fbf42c0868b321d6f6a097ee97b | [
"Apache-2.0"
] | null | null | null | v2/goalnet/core/modules/logger.py | DaniloZZZ/GoalNet | d24102a5f0700fbf42c0868b321d6f6a097ee97b | [
"Apache-2.0"
] | null | null | null | """
Created by Danil Lykov @danlkv on 13/02/19
"""
from pprint import pprint
import multiprocessing as prc
from goalnet.helpers.log_init import log
from goalnet.utils import get_network_config
from .AsyncBaseModule import AsyncModule
class LoggerModule(AsyncModule):
"""
A simple module that logs everything a... | 24.029412 | 68 | 0.709914 |
from pprint import pprint
import multiprocessing as prc
from goalnet.helpers.log_init import log
from goalnet.utils import get_network_config
from .AsyncBaseModule import AsyncModule
class LoggerModule(AsyncModule):
def __init__(self, netconf,name='logger'):
super().__init__(netconf, name=name)
asyn... | true | true |
1c3bce42ea29a20fbb907c8b16ed4eb577176d89 | 4,185 | py | Python | pypy/rlib/test/test_rweakkeydict.py | benoitc/pypy | a3e1b12d1d01dc29056b7badc051ffc034297658 | [
"MIT"
] | 1 | 2020-01-21T11:10:51.000Z | 2020-01-21T11:10:51.000Z | pypy/rlib/test/test_rweakkeydict.py | benoitc/pypy | a3e1b12d1d01dc29056b7badc051ffc034297658 | [
"MIT"
] | null | null | null | pypy/rlib/test/test_rweakkeydict.py | benoitc/pypy | a3e1b12d1d01dc29056b7badc051ffc034297658 | [
"MIT"
] | null | null | null | import py
from pypy.rlib import rgc
from pypy.rlib.rweakref import RWeakKeyDictionary
from pypy.rpython.test.test_llinterp import interpret
class KX(object):
pass
class KY(KX):
pass
class VX(object):
pass
class VY(VX):
pass
def make_test(loop=100, prebuilt=None):
def g(d):
assert d.get... | 25.05988 | 72 | 0.519235 | import py
from pypy.rlib import rgc
from pypy.rlib.rweakref import RWeakKeyDictionary
from pypy.rpython.test.test_llinterp import interpret
class KX(object):
pass
class KY(KX):
pass
class VX(object):
pass
class VY(VX):
pass
def make_test(loop=100, prebuilt=None):
def g(d):
assert d.get... | true | true |
1c3bcea52be1a62af86608ca35e65fa11993e1bb | 547,683 | py | Python | HLTrigger/Configuration/test/OnLine_HLT_PRef.py | DenkMybu/cmssw | 70b770f8d71f81469ef7f171c16d4d8958826d6e | [
"Apache-2.0"
] | null | null | null | HLTrigger/Configuration/test/OnLine_HLT_PRef.py | DenkMybu/cmssw | 70b770f8d71f81469ef7f171c16d4d8958826d6e | [
"Apache-2.0"
] | null | null | null | HLTrigger/Configuration/test/OnLine_HLT_PRef.py | DenkMybu/cmssw | 70b770f8d71f81469ef7f171c16d4d8958826d6e | [
"Apache-2.0"
] | null | null | null | # hltGetConfiguration --full --data /dev/CMSSW_12_3_0/PRef --type PRef --unprescale --process HLTPRef --globaltag auto:run3_hlt_PRef --input file:RelVal_Raw_PRef_DATA.root
# /dev/CMSSW_12_3_0/PRef/V23 (CMSSW_12_3_0_pre4)
import FWCore.ParameterSet.Config as cms
from HeterogeneousCore.CUDACore.SwitchProducerCUDA impo... | 48.105665 | 2,125 | 0.707365 |
import FWCore.ParameterSet.Config as cms
from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA
process = cms.Process( "HLTPRef" )
process.HLTConfigVersion = cms.PSet(
tableName = cms.string('/dev/CMSSW_12_3_0/PRef/V23')
)
process.transferSystem = cms.PSet(
destinations = cms.vstring( '... | true | true |
1c3bd12c2509fbbc3cd382544adb42425da721b8 | 214 | py | Python | users/urls.py | tomuhenry/wonya-backend | d54360e8d5d5363e4bf5471fb81d732a221e37c9 | [
"MIT"
] | 3 | 2020-06-16T22:28:05.000Z | 2020-06-17T10:07:00.000Z | users/urls.py | tomuhenry/wonya-backend | d54360e8d5d5363e4bf5471fb81d732a221e37c9 | [
"MIT"
] | 3 | 2020-06-17T11:04:31.000Z | 2021-04-08T21:09:07.000Z | users/urls.py | tomuhenry/wonya-backend | d54360e8d5d5363e4bf5471fb81d732a221e37c9 | [
"MIT"
] | null | null | null | from django.contrib import admin
from django.urls import path, include
app_name = 'users'
urlpatterns = [
path('', include('rest_auth.urls')),
path('register/', include('rest_auth.registration.urls')),
]
| 21.4 | 62 | 0.705607 | from django.contrib import admin
from django.urls import path, include
app_name = 'users'
urlpatterns = [
path('', include('rest_auth.urls')),
path('register/', include('rest_auth.registration.urls')),
]
| true | true |
1c3bd1d2a2eba796bbc6c2d572f4e7f6f5aa296d | 137 | py | Python | jsonfield/__init__.py | alexsilva/django-jsonfield | 37499674f62073baa7306fa6a9ae2721c72d2120 | [
"BSD-3-Clause"
] | null | null | null | jsonfield/__init__.py | alexsilva/django-jsonfield | 37499674f62073baa7306fa6a9ae2721c72d2120 | [
"BSD-3-Clause"
] | null | null | null | jsonfield/__init__.py | alexsilva/django-jsonfield | 37499674f62073baa7306fa6a9ae2721c72d2120 | [
"BSD-3-Clause"
] | null | null | null | import os
from jsonfield.fields import JSONField
__version__ = open(os.path.join(os.path.dirname(__file__), 'VERSION')).read().strip()
| 22.833333 | 85 | 0.759124 | import os
from jsonfield.fields import JSONField
__version__ = open(os.path.join(os.path.dirname(__file__), 'VERSION')).read().strip()
| true | true |
1c3bd36a5104a45808c96e6ecc8528009f469bec | 1,587 | py | Python | utils/views.py | dayraliz99/gmeBox | 82e7a19cf69452a469d09063146b215413db886b | [
"Apache-2.0"
] | null | null | null | utils/views.py | dayraliz99/gmeBox | 82e7a19cf69452a469d09063146b215413db886b | [
"Apache-2.0"
] | null | null | null | utils/views.py | dayraliz99/gmeBox | 82e7a19cf69452a469d09063146b215413db886b | [
"Apache-2.0"
] | null | null | null | from django.core.exceptions import PermissionDenied
class CustomUserOnlyMixin(object):
"""
Permite personalizar los permisos de acceso para los views
"""
permissions_required = None
def has_permissions(self):
if self.request.user.is_active is False:
return False
if sel... | 31.74 | 66 | 0.627599 | from django.core.exceptions import PermissionDenied
class CustomUserOnlyMixin(object):
permissions_required = None
def has_permissions(self):
if self.request.user.is_active is False:
return False
if self.request.user.is_superuser is True:
return True
groups = s... | true | true |
1c3bd7d8a3f08cc0b0e10770c6b45638d2469949 | 1,934 | py | Python | AnaphoraFinder.py | Studi60Lax/Rhetorical-Analysis | b4020d9c72e63b3dfebbd88d1234de9a1e31fe82 | [
"MIT"
] | 4 | 2019-10-20T17:44:02.000Z | 2022-03-28T14:30:50.000Z | AnaphoraFinder.py | Studi60Lax/Rhetorical-Analysis | b4020d9c72e63b3dfebbd88d1234de9a1e31fe82 | [
"MIT"
] | null | null | null | AnaphoraFinder.py | Studi60Lax/Rhetorical-Analysis | b4020d9c72e63b3dfebbd88d1234de9a1e31fe82 | [
"MIT"
] | 1 | 2020-02-02T07:07:40.000Z | 2020-02-02T07:07:40.000Z | from nltk import word_tokenize
class AnaphoraFinder:
def __init__(self):
self.f = ""
self.counter = 0
self.first_word = ""
self.b = False
#Path is inputted from AIPController
#Returns anaphora counter
def sendFile(self, path):
self.f = open(path)
... | 29.753846 | 75 | 0.481386 | from nltk import word_tokenize
class AnaphoraFinder:
def __init__(self):
self.f = ""
self.counter = 0
self.first_word = ""
self.b = False
def sendFile(self, path):
self.f = open(path)
for line in self.f:
try:
if self... | true | true |
1c3bd8efbe0b47e5e3dd582d5599cf423a55c082 | 4,430 | py | Python | napari/_qt/tests/test_qt_dims.py | arokem/napari | e16e1163cf422d3aba6d86d1ae7dcd70a85b87dd | [
"BSD-3-Clause"
] | null | null | null | napari/_qt/tests/test_qt_dims.py | arokem/napari | e16e1163cf422d3aba6d86d1ae7dcd70a85b87dd | [
"BSD-3-Clause"
] | 1 | 2019-09-18T22:59:55.000Z | 2019-09-23T16:41:08.000Z | napari/_qt/tests/test_qt_dims.py | arokem/napari | e16e1163cf422d3aba6d86d1ae7dcd70a85b87dd | [
"BSD-3-Clause"
] | null | null | null | import numpy as np
from napari.components import Dims
from napari._qt.qt_dims import QtDims
def test_creating_view(qtbot):
"""
Test creating dims view.
"""
ndim = 4
dims = Dims(ndim)
view = QtDims(dims)
qtbot.addWidget(view)
# Check that the dims model has been appended to the dims ... | 30.763889 | 79 | 0.669752 | import numpy as np
from napari.components import Dims
from napari._qt.qt_dims import QtDims
def test_creating_view(qtbot):
ndim = 4
dims = Dims(ndim)
view = QtDims(dims)
qtbot.addWidget(view)
assert view.dims == dims
assert view.nsliders == view.dims.ndim
assert np.sum(view... | true | true |
1c3bd95b330ff1dc43faa1814ed8f9bf4188d8ab | 686 | py | Python | i2c_responder/calc_icmpv6_chksum.py | ddgarrett/mbos | 58ca81fa518c4cbad77fb83f58120bfe1495482e | [
"MIT"
] | null | null | null | i2c_responder/calc_icmpv6_chksum.py | ddgarrett/mbos | 58ca81fa518c4cbad77fb83f58120bfe1495482e | [
"MIT"
] | null | null | null | i2c_responder/calc_icmpv6_chksum.py | ddgarrett/mbos | 58ca81fa518c4cbad77fb83f58120bfe1495482e | [
"MIT"
] | null | null | null | from struct import unpack
def calc_icmpv6_chksum(packet):
"""Calculate the ICMPv6 checksum for a packet.
:param packet: The packet bytes to checksum.
:returns: The checksum integer.
from: https://www.programcreek.com/python/?CodeExample=calculate+checksum
"""
total = 0
# Add up ... | 26.384615 | 77 | 0.61516 | from struct import unpack
def calc_icmpv6_chksum(packet):
total = 0
num_words = len(packet) // 2
for chunk in unpack("!%sH" % num_words, packet[0:num_words * 2]):
total += chunk
if len(packet) % 2:
total += packet[-1] << 8
total = (total >> 16) + (total & 0xffff)
... | true | true |
1c3bdb24cdb1ae51082f0482d8a76ee462ef1546 | 4,527 | py | Python | megadoot/megadoot.py | mayanks0ni/modmail-plugins | 82df5f13d2cc016af0792f2c42314577101553d3 | [
"MIT"
] | 14 | 2019-08-09T09:59:46.000Z | 2020-09-30T10:20:46.000Z | megadoot/megadoot.py | mayanks0ni/modmail-plugins | 82df5f13d2cc016af0792f2c42314577101553d3 | [
"MIT"
] | 1,093 | 2019-11-14T09:57:33.000Z | 2021-11-08T04:56:29.000Z | megadoot/megadoot.py | mayanks0ni/modmail-plugins | 82df5f13d2cc016af0792f2c42314577101553d3 | [
"MIT"
] | 38 | 2019-08-09T16:44:44.000Z | 2022-03-20T16:45:40.000Z | import random
import discord
from discord.ext import commands
class Megadoot(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.fights = [
'{0} tried to throw a snowball at {1} but it hits Dabbit\'s car, and Dabbit is not pleased!',
'{0} tackled {1} down ... | 61.175676 | 184 | 0.578529 | import random
import discord
from discord.ext import commands
class Megadoot(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.fights = [
'{0} tried to throw a snowball at {1} but it hits Dabbit\'s car, and Dabbit is not pleased!',
'{0} tackled {1} down ... | true | true |
1c3bdb32fc865ce079b625627d488a6b11d6b380 | 7,138 | py | Python | veriloggen/stream/scheduler.py | jesseclin/veriloggen | a645f2c53f04e5b88213eef17779d212192ea2b5 | [
"Apache-2.0"
] | 232 | 2015-09-01T16:07:48.000Z | 2022-03-28T14:53:28.000Z | veriloggen/stream/scheduler.py | jesseclin/veriloggen | a645f2c53f04e5b88213eef17779d212192ea2b5 | [
"Apache-2.0"
] | 34 | 2015-08-21T09:13:03.000Z | 2022-03-21T23:52:44.000Z | veriloggen/stream/scheduler.py | jesseclin/veriloggen | a645f2c53f04e5b88213eef17779d212192ea2b5 | [
"Apache-2.0"
] | 46 | 2015-09-24T14:39:57.000Z | 2022-02-23T21:59:56.000Z | from __future__ import absolute_import
from __future__ import print_function
from . import stypes
from .visitor import _Visitor
class _Scheduler(_Visitor):
def max_stage(self, *vars):
return stypes._max(*vars)
def next_stage(self, node, stage):
if stage is None:
return 0
... | 36.793814 | 91 | 0.60283 | from __future__ import absolute_import
from __future__ import print_function
from . import stypes
from .visitor import _Visitor
class _Scheduler(_Visitor):
def max_stage(self, *vars):
return stypes._max(*vars)
def next_stage(self, node, stage):
if stage is None:
return 0
... | true | true |
1c3bdbf32ed8ebc506854076d2d9c825108d5262 | 440 | py | Python | app.py | AcharyaRakesh/Baldness-Prediction | f97c3bf1f068b167405f3bc711a7f6630905da2e | [
"MIT"
] | null | null | null | app.py | AcharyaRakesh/Baldness-Prediction | f97c3bf1f068b167405f3bc711a7f6630905da2e | [
"MIT"
] | null | null | null | app.py | AcharyaRakesh/Baldness-Prediction | f97c3bf1f068b167405f3bc711a7f6630905da2e | [
"MIT"
] | null | null | null |
from main import load_model
model = load_model('model.h5')
import numpy as np
from tensorflow.keras.preprocessing import image
test_image = image.load_img('',target_size=(64,64) )
test_image = image.img_to_array(test_image)
test_image = test_image/255
test_image=np.expand_dims(test_image,axis=0)
result = ... | 25.882353 | 53 | 0.736364 |
from main import load_model
model = load_model('model.h5')
import numpy as np
from tensorflow.keras.preprocessing import image
test_image = image.load_img('',target_size=(64,64) )
test_image = image.img_to_array(test_image)
test_image = test_image/255
test_image=np.expand_dims(test_image,axis=0)
result = ... | true | true |
1c3bdca0bbd1a7ab4b6286aab45327684c4f6227 | 7,131 | py | Python | ze_trajectory_analysis/py/ze_trajectory_analysis/consistency_single_run.py | rockenbf/ze_oss | ee04158e2d51acb07a267196f618e9afbc3ffd83 | [
"BSD-3-Clause"
] | 30 | 2016-09-27T07:41:28.000Z | 2021-12-03T20:44:28.000Z | ze_trajectory_analysis/py/ze_trajectory_analysis/consistency_single_run.py | rockenbf/ze_oss | ee04158e2d51acb07a267196f618e9afbc3ffd83 | [
"BSD-3-Clause"
] | 1 | 2018-12-18T15:53:06.000Z | 2018-12-21T03:10:06.000Z | ze_trajectory_analysis/py/ze_trajectory_analysis/consistency_single_run.py | rockenbf/ze_oss | ee04158e2d51acb07a267196f618e9afbc3ffd83 | [
"BSD-3-Clause"
] | 12 | 2016-11-05T07:51:29.000Z | 2020-07-13T02:26:08.000Z | #!/usr/bin/python3
"""
Zurich Eye
"""
import os
import yaml
import logging
import argparse
import numpy as np
import ze_trajectory_analysis.analyse as traj_analysis
import ze_py.transformations as tf
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import vikit_py.transformations as tf
from matpl... | 37.335079 | 109 | 0.697097 |
import os
import yaml
import logging
import argparse
import numpy as np
import ze_trajectory_analysis.analyse as traj_analysis
import ze_py.transformations as tf
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import vikit_py.transformations as tf
from matplotlib import rc
from matplotlib.ticker... | true | true |
1c3bde8ca6b6b305dd3385b8719759404968c735 | 6,169 | py | Python | basicsr/utils/img_util.py | IanYeung/ReCp | 1a7ace0e1ca3c262e24a222f3f0ab0d5674e9410 | [
"Apache-2.0",
"MIT"
] | null | null | null | basicsr/utils/img_util.py | IanYeung/ReCp | 1a7ace0e1ca3c262e24a222f3f0ab0d5674e9410 | [
"Apache-2.0",
"MIT"
] | null | null | null | basicsr/utils/img_util.py | IanYeung/ReCp | 1a7ace0e1ca3c262e24a222f3f0ab0d5674e9410 | [
"Apache-2.0",
"MIT"
] | null | null | null | import cv2
import math
import numpy as np
import os
import torch
from torchvision.utils import make_grid
def normalize(imgs):
def _norm(img):
return img.astype(np.float32) / 255.
if isinstance(imgs, list):
return [_norm(img) for img in imgs]
else:
return _norm(imgs)
def img2ten... | 31.963731 | 79 | 0.58486 | import cv2
import math
import numpy as np
import os
import torch
from torchvision.utils import make_grid
def normalize(imgs):
def _norm(img):
return img.astype(np.float32) / 255.
if isinstance(imgs, list):
return [_norm(img) for img in imgs]
else:
return _norm(imgs)
def img2ten... | true | true |
1c3bde9c0433366821197ae865f4d4b41ed5c11f | 2,182 | py | Python | AlgorithmFactories/ClassificationAlgorithmFactories/LogisticRegressionAlgorithmFactory.py | CzakoZoltan08/COVID-19-patient-filtering-using-AutomaticAI | 87c4cb1d2848a0258b0b6d652316cb69de382ff0 | [
"MIT"
] | 1 | 2021-07-26T19:42:50.000Z | 2021-07-26T19:42:50.000Z | AlgorithmFactories/ClassificationAlgorithmFactories/LogisticRegressionAlgorithmFactory.py | CzakoZoltan08/COVID-19-patient-filtering-using-AutomaticAI | 87c4cb1d2848a0258b0b6d652316cb69de382ff0 | [
"MIT"
] | null | null | null | AlgorithmFactories/ClassificationAlgorithmFactories/LogisticRegressionAlgorithmFactory.py | CzakoZoltan08/COVID-19-patient-filtering-using-AutomaticAI | 87c4cb1d2848a0258b0b6d652316cb69de382ff0 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 23 12:28:07 2019
@author: czzo
"""
from collections import OrderedDict
from sklearn.linear_model import LogisticRegression
from ..Algorithm import Algorithm
const_param_logistic_regression = {
'verbose': 0,
'dual': False,
'class_weight': 'balanced',
... | 36.983051 | 111 | 0.733731 |
from collections import OrderedDict
from sklearn.linear_model import LogisticRegression
from ..Algorithm import Algorithm
const_param_logistic_regression = {
'verbose': 0,
'dual': False,
'class_weight': 'balanced',
'penalty': 'l1'
}
dicrete_hyper_parameter_list_of_solvers = ["liblinear", "newton... | true | true |
1c3be05818eb09a29d2c3fb648e19af0b8059c8d | 10,447 | py | Python | pip/resolve.py | lyw07/kolibripip | e7039eca92b61827faa754311f1489e89a11519d | [
"MIT"
] | null | null | null | pip/resolve.py | lyw07/kolibripip | e7039eca92b61827faa754311f1489e89a11519d | [
"MIT"
] | null | null | null | pip/resolve.py | lyw07/kolibripip | e7039eca92b61827faa754311f1489e89a11519d | [
"MIT"
] | null | null | null | """Dependency Resolution
The dependency resolution in pip is performed as follows:
for top-level requirements:
a. only one spec allowed per project, regardless of conflicts or not.
otherwise a "double requirement" exception is raised
b. they override sub-dependency requirements.
for sub-dependencies
... | 39.722433 | 79 | 0.615679 |
import logging
from itertools import chain
from pip.exceptions import (
BestVersionAlreadyInstalled,
DistributionNotFound, HashError, HashErrors, UnsupportedPythonVersion
)
from pip.req.req_install import InstallRequirement
from pip.utils import dist_in_usersite, ensure_dir
from pip.utils.logging import inden... | true | true |
1c3be1d05a6dd4619a12e37be7a86cf50a72ae07 | 2,307 | py | Python | backend/content_faith_recor_33375/urls.py | crowdbotics-apps/content-faith-recor-33375 | 3f6ff2b7833f282d1136d477c6a533591dd5fb63 | [
"FTL",
"AML",
"RSA-MD"
] | 1 | 2022-02-05T03:02:39.000Z | 2022-02-05T03:02:39.000Z | backend/content_faith_recor_33375/urls.py | crowdbotics-apps/content-faith-recor-33375 | 3f6ff2b7833f282d1136d477c6a533591dd5fb63 | [
"FTL",
"AML",
"RSA-MD"
] | null | null | null | backend/content_faith_recor_33375/urls.py | crowdbotics-apps/content-faith-recor-33375 | 3f6ff2b7833f282d1136d477c6a533591dd5fb63 | [
"FTL",
"AML",
"RSA-MD"
] | null | null | null | """content_faith_recor_33375 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='... | 36.619048 | 87 | 0.717815 |
from django.contrib import admin
from django.urls import path, include, re_path
from django.views.generic.base import TemplateView
from allauth.account.views import confirm_email
from rest_framework import permissions
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
urlpatterns = [
path("",... | true | true |
1c3be326bf00b9905fe2485f4e6ee3a8b341b075 | 5,403 | py | Python | xray/backends/common.py | eriknw/xray | 19df8d202b1d8054019e7e42365c67cdde6ff448 | [
"Apache-2.0"
] | null | null | null | xray/backends/common.py | eriknw/xray | 19df8d202b1d8054019e7e42365c67cdde6ff448 | [
"Apache-2.0"
] | null | null | null | xray/backends/common.py | eriknw/xray | 19df8d202b1d8054019e7e42365c67cdde6ff448 | [
"Apache-2.0"
] | 1 | 2020-02-05T00:19:02.000Z | 2020-02-05T00:19:02.000Z | import numpy as np
import itertools
from collections import Mapping
from ..core.utils import FrozenOrderedDict
from ..core.pycompat import iteritems
from ..core.variable import Coordinate
NONE_VAR_NAME = '__values__'
def _encode_variable_name(name):
if name is None:
name = NONE_VAR_NAME
return nam... | 31.051724 | 82 | 0.635388 | import numpy as np
import itertools
from collections import Mapping
from ..core.utils import FrozenOrderedDict
from ..core.pycompat import iteritems
from ..core.variable import Coordinate
NONE_VAR_NAME = '__values__'
def _encode_variable_name(name):
if name is None:
name = NONE_VAR_NAME
return nam... | true | true |
1c3be36c98aa6bb261b2a02b8e62a5a9a521c7b8 | 9,295 | py | Python | main.py | nsobczak/tic-tac-toe | 6b44ed29bdba4d9ddaa680591c8cc6aa9e06f22e | [
"MIT"
] | null | null | null | main.py | nsobczak/tic-tac-toe | 6b44ed29bdba4d9ddaa680591c8cc6aa9e06f22e | [
"MIT"
] | null | null | null | main.py | nsobczak/tic-tac-toe | 6b44ed29bdba4d9ddaa680591c8cc6aa9e06f22e | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
###############
# tic-tac-toe #
###############
Created on Tue Apr 14 17:08:22 2015
@author: Nicolas Sobczak
"""
# %%____________________________________________________________________________________________________
# Config
# Import
import random as rdm
import numpy as ... | 25.053908 | 105 | 0.471544 |
import random as rdm
import numpy as np
from copy import deepcopy
grilleVide = np.array([[0, 0, 0],
[0, 0, 0],
[0, 0, 0]])
dico = {}
dico['L1'] = ([1, 1], [1, 2], [1, 3])
dico['L2'] = ([2, 1], [2, 2], [2, 3])
dico['L3'] = ([3, 1], [3, 2], [3, 3])
dico['C1'... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.