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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c493e1bf2ed370836c63e29a5f7c2abab7be087 | 1,982 | py | Python | azure/mgmt/network/v2016_09_01/models/vpn_client_configuration.py | EnjoyLifeFund/Debian_py36_packages | 1985d4c73fabd5f08f54b922e73a9306e09c77a5 | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | 1 | 2022-01-25T22:52:58.000Z | 2022-01-25T22:52:58.000Z | azure/mgmt/network/v2016_09_01/models/vpn_client_configuration.py | EnjoyLifeFund/Debian_py36_packages | 1985d4c73fabd5f08f54b922e73a9306e09c77a5 | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | azure/mgmt/network/v2016_09_01/models/vpn_client_configuration.py | EnjoyLifeFund/Debian_py36_packages | 1985d4c73fabd5f08f54b922e73a9306e09c77a5 | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 47.190476 | 126 | 0.717962 |
from msrest.serialization import Model
class VpnClientConfiguration(Model):
_attribute_map = {
'vpn_client_address_pool': {'key': 'vpnClientAddressPool', 'type': 'AddressSpace'},
'vpn_client_root_certificates': {'key': 'vpnClientRootCertificates', 'type': '[VpnClientRootCertificate]'},... | true | true |
1c493e8807b0e5346571eaaacbb826cbf365e77c | 565 | py | Python | tracker/user.py | k4t0mono/bridge-chat | 49f70e270002b1cb91363b2a0b3acce2a56fee16 | [
"BSD-2-Clause"
] | null | null | null | tracker/user.py | k4t0mono/bridge-chat | 49f70e270002b1cb91363b2a0b3acce2a56fee16 | [
"BSD-2-Clause"
] | null | null | null | tracker/user.py | k4t0mono/bridge-chat | 49f70e270002b1cb91363b2a0b3acce2a56fee16 | [
"BSD-2-Clause"
] | null | null | null | import jwt
import time
import os
class User():
def __init__(self, login):
self.login = login
self.tokens = []
def gen_token(self):
end = int(str(time.time())[:-8]) + 86400
d = { 'login': self.login, 'type': 'auth', 'time': end }
t = jwt.encode(d, os.environ['B... | 23.541667 | 80 | 0.534513 | import jwt
import time
import os
class User():
def __init__(self, login):
self.login = login
self.tokens = []
def gen_token(self):
end = int(str(time.time())[:-8]) + 86400
d = { 'login': self.login, 'type': 'auth', 'time': end }
t = jwt.encode(d, os.environ['B... | true | true |
1c493e966b7d54c69854c811b65ceb355625b0b4 | 347 | py | Python | Python3/0009-Palindrome-Number/soln.py | wyaadarsh/LeetCode-Solutions | 3719f5cb059eefd66b83eb8ae990652f4b7fd124 | [
"MIT"
] | 5 | 2020-07-24T17:48:59.000Z | 2020-12-21T05:56:00.000Z | Python3/0009-Palindrome-Number/soln.py | zhangyaqi1989/LeetCode-Solutions | 2655a1ffc8678ad1de6c24295071308a18c5dc6e | [
"MIT"
] | null | null | null | Python3/0009-Palindrome-Number/soln.py | zhangyaqi1989/LeetCode-Solutions | 2655a1ffc8678ad1de6c24295071308a18c5dc6e | [
"MIT"
] | 2 | 2020-07-24T17:49:01.000Z | 2020-08-31T19:57:35.000Z | class Solution:
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
# solve it without converting the integer to a string
if x < 0:
return False
r = 0
origin = x
while x:
r = r * 10 + x % 10
x //= 10... | 23.133333 | 61 | 0.420749 | class Solution:
def isPalindrome(self, x):
if x < 0:
return False
r = 0
origin = x
while x:
r = r * 10 + x % 10
x //= 10
return r == origin | true | true |
1c493ee7f94ba470d37424f4171f5c35c2ec9d91 | 15,082 | py | Python | vspk/v6/nufirewallacl.py | axxyhtrx/vspk-python | 4495882c6bcbb1ef51b14b9f4dc7efe46476ff50 | [
"BSD-3-Clause"
] | 19 | 2016-03-07T12:34:22.000Z | 2020-06-11T11:09:02.000Z | vspk/v6/nufirewallacl.py | axxyhtrx/vspk-python | 4495882c6bcbb1ef51b14b9f4dc7efe46476ff50 | [
"BSD-3-Clause"
] | 40 | 2016-06-13T15:36:54.000Z | 2020-11-10T18:14:43.000Z | vspk/v6/nufirewallacl.py | axxyhtrx/vspk-python | 4495882c6bcbb1ef51b14b9f4dc7efe46476ff50 | [
"BSD-3-Clause"
] | 15 | 2016-06-10T22:06:01.000Z | 2020-12-15T18:37:42.000Z | # -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyrigh... | 30.164 | 296 | 0.604628 |
from .fetchers import NUPermissionsFetcher
from .fetchers import NUMetadatasFetcher
from .fetchers import NUFirewallRulesFetcher
from .fetchers import NUGlobalMetadatasFetcher
from .fetchers import NUDomainsFetcher
from bambou import NURESTObject
class NUFirewallAcl(NURESTObject... | true | true |
1c493ef011476abc24d0368d37585b1c67c3570d | 1,548 | py | Python | umusicfy/user_profile/urls.py | CarlosMart626/umusicfy | 97e2166fe26d1fbe36df6bea435044ef3d367edf | [
"Apache-2.0"
] | null | null | null | umusicfy/user_profile/urls.py | CarlosMart626/umusicfy | 97e2166fe26d1fbe36df6bea435044ef3d367edf | [
"Apache-2.0"
] | 8 | 2020-06-05T18:08:05.000Z | 2022-01-13T00:44:30.000Z | umusicfy/user_profile/urls.py | CarlosMart626/umusicfy | 97e2166fe26d1fbe36df6bea435044ef3d367edf | [
"Apache-2.0"
] | null | null | null | from django.contrib.auth.decorators import login_required
from django.conf.urls import url
# Import Class Based Views
from .views import UserProfileView, UpdateUserProfileView, UpdateUserPasswordView, \
UserProfileDetailView, PlaylistDetailView, PlaylistCreateView, FollowUserProfileView, \
FollowPlaylistView,... | 57.333333 | 116 | 0.720284 | from django.contrib.auth.decorators import login_required
from django.conf.urls import url
from .views import UserProfileView, UpdateUserProfileView, UpdateUserPasswordView, \
UserProfileDetailView, PlaylistDetailView, PlaylistCreateView, FollowUserProfileView, \
FollowPlaylistView, PlayListListView, AddToPl... | true | true |
1c49402d0cfc1395f249ead6417ae479d1dbeb4c | 3,495 | py | Python | scripts/compute_scores.py | JannikWirtz/importance-sampling-diagnostics | 9c9cab2ac91081ae2b64f99891504155057c09e3 | [
"MIT"
] | 289 | 2017-08-03T17:30:12.000Z | 2022-03-30T12:04:21.000Z | scripts/compute_scores.py | JannikWirtz/importance-sampling-diagnostics | 9c9cab2ac91081ae2b64f99891504155057c09e3 | [
"MIT"
] | 34 | 2017-08-03T21:47:49.000Z | 2021-06-16T17:59:45.000Z | scripts/compute_scores.py | JannikWirtz/importance-sampling-diagnostics | 9c9cab2ac91081ae2b64f99891504155057c09e3 | [
"MIT"
] | 58 | 2017-08-06T01:10:24.000Z | 2022-03-07T00:30:24.000Z | #!/usr/bin/env python
#
# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/
# Written by Angelos Katharopoulos <angelos.katharopoulos@idiap.ch>
#
import argparse
import numpy as np
from importance_sampling import models
from importance_sampling.datasets import CIFAR10, CIFAR100, MNIST, \
Onthefly... | 28.414634 | 76 | 0.595136 |
import argparse
import numpy as np
from importance_sampling import models
from importance_sampling.datasets import CIFAR10, CIFAR100, MNIST, \
OntheflyAugmentedImages, PennTreeBank
from importance_sampling.model_wrappers import OracleWrapper
from importance_sampling.utils.functional import compose, partial,... | false | true |
1c49404f0513b7d760f2819862a1b1a1b9b0b8f1 | 48,784 | py | Python | preproc/preproc_wifi.py | metehancekic/wireless-fingerprinting | 41872761260b3fc26f33acec983220e8b4d9f42f | [
"MIT"
] | 12 | 2020-03-05T12:24:37.000Z | 2022-01-07T15:10:37.000Z | preproc/preproc_wifi.py | metehancekic/wireless-fingerprinting | 41872761260b3fc26f33acec983220e8b4d9f42f | [
"MIT"
] | 5 | 2020-06-29T02:17:14.000Z | 2021-06-24T22:22:23.000Z | preproc/preproc_wifi.py | metehancekic/wireless-fingerprinting | 41872761260b3fc26f33acec983220e8b4d9f42f | [
"MIT"
] | 5 | 2020-11-01T17:49:46.000Z | 2022-03-05T02:52:11.000Z | '''
Contains code for fractionally spaced equalization, preamble detection
Also includes a modified version of Teledyne's data read and preprocessing code
'''
import numpy as np
import os
import json
import csv
import math
import fractions
import resampy
from tqdm import tqdm, trange
import matplotlib
import matplotli... | 40.755221 | 174 | 0.55426 |
import numpy as np
import os
import json
import csv
import math
import fractions
import resampy
from tqdm import tqdm, trange
import matplotlib
import matplotlib.pyplot as plt
from scipy.fftpack import fft, ifft, fftshift, ifftshift
import ipdb
from sklearn.preprocessing import normalize
def preprocess_wifi(data_dic... | true | true |
1c4940a471a05633b194d7313df6009ea37014ef | 25,648 | py | Python | src/tests/api/test_permissions.py | tixl/tixl | 9f515a4b4e17a14d1990b29385475195438969be | [
"Apache-2.0"
] | null | null | null | src/tests/api/test_permissions.py | tixl/tixl | 9f515a4b4e17a14d1990b29385475195438969be | [
"Apache-2.0"
] | 8 | 2015-01-06T10:50:27.000Z | 2015-01-18T18:38:18.000Z | src/tests/api/test_permissions.py | tixl/tixl | 9f515a4b4e17a14d1990b29385475195438969be | [
"Apache-2.0"
] | null | null | null | #
# This file is part of pretix (Community Edition).
#
# Copyright (C) 2014-2020 Raphael Michel and contributors
# Copyright (C) 2020-2021 rami.io GmbH and contributors
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
# Public License as published by ... | 45.314488 | 145 | 0.681535 |
import time
import pytest
from django.test import override_settings
from django.utils.timezone import now
from pretix.base.models import Organizer
event_urls = [
(None, ''),
(None, 'categories/'),
('can_view_orders', 'invoices/'),
(None, 'items/'),
('can_view_ord... | true | true |
1c4940b8959cc53cd05290301b2d13364041c21b | 751 | py | Python | archive/migrations/0002_auto_20181215_2009.py | WarwickAnimeSoc/aniMango | f927c2bc6eb484561ab38172ebebee6f03c8b13b | [
"MIT"
] | null | null | null | archive/migrations/0002_auto_20181215_2009.py | WarwickAnimeSoc/aniMango | f927c2bc6eb484561ab38172ebebee6f03c8b13b | [
"MIT"
] | 6 | 2016-10-18T14:52:05.000Z | 2020-06-18T15:14:41.000Z | archive/migrations/0002_auto_20181215_2009.py | WarwickAnimeSoc/aniMango | f927c2bc6eb484561ab38172ebebee6f03c8b13b | [
"MIT"
] | 6 | 2020-02-07T17:37:37.000Z | 2021-01-15T00:01:43.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2018-12-15 20:09
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('archive', '0001_initial'),
]
operations = [
migrations.AlterField(
... | 28.884615 | 161 | 0.585885 |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('archive', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='item',
name='file',
field=model... | true | true |
1c4941197e11bced5ec610532458438235e3a434 | 664 | py | Python | src/oca_github_bot/tasks/delete_branch.py | tafaRU/oca-github-bot | 4ede8cf4e7ffb6aa0fd02aadcdd53edfb94b211a | [
"MIT"
] | null | null | null | src/oca_github_bot/tasks/delete_branch.py | tafaRU/oca-github-bot | 4ede8cf4e7ffb6aa0fd02aadcdd53edfb94b211a | [
"MIT"
] | 1 | 2019-05-28T10:15:24.000Z | 2019-05-28T10:15:24.000Z | src/oca_github_bot/tasks/delete_branch.py | tafaRU/oca-github-bot | 4ede8cf4e7ffb6aa0fd02aadcdd53edfb94b211a | [
"MIT"
] | 1 | 2019-06-18T15:17:53.000Z | 2019-06-18T15:17:53.000Z | # Copyright (c) ACSONE SA/NV 2018
# Distributed under the MIT License (http://opensource.org/licenses/MIT).
from .. import github
from ..config import switchable
from ..github import gh_call
from ..queue import getLogger, task
_logger = getLogger(__name__)
@task()
@switchable()
def delete_branch(org, repo, branch, ... | 30.181818 | 75 | 0.674699 |
from .. import github
from ..config import switchable
from ..github import gh_call
from ..queue import getLogger, task
_logger = getLogger(__name__)
@task()
@switchable()
def delete_branch(org, repo, branch, dry_run=False):
with github.repository(org, repo) as gh_repo:
gh_branch = gh_call(gh_repo.ref,... | true | true |
1c49418810ea5ca5da0598ff490ca27f6dd4bd50 | 4,785 | py | Python | had/app/views/api/v1/persons/phone_api.py | eduardolujan/hexagonal_architecture_django | 8055927cb460bc40f3a2651c01a9d1da696177e8 | [
"BSD-3-Clause"
] | 6 | 2020-08-09T23:41:08.000Z | 2021-03-16T22:05:40.000Z | had/app/views/api/v1/persons/phone_api.py | eduardolujan/hexagonal_architecture_django | 8055927cb460bc40f3a2651c01a9d1da696177e8 | [
"BSD-3-Clause"
] | 1 | 2020-10-02T02:59:38.000Z | 2020-10-02T02:59:38.000Z | had/app/views/api/v1/persons/phone_api.py | eduardolujan/hexagonal_architecture_django | 8055927cb460bc40f3a2651c01a9d1da696177e8 | [
"BSD-3-Clause"
] | 2 | 2021-03-16T22:05:43.000Z | 2021-04-30T06:35:25.000Z | # -*- coding: utf-8 -*-
from rest_framework.views import APIView
from rest_framework.permissions import AllowAny
from modules.shared.infrastructure.serializers.django.serializer_manager import (
SerializerManager as DjangoSerializerManager,
)
from modules.users.infrastructure.serializers.django import (
User... | 37.97619 | 100 | 0.614629 |
from rest_framework.views import APIView
from rest_framework.permissions import AllowAny
from modules.shared.infrastructure.serializers.django.serializer_manager import (
SerializerManager as DjangoSerializerManager,
)
from modules.users.infrastructure.serializers.django import (
UserSerializer as DjangoUse... | true | true |
1c4943683afb62f8fb1168cb730218c3287099c4 | 5,313 | py | Python | app/api/v2/tests/test_candidate.py | softMaina/political-v2 | 985e96ec0ff6cc866a26538ef7a69436de7e17d0 | [
"MIT"
] | 2 | 2019-03-17T08:11:13.000Z | 2019-11-14T06:08:50.000Z | app/api/v2/tests/test_candidate.py | softMaina/political-v2 | 985e96ec0ff6cc866a26538ef7a69436de7e17d0 | [
"MIT"
] | null | null | null | app/api/v2/tests/test_candidate.py | softMaina/political-v2 | 985e96ec0ff6cc866a26538ef7a69436de7e17d0 | [
"MIT"
] | null | null | null |
import json
from flask import current_app
from app.api.v2.tests import base_tests
from . import helper_functions
from app.api.v2.tests.helper_functions import convert_response_to_json
class TestCandidates(base_tests.TestBaseClass):
"""
A class to test candidate's endpoints
:param: object of the TestBaseC... | 45.410256 | 165 | 0.680783 |
import json
from flask import current_app
from app.api.v2.tests import base_tests
from . import helper_functions
from app.api.v2.tests.helper_functions import convert_response_to_json
class TestCandidates(base_tests.TestBaseClass):
def register_user(self):
response = self.app_test_client.post('api/v2/au... | true | true |
1c49452cccd050c0ae0b8b5468b700cbb6d115c9 | 1,059 | py | Python | feature_importance_v2.py | terryli710/MPS_regression | d8f9c94ad315734ff9376a53e6be3f508b4da742 | [
"MIT"
] | null | null | null | feature_importance_v2.py | terryli710/MPS_regression | d8f9c94ad315734ff9376a53e6be3f508b4da742 | [
"MIT"
] | null | null | null | feature_importance_v2.py | terryli710/MPS_regression | d8f9c94ad315734ff9376a53e6be3f508b4da742 | [
"MIT"
] | null | null | null | ## Without filtering results with VIF, calculate the importance for all the features.
## Works for "first" and "structcoef"
from util_relaimpo import *
from util import loadNpy, loadCsv
def main(x_name, y_name, method, feature_names = []):
# INFO
print("Dataset", x_name.split('_')[0])
print("Method", str(m... | 40.730769 | 85 | 0.693107 |
print("Dataset", x_name.split('_')[0])
print("Method", str(method).split(' ')[1])
X = loadNpy(['data', 'X', x_name])
Y = loadNpy(['data', 'Y', y_name])
if feature_names: xdf = pd.DataFrame(data=X, columns=feature_names)
else: xdf = pd.DataFrame(data=X)
print("bootstrapping ..."... | true | true |
1c494530de31aff8b8204b0ef28d50b5b3cad91c | 113 | py | Python | tcex/sessions/__init__.py | brikardtc/tcex | 78680f055f4259e31f0b4989a5695604108d9fdd | [
"Apache-2.0"
] | null | null | null | tcex/sessions/__init__.py | brikardtc/tcex | 78680f055f4259e31f0b4989a5695604108d9fdd | [
"Apache-2.0"
] | null | null | null | tcex/sessions/__init__.py | brikardtc/tcex | 78680f055f4259e31f0b4989a5695604108d9fdd | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""Session module for TcEx Framework"""
# flake8: noqa
from .tc_session import TcSession
| 22.6 | 39 | 0.690265 |
from .tc_session import TcSession
| true | true |
1c49454c8e0883c7cc820aae3666d057cd052c30 | 3,723 | py | Python | monai/data/synthetic.py | loftwah/MONAI | 37fb3e779121e6dc74127993df102fc91d9065f8 | [
"Apache-2.0"
] | 1 | 2020-04-23T13:05:29.000Z | 2020-04-23T13:05:29.000Z | monai/data/synthetic.py | tranduyquockhanh/MONAI | 37fb3e779121e6dc74127993df102fc91d9065f8 | [
"Apache-2.0"
] | null | null | null | monai/data/synthetic.py | tranduyquockhanh/MONAI | 37fb3e779121e6dc74127993df102fc91d9065f8 | [
"Apache-2.0"
] | 1 | 2021-09-20T12:10:01.000Z | 2021-09-20T12:10:01.000Z | # Copyright 2020 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, s... | 43.290698 | 123 | 0.665055 |
import numpy as np
from monai.transforms.utils import rescale_array
def create_test_image_2d(width, height, num_objs=12, rad_max=30, noise_max=0.0, num_seg_classes=5, channel_dim=None):
image = np.zeros((width, height))
for i in range(num_objs):
x = np.random.randint(rad_max, width - rad_... | true | true |
1c49454d298b0470f6d86b30368b4e5d57afc0e8 | 1,953 | py | Python | DataSource/TickData.py | dukechain2333/BossaNova | af9fa7abf060b2e070aa6469afa44fd2861d5a22 | [
"MIT"
] | 2 | 2020-10-15T12:48:01.000Z | 2021-09-11T01:44:28.000Z | DataSource/TickData.py | dukechain2333/BossaNova | af9fa7abf060b2e070aa6469afa44fd2861d5a22 | [
"MIT"
] | null | null | null | DataSource/TickData.py | dukechain2333/BossaNova | af9fa7abf060b2e070aa6469afa44fd2861d5a22 | [
"MIT"
] | null | null | null | # @author Duke Chain
# @File:TickData.py
# @createTime 2020/12/08 15:25:08
import threading
from DBOperate.CreateStockInfo import CreateStockInfo
from DBOperate.AddStockInfo import AddStockInfo
import akshare as ak
class TickData(threading.Thread):
"""
获取Tick数据并写入数据库
Args:
ak:传入aksh... | 29.590909 | 113 | 0.550947 |
import threading
from DBOperate.CreateStockInfo import CreateStockInfo
from DBOperate.AddStockInfo import AddStockInfo
import akshare as ak
class TickData(threading.Thread):
def __init__(self, ak, stockID, dateList):
super().__init__()
self.ak = ak
self.stockID = stockID
self.... | true | true |
1c49456a4e965385fb2cd2b8f180a1dcc77558ad | 7,238 | py | Python | tools/train.py | tszssong/HRNet-Image-Classification | 6d8ee24aedf2e0b3134102c221a29fb9b0ce2e1b | [
"MIT"
] | null | null | null | tools/train.py | tszssong/HRNet-Image-Classification | 6d8ee24aedf2e0b3134102c221a29fb9b0ce2e1b | [
"MIT"
] | null | null | null | tools/train.py | tszssong/HRNet-Image-Classification | 6d8ee24aedf2e0b3134102c221a29fb9b0ce2e1b | [
"MIT"
] | null | null | null | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (Bin.Xiao@microsoft.com)
# Modified by Ke Sun (sunk@mail.ustc.edu.cn)
# ------------------------------------------------------------------------------
from ... | 33.665116 | 91 | 0.613844 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import pprint
import shutil
import sys
import torch
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
import torch.utils.data
import torch.utils.... | true | true |
1c4945b72a6e9e9e1a10dfad2632125e558e165c | 860 | py | Python | migrations/0066_auto_20190820_1448.py | audaciouscode/PassiveDataKit-Django | ed1e00c436801b9f49a3e0e6657c2adb6b2ba3d4 | [
"Apache-2.0"
] | 5 | 2016-01-26T19:19:44.000Z | 2018-12-12T18:04:04.000Z | migrations/0066_auto_20190820_1448.py | audacious-software/PassiveDataKit-Django | da91a375c075ceec938f2c9bb6b011f9f019b024 | [
"Apache-2.0"
] | 6 | 2020-02-17T20:16:28.000Z | 2021-12-13T21:51:20.000Z | migrations/0066_auto_20190820_1448.py | audacious-software/PassiveDataKit-Django | da91a375c075ceec938f2c9bb6b011f9f019b024 | [
"Apache-2.0"
] | 4 | 2020-01-29T15:36:58.000Z | 2021-06-01T18:55:26.000Z | # pylint: skip-file
# -*- coding: utf-8 -*-
# Generated by Django 1.11.23 on 2019-08-20 19:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('passive_data_kit', '0065_devicemodel_reference'),
]
operations = [
migrations.AddField(
... | 26.875 | 78 | 0.6 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('passive_data_kit', '0065_devicemodel_reference'),
]
operations = [
migrations.AddField(
model_name='deviceissue',
name='platform',
field=models.Char... | true | true |
1c4946a18d3acce164e58e7d5d801355d9aea016 | 3,169 | py | Python | tensorboard/tools/whitespace_hygiene_test.py | isabella232/tensorboard | 77cf61f74dd57e4f3a6256e3972335bbd82feb51 | [
"Apache-2.0"
] | null | null | null | tensorboard/tools/whitespace_hygiene_test.py | isabella232/tensorboard | 77cf61f74dd57e4f3a6256e3972335bbd82feb51 | [
"Apache-2.0"
] | 1 | 2021-02-24T00:55:12.000Z | 2021-02-24T00:55:12.000Z | tensorboard/tools/whitespace_hygiene_test.py | isabella232/tensorboard | 77cf61f74dd57e4f3a6256e3972335bbd82feb51 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | 29.342593 | 80 | 0.634269 |
import collections
import os
import subprocess
import sys
exceptions = frozenset(
[
"third_party/mock_call_assertions.patch",
]
)
Match = collections.namedtuple("Match", ("filename", "line_number", "line"))
def main():
chdir_to_repo_root()
matches = git_g... | true | true |
1c49472d0f5e80c89a16bc24af6c12fc4c561fcb | 2,362 | py | Python | src/third_party/beaengine/tests/0f3850.py | CrackerCat/rp | 5fe693c26d76b514efaedb4084f6e37d820db023 | [
"MIT"
] | 1 | 2022-01-17T17:40:29.000Z | 2022-01-17T17:40:29.000Z | src/third_party/beaengine/tests/0f3850.py | CrackerCat/rp | 5fe693c26d76b514efaedb4084f6e37d820db023 | [
"MIT"
] | null | null | null | src/third_party/beaengine/tests/0f3850.py | CrackerCat/rp | 5fe693c26d76b514efaedb4084f6e37d820db023 | [
"MIT"
] | null | null | null | #!/usr/bin/python
# -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This progra... | 40.033898 | 81 | 0.662151 |
from headers.BeaEnginePython import *
from nose.tools import *
class TestSuite:
def test(self):
myEVEX = EVEX('EVEX.128.66.0F38.W0')
myEVEX.vvvv = 0b1111
Buffer = bytes.fromhex('{}500e'.format(myEVEX.prefix()))
myDisasm = Disasm(Buffer)
m... | true | true |
1c49473fd7bb5ce515eff66c03f9cbc72d5e5171 | 719 | py | Python | assistant/configurations/theme.py | AmulyaParitosh/Virtual-Assistant | b1a0e6d8569a481558bd04c2d9295a6933536ed4 | [
"MIT"
] | null | null | null | assistant/configurations/theme.py | AmulyaParitosh/Virtual-Assistant | b1a0e6d8569a481558bd04c2d9295a6933536ed4 | [
"MIT"
] | null | null | null | assistant/configurations/theme.py | AmulyaParitosh/Virtual-Assistant | b1a0e6d8569a481558bd04c2d9295a6933536ed4 | [
"MIT"
] | null | null | null | import json
information = json.loads(open('assistant/configurations/themes.json').read())
Theme = "Shizuka"
for theme in information["Themes"]:
if theme["name"] == Theme:
name = theme["name"]
voice = theme["voice"]
art = theme["ascii"]
bg_image = theme["bg_image"]
label_... | 23.966667 | 77 | 0.628651 | import json
information = json.loads(open('assistant/configurations/themes.json').read())
Theme = "Shizuka"
for theme in information["Themes"]:
if theme["name"] == Theme:
name = theme["name"]
voice = theme["voice"]
art = theme["ascii"]
bg_image = theme["bg_image"]
label_... | true | true |
1c4947a8a1f80457570c9ffe5b8f4037ae19954e | 943 | py | Python | submission/damagereport/api/1/urls.py | simonprast/wopi-engine | b3f59782659c8be42f4064bce5281afd391833be | [
"BSD-Source-Code"
] | null | null | null | submission/damagereport/api/1/urls.py | simonprast/wopi-engine | b3f59782659c8be42f4064bce5281afd391833be | [
"BSD-Source-Code"
] | null | null | null | submission/damagereport/api/1/urls.py | simonprast/wopi-engine | b3f59782659c8be42f4064bce5281afd391833be | [
"BSD-Source-Code"
] | null | null | null | #
# Created on Wed Nov 18 2020
#
# Copyright (c) 2020 - Simon Prast
#
from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns
from . import api_views
urlpatterns = [
# POST - create new damage report (customer)
path('submit/', api_views.SubmitDamageReport.as_view()),
... | 29.46875 | 75 | 0.711559 |
from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns
from . import api_views
urlpatterns = [
path('submit/', api_views.SubmitDamageReport.as_view()),
path('submit/<int:report>/', api_views.SendMessage.as_view()),
path('show/', api_views.Ge... | true | true |
1c494833f793e0560e6b2f5a6c672a8f1d65c98c | 2,574 | py | Python | odd_tableau_adapter/mappers/sheets.py | opendatadiscovery/odd-tableau-adapter | dee69398ccdbed6acbc02a13c188f5ec1f26a7e1 | [
"Apache-2.0"
] | null | null | null | odd_tableau_adapter/mappers/sheets.py | opendatadiscovery/odd-tableau-adapter | dee69398ccdbed6acbc02a13c188f5ec1f26a7e1 | [
"Apache-2.0"
] | 1 | 2021-11-01T18:00:00.000Z | 2021-11-01T18:00:00.000Z | odd_tableau_adapter/mappers/sheets.py | opendatadiscovery/odd-tableau-adapter | dee69398ccdbed6acbc02a13c188f5ec1f26a7e1 | [
"Apache-2.0"
] | null | null | null | from copy import deepcopy
from datetime import datetime
import pytz
from odd_models.models import DataEntity, DataConsumer, DataEntityType
from oddrn_generator import TableauGenerator
from . import _TABLEAU_DATETIME_FORMAT, _data_consumer_metadata_schema_url, _data_consumer_metadata_excluded_keys
from .metadata impor... | 37.852941 | 113 | 0.653458 | from copy import deepcopy
from datetime import datetime
import pytz
from odd_models.models import DataEntity, DataConsumer, DataEntityType
from oddrn_generator import TableauGenerator
from . import _TABLEAU_DATETIME_FORMAT, _data_consumer_metadata_schema_url, _data_consumer_metadata_excluded_keys
from .metadata impor... | true | true |
1c4949bbb3f9fca427ac14839fdc5b4b1b8faa8f | 7,434 | py | Python | tests/test_metadata.py | tskisner/sotodlib | 9b80171129ea312bc7a61ce5c37d6abfbb3d5be9 | [
"MIT"
] | null | null | null | tests/test_metadata.py | tskisner/sotodlib | 9b80171129ea312bc7a61ce5c37d6abfbb3d5be9 | [
"MIT"
] | null | null | null | tests/test_metadata.py | tskisner/sotodlib | 9b80171129ea312bc7a61ce5c37d6abfbb3d5be9 | [
"MIT"
] | null | null | null | # Copyright (c) 2020 Simons Observatory.
# Full license can be found in the top level "LICENSE" file.
"""Demonstrate construction of some simple metadata structures. This
includes HDF5 IO helper routines, and the ObsDb/DetDb resolution and
association system used in Context/SuperLoader.
"""
import unittest
import t... | 41.764045 | 92 | 0.576944 |
import unittest
import tempfile
from sotodlib.core import metadata
from sotodlib.io.metadata import ResultSetHdfLoader, write_dataset, _decode_array
import os
import h5py
class MetadataTest(unittest.TestCase):
def setUp(self):
self.tempdir = tempfile.TemporaryDirectory()
def tearDown(self):
... | true | true |
1c4949e8507d2d5b90702103641c5f8095dbb773 | 2,557 | py | Python | main.py | fsevenm/ulauncher-uuid | 2fbb70fd2af246277b2baff03465bc8bd971c85f | [
"MIT"
] | 1 | 2022-01-29T16:30:00.000Z | 2022-01-29T16:30:00.000Z | main.py | fsevenm/ulauncher-uuid | 2fbb70fd2af246277b2baff03465bc8bd971c85f | [
"MIT"
] | null | null | null | main.py | fsevenm/ulauncher-uuid | 2fbb70fd2af246277b2baff03465bc8bd971c85f | [
"MIT"
] | null | null | null | import logging
import uuid
from ulauncher.api.client.Extension import Extension
from ulauncher.api.client.EventListener import EventListener
from ulauncher.api.shared.event import KeywordQueryEvent
from ulauncher.api.shared.item.ExtensionResultItem import ExtensionResultItem
from ulauncher.api.shared.action.RenderResul... | 35.027397 | 94 | 0.596402 | import logging
import uuid
from ulauncher.api.client.Extension import Extension
from ulauncher.api.client.EventListener import EventListener
from ulauncher.api.shared.event import KeywordQueryEvent
from ulauncher.api.shared.item.ExtensionResultItem import ExtensionResultItem
from ulauncher.api.shared.action.RenderResul... | true | true |
1c494a3c50140aabc3b3a441f1a35000c0f75722 | 189 | py | Python | pset_loops/loop_basics/p5.py | mottaquikarim/pydev-psets | 9749e0d216ee0a5c586d0d3013ef481cc21dee27 | [
"MIT"
] | 5 | 2019-04-08T20:05:37.000Z | 2019-12-04T20:48:45.000Z | pset_loops/loop_basics/p5.py | mottaquikarim/pydev-psets | 9749e0d216ee0a5c586d0d3013ef481cc21dee27 | [
"MIT"
] | 8 | 2019-04-15T15:16:05.000Z | 2022-02-12T10:33:32.000Z | pset_loops/loop_basics/p5.py | mottaquikarim/pydev-psets | 9749e0d216ee0a5c586d0d3013ef481cc21dee27 | [
"MIT"
] | 2 | 2019-04-10T00:14:42.000Z | 2020-02-26T20:35:21.000Z | """
Factors
"""
# Find all factors of a number that a user inputs and print out 'The factors of <the_user_input_number> are: '.
user_input = input('Enter a number to find its factors: ')
| 23.625 | 111 | 0.714286 |
user_input = input('Enter a number to find its factors: ')
| true | true |
1c494c0c55610349d045688af032b680b719446c | 2,457 | py | Python | pypeln/process/api/ordered.py | quarckster/pypeln | f4160d0f4d4718b67f79a0707d7261d249459a4b | [
"MIT"
] | 1,281 | 2018-09-20T05:35:27.000Z | 2022-03-30T01:29:48.000Z | pypeln/process/api/ordered.py | webclinic017/pypeln | 5231806f2cac9d2019dacbbcf913484fd268b8c1 | [
"MIT"
] | 78 | 2018-09-18T20:38:12.000Z | 2022-03-30T20:16:02.000Z | pypeln/process/api/ordered.py | webclinic017/pypeln | 5231806f2cac9d2019dacbbcf913484fd268b8c1 | [
"MIT"
] | 88 | 2018-09-24T10:46:14.000Z | 2022-03-28T09:34:50.000Z | import bisect
import typing as tp
from pypeln import utils as pypeln_utils
from pypeln.utils import A, B, T
from ..stage import Stage
from ..worker import ProcessFn, Worker
from .to_stage import to_stage
class Ordered(tp.NamedTuple):
def __call__(self, worker: Worker, **kwargs):
elems = []
for... | 26.138298 | 169 | 0.64998 | import bisect
import typing as tp
from pypeln import utils as pypeln_utils
from pypeln.utils import A, B, T
from ..stage import Stage
from ..worker import ProcessFn, Worker
from .to_stage import to_stage
class Ordered(tp.NamedTuple):
def __call__(self, worker: Worker, **kwargs):
elems = []
for... | true | true |
1c494d4b0502d2f40178993523ea1cca94619b40 | 55 | py | Python | lahman/__init__.py | PeterA182/liteSaber | 6560feb70fd23916c0188ba98a751f8fee99a18b | [
"MIT"
] | null | null | null | lahman/__init__.py | PeterA182/liteSaber | 6560feb70fd23916c0188ba98a751f8fee99a18b | [
"MIT"
] | null | null | null | lahman/__init__.py | PeterA182/liteSaber | 6560feb70fd23916c0188ba98a751f8fee99a18b | [
"MIT"
] | 1 | 2019-06-28T01:19:38.000Z | 2019-06-28T01:19:38.000Z | __author__ = 'Peter Altamura'
from lahman import Lahman | 27.5 | 29 | 0.818182 | __author__ = 'Peter Altamura'
from lahman import Lahman | true | true |
1c494dfc5b9895a242fb3bc427570d5fcb2fd608 | 12,414 | py | Python | lib/pavilion/expression_functions/base.py | ubccr/pavilion2 | 4c6d043b436761d9162d8824657f51cedc9907cc | [
"BSD-3-Clause"
] | null | null | null | lib/pavilion/expression_functions/base.py | ubccr/pavilion2 | 4c6d043b436761d9162d8824657f51cedc9907cc | [
"BSD-3-Clause"
] | null | null | null | lib/pavilion/expression_functions/base.py | ubccr/pavilion2 | 4c6d043b436761d9162d8824657f51cedc9907cc | [
"BSD-3-Clause"
] | null | null | null | """Contains the base Expression Function plugin class."""
import logging
import re
import inspect
from yapsy import IPlugin
LOGGER = logging.getLogger(__file__)
# The dictionary of available function plugins.
_FUNCTIONS = {} # type: {str,FunctionPlugin}
class FunctionPluginError(RuntimeError):
"""Error raise... | 34.483333 | 79 | 0.556791 |
import logging
import re
import inspect
from yapsy import IPlugin
LOGGER = logging.getLogger(__file__)
_FUNCTIONS = {}
class FunctionPluginError(RuntimeError):
class FunctionArgError(ValueError):
def num(val):
if isinstance(val, (float, int)):
return val
elif val in ('True', 'False'):
... | true | true |
1c494f5029b56fe8b217e4d957810d9edc58d324 | 15,887 | py | Python | model/model.py | eaidova/UNITER | 5b4c9faf8ed922176b20d89ac56a3e0b39374a22 | [
"MIT"
] | 612 | 2020-01-28T00:34:23.000Z | 2022-03-31T00:40:06.000Z | model/model.py | eaidova/UNITER | 5b4c9faf8ed922176b20d89ac56a3e0b39374a22 | [
"MIT"
] | 90 | 2020-02-18T10:54:40.000Z | 2022-03-17T07:36:35.000Z | model/model.py | eaidova/UNITER | 5b4c9faf8ed922176b20d89ac56a3e0b39374a22 | [
"MIT"
] | 114 | 2020-01-31T03:03:25.000Z | 2022-03-17T15:53:51.000Z | """
Copyright (c) Microsoft Corporation.
Licensed under the MIT license.
Pytorch modules
some classes are modified from HuggingFace
(https://github.com/huggingface/transformers)
"""
import copy
import json
import logging
from io import open
import torch
from torch import nn
from apex.normalization.fused_layer_norm im... | 43.171196 | 79 | 0.615031 | import copy
import json
import logging
from io import open
import torch
from torch import nn
from apex.normalization.fused_layer_norm import FusedLayerNorm
from .layer import BertLayer, BertPooler
logger = logging.getLogger(__name__)
class UniterConfig(object):
def __init__(self,
vocab_size_o... | true | true |
1c494fcec0deb185879083532a650364ea510ab7 | 3,911 | py | Python | tools/verify_caffe_model.py | cybercore-co-ltd/Onnx2Caffe | aa4a90b7539e2b5ee0ad42f507021585da58be80 | [
"MIT"
] | 7 | 2020-07-24T22:51:14.000Z | 2021-06-28T05:12:52.000Z | tools/verify_caffe_model.py | cybercore-co-ltd/Onnx2Caffe | aa4a90b7539e2b5ee0ad42f507021585da58be80 | [
"MIT"
] | 6 | 2020-07-23T04:32:06.000Z | 2020-12-28T09:52:40.000Z | tools/verify_caffe_model.py | cybercore-co-ltd/Onnx2Caffe | aa4a90b7539e2b5ee0ad42f507021585da58be80 | [
"MIT"
] | 5 | 2020-07-30T08:19:16.000Z | 2021-06-28T05:12:53.000Z | import argparse
import numpy as np
import onnx
import onnxruntime as rt
import torch
import os
import mmcv
import caffe
from terminaltables import AsciiTable
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('onnx_checkpoint', help='onnx checkpoint file')
parser.add_argument('caffe_... | 28.97037 | 83 | 0.682434 | import argparse
import numpy as np
import onnx
import onnxruntime as rt
import torch
import os
import mmcv
import caffe
from terminaltables import AsciiTable
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('onnx_checkpoint', help='onnx checkpoint file')
parser.add_argument('caffe_... | false | true |
1c495033486807a83992b5b2fcd5ec296570ade8 | 576 | py | Python | code/decision_tree/decision_tree_iris.py | CrazyXiao/machine-learning | 8e1e8cb9cf6f4e1c403873168f2bacbd84a106bd | [
"MIT"
] | 200 | 2019-04-23T01:13:31.000Z | 2021-08-01T07:56:46.000Z | code/decision_tree/decision_tree_iris.py | CrazyXiao/machine-learning | 8e1e8cb9cf6f4e1c403873168f2bacbd84a106bd | [
"MIT"
] | null | null | null | code/decision_tree/decision_tree_iris.py | CrazyXiao/machine-learning | 8e1e8cb9cf6f4e1c403873168f2bacbd84a106bd | [
"MIT"
] | 10 | 2019-04-24T10:18:59.000Z | 2021-04-19T12:58:59.000Z | #!/usr/bin/env python
"""
iris 决策树
"""
from sklearn.datasets import load_iris
from sklearn import tree
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
# 加载数据
iris = load_iris()
X = iris.data
y = iris.target
# 训练集和测试集
X_train, X_test, y_train, y_test = train_test_... | 16.457143 | 72 | 0.767361 |
from sklearn.datasets import load_iris
from sklearn import tree
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
iris = load_iris()
X = iris.data
y = iris.target
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
print(X_train.shape)
classif... | true | true |
1c495055dbaff7ed5a9f296fd48afb316a4ab298 | 1,294 | py | Python | src/web/modules/ejudge/migrations/0004_auto_20160329_1924.py | fossabot/SIStema | 1427dda2082688a9482c117d0e24ad380fdc26a6 | [
"MIT"
] | 5 | 2018-03-08T17:22:27.000Z | 2018-03-11T14:20:53.000Z | src/web/modules/ejudge/migrations/0004_auto_20160329_1924.py | fossabot/SIStema | 1427dda2082688a9482c117d0e24ad380fdc26a6 | [
"MIT"
] | 263 | 2018-03-08T18:05:12.000Z | 2022-03-11T23:26:20.000Z | src/web/modules/ejudge/migrations/0004_auto_20160329_1924.py | fossabot/SIStema | 1427dda2082688a9482c117d0e24ad380fdc26a6 | [
"MIT"
] | 6 | 2018-03-12T19:48:19.000Z | 2022-01-14T04:58:52.000Z | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import djchoices.choices
class Migration(migrations.Migration):
dependencies = [
('ejudge', '0003_auto_20160329_1823'),
]
operations = [
migrations.AddField(
model_name='... | 35.944444 | 256 | 0.616692 |
from __future__ import unicode_literals
from django.db import models, migrations
import djchoices.choices
class Migration(migrations.Migration):
dependencies = [
('ejudge', '0003_auto_20160329_1823'),
]
operations = [
migrations.AddField(
model_name='queueelement',
... | true | true |
1c495283b4a9eb1215b4155542911802987dc8c2 | 151 | py | Python | reallySecureRandom.py | CabraKill/desafio_ford | 9d0f5c5f7396b4fb702df23e8871b9906867d583 | [
"MIT"
] | null | null | null | reallySecureRandom.py | CabraKill/desafio_ford | 9d0f5c5f7396b4fb702df23e8871b9906867d583 | [
"MIT"
] | null | null | null | reallySecureRandom.py | CabraKill/desafio_ford | 9d0f5c5f7396b4fb702df23e8871b9906867d583 | [
"MIT"
] | null | null | null | import random
MIN_NUMBER = 0
MAX_NUMBER = 1000
def randomIntNumber(min: int = MIN_NUMBER, max: int = MAX_NUMBER):
return random.randint(min, max) | 21.571429 | 66 | 0.741722 | import random
MIN_NUMBER = 0
MAX_NUMBER = 1000
def randomIntNumber(min: int = MIN_NUMBER, max: int = MAX_NUMBER):
return random.randint(min, max) | true | true |
1c4952934ed638a6e4875e47806d396365cee9cf | 10,465 | py | Python | pymc3/parallel_sampling.py | acolombi/pymc3 | 3cb45700156b63e786eb70909d3e1d6e1f21703a | [
"Apache-2.0"
] | 1 | 2018-06-11T03:13:00.000Z | 2018-06-11T03:13:00.000Z | pymc3/parallel_sampling.py | acolombi/pymc3 | 3cb45700156b63e786eb70909d3e1d6e1f21703a | [
"Apache-2.0"
] | 2 | 2017-03-02T05:56:13.000Z | 2019-12-06T19:15:42.000Z | pymc3/parallel_sampling.py | acolombi/pymc3 | 3cb45700156b63e786eb70909d3e1d6e1f21703a | [
"Apache-2.0"
] | null | null | null | import multiprocessing
import multiprocessing.sharedctypes
import ctypes
import time
import logging
from collections import namedtuple
import traceback
import six
import numpy as np
from . import theanof
logger = logging.getLogger('pymc3')
# Taken from https://hg.python.org/cpython/rev/c4f92b597074
class RemoteTra... | 31.053412 | 78 | 0.572384 | import multiprocessing
import multiprocessing.sharedctypes
import ctypes
import time
import logging
from collections import namedtuple
import traceback
import six
import numpy as np
from . import theanof
logger = logging.getLogger('pymc3')
class RemoteTraceback(Exception):
def __init__(self, tb):
self... | true | true |
1c4952dfb7b5146c980edaa2ae1af799017e768b | 167 | py | Python | sewer/config.py | prestix-studio/sewer | 67867f778eb92c9c14cd028116f5695b0223baa2 | [
"MIT"
] | 135 | 2017-12-31T22:01:33.000Z | 2022-01-20T18:18:11.000Z | sewer/config.py | prestix-studio/sewer | 67867f778eb92c9c14cd028116f5695b0223baa2 | [
"MIT"
] | 149 | 2018-01-10T10:36:18.000Z | 2021-07-01T16:22:47.000Z | sewer/config.py | prestix-studio/sewer | 67867f778eb92c9c14cd028116f5695b0223baa2 | [
"MIT"
] | 61 | 2018-03-05T16:58:55.000Z | 2021-05-21T01:30:07.000Z | ACME_DIRECTORY_URL_STAGING = "https://acme-staging-v02.api.letsencrypt.org/directory"
ACME_DIRECTORY_URL_PRODUCTION = "https://acme-v02.api.letsencrypt.org/directory"
| 55.666667 | 85 | 0.826347 | ACME_DIRECTORY_URL_STAGING = "https://acme-staging-v02.api.letsencrypt.org/directory"
ACME_DIRECTORY_URL_PRODUCTION = "https://acme-v02.api.letsencrypt.org/directory"
| true | true |
1c4952e55605b55e89e8c96cb5c304d56bad7210 | 2,668 | py | Python | src/send_status.py | Satish615/deep-learning-containers-1 | 76e750e828b6f583a6b7b1c291057059a14285b1 | [
"Apache-2.0"
] | 1 | 2021-12-17T15:50:48.000Z | 2021-12-17T15:50:48.000Z | src/send_status.py | Satish615/deep-learning-containers-1 | 76e750e828b6f583a6b7b1c291057059a14285b1 | [
"Apache-2.0"
] | null | null | null | src/send_status.py | Satish615/deep-learning-containers-1 | 76e750e828b6f583a6b7b1c291057059a14285b1 | [
"Apache-2.0"
] | null | null | null | import os
import argparse
import utils
from github import GitHubHandler
def get_args():
"""
Manage arguments to this script when called directly
"""
parser = argparse.ArgumentParser()
parser.add_argument(
"--status",
choices=["0", "1", "2"],
help="Github status to set. 0 ... | 30.318182 | 122 | 0.664168 | import os
import argparse
import utils
from github import GitHubHandler
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"--status",
choices=["0", "1", "2"],
help="Github status to set. 0 is fail, 1 is success, 2 is pending",
)
return parser.parse_args(... | true | true |
1c49536f4b591e818fca4649372187456dbc31aa | 493 | py | Python | parser/team08/Tytus_SQLPARSER_G8/Instrucciones/Tipo.py | webdev188/tytus | 847071edb17b218f51bb969d335a8ec093d13f94 | [
"MIT"
] | 35 | 2020-12-07T03:11:43.000Z | 2021-04-15T17:38:16.000Z | parser/team08/Tytus_SQLPARSER_G8/Instrucciones/Tipo.py | webdev188/tytus | 847071edb17b218f51bb969d335a8ec093d13f94 | [
"MIT"
] | 47 | 2020-12-09T01:29:09.000Z | 2021-01-13T05:37:50.000Z | parser/team08/Tytus_SQLPARSER_G8/Instrucciones/Tipo.py | webdev188/tytus | 847071edb17b218f51bb969d335a8ec093d13f94 | [
"MIT"
] | 556 | 2020-12-07T03:13:31.000Z | 2021-06-17T17:41:10.000Z | from Instrucciones.TablaSimbolos.Instruccion import Instruccion
class Tipo(Instruccion):
def __init__(self, id, tipo, owner, id2, valor, linea, columna):
Instruccion.__init__(self,tipo,linea,columna)
self.valor = valor
def ejecutar(self, tabla, arbol):
super().ejecutar(tabla,arbol)
... | 30.8125 | 91 | 0.677485 | from Instrucciones.TablaSimbolos.Instruccion import Instruccion
class Tipo(Instruccion):
def __init__(self, id, tipo, owner, id2, valor, linea, columna):
Instruccion.__init__(self,tipo,linea,columna)
self.valor = valor
def ejecutar(self, tabla, arbol):
super().ejecutar(tabla,arbol)
... | true | true |
1c49548ead69b53400104cf9dac0bc4e40c5a598 | 3,709 | py | Python | scripts/setup/generate_secrets.py | GauravVirmani/zulip | 5a204d7c84d60e193f1ea0900d42848c5276a095 | [
"Apache-2.0"
] | null | null | null | scripts/setup/generate_secrets.py | GauravVirmani/zulip | 5a204d7c84d60e193f1ea0900d42848c5276a095 | [
"Apache-2.0"
] | null | null | null | scripts/setup/generate_secrets.py | GauravVirmani/zulip | 5a204d7c84d60e193f1ea0900d42848c5276a095 | [
"Apache-2.0"
] | 1 | 2021-06-10T15:12:52.000Z | 2021-06-10T15:12:52.000Z | #!/usr/bin/env python
# This tools generates /etc/zulip/zulip-secrets.conf
from __future__ import print_function
import sys
import os
import os.path
from os.path import dirname, abspath
if False:
from typing import Dict, Optional, Text
BASE_DIR = dirname(dirname(dirname(abspath(__file__))))
sys.path.append(BASE_D... | 34.342593 | 132 | 0.7134 |
from __future__ import print_function
import sys
import os
import os.path
from os.path import dirname, abspath
if False:
from typing import Dict, Optional, Text
BASE_DIR = dirname(dirname(dirname(abspath(__file__))))
sys.path.append(BASE_DIR)
import scripts.lib.setup_path_on_import
os.environ['DJANGO_SETTINGS_... | true | true |
1c4954dc8435739b2d95abc3a8c025fdebc8c898 | 4,984 | py | Python | tia/tests/test_rlab_table.py | lsternlicht/tia | fe74d1876260a946e52bd733bc32da0698749f2c | [
"BSD-3-Clause"
] | 23 | 2017-11-13T01:05:49.000Z | 2022-03-30T01:38:00.000Z | tia/tests/test_rlab_table.py | lsternlicht/tia | fe74d1876260a946e52bd733bc32da0698749f2c | [
"BSD-3-Clause"
] | 1 | 2018-09-19T21:59:04.000Z | 2018-09-19T21:59:04.000Z | tia/tests/test_rlab_table.py | lsternlicht/tia | fe74d1876260a946e52bd733bc32da0698749f2c | [
"BSD-3-Clause"
] | 13 | 2018-11-26T21:53:36.000Z | 2022-01-09T00:10:27.000Z | import unittest
import pandas as pd
import pandas.util.testing as pdtest
import tia.rlab.table as tbl
class TestTable(unittest.TestCase):
def setUp(self):
self.df1 = df1 = pd.DataFrame({'A': [.55, .65], 'B': [1234., -5678.]}, index=['I1', 'I2'])
# Multi-index frame with multi-index
cols ... | 40.520325 | 123 | 0.552769 | import unittest
import pandas as pd
import pandas.util.testing as pdtest
import tia.rlab.table as tbl
class TestTable(unittest.TestCase):
def setUp(self):
self.df1 = df1 = pd.DataFrame({'A': [.55, .65], 'B': [1234., -5678.]}, index=['I1', 'I2'])
cols = pd.MultiIndex.from_arrays([['LEFT'... | true | true |
1c49550b54ddcb81eae7fc9c5f4d29cbe211b580 | 3,020 | py | Python | samples/tests/create_delete_entity_test.py | dxiao2003/dialogflow-python-client-v2 | 05a1d3f0682de2c7d8c0c4db3fa5fea8934dfe72 | [
"Apache-2.0"
] | 1 | 2019-03-31T23:25:46.000Z | 2019-03-31T23:25:46.000Z | samples/tests/create_delete_entity_test.py | dxiao2003/dialogflow-python-client-v2 | 05a1d3f0682de2c7d8c0c4db3fa5fea8934dfe72 | [
"Apache-2.0"
] | 15 | 2020-01-28T23:14:29.000Z | 2022-02-10T00:40:40.000Z | samples/tests/create_delete_entity_test.py | dxiao2003/dialogflow-python-client-v2 | 05a1d3f0682de2c7d8c0c4db3fa5fea8934dfe72 | [
"Apache-2.0"
] | null | null | null | # Copyright 2017 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 33.555556 | 77 | 0.769536 |
from __future__ import absolute_import
import os
from .. import entity_type_management
from .. import entity_management
PROJECT_ID = os.getenv('GCLOUD_PROJECT')
ENTITY_TYPE_DISPLAY_NAME = 'fake_entity_type_for_testing'
ENTITY_VALUE_1 = 'fake_entity_for_testing_1'
ENTITY_VALUE_2 = 'fake_entity_for_testin... | true | true |
1c4956b1aa878124dc5b391c52167a788f947529 | 10,521 | py | Python | trac/loader.py | netjunki/trac | db1015b33aa440ffcfd91689b8dcbb43db8e2a28 | [
"BSD-3-Clause"
] | 1 | 2017-08-03T07:04:40.000Z | 2017-08-03T07:04:40.000Z | trac/loader.py | trac-ja/trac-ja | 8defc74c222e3dbe154dfb5eb34e8c1a1f663558 | [
"BSD-3-Clause"
] | null | null | null | trac/loader.py | trac-ja/trac-ja | 8defc74c222e3dbe154dfb5eb34e8c1a1f663558 | [
"BSD-3-Clause"
] | 1 | 2021-02-16T09:00:13.000Z | 2021-02-16T09:00:13.000Z | # -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2009 Edgewall Software
# Copyright (C) 2005-2006 Christopher Lenz <cmlenz@gmx.de>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://... | 42.084 | 80 | 0.550708 |
from glob import glob
import imp
import os.path
import pkg_resources
from pkg_resources import working_set, DistributionNotFound, VersionConflict, \
UnknownExtra
import sys
from trac.util import get_doc, get_module_path, get_sources, get_pkginfo
from trac.util.text import exce... | false | true |
1c495713f2d7d3192ab5567d3b26f08e034a69eb | 11,617 | py | Python | pyabsa/core/apc/classic/__bert__/dataset_utils/data_utils_for_training.py | onlyrico/PyABSA | d0905eb5253eaa564d2244cd777e3a734bca777a | [
"MIT"
] | null | null | null | pyabsa/core/apc/classic/__bert__/dataset_utils/data_utils_for_training.py | onlyrico/PyABSA | d0905eb5253eaa564d2244cd777e3a734bca777a | [
"MIT"
] | null | null | null | pyabsa/core/apc/classic/__bert__/dataset_utils/data_utils_for_training.py | onlyrico/PyABSA | d0905eb5253eaa564d2244cd777e3a734bca777a | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# file: data_utils.py
# author: songyouwei <youwei0314@gmail.com>
# Copyright (C) 2018. All Rights Reserved.
import os
import pickle
import numpy as np
import tqdm
from findfile import find_file
from google_drive_downloader.google_drive_downloader import GoogleDriveDownloader as gdd
from torch... | 44.003788 | 120 | 0.627615 |
import os
import pickle
import numpy as np
import tqdm
from findfile import find_file
from google_drive_downloader.google_drive_downloader import GoogleDriveDownloader as gdd
from torch.utils.data import Dataset
from transformers import AutoTokenizer
from pyabsa.core.apc.classic.__glove__.dataset_utils.dependenc... | true | true |
1c49582dab9e0f3c90ba1de50ff9860965a98b5d | 421 | py | Python | labs/4.1/server.py | alexellis/docker-blinkt-workshop | ae2204bbc85658b111e864ae4b39b05583eb4ebf | [
"MIT"
] | 171 | 2017-04-10T19:09:36.000Z | 2022-03-04T16:06:30.000Z | labs/4.1/server.py | mcne65/docker-blinkt-workshop | ae2204bbc85658b111e864ae4b39b05583eb4ebf | [
"MIT"
] | 4 | 2017-04-17T19:33:46.000Z | 2017-08-02T17:46:18.000Z | labs/4.1/server.py | mcne65/docker-blinkt-workshop | ae2204bbc85658b111e864ae4b39b05583eb4ebf | [
"MIT"
] | 30 | 2017-04-17T19:03:54.000Z | 2022-03-04T16:06:31.000Z | from flask import Flask, request, render_template
import json
app = Flask(__name__)
@app.route('/', methods=['GET'])
def home():
file = open("/sys/class/thermal/thermal_zone0/temp")
data = file.read().rstrip() # remove trailing '\n' newline character.
file.close()
payload = json.dumps({ "temperature": ... | 26.3125 | 73 | 0.657957 | from flask import Flask, request, render_template
import json
app = Flask(__name__)
@app.route('/', methods=['GET'])
def home():
file = open("/sys/class/thermal/thermal_zone0/temp")
data = file.read().rstrip()
file.close()
payload = json.dumps({ "temperature": data })
return payload
if __name... | true | true |
1c4958fcf0f982431d31d142ff78a7ab416fc6e0 | 10,841 | py | Python | docs/source/conf.py | wlad111/pymc3 | 43432834be5bbca72caa32d40a848515eea554a8 | [
"Apache-2.0"
] | null | null | null | docs/source/conf.py | wlad111/pymc3 | 43432834be5bbca72caa32d40a848515eea554a8 | [
"Apache-2.0"
] | null | null | null | docs/source/conf.py | wlad111/pymc3 | 43432834be5bbca72caa32d40a848515eea554a8 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# pymc3_ext documentation build configuration file, created by
# sphinx-quickstart on Sat Dec 26 14:40:23 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# ... | 32.555556 | 128 | 0.705009 |
import sys
import os
import pymc3_ext
sys.path.insert(0, os.path.abspath(os.path.join("..", "..")))
sys.path.insert(0, os.path.abspath("sphinxext"))
extensions = [
"matplotlib.sphinxext.plot_directive",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.mathjax",
... | true | true |
1c495b77063d3e04fd1ff7e97fe4f6361eba5132 | 834 | py | Python | Chapter06/example4.py | jpgacrama/Mastering-Concurrency-in-Python | 3033840fe9b36320ba41a4f23a7d5284d0e47e7c | [
"MIT"
] | null | null | null | Chapter06/example4.py | jpgacrama/Mastering-Concurrency-in-Python | 3033840fe9b36320ba41a4f23a7d5284d0e47e7c | [
"MIT"
] | null | null | null | Chapter06/example4.py | jpgacrama/Mastering-Concurrency-in-Python | 3033840fe9b36320ba41a4f23a7d5284d0e47e7c | [
"MIT"
] | null | null | null | # ch6/example4.py
from multiprocessing import Process, current_process
import time
from os import system, name
def f1():
p = current_process()
print('Starting process %s, ID %s...' % (p.name, p.pid))
time.sleep(4)
print('Exiting process %s, ID %s...' % (p.name, p.pid))
def f2():
p = current_proce... | 22.540541 | 60 | 0.577938 |
from multiprocessing import Process, current_process
import time
from os import system, name
def f1():
p = current_process()
print('Starting process %s, ID %s...' % (p.name, p.pid))
time.sleep(4)
print('Exiting process %s, ID %s...' % (p.name, p.pid))
def f2():
p = current_process()
print('S... | true | true |
1c495d19aad684be7ab6647d0bbb9cc56a933309 | 218 | py | Python | src/packages/play_text.py | Tpool1/Asclepius | 760ab31a8933772faa76064a42b11ab6e12d6c9a | [
"MIT"
] | null | null | null | src/packages/play_text.py | Tpool1/Asclepius | 760ab31a8933772faa76064a42b11ab6e12d6c9a | [
"MIT"
] | null | null | null | src/packages/play_text.py | Tpool1/Asclepius | 760ab31a8933772faa76064a42b11ab6e12d6c9a | [
"MIT"
] | null | null | null | import pyttsx3
from packages.write_conversation_data import write_conversation_data
def play_text(text):
engine = pyttsx3.init()
engine.say(text)
engine.runAndWait()
write_conversation_data(text)
| 21.8 | 68 | 0.761468 | import pyttsx3
from packages.write_conversation_data import write_conversation_data
def play_text(text):
engine = pyttsx3.init()
engine.say(text)
engine.runAndWait()
write_conversation_data(text)
| true | true |
1c495f1161e27118531d15882e1e5c93d9149524 | 3,826 | py | Python | Airplane/chap10/autopilot.py | eyler94/ee674AirplaneSim | 3ba2c6e685c2688a7f372475a7cd1f55f583d10e | [
"MIT"
] | 1 | 2020-06-07T00:14:42.000Z | 2020-06-07T00:14:42.000Z | Submarine/chap10/autopilot.py | eyler94/ee674AirplaneSim | 3ba2c6e685c2688a7f372475a7cd1f55f583d10e | [
"MIT"
] | null | null | null | Submarine/chap10/autopilot.py | eyler94/ee674AirplaneSim | 3ba2c6e685c2688a7f372475a7cd1f55f583d10e | [
"MIT"
] | 1 | 2019-06-24T22:10:48.000Z | 2019-06-24T22:10:48.000Z | """
autopilot block for mavsim_python
- Beard & McLain, PUP, 2012
- Last Update:
2/6/2019 - RWB
"""
import sys
import numpy as np
sys.path.append('..')
import parameters.control_parameters as AP
from chap6.pid_controlBrendon import pid_control#, pi_control, pd_control_with_rate
from message_types.msg_st... | 40.273684 | 133 | 0.575536 | import sys
import numpy as np
sys.path.append('..')
import parameters.control_parameters as AP
from chap6.pid_controlBrendon import pid_control
from message_types.msg_state import msg_state
from tools.tools import Euler2Quaternion, Quaternion2Euler
from control import matlab
class autopilot:
def __init__(self, ts... | true | true |
1c4960629fe2ffb245ea6b44937e597dbeb76aeb | 178 | py | Python | rund.py | devvspaces/mailfinder | a4d50a0d3bf80741e33df69c74c94daffebc435b | [
"MIT"
] | null | null | null | rund.py | devvspaces/mailfinder | a4d50a0d3bf80741e33df69c74c94daffebc435b | [
"MIT"
] | null | null | null | rund.py | devvspaces/mailfinder | a4d50a0d3bf80741e33df69c74c94daffebc435b | [
"MIT"
] | null | null | null | import re
with open('test.csv','r') as f:
response = f.read()
new_emails = set(re.findall(r"[a-z0-9\.\-+_]+@[a-z0-9\.\-+_]+\.com", response, re.I))
print(new_emails) | 29.666667 | 89 | 0.573034 | import re
with open('test.csv','r') as f:
response = f.read()
new_emails = set(re.findall(r"[a-z0-9\.\-+_]+@[a-z0-9\.\-+_]+\.com", response, re.I))
print(new_emails) | true | true |
1c496072aafd1dbd2e7caef2c92a7a1ad00fdb4b | 403 | py | Python | recipes/construct_webapp_class_manually.py | ammarsys/pyanywhere-wrapper | d8cde2d29900c25fc7ab3cd8103923f727b5dade | [
"MIT"
] | 5 | 2021-06-25T14:34:52.000Z | 2021-07-04T14:15:13.000Z | recipes/construct_webapp_class_manually.py | ammarsys/pyanywhere-wrapper | d8cde2d29900c25fc7ab3cd8103923f727b5dade | [
"MIT"
] | 1 | 2021-12-12T00:47:25.000Z | 2022-01-24T17:19:43.000Z | recipes/construct_webapp_class_manually.py | ammarsys/pyanywhere-wrapper | d8cde2d29900c25fc7ab3cd8103923f727b5dade | [
"MIT"
] | 1 | 2021-12-14T15:44:52.000Z | 2021-12-14T15:44:52.000Z | from pyaww.webapp import WebApp
my_webapp = WebApp(
{'id': 123,
'user': 'sampleuser',
'domain_name': 'something.com',
'python_version': '3.8',
'source_directory': '/home/something/',
'working_directory': '/home/something/',
'virtualenv_path': '/home/something/venv',
'expiry': 'so... | 25.1875 | 47 | 0.620347 | from pyaww.webapp import WebApp
my_webapp = WebApp(
{'id': 123,
'user': 'sampleuser',
'domain_name': 'something.com',
'python_version': '3.8',
'source_directory': '/home/something/',
'working_directory': '/home/something/',
'virtualenv_path': '/home/something/venv',
'expiry': 'so... | true | true |
1c4961378a4b0a0bdb51ede423c33dd48070c102 | 10,890 | py | Python | templates/games.py | tiendat101001/PythonProgrammingPuzzles | e4a6504bf783ad1ab93686cedd5d1818af92a5e4 | [
"MIT"
] | null | null | null | templates/games.py | tiendat101001/PythonProgrammingPuzzles | e4a6504bf783ad1ab93686cedd5d1818af92a5e4 | [
"MIT"
] | null | null | null | templates/games.py | tiendat101001/PythonProgrammingPuzzles | e4a6504bf783ad1ab93686cedd5d1818af92a5e4 | [
"MIT"
] | null | null | null | """
Solve some two-player games
"""
from problems import Problem
from typing import List
# Hint: subclass Problem.Debug for quick testing. Run make_dataset.py to make the dataset
# See https://github.com/microsoft/PythonProgrammingPuzzles/wiki/How-to-add-a-puzzle for more info
class Nim(Problem):
"""Compute op... | 38.34507 | 120 | 0.559963 |
from problems import Problem
from typing import List
class Nim(Problem):
timeout = 10
@staticmethod
def sat(cert: List[List[int]], heaps=[5, 9]):
good_leaves = {tuple(h) for h in cert}
cache = {}
def is_good_leave(h):
if h in cache:
return ... | true | true |
1c4962bf3e816c1cf57f29913651635757597c12 | 6,853 | py | Python | cogs/tag.py | theoxan/BC_HelperBot | 0d34d6364588b5649ef4689727197e1cc8a63d36 | [
"Apache-2.0"
] | null | null | null | cogs/tag.py | theoxan/BC_HelperBot | 0d34d6364588b5649ef4689727197e1cc8a63d36 | [
"Apache-2.0"
] | null | null | null | cogs/tag.py | theoxan/BC_HelperBot | 0d34d6364588b5649ef4689727197e1cc8a63d36 | [
"Apache-2.0"
] | null | null | null | import os
from os import path
import json
from difflib import SequenceMatcher
import discord
from discord.ext import commands
from schema import SchemaError
from .utils.misc import tag_shema
from .utils import checkers, misc
class Tag(commands.Cog):
def __init__(self, bot):
self.bot = bot
tags_... | 44.79085 | 229 | 0.569678 | import os
from os import path
import json
from difflib import SequenceMatcher
import discord
from discord.ext import commands
from schema import SchemaError
from .utils.misc import tag_shema
from .utils import checkers, misc
class Tag(commands.Cog):
def __init__(self, bot):
self.bot = bot
tags_... | true | true |
1c4962dc7ba607d9e75b274ac8278eb1eb299cef | 1,718 | py | Python | Projects/Online Workouts/w3resource/Basic - Part-II/program-29.py | ivenpoker/Python-Projects | 2975e1bd687ec8dbcc7a4842c13466cb86292679 | [
"MIT"
] | 1 | 2019-09-23T15:51:45.000Z | 2019-09-23T15:51:45.000Z | Projects/Online Workouts/w3resource/Basic - Part-II/program-29.py | ivenpoker/Python-Projects | 2975e1bd687ec8dbcc7a4842c13466cb86292679 | [
"MIT"
] | 5 | 2021-02-08T20:47:19.000Z | 2022-03-12T00:35:44.000Z | Projects/Online Workouts/w3resource/Basic - Part-II/program-29.py | ivenpoker/Python-Projects | 2975e1bd687ec8dbcc7a4842c13466cb86292679 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
#############################################################################
# #
# Program purpose: Find common divisor between two numbers in a given #
# pair. ... | 31.236364 | 77 | 0.438882 | true | true | |
1c49648eb9b542c70be44a372ce24b2211d6407b | 777 | py | Python | yoti_python_sdk/doc_scan/session/retrieve/document_id_photo_response.py | getyoti/python | 3df169145d5c818d0e79743768dde78e482eec9b | [
"MIT"
] | 9 | 2017-11-12T05:38:58.000Z | 2021-08-04T16:33:26.000Z | yoti_python_sdk/doc_scan/session/retrieve/document_id_photo_response.py | getyoti/python | 3df169145d5c818d0e79743768dde78e482eec9b | [
"MIT"
] | 237 | 2017-04-26T09:40:44.000Z | 2022-02-24T10:29:43.000Z | yoti_python_sdk/doc_scan/session/retrieve/document_id_photo_response.py | getyoti/python | 3df169145d5c818d0e79743768dde78e482eec9b | [
"MIT"
] | 9 | 2017-05-02T11:41:44.000Z | 2021-04-28T13:49:20.000Z | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from yoti_python_sdk.doc_scan.session.retrieve.media_response import MediaResponse
class DocumentIdPhotoResponse(object):
"""
Represents the document ID photo response
"""
def __init__(self, data=None):
"""
:param data: ... | 22.852941 | 82 | 0.584299 |
from __future__ import unicode_literals
from yoti_python_sdk.doc_scan.session.retrieve.media_response import MediaResponse
class DocumentIdPhotoResponse(object):
def __init__(self, data=None):
if data is None:
data = dict()
if "media" in data.keys():
self.__media = Medi... | true | true |
1c49663cca5de7c6f1eee0f2b738acf05391f261 | 6,920 | py | Python | gcpdiag/queries/logs.py | taylorjstacey/gcpdiag | 84ba1725cd3ed326b8da3e64bdd6569ed7ef20a4 | [
"Apache-2.0"
] | null | null | null | gcpdiag/queries/logs.py | taylorjstacey/gcpdiag | 84ba1725cd3ed326b8da3e64bdd6569ed7ef20a4 | [
"Apache-2.0"
] | null | null | null | gcpdiag/queries/logs.py | taylorjstacey/gcpdiag | 84ba1725cd3ed326b8da3e64bdd6569ed7ef20a4 | [
"Apache-2.0"
] | null | null | null | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 35.854922 | 82 | 0.702601 |
import concurrent.futures
import dataclasses
import datetime
import logging
from typing import Any, Dict, Mapping, Optional, Sequence, Set, Tuple
import dateutil.parser
import ratelimit
from gcpdiag import caching, config
from gcpdiag.queries import apis
@dataclasses.dataclass
class _LogsQueryJob:
... | true | true |
1c49666b9c4d832f37834fa730f66dc1774b3e18 | 1,174 | py | Python | Adafruit_DHT/__init__.py | HydAu/Adafruit_Python_DHT | 9e8109bb4ab5ec9127e53e792c1f69eddfd2f687 | [
"MIT"
] | 1 | 2015-11-17T15:05:13.000Z | 2015-11-17T15:05:13.000Z | Adafruit_DHT/__init__.py | HydAu/Adafruit_Python_DHT | 9e8109bb4ab5ec9127e53e792c1f69eddfd2f687 | [
"MIT"
] | null | null | null | Adafruit_DHT/__init__.py | HydAu/Adafruit_Python_DHT | 9e8109bb4ab5ec9127e53e792c1f69eddfd2f687 | [
"MIT"
] | 1 | 2016-02-14T11:59:45.000Z | 2016-02-14T11:59:45.000Z | # Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mo... | 55.904762 | 80 | 0.783646 |
from common import DHT11, DHT22, AM2302, read, read_retry | true | true |
1c4966ade42aaa97510f7628a11791f6090266df | 123 | py | Python | game/admin.py | 0xecho/2048-er | 732f9c250f8cb632068a93d4622d9f7d2f65a147 | [
"MIT"
] | 5 | 2021-10-04T15:38:58.000Z | 2021-12-30T07:43:30.000Z | game/admin.py | 0xecho/2048-er | 732f9c250f8cb632068a93d4622d9f7d2f65a147 | [
"MIT"
] | null | null | null | game/admin.py | 0xecho/2048-er | 732f9c250f8cb632068a93d4622d9f7d2f65a147 | [
"MIT"
] | null | null | null | from django.contrib import admin
from . import models
# Register your models here.
admin.site.register(models.Submission) | 20.5 | 38 | 0.804878 | from django.contrib import admin
from . import models
admin.site.register(models.Submission) | true | true |
1c496702676689a5a25c37ec1873b560deec1093 | 18,565 | py | Python | ucscsdk/mometa/license/LicenseDownloader.py | parag-may4/ucscsdk | 2ea762fa070330e3a4e2c21b46b157469555405b | [
"Apache-2.0"
] | 9 | 2016-12-22T08:39:25.000Z | 2019-09-10T15:36:19.000Z | ucscsdk/mometa/license/LicenseDownloader.py | parag-may4/ucscsdk | 2ea762fa070330e3a4e2c21b46b157469555405b | [
"Apache-2.0"
] | 10 | 2017-01-31T06:59:56.000Z | 2021-11-09T09:14:37.000Z | ucscsdk/mometa/license/LicenseDownloader.py | parag-may4/ucscsdk | 2ea762fa070330e3a4e2c21b46b157469555405b | [
"Apache-2.0"
] | 13 | 2016-11-14T07:42:58.000Z | 2022-02-10T17:32:05.000Z | """This module contains the general information for LicenseDownloader ManagedObject."""
from ...ucscmo import ManagedObject
from ...ucsccoremeta import UcscVersion, MoPropertyMeta, MoMeta
from ...ucscmeta import VersionMeta
class LicenseDownloaderConsts():
ADMIN_STATE_IDLE = "idle"
ADMIN_STATE_RESTART = "res... | 86.348837 | 2,742 | 0.752707 |
from ...ucscmo import ManagedObject
from ...ucsccoremeta import UcscVersion, MoPropertyMeta, MoMeta
from ...ucscmeta import VersionMeta
class LicenseDownloaderConsts():
ADMIN_STATE_IDLE = "idle"
ADMIN_STATE_RESTART = "restart"
FSM_PREV_DOWNLOAD_BEGIN = "DownloadBegin"
FSM_PREV_DOWNLOAD_DELETE_LOCAL =... | true | true |
1c496867149d9c74d5f66efd40cf073fe0da023f | 22,149 | py | Python | critiquebrainz/frontend/views/review.py | akshaaatt/critiquebrainz | 39184152af5f23adaa991c4b43ecbbb6f086f809 | [
"Apache-2.0"
] | 70 | 2015-03-10T00:08:21.000Z | 2022-02-20T05:36:53.000Z | critiquebrainz/frontend/views/review.py | akshaaatt/critiquebrainz | 39184152af5f23adaa991c4b43ecbbb6f086f809 | [
"Apache-2.0"
] | 279 | 2015-12-08T14:10:45.000Z | 2022-03-29T13:54:23.000Z | critiquebrainz/frontend/views/review.py | akshaaatt/critiquebrainz | 39184152af5f23adaa991c4b43ecbbb6f086f809 | [
"Apache-2.0"
] | 95 | 2015-03-12T21:39:42.000Z | 2022-03-10T00:51:04.000Z | from math import ceil
from brainzutils.musicbrainz_db.exceptions import NoDataFoundException
from flask import Blueprint, render_template, request, redirect, url_for, jsonify
from flask_babel import gettext, get_locale, lazy_gettext
from flask_login import login_required, current_user
from langdetect import detect
fro... | 45.202041 | 123 | 0.678676 | from math import ceil
from brainzutils.musicbrainz_db.exceptions import NoDataFoundException
from flask import Blueprint, render_template, request, redirect, url_for, jsonify
from flask_babel import gettext, get_locale, lazy_gettext
from flask_login import login_required, current_user
from langdetect import detect
fro... | true | true |
1c496954c9ff5125c6093492798868e790e4c9d0 | 1,004 | py | Python | framework/modelhublib/imageconverters/sitkToNumpyConverter.py | modelhub-ai/modelhub-engine | 81e893fb7669ee9912178346efbf828dd8c0410b | [
"MIT"
] | 6 | 2018-10-13T10:11:51.000Z | 2022-02-21T08:28:10.000Z | framework/modelhublib/imageconverters/sitkToNumpyConverter.py | modelhub-ai/modelhub-docker | 81e893fb7669ee9912178346efbf828dd8c0410b | [
"MIT"
] | 34 | 2018-03-06T16:25:10.000Z | 2018-06-26T21:55:13.000Z | framework/modelhublib/imageconverters/sitkToNumpyConverter.py | modelhub-ai/modelhub-engine | 81e893fb7669ee9912178346efbf828dd8c0410b | [
"MIT"
] | 3 | 2019-08-15T18:09:32.000Z | 2022-02-16T07:55:27.000Z | import SimpleITK
import numpy as np
from .imageConverter import ImageConverter
class SitkToNumpyConverter(ImageConverter):
"""
Converts SimpltITK.Image objects to Numpy
"""
def _convert(self, image):
"""
Args:
image (SimpleITK.Image): Image object to convert.
... | 27.888889 | 109 | 0.615538 | import SimpleITK
import numpy as np
from .imageConverter import ImageConverter
class SitkToNumpyConverter(ImageConverter):
def _convert(self, image):
if isinstance(image, SimpleITK.Image):
return self.__convertToNumpy(image)
else:
raise IOError("Image is not of type \"Sim... | true | true |
1c49697d08ff8fc6969f3ffb49a5cca3fa09e575 | 6,405 | py | Python | code/05-soz_subgraph.py | akashpattnaik/pre-ictal-similarity | 85f963aa0c6d2d0a6e971ffa005c400e136a0a76 | [
"MIT"
] | null | null | null | code/05-soz_subgraph.py | akashpattnaik/pre-ictal-similarity | 85f963aa0c6d2d0a6e971ffa005c400e136a0a76 | [
"MIT"
] | null | null | null | code/05-soz_subgraph.py | akashpattnaik/pre-ictal-similarity | 85f963aa0c6d2d0a6e971ffa005c400e136a0a76 | [
"MIT"
] | null | null | null | # %%
# %load_ext autoreload
# %autoreload 2
# Imports and environment setup
import numpy as np
import sys
import os
from numpy.core.fromnumeric import sort
import pandas as pd
import json
from scipy.io import loadmat
import matplotlib.pyplot as plt
from tqdm import tqdm
from os.path import join as ospj
from scipy.stats... | 38.584337 | 143 | 0.735207 |
import numpy as np
import sys
import os
from numpy.core.fromnumeric import sort
import pandas as pd
import json
from scipy.io import loadmat
import matplotlib.pyplot as plt
from tqdm import tqdm
from os.path import join as ospj
from scipy.stats import zscore
import time
from kneed import KneeLocator
from scipy.stat... | true | true |
1c4969f2e22ab20faedf093583573663bfaa39a7 | 2,013 | py | Python | services/backend/thiamsu/forms.py | LKKTGB/thiamsu | f08d453c6b35c801c57f2501e42565da56900814 | [
"MIT"
] | 10 | 2020-08-25T08:57:36.000Z | 2021-12-31T01:04:18.000Z | services/backend/thiamsu/forms.py | LKKTGB/thiamsu | f08d453c6b35c801c57f2501e42565da56900814 | [
"MIT"
] | 13 | 2020-04-26T08:41:30.000Z | 2021-06-10T17:34:25.000Z | services/backend/thiamsu/forms.py | LKKTGB/thiamsu | f08d453c6b35c801c57f2501e42565da56900814 | [
"MIT"
] | 1 | 2020-09-06T17:54:13.000Z | 2020-09-06T17:54:13.000Z | from django import forms
from django.forms import formset_factory
from django.forms.formsets import BaseFormSet
from django.forms.widgets import HiddenInput
from thiamsu.utils import get_youtube_id_from_url
class SongAdminForm(forms.ModelForm):
def clean_youtube_url(self):
youtube_id = get_youtube_id_fro... | 33.55 | 78 | 0.682067 | from django import forms
from django.forms import formset_factory
from django.forms.formsets import BaseFormSet
from django.forms.widgets import HiddenInput
from thiamsu.utils import get_youtube_id_from_url
class SongAdminForm(forms.ModelForm):
def clean_youtube_url(self):
youtube_id = get_youtube_id_fro... | true | true |
1c496b2598cdfd5fc69e5d28a1e867bb4e332220 | 2,682 | py | Python | tests/test_16_cc_oauth2_service.py | peppelinux/JWTConnect-Python-OidcService | af979f45666bc47b62c69ddcbb199a15c7b96597 | [
"Apache-2.0"
] | 1 | 2020-09-30T13:07:46.000Z | 2020-09-30T13:07:46.000Z | tests/test_16_cc_oauth2_service.py | peppelinux/JWTConnect-Python-OidcService | af979f45666bc47b62c69ddcbb199a15c7b96597 | [
"Apache-2.0"
] | null | null | null | tests/test_16_cc_oauth2_service.py | peppelinux/JWTConnect-Python-OidcService | af979f45666bc47b62c69ddcbb199a15c7b96597 | [
"Apache-2.0"
] | null | null | null | import pytest
from oidcservice.service_factory import service_factory
from oidcservice.service_context import ServiceContext
from oidcservice.state_interface import InMemoryStateDataBase
KEYDEF = [{"type": "EC", "crv": "P-256", "use": ["sig"]}]
class TestRP():
@pytest.fixture(autouse=True)
def create_servic... | 41.90625 | 77 | 0.568978 | import pytest
from oidcservice.service_factory import service_factory
from oidcservice.service_context import ServiceContext
from oidcservice.state_interface import InMemoryStateDataBase
KEYDEF = [{"type": "EC", "crv": "P-256", "use": ["sig"]}]
class TestRP():
@pytest.fixture(autouse=True)
def create_servic... | true | true |
1c496c2139c67302856260e7708094386979d059 | 1,100 | py | Python | src/txamqp/test/test_heartbeat.py | sbraz/txamqp | 10caf998dd8c05a7321cd10c24a83832bf58bd0c | [
"Apache-2.0"
] | 17 | 2016-12-20T13:21:18.000Z | 2021-09-22T07:44:15.000Z | src/txamqp/test/test_heartbeat.py | sbraz/txamqp | 10caf998dd8c05a7321cd10c24a83832bf58bd0c | [
"Apache-2.0"
] | 13 | 2017-07-05T07:52:33.000Z | 2022-03-25T10:14:15.000Z | src/txamqp/test/test_heartbeat.py | sbraz/txamqp | 10caf998dd8c05a7321cd10c24a83832bf58bd0c | [
"Apache-2.0"
] | 12 | 2017-06-27T18:48:20.000Z | 2021-02-15T12:22:11.000Z | from twisted.internet import reactor
from twisted.internet.defer import Deferred
from txamqp.testlib import TestBase
from txamqp.protocol import AMQClient
class SpyAMQClient(AMQClient):
called_reschedule_check = 0
called_send_hb = 0
def reschedule_check_heartbeat(self, dummy=None):
AMQClient.res... | 27.5 | 107 | 0.690909 | from twisted.internet import reactor
from twisted.internet.defer import Deferred
from txamqp.testlib import TestBase
from txamqp.protocol import AMQClient
class SpyAMQClient(AMQClient):
called_reschedule_check = 0
called_send_hb = 0
def reschedule_check_heartbeat(self, dummy=None):
AMQClient.res... | true | true |
1c496c2c582376bc0e7ee6a044286bdeda0d3676 | 25,695 | py | Python | tools/management/commands/upload_excel_bias.py | protwis/protwis | da9a455499343ab4e12902b99dcc259cda4a8d38 | [
"Apache-2.0"
] | 21 | 2016-01-20T09:33:14.000Z | 2021-12-20T19:19:45.000Z | tools/management/commands/upload_excel_bias.py | protwis/protwis | da9a455499343ab4e12902b99dcc259cda4a8d38 | [
"Apache-2.0"
] | 75 | 2016-02-26T16:29:58.000Z | 2022-03-21T12:35:13.000Z | tools/management/commands/upload_excel_bias.py | protwis/protwis | da9a455499343ab4e12902b99dcc259cda4a8d38 | [
"Apache-2.0"
] | 77 | 2016-01-22T08:44:26.000Z | 2022-02-01T15:54:56.000Z | from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from django.db import connection
from django.db import IntegrityError
from django.utils.text import slugify
from django.http import HttpResponse, JsonResponse
from decimal import Decimal
from build.management.commands.bas... | 39.96112 | 185 | 0.521502 | from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from django.db import connection
from django.db import IntegrityError
from django.utils.text import slugify
from django.http import HttpResponse, JsonResponse
from decimal import Decimal
from build.management.commands.bas... | true | true |
1c496c984a5305a874109d556f037a1da44afd9d | 363 | py | Python | Day01-15/code/Day15/pdf2.py | EngrSaad2/Python-100-Days | ab0b26714b1df50d02a1433dc82f2a3fb025be5c | [
"Apache-2.0"
] | 6 | 2020-04-22T14:07:51.000Z | 2021-09-07T12:55:23.000Z | Day01-15/code/Day15/pdf2.py | 2462612540/Python-Language | a676d1274a04ff03f1aea0de9c58019d6ef8f5fe | [
"Apache-2.0"
] | null | null | null | Day01-15/code/Day15/pdf2.py | 2462612540/Python-Language | a676d1274a04ff03f1aea0de9c58019d6ef8f5fe | [
"Apache-2.0"
] | 4 | 2019-08-25T05:51:00.000Z | 2021-04-16T08:14:16.000Z | """
读取PDF文件
Version: 0.1
Author: 骆昊
Date: 2018-03-26
"""
from PyPDF2 import PdfFileReader
with open('./res/Python课程大纲.pdf', 'rb') as f:
reader = PdfFileReader(f, strict=False)
print(reader.numPages)
if reader.isEncrypted:
reader.decrypt('')
current_page = reader.getPage(5)
print(current_p... | 19.105263 | 45 | 0.680441 |
from PyPDF2 import PdfFileReader
with open('./res/Python课程大纲.pdf', 'rb') as f:
reader = PdfFileReader(f, strict=False)
print(reader.numPages)
if reader.isEncrypted:
reader.decrypt('')
current_page = reader.getPage(5)
print(current_page)
print(current_page.extractText())
| true | true |
1c496ca75c47d276175856efd760bf5ff55c3465 | 547 | py | Python | augment/aug_insert_junk_chars.py | biubiubiiu/SpamClassification | c7159c77baf5f1ba09ce1af9fc0f7e0c10332864 | [
"Apache-2.0"
] | null | null | null | augment/aug_insert_junk_chars.py | biubiubiiu/SpamClassification | c7159c77baf5f1ba09ce1af9fc0f7e0c10332864 | [
"Apache-2.0"
] | null | null | null | augment/aug_insert_junk_chars.py | biubiubiiu/SpamClassification | c7159c77baf5f1ba09ce1af9fc0f7e0c10332864 | [
"Apache-2.0"
] | 1 | 2022-03-01T13:10:46.000Z | 2022-03-01T13:10:46.000Z | import random
from resources import list_junk_charaters
from .base_operation import BaseOperation
class InsertJunkCharacters(BaseOperation):
"""Insert meaningless a character into text"""
def __init__(self):
super(InsertJunkCharacters, self).__init__()
self.junk_chars = list_junk_charaters()... | 26.047619 | 55 | 0.694698 | import random
from resources import list_junk_charaters
from .base_operation import BaseOperation
class InsertJunkCharacters(BaseOperation):
def __init__(self):
super(InsertJunkCharacters, self).__init__()
self.junk_chars = list_junk_charaters()
def can_replace(self, s):
return True... | true | true |
1c496dfc9ef80a210ba798d35c3fe379edc60e8a | 5,072 | py | Python | server/server.py | TwistedSim/CoupIO | f517fb52b0b1050066d60fd0b389238e247cc90f | [
"MIT"
] | 3 | 2020-12-07T00:03:26.000Z | 2020-12-07T01:51:27.000Z | server/server.py | TwistedSim/CoupIO | f517fb52b0b1050066d60fd0b389238e247cc90f | [
"MIT"
] | null | null | null | server/server.py | TwistedSim/CoupIO | f517fb52b0b1050066d60fd0b389238e247cc90f | [
"MIT"
] | 1 | 2020-12-05T17:35:16.000Z | 2020-12-05T17:35:16.000Z | import asyncio
import inspect
import socketio
import random
from typing import Type
from games.game_interface import GameInterface, Game
class Server(socketio.AsyncNamespace):
current_games = {}
game_class = None
sio = None
start_lock = asyncio.Lock()
@classmethod
def configure(cls, sio: ... | 44.104348 | 126 | 0.638604 | import asyncio
import inspect
import socketio
import random
from typing import Type
from games.game_interface import GameInterface, Game
class Server(socketio.AsyncNamespace):
current_games = {}
game_class = None
sio = None
start_lock = asyncio.Lock()
@classmethod
def configure(cls, sio: ... | true | true |
1c496fe67e0d21c3e64a5837cd6d0721b4b6ee09 | 1,189 | py | Python | tests/gogs_tools_tests/test_gogs_utils.py | mondele/tx-manager | ddbbeeae5990a327ffc14b42c478d3ea435c0533 | [
"MIT"
] | 3 | 2017-03-17T02:25:21.000Z | 2017-05-18T22:18:20.000Z | tests/gogs_tools_tests/test_gogs_utils.py | mondele/tx-manager | ddbbeeae5990a327ffc14b42c478d3ea435c0533 | [
"MIT"
] | 184 | 2016-10-13T02:56:16.000Z | 2021-03-25T21:27:20.000Z | tests/gogs_tools_tests/test_gogs_utils.py | mondele/tx-manager | ddbbeeae5990a327ffc14b42c478d3ea435c0533 | [
"MIT"
] | 16 | 2016-09-15T23:34:19.000Z | 2019-07-25T07:06:32.000Z | from __future__ import absolute_import, unicode_literals, print_function
import mock
import unittest
from libraries.gogs_tools.gogs_handler import GogsHandler
class GogsHandlerTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.handler = GogsHandler("https://www.example.com/")
cls... | 36.030303 | 73 | 0.707317 | from __future__ import absolute_import, unicode_literals, print_function
import mock
import unittest
from libraries.gogs_tools.gogs_handler import GogsHandler
class GogsHandlerTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.handler = GogsHandler("https://www.example.com/")
cls... | true | true |
1c49703f28f036f4d4ac9547a92dd0ad4100c1c4 | 1,229 | py | Python | lib/lockfile.py | kaolin/rigor | c3489bf36088282368daee8fd71e9a64344145de | [
"BSD-2-Clause"
] | 5 | 2018-03-28T08:43:08.000Z | 2021-10-30T15:47:07.000Z | lib/lockfile.py | blindsightcorp/rigor | d4176afed5b82cef3daf778ed00fe9be66d231fb | [
"BSD-2-Clause"
] | 2 | 2016-10-10T19:10:26.000Z | 2017-05-03T23:01:37.000Z | lib/lockfile.py | kaolin/rigor | c3489bf36088282368daee8fd71e9a64344145de | [
"BSD-2-Clause"
] | 7 | 2016-05-25T00:15:43.000Z | 2017-06-26T17:32:45.000Z | """ File used to synchronize operations between processes """
import os
class LockFile(object):
"""
Use this to lock operations that need to occur only once, even if several
processes try to run the operation. It works by getting an exclusive lock on
the listed file. It will fail with an exception if the lock a... | 26.717391 | 78 | 0.703824 |
import os
class LockFile(object):
def __init__(self, path):
self._path = path
self._lock = None
def acquire(self):
if not self._lock:
self._lock = os.open(self._path, os.O_CREAT | os.O_EXCL | os.O_RDWR)
def release(self):
if self._lock:
os.close(self._lock)
os.unlink(self._path)
def __enter__... | true | true |
1c4970531f6fba9cef04cbc507d9376efaba246c | 416 | py | Python | products/migrations/0004_auto_20180914_2257.py | bubaic/e-shop | d0156d02d6e74e35d115f8742b55809466126513 | [
"MIT"
] | 1 | 2022-02-21T18:00:48.000Z | 2022-02-21T18:00:48.000Z | products/migrations/0004_auto_20180914_2257.py | bubaic/e-shop | d0156d02d6e74e35d115f8742b55809466126513 | [
"MIT"
] | null | null | null | products/migrations/0004_auto_20180914_2257.py | bubaic/e-shop | d0156d02d6e74e35d115f8742b55809466126513 | [
"MIT"
] | null | null | null | # Generated by Django 2.1 on 2018-09-14 17:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0003_product_image'),
]
operations = [
migrations.AlterField(
model_name='product',
name='image',
... | 21.894737 | 86 | 0.610577 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0003_product_image'),
]
operations = [
migrations.AlterField(
model_name='product',
name='image',
field=models.FileField(blank=True, null=T... | true | true |
1c49712da3c586e84e204bc68db748b83fe51cbd | 164 | py | Python | 01_Day_Introduction/euclidian_distance.py | fernandovicentinpavanello/30-days-of-Python | 3e04ef64a0997bb71eeac57911e47f2f6414ae75 | [
"MIT"
] | 1 | 2022-03-08T07:08:39.000Z | 2022-03-08T07:08:39.000Z | 01_Day_Introduction/euclidian_distance.py | luizpavanello/30-days-of-Python | 3c727a76b6185a5ba684c393c5cdfc759c3c4b01 | [
"MIT"
] | null | null | null | 01_Day_Introduction/euclidian_distance.py | luizpavanello/30-days-of-Python | 3c727a76b6185a5ba684c393c5cdfc759c3c4b01 | [
"MIT"
] | null | null | null | # Python Euclidian Distance using math.dist
from math import dist
point_1 = (2, 3)
point_2 = (10, 8)
print(dist(point_1, point_2))
# Result: 9.433981132056603
| 14.909091 | 43 | 0.719512 |
from math import dist
point_1 = (2, 3)
point_2 = (10, 8)
print(dist(point_1, point_2))
| true | true |
1c4972132ffd5f30ca850ea943fd539eece66d4f | 4,004 | py | Python | wheat/wallet/util/trade_utils.py | grayfallstown/wheat-blockchain | f391cdd30a0cbcdb2adf4439a25581fd28b42c1f | [
"Apache-2.0"
] | 15 | 2021-07-12T14:27:42.000Z | 2022-02-09T04:32:44.000Z | wheat/wallet/util/trade_utils.py | grayfallstown/wheat-blockchain | f391cdd30a0cbcdb2adf4439a25581fd28b42c1f | [
"Apache-2.0"
] | 21 | 2021-07-12T23:25:36.000Z | 2021-10-29T23:19:55.000Z | wheat/wallet/util/trade_utils.py | grayfallstown/wheat-blockchain | f391cdd30a0cbcdb2adf4439a25581fd28b42c1f | [
"Apache-2.0"
] | 8 | 2021-07-12T13:15:19.000Z | 2022-03-15T08:41:18.000Z | from typing import Dict, Optional, Tuple
from wheat.types.blockchain_format.program import Program, INFINITE_COST
from wheat.types.condition_opcodes import ConditionOpcode
from wheat.types.spend_bundle import SpendBundle
from wheat.util.condition_tools import conditions_dict_for_solution
from wheat.wallet.cc_wallet im... | 42.595745 | 116 | 0.699051 | from typing import Dict, Optional, Tuple
from wheat.types.blockchain_format.program import Program, INFINITE_COST
from wheat.types.condition_opcodes import ConditionOpcode
from wheat.types.spend_bundle import SpendBundle
from wheat.util.condition_tools import conditions_dict_for_solution
from wheat.wallet.cc_wallet im... | true | true |
1c4973a004a9278329b4a2ea713e7f3e1c39f8cc | 10,727 | py | Python | venv/Lib/site-packages/selenium/webdriver/firefox/webdriver.py | dasxran/seleniumMachineLearning | 3098f836913a89847cb9e308189383a4ea981139 | [
"MIT"
] | 64 | 2020-07-22T06:24:18.000Z | 2022-03-27T10:48:15.000Z | venv/Lib/site-packages/selenium/webdriver/firefox/webdriver.py | dasxran/seleniumMachineLearning | 3098f836913a89847cb9e308189383a4ea981139 | [
"MIT"
] | 51 | 2021-04-08T11:39:59.000Z | 2021-05-07T12:01:27.000Z | venv/Lib/site-packages/selenium/webdriver/firefox/webdriver.py | dasxran/seleniumMachineLearning | 3098f836913a89847cb9e308189383a4ea981139 | [
"MIT"
] | 21 | 2019-03-11T04:25:23.000Z | 2022-02-03T08:54:33.000Z | # Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 38.725632 | 89 | 0.648271 |
import warnings
try:
basestring
except NameError:
basestring = str
import shutil
import sys
from contextlib import contextmanager
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
from... | true | true |
1c497475a53a4c0124cb3f312edcf589a9dd4c1d | 14,550 | py | Python | models/variation/pix2pix_tm2_mc_full_in2_model.py | tkuri/irradiance_estimation | 3f7e0e8d4772222faad7257a70a8dec0198e4810 | [
"BSD-3-Clause"
] | 1 | 2020-07-22T18:06:40.000Z | 2020-07-22T18:06:40.000Z | models/variation/pix2pix_tm2_mc_full_in2_model.py | tkuri/irradiance_estimation | 3f7e0e8d4772222faad7257a70a8dec0198e4810 | [
"BSD-3-Clause"
] | null | null | null | models/variation/pix2pix_tm2_mc_full_in2_model.py | tkuri/irradiance_estimation | 3f7e0e8d4772222faad7257a70a8dec0198e4810 | [
"BSD-3-Clause"
] | null | null | null | import torch
from .base_model import BaseModel
from . import networks
from torch.nn import functional as F
class Pix2PixTm2McFullIn2Model(BaseModel):
""" This class implements the pix2pix model, for learning a mapping from input images to output images given paired data.
The model training requires '--dataset... | 58.669355 | 239 | 0.620619 | import torch
from .base_model import BaseModel
from . import networks
from torch.nn import functional as F
class Pix2PixTm2McFullIn2Model(BaseModel):
@staticmethod
def modify_commandline_options(parser, is_train=True):
parser.set_defaults(norm='batch', netG='unet_256', dataset_mode='aligned3')... | true | true |
1c497491d95957aa66acaa71fdefe22a342c41c1 | 19,473 | py | Python | mudata/_core/io.py | scverse/mudata | fbfc634e8f17bd70ed67bb8a37951564f16b61e6 | [
"BSD-3-Clause"
] | 12 | 2022-01-10T14:11:23.000Z | 2022-03-17T13:03:45.000Z | mudata/_core/io.py | scverse/mudata | fbfc634e8f17bd70ed67bb8a37951564f16b61e6 | [
"BSD-3-Clause"
] | 10 | 2022-01-24T15:09:03.000Z | 2022-03-29T03:47:28.000Z | mudata/_core/io.py | scverse/mudata | fbfc634e8f17bd70ed67bb8a37951564f16b61e6 | [
"BSD-3-Clause"
] | null | null | null | from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import zarr
from typing import Union
from os import PathLike
import os
from warnings import warn
from collections.abc import MutableMapping
import numpy as np
import h5py
import anndata as ad
from anndata import AnnData
# from... | 31.612013 | 111 | 0.583629 | from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import zarr
from typing import Union
from os import PathLike
import os
from warnings import warn
from collections.abc import MutableMapping
import numpy as np
import h5py
import anndata as ad
from anndata import AnnData
pathl... | true | true |
1c4974b9fca1aa6488c9bc567b5f3b3cb8f9a5fd | 3,464 | py | Python | salt/modules/sysmod.py | ageron/salt | 72a0a89011e55ce7c875e948b5f0e97e70328153 | [
"Apache-2.0"
] | 2 | 2019-03-30T02:12:56.000Z | 2021-03-08T18:59:46.000Z | salt/modules/sysmod.py | ageron/salt | 72a0a89011e55ce7c875e948b5f0e97e70328153 | [
"Apache-2.0"
] | null | null | null | salt/modules/sysmod.py | ageron/salt | 72a0a89011e55ce7c875e948b5f0e97e70328153 | [
"Apache-2.0"
] | null | null | null | '''
The sys module provides information about the available functions on the
minion.
'''
# Import python libs
import logging
# Import salt libs
# TODO: should probably use _getargs() from salt.utils?
from salt.state import _getargs
log = logging.getLogger(__name__)
def __virtual__():
'''
Return as sys
... | 24.920863 | 78 | 0.582852 |
import logging
from salt.state import _getargs
log = logging.getLogger(__name__)
def __virtual__():
return 'sys'
def doc(module=''):
docs = {}
if module:
target_mod = module + '.' if not module.endswith('.') else module
else:
target_mod = ''
for fun in __s... | true | true |
1c49773883879141ec47340b240f609fe8894f09 | 518 | py | Python | tests/test_functions.py | brisvag/mdocfile | abab15dac94460de7c62d339d7a2d497bbb722fd | [
"BSD-3-Clause"
] | 1 | 2022-02-23T02:42:35.000Z | 2022-02-23T02:42:35.000Z | tests/test_functions.py | brisvag/mdocfile | abab15dac94460de7c62d339d7a2d497bbb722fd | [
"BSD-3-Clause"
] | 1 | 2022-03-28T13:11:37.000Z | 2022-03-30T14:19:31.000Z | tests/test_functions.py | brisvag/mdocfile | abab15dac94460de7c62d339d7a2d497bbb722fd | [
"BSD-3-Clause"
] | 1 | 2022-03-18T13:23:08.000Z | 2022-03-18T13:23:08.000Z | import pandas as pd
import pytest
from mdocfile.functions import read
@pytest.mark.parametrize(
'camel_to_snake', [True, False]
)
def test_read(tilt_series_mdoc_file, camel_to_snake: bool):
df = read(tilt_series_mdoc_file, camel_to_snake=camel_to_snake)
print(camel_to_snake, len(df.columns))
print(df.... | 25.9 | 67 | 0.720077 | import pandas as pd
import pytest
from mdocfile.functions import read
@pytest.mark.parametrize(
'camel_to_snake', [True, False]
)
def test_read(tilt_series_mdoc_file, camel_to_snake: bool):
df = read(tilt_series_mdoc_file, camel_to_snake=camel_to_snake)
print(camel_to_snake, len(df.columns))
print(df.... | true | true |
1c49774d2ad0cf760e33d25aee3e251a29965c7f | 32,566 | py | Python | pyhap/camera.py | sander-vd/HAP-python | 991761ceadfd7796d454d61c87be7f5d4b75d432 | [
"Apache-2.0"
] | 3 | 2019-12-07T22:42:38.000Z | 2022-01-20T08:44:46.000Z | pyhap/camera.py | sander-vd/HAP-python | 991761ceadfd7796d454d61c87be7f5d4b75d432 | [
"Apache-2.0"
] | null | null | null | pyhap/camera.py | sander-vd/HAP-python | 991761ceadfd7796d454d61c87be7f5d4b75d432 | [
"Apache-2.0"
] | 1 | 2021-05-15T22:34:52.000Z | 2021-05-15T22:34:52.000Z | """Contains the Camera accessory and related.
When a HAP client (e.g. iOS) wants to start a video stream it does the following:
[0. Read supported RTP configuration]
[0. Read supported video configuration]
[0. Read supported audio configuration]
[0. Read the current streaming status]
1. Sets the SetupEndpoints charact... | 38.67696 | 90 | 0.605171 |
import asyncio
import functools
import os
import ipaddress
import logging
import struct
from uuid import UUID
from pyhap import RESOURCE_DIR
from pyhap.accessory import Accessory
from pyhap.const import CATEGORY_CAMERA
from pyhap.util import to_base64_str, byte_bool
from pyhap import tlv
SETUP_TYPES = {
'SESSIO... | true | true |
1c49776c2f73f90a5fcf5d29799236503717cedd | 5,508 | py | Python | python/tests/unittest/test_context.py | LI-Mingyu/GraphScope-MY | 942060983d3f7f8d3a3377467386e27aba285b33 | [
"Apache-2.0"
] | 1 | 2021-12-17T03:58:08.000Z | 2021-12-17T03:58:08.000Z | python/tests/unittest/test_context.py | LI-Mingyu/GraphScope-MY | 942060983d3f7f8d3a3377467386e27aba285b33 | [
"Apache-2.0"
] | null | null | null | python/tests/unittest/test_context.py | LI-Mingyu/GraphScope-MY | 942060983d3f7f8d3a3377467386e27aba285b33 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 Alibaba Group Holding Limited. 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... | 35.307692 | 88 | 0.698076 |
import os
import pandas as pd
import pytest
import vineyard.io
from graphscope import lpa
from graphscope import sssp
from graphscope.framework.app import AppAssets
from graphscope.framework.errors import InvalidArgumentError
def test_simple_context_to_numpy(simple_context):
out = simple_conte... | true | true |
1c49784aa8306157fe272237ed9d63b7286a170d | 6,799 | py | Python | torchgan/metrics/proximal_duality_gap.py | proximal-dg/proximal_dg | 000e925c7daab099b2c3735f99e65e6b2a00a799 | [
"MIT"
] | 13 | 2021-05-12T05:37:20.000Z | 2022-03-30T17:05:47.000Z | torchgan/metrics/proximal_duality_gap.py | proximal-dg/proximal_dg | 000e925c7daab099b2c3735f99e65e6b2a00a799 | [
"MIT"
] | 3 | 2021-10-20T04:51:36.000Z | 2022-02-25T13:37:32.000Z | torchgan/metrics/proximal_duality_gap.py | proximal-dg/proximal_dg | 000e925c7daab099b2c3735f99e65e6b2a00a799 | [
"MIT"
] | 1 | 2021-12-28T17:03:08.000Z | 2021-12-28T17:03:08.000Z | import torch
import torch.nn.functional as F
import torchvision
import copy
import time
import os
from ..utils import reduce
from .metric import EvaluationMetric
from torchgan.trainer import *
import torch.multiprocessing as mp
import numpy as np
from ray import tune
from torch.optim import Adam
__all__ = ["ProximalDua... | 42.761006 | 292 | 0.626121 | import torch
import torch.nn.functional as F
import torchvision
import copy
import time
import os
from ..utils import reduce
from .metric import EvaluationMetric
from torchgan.trainer import *
import torch.multiprocessing as mp
import numpy as np
from ray import tune
from torch.optim import Adam
__all__ = ["ProximalDua... | true | true |
1c49787b94ab42aa228264ebb5813f6406a67b28 | 203 | py | Python | Old/src/com/basic/call_func.py | exchris/Pythonlearn | 174f38a86cf1c85d6fc099005aab3568e7549cd0 | [
"MIT"
] | null | null | null | Old/src/com/basic/call_func.py | exchris/Pythonlearn | 174f38a86cf1c85d6fc099005aab3568e7549cd0 | [
"MIT"
] | 1 | 2018-11-27T09:58:54.000Z | 2018-11-27T09:58:54.000Z | Old/src/com/basic/call_func.py | exchris/pythonlearn | 174f38a86cf1c85d6fc099005aab3568e7549cd0 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
x = abs(100)
y = abs(-20)
print(x, y)
print('max(1, 2, 3) =', max(1, 2, 3))
print('min(1, 2, 3) =', min(1, 2, 3))
print('sum([1, 2, 3]) =', sum([1, 2, 3])) | 22.555556 | 41 | 0.477833 |
x = abs(100)
y = abs(-20)
print(x, y)
print('max(1, 2, 3) =', max(1, 2, 3))
print('min(1, 2, 3) =', min(1, 2, 3))
print('sum([1, 2, 3]) =', sum([1, 2, 3])) | true | true |
1c4979a46c5b421ace7a15f391b274820af9e4a1 | 25,942 | py | Python | stable_baselines3/sac/policies.py | danielhettegger-rl/stable-baselines3 | 23de12e95d96b7bb6136c6a338e407ae7db7c545 | [
"MIT"
] | null | null | null | stable_baselines3/sac/policies.py | danielhettegger-rl/stable-baselines3 | 23de12e95d96b7bb6136c6a338e407ae7db7c545 | [
"MIT"
] | null | null | null | stable_baselines3/sac/policies.py | danielhettegger-rl/stable-baselines3 | 23de12e95d96b7bb6136c6a338e407ae7db7c545 | [
"MIT"
] | null | null | null | import warnings
from typing import Any, Dict, List, Optional, Tuple, Type, Union
import gym
import torch as th
from torch import nn
from stable_baselines3.common.distributions import SquashedDiagGaussianDistribution, StateDependentNoiseDistribution
from stable_baselines3.common.policies import BaseModel, BasePolicy, ... | 43.021559 | 125 | 0.67304 | import warnings
from typing import Any, Dict, List, Optional, Tuple, Type, Union
import gym
import torch as th
from torch import nn
from stable_baselines3.common.distributions import SquashedDiagGaussianDistribution, StateDependentNoiseDistribution
from stable_baselines3.common.policies import BaseModel, BasePolicy, ... | true | true |
1c497aa96e625e83e18815ae709066fd24247385 | 6,399 | py | Python | controller/gui.py | HighwayFlocking/HighwayFlocking | e870579d11574f5789162481219e771610f8b721 | [
"ECL-2.0",
"Apache-2.0"
] | 44 | 2015-06-11T14:39:26.000Z | 2021-05-21T11:06:47.000Z | controller/gui.py | HighwayFlocking/HighwayFlocking | e870579d11574f5789162481219e771610f8b721 | [
"ECL-2.0",
"Apache-2.0"
] | 2 | 2015-06-12T07:32:58.000Z | 2018-05-27T07:04:52.000Z | controller/gui.py | HighwayFlocking/HighwayFlocking | e870579d11574f5789162481219e771610f8b721 | [
"ECL-2.0",
"Apache-2.0"
] | 8 | 2015-06-11T15:19:08.000Z | 2019-10-08T13:18:52.000Z | #coding: utf-8
# Copyright 2015 Sindre Ilebekk Johansen and Andreas Sløgedal Løvland
# 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
# Unles... | 34.967213 | 125 | 0.64932 |
import sys
import logging
import os
import threading
from datetime import time
import subprocess
from PySide import QtCore, QtGui
from PySide.QtCore import QTimer
from lib.gui.controller_ui import Ui_MainWindow
import configs
import config as cfg
from lib.simulation import Simulator, SimulatorIsClosed... | true | true |
1c497acc563c98424984a3eed65eb8d2e59387b3 | 563 | py | Python | pyqt/pyqt5-master/src/windows/Background2.py | Ding-zhenke/Dcount-s-notebook | 16c29ac7d076c466e053f1b8db4a7f4e43f67a24 | [
"MIT"
] | null | null | null | pyqt/pyqt5-master/src/windows/Background2.py | Ding-zhenke/Dcount-s-notebook | 16c29ac7d076c466e053f1b8db4a7f4e43f67a24 | [
"MIT"
] | null | null | null | pyqt/pyqt5-master/src/windows/Background2.py | Ding-zhenke/Dcount-s-notebook | 16c29ac7d076c466e053f1b8db4a7f4e43f67a24 | [
"MIT"
] | 2 | 2019-06-18T05:53:26.000Z | 2019-06-19T03:26:02.000Z | '''
使用多种方式设置窗口背景色和背景图片
1. QSS
2. QPalette
3. 直接绘制
'''
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
class Background2(QWidget):
def __init__(self):
super().__init__()
self.setWindowTitle("绘制背景图片")
def paintEvent(self, event):
painte... | 18.766667 | 48 | 0.646536 |
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
class Background2(QWidget):
def __init__(self):
super().__init__()
self.setWindowTitle("绘制背景图片")
def paintEvent(self, event):
painter = QPainter(self)
pixmap = QPixmap('./images/screen... | true | true |
1c497bb22e51089dbe0ccd8f10dc86c537c0c7d6 | 9,748 | py | Python | train.py | ssahn3087/pedestrian_detection | d9a6cb9d10246941cff8575c803ab60b3a9d7d04 | [
"MIT"
] | 1 | 2019-10-25T12:31:38.000Z | 2019-10-25T12:31:38.000Z | train.py | ssahn3087/pedestrian_detection | d9a6cb9d10246941cff8575c803ab60b3a9d7d04 | [
"MIT"
] | null | null | null | train.py | ssahn3087/pedestrian_detection | d9a6cb9d10246941cff8575c803ab60b3a9d7d04 | [
"MIT"
] | null | null | null | import os
import torch
import numpy as np
import math
from torch.autograd import Variable
from datetime import datetime
from faster_rcnn import network
from faster_rcnn.network import init_data, data_to_variable
from faster_rcnn.network import train_net_params, print_weight_grad
from faster_rcnn.faster_rcnn_vgg import ... | 36.237918 | 122 | 0.627924 | import os
import torch
import numpy as np
import math
from torch.autograd import Variable
from datetime import datetime
from faster_rcnn import network
from faster_rcnn.network import init_data, data_to_variable
from faster_rcnn.network import train_net_params, print_weight_grad
from faster_rcnn.faster_rcnn_vgg import ... | true | true |
1c497cc803b8be1b63fb9e21a689f8082660622d | 600 | py | Python | tester.py | sjsafranek/asset_server | e036b87f629dade7f52a8a3e2b63ace52b32a88f | [
"MIT"
] | null | null | null | tester.py | sjsafranek/asset_server | e036b87f629dade7f52a8a3e2b63ace52b32a88f | [
"MIT"
] | null | null | null | tester.py | sjsafranek/asset_server | e036b87f629dade7f52a8a3e2b63ace52b32a88f | [
"MIT"
] | null | null | null | import requests
r = requests.post("http://localhost:1111/api/v1/asset", files={
'uploadfile': open('test.jpg','rb')
})
print(r.text)
if 200 != r.status_code:
exit()
asset_id = r.json()['data']['asset_id']
r = requests.get("http://localhost:1111/api/v1/asset/{0}".format(asset_id))
print(r.text)
if 200 != r.s... | 22.222222 | 78 | 0.66 | import requests
r = requests.post("http://localhost:1111/api/v1/asset", files={
'uploadfile': open('test.jpg','rb')
})
print(r.text)
if 200 != r.status_code:
exit()
asset_id = r.json()['data']['asset_id']
r = requests.get("http://localhost:1111/api/v1/asset/{0}".format(asset_id))
print(r.text)
if 200 != r.s... | true | true |
1c497e6e46579745df1fb77e24b216d3ac5774a7 | 21,159 | py | Python | ktrain/vision/models.py | husmen/ktrain | 4147b0bd146deb513c6f94505908294a5163efac | [
"Apache-2.0"
] | null | null | null | ktrain/vision/models.py | husmen/ktrain | 4147b0bd146deb513c6f94505908294a5163efac | [
"Apache-2.0"
] | null | null | null | ktrain/vision/models.py | husmen/ktrain | 4147b0bd146deb513c6f94505908294a5163efac | [
"Apache-2.0"
] | null | null | null | from ..imports import *
from .. import utils as U
from .wrn import create_wide_residual_network
PRETRAINED_RESNET50 = 'pretrained_resnet50'
PRETRAINED_MOBILENET = 'pretrained_mobilenet'
PRETRAINED_MOBILENETV3 = 'pretrained_mobilenetv3'
PRETRAINED_INCEPTION = 'pretrained_inception'
PRETRAINED_EFFICIENTNETB1 = 'pretr... | 42.745455 | 130 | 0.598658 | from ..imports import *
from .. import utils as U
from .wrn import create_wide_residual_network
PRETRAINED_RESNET50 = 'pretrained_resnet50'
PRETRAINED_MOBILENET = 'pretrained_mobilenet'
PRETRAINED_MOBILENETV3 = 'pretrained_mobilenetv3'
PRETRAINED_INCEPTION = 'pretrained_inception'
PRETRAINED_EFFICIENTNETB1 = 'pretr... | true | true |
1c497ec5d0c301db41eee7e775d56ae2985ce8dc | 10,074 | py | Python | octopus_deploy_swagger_client/models/root_resource.py | cvent/octopus-deploy-api-client | 0e03e842e1beb29b132776aee077df570b88366a | [
"Apache-2.0"
] | null | null | null | octopus_deploy_swagger_client/models/root_resource.py | cvent/octopus-deploy-api-client | 0e03e842e1beb29b132776aee077df570b88366a | [
"Apache-2.0"
] | null | null | null | octopus_deploy_swagger_client/models/root_resource.py | cvent/octopus-deploy-api-client | 0e03e842e1beb29b132776aee077df570b88366a | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
"""
Octopus Server API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 2019.6.7+Branch.tags-2019.6.7.Sha.aa18dc6809953218c66f57eff7d26481d9b23d6a
Generated by: https://github.com/swagger-api... | 28.782857 | 236 | 0.611376 |
import pprint
import re
import six
class RootResource(object):
swagger_types = {
'id': 'str',
'application': 'str',
'version': 'str',
'api_version': 'str',
'installation_id': 'str',
'is_early_access_program': 'bool',
'has_long_term_support': 'bool',
... | true | true |
1c497f273191aaa9f08c21c995e05301e9578810 | 546 | py | Python | python/collatz_conjecture.py | lsantosdemoura/clojure-algorithms | 56696b7b6544f37d736135cac6b03342fdeb4825 | [
"MIT"
] | null | null | null | python/collatz_conjecture.py | lsantosdemoura/clojure-algorithms | 56696b7b6544f37d736135cac6b03342fdeb4825 | [
"MIT"
] | null | null | null | python/collatz_conjecture.py | lsantosdemoura/clojure-algorithms | 56696b7b6544f37d736135cac6b03342fdeb4825 | [
"MIT"
] | null | null | null | def calculate_sieve(number):
if number <= 0:
print(f'{number} is less than or equal to 0, enter another number please:')
ask_number()
else:
count = 1
while number != 1:
if number % 2 == 0:
number = number // 2
else:
number =... | 23.73913 | 83 | 0.53663 | def calculate_sieve(number):
if number <= 0:
print(f'{number} is less than or equal to 0, enter another number please:')
ask_number()
else:
count = 1
while number != 1:
if number % 2 == 0:
number = number // 2
else:
number =... | true | true |
1c498059b0ab55361020f761725d41830c547370 | 2,423 | py | Python | bayesvp/tests/test_likelihood.py | cameronliang/BayesVP | 3a38e6fc8b85f96f402289fde74f996971edec93 | [
"MIT"
] | 5 | 2017-10-10T20:24:05.000Z | 2017-11-02T20:20:34.000Z | bayesvp/tests/test_likelihood.py | cameronliang/BayesVP | 3a38e6fc8b85f96f402289fde74f996971edec93 | [
"MIT"
] | 1 | 2019-11-15T18:17:19.000Z | 2019-11-15T18:36:01.000Z | bayesvp/tests/test_likelihood.py | cameronliang/BayesVP | 3a38e6fc8b85f96f402289fde74f996971edec93 | [
"MIT"
] | 4 | 2018-05-22T14:30:23.000Z | 2021-09-23T09:23:46.000Z | import unittest
import os
import sys
import numpy as np
from bayesvp.config import DefineParams
from bayesvp.likelihood import Posterior
from bayesvp.utilities import get_bayesvp_Dir
###############################################################################
# TEST CASE 1: OVI line with stock config file and spec... | 31.881579 | 79 | 0.570367 | import unittest
import os
import sys
import numpy as np
from bayesvp.config import DefineParams
from bayesvp.likelihood import Posterior
from bayesvp.utilities import get_bayesvp_Dir
| true | true |
1c498119f6fa59f0759598353b4eb9eb224fdda7 | 1,104 | py | Python | h2o-py/tests/testdir_misc/pyunit_download_all_logs.py | ChristosChristofidis/h2o-3 | 2a926c0950a98eff5a4c06aeaf0373e17176ecd8 | [
"Apache-2.0"
] | null | null | null | h2o-py/tests/testdir_misc/pyunit_download_all_logs.py | ChristosChristofidis/h2o-3 | 2a926c0950a98eff5a4c06aeaf0373e17176ecd8 | [
"Apache-2.0"
] | null | null | null | h2o-py/tests/testdir_misc/pyunit_download_all_logs.py | ChristosChristofidis/h2o-3 | 2a926c0950a98eff5a4c06aeaf0373e17176ecd8 | [
"Apache-2.0"
] | 1 | 2020-12-18T19:20:02.000Z | 2020-12-18T19:20:02.000Z | import sys, os
sys.path.insert(1, "../../")
import h2o
import random
def download_all_logs(ip,port):
# Connect to h2o
h2o.init(ip,port)
# default
log_location = h2o.download_all_logs()
assert os.path.exists(log_location), "Expected h2o logs to be saved in {0}, but they weren't".format(log_location... | 35.612903 | 118 | 0.712862 | import sys, os
sys.path.insert(1, "../../")
import h2o
import random
def download_all_logs(ip,port):
h2o.init(ip,port)
log_location = h2o.download_all_logs()
assert os.path.exists(log_location), "Expected h2o logs to be saved in {0}, but they weren't".format(log_location)
os.remove(log_locat... | true | true |
1c4981738c26de6226fe40bbd740e912076a2276 | 13,275 | py | Python | vnpy/api/geya/geyaApi.py | cmbclh/vnpy1.7 | 25a95ba63c7797e92ba45450d79ee1326135fb47 | [
"MIT"
] | null | null | null | vnpy/api/geya/geyaApi.py | cmbclh/vnpy1.7 | 25a95ba63c7797e92ba45450d79ee1326135fb47 | [
"MIT"
] | null | null | null | vnpy/api/geya/geyaApi.py | cmbclh/vnpy1.7 | 25a95ba63c7797e92ba45450d79ee1326135fb47 | [
"MIT"
] | null | null | null | # encoding: utf-8
import urllib
import hashlib
import os
import jpype
from jpype import *
import math
import requests
from Queue import Queue, Empty
from threading import Thread
from time import sleep
LHANG_API_ROOT = "https://api.lhang.com/v1/"
FUNCTION_TICKER = 'FUNCTION_TICKER'
FUNCTION_ALL_TICKER = 'FUNCTION_AL... | 37.394366 | 123 | 0.490847 |
import urllib
import hashlib
import os
import jpype
from jpype import *
import math
import requests
from Queue import Queue, Empty
from threading import Thread
from time import sleep
LHANG_API_ROOT = "https://api.lhang.com/v1/"
FUNCTION_TICKER = 'FUNCTION_TICKER'
FUNCTION_ALL_TICKER = 'FUNCTION_ALL_TICKER'
FUNCTIO... | false | true |
1c4981ea161448965260abc067ee7218670be9b4 | 218 | py | Python | text/_cascade/text/spacing/word.py | jedhsu/text | 8525b602d304ac571a629104c48703443244545c | [
"Apache-2.0"
] | null | null | null | text/_cascade/text/spacing/word.py | jedhsu/text | 8525b602d304ac571a629104c48703443244545c | [
"Apache-2.0"
] | null | null | null | text/_cascade/text/spacing/word.py | jedhsu/text | 8525b602d304ac571a629104c48703443244545c | [
"Apache-2.0"
] | null | null | null | """
Word Spacing
"""
__all__ = ["WordSpacing"]
class WordSpacingKeyword:
Normal = "normal"
class WordSpacing(
WordSpacingKeyword,
Length,
):
"""
Spacing between each word.
"""
pass
| 9.083333 | 30 | 0.59633 |
__all__ = ["WordSpacing"]
class WordSpacingKeyword:
Normal = "normal"
class WordSpacing(
WordSpacingKeyword,
Length,
):
pass
| true | true |
1c4982c7f40c95390cf2ad55bc3592134703da57 | 5,605 | py | Python | fa_en_keyboard_exchange.py | arian42/wrong-keyboard | c0c0842ae8181ff52b33675aa7171de43bb56513 | [
"MIT"
] | null | null | null | fa_en_keyboard_exchange.py | arian42/wrong-keyboard | c0c0842ae8181ff52b33675aa7171de43bb56513 | [
"MIT"
] | null | null | null | fa_en_keyboard_exchange.py | arian42/wrong-keyboard | c0c0842ae8181ff52b33675aa7171de43bb56513 | [
"MIT"
] | null | null | null | # -------------------------------------------------------------------------------------------------------------------
# this is a alpha version. need more work
# written by Arian Heydari
#
# things that i should add and fix:
# words list are bad (need better words file)
# add auto learn function for new words
# ... | 27.747525 | 120 | 0.363426 |
def binary_search(alist, item):
first = 0
last = len(alist) - 1
found = False
while first <= last and not found:
pos = 0
midpoint = (first + last) // 2
if alist[midpoint] == item:
pos = midpoint
found = True
else:
if item < ali... | true | true |
1c4982dab6584e4c750c0a7551513aed7ec8c4b7 | 221 | py | Python | abc/abc190/abc190d-3.py | c-yan/atcoder | 940e49d576e6a2d734288fadaf368e486480a948 | [
"MIT"
] | 1 | 2019-08-21T00:49:34.000Z | 2019-08-21T00:49:34.000Z | abc/abc190/abc190d-3.py | c-yan/atcoder | 940e49d576e6a2d734288fadaf368e486480a948 | [
"MIT"
] | null | null | null | abc/abc190/abc190d-3.py | c-yan/atcoder | 940e49d576e6a2d734288fadaf368e486480a948 | [
"MIT"
] | null | null | null | N = int(input())
a = N
while a % 2 == 0:
a //= 2
result = 0
for i in range(1, int(a ** 0.5) + 1):
if a % i != 0:
continue
result += 1
if i * i != a:
result += 1
result *= 2
print(result)
| 13.8125 | 37 | 0.438914 | N = int(input())
a = N
while a % 2 == 0:
a //= 2
result = 0
for i in range(1, int(a ** 0.5) + 1):
if a % i != 0:
continue
result += 1
if i * i != a:
result += 1
result *= 2
print(result)
| true | true |
1c498316fdd0c125a26460ff88c3dfe714b68c44 | 9,921 | py | Python | train_sppe/src/utils/img.py | mdraw/AlphaPose | bed8e0798f6deed4789b9ae2646f72b9fd138c5b | [
"Apache-2.0"
] | null | null | null | train_sppe/src/utils/img.py | mdraw/AlphaPose | bed8e0798f6deed4789b9ae2646f72b9fd138c5b | [
"Apache-2.0"
] | null | null | null | train_sppe/src/utils/img.py | mdraw/AlphaPose | bed8e0798f6deed4789b9ae2646f72b9fd138c5b | [
"Apache-2.0"
] | null | null | null | # -----------------------------------------------------
# Copyright (c) Shanghai Jiao Tong University. All rights reserved.
# Written by Jiefeng Li (jeff.lee.sjtu@gmail.com)
# -----------------------------------------------------
import numpy as np
import torch
import scipy.misc
import torch.nn.functional as F
import ... | 31.100313 | 92 | 0.513154 |
import numpy as np
import torch
import scipy.misc
import torch.nn.functional as F
import cv2
from opt import opt
RED = (0, 0, 255)
GREEN = (0, 255, 0)
BLUE = (255, 0, 0)
CYAN = (255, 255, 0)
YELLOW = (0, 255, 255)
ORANGE = (0, 165, 255)
PURPLE = (255, 0, 255)
def im_to_torch(img):
img = np.transpose(img, (... | true | true |
1c498364b124248db0499e5d367de8334f74324d | 462 | py | Python | data/scripts/templates/object/draft_schematic/furniture/shared_furniture_chair_elegant.py | obi-two/GameServer | 7d37024e2291a97d49522610cd8f1dbe5666afc2 | [
"MIT"
] | 20 | 2015-02-23T15:11:56.000Z | 2022-03-18T20:56:48.000Z | data/scripts/templates/object/draft_schematic/furniture/shared_furniture_chair_elegant.py | apathyboy/swganh | 665128efe9154611dec4cb5efc61d246dd095984 | [
"MIT"
] | null | null | null | data/scripts/templates/object/draft_schematic/furniture/shared_furniture_chair_elegant.py | apathyboy/swganh | 665128efe9154611dec4cb5efc61d246dd095984 | [
"MIT"
] | 20 | 2015-04-04T16:35:59.000Z | 2022-03-24T14:54:37.000Z | #### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/furniture/shared_furniture_chair_elegant.iff"
result.attri... | 27.176471 | 88 | 0.735931 | true | true | |
1c4983c64dbb362dcacbdb6c9d607d9aba2da2ce | 509 | py | Python | pythran/tests/euler/euler10.py | artas360/pythran | 66dad52d52be71693043e9a7d7578cfb9cb3d1da | [
"BSD-3-Clause"
] | null | null | null | pythran/tests/euler/euler10.py | artas360/pythran | 66dad52d52be71693043e9a7d7578cfb9cb3d1da | [
"BSD-3-Clause"
] | null | null | null | pythran/tests/euler/euler10.py | artas360/pythran | 66dad52d52be71693043e9a7d7578cfb9cb3d1da | [
"BSD-3-Clause"
] | 1 | 2017-03-12T20:32:36.000Z | 2017-03-12T20:32:36.000Z | #runas solve(2000000)
#pythran export solve(int)
def solve(max):
'''
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million.
'''
sieve = [True] * max # Sieve is faster for 2M primes
def mark(sieve, x):
for i in xrange(x+x, len(sie... | 25.45 | 60 | 0.563851 |
def solve(max):
sieve = [True] * max
def mark(sieve, x):
for i in xrange(x+x, len(sieve), x):
sieve[i] = False
for x in xrange(2, int(len(sieve) ** 0.5) + 1):
if sieve[x]: mark(sieve, x)
return sum(i for i in xrange(2, len(sieve)) if sieve[i])
| true | true |
1c4984353c9bf656314d3233f534932929e34855 | 2,833 | py | Python | cvjyo.py | Aravind-Suresh/CVJyo | 6cb324fb538a50939335fd28ee90e23fbb32f2c0 | [
"MIT"
] | null | null | null | cvjyo.py | Aravind-Suresh/CVJyo | 6cb324fb538a50939335fd28ee90e23fbb32f2c0 | [
"MIT"
] | null | null | null | cvjyo.py | Aravind-Suresh/CVJyo | 6cb324fb538a50939335fd28ee90e23fbb32f2c0 | [
"MIT"
] | null | null | null | import cv2
import numpy as np
import sys
import math
def markPoints(pts, img):
for pt in pts:
cv2.circle(img, tuple((pt[0], pt[1])), 2, 0, -1)
def contourAreaComparator(cnt1, cnt2):
if cv2.contourArea(cnt1) > cv2.contourArea(cnt2):
return 1
else:
return -1
def orderClockwise(ptsO, pt):
pts = ptsO ... | 26.476636 | 101 | 0.678433 | import cv2
import numpy as np
import sys
import math
def markPoints(pts, img):
for pt in pts:
cv2.circle(img, tuple((pt[0], pt[1])), 2, 0, -1)
def contourAreaComparator(cnt1, cnt2):
if cv2.contourArea(cnt1) > cv2.contourArea(cnt2):
return 1
else:
return -1
def orderClockwise(ptsO, pt):
pts = ptsO ... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.