hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 958k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f74dac69f5537f2ec412c155c1e1864b599b088d | 66,791 | py | Python | cinder/tests/unit/test_netapp_nfs.py | overcastcloud/cinder | ad977d456c5d50e992eee95ea40f4e3dd21981dc | [
"Apache-2.0"
] | null | null | null | cinder/tests/unit/test_netapp_nfs.py | overcastcloud/cinder | ad977d456c5d50e992eee95ea40f4e3dd21981dc | [
"Apache-2.0"
] | null | null | null | cinder/tests/unit/test_netapp_nfs.py | overcastcloud/cinder | ad977d456c5d50e992eee95ea40f4e3dd21981dc | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2012 NetApp, 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... | 42.406984 | 79 | 0.636478 |
import itertools
import os
import shutil
import unittest
from lxml import etree
import mock
from mox3 import mox as mox_lib
from oslo_log import log as logging
import six
from cinder import exception
from cinder.i18n import _LW
from cinder.image import image_utils
from cinder import test
from cinder import utils as ... | true | true |
f74dac726ade849bc8e291db31f2161f9fb881ae | 13,185 | py | Python | opts.py | sidsachan/PDVC | c7a1dae011a915b84ec634ce204b6464ec5d7176 | [
"MIT"
] | null | null | null | opts.py | sidsachan/PDVC | c7a1dae011a915b84ec634ce204b6464ec5d7176 | [
"MIT"
] | null | null | null | opts.py | sidsachan/PDVC | c7a1dae011a915b84ec634ce204b6464ec5d7176 | [
"MIT"
] | null | null | null | import argparse
import time
import yaml
import os
import numpy as np
def parse_opts():
parser = argparse.ArgumentParser()
# configure of this run
parser.add_argument('--cfg_path', type=str, required=True, help='config file')
parser.add_argument('--id', type=str, default='', help='id of this run. Resul... | 58.861607 | 202 | 0.654835 | import argparse
import time
import yaml
import os
import numpy as np
def parse_opts():
parser = argparse.ArgumentParser()
parser.add_argument('--cfg_path', type=str, required=True, help='config file')
parser.add_argument('--id', type=str, default='', help='id of this run. Results and logs will saved i... | true | true |
f74dad4f7209e1695d047761d0ee365e6f130992 | 1,053 | py | Python | learning_python/lesson2/exercise4.py | fallenfuzz/pynet | 9624d83cca160fd325a34e838e4474c9b80fe2ab | [
"Apache-2.0"
] | 528 | 2015-01-07T15:28:51.000Z | 2022-03-27T09:45:37.000Z | learning_python/lesson2/exercise4.py | fallenfuzz/pynet | 9624d83cca160fd325a34e838e4474c9b80fe2ab | [
"Apache-2.0"
] | 19 | 2015-07-01T23:52:27.000Z | 2021-09-22T04:30:34.000Z | learning_python/lesson2/exercise4.py | fallenfuzz/pynet | 9624d83cca160fd325a34e838e4474c9b80fe2ab | [
"Apache-2.0"
] | 555 | 2015-01-18T07:21:43.000Z | 2022-03-20T21:25:22.000Z | #!/usr/bin/env python
"""Read in the "show_ip_int_brief.txt" file into your program using the
.readlines() method.
Obtain the list entry associated with the FastEthernet4 interface. You can
just hard-code the index at this point since we haven't covered for-loops
or regular expressions:
Use the string .split() method... | 30.085714 | 79 | 0.773029 | from __future__ import print_function, unicode_literals
with open("show_ip_int_brief.txt") as f:
show_ip_int_brief = f.readlines()
fa4_ip = show_ip_int_brief[5].strip()
fields = fa4_ip.split()
intf = fields[0]
ip_address = fields[1]
my_results = (intf, ip_address)
print(my_results)
| true | true |
f74dad801f9b275a6164dd1a488efbaf9f19d59c | 68 | py | Python | src/lib/lib2to3/pgen2/__init__.py | timmartin/skulpt | 2e3a3fbbaccc12baa29094a717ceec491a8a6750 | [
"MIT"
] | 10 | 2015-11-13T17:02:40.000Z | 2021-02-09T23:21:05.000Z | src/lib/lib2to3/pgen2/__init__.py | timmartin/skulpt | 2e3a3fbbaccc12baa29094a717ceec491a8a6750 | [
"MIT"
] | 43 | 2015-06-03T17:59:23.000Z | 2021-09-17T10:45:21.000Z | src/lib/lib2to3/pgen2/__init__.py | timmartin/skulpt | 2e3a3fbbaccc12baa29094a717ceec491a8a6750 | [
"MIT"
] | 13 | 2017-07-02T03:16:46.000Z | 2021-07-05T14:53:56.000Z | raise NotImplementedError("pgen2 is not yet implemented in Skulpt")
| 34 | 67 | 0.823529 | raise NotImplementedError("pgen2 is not yet implemented in Skulpt")
| true | true |
f74daee8002f6239f1bbdedb0e4a71faa668b036 | 4,455 | py | Python | koodikoulu/settings.py | codeschule/koodikoulu-site | dde9932564f36dce6f4dbfd31e7923f1bae83293 | [
"MIT"
] | 5 | 2015-09-16T10:50:53.000Z | 2016-01-16T09:10:37.000Z | koodikoulu/settings.py | codeschule/koodikoulu-site | dde9932564f36dce6f4dbfd31e7923f1bae83293 | [
"MIT"
] | 10 | 2015-09-07T05:58:03.000Z | 2019-02-15T10:36:48.000Z | koodikoulu/settings.py | codeschule/koodikoulu-site | dde9932564f36dce6f4dbfd31e7923f1bae83293 | [
"MIT"
] | 6 | 2015-09-06T19:42:46.000Z | 2019-12-29T21:31:07.000Z | """
Django settings for koodikoulu project.
Generated by 'django-admin startproject' using Django 1.8.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build p... | 25.751445 | 90 | 0.654994 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = os.getenv('SECRET_KEY', '!5qr)bf6lc&-6-zh-@baepxqyy9qohph%as#ea&5o11!l4skwx')
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'dj... | true | true |
f74db12354e7f30a7726a87b90f35c052b0866ec | 3,042 | py | Python | scripts/geodata/addresses/po_boxes.py | Fillr/libpostal | bce153188aff9fbe65aef12c3c639d8069e707fc | [
"MIT"
] | 3,489 | 2015-03-03T00:21:38.000Z | 2022-03-29T09:03:05.000Z | scripts/geodata/addresses/po_boxes.py | StephenHildebrand/libpostal | d8c9847c5686a1b66056e65128e1774f060ff36f | [
"MIT"
] | 488 | 2015-05-29T23:04:28.000Z | 2022-03-29T11:20:24.000Z | scripts/geodata/addresses/po_boxes.py | StephenHildebrand/libpostal | d8c9847c5686a1b66056e65128e1774f060ff36f | [
"MIT"
] | 419 | 2015-11-24T16:53:07.000Z | 2022-03-27T06:51:28.000Z | import random
import six
from geodata.addresses.config import address_config
from geodata.addresses.numbering import NumberedComponent, Digits, sample_alphabet, latin_alphabet
from geodata.encoding import safe_decode
from geodata.math.sampling import cdf, weighted_choice
class POBox(NumberedComponent):
@classmet... | 39.506494 | 132 | 0.649244 | import random
import six
from geodata.addresses.config import address_config
from geodata.addresses.numbering import NumberedComponent, Digits, sample_alphabet, latin_alphabet
from geodata.encoding import safe_decode
from geodata.math.sampling import cdf, weighted_choice
class POBox(NumberedComponent):
@classmet... | true | true |
f74db304101d652c64a47651c51ea89f1ee0d820 | 1,027 | py | Python | mylittlefacewhen/scripts/old/reprocess.py | luckydonald/memes.pony.style | 993b007c05e02d5ba8638180936f7c833707694a | [
"0BSD"
] | 3 | 2020-04-20T16:38:28.000Z | 2021-06-24T11:40:53.000Z | mylittlefacewhen/scripts/old/reprocess.py | luckydonald/memes.pony.style | 993b007c05e02d5ba8638180936f7c833707694a | [
"0BSD"
] | 13 | 2020-02-12T00:55:59.000Z | 2022-03-11T23:52:34.000Z | mylittlefacewhen/scripts/old/reprocess.py | luckydonald/memes.pony.style | 993b007c05e02d5ba8638180936f7c833707694a | [
"0BSD"
] | null | null | null | from viewer.models import Face
import os
import shutil
SIZES = (120, 160, 320, 640, 1000)
SIZENAMES = ("thumb", "small", "medium", "large", "huge")
for face in Face.objects.filter(id__gte=1536):
# if not face.image.name.startswith("f/img/mlfw"):
print(str(face.id) + ": " + face.image.name)
#namepart = fac... | 27.756757 | 58 | 0.5852 | from viewer.models import Face
import os
import shutil
SIZES = (120, 160, 320, 640, 1000)
SIZENAMES = ("thumb", "small", "medium", "large", "huge")
for face in Face.objects.filter(id__gte=1536):
print(str(face.id) + ": " + face.image.name)
if face.tags.filter(name="trans... | true | true |
f74db3554a1ac88fe5c76ddc875c2aaba45e53a9 | 2,615 | py | Python | mitm.py | jaybosamiya/DiffieHellman-ManInTheMiddle | 1103bd843bb6d61be6aa1520c5e32857dde53870 | [
"Unlicense",
"MIT"
] | 9 | 2015-11-11T18:28:00.000Z | 2020-06-03T08:31:41.000Z | mitm.py | jaybosamiya/DiffieHellman-ManInTheMiddle | 1103bd843bb6d61be6aa1520c5e32857dde53870 | [
"Unlicense",
"MIT"
] | null | null | null | mitm.py | jaybosamiya/DiffieHellman-ManInTheMiddle | 1103bd843bb6d61be6aa1520c5e32857dde53870 | [
"Unlicense",
"MIT"
] | 4 | 2016-11-22T03:59:34.000Z | 2021-06-02T21:33:38.000Z | #! /usr/bin/env python
# TODO: Convert key exchange protocol part into function to reduce
# repetition of code.
import threading
import time
import sys
import network
from diffie_hellman import DiffieHellman
from crypto_protocol import CryptoProtocol
def usage():
print "Usage:"
print " " + sys.argv[0] + ... | 24.669811 | 88 | 0.710899 |
import threading
import time
import sys
import network
from diffie_hellman import DiffieHellman
from crypto_protocol import CryptoProtocol
def usage():
print "Usage:"
print " " + sys.argv[0] + " server_ip server_port client_port"
sys.exit()
if len(sys.argv) != 4:
usage()
def get_line(conn):
... | false | true |
f74db3de9fd6c38cc63b365a59a1903fd78b51c5 | 777 | py | Python | apps/pl_users/filters.py | PremierLangage/platon_assets | 52369067cae9d3969091bb691e0fe7cfb9d10b96 | [
"CECILL-B"
] | null | null | null | apps/pl_users/filters.py | PremierLangage/platon_assets | 52369067cae9d3969091bb691e0fe7cfb9d10b96 | [
"CECILL-B"
] | 10 | 2020-10-07T12:25:03.000Z | 2021-09-13T20:33:36.000Z | apps/pl_users/filters.py | PremierLangage/platon_assets | 52369067cae9d3969091bb691e0fe7cfb9d10b96 | [
"CECILL-B"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# filters.py
#
# Authors:
# - Mamadou CISSE <mciissee.@gmail.com>
#
from django.contrib.auth import get_user_model
from django_filters import rest_framework as filters
from django.db.models import Q
User = get_user_model()
class UserFilter(filters.FilterSet):... | 22.2 | 77 | 0.612613 |
from django.contrib.auth import get_user_model
from django_filters import rest_framework as filters
from django.db.models import Q
User = get_user_model()
class UserFilter(filters.FilterSet):
is_admin = filters.BooleanFilter(label='Admin', method='filter_is_admin')
class Meta:
model = User
... | true | true |
f74db408c2152f536db41b3c8666c2c715960d32 | 4,383 | py | Python | examples/batch_merge_parse_record_prediction_obstacles.py | JohannesLiu/Apollo-Cyber-Parser | ef7e99ea29b2586a72c4cf0b74c18370102be65c | [
"MIT"
] | 2 | 2022-03-11T07:45:59.000Z | 2022-03-31T17:38:04.000Z | examples/batch_merge_parse_record_prediction_obstacles.py | JohannesLiu/Apollo-Cyber-Parser | ef7e99ea29b2586a72c4cf0b74c18370102be65c | [
"MIT"
] | 1 | 2022-03-20T12:22:49.000Z | 2022-03-31T17:47:06.000Z | examples/batch_merge_parse_record_prediction_obstacles.py | JohannesLiu/Apollo-Cyber-Parser | ef7e99ea29b2586a72c4cf0b74c18370102be65c | [
"MIT"
] | null | null | null | # ****************************************************************************
# Copyright 2018 The Apollo 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
#
# ht... | 35.064 | 104 | 0.626283 |
"""Module for example of record trans."""
import sys
import os
sys.path.append("/apollo/cyber")
os.chdir("/apollo/cyber")
from cyber_py import cyber
from cyber_py import record
from modules.prediction.proto import prediction_obstacle_pb2
import pickle
from msgtools import File, Parser
MSG_TYPE = "apollo.prediction.P... | false | true |
f74db4d98995f1b0448f9e76c940cc31031b46ff | 4,926 | py | Python | venv/Lib/site-packages/pymsgbox/_native_win.py | SteevenBrunner/gmail-generator | 0ab6f047faad48c388c6d7d2b887f33b6839b6f9 | [
"MIT"
] | 49 | 2015-05-21T08:32:30.000Z | 2022-02-21T04:56:13.000Z | venv/Lib/site-packages/pymsgbox/_native_win.py | AsterLaoWhy/Navi | 819e4cc9e70721d65da5979e0c7a6fead9eb9d6e | [
"MIT"
] | 9 | 2021-08-14T01:27:36.000Z | 2021-08-24T18:10:18.000Z | venv/Lib/site-packages/pymsgbox/_native_win.py | AsterLaoWhy/Navi | 819e4cc9e70721d65da5979e0c7a6fead9eb9d6e | [
"MIT"
] | 15 | 2015-04-09T19:26:33.000Z | 2022-02-16T19:02:42.000Z | # This module contains all the Windows-specific code to create native
# message boxes using the winapi.
# If you'd like to learn more about calling the winapi functions from
# Python, you can check out my other module "nicewin" to see nicely-documented
# examples. It is at https://github.com/asweigart/nicewin
# The d... | 31.987013 | 161 | 0.670727 |
# Python, you can check out my other module "nicewin" to see nicely-documented
# examples. It is at https://github.com/asweigart/nicewin
# The documentation for the MessageBox winapi is at:
# https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-messagebox
import sys, ctypes
import pymsgbox
MB_OK ... | true | true |
f74db61db061c119102d3c94cf111945daffd07a | 8,467 | py | Python | decisiveml/montecarlo.py | avielfedida/DecisiveML | cf0feceeda0fc4abd4af6cc766c7c14ee655b576 | [
"BSD-3-Clause"
] | 78 | 2020-04-13T13:21:25.000Z | 2022-03-22T12:47:49.000Z | decisiveml/montecarlo.py | avielfedida/DecisiveML | cf0feceeda0fc4abd4af6cc766c7c14ee655b576 | [
"BSD-3-Clause"
] | 2 | 2020-10-30T22:32:09.000Z | 2021-03-13T17:51:12.000Z | decisiveml/montecarlo.py | avielfedida/DecisiveML | cf0feceeda0fc4abd4af6cc766c7c14ee655b576 | [
"BSD-3-Clause"
] | 21 | 2020-04-13T21:19:25.000Z | 2022-01-22T14:48:36.000Z | import pandas as pd
import random
import statistics
import logging
logger = logging.getLogger(__name__)
# MonkeyPatch Python 3.6 choices into random 3.5.5
import bisect as _bisect
import itertools as _itertools
def choices(population, weights=None, cum_weights=None, k=1):
"""Return a k sized list of population ... | 34.559184 | 123 | 0.606827 | import pandas as pd
import random
import statistics
import logging
logger = logging.getLogger(__name__)
import bisect as _bisect
import itertools as _itertools
def choices(population, weights=None, cum_weights=None, k=1):
if cum_weights is None:
if weights is None:
total = len(population)
... | true | true |
f74db77c8b97bf1a0471a13410eadbfd45cebddc | 789 | py | Python | code/misc/shellcode/encoders/insertion/insertion-encoder.py | rbctee/MalwareDevelopment | 115cc5a7f2a0d42a6e7b6ae81b2b07ea514537e2 | [
"BSD-3-Clause"
] | null | null | null | code/misc/shellcode/encoders/insertion/insertion-encoder.py | rbctee/MalwareDevelopment | 115cc5a7f2a0d42a6e7b6ae81b2b07ea514537e2 | [
"BSD-3-Clause"
] | null | null | null | code/misc/shellcode/encoders/insertion/insertion-encoder.py | rbctee/MalwareDevelopment | 115cc5a7f2a0d42a6e7b6ae81b2b07ea514537e2 | [
"BSD-3-Clause"
] | null | null | null | import sys
try:
data = sys.argv[1].replace(r'\x', '')
except:
print(f"[+] Enter you shellcode as the first argument")
print(f"[+] Example:")
print("\t" + r'python3 ./script.py "\xeb\x1a\x31\xc0\x31\xdb\x5e\x88\x46\x07\x89\x46\x08\x89\x46\x0c\x89\xf3\xb0\x0b\x8d..."')
sys.exit(1)
data = bytes.fromh... | 23.205882 | 130 | 0.598226 | import sys
try:
data = sys.argv[1].replace(r'\x', '')
except:
print(f"[+] Enter you shellcode as the first argument")
print(f"[+] Example:")
print("\t" + r'python3 ./script.py "\xeb\x1a\x31\xc0\x31\xdb\x5e\x88\x46\x07\x89\x46\x08\x89\x46\x0c\x89\xf3\xb0\x0b\x8d..."')
sys.exit(1)
data = bytes.fromh... | true | true |
f74db77d4e75ad1dd6391bd7f2216e1c5a91ea0f | 7,604 | py | Python | tools/Slicer.py | rshariffdeen/PatchWeave | e41da9e506be8497da2ec9acacd327b8c942f7c8 | [
"MIT"
] | 5 | 2021-02-23T00:50:21.000Z | 2022-03-22T21:23:39.000Z | tools/Slicer.py | rshariffdeen/PatchWeave | e41da9e506be8497da2ec9acacd327b8c942f7c8 | [
"MIT"
] | null | null | null | tools/Slicer.py | rshariffdeen/PatchWeave | e41da9e506be8497da2ec9acacd327b8c942f7c8 | [
"MIT"
] | 1 | 2019-08-14T08:50:48.000Z | 2019-08-14T08:50:48.000Z | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from common.Utilities import get_code, error_exit
from ast import ASTGenerator
import Extractor
import Oracle
import Logger
import Filter
import Emitter
def slice_code_from_trace(diff_info, trace_list, path_a, path_b):
Logger.trace(__name__ + ":" + sys.... | 44.467836 | 93 | 0.547607 |
import sys
from common.Utilities import get_code, error_exit
from ast import ASTGenerator
import Extractor
import Oracle
import Logger
import Filter
import Emitter
def slice_code_from_trace(diff_info, trace_list, path_a, path_b):
Logger.trace(__name__ + ":" + sys._getframe().f_code.co_name, locals())
fo... | true | true |
f74db77fb5c040bbaf0c2ea054d56ccca4b33ede | 84,510 | py | Python | tests/schema/tests.py | ioinfinity/django | b6a0ab523751c13ae3eaec102de70f58f73a0d94 | [
"PSF-2.0",
"BSD-3-Clause"
] | null | null | null | tests/schema/tests.py | ioinfinity/django | b6a0ab523751c13ae3eaec102de70f58f73a0d94 | [
"PSF-2.0",
"BSD-3-Clause"
] | 1 | 2020-07-02T21:10:44.000Z | 2020-07-02T21:11:21.000Z | tests/schema/tests.py | ioinfinity/django | b6a0ab523751c13ae3eaec102de70f58f73a0d94 | [
"PSF-2.0",
"BSD-3-Clause"
] | 1 | 2020-08-11T18:46:32.000Z | 2020-08-11T18:46:32.000Z | import datetime
import itertools
import unittest
from copy import copy
from django.db import (
DatabaseError, IntegrityError, OperationalError, connection,
)
from django.db.models import Model
from django.db.models.deletion import CASCADE
from django.db.models.fields import (
AutoField, BigIntegerField, Binary... | 43.584322 | 114 | 0.643592 | import datetime
import itertools
import unittest
from copy import copy
from django.db import (
DatabaseError, IntegrityError, OperationalError, connection,
)
from django.db.models import Model
from django.db.models.deletion import CASCADE
from django.db.models.fields import (
AutoField, BigIntegerField, Binary... | true | true |
f74db84803583237b646326868702690d742bdbc | 313 | py | Python | tests/test_utils.py | logicalclocks/keras-autodoc | 0d7d1cde3bb4cd8020afd53385d33b34454bc4e6 | [
"Apache-2.0"
] | 34 | 2019-10-08T02:12:57.000Z | 2022-01-12T16:43:44.000Z | tests/test_utils.py | logicalclocks/keras-autodoc | 0d7d1cde3bb4cd8020afd53385d33b34454bc4e6 | [
"Apache-2.0"
] | 26 | 2019-10-21T19:41:14.000Z | 2021-11-17T17:37:23.000Z | tests/test_utils.py | logicalclocks/keras-autodoc | 0d7d1cde3bb4cd8020afd53385d33b34454bc4e6 | [
"Apache-2.0"
] | 22 | 2019-10-09T14:00:14.000Z | 2021-07-28T15:07:11.000Z | import os
import io
from keras_autodoc import utils
from . import dummy_package
def test_import_object():
assert os.path.join == utils.import_object('os.path.join')
assert io.BytesIO.flush == utils.import_object('io.BytesIO.flush')
assert dummy_package == utils.import_object('tests.dummy_package')
| 28.454545 | 70 | 0.763578 | import os
import io
from keras_autodoc import utils
from . import dummy_package
def test_import_object():
assert os.path.join == utils.import_object('os.path.join')
assert io.BytesIO.flush == utils.import_object('io.BytesIO.flush')
assert dummy_package == utils.import_object('tests.dummy_package')
| true | true |
f74db966a9a070b976ae93a0c881eec7726bdabb | 2,435 | py | Python | python3/koans/about_control_statements.py | myraileen/python_koans | c65f9469ac86873f209ea72c7c9f9163a84b2884 | [
"MIT"
] | null | null | null | python3/koans/about_control_statements.py | myraileen/python_koans | c65f9469ac86873f209ea72c7c9f9163a84b2884 | [
"MIT"
] | null | null | null | python3/koans/about_control_statements.py | myraileen/python_koans | c65f9469ac86873f209ea72c7c9f9163a84b2884 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutControlStatements(Koan):
def test_if_then_else_statements(self):
if True:
result = 'true value'
else:
result = 'false value'
self.assertEqual('true value', result)
def test_if_t... | 30.061728 | 248 | 0.537577 |
from runner.koan import *
class AboutControlStatements(Koan):
def test_if_then_else_statements(self):
if True:
result = 'true value'
else:
result = 'false value'
self.assertEqual('true value', result)
def test_if_then_statements(self):
result = 'defaul... | true | true |
f74dba2019fdd03217369cfb350a527039fbd352 | 257 | py | Python | openmixup/models/semisup/__init__.py | Westlake-AI/openmixup | ea81250819e740dd823e30cb7ce382d14a3c1b91 | [
"Apache-2.0"
] | 10 | 2021-12-30T10:22:27.000Z | 2022-03-30T02:31:38.000Z | openmixup/models/semisup/__init__.py | Westlake-AI/openmixup | ea81250819e740dd823e30cb7ce382d14a3c1b91 | [
"Apache-2.0"
] | 3 | 2022-01-20T21:02:48.000Z | 2022-03-19T13:49:45.000Z | openmixup/models/semisup/__init__.py | Westlake-AI/openmixup | ea81250819e740dd823e30cb7ce382d14a3c1b91 | [
"Apache-2.0"
] | null | null | null | from .dmixmatch import DMixMatch
from .dmix_tuning import DMixTuning
from .fine_tuning import FineTuning
from .fixmatch import FixMatch
from .self_tuning import SelfTuning
__all__ = [
'DMixMatch', 'FixMatch', 'FineTuning', 'DMixTuning', 'SelfTuning'
]
| 25.7 | 69 | 0.782101 | from .dmixmatch import DMixMatch
from .dmix_tuning import DMixTuning
from .fine_tuning import FineTuning
from .fixmatch import FixMatch
from .self_tuning import SelfTuning
__all__ = [
'DMixMatch', 'FixMatch', 'FineTuning', 'DMixTuning', 'SelfTuning'
]
| true | true |
f74dbb92b0bc717c6b46937cc79987deca6bed43 | 9,126 | py | Python | src/App.py | deeplearningunb/NextValue | 50c04ea55fa3141009d1f018197e02344fdda327 | [
"MIT"
] | null | null | null | src/App.py | deeplearningunb/NextValue | 50c04ea55fa3141009d1f018197e02344fdda327 | [
"MIT"
] | 9 | 2021-04-10T22:33:36.000Z | 2021-05-13T01:47:04.000Z | src/App.py | deeplearningunb/NextValue | 50c04ea55fa3141009d1f018197e02344fdda327 | [
"MIT"
] | null | null | null | import tkinter as tk
from os import listdir
from os.path import isfile, join
from pages.StartPage import StartPage
from pages.ConfigurationPage import ConfigurationPage
from pages.TrainingPage import TrainingPage
from pages.ResultPage import ResultPage
from pages.ChooseDatePage import ChooseDatePage
from pages.ChooseIn... | 36.358566 | 143 | 0.635328 | import tkinter as tk
from os import listdir
from os.path import isfile, join
from pages.StartPage import StartPage
from pages.ConfigurationPage import ConfigurationPage
from pages.TrainingPage import TrainingPage
from pages.ResultPage import ResultPage
from pages.ChooseDatePage import ChooseDatePage
from pages.ChooseIn... | true | true |
f74dbc02065307cb05c9e6eae9e13ab4ac6fe3d0 | 12,597 | py | Python | models/networks_graphx_refine_no_img_encoder.py | brian220/Sketch2PointCloud | 65ce7b9921a7bef9f21ca2fc72820ca7f6fd6648 | [
"MIT"
] | 3 | 2022-03-28T02:37:05.000Z | 2022-03-31T05:51:12.000Z | models/networks_graphx_refine_no_img_encoder.py | brian220/sketch_part_rec | 17e8657ffc6605804ab4f1da89f446ea4d37665c | [
"MIT"
] | null | null | null | models/networks_graphx_refine_no_img_encoder.py | brian220/sketch_part_rec | 17e8657ffc6605804ab4f1da89f446ea4d37665c | [
"MIT"
] | 1 | 2022-03-30T04:51:39.000Z | 2022-03-30T04:51:39.000Z | import torch.nn as nn
import torch
import torch.nn.functional as F
import torchvision.models
import os
import utils.network_utils
from utils.pointnet2_utils import PointNetSetAbstraction,PointNetFeaturePropagation
import cuda.emd.emd_module as emd
# Set the path for pretrain weight
os.environ['TORCH_HOME'] = '/media... | 36.941349 | 139 | 0.606891 | import torch.nn as nn
import torch
import torch.nn.functional as F
import torchvision.models
import os
import utils.network_utils
from utils.pointnet2_utils import PointNetSetAbstraction,PointNetFeaturePropagation
import cuda.emd.emd_module as emd
os.environ['TORCH_HOME'] = '/media/caig/FECA2C89CA2C406F/sketch3D/pre... | true | true |
f74dbc0e6c8d8c7b0435332cca337bc6e6c0c52c | 662 | py | Python | examples/ssa_example.py | SMAT-Lab/Scalpel | 1022200043f2d9e8c24256821b863997ab34dd49 | [
"Apache-2.0"
] | 102 | 2021-12-15T09:08:48.000Z | 2022-03-24T15:15:25.000Z | examples/ssa_example.py | StarWatch27/Scalpel | 8853e6e84f318f3cfeda0e03d274748b2fbe30fa | [
"Apache-2.0"
] | 11 | 2021-12-04T11:48:31.000Z | 2022-03-21T09:21:45.000Z | examples/ssa_example.py | StarWatch27/Scalpel | 8853e6e84f318f3cfeda0e03d274748b2fbe30fa | [
"Apache-2.0"
] | 11 | 2021-12-04T11:47:41.000Z | 2022-02-06T09:04:39.000Z | import os
import sys
import ast
import astor
import unittest
from scalpel.core.mnode import MNode
from scalpel.SSA.const import SSA
code_str = """
b = 10
if b>0:
a = a+b
else:
a = 10
print(a)
"""
def main():
mnode = MNode("local")
mnode.source = code_str
mnode.gen_ast()
cfg = mnode.gen_cfg()
... | 19.470588 | 64 | 0.654079 | import os
import sys
import ast
import astor
import unittest
from scalpel.core.mnode import MNode
from scalpel.SSA.const import SSA
code_str = """
b = 10
if b>0:
a = a+b
else:
a = 10
print(a)
"""
def main():
mnode = MNode("local")
mnode.source = code_str
mnode.gen_ast()
cfg = mnode.gen_cfg()
... | true | true |
f74dbc0edbbc975785b88e27d1296ba416992478 | 287 | py | Python | awswrangler/__metadata__.py | Kyruski/aws-data-wrangler | 2c240e398bef06d00a69ac690c23ffb50666df69 | [
"Apache-2.0"
] | null | null | null | awswrangler/__metadata__.py | Kyruski/aws-data-wrangler | 2c240e398bef06d00a69ac690c23ffb50666df69 | [
"Apache-2.0"
] | 56 | 2021-06-04T13:41:52.000Z | 2022-03-28T08:53:21.000Z | awswrangler/__metadata__.py | Kyruski/aws-data-wrangler | 2c240e398bef06d00a69ac690c23ffb50666df69 | [
"Apache-2.0"
] | 1 | 2022-02-06T02:04:32.000Z | 2022-02-06T02:04:32.000Z | """Metadata Module.
Source repository: https://github.com/awslabs/aws-data-wrangler
Documentation: https://aws-data-wrangler.readthedocs.io/
"""
__title__: str = "awswrangler"
__description__: str = "Pandas on AWS."
__version__: str = "2.12.1"
__license__: str = "Apache License 2.0"
| 23.916667 | 63 | 0.735192 |
__title__: str = "awswrangler"
__description__: str = "Pandas on AWS."
__version__: str = "2.12.1"
__license__: str = "Apache License 2.0"
| true | true |
f74dbc1b58777aad5c58bb6eb65101e341616870 | 805 | py | Python | lona/shell/commands/lona_connections.py | korantu/lona | 5039fa59f37cc32b9c789753af2ed8a8670ab611 | [
"MIT"
] | 155 | 2020-09-12T21:54:10.000Z | 2021-08-15T15:12:40.000Z | lona/shell/commands/lona_connections.py | korantu/lona | 5039fa59f37cc32b9c789753af2ed8a8670ab611 | [
"MIT"
] | 9 | 2020-09-30T19:34:07.000Z | 2021-08-15T17:20:14.000Z | lona/shell/commands/lona_connections.py | korantu/lona | 5039fa59f37cc32b9c789753af2ed8a8670ab611 | [
"MIT"
] | 9 | 2020-09-30T19:28:41.000Z | 2021-08-14T15:39:39.000Z | from rlpython.utils.argument_parser import ReplArgumentParser
from rlpython.utils.table import write_table
class LonaConnectionsCommand:
"""
List all current connections to Lona
"""
NAME = 'lona_connections'
def __init__(self, repl):
self.repl = repl
def run(self, argv):
# p... | 24.393939 | 74 | 0.632298 | from rlpython.utils.argument_parser import ReplArgumentParser
from rlpython.utils.table import write_table
class LonaConnectionsCommand:
NAME = 'lona_connections'
def __init__(self, repl):
self.repl = repl
def run(self, argv):
argument_parser = ReplArgumentParser(
re... | true | true |
f74dbc61b0ec900aecf1955c749cfc34b0eb57af | 672 | py | Python | app/logger.py | japinol7/music-lib-explorer | 65323bfe7ce7355222bd35ebad8a9240bdfd8cec | [
"MIT"
] | 1 | 2021-08-03T15:01:49.000Z | 2021-08-03T15:01:49.000Z | app/logger.py | japinol7/music-lib-explorer | 65323bfe7ce7355222bd35ebad8a9240bdfd8cec | [
"MIT"
] | null | null | null | app/logger.py | japinol7/music-lib-explorer | 65323bfe7ce7355222bd35ebad8a9240bdfd8cec | [
"MIT"
] | null | null | null | import os
import sys
import logging
from app.config import config
logging.basicConfig(format=config.LOGGER_FORMAT)
def get_level(level):
return {
'CRITICAL': logging.CRITICAL,
'DEBUG': logging.DEBUG,
'ERROR': logging.ERROR,
'FATAL': logging.FATAL,
'INFO': logging.INFO,
... | 21 | 48 | 0.68006 | import os
import sys
import logging
from app.config import config
logging.basicConfig(format=config.LOGGER_FORMAT)
def get_level(level):
return {
'CRITICAL': logging.CRITICAL,
'DEBUG': logging.DEBUG,
'ERROR': logging.ERROR,
'FATAL': logging.FATAL,
'INFO': logging.INFO,
... | true | true |
f74dbcee306ee920bd26d1653bb95b82f51df0a1 | 1,105 | py | Python | setup.py | jsoa/django-tabbed-admin | 64e4c0694834af85594c6509b100a89a2fce2ad1 | [
"BSD-3-Clause"
] | 1 | 2020-05-19T07:48:08.000Z | 2020-05-19T07:48:08.000Z | setup.py | jsoa/django-tabbed-admin | 64e4c0694834af85594c6509b100a89a2fce2ad1 | [
"BSD-3-Clause"
] | null | null | null | setup.py | jsoa/django-tabbed-admin | 64e4c0694834af85594c6509b100a89a2fce2ad1 | [
"BSD-3-Clause"
] | 5 | 2017-03-30T20:29:19.000Z | 2020-03-26T21:14:32.000Z | #! /usr/bin/env python
from distutils.core import setup
from setuptools import find_packages
import sys
# python2 and python3 support
try:
reload
except NameError:
# py3k has unicode by default
pass
else:
reload(sys).setdefaultencoding('utf-8')
setup(
name='django-tabbed-admin',
version='1.0.... | 27.625 | 57 | 0.651584 | from distutils.core import setup
from setuptools import find_packages
import sys
try:
reload
except NameError:
pass
else:
reload(sys).setdefaultencoding('utf-8')
setup(
name='django-tabbed-admin',
version='1.0.1',
author='Guillaume Pousseo',
author_email='guillaumepousseo@revsquare.co... | true | true |
f74dbcfc5d08a83441eb27b2b95e8a7c6c96d589 | 8,396 | py | Python | tests/command_line/test_merge.py | graeme-winter/dials | 78a696a6591e224e73204846f39771ebac0c2668 | [
"BSD-3-Clause"
] | null | null | null | tests/command_line/test_merge.py | graeme-winter/dials | 78a696a6591e224e73204846f39771ebac0c2668 | [
"BSD-3-Clause"
] | null | null | null | tests/command_line/test_merge.py | graeme-winter/dials | 78a696a6591e224e73204846f39771ebac0c2668 | [
"BSD-3-Clause"
] | null | null | null | """Tests for dials.merge command line program."""
import procrunner
import pytest
from cctbx import uctbx
from dxtbx.model.experiment_list import ExperimentListFactory
from iotbx import mtz
from dials.array_family import flex
def validate_mtz(mtz_file, expected_labels, unexpected_labels=None):
assert mtz_file... | 33.31746 | 84 | 0.665317 |
import procrunner
import pytest
from cctbx import uctbx
from dxtbx.model.experiment_list import ExperimentListFactory
from iotbx import mtz
from dials.array_family import flex
def validate_mtz(mtz_file, expected_labels, unexpected_labels=None):
assert mtz_file.check()
m = mtz.object(mtz_file.strpath)
... | true | true |
f74dbd875164eed8065447bd131b31d823e95d53 | 329 | py | Python | Arays/AlgoExpert/easy/1_validate_subsequence.py | sounak95/100_days_of_code | 50fbf088ce6ab2137aa216a30e3b3f828b278a22 | [
"Apache-2.0"
] | null | null | null | Arays/AlgoExpert/easy/1_validate_subsequence.py | sounak95/100_days_of_code | 50fbf088ce6ab2137aa216a30e3b3f828b278a22 | [
"Apache-2.0"
] | null | null | null | Arays/AlgoExpert/easy/1_validate_subsequence.py | sounak95/100_days_of_code | 50fbf088ce6ab2137aa216a30e3b3f828b278a22 | [
"Apache-2.0"
] | null | null | null |
def validate_subseuence(arr, seq):
arr_idx=0
seq_idx=0
while(arr_idx<len(arr) and seq_idx<len(seq)):
if arr[arr_idx]== seq[seq_idx]:
seq_idx+=1
arr_idx+=1
return seq_idx==len(seq)
print(validate_subseuence([1,2,3,4,5,6], [2,4,6]))
print(validate_subseuence([1,2,3,4,5,6], [... | 23.5 | 50 | 0.610942 |
def validate_subseuence(arr, seq):
arr_idx=0
seq_idx=0
while(arr_idx<len(arr) and seq_idx<len(seq)):
if arr[arr_idx]== seq[seq_idx]:
seq_idx+=1
arr_idx+=1
return seq_idx==len(seq)
print(validate_subseuence([1,2,3,4,5,6], [2,4,6]))
print(validate_subseuence([1,2,3,4,5,6], [... | true | true |
f74dbf3bfd075d0354c04bc14ad9c22ffe030746 | 839 | py | Python | policy.py | escribano89/cartpole-REINFORCE | e2d79ce721a50feea783c368a66c6f80631cdf26 | [
"CC0-1.0"
] | null | null | null | policy.py | escribano89/cartpole-REINFORCE | e2d79ce721a50feea783c368a66c6f80631cdf26 | [
"CC0-1.0"
] | null | null | null | policy.py | escribano89/cartpole-REINFORCE | e2d79ce721a50feea783c368a66c6f80631cdf26 | [
"CC0-1.0"
] | null | null | null | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Categorical
class Policy(nn.Module):
def __init__(self, s_size=4, h_size=8, a_size=2):
super(Policy, self).__init__()
self.fc1 = nn.Linear(s_size, h_size)
self.fc2 = nn.Linear(h_size,... | 33.56 | 71 | 0.595948 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Categorical
class Policy(nn.Module):
def __init__(self, s_size=4, h_size=8, a_size=2):
super(Policy, self).__init__()
self.fc1 = nn.Linear(s_size, h_size)
self.fc2 = nn.Linear(h_size,... | true | true |
f74dbf6594a34f35dbc0137ca84a9b43431b4b50 | 20,495 | py | Python | octavia/tests/unit/amphorae/backends/agent/api_server/test_amphora_info.py | anqili426/LBEvents | 58a4490bbf44df30bcf1c38adfedf1923fdbaeeb | [
"Apache-2.0"
] | null | null | null | octavia/tests/unit/amphorae/backends/agent/api_server/test_amphora_info.py | anqili426/LBEvents | 58a4490bbf44df30bcf1c38adfedf1923fdbaeeb | [
"Apache-2.0"
] | null | null | null | octavia/tests/unit/amphorae/backends/agent/api_server/test_amphora_info.py | anqili426/LBEvents | 58a4490bbf44df30bcf1c38adfedf1923fdbaeeb | [
"Apache-2.0"
] | null | null | null | # Copyright 2017 Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 49.86618 | 79 | 0.525055 |
import random
import mock
from oslo_utils import uuidutils
from octavia.amphorae.backends.agent import api_server
from octavia.amphorae.backends.agent.api_server import amphora_info
from octavia.tests.common import utils as test_utils
import octavia.tests.unit.base as base
class TestAmphoraInfo(base.TestCase):
... | true | true |
f74dbf76f7d7bc9080059d3ab1350725c1f3f0cd | 1,700 | py | Python | sri/maxpathsum_in_binary_tree.py | ravichalla/wallbreaker | 0d587f12c60df5e4bca47f9183484a69d284d1f5 | [
"MIT"
] | null | null | null | sri/maxpathsum_in_binary_tree.py | ravichalla/wallbreaker | 0d587f12c60df5e4bca47f9183484a69d284d1f5 | [
"MIT"
] | null | null | null | sri/maxpathsum_in_binary_tree.py | ravichalla/wallbreaker | 0d587f12c60df5e4bca47f9183484a69d284d1f5 | [
"MIT"
] | null | null | null | class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
# O(n) time | O(Log(n)) space
def maxPathSum(tree):
_, maxSum =findMaxSum(tree)
return maxSum
def findMaxSum(tree):
if tree is None:
return (0, 0)
leftMaxSumAsBranch, leftMax... | 28.333333 | 76 | 0.621765 | class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def maxPathSum(tree):
_, maxSum =findMaxSum(tree)
return maxSum
def findMaxSum(tree):
if tree is None:
return (0, 0)
leftMaxSumAsBranch, leftMaxPathSum = findMaxSum(tree.left... | true | true |
f74dc0583b765ed097d12b201fadc0abfbf3a6a4 | 649 | py | Python | server/manage.py | dmt0768/Synthesizer_upd | 66ee7830bb14f097fe9013d69a2f89cd893f18f0 | [
"MIT"
] | null | null | null | server/manage.py | dmt0768/Synthesizer_upd | 66ee7830bb14f097fe9013d69a2f89cd893f18f0 | [
"MIT"
] | null | null | null | server/manage.py | dmt0768/Synthesizer_upd | 66ee7830bb14f097fe9013d69a2f89cd893f18f0 | [
"MIT"
] | null | null | null | #!/home/debian/server_synth/venv/bin/python3
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc... | 29.5 | 73 | 0.690293 | import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
... | true | true |
f74dc0bf0c01c4ace46b3d74caf0620cd43d9476 | 15,667 | py | Python | utils/reprocessing.py | dpton/tensorflow-attention-rnn | a1b8884640ca49d6fdebc7df2167e4353364a243 | [
"Apache-2.0"
] | 2 | 2017-11-20T14:02:07.000Z | 2018-11-16T08:32:48.000Z | utils/reprocessing.py | dpton/tensorflow-attention-rnn | a1b8884640ca49d6fdebc7df2167e4353364a243 | [
"Apache-2.0"
] | null | null | null | utils/reprocessing.py | dpton/tensorflow-attention-rnn | a1b8884640ca49d6fdebc7df2167e4353364a243 | [
"Apache-2.0"
] | 1 | 2018-10-16T03:10:39.000Z | 2018-10-16T03:10:39.000Z | # _*_ coding:utf-8 _*_
# !/usr/bin/env python
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
import logging
import nltk
from nltk.corpus import stopwords
from gensim.models.wrappers import FastText
from gensim.models import Word2Vec
import random
import threading
i... | 38.305623 | 148 | 0.631136 | from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
import logging
import nltk
from nltk.corpus import stopwords
from gensim.models.wrappers import FastText
from gensim.models import Word2Vec
import random
import threading
import tensorflow as tf
import re
import uni... | true | true |
f74dc1489938cb9c9910f2d25543a58672b8e7cb | 17,716 | py | Python | Lib/test/test_posixpath.py | rbuzatu90/hyperv-python | 82bf5a72b4d956ea05affe1644b47e378dec0f4e | [
"bzip2-1.0.6"
] | 2,151 | 2020-04-18T07:31:17.000Z | 2022-03-31T08:39:18.000Z | Lib/test/test_posixpath.py | odsod/cpython-internals-course | 55fffca28e83ac0f30029c60113a3110451dfa08 | [
"PSF-2.0"
] | 395 | 2020-04-18T08:22:18.000Z | 2021-12-08T13:04:49.000Z | Lib/test/test_posixpath.py | odsod/cpython-internals-course | 55fffca28e83ac0f30029c60113a3110451dfa08 | [
"PSF-2.0"
] | 338 | 2020-04-18T08:03:10.000Z | 2022-03-29T12:33:22.000Z | import unittest
from test import test_support, test_genericpath
import posixpath, os
from posixpath import realpath, abspath, dirname, basename
# An absolute path to a temporary filename for testing. We can't rely on TESTFN
# being an absolute path, so we need this.
ABSTFN = abspath(test_support.TESTFN)
def skip_if... | 41.783019 | 97 | 0.518853 | import unittest
from test import test_support, test_genericpath
import posixpath, os
from posixpath import realpath, abspath, dirname, basename
# being an absolute path, so we need this.
ABSTFN = abspath(test_support.TESTFN)
def skip_if_ABSTFN_contains_backslash(test):
found_backslash = '\\' in ABSTFN
msg =... | true | true |
f74dc20833b654bf80c427a1d599653403c8f428 | 9,599 | py | Python | plugins/keepkey/clientbase.py | futuro-coin/electrum-futuro | 04910904a6d4d330f202daf0c1975b8296ad8e5d | [
"MIT"
] | 4 | 2019-01-16T14:30:39.000Z | 2021-10-21T04:21:45.000Z | plugins/keepkey/clientbase.py | futuro-coin/electrum-futuro | 04910904a6d4d330f202daf0c1975b8296ad8e5d | [
"MIT"
] | 1 | 2021-11-15T17:47:31.000Z | 2021-11-15T17:47:31.000Z | plugins/keepkey/clientbase.py | futuro-coin/electrum-futuro | 04910904a6d4d330f202daf0c1975b8296ad8e5d | [
"MIT"
] | 2 | 2018-12-18T17:32:46.000Z | 2019-01-16T14:30:42.000Z | import time
from struct import pack
from electrum.i18n import _
from electrum.util import PrintError, UserCancelled
from electrum.keystore import bip39_normalize_passphrase
from electrum.bitcoin import serialize_xpub
class GuiMixin(object):
# Requires: self.proto, self.device
messages = {
3: _("Conf... | 38.243028 | 136 | 0.612043 | import time
from struct import pack
from electrum.i18n import _
from electrum.util import PrintError, UserCancelled
from electrum.keystore import bip39_normalize_passphrase
from electrum.bitcoin import serialize_xpub
class GuiMixin(object):
messages = {
3: _("Confirm the transaction output on your {... | true | true |
f74dc38c10e2c7c599684c61ab8cc06a08570ff9 | 9,246 | py | Python | kedro/extras/datasets/pickle/pickle_dataset.py | csaranbalaji/kedro | 8968f95bf22322c19f8ddc8838589a2d1384b01c | [
"Apache-2.0"
] | 1 | 2020-09-07T17:12:22.000Z | 2020-09-07T17:12:22.000Z | kedro/extras/datasets/pickle/pickle_dataset.py | csaranbalaji/kedro | 8968f95bf22322c19f8ddc8838589a2d1384b01c | [
"Apache-2.0"
] | null | null | null | kedro/extras/datasets/pickle/pickle_dataset.py | csaranbalaji/kedro | 8968f95bf22322c19f8ddc8838589a2d1384b01c | [
"Apache-2.0"
] | null | null | null | # Copyright 2020 QuantumBlack Visual Analytics Limited
#
# 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
#
# THE SOFTWARE IS PROVIDED "AS IS",... | 41.461883 | 109 | 0.63833 |
import pickle
from copy import deepcopy
from pathlib import PurePosixPath
from typing import Any, Dict
import fsspec
from kedro.io.core import (
AbstractVersionedDataSet,
DataSetError,
Version,
get_filepath_str,
get_protocol_and_path,
)
try:
import joblib
except ImportError: joblib = No... | true | true |
f74dc4ce5d93b4b2744c184f87e8d95ffff94fae | 4,556 | py | Python | hpccm/templates/git.py | brisbane/hpc-container-maker | 29c675d62651c6dde566b699ad85f794114a94c4 | [
"Apache-2.0"
] | null | null | null | hpccm/templates/git.py | brisbane/hpc-container-maker | 29c675d62651c6dde566b699ad85f794114a94c4 | [
"Apache-2.0"
] | null | null | null | hpccm/templates/git.py | brisbane/hpc-container-maker | 29c675d62651c6dde566b699ad85f794114a94c4 | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 34.778626 | 92 | 0.588455 |
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function
import logging import os
import posixpath
import re
import subprocess
import hpccm.base_object
class git(hpccm.base_object):
def __init__(self, **kwargs):
super(git, self).__init__(**... | true | true |
f74dc688b3d7be87c7f3eb7142ffd8da0721b455 | 24,346 | py | Python | venv/lib/python3.8/site-packages/django/contrib/gis/gdal/geometries.py | Joshua-Barawa/My-Photos | adcaea48149c6b31e9559b045709d538d0b749bc | [
"PostgreSQL",
"Unlicense"
] | 16 | 2019-08-10T12:24:06.000Z | 2020-05-21T09:11:14.000Z | venv/lib/python3.8/site-packages/django/contrib/gis/gdal/geometries.py | Joshua-Barawa/My-Photos | adcaea48149c6b31e9559b045709d538d0b749bc | [
"PostgreSQL",
"Unlicense"
] | 12 | 2019-08-10T11:55:29.000Z | 2020-05-21T04:46:30.000Z | venv/lib/python3.8/site-packages/django/contrib/gis/gdal/geometries.py | Joshua-Barawa/My-Photos | adcaea48149c6b31e9559b045709d538d0b749bc | [
"PostgreSQL",
"Unlicense"
] | 4 | 2022-03-12T10:17:00.000Z | 2022-03-26T08:40:43.000Z | """
The OGRGeometry is a wrapper for using the OGR Geometry class
(see https://gdal.org/api/ogrgeometry_cpp.html#_CPPv411OGRGeometry).
OGRGeometry may be instantiated when reading geometries from OGR Data Sources
(e.g. SHP files), or when given OGC WKT (a string).
While the 'full' API is not present yet, the API ... | 32.723118 | 88 | 0.622648 | import sys
from binascii import b2a_hex
from ctypes import byref, c_char_p, c_double, c_ubyte, c_void_p, string_at
from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.envelope import Envelope, OGREnvelope
from django.contrib.gis.gdal.error import GDALException, SRSException
from django.contr... | true | true |
f74dc7690ca163b0c3ffed75e506208a222f0701 | 4,284 | py | Python | homeassistant/components/fail2ban/sensor.py | MrDelik/core | 93a66cc357b226389967668441000498a10453bb | [
"Apache-2.0"
] | 30,023 | 2016-04-13T10:17:53.000Z | 2020-03-02T12:56:31.000Z | homeassistant/components/fail2ban/sensor.py | MrDelik/core | 93a66cc357b226389967668441000498a10453bb | [
"Apache-2.0"
] | 24,710 | 2016-04-13T08:27:26.000Z | 2020-03-02T12:59:13.000Z | homeassistant/components/fail2ban/sensor.py | MrDelik/core | 93a66cc357b226389967668441000498a10453bb | [
"Apache-2.0"
] | 11,956 | 2016-04-13T18:42:31.000Z | 2020-03-02T09:32:12.000Z | """Support for displaying IPs banned by fail2ban."""
from __future__ import annotations
from datetime import timedelta
import logging
import os
import re
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import CONF_FILE_PATH, CONF_NAME
from h... | 32.210526 | 85 | 0.645658 | from __future__ import annotations
from datetime import timedelta
import logging
import os
import re
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import CONF_FILE_PATH, CONF_NAME
from homeassistant.core import HomeAssistant
import homeass... | true | true |
f74dc94409af598c9ae22618267d5c054f1dfda3 | 30,000 | py | Python | efficientdet/inference.py | zzm422/automl | 38d6623e0983d6ee1d16bb5b1db5c6b2ccbb3ecf | [
"Apache-2.0"
] | null | null | null | efficientdet/inference.py | zzm422/automl | 38d6623e0983d6ee1d16bb5b1db5c6b2ccbb3ecf | [
"Apache-2.0"
] | null | null | null | efficientdet/inference.py | zzm422/automl | 38d6623e0983d6ee1d16bb5b1db5c6b2ccbb3ecf | [
"Apache-2.0"
] | 1 | 2020-08-30T13:52:35.000Z | 2020-08-30T13:52:35.000Z | # Copyright 2020 Google Research. 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... | 37.174721 | 119 | 0.662367 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
import functools
import os
import time
from absl import logging
import numpy as np
from PIL import Image
import tensorflow.compat.v1 as tf
from typing import Text, Dict, Any, List, Tuple, Union
im... | true | true |
f74dc9c1edd0105eb5f0634515271a31a8a028da | 6,089 | py | Python | basicsr/ops/upfirdn2d/upfirdn2d.py | marcelodiaz558/BasicSR | 1d5138ed567e966965fd1540838d27e6f5082b70 | [
"Apache-2.0",
"MIT"
] | 1 | 2021-12-14T10:06:12.000Z | 2021-12-14T10:06:12.000Z | basicsr/ops/upfirdn2d/upfirdn2d.py | marcelodiaz558/BasicSR | 1d5138ed567e966965fd1540838d27e6f5082b70 | [
"Apache-2.0",
"MIT"
] | null | null | null | basicsr/ops/upfirdn2d/upfirdn2d.py | marcelodiaz558/BasicSR | 1d5138ed567e966965fd1540838d27e6f5082b70 | [
"Apache-2.0",
"MIT"
] | null | null | null | # modify from https://github.com/rosinality/stylegan2-pytorch/blob/master/op/upfirdn2d.py # noqa:E501
import os
import torch
from torch.autograd import Function
from torch.nn import functional as F
BASICSR_JIT = os.getenv('BASICSR_JIT')
if BASICSR_JIT == 'True':
from torch.utils.cpp_extension import load
mod... | 31.549223 | 117 | 0.572344 |
import os
import torch
from torch.autograd import Function
from torch.nn import functional as F
BASICSR_JIT = os.getenv('BASICSR_JIT')
if BASICSR_JIT == 'True':
from torch.utils.cpp_extension import load
module_path = os.path.dirname(__file__)
upfirdn2d_ext = load(
'upfirdn2d',
sources=[
... | true | true |
f74dc9ecb093044dac44b4cd0ccae489bc5f31b1 | 573 | py | Python | monkeygod/forms.py | Nonse/monkeys | 93681edf18126cc49858992f80df25a7cff931e8 | [
"MIT"
] | null | null | null | monkeygod/forms.py | Nonse/monkeys | 93681edf18126cc49858992f80df25a7cff931e8 | [
"MIT"
] | null | null | null | monkeygod/forms.py | Nonse/monkeys | 93681edf18126cc49858992f80df25a7cff931e8 | [
"MIT"
] | null | null | null | from flask_wtf import Form
from wtforms import StringField, IntegerField
from wtforms.fields.html5 import EmailField
from wtforms.validators import *
class CreateMonkeyForm(Form):
name = StringField('name', validators=[DataRequired()])
age = IntegerField('age', validators=[DataRequired()])
email = EmailFi... | 33.705882 | 61 | 0.73822 | from flask_wtf import Form
from wtforms import StringField, IntegerField
from wtforms.fields.html5 import EmailField
from wtforms.validators import *
class CreateMonkeyForm(Form):
name = StringField('name', validators=[DataRequired()])
age = IntegerField('age', validators=[DataRequired()])
email = EmailFi... | true | true |
f74dcaab5a3652889a05f85b43b185e95c4a9aae | 770 | py | Python | software/GTac_Hand/draw_bubbles_py_finger.py | roobooot/GTac_ | 94dc67668f87cfd17575033fc880ea7e4327e6ef | [
"MIT"
] | null | null | null | software/GTac_Hand/draw_bubbles_py_finger.py | roobooot/GTac_ | 94dc67668f87cfd17575033fc880ea7e4327e6ef | [
"MIT"
] | null | null | null | software/GTac_Hand/draw_bubbles_py_finger.py | roobooot/GTac_ | 94dc67668f87cfd17575033fc880ea7e4327e6ef | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 9 09:50:42 2021
@author: Zeyu
"""
import serial
import time
from data_gen import data_checkout,raw_data_checkout
if __name__ == '__main__':
try:
ser = serial.Serial('COM12', 115200)
except:
print('Serial Connection Failed, Will Try Again in 3 SE... | 25.666667 | 70 | 0.548052 |
import serial
import time
from data_gen import data_checkout,raw_data_checkout
if __name__ == '__main__':
try:
ser = serial.Serial('COM12', 115200)
except:
print('Serial Connection Failed, Will Try Again in 3 SECONDS')
time.sleep(3)
else:
if ser.is_open:
print('... | true | true |
f74dcbce2752edbbb1db23c98280a95f8f8c497b | 839 | py | Python | api/schemas/airplane.py | ascii-dev/flight-booking | 3a64951f91d0254402bc5c14e5ef6d1bd2cf372e | [
"MIT"
] | null | null | null | api/schemas/airplane.py | ascii-dev/flight-booking | 3a64951f91d0254402bc5c14e5ef6d1bd2cf372e | [
"MIT"
] | 30 | 2019-05-26T09:39:12.000Z | 2021-06-02T00:16:58.000Z | api/schemas/airplane.py | ascii-dev/flight-booking | 3a64951f91d0254402bc5c14e5ef6d1bd2cf372e | [
"MIT"
] | null | null | null | """Module for airplane schema"""
from marshmallow import fields
from .base.base_schema import BaseSchema
from ..utilities.helpers.common_schema_args import common_schema_args
from ..utilities.validators.string_length_validator import \
string_length_validator, empty_string_validator
from ..utilities.validators.n... | 31.074074 | 69 | 0.713945 | from marshmallow import fields
from .base.base_schema import BaseSchema
from ..utilities.helpers.common_schema_args import common_schema_args
from ..utilities.validators.string_length_validator import \
string_length_validator, empty_string_validator
from ..utilities.validators.name_validator import name_validat... | true | true |
f74dcc7b527e602a89975763744611a138460b1d | 7,403 | py | Python | unittests/properties_test.py | engeg/recipes-py | 9dac536b55887262b4ce846f3db7a7f596542e5e | [
"Apache-2.0"
] | 23 | 2016-01-20T00:45:26.000Z | 2022-02-26T04:25:30.000Z | unittests/properties_test.py | engeg/recipes-py | 9dac536b55887262b4ce846f3db7a7f596542e5e | [
"Apache-2.0"
] | 8 | 2016-01-15T19:00:38.000Z | 2018-03-06T00:15:24.000Z | unittests/properties_test.py | engeg/recipes-py | 9dac536b55887262b4ce846f3db7a7f596542e5e | [
"Apache-2.0"
] | 13 | 2015-09-05T05:52:43.000Z | 2019-07-08T17:34:27.000Z | #!/usr/bin/env vpython
# Copyright 2015 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
import test_env
from recipe_engine import recipe_api, config
RECIPE_PROPERTY = recipe_api.BoundProperty.RECIPE_PROPERTY
... | 34.755869 | 88 | 0.639606 |
import test_env
from recipe_engine import recipe_api, config
RECIPE_PROPERTY = recipe_api.BoundProperty.RECIPE_PROPERTY
MODULE_PROPERTY = recipe_api.BoundProperty.MODULE_PROPERTY
def make_prop(**kwargs):
name = kwargs.pop('name', 'dumb_name')
return recipe_api.Property(**kwargs).bind(
name, RECIPE_PROPERT... | true | true |
f74dccdec58cd4914c6a800b558f844912c359ce | 1,458 | py | Python | utils/ucf10/video_jpg_ucf101_hmdb51.py | sakshikakde/interpretability_of_lstm | 241166b91a5f4be733807c38d905946136a066fd | [
"MIT"
] | 2 | 2022-01-13T16:49:24.000Z | 2022-01-24T00:59:54.000Z | utils/ucf10/video_jpg_ucf101_hmdb51.py | sakshikakde/interpretability_of_lstm | 241166b91a5f4be733807c38d905946136a066fd | [
"MIT"
] | null | null | null | utils/ucf10/video_jpg_ucf101_hmdb51.py | sakshikakde/interpretability_of_lstm | 241166b91a5f4be733807c38d905946136a066fd | [
"MIT"
] | null | null | null | from __future__ import print_function, division
import os
import sys
import subprocess
def class_process(dir_path, dst_dir_path, class_name):
class_path = os.path.join(dir_path, class_name)
if not os.path.isdir(class_path):
return
dst_class_path = os.path.join(dst_dir_path, class_name)
if not os.path.exis... | 31.021277 | 111 | 0.689986 | from __future__ import print_function, division
import os
import sys
import subprocess
def class_process(dir_path, dst_dir_path, class_name):
class_path = os.path.join(dir_path, class_name)
if not os.path.isdir(class_path):
return
dst_class_path = os.path.join(dst_dir_path, class_name)
if not os.path.exis... | true | true |
f74dcd7dd1b925a0a8000af109ee319c3b0e23c1 | 270 | py | Python | stratascratch/Pandas-Solution/Ranking Most Active Guests.py | CAG9/SQL-Interview-Questions | 79d0855a7cab28abd8b6462273aacaf38b5d8448 | [
"MIT"
] | null | null | null | stratascratch/Pandas-Solution/Ranking Most Active Guests.py | CAG9/SQL-Interview-Questions | 79d0855a7cab28abd8b6462273aacaf38b5d8448 | [
"MIT"
] | null | null | null | stratascratch/Pandas-Solution/Ranking Most Active Guests.py | CAG9/SQL-Interview-Questions | 79d0855a7cab28abd8b6462273aacaf38b5d8448 | [
"MIT"
] | null | null | null | # Import your libraries
import pandas as pd
# Start writing code
Grouped = airbnb_contacts.groupby('id_guest').sum().reset_index().sort_values(by=['n_messages'], ascending =False)
Grouped['ranking'] = Grouped['n_messages'].rank(method='dense',ascending =False)
Grouped
| 33.75 | 114 | 0.762963 | import pandas as pd
Grouped = airbnb_contacts.groupby('id_guest').sum().reset_index().sort_values(by=['n_messages'], ascending =False)
Grouped['ranking'] = Grouped['n_messages'].rank(method='dense',ascending =False)
Grouped
| true | true |
f74dceee6280c78b32b80421136a825d72ab3640 | 2,716 | py | Python | package/crud/abc/watcher.py | derekmerck/pycrud | 065edd4f3ec1fda906772de7a20e8df16e31bfb2 | [
"MIT"
] | 15 | 2019-02-12T23:26:09.000Z | 2021-12-21T08:53:58.000Z | package/crud/abc/watcher.py | derekmerck/pycrud | 065edd4f3ec1fda906772de7a20e8df16e31bfb2 | [
"MIT"
] | 2 | 2019-01-23T21:13:12.000Z | 2019-06-28T15:45:51.000Z | package/crud/abc/watcher.py | derekmerck/pycrud | 065edd4f3ec1fda906772de7a20e8df16e31bfb2 | [
"MIT"
] | 6 | 2019-01-23T20:22:50.000Z | 2022-02-03T03:27:04.000Z | import logging, time
from abc import ABC
from itertools import count
from enum import Enum
from datetime import datetime, timedelta
from typing import Callable
import attr
from .observable import ObservableMixin, Event
@attr.s
class Trigger(object):
n_items = count(0)
tgid = attr.ib(init=False, factory=n_item... | 30.516854 | 89 | 0.571429 | import logging, time
from abc import ABC
from itertools import count
from enum import Enum
from datetime import datetime, timedelta
from typing import Callable
import attr
from .observable import ObservableMixin, Event
@attr.s
class Trigger(object):
n_items = count(0)
tgid = attr.ib(init=False, factory=n_item... | true | true |
f74dd1703d6c0295f1226dcc794b02eaa666430e | 2,472 | py | Python | tensorforce/core/policies/policy.py | JNC96/tensorforce | f691d1b5cc4a328f18712a14105fd90335bd3d3c | [
"Apache-2.0"
] | 1 | 2019-09-23T18:39:57.000Z | 2019-09-23T18:39:57.000Z | tensorforce/core/policies/policy.py | VonRosenchild/tensorforce | 92c987424c89e96238a3689aa4018df0d9d40504 | [
"Apache-2.0"
] | null | null | null | tensorforce/core/policies/policy.py | VonRosenchild/tensorforce | 92c987424c89e96238a3689aa4018df0d9d40504 | [
"Apache-2.0"
] | 1 | 2019-09-23T18:40:00.000Z | 2019-09-23T18:40:00.000Z | # Copyright 2018 Tensorforce Team. 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... | 38.030769 | 96 | 0.658576 |
import tensorflow as tf
from tensorforce import util
from tensorforce.core import Module
class Policy(Module):
def __init__(
self, name, states_spec, actions_spec, device=None, summary_labels=None,
l2_regularization=None
):
super().__init__(
name=name, device=device, sum... | true | true |
f74dd1802d94ba5408a59c8d7fdea98540079241 | 11,754 | py | Python | testing/distributions/gp/cond_gp_test.py | tdiethe/MXFusion | fbdba79ca85cb5a9760722ffd932b9ec4c401745 | [
"Apache-2.0"
] | null | null | null | testing/distributions/gp/cond_gp_test.py | tdiethe/MXFusion | fbdba79ca85cb5a9760722ffd932b9ec4c401745 | [
"Apache-2.0"
] | null | null | null | testing/distributions/gp/cond_gp_test.py | tdiethe/MXFusion | fbdba79ca85cb5a9760722ffd932b9ec4c401745 | [
"Apache-2.0"
] | null | null | null | import pytest
import mxnet as mx
import numpy as np
from mxfusion.models import Model
from mxfusion.components.variables.runtime_variable import is_sampled_array, get_num_samples
from mxfusion.components.distributions import ConditionalGaussianProcess
from mxfusion.components.distributions.gp.kernels import RBF
from mx... | 62.521277 | 220 | 0.68181 | import pytest
import mxnet as mx
import numpy as np
from mxfusion.models import Model
from mxfusion.components.variables.runtime_variable import is_sampled_array, get_num_samples
from mxfusion.components.distributions import ConditionalGaussianProcess
from mxfusion.components.distributions.gp.kernels import RBF
from mx... | true | true |
f74dd24d0cd28a51b15ef9abaaca70baaa282110 | 1,617 | py | Python | src/python/test/pn2json_test.py | orbea/procyon | 469d94427d3b6e7cc2ab93606bdf968717a49150 | [
"Apache-2.0"
] | null | null | null | src/python/test/pn2json_test.py | orbea/procyon | 469d94427d3b6e7cc2ab93606bdf968717a49150 | [
"Apache-2.0"
] | null | null | null | src/python/test/pn2json_test.py | orbea/procyon | 469d94427d3b6e7cc2ab93606bdf968717a49150 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2017 The Procyon 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
#
# Un... | 26.95 | 82 | 0.727273 |
from __future__ import absolute_import, division, print_function, unicode_literals
import io
import json
import math
import os
import procyon
import procyon.lex
import procyon.pn2json
import re
import subprocess
import sys
from .context import procyon, pntest
def jsonify(source):
try:
return procyon.pn2... | true | true |
f74dd27cc7ff6b0d432d4a5efea90bf6babe4f79 | 1,613 | py | Python | calc/managers.py | BAcode-X/webCalc | c673855bfd56dd1a07687c9bcb5048b7389ddf57 | [
"MIT"
] | 1 | 2022-02-06T13:26:30.000Z | 2022-02-06T13:26:30.000Z | calc/managers.py | BAcode-X/webCalc | c673855bfd56dd1a07687c9bcb5048b7389ddf57 | [
"MIT"
] | 2 | 2021-08-23T14:38:41.000Z | 2021-08-23T19:38:18.000Z | calc/managers.py | BAcode-X/webCalc | c673855bfd56dd1a07687c9bcb5048b7389ddf57 | [
"MIT"
] | null | null | null | from django.contrib.auth.base_user import BaseUserManager
from django.utils.translation import ugettext_lazy as _
class CustomUserManager(BaseUserManager):
def create_user(self, nick, email, password, first_name, last_name, **extra_fields):
"""
Create and save a User with the given nickname, email... | 39.341463 | 109 | 0.66026 | from django.contrib.auth.base_user import BaseUserManager
from django.utils.translation import ugettext_lazy as _
class CustomUserManager(BaseUserManager):
def create_user(self, nick, email, password, first_name, last_name, **extra_fields):
if not nick:
raise ValueError(_('The Nickname must be... | true | true |
f74dd2e51283db2e9edf4a0c6df8da5e7dee6f8d | 10,493 | py | Python | neo4j/conf.py | neo4j/neo4j-python-driver | 1c009476710ab451e55e75d28d372664253fda4e | [
"Apache-2.0"
] | 739 | 2015-05-29T21:53:27.000Z | 2022-03-24T00:13:53.000Z | DoctorAI_Lambda_Main/neo4j/conf.py | dgg32/doctorai_walkthrough | f05ba98ee4d16c6bdf826ae209c84a69c76a8654 | [
"MIT"
] | 264 | 2015-08-26T13:45:33.000Z | 2022-03-17T17:26:50.000Z | neo4j/conf.py | neo4j/neo4j-python-driver | 1c009476710ab451e55e75d28d372664253fda4e | [
"Apache-2.0"
] | 178 | 2015-05-21T08:10:54.000Z | 2022-03-31T11:49:08.000Z | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright (c) "Neo4j"
# Neo4j Sweden AB [http://neo4j.com]
#
# This file is part of Neo4j.
#
# 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
#... | 31.605422 | 123 | 0.645287 |
from abc import ABCMeta
from collections.abc import Mapping
from warnings import warn
from neo4j.meta import get_user_agent
from neo4j.api import (
TRUST_SYSTEM_CA_SIGNED_CERTIFICATES,
TRUST_ALL_CERTIFICATES,
WRITE_ACCESS,
DEFAULT_DATABASE,
)
from neo4j.exceptions import (
ConfigurationError,
)... | true | true |
f74dd367954ac59f8d6c1b21eb961277cfb231f1 | 6,310 | py | Python | tests/unit/test_models_wheel.py | Cactusmachete/pip | e9f461241032dbd540fb6271f1dbbb29a6a0db82 | [
"MIT"
] | null | null | null | tests/unit/test_models_wheel.py | Cactusmachete/pip | e9f461241032dbd540fb6271f1dbbb29a6a0db82 | [
"MIT"
] | null | null | null | tests/unit/test_models_wheel.py | Cactusmachete/pip | e9f461241032dbd540fb6271f1dbbb29a6a0db82 | [
"MIT"
] | null | null | null | import pytest
from pip._vendor.packaging.tags import Tag
from pip._internal import pep425tags
from pip._internal.exceptions import InvalidWheelFilename
from pip._internal.models.wheel import Wheel
class TestWheelFile(object):
def test_std_wheel_pattern(self):
w = Wheel('simple-1.1.1-py2-none-any.whl')
... | 34.861878 | 78 | 0.59683 | import pytest
from pip._vendor.packaging.tags import Tag
from pip._internal import pep425tags
from pip._internal.exceptions import InvalidWheelFilename
from pip._internal.models.wheel import Wheel
class TestWheelFile(object):
def test_std_wheel_pattern(self):
w = Wheel('simple-1.1.1-py2-none-any.whl')
... | true | true |
f74dd36a3236777e8c1ee85e0e89d8234ed93481 | 2,610 | py | Python | modules/pytket-aqt/tests/convert_test.py | irfankhan10/pytket-extensions | 8ab33c1dcff91dfc50d471fbc160277e82d2492b | [
"Apache-2.0"
] | 22 | 2021-03-02T15:17:22.000Z | 2022-03-20T21:17:10.000Z | modules/pytket-aqt/tests/convert_test.py | irfankhan10/pytket-extensions | 8ab33c1dcff91dfc50d471fbc160277e82d2492b | [
"Apache-2.0"
] | 132 | 2021-03-03T08:30:05.000Z | 2022-03-31T21:11:58.000Z | modules/pytket-aqt/tests/convert_test.py | irfankhan10/pytket-extensions | 8ab33c1dcff91dfc50d471fbc160277e82d2492b | [
"Apache-2.0"
] | 13 | 2021-03-05T17:01:19.000Z | 2022-03-17T15:38:02.000Z | # Copyright 2020-2021 Cambridge Quantum Computing
#
# 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... | 28.064516 | 87 | 0.678927 |
from typing import Tuple, List
import json
import os
import numpy as np
import pytest
from pytket.circuit import Circuit, OpType from pytket.extensions.aqt.backends.aqt import _translate_aqt, AQTBackend, _aqt_rebase
skip_remote_tests: bool = os.getenv("PYTKET_RUN_REMOTE_TESTS") is None
REASON = "PYTKET_RUN_REMOTE_TE... | true | true |
f74dd3faeba7ace6e5b971cc6d1e32bf5ffbf597 | 2,161 | py | Python | q44.py | kylepw/ctci | 7e2fcc6775db3789d0e425f4fb969acf6c44aad5 | [
"MIT"
] | null | null | null | q44.py | kylepw/ctci | 7e2fcc6775db3789d0e425f4fb969acf6c44aad5 | [
"MIT"
] | null | null | null | q44.py | kylepw/ctci | 7e2fcc6775db3789d0e425f4fb969acf6c44aad5 | [
"MIT"
] | null | null | null | """
q44.py
~~~~~~
Check Balanced: Implement a function to check if a binary tree is balanced. For
the purposes of this question, a balanced tree is defined to be a tree such that
the heights of the two subtrees of any node never differ by more than one.
Hints: #21, #33, #49, #105, #124
"""
impo... | 30.013889 | 234 | 0.601111 | import unittest
class Node:
def __init__(self, value):
self.left = None
self.right = None
self.value = value
def __repr__(self):
return f'Node ({self.value})'
def array_to_binary(array, start=None, end=None):
start = 0 if start is None else start
end = len(array) - 1... | true | true |
f74dd43f7f25aee6abb1ef96f5623bb0c8999057 | 2,908 | py | Python | influxdb_client/domain/flux_response.py | kelseiv/influxdb-client-python | 9a0d2d659157cca96f6a04818fdeb215d699bdd7 | [
"MIT"
] | 1 | 2021-06-06T10:39:47.000Z | 2021-06-06T10:39:47.000Z | influxdb_client/domain/flux_response.py | kelseiv/influxdb-client-python | 9a0d2d659157cca96f6a04818fdeb215d699bdd7 | [
"MIT"
] | null | null | null | influxdb_client/domain/flux_response.py | kelseiv/influxdb-client-python | 9a0d2d659157cca96f6a04818fdeb215d699bdd7 | [
"MIT"
] | null | null | null | # coding: utf-8
"""
Influx API Service
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: 0.1.0
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
class Flux... | 25.734513 | 124 | 0.547455 |
import pprint
import re
import six
class FluxResponse(object):
openapi_types = {
'flux': 'str'
}
attribute_map = {
'flux': 'flux'
}
def __init__(self, flux=None):
self._flux = None
self.discriminator = None
if flux is not None:
self.fl... | true | true |
f74dd447a00d1b13ea654c3f4582371ce253c0ab | 43,676 | py | Python | pyvcloud/vcd/utils.py | lrivallain/pyvcloud | 0ae305c7d83c7c4e370428ab4ee1070edfb3fe1e | [
"Apache-2.0"
] | 168 | 2015-01-01T07:15:03.000Z | 2022-01-27T00:27:49.000Z | pyvcloud/vcd/utils.py | lrivallain/pyvcloud | 0ae305c7d83c7c4e370428ab4ee1070edfb3fe1e | [
"Apache-2.0"
] | 392 | 2015-01-08T10:03:01.000Z | 2022-03-28T02:12:02.000Z | pyvcloud/vcd/utils.py | lrivallain/pyvcloud | 0ae305c7d83c7c4e370428ab4ee1070edfb3fe1e | [
"Apache-2.0"
] | 246 | 2015-01-13T01:52:58.000Z | 2022-03-28T09:34:47.000Z | # VMware vCloud Python SDK
# Copyright (c) 2014-2018 VMware, 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
#
# U... | 39.206463 | 121 | 0.6284 |
from ipaddress import IPv4Network
from os.path import abspath
from os.path import dirname
from os.path import join as joinpath
from os.path import realpath
import humanfriendly
from lxml import etree
from lxml.objectify import NoneElement
from pygments import formatters
from pygments import highlight
from pygments im... | true | true |
f74dd45fbaf427f6dd3db15a5c5ffa191f9757f1 | 947 | py | Python | posts/management/commands/cleanup_post_views.py | NakolenkeDevelopment/rustockholm.club | 1b347180d58e63a11c9d3c05fea9f10d753b7732 | [
"MIT"
] | 496 | 2020-04-24T04:20:32.000Z | 2022-03-31T21:55:57.000Z | posts/management/commands/cleanup_post_views.py | NakolenkeDevelopment/rustockholm.club | 1b347180d58e63a11c9d3c05fea9f10d753b7732 | [
"MIT"
] | 642 | 2020-04-24T11:54:13.000Z | 2022-03-26T15:41:06.000Z | posts/management/commands/cleanup_post_views.py | NakolenkeDevelopment/rustockholm.club | 1b347180d58e63a11c9d3c05fea9f10d753b7732 | [
"MIT"
] | 243 | 2020-04-24T11:49:11.000Z | 2022-03-24T18:38:48.000Z | import logging
from django.core.management import BaseCommand
from django.db import connection
log = logging.getLogger(__name__)
class Command(BaseCommand):
help = "Cleans up old and useless post views and history to save DB space"
def handle(self, *args, **options):
# cleanup anonymous post_views ... | 32.655172 | 105 | 0.61774 | import logging
from django.core.management import BaseCommand
from django.db import connection
log = logging.getLogger(__name__)
class Command(BaseCommand):
help = "Cleans up old and useless post views and history to save DB space"
def handle(self, *args, **options):
with connection.cursor(... | true | true |
f74dd498dec3eef1d0924469950e6fd9c7859abb | 2,076 | py | Python | app/extension/logging/customizeLogger.py | Alex4386/XenXenXenSe | c60e50f26a7c3b306ee3cbb140b3ad7f39c21d93 | [
"MIT"
] | 1 | 2021-04-23T08:56:05.000Z | 2021-04-23T08:56:05.000Z | app/extension/logging/customizeLogger.py | Alex4386/XenXenXenSe | c60e50f26a7c3b306ee3cbb140b3ad7f39c21d93 | [
"MIT"
] | null | null | null | app/extension/logging/customizeLogger.py | Alex4386/XenXenXenSe | c60e50f26a7c3b306ee3cbb140b3ad7f39c21d93 | [
"MIT"
] | null | null | null | import logging
import sys
from pathlib import Path
import ujson
from loguru import logger
from app.extension.logging.interceptHandler import InterceptHandler
class CustomizeLogger:
@classmethod
def make_logger(cls):
config_path = "logging_config.json"
config = cls.load_logging_config(config_... | 27.315789 | 75 | 0.586224 | import logging
import sys
from pathlib import Path
import ujson
from loguru import logger
from app.extension.logging.interceptHandler import InterceptHandler
class CustomizeLogger:
@classmethod
def make_logger(cls):
config_path = "logging_config.json"
config = cls.load_logging_config(config_... | true | true |
f74dd49a021129437f6b37eb43a0a853ac7298d6 | 1,274 | py | Python | az_ykan_v1.0.1/Arduino-master/tests/device/test_WiFiServer/test_WiFiServer.py | angelbarusta/ind-matageyco | 08be088f2178312e9bac94b9604bacd5223f4b53 | [
"Apache-2.0"
] | null | null | null | az_ykan_v1.0.1/Arduino-master/tests/device/test_WiFiServer/test_WiFiServer.py | angelbarusta/ind-matageyco | 08be088f2178312e9bac94b9604bacd5223f4b53 | [
"Apache-2.0"
] | null | null | null | az_ykan_v1.0.1/Arduino-master/tests/device/test_WiFiServer/test_WiFiServer.py | angelbarusta/ind-matageyco | 08be088f2178312e9bac94b9604bacd5223f4b53 | [
"Apache-2.0"
] | 1 | 2018-03-29T14:05:48.000Z | 2018-03-29T14:05:48.000Z | from mock_decorators import setup, teardown
from threading import Thread
import socket
import time
stop_client_thread = False
client_thread = None
@setup('Simple echo server')
def setup_echo_server(e):
global stop_client_thread
global client_thread
def echo_client_thread():
server_address = socket... | 29.627907 | 71 | 0.621664 | from mock_decorators import setup, teardown
from threading import Thread
import socket
import time
stop_client_thread = False
client_thread = None
@setup('Simple echo server')
def setup_echo_server(e):
global stop_client_thread
global client_thread
def echo_client_thread():
server_address = socket... | true | true |
f74dd56ec850661152c4c4f5933bf785cbe641e3 | 1,118 | py | Python | tests/project/test_brownie_mix.py | palkeo/brownie | 25fb857b40ef69e30665640873d72be2ec3ab483 | [
"MIT"
] | 1 | 2021-07-07T12:27:19.000Z | 2021-07-07T12:27:19.000Z | tests/project/test_brownie_mix.py | dmuhs/brownie | e245ca1854e32cd8c9678f7ebc7a4ec63dde0074 | [
"MIT"
] | null | null | null | tests/project/test_brownie_mix.py | dmuhs/brownie | e245ca1854e32cd8c9678f7ebc7a4ec63dde0074 | [
"MIT"
] | 1 | 2020-06-28T22:02:33.000Z | 2020-06-28T22:02:33.000Z | #!/usr/bin/python3
import os
from pathlib import Path
import pytest
from brownie.project.scripts import run
# browniemix is parametrized with every mix repo from https://www.github.com/brownie-mix/
def test_mixes(plugintesterbase, project, tmp_path, rpc, browniemix):
path = Path(project.from_brownie_mix(browni... | 29.421053 | 89 | 0.708408 |
import os
from pathlib import Path
import pytest
from brownie.project.scripts import run
def test_mixes(plugintesterbase, project, tmp_path, rpc, browniemix):
path = Path(project.from_brownie_mix(browniemix, tmp_path.joinpath("testmix")))
os.chdir(path)
result = plugintesterbase.runpytest("-C")
... | true | true |
f74dd617c0b11ef46904a3180e30869e7caf06c4 | 2,507 | py | Python | examples/walk_integration.py | Ipuch/Humanoid2D | 3afd3926b9fb2ddc39be9bef99b89f864f41dcb7 | [
"MIT"
] | null | null | null | examples/walk_integration.py | Ipuch/Humanoid2D | 3afd3926b9fb2ddc39be9bef99b89f864f41dcb7 | [
"MIT"
] | null | null | null | examples/walk_integration.py | Ipuch/Humanoid2D | 3afd3926b9fb2ddc39be9bef99b89f864f41dcb7 | [
"MIT"
] | null | null | null | import biorbd
import numpy as np
from bioptim import OdeSolver, CostType, RigidBodyDynamics
from bioptim import Solver, DefectType
from humanoid_2d import Humanoid2D, Integration, add_custom_plots, HumanoidOcp, HumanoidOcpMultiPhase
def torque_driven_dynamics(model: biorbd.Model, states: np.array, controls: np.arra... | 27.25 | 119 | 0.676506 | import biorbd
import numpy as np
from bioptim import OdeSolver, CostType, RigidBodyDynamics
from bioptim import Solver, DefectType
from humanoid_2d import Humanoid2D, Integration, add_custom_plots, HumanoidOcp, HumanoidOcpMultiPhase
def torque_driven_dynamics(model: biorbd.Model, states: np.array, controls: np.arra... | true | true |
f74dd6aaa3cd5c16ef46a5e76f2fb84dbdb9ddf6 | 7,784 | py | Python | components/python/mail_utils.py | SylvanasSun/code-snippets | 8a393c50955a6a1ad0ca9809f3f7501faae52c51 | [
"MIT"
] | 1 | 2018-01-31T03:43:08.000Z | 2018-01-31T03:43:08.000Z | components/python/mail_utils.py | SylvanasSun/code-snippets | 8a393c50955a6a1ad0ca9809f3f7501faae52c51 | [
"MIT"
] | null | null | null | components/python/mail_utils.py | SylvanasSun/code-snippets | 8a393c50955a6a1ad0ca9809f3f7501faae52c51 | [
"MIT"
] | null | null | null | import smtplib
from email import encoders
from email.header import Header
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.utils import parseaddr, formataddr
class SmtpKeys(object):
SMTP_HOST = 'smtp_host'
SMTP_PORT = 'smtp_por... | 38.156863 | 101 | 0.63592 | import smtplib
from email import encoders
from email.header import Header
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.utils import parseaddr, formataddr
class SmtpKeys(object):
SMTP_HOST = 'smtp_host'
SMTP_PORT = 'smtp_por... | true | true |
f74dd71ca127e88b891ed75ab980109e1b1cf85b | 461 | py | Python | tests/test_cli.py | GuerrillaAnalytics/made-cli | ee81e8293d23f50a377fd177efa05dd46d9de751 | [
"MIT"
] | 1 | 2017-09-03T16:30:26.000Z | 2017-09-03T16:30:26.000Z | tests/test_cli.py | GuerrillaAnalytics/made-cli | ee81e8293d23f50a377fd177efa05dd46d9de751 | [
"MIT"
] | null | null | null | tests/test_cli.py | GuerrillaAnalytics/made-cli | ee81e8293d23f50a377fd177efa05dd46d9de751 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""Tests for the Config class."""
from click.testing import CliRunner
from made import cli
import pytest
@pytest.fixture
def runner():
"""TODO."""
return CliRunner()
def test_cli(runner):
"""Tests that the cli can be launched."""
result = runner.invoke(cli.cli)
assert ... | 19.208333 | 53 | 0.657267 |
from click.testing import CliRunner
from made import cli
import pytest
@pytest.fixture
def runner():
return CliRunner()
def test_cli(runner):
result = runner.invoke(cli.cli)
assert result.exit_code == 0
assert not result.exception
print(result.output.strip())
| true | true |
f74dd73fd1a8c40cdfe95ae0bad1597f00cb8bd1 | 30,878 | py | Python | Lib/defcon/objects/info.py | Space0726/defcon | a1b0155d7a1708ea4edce7930572e06896020343 | [
"MIT"
] | 25 | 2015-03-05T13:56:01.000Z | 2019-01-15T08:33:07.000Z | Lib/defcon/objects/info.py | Space0726/defcon | a1b0155d7a1708ea4edce7930572e06896020343 | [
"MIT"
] | 154 | 2015-07-05T15:55:47.000Z | 2018-12-23T22:04:00.000Z | Lib/defcon/objects/info.py | Space0726/defcon | a1b0155d7a1708ea4edce7930572e06896020343 | [
"MIT"
] | 22 | 2015-09-09T01:55:39.000Z | 2018-03-20T20:33:33.000Z | from __future__ import absolute_import
# this file was generated by infoObjectGenerator.py.
# this file should not be edited by hand.
import weakref
from warnings import warn
from fontTools import ufoLib
from defcon.objects.base import BaseObject
from copy import copy
from functools import partial
def _guidelineDepre... | 101.907591 | 474 | 0.726828 | from __future__ import absolute_import
import weakref
from warnings import warn
from fontTools import ufoLib
from defcon.objects.base import BaseObject
from copy import copy
from functools import partial
def _guidelineDeprecation(message=None):
msg = "Font level guidelines are now handled in the Font object."
... | true | true |
f74dd77ccfb26fe1b5a5810a0f7277b1ffb3ddc3 | 549 | py | Python | db/pandas.py | NovaSBE-DSKC/retention-evaluation | 5b68b9282f0b5479a9dc5238faef68067c76b861 | [
"MIT"
] | null | null | null | db/pandas.py | NovaSBE-DSKC/retention-evaluation | 5b68b9282f0b5479a9dc5238faef68067c76b861 | [
"MIT"
] | null | null | null | db/pandas.py | NovaSBE-DSKC/retention-evaluation | 5b68b9282f0b5479a9dc5238faef68067c76b861 | [
"MIT"
] | null | null | null | from . import get_connector, get_engine
import pandas as pd
def get_dataframe(table_name, limit=None):
# limit query
limit_query=""
if limit:
limit_query="limit {}".format(limit)
# create query
query = "SELECT * FROM {} {}".format(table_name, limit_query)
# get dataframe from sql qu... | 21.96 | 65 | 0.632058 | from . import get_connector, get_engine
import pandas as pd
def get_dataframe(table_name, limit=None):
limit_query=""
if limit:
limit_query="limit {}".format(limit)
query = "SELECT * FROM {} {}".format(table_name, limit_query)
df = pd.read_sql(query, con=get_connector())
re... | true | true |
f74dd7d0693f08976d5b18f84361cea11b05afcf | 5,337 | py | Python | UltronRoBo/modules/gtranslator.py | UltronRoBo/UltronRoBoAssistant | 874dcf725d453ffabd85543533d2a07676af4d65 | [
"MIT"
] | null | null | null | UltronRoBo/modules/gtranslator.py | UltronRoBo/UltronRoBoAssistant | 874dcf725d453ffabd85543533d2a07676af4d65 | [
"MIT"
] | null | null | null | UltronRoBo/modules/gtranslator.py | UltronRoBo/UltronRoBoAssistant | 874dcf725d453ffabd85543533d2a07676af4d65 | [
"MIT"
] | null | null | null | """
MIT License
Copyright (c) 2021 UltronRoBo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, di... | 38.673913 | 119 | 0.640809 |
from emoji import UNICODE_EMOJI
from google_trans_new import LANGUAGES, google_translator
from telegram import ParseMode, Update
from telegram.ext import CallbackContext, run_async
from UltronRoBo import dispatcher
from UltronRoBo.modules.disable import DisableAbleCommandHandler
@run_async
def totranslate(update: U... | true | true |
f74dd7e7248eace73f553897f6f43e0564658d63 | 3,192 | py | Python | website/rate/views.py | MattJamesChampion/mince-pie-rate | f2c346e2c312e80f779f48bc7b3ae6348ace2344 | [
"MIT"
] | null | null | null | website/rate/views.py | MattJamesChampion/mince-pie-rate | f2c346e2c312e80f779f48bc7b3ae6348ace2344 | [
"MIT"
] | 9 | 2018-10-02T11:34:36.000Z | 2021-06-10T17:39:31.000Z | website/rate/views.py | MattJamesChampion/mince-pie-rate | f2c346e2c312e80f779f48bc7b3ae6348ace2344 | [
"MIT"
] | null | null | null | from django.http import HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
from django.urls import reverse
from django.core.files.storage import FileSystemStorage
from django.contrib.auth.decorators import login_required
from .models import MincePie, Review
from .forms import MincePieForm, Rev... | 40.405063 | 144 | 0.66886 | from django.http import HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
from django.urls import reverse
from django.core.files.storage import FileSystemStorage
from django.contrib.auth.decorators import login_required
from .models import MincePie, Review
from .forms import MincePieForm, Rev... | true | true |
f74dd89b6848435110a041c4eea4c98b95f4e1a3 | 793 | py | Python | doc/CyberSecurity/Classic_Cryptography/code/LetterFrequency.py | tanducmai/.dotfiles | 13cad9bc7fcecff6108eb5df34635d4748712532 | [
"Unlicense"
] | null | null | null | doc/CyberSecurity/Classic_Cryptography/code/LetterFrequency.py | tanducmai/.dotfiles | 13cad9bc7fcecff6108eb5df34635d4748712532 | [
"Unlicense"
] | null | null | null | doc/CyberSecurity/Classic_Cryptography/code/LetterFrequency.py | tanducmai/.dotfiles | 13cad9bc7fcecff6108eb5df34635d4748712532 | [
"Unlicense"
] | null | null | null | #LetterFrequency.py
#This program will create a CSV file of frequencies based on a text file.
#Use Excel or similar spreadsheet software to visualize the frequencies of the CSV file.
import os
def countLetters(message):
dir_path = os.path.dirname(os.path.realpath(__file__))
os.chdir(dir_path)
alpha = "AB... | 22.657143 | 88 | 0.617907 |
import os
def countLetters(message):
dir_path = os.path.dirname(os.path.realpath(__file__))
os.chdir(dir_path)
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
message = message.upper()
freq = [0] * 26
for letter in message:
spot = alpha.find(letter)
if spot >= 0:
freq[spot]... | true | true |
f74dd89d0a7c7ccd10ba82d3c13b52603f940de8 | 1,316 | py | Python | periodic_table.py | mkirby1995/PyISRU | 46338999e70308604692bbd3c20b4f770c27dc6d | [
"MIT"
] | null | null | null | periodic_table.py | mkirby1995/PyISRU | 46338999e70308604692bbd3c20b4f770c27dc6d | [
"MIT"
] | null | null | null | periodic_table.py | mkirby1995/PyISRU | 46338999e70308604692bbd3c20b4f770c27dc6d | [
"MIT"
] | null | null | null | import pandas as pd
import json
class Element:
def __init__(self, name, abrivation, atomic_number,
atomic_mass, period, group):
self.name = name
self.abrivation = abrivation
self.atomic_number = atomic_number
self.atomic_mass = atomic_mass
self.period = period #row
self.gro... | 26.857143 | 73 | 0.582827 | import pandas as pd
import json
class Element:
def __init__(self, name, abrivation, atomic_number,
atomic_mass, period, group):
self.name = name
self.abrivation = abrivation
self.atomic_number = atomic_number
self.atomic_mass = atomic_mass
self.period = period self.group = ... | true | true |
f74dd987ed2b5939b07943c6fac65134b2236048 | 20,443 | py | Python | wechatpy/events.py | maodei/wechatpy | a53bae5a87d933dd5be248ac97736f172a474f5b | [
"MIT"
] | null | null | null | wechatpy/events.py | maodei/wechatpy | a53bae5a87d933dd5be248ac97736f172a474f5b | [
"MIT"
] | null | null | null | wechatpy/events.py | maodei/wechatpy | a53bae5a87d933dd5be248ac97736f172a474f5b | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
wechatpy.events
~~~~~~~~~~~~~~~~
This module contains all the events WeChat callback uses.
:copyright: (c) 2014 by messense.
:license: MIT, see LICENSE for more details.
"""
from __future__ import absolute_import, unicode_literals
from wechatpy.fields import (
Stri... | 24.51199 | 111 | 0.679255 | from __future__ import absolute_import, unicode_literals
from wechatpy.fields import (
StringField,
FloatField,
IntegerField,
BaseField,
Base64DecodeField,
DateTimeField
)
from wechatpy.messages import BaseMessage
EVENT_TYPES = {}
def register_event(event_type):
def register(cls):
... | true | true |
f74dda8f1b55fdf7ebda449ed4e3c90aa3625184 | 7,335 | py | Python | three_body_2d.py | dan3dewey/Pythonista-bagatelles | 8c2e1d061d76184490605e2a5d52fb236931cba7 | [
"MIT"
] | null | null | null | three_body_2d.py | dan3dewey/Pythonista-bagatelles | 8c2e1d061d76184490605e2a5d52fb236931cba7 | [
"MIT"
] | null | null | null | three_body_2d.py | dan3dewey/Pythonista-bagatelles | 8c2e1d061d76184490605e2a5d52fb236931cba7 | [
"MIT"
] | null | null | null | # coding: utf-8
# three_body_2d.py
""" Use Docstrings like this so that help() can give useful output.
These can be multi-line, that's nice ;-)
Simple 3-body simulation constrained to 2D """
# run it at os command line:
# osprompt> py three_body_2d.py
# v8 - adjusted to run in pythonista
# v7 - put previous ... | 36.133005 | 98 | 0.590184 |
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
tmax = 6.0
dt = 0.001
epsilon = 1.0e-4
grav = 0.8
b1x = 1.0
b1y = 0.0
b1vx = 0.0
b1vy = 0.5
b1m = 3.0
b2x = -0.5
b2y = 0.86
b2vx = 0.5
b2vy = 0.0
b2m = 4.1
b3x = -0.5
b3y = -0.86
b3vx = -0.5
b3vy =... | true | true |
f74ddb93841154bf3d19bc5ec50aaf2d36313ecf | 739 | py | Python | setup.py | amansrivastava17/xlnet | 87904c1b244a7e65b787c9a99a6c1ceca75e3bbd | [
"Apache-2.0"
] | null | null | null | setup.py | amansrivastava17/xlnet | 87904c1b244a7e65b787c9a99a6c1ceca75e3bbd | [
"Apache-2.0"
] | null | null | null | setup.py | amansrivastava17/xlnet | 87904c1b244a7e65b787c9a99a6c1ceca75e3bbd | [
"Apache-2.0"
] | null | null | null | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="xlnet",
version="0.0.1",
author="zihangdai",
author_email="zander.dai@gmail.com",
description="XLNet: Generalized Autoregressive Pretraining for Language Understanding",
long_descripti... | 28.423077 | 91 | 0.671177 | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="xlnet",
version="0.0.1",
author="zihangdai",
author_email="zander.dai@gmail.com",
description="XLNet: Generalized Autoregressive Pretraining for Language Understanding",
long_descripti... | true | true |
f74ddbac02d0faa9b74d747f6bfbe64b67be0174 | 5,884 | py | Python | pywikibot/families/wiktionary_family.py | planetmaker/pywikibot | acfa697250092f69bdd338057eccdc119f7d0fcf | [
"MIT"
] | null | null | null | pywikibot/families/wiktionary_family.py | planetmaker/pywikibot | acfa697250092f69bdd338057eccdc119f7d0fcf | [
"MIT"
] | null | null | null | pywikibot/families/wiktionary_family.py | planetmaker/pywikibot | acfa697250092f69bdd338057eccdc119f7d0fcf | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""Family module for Wiktionary."""
#
# (C) Pywikibot team, 2005-2020
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, division, unicode_literals
from pywikibot import family
from pywikibot.tools import classproperty
# The Wikimedia family that is ... | 43.585185 | 94 | 0.444256 | from __future__ import absolute_import, division, unicode_literals
from pywikibot import family
from pywikibot.tools import classproperty
class Family(family.SubdomainFamily, family.WikimediaFamily):
name = 'wiktionary'
closed_wikis = [
'aa', 'ab', 'ak', 'als', 'as', 'av', 'ba', 'bh', 'bi'... | true | true |
f74ddbd66a67805d2640789041a7577e9645bf73 | 167 | py | Python | lw301_server_app/handler/__init__.py | SergeyZh/lw301_server | 6efd5dc74f1df9ab0d51f5e66b5237ad35f8fda6 | [
"Apache-2.0"
] | 2 | 2018-07-23T20:22:55.000Z | 2019-01-27T21:47:40.000Z | lw301_server_app/handler/__init__.py | SergeyZh/lw301_server | 6efd5dc74f1df9ab0d51f5e66b5237ad35f8fda6 | [
"Apache-2.0"
] | 4 | 2018-07-23T19:20:00.000Z | 2018-11-21T07:45:53.000Z | lw301_server_app/handler/__init__.py | SergeyZh/lw301_server | 6efd5dc74f1df9ab0d51f5e66b5237ad35f8fda6 | [
"Apache-2.0"
] | 2 | 2019-01-28T07:39:06.000Z | 2020-05-15T21:32:58.000Z | # coding: utf-8
from tornado.web import RequestHandler
class Base(RequestHandler):
def initialize(self):
self.log = self.application.settings['logger']
| 18.555556 | 54 | 0.718563 | from tornado.web import RequestHandler
class Base(RequestHandler):
def initialize(self):
self.log = self.application.settings['logger']
| true | true |
f74ddd0e270265ee12475857505232e145f6e150 | 996 | py | Python | azure_monitor/python_logger_opencensus_azure/monitoring/examples/api_2.py | jchomarat/azure-monitor-opencensus-python | ab843291677896026aa60af3368d878ac453b0f3 | [
"MIT"
] | 14 | 2020-05-04T15:11:42.000Z | 2022-03-17T11:04:41.000Z | azure_monitor/python_logger_opencensus_azure/monitoring/examples/api_2.py | jchomarat/azure-monitor-opencensus-python | ab843291677896026aa60af3368d878ac453b0f3 | [
"MIT"
] | 4 | 2020-04-18T22:41:34.000Z | 2021-11-15T14:12:14.000Z | azure_monitor/python_logger_opencensus_azure/monitoring/examples/api_2.py | jchomarat/azure-monitor-opencensus-python | ab843291677896026aa60af3368d878ac453b0f3 | [
"MIT"
] | 14 | 2020-02-21T19:55:51.000Z | 2022-02-10T08:59:52.000Z | """REST API Module using AppLogger"""
import json
import logging
from flask import Flask, jsonify
import sys
import os
sys.path.append(os.path.join(os.getcwd(),'monitoring'))
from src.logger import AppLogger
component_name ="API_2"
app = Flask(component_name)
logging_config_file_path = os.path.join(os.getcwd(),'mon... | 29.294118 | 98 | 0.746988 |
import json
import logging
from flask import Flask, jsonify
import sys
import os
sys.path.append(os.path.join(os.getcwd(),'monitoring'))
from src.logger import AppLogger
component_name ="API_2"
app = Flask(component_name)
logging_config_file_path = os.path.join(os.getcwd(),'monitoring',"examples","logging_config.js... | true | true |
f74dddb623802bfec005ee2278984e1f83501161 | 1,360 | py | Python | problems/exercism/clock/clock.py | JayMonari/py-personal | ef16d030cc7fe2266d661e1378d95f588229b746 | [
"MIT"
] | null | null | null | problems/exercism/clock/clock.py | JayMonari/py-personal | ef16d030cc7fe2266d661e1378d95f588229b746 | [
"MIT"
] | null | null | null | problems/exercism/clock/clock.py | JayMonari/py-personal | ef16d030cc7fe2266d661e1378d95f588229b746 | [
"MIT"
] | null | null | null | from typing import Tuple
class Clock:
MINS_PER_HOUR = 60
HOURS_PER_DAY = 24
def __init__(self, hour: int, minute: int) -> None:
nhours, nmins = self.__normalize(hour, minute, self.MINS_PER_HOUR)
_, nhours = self.__normalize(0, nhours, self.HOURS_PER_DAY)
self.hours = nhours
... | 32.380952 | 75 | 0.575 | from typing import Tuple
class Clock:
MINS_PER_HOUR = 60
HOURS_PER_DAY = 24
def __init__(self, hour: int, minute: int) -> None:
nhours, nmins = self.__normalize(hour, minute, self.MINS_PER_HOUR)
_, nhours = self.__normalize(0, nhours, self.HOURS_PER_DAY)
self.hours = nhours
... | true | true |
f74de0e388005ba39e43708024aba7ca7ac8c7ff | 10,202 | py | Python | lreid/models/LwFnet.py | TPCD/LifelongReID | cb33f9c29fe398e7546db345fab1c338dda8252f | [
"MIT"
] | 63 | 2021-03-20T15:33:11.000Z | 2022-03-30T03:04:14.000Z | lreid/models/LwFnet.py | TPCD/LifelongReID | cb33f9c29fe398e7546db345fab1c338dda8252f | [
"MIT"
] | 5 | 2021-03-23T08:04:21.000Z | 2022-03-10T02:28:43.000Z | lreid/models/LwFnet.py | TPCD/LifelongReID | cb33f9c29fe398e7546db345fab1c338dda8252f | [
"MIT"
] | 10 | 2021-04-30T11:14:10.000Z | 2022-03-18T16:44:55.000Z | import torch.nn as nn
import torchvision
import copy
import torch
import numpy as np
from .bnneck import BNClassifier, Classifier, Classifier_without_bias
from torch.autograd import Variable
def weights_init_kaiming(m):
classname = m.__class__.__name__
if classname.find('Linear') != -1:
nn.init.kaiming... | 39.088123 | 97 | 0.596746 | import torch.nn as nn
import torchvision
import copy
import torch
import numpy as np
from .bnneck import BNClassifier, Classifier, Classifier_without_bias
from torch.autograd import Variable
def weights_init_kaiming(m):
classname = m.__class__.__name__
if classname.find('Linear') != -1:
nn.init.kaiming... | true | true |
f74de10c832f819fc8dddcb21e82e0a0f506e875 | 2,442 | py | Python | setup.py | CNES/Pandora_MCCNN | 54d4423f88d31831065ff28ccb5affb724239988 | [
"Apache-2.0"
] | 3 | 2021-07-20T09:41:56.000Z | 2021-12-13T08:29:43.000Z | setup.py | CNES/Pandora_MCCNN | 54d4423f88d31831065ff28ccb5affb724239988 | [
"Apache-2.0"
] | null | null | null | setup.py | CNES/Pandora_MCCNN | 54d4423f88d31831065ff28ccb5affb724239988 | [
"Apache-2.0"
] | 2 | 2021-07-09T15:08:05.000Z | 2022-01-20T16:27:03.000Z | #!/usr/bin/env python
# coding: utf8
#
# Copyright (c) 2021 Centre National d'Etudes Spatiales (CNES).
#
# This file is part of PANDORA_MCCNN
#
# https://github.com/CNES/Pandora_MCCNN
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licens... | 26.258065 | 95 | 0.674447 | #
# This file is part of PANDORA_MCCNN
#
# https://github.com/CNES/Pandora_MCCNN
#
# 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
#
# Unl... | true | true |
f74de24b0972355a4c9ca92da0c53190ab1f3927 | 5,774 | py | Python | bfxapi/examples/ws/multiple_instances.py | itsdeka/bitfinex-api-py | 53ad572170e5a92679553703e961207930b197f8 | [
"Apache-2.0"
] | null | null | null | bfxapi/examples/ws/multiple_instances.py | itsdeka/bitfinex-api-py | 53ad572170e5a92679553703e961207930b197f8 | [
"Apache-2.0"
] | null | null | null | bfxapi/examples/ws/multiple_instances.py | itsdeka/bitfinex-api-py | 53ad572170e5a92679553703e961207930b197f8 | [
"Apache-2.0"
] | null | null | null | """
This is an example of how it is possible to spawn multiple
bfx ws instances to comply with the open subscriptions number constraint (max. 25)
(https://docs.bitfinex.com/docs/requirements-and-limitations)
"""
import sys
sys.path.append('../../../')
import asyncio
import json
from datetime import datetime
from func... | 31.725275 | 114 | 0.653446 |
import sys
sys.path.append('../../../')
import asyncio
import json
from datetime import datetime
from functools import partial
import websockets as ws
from bfxapi import Client
import math
import random
MAX_CHANNELS = 25
def get_random_list_of_tickers():
tickers = ["FILUST", "FTTUSD", "FTTUST", "FUNUSD", "GNOUS... | true | true |
f74de2a902988fe31f43cffb5647e32d2bdd6a68 | 5,171 | py | Python | edivorce/apps/core/templatetags/format_utils.py | rloisell/eDivorce | c9152bfaebf9b97f90b34c7abf8eacd9227b7c97 | [
"Apache-2.0"
] | null | null | null | edivorce/apps/core/templatetags/format_utils.py | rloisell/eDivorce | c9152bfaebf9b97f90b34c7abf8eacd9227b7c97 | [
"Apache-2.0"
] | null | null | null | edivorce/apps/core/templatetags/format_utils.py | rloisell/eDivorce | c9152bfaebf9b97f90b34c7abf8eacd9227b7c97 | [
"Apache-2.0"
] | null | null | null | # pylint: disable=invalid-name
""" Template formatting helpers """
from datetime import datetime
import locale
import re
from django import template
from django.utils.safestring import mark_safe
from django.utils.timesince import timesince
locale.setlocale(locale.LC_ALL, '')
register = template.Library()
@registe... | 29.718391 | 83 | 0.646297 |
from datetime import datetime
import locale
import re
from django import template
from django.utils.safestring import mark_safe
from django.utils.timesince import timesince
locale.setlocale(locale.LC_ALL, '')
register = template.Library()
@register.filter
def linebreaksli(value):
value = re.sub(r'\r\n|\r|\n',... | true | true |
f74de46fdcd3addf8b58af9739f978e7e2e89f35 | 301 | py | Python | PRIMEIRO MUNDO - FIRST WORLD/Cateto e hipotenusa - 17.py | MatheusKlebson/Python-Course | c1c5404095601733057bd91a96b5b4c45f0b5b9a | [
"MIT"
] | null | null | null | PRIMEIRO MUNDO - FIRST WORLD/Cateto e hipotenusa - 17.py | MatheusKlebson/Python-Course | c1c5404095601733057bd91a96b5b4c45f0b5b9a | [
"MIT"
] | 1 | 2020-11-25T15:47:38.000Z | 2020-11-25T15:47:38.000Z | PRIMEIRO MUNDO - FIRST WORLD/Cateto e hipotenusa - 17.py | MatheusKlebson/Python-Course | c1c5404095601733057bd91a96b5b4c45f0b5b9a | [
"MIT"
] | null | null | null | #Exercício Python 017: Faça um programa que leia o comprimento do cateto oposto e do cateto adjacente de um triângulo retângulo
# Calcule e mostre o comprimento da hipotenusa.
from math import hypot
co = float(input("Cateto oposto:"))
ca = float(input("Cateto adjacente:"))
hi = hypot(co,ca)
print(hi) | 43 | 127 | 0.767442 | from math import hypot
co = float(input("Cateto oposto:"))
ca = float(input("Cateto adjacente:"))
hi = hypot(co,ca)
print(hi) | true | true |
f74de5673b11cd292aa925c41c733d3030b8f0f7 | 3,920 | py | Python | lib/configure_opsman_director_test.py | lclayton1977/aws-pcf-quickstart | 606f3af7045170f1c0aeb42b179b51999f6953ca | [
"Apache-2.0"
] | null | null | null | lib/configure_opsman_director_test.py | lclayton1977/aws-pcf-quickstart | 606f3af7045170f1c0aeb42b179b51999f6953ca | [
"Apache-2.0"
] | null | null | null | lib/configure_opsman_director_test.py | lclayton1977/aws-pcf-quickstart | 606f3af7045170f1c0aeb42b179b51999f6953ca | [
"Apache-2.0"
] | null | null | null | # aws-pcf-quickstart
#
# Copyright (c) 2017-Present Pivotal Software, Inc. All Rights Reserved.
#
# This program and the accompanying materials are made available under
# the terms of the under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may ... | 41.263158 | 84 | 0.68801 |
import unittest
from mock import Mock, patch, mock_open
from os.path import expanduser
import configure_opsman_director
from settings import Settings
class TestConfigureOpsManDirector(unittest.TestCase):
def setUp(self):
self.settings = Mock(Settings)
self.settings.zones = ["zone1"]
sel... | true | true |
f74de5f0658753c4851b3faf3582c48477a6fd79 | 5,197 | py | Python | knn_train.py | vlstyxz/Brain-Computer-Interface-with-Neurosky | 185d31a6e8d044fb766838947c37eec0af8f84f4 | [
"MIT"
] | 9 | 2019-09-29T20:26:04.000Z | 2022-02-25T19:01:03.000Z | knn_train.py | vlstyxz/Brain-Computer-Interface-with-Neurosky | 185d31a6e8d044fb766838947c37eec0af8f84f4 | [
"MIT"
] | null | null | null | knn_train.py | vlstyxz/Brain-Computer-Interface-with-Neurosky | 185d31a6e8d044fb766838947c37eec0af8f84f4 | [
"MIT"
] | 10 | 2019-09-26T18:21:36.000Z | 2021-09-10T19:05:22.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 17 20:43:41 2019
@author: anilosmantur
"""
import numpy as np
import matplotlib.pyplot as plt
from sklearn.neighbors import KNeighborsClassifier
from sklearn.preprocessing import MinMaxScaler
from sklearn import metrics
from pylab import rcParams
r... | 32.48125 | 103 | 0.719646 |
import numpy as np
import matplotlib.pyplot as plt
from sklearn.neighbors import KNeighborsClassifier
from sklearn.preprocessing import MinMaxScaler
from sklearn import metrics
from pylab import rcParams
rcParams['figure.figsize'] = 10, 5
n_samples = 30
dataNameList = ['attention','meditation','rawValue','delta','the... | true | true |
f74de64cef334445f40a14ed0f0626a1cdf6e5e8 | 5,886 | py | Python | plex_mpv_shim/video_profile.py | aelfa/plex-mpv-shim | c0dbf148fa1dc693cd776bd858648a63443616eb | [
"MIT"
] | 231 | 2019-08-18T06:25:17.000Z | 2022-03-28T08:35:50.000Z | plex_mpv_shim/video_profile.py | aelfa/plex-mpv-shim | c0dbf148fa1dc693cd776bd858648a63443616eb | [
"MIT"
] | 64 | 2019-08-18T00:40:36.000Z | 2022-03-30T07:05:38.000Z | plex_mpv_shim/video_profile.py | aelfa/plex-mpv-shim | c0dbf148fa1dc693cd776bd858648a63443616eb | [
"MIT"
] | 20 | 2019-08-19T21:02:36.000Z | 2022-03-12T15:07:38.000Z | from .conf import settings
from . import conffile
from .utils import get_resource
import logging
import os.path
import shutil
import json
import time
APP_NAME = 'plex-mpv-shim'
log = logging.getLogger('video_profile')
class MPVSettingError(Exception):
"""Raised when MPV does not support a required setting."""
... | 40.315068 | 127 | 0.614679 | from .conf import settings
from . import conffile
from .utils import get_resource
import logging
import os.path
import shutil
import json
import time
APP_NAME = 'plex-mpv-shim'
log = logging.getLogger('video_profile')
class MPVSettingError(Exception):
pass
class VideoProfileManager:
def __init__(self, menu, ... | true | true |
f74de672f471a6a33c23d6614a612a1a641563b0 | 14,389 | py | Python | block.py | sarahhjchung/Blocky | f6fcf727d78697d75f7d1a096b92a5b9dc62f934 | [
"BSD-4-Clause-UC"
] | 1 | 2021-07-30T07:13:40.000Z | 2021-07-30T07:13:40.000Z | block.py | sarahhjchung/Blocky | f6fcf727d78697d75f7d1a096b92a5b9dc62f934 | [
"BSD-4-Clause-UC"
] | null | null | null | block.py | sarahhjchung/Blocky | f6fcf727d78697d75f7d1a096b92a5b9dc62f934 | [
"BSD-4-Clause-UC"
] | 1 | 2021-01-09T22:26:51.000Z | 2021-01-09T22:26:51.000Z | """CSC148 Assignment 2
=== CSC148 Winter 2020 ===
Department of Computer Science,
University of Toronto
This code is provided solely for the personal and private use of
students taking the CSC148 course at the University of Toronto.
Copying for purposes other than this use is expressly prohibited.
All forms ... | 38.167109 | 81 | 0.570714 | from __future__ import annotations
from typing import Optional, Tuple, List
import random
import math
from settings import colour_name, COLOUR_LIST
def generate_board(max_depth: int, size: int) -> Block:
board = Block((0, 0), size, random.choice(COLOUR_LIST), 0, max_depth)
board.smash()
retu... | true | true |
f74de71a9aa5d6a8a3d667499fc5737486a334f8 | 1,093 | py | Python | cogs/utils/checks.py | blitzwolfz/DevilBot | 147b7e2f5e4764a7a61437e494c95cb95569ec79 | [
"Apache-2.0"
] | 1 | 2020-09-01T01:40:34.000Z | 2020-09-01T01:40:34.000Z | cogs/utils/checks.py | blitzwolfz/DevilBot | 147b7e2f5e4764a7a61437e494c95cb95569ec79 | [
"Apache-2.0"
] | null | null | null | cogs/utils/checks.py | blitzwolfz/DevilBot | 147b7e2f5e4764a7a61437e494c95cb95569ec79 | [
"Apache-2.0"
] | null | null | null | from discord.ext import commands
'''
Copyright (c) 2020 nizcomix
https://github.com/niztg/CyberTron5000
under the terms of the MIT LICENSE
'''
def check_admin_or_owner():
def predicate(ctx):
if ctx.message.author.id == 670564722218762240:
return True
elif ctx.message.author.permission... | 27.325 | 92 | 0.644099 | from discord.ext import commands
def check_admin_or_owner():
def predicate(ctx):
if ctx.message.author.id == 670564722218762240:
return True
elif ctx.message.author.permissions_in(channel=ctx.message.channel).administrator:
return True
else:
return False... | true | true |
f74de71f3f74d104cd29190444158aba53a7e4a3 | 10,445 | py | Python | chekw.py | AdamGlowicki/erpzgeckonetu | ce32d351c22bbb54732f6fa779d269d5ba58c5af | [
"MIT"
] | null | null | null | chekw.py | AdamGlowicki/erpzgeckonetu | ce32d351c22bbb54732f6fa779d269d5ba58c5af | [
"MIT"
] | null | null | null | chekw.py | AdamGlowicki/erpzgeckonetu | ce32d351c22bbb54732f6fa779d269d5ba58c5af | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# coding=utf-8
# chrome 60 + chromedriver 2.31
import os
import random
import sys
import time
import commands
import argparse
import requests
import mysql.connector
from requests.adapters import HTTPAdapter
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium... | 33.693548 | 145 | 0.637626 |
import os
import random
import sys
import time
import commands
import argparse
import requests
import mysql.connector
from requests.adapters import HTTPAdapter
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui imp... | false | true |
f74de765e87c7fbeefe49f40c74e4ba852cd5f11 | 11,926 | py | Python | retrieval_baseline_edit.py | stanfordmlgroup/CXR-RePaiR | 5142820c85f0098a233441710a6f8a0cec004644 | [
"MIT"
] | null | null | null | retrieval_baseline_edit.py | stanfordmlgroup/CXR-RePaiR | 5142820c85f0098a233441710a6f8a0cec004644 | [
"MIT"
] | null | null | null | retrieval_baseline_edit.py | stanfordmlgroup/CXR-RePaiR | 5142820c85f0098a233441710a6f8a0cec004644 | [
"MIT"
] | null | null | null | from cgi import test
import torch
from torchvision import transforms
import torchvision.models as models
from torch.utils import data
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics.pairwise import cosine_similarity
from scipy.spatial.distance import cdist
from PIL import Image
import pandas as... | 43.210145 | 207 | 0.666946 | from cgi import test
import torch
from torchvision import transforms
import torchvision.models as models
from torch.utils import data
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics.pairwise import cosine_similarity
from scipy.spatial.distance import cdist
from PIL import Image
import pandas as... | true | true |
f74de767df00d1cd1b3a35fe8be30b9569be1652 | 2,332 | py | Python | telemetry/telemetry/internal/results/html_output_formatter_unittest.py | oneumyvakin/catapult | 69d05ea70e77998c86149ac78044470e3ca364ad | [
"BSD-3-Clause"
] | null | null | null | telemetry/telemetry/internal/results/html_output_formatter_unittest.py | oneumyvakin/catapult | 69d05ea70e77998c86149ac78044470e3ca364ad | [
"BSD-3-Clause"
] | null | null | null | telemetry/telemetry/internal/results/html_output_formatter_unittest.py | oneumyvakin/catapult | 69d05ea70e77998c86149ac78044470e3ca364ad | [
"BSD-3-Clause"
] | null | null | null | # Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import StringIO
import unittest
from telemetry import story
from telemetry import benchmark
from telemetry.internal.results import html_output_for... | 35.876923 | 77 | 0.732419 |
import os
import StringIO
import unittest
from telemetry import story
from telemetry import benchmark
from telemetry.internal.results import html_output_formatter
from telemetry.internal.results import page_test_results
from telemetry import page as page_module
from telemetry.value import improvement_direction
from t... | true | true |
f74de7b7da65e744d443c044b7ebca079e93e7ba | 62 | py | Python | config.py | TheLady/say_what | 22b187e000b0ab13606c73804db0af89b945751d | [
"MIT"
] | null | null | null | config.py | TheLady/say_what | 22b187e000b0ab13606c73804db0af89b945751d | [
"MIT"
] | null | null | null | config.py | TheLady/say_what | 22b187e000b0ab13606c73804db0af89b945751d | [
"MIT"
] | null | null | null |
DATABASE = 'data/say_what.db'
BILL_TEXT_ROOT = 'data/bills/'
| 15.5 | 30 | 0.725806 |
DATABASE = 'data/say_what.db'
BILL_TEXT_ROOT = 'data/bills/'
| true | true |
f74de801168d6765ba1631a5b91ed4e364c4b1ee | 4,044 | py | Python | intersight/models/recovery_backup_profile_list.py | sdnit-se/intersight-python | 551f7685c0f76bb8af60ec83ffb6f9672d49a4ae | [
"Apache-2.0"
] | 21 | 2018-03-29T14:20:35.000Z | 2021-10-13T05:11:41.000Z | intersight/models/recovery_backup_profile_list.py | sdnit-se/intersight-python | 551f7685c0f76bb8af60ec83ffb6f9672d49a4ae | [
"Apache-2.0"
] | 14 | 2018-01-30T15:45:46.000Z | 2022-02-23T14:23:21.000Z | intersight/models/recovery_backup_profile_list.py | sdnit-se/intersight-python | 551f7685c0f76bb8af60ec83ffb6f9672d49a4ae | [
"Apache-2.0"
] | 18 | 2018-01-03T15:09:56.000Z | 2021-07-16T02:21:54.000Z | # coding: utf-8
"""
Cisco Intersight OpenAPI specification.
The Cisco Intersight OpenAPI specification.
OpenAPI spec version: 1.0.9-1461
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class RecoveryBackupPro... | 26.25974 | 90 | 0.570475 |
from pprint import pformat
from six import iteritems
import re
class RecoveryBackupProfileList(object):
swagger_types = {
'count': 'int',
'results': 'list[RecoveryBackupProfile]'
}
attribute_map = {
'count': 'Count',
'results': 'Results'
}
def __init__(self, ... | true | true |
f74de8648c7d73884a69cb498e8486ffc23968c2 | 1,493 | py | Python | samples/snippets/export_model_tabular_classification_sample_test.py | nachocano/python-aiplatform | 1c6b998d9145309d79712f494a2b00b50a9a9bf4 | [
"Apache-2.0"
] | null | null | null | samples/snippets/export_model_tabular_classification_sample_test.py | nachocano/python-aiplatform | 1c6b998d9145309d79712f494a2b00b50a9a9bf4 | [
"Apache-2.0"
] | 1 | 2021-02-12T23:56:38.000Z | 2021-02-12T23:56:38.000Z | samples/snippets/export_model_tabular_classification_sample_test.py | nachocano/python-aiplatform | 1c6b998d9145309d79712f494a2b00b50a9a9bf4 | [
"Apache-2.0"
] | null | null | null | # 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 32.456522 | 90 | 0.766242 |
import os
from uuid import uuid4
import pytest
import export_model_tabular_classification_sample
PROJECT_ID = os.getenv("BUILD_SPECIFIC_GCLOUD_PROJECT")
MODEL_ID = "6036688272397172736" GCS_BUCKET = "gs://ucaip-samples-test-output"
GCS_PREFIX = f"tmp/export_model_test_{uuid4()}"
@pytest.fixture(scope="function",... | true | true |
f74de89355e72665e704c363d8d6c74b2f635423 | 5,193 | py | Python | prplatform/aplus_integration/lti_middleware.py | piehei/prplatform | f3248b66019f207bb06a4681a62057e175408b3e | [
"MIT"
] | 3 | 2018-10-07T18:50:01.000Z | 2020-07-29T14:43:51.000Z | prplatform/aplus_integration/lti_middleware.py | piehei/prplatform | f3248b66019f207bb06a4681a62057e175408b3e | [
"MIT"
] | 9 | 2019-08-26T11:55:00.000Z | 2020-05-04T13:56:06.000Z | prplatform/aplus_integration/lti_middleware.py | piehei/prplatform | f3248b66019f207bb06a4681a62057e175408b3e | [
"MIT"
] | null | null | null | import logging
from django.db import IntegrityError
from django.http import HttpResponse
from django.contrib.auth import authenticate, login
from django.urls import resolve
from oauthlib.oauth1 import SignatureOnlyEndpoint
from oauthlib.common import urlencode
from urllib.parse import urlparse
from django_lti_login.val... | 44.008475 | 105 | 0.65415 | import logging
from django.db import IntegrityError
from django.http import HttpResponse
from django.contrib.auth import authenticate, login
from django.urls import resolve
from oauthlib.oauth1 import SignatureOnlyEndpoint
from oauthlib.common import urlencode
from urllib.parse import urlparse
from django_lti_login.val... | true | true |
f74de8c121cb910d4f70edec8c8f33b9a94dc57d | 532 | py | Python | DEVS_CodeGen/DEVS_CodeSync_v.py | JiyongYang/DEVS_Visualizer-CodeConsistency | 9ad60e1943a152c025878b83b38448d82c47a907 | [
"MIT"
] | null | null | null | DEVS_CodeGen/DEVS_CodeSync_v.py | JiyongYang/DEVS_Visualizer-CodeConsistency | 9ad60e1943a152c025878b83b38448d82c47a907 | [
"MIT"
] | null | null | null | DEVS_CodeGen/DEVS_CodeSync_v.py | JiyongYang/DEVS_Visualizer-CodeConsistency | 9ad60e1943a152c025878b83b38448d82c47a907 | [
"MIT"
] | null | null | null | import xml.etree.ElementTree as ET
import copy
from Model import *
def Read_cm_header(fileName):
portsLst = []
flg = False
f = open(fileName, 'r')
while True:
line = f.readline()
if not line: break
# find ports
if(line.strip() == "// [Region] Ports"):
flg = ... | 22.166667 | 60 | 0.526316 | import xml.etree.ElementTree as ET
import copy
from Model import *
def Read_cm_header(fileName):
portsLst = []
flg = False
f = open(fileName, 'r')
while True:
line = f.readline()
if not line: break
if(line.strip() == "// [Region] Ports"):
flg = True
... | true | true |
f74de9c84ca94364db3448f04b9e41793e61b89b | 370 | py | Python | Utils/averageAccuracy.py | Lemon-362/RGCSA-master | 4425f86e7e07de19a7256a57eee1642ebffb6199 | [
"Apache-2.0"
] | null | null | null | Utils/averageAccuracy.py | Lemon-362/RGCSA-master | 4425f86e7e07de19a7256a57eee1642ebffb6199 | [
"Apache-2.0"
] | null | null | null | Utils/averageAccuracy.py | Lemon-362/RGCSA-master | 4425f86e7e07de19a7256a57eee1642ebffb6199 | [
"Apache-2.0"
] | null | null | null | import numpy as np
from operator import truediv
def AA_andEachClassAccuracy(confusion_matrix):
counter = confusion_matrix.shape[0]
list_diag = np.diag(confusion_matrix) # 对角线
list_raw_sum = np.sum(confusion_matrix, axis=1)
each_acc = np.nan_to_num(truediv(list_diag, list_raw_sum))
average_acc = n... | 30.833333 | 62 | 0.759459 | import numpy as np
from operator import truediv
def AA_andEachClassAccuracy(confusion_matrix):
counter = confusion_matrix.shape[0]
list_diag = np.diag(confusion_matrix) list_raw_sum = np.sum(confusion_matrix, axis=1)
each_acc = np.nan_to_num(truediv(list_diag, list_raw_sum))
average_acc = np.mean... | true | true |
f74de9cb8d77f714eaa55ebb6f7a3f932d2ca99a | 14,654 | py | Python | tests/codec/cer/test_decoder.py | pysnmp/pyasn1 | d52a38c74df682d0b82d771028c145e8aba23ff4 | [
"BSD-2-Clause"
] | null | null | null | tests/codec/cer/test_decoder.py | pysnmp/pyasn1 | d52a38c74df682d0b82d771028c145e8aba23ff4 | [
"BSD-2-Clause"
] | 3 | 2021-11-16T20:28:20.000Z | 2021-11-24T20:27:24.000Z | tests/codec/cer/test_decoder.py | pysnmp/pyasn1 | d52a38c74df682d0b82d771028c145e8aba23ff4 | [
"BSD-2-Clause"
] | null | null | null | #
# This file is part of pyasn1 software.
#
# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com>
# License: http://snmplabs.com/pyasn1/license.html
#
import sys
try:
import unittest2 as unittest
except ImportError:
import unittest
from tests.base import BaseTestCase
from pyasn1.type import tag
from py... | 28.960474 | 88 | 0.431213 | import sys
try:
import unittest2 as unittest
except ImportError:
import unittest
from tests.base import BaseTestCase
from pyasn1.type import tag
from pyasn1.type import namedtype
from pyasn1.type import opentype
from pyasn1.type import univ
from pyasn1.codec.cer import decoder
from pyasn1.compat.octets impor... | true | true |
f74dead472a9b9f28db3dba337899eef182058e6 | 10,689 | py | Python | fasterai/visualize.py | mc-robinson/DeOldify | b6823187223ab27865547782e5b5748922f47e66 | [
"MIT"
] | 3 | 2018-11-09T04:39:21.000Z | 2018-11-11T11:47:28.000Z | fasterai/visualize.py | mc-robinson/DeOldify | b6823187223ab27865547782e5b5748922f47e66 | [
"MIT"
] | null | null | null | fasterai/visualize.py | mc-robinson/DeOldify | b6823187223ab27865547782e5b5748922f47e66 | [
"MIT"
] | null | null | null | from numpy import ndarray
from fastai.torch_imports import *
from fastai.core import *
from matplotlib.axes import Axes
from fastai.dataset import FilesDataset, ImageData, ModelData, open_image
from fastai.transforms import Transform, scale_min, tfms_from_stats, inception_stats
from fastai.transforms import CropType, N... | 43.100806 | 142 | 0.683319 | from numpy import ndarray
from fastai.torch_imports import *
from fastai.core import *
from matplotlib.axes import Axes
from fastai.dataset import FilesDataset, ImageData, ModelData, open_image
from fastai.transforms import Transform, scale_min, tfms_from_stats, inception_stats
from fastai.transforms import CropType, N... | true | true |
f74deaf5824f9f7568370149890b90427476dbb8 | 1,337 | py | Python | meiduo02/mall/apps/verifications/views.py | sunsyw/web | a85d58e22d008bbe7f4d53c60163a07e9accebe9 | [
"Apache-2.0"
] | null | null | null | meiduo02/mall/apps/verifications/views.py | sunsyw/web | a85d58e22d008bbe7f4d53c60163a07e9accebe9 | [
"Apache-2.0"
] | null | null | null | meiduo02/mall/apps/verifications/views.py | sunsyw/web | a85d58e22d008bbe7f4d53c60163a07e9accebe9 | [
"Apache-2.0"
] | null | null | null | from django.http import HttpResponse
from django.shortcuts import render
# Create your views here.
from rest_framework.views import APIView
from rest_framework.response import Response
from libs.captcha.captcha import captcha
from django_redis import get_redis_connection
from verifications.serializers import Register... | 29.711111 | 61 | 0.696335 | from django.http import HttpResponse
from django.shortcuts import render
from rest_framework.views import APIView
from rest_framework.response import Response
from libs.captcha.captcha import captcha
from django_redis import get_redis_connection
from verifications.serializers import RegisterSmsSerializer
import rando... | true | true |
f74debea25ffd6677c5d9450ec444e3961e88915 | 86,318 | py | Python | cvat/apps/engine/views.py | tejan74/ltts_adas | 944dcd7555935175f4099536a9e35af99bc133f8 | [
"Intel",
"MIT"
] | null | null | null | cvat/apps/engine/views.py | tejan74/ltts_adas | 944dcd7555935175f4099536a9e35af99bc133f8 | [
"Intel",
"MIT"
] | null | null | null | cvat/apps/engine/views.py | tejan74/ltts_adas | 944dcd7555935175f4099536a9e35af99bc133f8 | [
"Intel",
"MIT"
] | 1 | 2022-01-04T12:28:30.000Z | 2022-01-04T12:28:30.000Z | # Copyright (C) 2018-2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
import errno
import io
import os
import os.path as osp
from django.db.models import query
import pytz
import shutil
import traceback
import uuid
from datetime import datetime
from distutils.util import strtobool
from tempfile import mkstemp, ... | 49.324571 | 187 | 0.638164 |
import errno
import io
import os
import os.path as osp
from django.db.models import query
import pytz
import shutil
import traceback
import uuid
from datetime import datetime
from distutils.util import strtobool
from tempfile import mkstemp, NamedTemporaryFile
import json
import csv
from django.template.loader import ... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.