hexsha stringlengths 40 40 | size int64 4 996k | ext stringclasses 8
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 4 996k | avg_line_length float64 1.33 58.2k | max_line_length int64 2 323k | alphanum_fraction float64 0 0.97 | content_no_comment stringlengths 0 946k | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f7ff821bf5de6837b2ea1910416038596cfe1376 | 11,409 | py | Python | sdk/python/pulumi_azure_native/databoxedge/v20200901preview/user.py | sebtelko/pulumi-azure-native | 711ec021b5c73da05611c56c8a35adb0ce3244e4 | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/databoxedge/v20200901preview/user.py | sebtelko/pulumi-azure-native | 711ec021b5c73da05611c56c8a35adb0ce3244e4 | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/databoxedge/v20200901preview/user.py | sebtelko/pulumi-azure-native | 711ec021b5c73da05611c56c8a35adb0ce3244e4 | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... | 44.392996 | 1,148 | 0.653519 |
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
from . import outputs
from ._enums import *
from ._inputs import *
__all__ = ['UserArgs', 'User']
@pulumi.input_type
class UserArgs:
def __init__(__self__, *,
... | true | true |
f7ff821d70ce82e373bca3604bbc305030fb02b8 | 1,048 | py | Python | mdls/config/mistune_conf.py | ompugao/mdls | 7ba9fbf75fd13c6e3f85fc248cb32e966dea2399 | [
"MIT"
] | null | null | null | mdls/config/mistune_conf.py | ompugao/mdls | 7ba9fbf75fd13c6e3f85fc248cb32e966dea2399 | [
"MIT"
] | null | null | null | mdls/config/mistune_conf.py | ompugao/mdls | 7ba9fbf75fd13c6e3f85fc248cb32e966dea2399 | [
"MIT"
] | null | null | null | # Copyright 2017 Palantir Technologies, Inc.
import logging
import os
from mdls._utils import find_parents
from .source import ConfigSource
log = logging.getLogger(__name__)
CONFIG_KEY = 'mistune'
PROJECT_CONFIGS = []
OPTIONS = [
('mathjax', 'plugins.mistune.mathjax.enabled', bool),
#('wikilink', 'plugins.py... | 29.942857 | 76 | 0.714695 |
import logging
import os
from mdls._utils import find_parents
from .source import ConfigSource
log = logging.getLogger(__name__)
CONFIG_KEY = 'mistune'
PROJECT_CONFIGS = []
OPTIONS = [
('mathjax', 'plugins.mistune.mathjax.enabled', bool),
]
class MistuneConfig(ConfigSource):
def user_config(self):
... | true | true |
f7ff832c8ffa3f620328d179f677359a6dd3c98c | 560 | py | Python | daemons/notification/app.py | ambrosejcarr/matrix-service | f61252d79941fa962240e27062682c9676f07e95 | [
"MIT"
] | 11 | 2018-10-26T20:47:55.000Z | 2022-02-02T10:32:42.000Z | daemons/notification/app.py | ambrosejcarr/matrix-service | f61252d79941fa962240e27062682c9676f07e95 | [
"MIT"
] | 379 | 2018-06-04T22:44:33.000Z | 2020-06-03T00:20:08.000Z | daemons/notification/app.py | ambrosejcarr/matrix-service | f61252d79941fa962240e27062682c9676f07e95 | [
"MIT"
] | 4 | 2018-11-22T01:00:27.000Z | 2020-09-01T16:42:05.000Z | import json
from matrix.lambdas.daemons.notification import NotificationHandler
def notification_handler(event, context):
notification = json.loads(event["Records"][0]["body"])
assert ('bundle_uuid' in notification and 'bundle_version' in notification and 'event_type' in notification)
bundle_uuid = noti... | 35 | 112 | 0.778571 | import json
from matrix.lambdas.daemons.notification import NotificationHandler
def notification_handler(event, context):
notification = json.loads(event["Records"][0]["body"])
assert ('bundle_uuid' in notification and 'bundle_version' in notification and 'event_type' in notification)
bundle_uuid = noti... | true | true |
f7ff838702ae36e42626aa978ddbadaf027b4e37 | 1,404 | py | Python | vhoops/modules/home/ui/routes.py | yigitbasalma/vhoops | e55e841631aeaeace371218229e9323a9b4fa06d | [
"Unlicense",
"MIT"
] | 4 | 2021-02-26T11:14:15.000Z | 2021-12-26T13:11:17.000Z | vhoops/modules/home/ui/routes.py | yigitbasalma/vhoops | e55e841631aeaeace371218229e9323a9b4fa06d | [
"Unlicense",
"MIT"
] | 2 | 2021-02-26T10:16:03.000Z | 2021-02-26T10:16:19.000Z | vhoops/modules/home/ui/routes.py | yigitbasalma/vhoops | e55e841631aeaeace371218229e9323a9b4fa06d | [
"Unlicense",
"MIT"
] | null | null | null | #!/usr/bin/python
# -*- coding: utf-8 -*-
from flask import Blueprint, render_template
from flask_login import login_required, current_user
from vhoops.modules.home.forms.user_profile import General, ChangePassword
from vhoops.modules.alerts.api.controllers import get_alerts_func
from vhoops.modules.teams.api.contro... | 31.2 | 74 | 0.752137 |
from flask import Blueprint, render_template
from flask_login import login_required, current_user
from vhoops.modules.home.forms.user_profile import General, ChangePassword
from vhoops.modules.alerts.api.controllers import get_alerts_func
from vhoops.modules.teams.api.controllers import get_all_teams_func
from vho... | true | true |
f7ff83b8a9ef044ce063db9886bad6944b26782d | 448 | py | Python | theBroker/venv/Scripts/pip3.7-script.py | emirgo/WeatherStation | f0f8c3464470991fc962d83cea20f3bcfd6a04b6 | [
"MIT"
] | null | null | null | theBroker/venv/Scripts/pip3.7-script.py | emirgo/WeatherStation | f0f8c3464470991fc962d83cea20f3bcfd6a04b6 | [
"MIT"
] | null | null | null | theBroker/venv/Scripts/pip3.7-script.py | emirgo/WeatherStation | f0f8c3464470991fc962d83cea20f3bcfd6a04b6 | [
"MIT"
] | null | null | null | #!"D:\1 UNIVERSITY\ProejctSoftwareEngineering\WeatherStation\theBroker\venv\Scripts\python.exe"
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==19.0.3','console_scripts','pip3.7'
__requires__ = 'pip==19.0.3'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-scri... | 34.461538 | 95 | 0.685268 |
__requires__ = 'pip==19.0.3'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(
load_entry_point('pip==19.0.3', 'console_scripts', 'pip3.7')()
)
| true | true |
f7ff8447dc20bb3f3a0edf84a6a61a23962008fa | 6,419 | py | Python | examples/domains/wikitext103_wae.py | awslabs/w-lda | 15eb320faac0570e858c689df6f2c61bcad3010e | [
"Apache-2.0"
] | 40 | 2019-12-06T20:55:47.000Z | 2022-03-25T14:07:34.000Z | examples/domains/wikitext103_wae.py | awslabs/w-lda | 15eb320faac0570e858c689df6f2c61bcad3010e | [
"Apache-2.0"
] | 7 | 2019-12-09T12:44:53.000Z | 2021-09-30T02:20:15.000Z | examples/domains/wikitext103_wae.py | awslabs/w-lda | 15eb320faac0570e858c689df6f2c61bcad3010e | [
"Apache-2.0"
] | 9 | 2019-12-08T08:20:03.000Z | 2021-12-28T14:17:32.000Z | # Copyright 2019 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... | 34.88587 | 108 | 0.627045 |
import os
import shutil
import numpy as np
from core import Data
from utils import reverse_dict
import scipy.sparse as sparse
import nltk
class Wikitext103(Data):
def __init__(self, batch_size, data_path='', ctx=None, saveto='', **kwargs):
self.saveto = saveto
super(Wikitext103, sel... | true | true |
f7ff8468c11e20a862b15c32e9ef8d87b9c6c1cd | 15,595 | py | Python | unit_tests/bigquery/test_query.py | Ofekmeister/google-cloud-python | 07dd51bc447beca67b8da1c66f1dfb944ef70418 | [
"Apache-2.0"
] | null | null | null | unit_tests/bigquery/test_query.py | Ofekmeister/google-cloud-python | 07dd51bc447beca67b8da1c66f1dfb944ef70418 | [
"Apache-2.0"
] | null | null | null | unit_tests/bigquery/test_query.py | Ofekmeister/google-cloud-python | 07dd51bc447beca67b8da1c66f1dfb944ef70418 | [
"Apache-2.0"
] | null | null | null | # Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 38.506173 | 79 | 0.597756 |
import unittest
class TestQueryResults(unittest.TestCase):
PROJECT = 'project'
JOB_NAME = 'job_name'
JOB_NAME = 'test-synchronous-query'
JOB_TYPE = 'query'
QUERY = 'select count(*) from persons'
TOKEN = 'TOKEN'
def _getTargetClass(self):
from google.cloud.bigquery.qu... | true | true |
f7ff84b0dacbdaf59048ed59c911b8125c0ae9f8 | 10,029 | py | Python | backend/src/database/usersCollectionManager.py | NRizzoInc/email_messages | d15826efb4e19d6c97738df582fc767d4db9ba3e | [
"MIT"
] | 1 | 2020-03-22T03:48:41.000Z | 2020-03-22T03:48:41.000Z | backend/src/database/usersCollectionManager.py | NRizzoInc/email_messages | d15826efb4e19d6c97738df582fc767d4db9ba3e | [
"MIT"
] | 31 | 2020-07-15T01:38:27.000Z | 2020-07-20T20:55:41.000Z | backend/src/database/usersCollectionManager.py | NRizzoInc/email_messages | d15826efb4e19d6c97738df582fc767d4db9ba3e | [
"MIT"
] | null | null | null | """
\n@File: Responsible for maintaing the "users" collection
"""
#------------------------------STANDARD DEPENDENCIES-----------------------------#
import json
import pickle, copyreg, ssl # for serializing User objects (SSL obj requires more work)
import uuid
#-----------------------------3RD PARTY DEPENDENCIES-... | 47.084507 | 115 | 0.622495 |
import json
import pickle, copyreg, ssl
import uuid
from pymongo import MongoClient, collection
from bson.binary import Binary
from backend.src import utils
from .databaseBaseClass import DatabaseBaseClass
class UsersCollectionManager(DatabaseBaseClass):
def __init__(self):
super().__init__()... | true | true |
f7ff84d32698d8122ff12028df7022ef707fb1cd | 123 | py | Python | af_price_fall_notifier_app/apps.py | chasesagar/Amazon-Scraper | b93ba83660f1c95173f7b35bd59221b4ed0ce37d | [
"MIT"
] | null | null | null | af_price_fall_notifier_app/apps.py | chasesagar/Amazon-Scraper | b93ba83660f1c95173f7b35bd59221b4ed0ce37d | [
"MIT"
] | null | null | null | af_price_fall_notifier_app/apps.py | chasesagar/Amazon-Scraper | b93ba83660f1c95173f7b35bd59221b4ed0ce37d | [
"MIT"
] | 1 | 2021-06-29T18:48:47.000Z | 2021-06-29T18:48:47.000Z | from django.apps import AppConfig
class AfPriceFallNotifierAppConfig(AppConfig):
name = 'af_price_fall_notifier_app'
| 20.5 | 46 | 0.821138 | from django.apps import AppConfig
class AfPriceFallNotifierAppConfig(AppConfig):
name = 'af_price_fall_notifier_app'
| true | true |
f7ff865acd0b8aa528055e46fb258327fcd51e57 | 28,207 | py | Python | renpy/sl2/slparser.py | theizrael/renpy-7.4.10-sdk | 312192c87f92eb0ac29be78d26421856f767279e | [
"Apache-2.0"
] | null | null | null | renpy/sl2/slparser.py | theizrael/renpy-7.4.10-sdk | 312192c87f92eb0ac29be78d26421856f767279e | [
"Apache-2.0"
] | null | null | null | renpy/sl2/slparser.py | theizrael/renpy-7.4.10-sdk | 312192c87f92eb0ac29be78d26421856f767279e | [
"Apache-2.0"
] | null | null | null | # Copyright 2004-2021 Tom Rothamel <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, m... | 27.044104 | 140 | 0.585812 |
from __future__ import division, absolute_import, with_statement, print_function, unicode_literals
from renpy.compat import *
import collections
import renpy.sl2
import renpy.sl2.slast as slast
from ast import literal_eval
STYLE_PREFIXES = [
'',
'insensitive_',
'hover_',
'idle_'... | true | true |
f7ff88ade726ea9906f544491a027b68a650a86a | 17,342 | py | Python | avclass2/avclass2_update_module.py | kazuya-n/avclass | eafc5755d96eb6defb222be4c18831e4f75fb038 | [
"MIT"
] | null | null | null | avclass2/avclass2_update_module.py | kazuya-n/avclass | eafc5755d96eb6defb222be4c18831e4f75fb038 | [
"MIT"
] | null | null | null | avclass2/avclass2_update_module.py | kazuya-n/avclass | eafc5755d96eb6defb222be4c18831e4f75fb038 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
AVClass2 Update module
'''
import sys
import os
import argparse
import logging
# Make sure paths are relative to execution path
script_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.join(script_dir, 'lib/'))
from operator import itemgetter
f... | 34.272727 | 79 | 0.547976 |
import sys
import os
import argparse
import logging
script_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.join(script_dir, 'lib/'))
from operator import itemgetter
from collections import namedtuple
from avclass2_common import Taxonomy, Expansion, Tagging
log = logging.getLogger(__nam... | true | true |
f7ff88e8eb54ae16817187f7e0247609ddf9b9ab | 2,253 | py | Python | heapprof/tests/si_prefix_test.py | humu/heapprof | c46a5d0de86d5d1c50b0aa1b7014ef0b2b46a821 | [
"MIT"
] | 34 | 2019-08-13T23:55:17.000Z | 2021-06-22T01:29:05.000Z | heapprof/tests/si_prefix_test.py | humu/heapprof | c46a5d0de86d5d1c50b0aa1b7014ef0b2b46a821 | [
"MIT"
] | 7 | 2019-08-13T22:33:03.000Z | 2021-09-27T22:39:59.000Z | heapprof/tests/si_prefix_test.py | humu/heapprof | c46a5d0de86d5d1c50b0aa1b7014ef0b2b46a821 | [
"MIT"
] | 5 | 2019-08-16T01:50:02.000Z | 2021-08-30T20:02:48.000Z | import unittest
from heapprof._si_prefix import siPrefixString
class SIPrefixTest(unittest.TestCase):
def testDecimal(self):
self.assertEqual('1050.00', siPrefixString(1050, threshold=1.1, precision=2))
self.assertEqual('1.05k', siPrefixString(1050, threshold=1.05, precision=2))
self.asse... | 43.326923 | 100 | 0.632046 | import unittest
from heapprof._si_prefix import siPrefixString
class SIPrefixTest(unittest.TestCase):
def testDecimal(self):
self.assertEqual('1050.00', siPrefixString(1050, threshold=1.1, precision=2))
self.assertEqual('1.05k', siPrefixString(1050, threshold=1.05, precision=2))
self.asse... | true | true |
f7ff89387b76cf80afb68ce72b0c49b1de0205fa | 532 | py | Python | 24.py | RafaelHuang87/Leet-Code-Practice | 7754dcee38ffda18a5759113ef06d7becf4fe728 | [
"MIT"
] | null | null | null | 24.py | RafaelHuang87/Leet-Code-Practice | 7754dcee38ffda18a5759113ef06d7becf4fe728 | [
"MIT"
] | null | null | null | 24.py | RafaelHuang87/Leet-Code-Practice | 7754dcee38ffda18a5759113ef06d7becf4fe728 | [
"MIT"
] | null | null | null | # Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def swapPairs(self, head: ListNode) -> ListNode:
if not head or not head.next:
return head
temp = ListNode(0)
temp.next = head
p ... | 24.181818 | 52 | 0.503759 |
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def swapPairs(self, head: ListNode) -> ListNode:
if not head or not head.next:
return head
temp = ListNode(0)
temp.next = head
p = temp
q = temp.next
... | true | true |
f7ff89c8555ab8adcdbf88a53a3f7b7f6a7a4435 | 1,155 | py | Python | solutions/ba6a.py | RafikFarhad/Bioinformatics_Codes | 3195a0533bd36fb4060dd7d3809ddd12edca499a | [
"MIT"
] | null | null | null | solutions/ba6a.py | RafikFarhad/Bioinformatics_Codes | 3195a0533bd36fb4060dd7d3809ddd12edca499a | [
"MIT"
] | null | null | null | solutions/ba6a.py | RafikFarhad/Bioinformatics_Codes | 3195a0533bd36fb4060dd7d3809ddd12edca499a | [
"MIT"
] | null | null | null | import itertools
import random
import networkx as nx
import sys
import pandas as pd
sys.setrecursionlimit(2000)
def prettyGenome(arr):
return '(' + ' '.join('{0:+d}'.format(_) for _ in arr) + ')'
def GreedySorting(genome):
length = len(genome)
res = []
for i in range(1, length+1):
try:
... | 26.25 | 89 | 0.555844 | import itertools
import random
import networkx as nx
import sys
import pandas as pd
sys.setrecursionlimit(2000)
def prettyGenome(arr):
return '(' + ' '.join('{0:+d}'.format(_) for _ in arr) + ')'
def GreedySorting(genome):
length = len(genome)
res = []
for i in range(1, length+1):
try:
... | true | true |
f7ff89ed2c936f359d381c8ef43ff719baaa57a5 | 8,824 | py | Python | corona_model/start_here.py | kukaiN/modeling_in_python | 99641bc2be5887c5571fd494f5025efe8a0441bb | [
"MIT"
] | 2 | 2021-02-06T04:15:08.000Z | 2022-03-14T12:02:34.000Z | corona_model/start_here.py | kukaiN/modeling_in_python | 99641bc2be5887c5571fd494f5025efe8a0441bb | [
"MIT"
] | null | null | null | corona_model/start_here.py | kukaiN/modeling_in_python | 99641bc2be5887c5571fd494f5025efe8a0441bb | [
"MIT"
] | 4 | 2021-01-03T05:17:54.000Z | 2021-06-08T16:00:25.000Z | import model_framework
import platform
import statfile
import copy
import fileRelated
import pandas as pd
import experiment as experiment
import main_config
from pathlib import Path
def main():
"""intialize and run the model, for indepth detail about the config or how to run the code, go to the github page for thi... | 42.423077 | 201 | 0.578536 | import model_framework
import platform
import statfile
import copy
import fileRelated
import pandas as pd
import experiment as experiment
import main_config
from pathlib import Path
def main():
modelConfig = main_config.modelConfig
R0_controls = {
"World" : [
("Dyna... | true | true |
f7ff8b7ca202cd306780e89b727abe6ed4218fe7 | 12,621 | py | Python | sdk/python/pulumi_azure_native/customerinsights/get_prediction.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/customerinsights/get_prediction.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/customerinsights/get_prediction.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilities, _tables
from ... | 39.688679 | 460 | 0.67356 |
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilities, _tables
from . import outputs
__all__ = [
'GetPredictionResult',
'AwaitableGetPredictionResult',
'get_prediction',
]
@pulumi.output_type
class GetPredictionResult:
... | true | true |
f7ff8bef525aba9cf35207b8d9e329ad82e68dd7 | 1,908 | py | Python | pinpayments/templatetags/pin_payment_tags.py | rossp/django-pinpayments | bf5aa733d2a3ab637a4431d409777a215ea9afc6 | [
"Unlicense"
] | 11 | 2015-02-01T08:22:47.000Z | 2021-04-15T03:52:17.000Z | pinpayments/templatetags/pin_payment_tags.py | rossp/django-pinpayments | bf5aa733d2a3ab637a4431d409777a215ea9afc6 | [
"Unlicense"
] | 18 | 2015-01-18T03:43:44.000Z | 2021-07-04T22:46:29.000Z | pinpayments/templatetags/pin_payment_tags.py | rossp/django-pinpayments | bf5aa733d2a3ab637a4431d409777a215ea9afc6 | [
"Unlicense"
] | 7 | 2015-05-30T08:41:06.000Z | 2020-03-09T07:09:39.000Z | """ The tags with which the JS components can be used """
from django import template
from django.conf import settings
register = template.Library()
def pin_header(context, environment=''):
"""
pin_header - Renders the JavaScript required for Pin.js payments.
This will also include the Pin.js file from p... | 30.285714 | 86 | 0.654612 | from django import template
from django.conf import settings
register = template.Library()
def pin_header(context, environment=''):
if environment == '':
environment = getattr(settings, 'PIN_DEFAULT_ENVIRONMENT', 'test')
pin_config = getattr(settings, 'PIN_ENVIRONMENTS', {})
if pin_config == {}... | true | true |
f7ff8bfb5c2e133efcd2c7a039f14c5b0f6c91ab | 5,635 | py | Python | appengine/standard/localtesting/datastore_test.py | HoleCat/echarlosperros | b67460de0467e05b42a763c4430b26ecfd97c2aa | [
"Apache-2.0"
] | null | null | null | appengine/standard/localtesting/datastore_test.py | HoleCat/echarlosperros | b67460de0467e05b42a763c4430b26ecfd97c2aa | [
"Apache-2.0"
] | null | null | null | appengine/standard/localtesting/datastore_test.py | HoleCat/echarlosperros | b67460de0467e05b42a763c4430b26ecfd97c2aa | [
"Apache-2.0"
] | null | null | null | # Copyright 2015 Google Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 33.945783 | 79 | 0.659095 |
import unittest
from google.appengine.api import memcache
from google.appengine.ext import ndb
from google.appengine.ext import testbed
class TestModel(ndb.Model):
number = ndb.IntegerProperty(default=42)
text = ndb.StringProperty()
class TestEntityGroupRoot(ndb.Model):
p... | true | true |
f7ff8c0cf99f3eff44688e61cf27a773698679f1 | 271 | py | Python | 36_delete_dictionary.py | onowdev/python-selflearning | 3d7245de0207a5bfcbce4f7adde60e7316b70a8e | [
"MIT"
] | null | null | null | 36_delete_dictionary.py | onowdev/python-selflearning | 3d7245de0207a5bfcbce4f7adde60e7316b70a8e | [
"MIT"
] | null | null | null | 36_delete_dictionary.py | onowdev/python-selflearning | 3d7245de0207a5bfcbce4f7adde60e7316b70a8e | [
"MIT"
] | null | null | null | dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}
del dict['Name'] # remove entry with key 'Name'
dict.clear() # remove all entries in dict
del dict # delete entire dictionary
print ("dict['Age']: ", dict['Age'])
print ("dict['School']: ", dict['School']) | 33.875 | 51 | 0.601476 | dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}
del dict['Name']
dict.clear()
del dict
print ("dict['Age']: ", dict['Age'])
print ("dict['School']: ", dict['School']) | true | true |
f7ff8d5f3b3a8efae18b233903b6f163cd85eab4 | 3,093 | py | Python | ocdskingfisherprocess/signals/signals.py | matiasSanabria/kingfisher-process | 88cb768aaa562714c8bd53e05717639faf041501 | [
"BSD-3-Clause"
] | null | null | null | ocdskingfisherprocess/signals/signals.py | matiasSanabria/kingfisher-process | 88cb768aaa562714c8bd53e05717639faf041501 | [
"BSD-3-Clause"
] | null | null | null | ocdskingfisherprocess/signals/signals.py | matiasSanabria/kingfisher-process | 88cb768aaa562714c8bd53e05717639faf041501 | [
"BSD-3-Clause"
] | null | null | null | import json
import redis
from ocdskingfisherprocess.signals import KINGFISHER_SIGNALS
from ocdskingfisherprocess.transform import TRANSFORM_TYPE_COMPILE_RELEASES, TRANSFORM_TYPE_UPGRADE_1_0_TO_1_1
# Doing globals this way is hacky. Look into https://www.mattlayman.com/blog/2015/blinker/ instead.
our_database = None
... | 44.826087 | 116 | 0.682509 | import json
import redis
from ocdskingfisherprocess.signals import KINGFISHER_SIGNALS
from ocdskingfisherprocess.transform import TRANSFORM_TYPE_COMPILE_RELEASES, TRANSFORM_TYPE_UPGRADE_1_0_TO_1_1
our_database = None
our_config = None
def setup_signals(config, database):
global our_database, our_config
ou... | true | true |
f7ff8f95b00bb8f885e1e0d70e2b6eced1db0735 | 1,173 | py | Python | util/paths.py | weg-li-project/car-ml | 3c0f09c21fd14fa17e8f3faee84f7960e6e7f729 | [
"FTL",
"CNRI-Python"
] | null | null | null | util/paths.py | weg-li-project/car-ml | 3c0f09c21fd14fa17e8f3faee84f7960e6e7f729 | [
"FTL",
"CNRI-Python"
] | null | null | null | util/paths.py | weg-li-project/car-ml | 3c0f09c21fd14fa17e8f3faee84f7960e6e7f729 | [
"FTL",
"CNRI-Python"
] | null | null | null | import os
dirname = os.path.dirname(os.path.realpath(__file__))
root_path = os.path.join(dirname, "..")
data_path = os.path.join(root_path, "data/")
city_ids_path = os.path.join(data_path, "city_ids.csv")
charges_schroeder_path = os.path.join(data_path, "charges_schroeder/")
charges_csv_filepath = os.path.join(charg... | 45.115385 | 83 | 0.793691 | import os
dirname = os.path.dirname(os.path.realpath(__file__))
root_path = os.path.join(dirname, "..")
data_path = os.path.join(root_path, "data/")
city_ids_path = os.path.join(data_path, "city_ids.csv")
charges_schroeder_path = os.path.join(data_path, "charges_schroeder/")
charges_csv_filepath = os.path.join(charg... | true | true |
f7ff8feaadfea426f8f446a8b3e7180f1f38f203 | 2,496 | py | Python | ogindia/tests/test_data.py | pravinrawal/OG-India | 5903effc6ed2dad63ce149c54444f44323d35936 | [
"CC0-1.0"
] | 1 | 2018-05-31T11:19:15.000Z | 2018-05-31T11:19:15.000Z | ogindia/tests/test_data.py | dc4tpru/OG-India | b2d6b6a561c48d52a5aef0fff1c3b40691ee8680 | [
"CC0-1.0"
] | null | null | null | ogindia/tests/test_data.py | dc4tpru/OG-India | b2d6b6a561c48d52a5aef0fff1c3b40691ee8680 | [
"CC0-1.0"
] | null | null | null | import pytest
import os
from ogindia.utils import CPS_START_YEAR
def test_cps():
"""
Check that setting `data` to 'cps' uses cps data
"""
from ogindia import get_micro_data
baseline = False
start_year = 2016
reform = {"II_em": {2017: 10000}}
calc = get_micro_data.get_calculator(
... | 34.666667 | 75 | 0.653446 | import pytest
import os
from ogindia.utils import CPS_START_YEAR
def test_cps():
from ogindia import get_micro_data
baseline = False
start_year = 2016
reform = {"II_em": {2017: 10000}}
calc = get_micro_data.get_calculator(
baseline, start_year, reform=reform,
records_start_year=CP... | true | true |
f7ff8feebee93dede0167bc6be2ac2ebf5d558ac | 5,313 | py | Python | lark/parsers/lalr_parser.py | asellappen/lark | da6a4e4d00022452abf59df4b4232480608d4f7d | [
"MIT"
] | null | null | null | lark/parsers/lalr_parser.py | asellappen/lark | da6a4e4d00022452abf59df4b4232480608d4f7d | [
"MIT"
] | null | null | null | lark/parsers/lalr_parser.py | asellappen/lark | da6a4e4d00022452abf59df4b4232480608d4f7d | [
"MIT"
] | null | null | null | """This module implements a LALR(1) Parser
"""
# Author: Erez Shinan (2017)
# Email : erezshin@gmail.com
from copy import deepcopy, copy
from ..exceptions import UnexpectedInput, UnexpectedToken
from ..lexer import Token
from ..utils import Serialize
from .lalr_analysis import LALR_Analyzer, Shift, Reduce, IntParseTab... | 32.2 | 100 | 0.590627 |
from copy import deepcopy, copy
from ..exceptions import UnexpectedInput, UnexpectedToken
from ..lexer import Token
from ..utils import Serialize
from .lalr_analysis import LALR_Analyzer, Shift, Reduce, IntParseTable
from .lalr_puppet import ParserPuppet
lize):
def __init__(self, parser_conf, debug=False):
... | true | true |
f7ff90f22f20a2fc1aa1486b41f8828b018cc1e2 | 2,803 | py | Python | test/Python/Tracing/slice.py | cathyzhyi/mlir-npcomp | 79a3f639bfb449ba1409ff6dff161badf5a11b44 | [
"Apache-2.0"
] | null | null | null | test/Python/Tracing/slice.py | cathyzhyi/mlir-npcomp | 79a3f639bfb449ba1409ff6dff161badf5a11b44 | [
"Apache-2.0"
] | null | null | null | test/Python/Tracing/slice.py | cathyzhyi/mlir-npcomp | 79a3f639bfb449ba1409ff6dff161badf5a11b44 | [
"Apache-2.0"
] | null | null | null | # RUN: %PYTHON %s | FileCheck %s --dump-input=fail
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
import numpy as np
import npcomp as npc
from npcomp.types import *... | 57.204082 | 423 | 0.616126 |
import numpy as np
import npcomp as npc
from npcomp.types import *
def slice_array1(a: np.ndarray) -> np.ndarray:
return a[1, 2:10:2, 3:4, ..., :, 0]
exp = npc.Exporter()
exp.slice_array1 = slice_array1
mb = npc.tracing.ModuleBuilder()
mb.trace(exp.slice_array1)
print(mb.module)
| true | true |
f7ff919354d89409915048a72e9c703ef3ab68c9 | 228 | py | Python | tests/test_ws_timeout_error.py | gridsmartercities/pywsitest | 7d438477bfc61b6e3adeab6530f52a24359249d8 | [
"MIT"
] | 19 | 2019-07-31T14:51:25.000Z | 2021-12-10T08:43:46.000Z | tests/test_ws_timeout_error.py | gridsmartercities/pywsitest | 7d438477bfc61b6e3adeab6530f52a24359249d8 | [
"MIT"
] | 10 | 2019-07-30T12:07:24.000Z | 2020-12-27T18:33:07.000Z | tests/test_ws_timeout_error.py | gridsmartercities/pywsitest | 7d438477bfc61b6e3adeab6530f52a24359249d8 | [
"MIT"
] | 1 | 2021-03-29T09:33:45.000Z | 2021-03-29T09:33:45.000Z | import unittest
from pywsitest import WSTimeoutError
class WSTimeoutErrorTests(unittest.TestCase):
def test_receive_timeout_error(self):
with self.assertRaises(WSTimeoutError):
raise WSTimeoutError()
| 20.727273 | 47 | 0.758772 | import unittest
from pywsitest import WSTimeoutError
class WSTimeoutErrorTests(unittest.TestCase):
def test_receive_timeout_error(self):
with self.assertRaises(WSTimeoutError):
raise WSTimeoutError()
| true | true |
f7ff919e79118549fe71d1a4b1102a4ab7d17b01 | 2,060 | py | Python | find-atlas-review-errors/review_visits.py | gbabineau/find-atlas-coding-errors | d64601eaf5171e5f867194ff925bc06bbacd8cd6 | [
"MIT"
] | null | null | null | find-atlas-review-errors/review_visits.py | gbabineau/find-atlas-coding-errors | d64601eaf5171e5f867194ff925bc06bbacd8cd6 | [
"MIT"
] | null | null | null | find-atlas-review-errors/review_visits.py | gbabineau/find-atlas-coding-errors | d64601eaf5171e5f867194ff925bc06bbacd8cd6 | [
"MIT"
] | null | null | null | """Reviews visits in an area for checklists from a user and then checks the checklist."""
# Copyright (c) 2019 Guy Babineau
from .review_checklist import review_checklist
from ebird.api import get_visits
import sys
from time import sleep
import datetime
def review_visits(ebird_api_key, user, area, day, end_day, max... | 36.785714 | 109 | 0.618932 |
from .review_checklist import review_checklist
from ebird.api import get_visits
import sys
from time import sleep
import datetime
def review_visits(ebird_api_key, user, area, day, end_day, max_records, verbose):
while day < end_day:
day_string = day.strftime("%Y-%m-%d")
records = get_visits(eb... | true | true |
f7ff9368d46a6ee205cf989e3f3614e7ddcfbd01 | 1,806 | py | Python | forms/widgets.py | goztrk/django-htk | c56bf112e5d627780d2f4288460eae5cce80fa9e | [
"MIT"
] | 206 | 2015-10-15T07:05:08.000Z | 2021-02-19T11:48:36.000Z | forms/widgets.py | goztrk/django-htk | c56bf112e5d627780d2f4288460eae5cce80fa9e | [
"MIT"
] | 8 | 2017-10-16T10:18:31.000Z | 2022-03-09T14:24:27.000Z | forms/widgets.py | goztrk/django-htk | c56bf112e5d627780d2f4288460eae5cce80fa9e | [
"MIT"
] | 61 | 2015-10-15T08:12:44.000Z | 2022-03-10T12:25:06.000Z | # Django Imports
from django import forms
from django.utils.html import format_html
from django.utils.safestring import mark_safe
# Deprecated in Django 1.11
# forms.widgets.RadioChoiceInput
# https://docs.djangoproject.com/en/2.0/releases/1.11/#changes-due-to-the-introduction-of-template-based-widget-rendering
#clas... | 41.045455 | 121 | 0.699336 |
from django import forms
from django.utils.html import format_html
from django.utils.safestring import mark_safe
me=None, value=None, attrs=None, choices=()):
if self.id_for_label:
label_for = format_html(' for="{}"', self.id_for_label)
else:
label_for = ''
attrs = d... | true | true |
f7ff93a889c163a27fc4941239fce6a14517aee6 | 315 | py | Python | 01-Defining_classes_exercises/01-Car.py | Beshkov/OOP | 297edadb3e7801dfeee5752a20aae6aead8da610 | [
"MIT"
] | 1 | 2021-05-24T17:51:53.000Z | 2021-05-24T17:51:53.000Z | 01-Defining_classes_exercises/01-Car.py | Beshkov/Python_OOP | 297edadb3e7801dfeee5752a20aae6aead8da610 | [
"MIT"
] | null | null | null | 01-Defining_classes_exercises/01-Car.py | Beshkov/Python_OOP | 297edadb3e7801dfeee5752a20aae6aead8da610 | [
"MIT"
] | null | null | null | class Car:
def __init__(self, name: str, model: str, engine: str):
self.name = name
self.model = model
self.engine = engine
def get_info(self):
return f"This is {self.name} {self.model} with engine {self.engine}"
car = Car("Kia", "Rio", "1.3L B3 I4")
print(car.get_info())
| 26.25 | 76 | 0.6 | class Car:
def __init__(self, name: str, model: str, engine: str):
self.name = name
self.model = model
self.engine = engine
def get_info(self):
return f"This is {self.name} {self.model} with engine {self.engine}"
car = Car("Kia", "Rio", "1.3L B3 I4")
print(car.get_info())
| true | true |
f7ff942579a4801b676132b04a313b199a535b79 | 1,462 | py | Python | makeCourse/theme.py | dualspiral/makecourse | 96c0d3137b00a400df082f160eabf8a925953067 | [
"Apache-2.0"
] | null | null | null | makeCourse/theme.py | dualspiral/makecourse | 96c0d3137b00a400df082f160eabf8a925953067 | [
"Apache-2.0"
] | null | null | null | makeCourse/theme.py | dualspiral/makecourse | 96c0d3137b00a400df082f160eabf8a925953067 | [
"Apache-2.0"
] | null | null | null | import logging
from distutils.dir_util import copy_tree
logger = logging.getLogger(__name__)
class Theme(object):
def __init__(self, course, name, source, theme_data):
self.course = course
self.hidden = False
self.name = name
self.source = source
keys = ('title','path','hi... | 28.666667 | 91 | 0.597127 | import logging
from distutils.dir_util import copy_tree
logger = logging.getLogger(__name__)
class Theme(object):
def __init__(self, course, name, source, theme_data):
self.course = course
self.hidden = False
self.name = name
self.source = source
keys = ('title','path','hi... | true | true |
f7ff9471450d2bad8c34351cb527a5d4e836e49d | 1,647 | py | Python | consumer_markethistory.py | brentnowak/spotmarket | b19982e6bbf595f43bb200802aa24da0802b447a | [
"Unlicense"
] | 20 | 2016-01-29T19:39:46.000Z | 2018-05-05T08:58:21.000Z | consumer_markethistory.py | brentnowak/spotmarket | b19982e6bbf595f43bb200802aa24da0802b447a | [
"Unlicense"
] | 2 | 2016-03-18T13:32:08.000Z | 2016-06-12T01:00:36.000Z | consumer_markethistory.py | brentnowak/spotmarket | b19982e6bbf595f43bb200802aa24da0802b447a | [
"Unlicense"
] | 11 | 2016-01-29T18:59:04.000Z | 2021-01-31T09:39:11.000Z | #-----------------------------------------------------------------------------
# consumer_markethistory.py -
# https://github.com/brentnowak/spotmarket
#-----------------------------------------------------------------------------
# Version: 0.1
# - Initial release
# Version: 0.2
# - Migration to market.history
# Versi... | 33.612245 | 126 | 0.585307 |
import concurrent.futures
import multiprocessing
from time import sleep
from _market import *
import requests.packages.urllib3
requests.packages.urllib3.disable_warnings()
maxWorkers = multiprocessing.cpu_count()
def main():
for regionID in regionIDs:
currentItems = 1
with co... | true | true |
f7ff95485672645e78447f87866304c52504f253 | 202 | py | Python | Modules/regression/classes/termcol.py | williamclot/PrivacyPreservingRidgeRegression | 5e0379162bdf114d862982a5ac438f076aa3c81b | [
"X11"
] | 1 | 2019-08-19T13:38:51.000Z | 2019-08-19T13:38:51.000Z | Modules/regression/classes/termcol.py | williamclot/PrivacyPreservingRidgeRegression | 5e0379162bdf114d862982a5ac438f076aa3c81b | [
"X11"
] | null | null | null | Modules/regression/classes/termcol.py | williamclot/PrivacyPreservingRidgeRegression | 5e0379162bdf114d862982a5ac438f076aa3c81b | [
"X11"
] | 1 | 2021-03-05T06:46:01.000Z | 2021-03-05T06:46:01.000Z | class termcol:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m' | 22.444444 | 25 | 0.514851 | class termcol:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m' | true | true |
f7ff964837facfd0d3166dcc02e325121e8c1e97 | 1,588 | py | Python | blueapps/account/utils/sms.py | TencentBlueKing/bk-chatbot | da37fb2197142eae32158cdb5c2b658100133fff | [
"MIT"
] | 11 | 2021-05-27T11:45:02.000Z | 2022-03-29T15:03:28.000Z | blueapps/account/utils/sms.py | hchicken/bk-chatbot | da37fb2197142eae32158cdb5c2b658100133fff | [
"MIT"
] | 2 | 2021-08-16T03:59:19.000Z | 2021-09-29T09:31:39.000Z | blueapps/account/utils/sms.py | hchicken/bk-chatbot | da37fb2197142eae32158cdb5c2b658100133fff | [
"MIT"
] | 12 | 2021-05-27T11:59:18.000Z | 2022-03-17T07:21:53.000Z | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2020 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | 31.76 | 115 | 0.745592 |
from blueapps.account.conf import ConfFixture
from blueapps.utils import client
from blueapps.utils.esbclient import CustomComponentAPI
def send_sms(user_list, content):
sms_module = client.__getattr__(ConfFixture.SMS_CLIENT_MODULE)
sms_func = sms_module.__getattr__(ConfFixture.SMS_CLIENT_FUNC)
... | true | true |
f7ff96fb054f634cdbe2acbb1c32a07b7bf004a6 | 801 | py | Python | examples/ServiceMonitor/monitor/filters/timeout.py | frikyalong/vnpy | d8ea554e34ff285c97cc2ddb4e881a1f0a6f02d3 | [
"MIT"
] | 1 | 2018-11-05T07:34:36.000Z | 2018-11-05T07:34:36.000Z | examples/ServiceMonitor/monitor/filters/timeout.py | frikyalong/vnpy | d8ea554e34ff285c97cc2ddb4e881a1f0a6f02d3 | [
"MIT"
] | null | null | null | examples/ServiceMonitor/monitor/filters/timeout.py | frikyalong/vnpy | d8ea554e34ff285c97cc2ddb4e881a1f0a6f02d3 | [
"MIT"
] | null | null | null | import datetime
from .base import BaseFilter
class Timeout(BaseFilter):
def get_default_options(self):
return {
"key": "timestamp",
"timestamp_format": "%Y-%m-%d %H:%M:%S",
}
def __call__(self, event):
key = self.options["key"]
fmt = self.options["time... | 27.62069 | 65 | 0.520599 | import datetime
from .base import BaseFilter
class Timeout(BaseFilter):
def get_default_options(self):
return {
"key": "timestamp",
"timestamp_format": "%Y-%m-%d %H:%M:%S",
}
def __call__(self, event):
key = self.options["key"]
fmt = self.options["time... | true | true |
f7ff97037fe05e4ebb3b0c42d212be0d1a25687e | 6,513 | py | Python | src/model.py | tadeoos/gpt-2 | 32e29f1acca9ade9913b5d0d2b71384c31357eed | [
"MIT"
] | null | null | null | src/model.py | tadeoos/gpt-2 | 32e29f1acca9ade9913b5d0d2b71384c31357eed | [
"MIT"
] | null | null | null | src/model.py | tadeoos/gpt-2 | 32e29f1acca9ade9913b5d0d2b71384c31357eed | [
"MIT"
] | null | null | null | import numpy as np
import tensorflow as tf
from tensorflow.contrib.training import HParams
def default_hparams():
return HParams(
n_vocab=0,
n_ctx=1024,
n_embd=768,
n_head=12,
n_layer=12,
)
def shape_list(x):
"""Deal with dynamic shape in tensorflow cleanly."""
... | 37.217143 | 108 | 0.600952 | import numpy as np
import tensorflow as tf
from tensorflow.contrib.training import HParams
def default_hparams():
return HParams(
n_vocab=0,
n_ctx=1024,
n_embd=768,
n_head=12,
n_layer=12,
)
def shape_list(x):
static = x.shape.as_list()
dynamic = tf.shape(x)
... | true | true |
f7ff970541213aae1643b6660e4fc2a38f053040 | 8,660 | py | Python | AutomatedTesting/Gem/PythonTests/Atom/atom_utils/material_editor_utils.py | LB-JakubSkorupka/o3de | e224fc2ee5ec2a12e75a10acae268b7b38ae3a32 | [
"Apache-2.0",
"MIT"
] | 11 | 2021-07-08T09:58:26.000Z | 2022-03-17T17:59:26.000Z | AutomatedTesting/Gem/PythonTests/Atom/atom_utils/material_editor_utils.py | LB-JakubSkorupka/o3de | e224fc2ee5ec2a12e75a10acae268b7b38ae3a32 | [
"Apache-2.0",
"MIT"
] | 29 | 2021-07-06T19:33:52.000Z | 2022-03-22T10:27:49.000Z | AutomatedTesting/Gem/PythonTests/Atom/atom_utils/material_editor_utils.py | LB-JakubSkorupka/o3de | e224fc2ee5ec2a12e75a10acae268b7b38ae3a32 | [
"Apache-2.0",
"MIT"
] | 4 | 2021-07-06T19:24:43.000Z | 2022-03-31T12:42:27.000Z | """
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
import azlmbr.materialeditor will fail with a ModuleNotFound error when using this script with Editor.exe
This is b... | 30.70922 | 117 | 0.703811 |
import os
import sys
import time
import azlmbr.atom
import azlmbr.atomtools as atomtools
import azlmbr.materialeditor as materialeditor
import azlmbr.bus as bus
def is_close(actual, expected, buffer=sys.float_info.min):
return abs(actual - expected) < buffer
def compare_colors(color1, color2, buffer=0.00001):
... | true | true |
f7ff97137f9a1ddaea3def32100e9bb4a61d73a5 | 8,225 | py | Python | appengine-mapreduce/python/test/mapreduce/shuffler_end_to_end_test.py | bslatkin/8-bits | 1608a53bdd5ff491519396212679dc79cc07fca4 | [
"Apache-2.0"
] | 2 | 2015-02-18T08:12:23.000Z | 2015-09-24T20:35:41.000Z | appengine-mapreduce/python/test/mapreduce/shuffler_end_to_end_test.py | bslatkin/8-bits | 1608a53bdd5ff491519396212679dc79cc07fca4 | [
"Apache-2.0"
] | null | null | null | appengine-mapreduce/python/test/mapreduce/shuffler_end_to_end_test.py | bslatkin/8-bits | 1608a53bdd5ff491519396212679dc79cc07fca4 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
#
# Copyright 2011 Google Inc. All Rights Reserved.
import unittest
from mapreduce.lib import pipeline
from google.appengine.api import files
from google.appengine.api.files import file_service_pb
from google.appengine.api.files import records
from google.appengine.ext import db
from mapredu... | 32.003891 | 77 | 0.665897 |
import unittest
from mapreduce.lib import pipeline
from google.appengine.api import files
from google.appengine.api.files import file_service_pb
from google.appengine.api.files import records
from google.appengine.ext import db
from mapreduce import base_handler
from mapreduce import control
from mapreduce imp... | true | true |
f7ff9714c765e0542e3601d9a4160a715926b8f5 | 1,191 | py | Python | zun/tests/unit/scheduler/fakes.py | wanghuiict/zun | 2f4a3a2ba06d7ca83002418d4003ee5dece70952 | [
"Apache-2.0"
] | 83 | 2016-09-14T22:06:26.000Z | 2022-01-27T03:49:52.000Z | zun/tests/unit/scheduler/fakes.py | wanghuiict/zun | 2f4a3a2ba06d7ca83002418d4003ee5dece70952 | [
"Apache-2.0"
] | 5 | 2019-08-14T06:46:03.000Z | 2021-12-13T20:01:25.000Z | zun/tests/unit/scheduler/fakes.py | wanghuiict/zun | 2f4a3a2ba06d7ca83002418d4003ee5dece70952 | [
"Apache-2.0"
] | 54 | 2016-09-29T10:16:02.000Z | 2022-01-28T19:12:49.000Z | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | 32.189189 | 78 | 0.697733 |
from zun.scheduler import driver
from zun.scheduler import host_state
class FakeScheduler(driver.Scheduler):
def select_destinations(self, context, containers):
return []
class FakeHostState(host_state.HostState):
def __init__(self, host, attribute_dict=None):
super(FakeHostStat... | true | true |
f7ff98278ed3aea357fb128d2c1891cb33488220 | 46,629 | py | Python | tests/unit/commands/local/lib/test_cfn_api_provider.py | G4brym/aws-sam-cli | 0601140f031f5b325b1861b298a6a589cf9c072b | [
"BSD-2-Clause",
"Apache-2.0"
] | null | null | null | tests/unit/commands/local/lib/test_cfn_api_provider.py | G4brym/aws-sam-cli | 0601140f031f5b325b1861b298a6a589cf9c072b | [
"BSD-2-Clause",
"Apache-2.0"
] | null | null | null | tests/unit/commands/local/lib/test_cfn_api_provider.py | G4brym/aws-sam-cli | 0601140f031f5b325b1861b298a6a589cf9c072b | [
"BSD-2-Clause",
"Apache-2.0"
] | null | null | null | import json
import tempfile
from collections import OrderedDict
from unittest import TestCase
from unittest.mock import patch
from samcli.lib.providers.api_provider import ApiProvider
from samcli.lib.providers.cfn_api_provider import CfnApiProvider
from samcli.local.apigw.local_apigw_service import Route
from tests.u... | 42.39 | 122 | 0.427524 | import json
import tempfile
from collections import OrderedDict
from unittest import TestCase
from unittest.mock import patch
from samcli.lib.providers.api_provider import ApiProvider
from samcli.lib.providers.cfn_api_provider import CfnApiProvider
from samcli.local.apigw.local_apigw_service import Route
from tests.u... | true | true |
f7ff9829419919ac745e63240c388ce1ca72f8c0 | 4,385 | py | Python | mdn_cell/mdn_train_K4_fullnet.py | fregu856/ebms_proposals | e3e1cc35d5419ca61e25decb243a0b8bebd0d700 | [
"MIT"
] | 2 | 2021-11-07T23:00:38.000Z | 2021-12-14T16:17:50.000Z | mdn_cell/mdn_train_K4_fullnet.py | fregu856/ebms_proposals | e3e1cc35d5419ca61e25decb243a0b8bebd0d700 | [
"MIT"
] | null | null | null | mdn_cell/mdn_train_K4_fullnet.py | fregu856/ebms_proposals | e3e1cc35d5419ca61e25decb243a0b8bebd0d700 | [
"MIT"
] | null | null | null | # camera-ready
from datasets import DatasetTrain # (this needs to be imported before torch, because cv2 needs to be imported before torch for some reason)
from mdn_model_K4 import ToyNet
import torch
import torch.utils.data
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torc... | 40.981308 | 162 | 0.549373 |
from datasets import DatasetTrain
from mdn_model_K4 import ToyNet
import torch
import torch.utils.data
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torch.distributions
import math
import numpy as np
import pickle
import matplotlib
matplotlib.use("Agg")
import matplotlib... | true | true |
f7ff9b6c52541d9375bf8ae450b329c17fa442d9 | 3,545 | py | Python | 16-ratios/test.py | Yu-Nie/YOLOV3 | 09db1d551d293dcfa7a638fd6693920840d28a74 | [
"MIT"
] | null | null | null | 16-ratios/test.py | Yu-Nie/YOLOV3 | 09db1d551d293dcfa7a638fd6693920840d28a74 | [
"MIT"
] | null | null | null | 16-ratios/test.py | Yu-Nie/YOLOV3 | 09db1d551d293dcfa7a638fd6693920840d28a74 | [
"MIT"
] | null | null | null | from torch.utils.data import DataLoader
import utils.gpu as gpu
from model.yolov3 import Yolov3
from tqdm import tqdm
from utils.tools import *
from eval.evaluator import Evaluator
import argparse
import os
import config.yolov3_config_voc as cfg
from utils.visualize import *
# import os
# os.environ["CUDA_VISIBLE_DEVI... | 34.086538 | 136 | 0.5811 | from torch.utils.data import DataLoader
import utils.gpu as gpu
from model.yolov3 import Yolov3
from tqdm import tqdm
from utils.tools import *
from eval.evaluator import Evaluator
import argparse
import os
import config.yolov3_config_voc as cfg
from utils.visualize import *
class Tester(object):
def __init__(... | true | true |
f7ff9e691e95a169021cf669c7b683fe01f402df | 7,834 | py | Python | cub_attr1.py | elviswf/pytorch_cv | a7f11f857a0c1d5e5a807aeed5e594659212fba0 | [
"Apache-2.0"
] | null | null | null | cub_attr1.py | elviswf/pytorch_cv | a7f11f857a0c1d5e5a807aeed5e594659212fba0 | [
"Apache-2.0"
] | null | null | null | cub_attr1.py | elviswf/pytorch_cv | a7f11f857a0c1d5e5a807aeed5e594659212fba0 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""
@Time : 2017/12/4 15:42
@Author : Elvis
cub.py
watch --color -n1 gpustat -cpu
CUDA_VISIBLE_DEVICES=3 python cub_attr1.py
zsl_resnet18_fc00 : Sigmoid + dropout 0.5 74.789% (1329/1777) ZSL_Acc: 53.354% (1583/2967) 200 epoch
zsl_resnet18_fc01 : Sigmoid with fc pretrain Acc: 73.044% ... | 36.268519 | 107 | 0.654583 |
import torch
from torch import nn
from torch import optim
from torch.backends import cudnn
from torch.autograd import Variable
import os
import argparse
from data.data_loader import DataLoader
from models.zsl_resnet import attrCNN
from utils.logger import progress_bar
BASE_LR = 0.01
NUM_CLASSES = 150
NUM_ATTR =... | true | true |
f7ff9e7a1ee17cc4704a27a27776b87141cc4a26 | 1,102 | py | Python | prody/chromatin/__init__.py | grandevelia/ProDy | 7c725640a94c16543423c0756388998cb86a97ae | [
"MIT"
] | 210 | 2015-01-26T08:17:56.000Z | 2022-03-30T01:40:34.000Z | prody/chromatin/__init__.py | grandevelia/ProDy | 7c725640a94c16543423c0756388998cb86a97ae | [
"MIT"
] | 555 | 2015-01-05T21:51:54.000Z | 2022-03-31T16:51:41.000Z | prody/chromatin/__init__.py | grandevelia/ProDy | 7c725640a94c16543423c0756388998cb86a97ae | [
"MIT"
] | 99 | 2015-02-09T18:00:39.000Z | 2022-03-07T12:52:51.000Z | # -*- coding: utf-8 -*-
"""This module defines classes and functions to parse and write Hi-C data files,
visualize, and perform elastic network analysis on Hi-C data.
Parse/write Hi-C files
=====================
Following ProDy functions are for parsing and writing Hi-C files:
* :func:`.parseHiC` - parse Hi-C dat... | 21.607843 | 81 | 0.676951 |
import prody
LOGGER = prody.LOGGER
SETTINGS = prody.SETTINGS
__all__ = []
from . import hic
from .hic import *
__all__.extend(hic.__all__)
from . import norm
from .norm import *
__all__.extend(norm.__all__)
from . import cluster
from .cluster import *
__all__.extend(cluster.__all__)
from . import functions
from ... | true | true |
f7ff9ef7751a1e2fa272c6a3b3e1c6487709744c | 1,976 | py | Python | sequence_search/db/tests/test_base.py | RNAcentral/sequence_search | e0319e384cc9dea017f165e2c4c5143ee232f9fd | [
"Apache-2.0"
] | 2 | 2019-02-13T16:33:46.000Z | 2019-10-22T16:27:00.000Z | sequence_search/db/tests/test_base.py | RNAcentral/sequence_search | e0319e384cc9dea017f165e2c4c5143ee232f9fd | [
"Apache-2.0"
] | 110 | 2019-02-15T15:06:05.000Z | 2022-03-04T16:03:38.000Z | sequence_search/db/tests/test_base.py | RNAcentral/sequence_search | e0319e384cc9dea017f165e2c4c5143ee232f9fd | [
"Apache-2.0"
] | 1 | 2021-06-30T21:39:35.000Z | 2021-06-30T21:39:35.000Z | """
Copyright [2009-2019] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | 42.042553 | 119 | 0.742915 |
import logging
from aiohttp import web, web_middlewares
from aiohttp.test_utils import AioHTTPTestCase
from sequence_search.db.models import init_pg
from sequence_search.db.settings import get_postgres_credentials
class DBTestCase(AioHTTPTestCase):
async def get_application(self):
logging.basicConfig(l... | true | true |
f7ff9f287cc5eace3114bff34cc4d5ea8716e13d | 4,876 | py | Python | fdk_client/application/models/FeedbackValidator.py | kavish-d/fdk-client-python | a1023eb530473322cb52e095fc4ceb226c1e6037 | [
"MIT"
] | null | null | null | fdk_client/application/models/FeedbackValidator.py | kavish-d/fdk-client-python | a1023eb530473322cb52e095fc4ceb226c1e6037 | [
"MIT"
] | null | null | null | fdk_client/application/models/FeedbackValidator.py | kavish-d/fdk-client-python | a1023eb530473322cb52e095fc4ceb226c1e6037 | [
"MIT"
] | null | null | null | """Class Validators."""
from marshmallow import fields, Schema
from marshmallow.validate import OneOf
from ..enums import *
from ..models.BaseSchema import BaseSchema
class FeedbackValidator:
class createAbuseReport(BaseSchema):
pass
class updateAbuseReport(BaseSchema):
... | 23 | 82 | 0.5484 |
from marshmallow import fields, Schema
from marshmallow.validate import OneOf
from ..enums import *
from ..models.BaseSchema import BaseSchema
class FeedbackValidator:
class createAbuseReport(BaseSchema):
pass
class updateAbuseReport(BaseSchema):
pass
cla... | true | true |
f7ff9f6b5756f215cb956437f8d7e710b371945c | 8,270 | py | Python | cbf_clf_qp.py | kimukook/CLF-CBF-python | 28a46a4f9abf095e1f1b92e6cc056956caab5374 | [
"MIT"
] | null | null | null | cbf_clf_qp.py | kimukook/CLF-CBF-python | 28a46a4f9abf095e1f1b92e6cc056956caab5374 | [
"MIT"
] | null | null | null | cbf_clf_qp.py | kimukook/CLF-CBF-python | 28a46a4f9abf095e1f1b92e6cc056956caab5374 | [
"MIT"
] | null | null | null | '''
=====================================
Author : Muhan Zhao
Date : Feb. 16, 2020
Location: UC San Diego, La Jolla, CA
=====================================
'''
import numpy as np
import cvxpy as cp
class OptionsClass:
"""
Options Class
"""
def __init__(self):
self.options = None
... | 34.173554 | 120 | 0.525998 |
import numpy as np
import cvxpy as cp
class OptionsClass:
def __init__(self):
self.options = None
self.solverName = 'None'
def set_option(self, key, value):
try:
if type(value) is self.options[key][2]:
self.options[key][0] = value
else:
... | true | true |
f7ffa092811cfb98f8aabe5c4c7fe9bafccaa4a9 | 857 | py | Python | imodels/tree/iterative_random_forest/iterative_random_forest.py | csinva/interpretability-workshop | db201be7723179a1f5ab20b242419a604edc9186 | [
"MIT"
] | 1 | 2019-07-09T14:19:16.000Z | 2019-07-09T14:19:16.000Z | imodels/tree/iterative_random_forest/iterative_random_forest.py | csinva/interpretability-workshop | db201be7723179a1f5ab20b242419a604edc9186 | [
"MIT"
] | null | null | null | imodels/tree/iterative_random_forest/iterative_random_forest.py | csinva/interpretability-workshop | db201be7723179a1f5ab20b242419a604edc9186 | [
"MIT"
] | null | null | null | import numpy as np
from irf.ensemble import wrf
from sklearn.base import BaseEstimator
class IRFClassifier(BaseEstimator):
def __init__(self):
self.model = wrf()
self.predict = self.model.predict
self.predict_proba = self.model.predict_proba
def fit(self, X, y, lambda_reg=0.1, sample_... | 26.78125 | 76 | 0.605601 | import numpy as np
from irf.ensemble import wrf
from sklearn.base import BaseEstimator
class IRFClassifier(BaseEstimator):
def __init__(self):
self.model = wrf()
self.predict = self.model.predict
self.predict_proba = self.model.predict_proba
def fit(self, X, y, lambda_reg=0.1, sample_... | true | true |
f7ffa1e10c8902c4cf1150a9280e121b87615fc9 | 8,522 | py | Python | tests/test_connect.py | risicle/clickhouse-driver | d36569f52d3e62ad2e275b1d63ad79b75a06402d | [
"MIT"
] | 1 | 2020-03-08T10:10:48.000Z | 2020-03-08T10:10:48.000Z | tests/test_connect.py | risicle/clickhouse-driver | d36569f52d3e62ad2e275b1d63ad79b75a06402d | [
"MIT"
] | null | null | null | tests/test_connect.py | risicle/clickhouse-driver | d36569f52d3e62ad2e275b1d63ad79b75a06402d | [
"MIT"
] | null | null | null | # coding: utf-8
import socket
from mock import patch
from io import BytesIO
from clickhouse_driver import errors
from clickhouse_driver.client import Client
from clickhouse_driver.protocol import ClientPacketTypes, ServerPacketTypes
from clickhouse_driver.bufferedreader import BufferedReader
from clickhouse_driver.wr... | 33.419608 | 76 | 0.591997 |
import socket
from mock import patch
from io import BytesIO
from clickhouse_driver import errors
from clickhouse_driver.client import Client
from clickhouse_driver.protocol import ClientPacketTypes, ServerPacketTypes
from clickhouse_driver.bufferedreader import BufferedReader
from clickhouse_driver.writer import wri... | true | true |
f7ffa21c257ba1e17cc8c6621957e39dccd105d8 | 14,480 | py | Python | softlearning/algorithms/sac.py | JiazhengChai/synergy_DRL | c08e78e5fe39d9d46213e1bf07b8dafc2195b05a | [
"MIT"
] | 2 | 2020-01-07T04:12:42.000Z | 2021-12-21T22:25:31.000Z | softlearning/algorithms/sac.py | JiazhengChai/synergy_DRL | c08e78e5fe39d9d46213e1bf07b8dafc2195b05a | [
"MIT"
] | 11 | 2019-11-29T02:59:34.000Z | 2022-03-12T00:07:28.000Z | softlearning/algorithms/sac.py | JiazhengChai/synergy_DRL | c08e78e5fe39d9d46213e1bf07b8dafc2195b05a | [
"MIT"
] | 1 | 2020-04-28T12:06:40.000Z | 2020-04-28T12:06:40.000Z | from collections import OrderedDict
from numbers import Number
import numpy as np
import tensorflow as tf
from tensorflow.python.training import training_util
from .rl_algorithm import RLAlgorithm
def td_target(reward, discount, next_value):
return reward + discount * next_value
class SAC(RLAlgorithm):
""... | 33.364055 | 80 | 0.59261 | from collections import OrderedDict
from numbers import Number
import numpy as np
import tensorflow as tf
from tensorflow.python.training import training_util
from .rl_algorithm import RLAlgorithm
def td_target(reward, discount, next_value):
return reward + discount * next_value
class SAC(RLAlgorithm):
d... | true | true |
f7ffa24aab5c5cec9535bd4faca6a966d41322f9 | 1,510 | py | Python | spyder.py | soonyenju/metSpy | d49c4229786e144c7588fad79efb6cf59b602182 | [
"MIT"
] | 2 | 2018-11-07T08:36:06.000Z | 2019-01-10T06:59:48.000Z | spyder.py | soonyenju/metSpy | d49c4229786e144c7588fad79efb6cf59b602182 | [
"MIT"
] | 2 | 2018-10-24T08:21:54.000Z | 2018-10-25T02:50:49.000Z | spyder.py | soonyenju/metSpy | d49c4229786e144c7588fad79efb6cf59b602182 | [
"MIT"
] | null | null | null | # coding: utf-8
from bs4 import BeautifulSoup
from pathlib import Path
from datetime import datetime
import urllib, requests
import socket
import time, pickle
from metspy.config import Config
from metspy.initializer import Urlinit, Urloader
class Spyder(Config):
"""
Create a new spider
"""
def __init__(self, obj_p... | 25.59322 | 60 | 0.683444 |
from bs4 import BeautifulSoup
from pathlib import Path
from datetime import datetime
import urllib, requests
import socket
import time, pickle
from metspy.config import Config
from metspy.initializer import Urlinit, Urloader
class Spyder(Config):
def __init__(self, obj_path = "./static/urls.pkl"):
super(Spyder, se... | true | true |
f7ffa2c9b3d490070ee4ca47edb7b91b15ded8fd | 2,838 | py | Python | Deep RL/agent.py | sakshamarora1/Road-Fighter-AI | 9009240aee7af60605a1f878c0e969c35558c51c | [
"MIT"
] | 1 | 2020-07-19T15:03:30.000Z | 2020-07-19T15:03:30.000Z | Deep RL/agent.py | sakshamarora1/Road-Fighter-AI | 9009240aee7af60605a1f878c0e969c35558c51c | [
"MIT"
] | null | null | null | Deep RL/agent.py | sakshamarora1/Road-Fighter-AI | 9009240aee7af60605a1f878c0e969c35558c51c | [
"MIT"
] | null | null | null | from dqn import DeepQNetwork, ReplayMemory, Transition
import torch
import numpy as np
class DQNAgent:
def __init__(self, inputs, n_actions):
self.brain = DeepQNetwork(inputs, 16, 16, outputNum=n_actions)
self.target_brain = DeepQNetwork(inputs, 16, 16, outputNum=n_actions)
self.target_bra... | 31.533333 | 84 | 0.625088 | from dqn import DeepQNetwork, ReplayMemory, Transition
import torch
import numpy as np
class DQNAgent:
def __init__(self, inputs, n_actions):
self.brain = DeepQNetwork(inputs, 16, 16, outputNum=n_actions)
self.target_brain = DeepQNetwork(inputs, 16, 16, outputNum=n_actions)
self.target_bra... | true | true |
f7ffa4ca243d797dc52779a3b8f18154e9171231 | 3,438 | py | Python | src/instrumentum/model_tuning/old_wrapper_optuna.py | FedericoMontana/instrumentum | 0d07f6503c3c0fc980d349aeb6f47c960a4afe9c | [
"MIT"
] | 1 | 2022-02-22T17:27:39.000Z | 2022-02-22T17:27:39.000Z | src/instrumentum/model_tuning/old_wrapper_optuna.py | FedericoMontana/instrumentum | 0d07f6503c3c0fc980d349aeb6f47c960a4afe9c | [
"MIT"
] | 1 | 2021-12-03T21:43:42.000Z | 2021-12-03T21:43:42.000Z | src/instrumentum/model_tuning/old_wrapper_optuna.py | FedericoMontana/instrumentum | 0d07f6503c3c0fc980d349aeb6f47c960a4afe9c | [
"MIT"
] | null | null | null | import logging
import optuna
import optuna.integration.lightgbm as lgb
import pandas as pd
from catboost import CatBoostClassifier
from lightgbm import LGBMClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import roc_auc_score
from s... | 26.244275 | 85 | 0.672193 | import logging
import optuna
import optuna.integration.lightgbm as lgb
import pandas as pd
from catboost import CatBoostClassifier
from lightgbm import LGBMClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import roc_auc_score
from s... | true | true |
f7ffa53d57e8e39bd23112bc98ef09f1ba3b8a51 | 216 | py | Python | ltr/helpers/handle_resp.py | tanjie123/hello-ltr | fe1ad1989e1bb17dfc8d1c09931480becf59766e | [
"Apache-2.0"
] | 109 | 2019-04-18T01:24:29.000Z | 2022-03-12T17:37:30.000Z | ltr/helpers/handle_resp.py | tanjie123/hello-ltr | fe1ad1989e1bb17dfc8d1c09931480becf59766e | [
"Apache-2.0"
] | 63 | 2019-04-14T01:01:24.000Z | 2022-03-03T20:48:41.000Z | ltr/helpers/handle_resp.py | tanjie123/hello-ltr | fe1ad1989e1bb17dfc8d1c09931480becf59766e | [
"Apache-2.0"
] | 41 | 2019-04-22T15:22:41.000Z | 2022-02-26T00:03:02.000Z |
def resp_msg(msg, resp, throw=True):
print('{} [Status: {}]'.format(msg, resp.status_code))
if resp.status_code >= 400:
print(resp.text)
if throw:
raise RuntimeError(resp.text)
| 21.6 | 58 | 0.587963 |
def resp_msg(msg, resp, throw=True):
print('{} [Status: {}]'.format(msg, resp.status_code))
if resp.status_code >= 400:
print(resp.text)
if throw:
raise RuntimeError(resp.text)
| true | true |
f7ffa5c86ee2c07884c76763f6aff99c38be46ba | 303 | py | Python | utils_nlp/dataset/__init__.py | youtanyouzhen/nlp | 06b2be2c2dad3a28c8ceb408c2f6838cd00c13e0 | [
"MIT"
] | null | null | null | utils_nlp/dataset/__init__.py | youtanyouzhen/nlp | 06b2be2c2dad3a28c8ceb408c2f6838cd00c13e0 | [
"MIT"
] | null | null | null | utils_nlp/dataset/__init__.py | youtanyouzhen/nlp | 06b2be2c2dad3a28c8ceb408c2f6838cd00c13e0 | [
"MIT"
] | null | null | null | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from enum import Enum
import nltk
# nltk.download("punkt", quiet=True)
# nltk.download("stopwords", quiet=True)
class Split(str, Enum):
TRAIN: str = "train"
DEV: str = "dev"
TEST: str = "test"
| 20.2 | 59 | 0.683168 |
from enum import Enum
import nltk
class Split(str, Enum):
TRAIN: str = "train"
DEV: str = "dev"
TEST: str = "test"
| true | true |
f7ffa5d4dd241723b403921aa4bac015b8c379a6 | 8,322 | py | Python | test/test_report.py | OSM-es/CatAtom2Osm | 89394161b07c5dd7cd2843bce8f911b93796b33a | [
"BSD-2-Clause"
] | 8 | 2018-01-30T18:26:29.000Z | 2022-02-03T19:16:54.000Z | test/test_report.py | OSM-es/CatAtom2Osm | 89394161b07c5dd7cd2843bce8f911b93796b33a | [
"BSD-2-Clause"
] | 99 | 2018-01-22T08:37:53.000Z | 2022-03-28T13:50:06.000Z | test/test_report.py | OSM-es/CatAtom2Osm | 89394161b07c5dd7cd2843bce8f911b93796b33a | [
"BSD-2-Clause"
] | 9 | 2018-01-21T15:51:41.000Z | 2022-01-04T18:35:19.000Z | # -*- coding: utf-8 -*-
from __future__ import division, unicode_literals
from builtins import str
import io
import mock
import unittest
import os
import locale
from collections import Counter
from datetime import datetime
from catatom2osm import config, osm, report
from catatom2osm.compat import install_gettext
os.en... | 35.412766 | 105 | 0.563927 |
from __future__ import division, unicode_literals
from builtins import str
import io
import mock
import unittest
import os
import locale
from collections import Counter
from datetime import datetime
from catatom2osm import config, osm, report
from catatom2osm.compat import install_gettext
os.environ['LANGUAGE'] = 'C'... | true | true |
f7ffa73921d29299350bfec3addf3379899c9441 | 791 | py | Python | biodata/api/serializers.py | znatty22/biodataservice | a3eeb137d2e727a0fc58437b185f2637bc4665ed | [
"Apache-2.0"
] | null | null | null | biodata/api/serializers.py | znatty22/biodataservice | a3eeb137d2e727a0fc58437b185f2637bc4665ed | [
"Apache-2.0"
] | null | null | null | biodata/api/serializers.py | znatty22/biodataservice | a3eeb137d2e727a0fc58437b185f2637bc4665ed | [
"Apache-2.0"
] | null | null | null | from rest_framework import serializers
from biodata.api import models as m
COMMON_FIELDS = ['kf_id', 'created', 'modified']
class StudySerializer(serializers.ModelSerializer):
class Meta:
model = m.Study
fields = COMMON_FIELDS + ['name', 'short_name', 'participants']
read_only_fields = ['... | 28.25 | 71 | 0.653603 | from rest_framework import serializers
from biodata.api import models as m
COMMON_FIELDS = ['kf_id', 'created', 'modified']
class StudySerializer(serializers.ModelSerializer):
class Meta:
model = m.Study
fields = COMMON_FIELDS + ['name', 'short_name', 'participants']
read_only_fields = ['... | true | true |
f7ffa7e780b0a050b3a879c095cc31bd8786485a | 4,884 | py | Python | conf.py | tabshaikh/documentation | 96f1e169eaccbb22799cc6bbdf6045e726ff8bb6 | [
"CC-BY-4.0"
] | null | null | null | conf.py | tabshaikh/documentation | 96f1e169eaccbb22799cc6bbdf6045e726ff8bb6 | [
"CC-BY-4.0"
] | null | null | null | conf.py | tabshaikh/documentation | 96f1e169eaccbb22799cc6bbdf6045e726ff8bb6 | [
"CC-BY-4.0"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sphinx_rtd_theme
#
# Open States API documentation build configuration file, created by
# sphinx-quickstart on Mon Jan 9 13:39:21 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuratio... | 30.335404 | 79 | 0.685299 |
import sphinx_rtd_theme
extensions = []
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = 'Open States Documentation'
copyright = '2017, Open States'
author = 'Open States'
# |version| and |release|, also used in various other places thr... | true | true |
f7ffa93719f2d814ac9ccb8a67449230dd793043 | 225 | py | Python | tweets/serializers.py | bewallyt/Classy | f4a672f759da862b37b3980151c37cb0d05504d6 | [
"MIT"
] | null | null | null | tweets/serializers.py | bewallyt/Classy | f4a672f759da862b37b3980151c37cb0d05504d6 | [
"MIT"
] | null | null | null | tweets/serializers.py | bewallyt/Classy | f4a672f759da862b37b3980151c37cb0d05504d6 | [
"MIT"
] | null | null | null | from rest_framework import serializers
from tweets.models import Tweet
class TweetSerializer(serializers.ModelSerializer):
class Meta:
model = Tweet
fields = ('content', 'date', 'author', 'hashtag')
| 17.307692 | 57 | 0.697778 | from rest_framework import serializers
from tweets.models import Tweet
class TweetSerializer(serializers.ModelSerializer):
class Meta:
model = Tweet
fields = ('content', 'date', 'author', 'hashtag')
| true | true |
f7ffaa5d9be644df19e50b7aa9febcafe18805dc | 337 | py | Python | src/setup.py | jesserockz/python-iglo | f36454b6ed1131af8d432c1b3dbe21df80371d93 | [
"MIT"
] | null | null | null | src/setup.py | jesserockz/python-iglo | f36454b6ed1131af8d432c1b3dbe21df80371d93 | [
"MIT"
] | 1 | 2019-11-23T09:23:01.000Z | 2019-11-26T09:19:46.000Z | src/setup.py | jesserockz/python-iglo | f36454b6ed1131af8d432c1b3dbe21df80371d93 | [
"MIT"
] | 3 | 2018-03-18T10:52:11.000Z | 2021-01-24T21:13:35.000Z | from setuptools import setup, find_packages
setup(name='iglo',
version='1.2.7',
description='Control iGlo based RGB lights',
url='http://github.com/jesserockz/python-iglo',
author='Jesse Hills',
license='MIT',
install_requires=[],
packages=find_packages(exclude=["dist"]),
... | 28.083333 | 53 | 0.649852 | from setuptools import setup, find_packages
setup(name='iglo',
version='1.2.7',
description='Control iGlo based RGB lights',
url='http://github.com/jesserockz/python-iglo',
author='Jesse Hills',
license='MIT',
install_requires=[],
packages=find_packages(exclude=["dist"]),
... | true | true |
f7ffaa66df0debc9ff7967d63cc13577e329ddd4 | 2,052 | py | Python | lifelist/api/serializers.py | andela-mnzomo/life-list | 28a7fa9d16e2b322e4a1bce269dbe7331e783534 | [
"Unlicense"
] | 3 | 2017-08-17T07:12:03.000Z | 2017-10-18T11:13:44.000Z | lifelist/api/serializers.py | andela-mnzomo/life-list | 28a7fa9d16e2b322e4a1bce269dbe7331e783534 | [
"Unlicense"
] | 1 | 2018-05-30T14:38:52.000Z | 2018-05-30T14:38:52.000Z | lifelist/api/serializers.py | andela-mnzomo/life-list | 28a7fa9d16e2b322e4a1bce269dbe7331e783534 | [
"Unlicense"
] | null | null | null | from api.models import Bucketlist, Item
from django.contrib.auth.models import User
from rest_framework import serializers
class ItemSerializer(serializers.ModelSerializer):
item_bucketlist = serializers.StringRelatedField(
read_only=True)
date_created = serializers.DateTimeField(
format='%d... | 26.649351 | 71 | 0.623782 | from api.models import Bucketlist, Item
from django.contrib.auth.models import User
from rest_framework import serializers
class ItemSerializer(serializers.ModelSerializer):
item_bucketlist = serializers.StringRelatedField(
read_only=True)
date_created = serializers.DateTimeField(
format='%d... | true | true |
f7ffaa8f5188de0e09d241c1c18a144b4e55ab5d | 9,110 | py | Python | service/config/config.py | Nansir0808/kamiFaka | 5deb2e907437e280cb73e05b3e6ec2cbc115904f | [
"MIT"
] | null | null | null | service/config/config.py | Nansir0808/kamiFaka | 5deb2e907437e280cb73e05b3e6ec2cbc115904f | [
"MIT"
] | null | null | null | service/config/config.py | Nansir0808/kamiFaka | 5deb2e907437e280cb73e05b3e6ec2cbc115904f | [
"MIT"
] | null | null | null | from service.database.models import *
from service.api.db import db
# 经验:先用true或false
def init_db(update=False):
# 管理员信息
db.session.add(AdminUser('admin@qq.com','$2b$12$BKSXKYuCgeXjr8IEbK02re0VhkFoAz7f3aHF3kYAMLzYaEiObqPYm'))
# 邮箱配置
# db.session.add(Smtp('demo@qq.com','卡密发卡网','smtp.qq.com','465','xxxxx... | 101.222222 | 2,166 | 0.724698 | from service.database.models import *
from service.api.db import db
def init_db(update=False):
db.session.add(AdminUser('admin@qq.com','$2b$12$BKSXKYuCgeXjr8IEbK02re0VhkFoAz7f3aHF3kYAMLzYaEiObqPYm'))
db.session.add(Payment('支付宝当面付','支付宝',"{'APPID':'2016091800537528','alipay_public_key':'MI... | true | true |
f7ffaaeb999762ff1aa782cb6d15a2736a36595a | 3,745 | py | Python | task_dispatcher.py | embeddedden/organizer | afe3243b535137d83b12e5c8ebaa58cf8a7a1a48 | [
"MIT"
] | 4 | 2020-05-24T20:46:02.000Z | 2020-06-16T12:37:15.000Z | task_dispatcher.py | embeddedden/organizer | afe3243b535137d83b12e5c8ebaa58cf8a7a1a48 | [
"MIT"
] | null | null | null | task_dispatcher.py | embeddedden/organizer | afe3243b535137d83b12e5c8ebaa58cf8a7a1a48 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
"""
Created on Sun May 17 00:39:50 2020
@author: embden
"""
from task import Task, task_id
from csv_data_organizer import CSVDataOrganizer
from datetime import timedelta, datetime
class TaskDispatcher:
""" Implement inner logic of task management. """
def __init__(self, session_tasks=... | 43.546512 | 97 | 0.670761 |
from task import Task, task_id
from csv_data_organizer import CSVDataOrganizer
from datetime import timedelta, datetime
class TaskDispatcher:
def __init__(self, session_tasks=None):
if session_tasks is not None:
self.session_tasks = session_tasks
else:
self.session_tasks... | true | true |
f7ffab09880b5d622e469eac600cefc923031191 | 447 | py | Python | app/helpers/File.py | Abdusalam-mah/omr-fastapi | 95b8888116612c4d37862dc29596860bc9825a68 | [
"MIT"
] | 1 | 2022-03-29T19:08:59.000Z | 2022-03-29T19:08:59.000Z | app/helpers/File.py | Abdusalam-mah/omr-fastapi | 95b8888116612c4d37862dc29596860bc9825a68 | [
"MIT"
] | 1 | 2022-03-24T18:04:18.000Z | 2022-03-24T18:04:18.000Z | app/helpers/File.py | Abdusalam-mah/omr-fastapi | 95b8888116612c4d37862dc29596860bc9825a68 | [
"MIT"
] | null | null | null | import shutil
import os
def saveTempFile(file):
""" save the file to the temp images folder """
with open(file.filename, "wb") as f:
shutil.copyfileobj(file.file, f)
shutil.move(file.filename, 'temp/images/'+file.filename)
# return the filename for identification purposes
return file.... | 26.294118 | 64 | 0.682327 | import shutil
import os
def saveTempFile(file):
with open(file.filename, "wb") as f:
shutil.copyfileobj(file.file, f)
shutil.move(file.filename, 'temp/images/'+file.filename)
return file.filename
def deleteTempFile(file):
os.remove('temp/images/'+file)
| true | true |
f7ffab68bc2f8b44a9c2cdc17a0c0c53fc16a43f | 326 | py | Python | examples/convert_to_hass.py | schoenpat/sonyapilib | 367490d53dbd8b4c20ea145f14600e3e3356ef71 | [
"MIT"
] | null | null | null | examples/convert_to_hass.py | schoenpat/sonyapilib | 367490d53dbd8b4c20ea145f14600e3e3356ef71 | [
"MIT"
] | null | null | null | examples/convert_to_hass.py | schoenpat/sonyapilib | 367490d53dbd8b4c20ea145f14600e3e3356ef71 | [
"MIT"
] | null | null | null | import json
from sonyapilib.device import SonyDevice
config_file = 'bluray.json'
with open(config_file, 'r') as myfile:
data=myfile.read()
device = SonyDevice.load_from_json(data)
hass_cfg = {}
hass_cfg[device.host] = {}
hass_cfg[device.host]["device"] = data
print(json.dumps(hass_cfg), file=open("sony.conf",... | 21.733333 | 57 | 0.723926 | import json
from sonyapilib.device import SonyDevice
config_file = 'bluray.json'
with open(config_file, 'r') as myfile:
data=myfile.read()
device = SonyDevice.load_from_json(data)
hass_cfg = {}
hass_cfg[device.host] = {}
hass_cfg[device.host]["device"] = data
print(json.dumps(hass_cfg), file=open("sony.conf",... | true | true |
f7ffabd32a29075b3dd0d5b53bd44b681e980a68 | 2,870 | py | Python | hs_swat_modelinstance/receivers.py | tommac7/hydroshare | 87c4543a55f98103d2614bf4c47f7904c3f9c029 | [
"BSD-3-Clause"
] | 1 | 2018-09-17T13:07:29.000Z | 2018-09-17T13:07:29.000Z | hs_swat_modelinstance/receivers.py | tommac7/hydroshare | 87c4543a55f98103d2614bf4c47f7904c3f9c029 | [
"BSD-3-Clause"
] | 100 | 2017-08-01T23:48:04.000Z | 2018-04-03T13:17:27.000Z | hs_swat_modelinstance/receivers.py | tommac7/hydroshare | 87c4543a55f98103d2614bf4c47f7904c3f9c029 | [
"BSD-3-Clause"
] | 2 | 2017-07-27T20:41:33.000Z | 2017-07-27T22:40:57.000Z | from django.dispatch import receiver
from django.core.exceptions import ObjectDoesNotExist
from hs_core.signals import pre_metadata_element_create, pre_metadata_element_update,\
pre_create_resource, post_metadata_element_update
import hs_swat_modelinstance.models as swat_models
from hs_swat_modelinstance.forms im... | 41.594203 | 93 | 0.76446 | from django.dispatch import receiver
from django.core.exceptions import ObjectDoesNotExist
from hs_core.signals import pre_metadata_element_create, pre_metadata_element_update,\
pre_create_resource, post_metadata_element_update
import hs_swat_modelinstance.models as swat_models
from hs_swat_modelinstance.forms im... | true | true |
f7ffac1c456ec7fca0a3128bbf927972054d90a3 | 2,997 | py | Python | vivisect/tests/testremote.py | rnui2k/vivisect | b7b00f2d03defef28b4b8c912e3a8016e956c5f7 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | vivisect/tests/testremote.py | rnui2k/vivisect | b7b00f2d03defef28b4b8c912e3a8016e956c5f7 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | vivisect/tests/testremote.py | rnui2k/vivisect | b7b00f2d03defef28b4b8c912e3a8016e956c5f7 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | import os
import time
import tempfile
import unittest
import threading
import multiprocessing as mp
import vivisect
import vivisect.tests.helpers as helpers
import vivisect.remote.server as v_r_server
def runServer(name, port):
dirn = os.path.dirname(name)
testfile = helpers.getTestPath('windows', 'amd64', '... | 33.674157 | 114 | 0.532866 | import os
import time
import tempfile
import unittest
import threading
import multiprocessing as mp
import vivisect
import vivisect.tests.helpers as helpers
import vivisect.remote.server as v_r_server
def runServer(name, port):
dirn = os.path.dirname(name)
testfile = helpers.getTestPath('windows', 'amd64', '... | true | true |
f7ffacc2f2755cda2e764dd600b2d02fc5bd732d | 5,512 | py | Python | tools/python/boutiques/util/utils.py | boutiques/boutiques-schema | 5a2374e87dd837cb83fec9603f32e3c9085613ba | [
"MIT"
] | 54 | 2016-07-21T19:14:13.000Z | 2021-11-16T11:49:15.000Z | tools/python/boutiques/util/utils.py | boutiques/boutiques-schema | 5a2374e87dd837cb83fec9603f32e3c9085613ba | [
"MIT"
] | 539 | 2016-07-20T20:09:38.000Z | 2022-03-17T00:45:26.000Z | tools/python/boutiques/util/utils.py | boutiques/boutiques-schema | 5a2374e87dd837cb83fec9603f32e3c9085613ba | [
"MIT"
] | 52 | 2016-07-22T18:09:59.000Z | 2021-02-03T15:22:55.000Z | import os
import simplejson as json
from boutiques.logger import raise_error, print_warning
from boutiques import __file__ as bfile
# Parses absolute path into filename
def extractFileName(path):
# Helps OS path handle case where "/" is at the end of path
if path is None:
return None
elif path[:-1... | 35.56129 | 73 | 0.595065 | import os
import simplejson as json
from boutiques.logger import raise_error, print_warning
from boutiques import __file__ as bfile
def extractFileName(path):
if path is None:
return None
elif path[:-1] == '/':
return os.path.basename(path[:-1]) + "/"
else:
return os.path.bas... | true | true |
f7ffae48ee2ed967b9483fbdd9ed0347bf577dc8 | 1,748 | py | Python | bot/cogs/prune_users.py | diegorusso/discordbot | 528ab3738b9fe759d65b73f59de8e9cb64f0ac45 | [
"MIT"
] | null | null | null | bot/cogs/prune_users.py | diegorusso/discordbot | 528ab3738b9fe759d65b73f59de8e9cb64f0ac45 | [
"MIT"
] | 2 | 2018-02-11T16:39:47.000Z | 2020-08-11T09:34:27.000Z | bot/cogs/prune_users.py | diegorusso/discordbot | 528ab3738b9fe759d65b73f59de8e9cb64f0ac45 | [
"MIT"
] | 1 | 2018-02-11T19:42:04.000Z | 2018-02-11T19:42:04.000Z | """PruneUsers module."""
import asyncio
class PruneUsers(object):
"""PruneUsers class."""
def __init__(self, bot):
"""Init method for PruneUsers."""
self.bot = bot
server_id = self.bot.config['general']['server_id']
inactive_days = int(self.bot.config['prune_users']['inactive... | 38.844444 | 79 | 0.566362 |
import asyncio
class PruneUsers(object):
def __init__(self, bot):
self.bot = bot
server_id = self.bot.config['general']['server_id']
inactive_days = int(self.bot.config['prune_users']['inactive_days'])
bg_interval = int(self.bot.config['prune_users']['bg_interval'])
self.... | true | true |
f7ffaeee77748554cd1a16478e873aa85dffc733 | 16,556 | gyp | Python | libjingle_tests.gyp | whxcctv/I-wanna-talk | e20723b1adae087541378f3551b47bdf7c8391f5 | [
"BSL-1.0",
"BSD-3-Clause"
] | 2 | 2020-10-17T03:21:36.000Z | 2021-06-21T02:41:49.000Z | libjingle_tests.gyp | whxcctv/I-wanna-talk | e20723b1adae087541378f3551b47bdf7c8391f5 | [
"BSL-1.0",
"BSD-3-Clause"
] | null | null | null | libjingle_tests.gyp | whxcctv/I-wanna-talk | e20723b1adae087541378f3551b47bdf7c8391f5 | [
"BSL-1.0",
"BSD-3-Clause"
] | 1 | 2015-09-11T06:51:49.000Z | 2015-09-11T06:51:49.000Z | #
# libjingle
# Copyright 2012 Google Inc.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following d... | 38.502326 | 120 | 0.578884 |
{
'includes': ['build/common.gypi'],
'targets': [
{
'target_name': 'libjingle_unittest_main',
'type': 'static_library',
'dependencies': [
'<(DEPTH)/third_party/libyuv/libyuv.gyp:libyuv',
'<(webrtc_root)/base/base_tests.gyp:rtc_base_tests_utils',
... | true | true |
f7ffb2c1f1f42a121d82e8a6a25a639f2a9e4bf8 | 1,410 | py | Python | setup.py | LevyForchh/bionic | f7f9486ac22c928bfbf12c40abf4bfd81751d77e | [
"Apache-2.0"
] | null | null | null | setup.py | LevyForchh/bionic | f7f9486ac22c928bfbf12c40abf4bfd81751d77e | [
"Apache-2.0"
] | 1 | 2020-05-19T01:01:27.000Z | 2020-05-19T01:01:27.000Z | setup.py | LevyForchh/bionic | f7f9486ac22c928bfbf12c40abf4bfd81751d77e | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import os
from runpy import run_path
# This appears to be the least annoying Python-version-agnostic way of loading
# an external file.
extras_require = run_path(os.path.join(
os.path.dirname(__file__), 'bionic', 'extras.py... | 26.603774 | 78 | 0.656738 |
from setuptools import setup, find_packages
import os
from runpy import run_path
extras_require = run_path(os.path.join(
os.path.dirname(__file__), 'bionic', 'extras.py'))['extras_require']
with open('README.md') as readme_file:
readme = readme_file.read()
requirements = [
'PyYAML',
'numpy',
... | true | true |
f7ffb2d2e904341a1593f00e42fb9860879101f1 | 2,618 | py | Python | interchange/geo.py | py2neo-org/interchange | 5a081adb6358e038dceeb9b7bb166e7f341066bd | [
"Apache-2.0"
] | null | null | null | interchange/geo.py | py2neo-org/interchange | 5a081adb6358e038dceeb9b7bb166e7f341066bd | [
"Apache-2.0"
] | 4 | 2021-10-11T12:24:35.000Z | 2021-11-10T15:55:02.000Z | interchange/geo.py | py2neo-org/interchange | 5a081adb6358e038dceeb9b7bb166e7f341066bd | [
"Apache-2.0"
] | 1 | 2021-11-23T20:24:25.000Z | 2021-11-23T20:24:25.000Z | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright Nigel Small
#
# 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... | 25.920792 | 99 | 0.645149 |
__all__ = [
"Point",
"CartesianPoint",
"WGS84Point",
]
_srid_table = {}
class Point(tuple):
@classmethod
def class_for_srid(cls, srid):
point_class, dim = _srid_table[srid]
return point_class, dim
srid = None
def __new__(cls, iterable):
ret... | true | true |
f7ffb39b815a121988ba68c8c295381065ceb78b | 14,226 | py | Python | src/plotting.py | pradeep90/reddit-post-classifier | 081fd1cda50a0938d1b7f32c3919defbf27bea68 | [
"Apache-2.0"
] | null | null | null | src/plotting.py | pradeep90/reddit-post-classifier | 081fd1cda50a0938d1b7f32c3919defbf27bea68 | [
"Apache-2.0"
] | null | null | null | src/plotting.py | pradeep90/reddit-post-classifier | 081fd1cda50a0938d1b7f32c3919defbf27bea68 | [
"Apache-2.0"
] | null | null | null | import datetime
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
PLOT_NBC = False
PLOT_LR = False
PLOT_CNN = True
# Learing curve for NBC
if PLOT_NBC:
training_fracs = [0.025, 0.05, 0.075, 0.1, 0.15, 0.2, 1.0]
training_precision_at_5 = [1, 1, 1, 1, 1, 1]
testing_precision_at_5 = [0.77, 0.82,... | 52.301471 | 208 | 0.638198 | import datetime
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
PLOT_NBC = False
PLOT_LR = False
PLOT_CNN = True
if PLOT_NBC:
training_fracs = [0.025, 0.05, 0.075, 0.1, 0.15, 0.2, 1.0]
training_precision_at_5 = [1, 1, 1, 1, 1, 1]
testing_precision_at_5 = [0.77, 0.82, 0.84, 0.85, 0.86, 0.85... | true | true |
f7ffb42910b936dd5cb58fa20168d7f450a73b00 | 305 | py | Python | fastapi_cache/key_builder.py | johnR46/fastapi-cache | a81d52f25965a959f851021584feec3de926dc91 | [
"Apache-2.0"
] | null | null | null | fastapi_cache/key_builder.py | johnR46/fastapi-cache | a81d52f25965a959f851021584feec3de926dc91 | [
"Apache-2.0"
] | null | null | null | fastapi_cache/key_builder.py | johnR46/fastapi-cache | a81d52f25965a959f851021584feec3de926dc91 | [
"Apache-2.0"
] | null | null | null | import hashlib
from typing import Optional
def default_key_builder(
prefix: str,
func,
parameter: Optional[dict] = None,
):
cache_key = (
prefix + ':' + hashlib.md5(f"{func.__module__}:{func.__name__}:{parameter}".encode()).hexdigest()
)
return cache_key
| 21.785714 | 109 | 0.616393 | import hashlib
from typing import Optional
def default_key_builder(
prefix: str,
func,
parameter: Optional[dict] = None,
):
cache_key = (
prefix + ':' + hashlib.md5(f"{func.__module__}:{func.__name__}:{parameter}".encode()).hexdigest()
)
return cache_key
| true | true |
f7ffb48c665087c03efcd60e58e6dc4d2eb60da5 | 1,373 | py | Python | file_encryptor/settings.py | SleepingSoul/file-encryptor | d43ddb4c9e9c56ee67f333347da3f03f4e451c4f | [
"MIT"
] | 7 | 2015-01-03T00:08:00.000Z | 2016-02-21T02:47:23.000Z | file_encryptor/settings.py | hnjm/file-encryptor | 245191c45dbd68e09a4a8f07c5d7331be195dc6b | [
"MIT"
] | 3 | 2015-02-02T04:20:55.000Z | 2015-12-14T04:00:16.000Z | file_encryptor/settings.py | hnjm/file-encryptor | 245191c45dbd68e09a4a8f07c5d7331be195dc6b | [
"MIT"
] | 7 | 2015-01-23T12:41:39.000Z | 2015-12-17T22:01:58.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2014 Storj Labs
#
# 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 witho... | 42.90625 | 79 | 0.766205 |
CHUNK_SIZE = 2**14
DEFAULT_HMAC_PASSPHRASE = 'Something old, something new.'
| true | true |
f7ffb50752e74fc276963006dbf5722a06d83799 | 365 | py | Python | output/models/ms_data/particles/particles_jj002_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 1 | 2021-08-14T17:59:21.000Z | 2021-08-14T17:59:21.000Z | output/models/ms_data/particles/particles_jj002_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 4 | 2020-02-12T21:30:44.000Z | 2020-04-15T20:06:46.000Z | output/models/ms_data/particles/particles_jj002_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | null | null | null | from output.models.ms_data.particles.particles_jj002_xsd.particles_jj002 import (
B as B,
R,
Doc,
)
from output.models.ms_data.particles.particles_jj002_xsd.particles_jj002_imp import (
B as ImpB,
ExtRefType,
ImpElem1,
ImpElem2,
)
__all__ = [
"B",
"R",
"Doc",
"ImpB",
"Ex... | 16.590909 | 85 | 0.632877 | from output.models.ms_data.particles.particles_jj002_xsd.particles_jj002 import (
B as B,
R,
Doc,
)
from output.models.ms_data.particles.particles_jj002_xsd.particles_jj002_imp import (
B as ImpB,
ExtRefType,
ImpElem1,
ImpElem2,
)
__all__ = [
"B",
"R",
"Doc",
"ImpB",
"Ex... | true | true |
f7ffb51e9b01237a60725d6e6189859d404a164e | 89 | py | Python | REST API/code/db.py | ccruz182/Store-REST-API | ece3f908279aa15df04a0bab32060f5ee1fc1462 | [
"Apache-2.0"
] | null | null | null | REST API/code/db.py | ccruz182/Store-REST-API | ece3f908279aa15df04a0bab32060f5ee1fc1462 | [
"Apache-2.0"
] | null | null | null | REST API/code/db.py | ccruz182/Store-REST-API | ece3f908279aa15df04a0bab32060f5ee1fc1462 | [
"Apache-2.0"
] | null | null | null | from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy() # Link Flask app with database | 29.666667 | 48 | 0.808989 | from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy() | true | true |
f7ffb5379681ee5cdd484e1fb05b8a783360afb5 | 1,824 | py | Python | examples/src/main/python/streaming/hdfs_wordcount.py | MiguelPeralvo/spark | 979a73f86f77e7ae294979b7962b8ae30d38f1ff | [
"Apache-2.0"
] | 51 | 2015-01-01T12:59:51.000Z | 2020-03-30T15:40:24.000Z | examples/src/main/python/streaming/hdfs_wordcount.py | MiguelPeralvo/spark | 979a73f86f77e7ae294979b7962b8ae30d38f1ff | [
"Apache-2.0"
] | 6 | 2019-11-13T07:48:07.000Z | 2022-01-21T23:24:20.000Z | examples/src/main/python/streaming/hdfs_wordcount.py | MiguelPeralvo/spark | 979a73f86f77e7ae294979b7962b8ae30d38f1ff | [
"Apache-2.0"
] | 36 | 2015-02-12T02:57:59.000Z | 2020-07-23T22:06:59.000Z | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 36.48 | 94 | 0.724781 |
import sys
from pyspark import SparkContext
from pyspark.streaming import StreamingContext
if __name__ == "__main__":
if len(sys.argv) != 2:
print >> sys.stderr, "Usage: hdfs_wordcount.py <directory>"
exit(-1)
sc = SparkContext(appName="PythonStreamingHDFSWordCount")
ssc... | true | true |
f7ffb58199b0ff1028fb183b81068d8955e96ecd | 22,075 | py | Python | process_includes.py | andreif/generateDS | 995fa381b3f1079937bb0c1cb14f8167e879c33d | [
"MIT"
] | null | null | null | process_includes.py | andreif/generateDS | 995fa381b3f1079937bb0c1cb14f8167e879c33d | [
"MIT"
] | null | null | null | process_includes.py | andreif/generateDS | 995fa381b3f1079937bb0c1cb14f8167e879c33d | [
"MIT"
] | null | null | null | #!/usr/bin/env python
"""
python %prog [options] <in_schema.xsd> <out_schema.xsd>
Synopsis:
Prepare schema document. Replace include and import elements.
Examples:
python %prog myschema.xsd
python %prog myschema.xsd newschema.xsd
python %prog -f myschema.xsd newschema.xsd
cat infile.xsd | pyth... | 33.497724 | 79 | 0.588086 |
import sys
import os
if sys.version_info.major == 2:
import urllib2
else:
import urllib.request
import urllib.error
import urllib.parse
import copy
from optparse import OptionParser, Values
import itertools
from copy import deepcopy
from lxml import etree
try:
from gds_inner_name_map import In... | true | true |
f7ffb5b45b477cf608a2b90e60031a8fa9501218 | 1,745 | py | Python | caffe2/python/operator_test/cast_op_test.py | wenhaopeter/read_pytorch_code | 491f989cd918cf08874dd4f671fb7f0142a0bc4f | [
"Intel",
"X11"
] | 40 | 2021-06-01T07:37:59.000Z | 2022-03-25T01:42:09.000Z | caffe2/python/operator_test/cast_op_test.py | wenhaopeter/read_pytorch_code | 491f989cd918cf08874dd4f671fb7f0142a0bc4f | [
"Intel",
"X11"
] | 14 | 2021-06-01T11:52:46.000Z | 2022-03-25T02:13:08.000Z | caffe2/python/operator_test/cast_op_test.py | wenhaopeter/read_pytorch_code | 491f989cd918cf08874dd4f671fb7f0142a0bc4f | [
"Intel",
"X11"
] | 7 | 2021-07-20T19:34:26.000Z | 2022-03-13T21:07:36.000Z | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import core, workspace
import caffe2.python.hypothesis_test_util as hu
from hypothesis import given
import numpy as np
class TestCastOp(hu.Hypothes... | 35.612245 | 80 | 0.645272 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import core, workspace
import caffe2.python.hypothesis_test_util as hu
from hypothesis import given
import numpy as np
class TestCastOp(hu.Hypothes... | true | true |
f7ffb7441a98c6a8d5531e1958bf654731931f9a | 3,170 | py | Python | client/gui/Login.py | Howest-AdvMathProg/project-2021-Joren-vanGoethem | 224d871951ef40d0448aa33cee9064f8e0f82af7 | [
"MIT"
] | null | null | null | client/gui/Login.py | Howest-AdvMathProg/project-2021-Joren-vanGoethem | 224d871951ef40d0448aa33cee9064f8e0f82af7 | [
"MIT"
] | null | null | null | client/gui/Login.py | Howest-AdvMathProg/project-2021-Joren-vanGoethem | 224d871951ef40d0448aa33cee9064f8e0f82af7 | [
"MIT"
] | null | null | null | from PyQt5.QtWidgets import *
from PyQt5.uic import *
from PyQt5 import *
import sys # We need sys so that we can pass argv to QApplication
from gui.ui.mainwindowui import Ui_MainWindow
from User import User
from time import sleep
class Login(QDialog):
def __init__(self, MainWindow, parent=None):
super()... | 30.480769 | 101 | 0.552681 | from PyQt5.QtWidgets import *
from PyQt5.uic import *
from PyQt5 import *
import sys
from gui.ui.mainwindowui import Ui_MainWindow
from User import User
from time import sleep
class Login(QDialog):
def __init__(self, MainWindow, parent=None):
super().__init__(parent)
loadUi('gui/ui/Login.ui', se... | true | true |
f7ffb84e82522ef6fe5b873eb6a334a4655116fc | 3,468 | py | Python | cp/max_subarray_sum.py | hauntarl/real-python | 6ffb535648bf5c79c90e2ed7def842078bc7807f | [
"MIT"
] | 2 | 2020-12-15T18:11:00.000Z | 2021-03-01T11:43:16.000Z | cp/max_subarray_sum.py | hauntarl/real_python | 6ffb535648bf5c79c90e2ed7def842078bc7807f | [
"MIT"
] | null | null | null | cp/max_subarray_sum.py | hauntarl/real_python | 6ffb535648bf5c79c90e2ed7def842078bc7807f | [
"MIT"
] | null | null | null | """
Given an array of n numbers, calculate the maximum subarray sum, i.e., the
largest possible sum of a sequence of consecutive values in the array. The
problem is interesting when there may be negative values in the array.
For example, in the array: [-1, 2, 4, -3, 5, 2, -5, 2]
the following subarray produces the m... | 31.243243 | 80 | 0.659458 | from util import timeit
@timeit
def algorithm_1(array: list) -> int:
best = 0
size = len(array)
for i in range(0, size):
for j in range(i, size):
curr = 0
for k in range(i, j):
curr += array[k]
best = max(best, curr)
return best
@timeit
... | true | true |
f7ffb892e8610fda995948c4c171e6e76e5d5004 | 9,578 | py | Python | DropDtw-Code/train.py | Crossmdl/Crossmdl | 49f245349cc32f750bc33ef891b2ee90f60317a6 | [
"MIT"
] | null | null | null | DropDtw-Code/train.py | Crossmdl/Crossmdl | 49f245349cc32f750bc33ef891b2ee90f60317a6 | [
"MIT"
] | null | null | null | DropDtw-Code/train.py | Crossmdl/Crossmdl | 49f245349cc32f750bc33ef891b2ee90f60317a6 | [
"MIT"
] | null | null | null | import os
import torch
import argparse
import random
import torch
import numpy as np
import pytorch_lightning as pl
import torchmetrics
from copy import deepcopy, copy
import pickle as pkl
from paths import PROJECT_PATH, WEIGHTS_PATH
from models.nets import EmbeddingsMapping
from models.losses import compute_clust_l... | 48.619289 | 171 | 0.687409 | import os
import torch
import argparse
import random
import torch
import numpy as np
import pytorch_lightning as pl
import torchmetrics
from copy import deepcopy, copy
import pickle as pkl
from paths import PROJECT_PATH, WEIGHTS_PATH
from models.nets import EmbeddingsMapping
from models.losses import compute_clust_l... | true | true |
f7ffb91b351e62797bb1380ee16f6476bbcdd213 | 86,251 | py | Python | llvmlite/tests/test_ir.py | ax3l/llvmlite | 4acef2d5165768f43b315dd47ed99a5f8f63b3a8 | [
"BSD-2-Clause"
] | 76 | 2020-07-06T14:44:05.000Z | 2022-02-14T15:30:21.000Z | llvmlite/tests/test_ir.py | ax3l/llvmlite | 4acef2d5165768f43b315dd47ed99a5f8f63b3a8 | [
"BSD-2-Clause"
] | 11 | 2020-08-09T02:30:14.000Z | 2022-03-12T00:50:14.000Z | llvmlite/tests/test_ir.py | ax3l/llvmlite | 4acef2d5165768f43b315dd47ed99a5f8f63b3a8 | [
"BSD-2-Clause"
] | 11 | 2020-07-12T16:18:07.000Z | 2022-02-05T16:48:35.000Z | """
IR Construction Tests
"""
import copy
import itertools
import pickle
import re
import textwrap
import unittest
from . import TestCase
from llvmlite import ir
from llvmlite import binding as llvm
int1 = ir.IntType(1)
int8 = ir.IntType(8)
int16 = ir.IntType(16)
int32 = ir.IntType(32)
int64 = ir.IntType(64)
hlf = ... | 38.729681 | 193 | 0.531263 |
import copy
import itertools
import pickle
import re
import textwrap
import unittest
from . import TestCase
from llvmlite import ir
from llvmlite import binding as llvm
int1 = ir.IntType(1)
int8 = ir.IntType(8)
int16 = ir.IntType(16)
int32 = ir.IntType(32)
int64 = ir.IntType(64)
hlf = ir.HalfType()
flt = ir.FloatTy... | true | true |
f7ffb9299d605f1fc9488c1425f809d4aab539f5 | 2,194 | py | Python | HumeanPoseEstimate/loss.py | YuHe0108/cvmodule | ea00a90fc9bbca5b2c7809791cbd1f7b0da526cd | [
"Apache-2.0"
] | null | null | null | HumeanPoseEstimate/loss.py | YuHe0108/cvmodule | ea00a90fc9bbca5b2c7809791cbd1f7b0da526cd | [
"Apache-2.0"
] | null | null | null | HumeanPoseEstimate/loss.py | YuHe0108/cvmodule | ea00a90fc9bbca5b2c7809791cbd1f7b0da526cd | [
"Apache-2.0"
] | null | null | null | from tensorflow import keras
import tensorflow as tf
def joint_mse_loss(y_pred, y_true, true_weight):
"""
损失函数想要表达的意思: 输出的特征图数量为关键点的数量,意味着输出的是每一个像素属于各个关键点的置信度
"""
batch_size = y_pred.shape[0]
num_of_joints = y_pred.shape[-1] # 有多少个关键点
y_pred = tf.reshape(y_pred, shape=(batch_size, -... | 46.680851 | 92 | 0.608478 | from tensorflow import keras
import tensorflow as tf
def joint_mse_loss(y_pred, y_true, true_weight):
batch_size = y_pred.shape[0]
num_of_joints = y_pred.shape[-1]
y_pred = tf.reshape(y_pred, shape=(batch_size, -1, num_of_joints))
heatmap_pred_list = tf.split(value=y_pred,
... | true | true |
f7ffba000e0145dc2f44fbca9f95ac3150c5fd94 | 13,021 | py | Python | caffe2/python/optimizer.py | kyper999/caffe2-2 | 7c10b470de8d19261f10e958846d7efcfd751a09 | [
"MIT"
] | null | null | null | caffe2/python/optimizer.py | kyper999/caffe2-2 | 7c10b470de8d19261f10e958846d7efcfd751a09 | [
"MIT"
] | null | null | null | caffe2/python/optimizer.py | kyper999/caffe2-2 | 7c10b470de8d19261f10e958846d7efcfd751a09 | [
"MIT"
] | null | null | null | ## @package optimizer
# Module caffe2.python.optimizer
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from collections import namedtuple
from caffe2.python import core
from caffe2.python.modeling import parameter_info... | 35.097035 | 80 | 0.607173 | port absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from collections import namedtuple
from caffe2.python import core
from caffe2.python.modeling import parameter_info
from caffe2.proto import caffe2_pb2
_OPTIMIZER_ITERATION_NAME = "optim... | true | true |
f7ffba573bdea60f3487d8e32bf38901f2225870 | 31,706 | py | Python | ansible/venv/lib/python2.7/site-packages/ansible/modules/network/netscaler/netscaler_service.py | gvashchenkolineate/gvashchenkolineate_infra_trytravis | 0fb18850afe0d8609693ba4b23f29c7cda17d97f | [
"MIT"
] | 17 | 2017-06-07T23:15:01.000Z | 2021-08-30T14:32:36.000Z | ansible/venv/lib/python2.7/site-packages/ansible/modules/network/netscaler/netscaler_service.py | gvashchenkolineate/gvashchenkolineate_infra_trytravis | 0fb18850afe0d8609693ba4b23f29c7cda17d97f | [
"MIT"
] | 9 | 2017-06-25T03:31:52.000Z | 2021-05-17T23:43:12.000Z | ansible/venv/lib/python2.7/site-packages/ansible/modules/network/netscaler/netscaler_service.py | gvashchenkolineate/gvashchenkolineate_infra_trytravis | 0fb18850afe0d8609693ba4b23f29c7cda17d97f | [
"MIT"
] | 3 | 2018-05-26T21:31:22.000Z | 2019-09-28T17:00:45.000Z | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Citrix Systems
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | 32.890041 | 144 | 0.570933 |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: netscaler_service
short_description: Manage service c... | true | true |
f7ffba5c041af60da82ca90652319fd5556eae04 | 1,038 | py | Python | plots/test 1 total count.py | IvanIFChen/Passiotic | f6a035fad5c6a6372721e2f74f9abdc98d0ffe67 | [
"MIT"
] | 1 | 2019-03-15T15:45:46.000Z | 2019-03-15T15:45:46.000Z | plots/test 1 total count.py | cjcodell1/Passiotic | f6a035fad5c6a6372721e2f74f9abdc98d0ffe67 | [
"MIT"
] | null | null | null | plots/test 1 total count.py | cjcodell1/Passiotic | f6a035fad5c6a6372721e2f74f9abdc98d0ffe67 | [
"MIT"
] | 1 | 2019-07-03T15:49:51.000Z | 2019-07-03T15:49:51.000Z | import matplotlib.pyplot as plt
import json
from dateutil import parser
from pprint import pprint
from collections import defaultdict
from datetime import datetime, timedelta
def load_from_file(filename):
data = defaultdict(int)
raw_data = []
with open(filename, 'r') as f:
for line in f.readlines(... | 28.833333 | 70 | 0.60501 | import matplotlib.pyplot as plt
import json
from dateutil import parser
from pprint import pprint
from collections import defaultdict
from datetime import datetime, timedelta
def load_from_file(filename):
data = defaultdict(int)
raw_data = []
with open(filename, 'r') as f:
for line in f.readlines(... | true | true |
f7ffbb10489dfcbfb2d4ef2719161bc10a92cca6 | 1,553 | py | Python | 3. Algorithms/04. String Process Algorithm/KMP Algorithm Design/kmp_algorithm.py | oneonlee/Computer-Science | 4a3e2bf92986b5db3967d788832bca353fe71e61 | [
"MIT"
] | 1 | 2021-10-19T20:06:55.000Z | 2021-10-19T20:06:55.000Z | 3. Algorithms/04. String Process Algorithm/KMP Algorithm Design/kmp_algorithm.py | oneonlee/Computer-Science | 4a3e2bf92986b5db3967d788832bca353fe71e61 | [
"MIT"
] | null | null | null | 3. Algorithms/04. String Process Algorithm/KMP Algorithm Design/kmp_algorithm.py | oneonlee/Computer-Science | 4a3e2bf92986b5db3967d788832bca353fe71e61 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""kmp_algorithm.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1wsUiWXaWKuIxv-udYnxqV463PD4z2ps-
"""
def init_next(pattern):
M = len(pattern)
next = [0 for _ in range(M)] # 정보 저장용 배열
j = 0 # 배열의 값을 불러오고,... | 26.775862 | 152 | 0.553123 |
def init_next(pattern):
M = len(pattern)
next = [0 for _ in range(M)]
j = 0
for i in range(1, M):
while j > 0 and pattern[i] != pattern[j]:
j = next[j-1]
if pattern[i] == pattern[j] :
j += 1
next[i] = ... | true | true |
f7ffbd76818cc21e689c35f422047192d559c410 | 766 | py | Python | bin/test-server.py | phorward/flare | 89a20bd1fb5ef7d0deebbd1f76c58a063e86f41e | [
"MIT"
] | null | null | null | bin/test-server.py | phorward/flare | 89a20bd1fb5ef7d0deebbd1f76c58a063e86f41e | [
"MIT"
] | null | null | null | bin/test-server.py | phorward/flare | 89a20bd1fb5ef7d0deebbd1f76c58a063e86f41e | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import os
import socketserver
from http.server import SimpleHTTPRequestHandler
class pyodideHttpServer(SimpleHTTPRequestHandler):
def __init__(self, request, client_address, server):
self.extensions_map.update(
{
".wasm": "application/wasm",
}... | 25.533333 | 62 | 0.67624 |
import os
import socketserver
from http.server import SimpleHTTPRequestHandler
class pyodideHttpServer(SimpleHTTPRequestHandler):
def __init__(self, request, client_address, server):
self.extensions_map.update(
{
".wasm": "application/wasm",
}
)
su... | true | true |
f7ffbe1d06bacea70998662dd496f56a97c01054 | 4,410 | py | Python | src/cosalib/cli.py | nikita-dubrovskii/coreos-assembler | 378fb9d7670a32b1c16835739e82c15bb0e8f6aa | [
"Apache-2.0"
] | null | null | null | src/cosalib/cli.py | nikita-dubrovskii/coreos-assembler | 378fb9d7670a32b1c16835739e82c15bb0e8f6aa | [
"Apache-2.0"
] | null | null | null | src/cosalib/cli.py | nikita-dubrovskii/coreos-assembler | 378fb9d7670a32b1c16835739e82c15bb0e8f6aa | [
"Apache-2.0"
] | null | null | null | # NOTE: PYTHONUNBUFFERED is set in the entrypoint for unbuffered output
# pylint: disable=C0103
import argparse
import logging as log
import os
from cosalib import (
aliyun,
aws,
azure,
gcp,
vultr,
exoscale
)
CLOUD_CLI_TARGET = {
"aws": (aws.aws_cli,
aws.aws_run_ore,... | 30.205479 | 78 | 0.587755 |
import argparse
import logging as log
import os
from cosalib import (
aliyun,
aws,
azure,
gcp,
vultr,
exoscale
)
CLOUD_CLI_TARGET = {
"aws": (aws.aws_cli,
aws.aws_run_ore,
aws.aws_run_ore_replicate),
"aliyun": (aliyun.aliyun_cli,
... | true | true |
f7ffbf7ce1c62a70431c1d8d68dfaca9799270a1 | 4,218 | py | Python | tensorflow_datasets/text/eraser_multi_rc.py | ChAnYaNG97/datasets | 0a45e2ea98716d325fc1c5e5494f2575f3bdb908 | [
"Apache-2.0"
] | 1 | 2020-10-11T19:15:49.000Z | 2020-10-11T19:15:49.000Z | tensorflow_datasets/text/eraser_multi_rc.py | ChAnYaNG97/datasets | 0a45e2ea98716d325fc1c5e5494f2575f3bdb908 | [
"Apache-2.0"
] | 1 | 2021-02-23T20:16:05.000Z | 2021-02-23T20:16:05.000Z | tensorflow_datasets/text/eraser_multi_rc.py | ChAnYaNG97/datasets | 0a45e2ea98716d325fc1c5e5494f2575f3bdb908 | [
"Apache-2.0"
] | 1 | 2020-08-03T20:19:12.000Z | 2020-08-03T20:19:12.000Z | # coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | 35.745763 | 143 | 0.664533 |
import json
import os
import tensorflow.compat.v2 as tf
import tensorflow_datasets.public_api as tfds
_CITATION = """
@unpublished{eraser2019,
title = {ERASER: A Benchmark to Evaluate Rationalized NLP Models},
author = {Jay DeYoung and Sarthak Jain and Nazneen Fatema Rajani and Eric Lehman and ... | true | true |
f7ffbfc2bc7529594e23f3889a5ead2b68cc1ee1 | 7,305 | py | Python | mnist_cnn.py | VishaalMK/VectorDefense | dc488fbf19bc9aefaf58bcc2b89dfe0e5adc3806 | [
"MIT"
] | 13 | 2018-04-28T21:41:23.000Z | 2021-05-29T05:05:14.000Z | mnist_cnn.py | VishaalMK/VectorDefense | dc488fbf19bc9aefaf58bcc2b89dfe0e5adc3806 | [
"MIT"
] | null | null | null | mnist_cnn.py | VishaalMK/VectorDefense | dc488fbf19bc9aefaf58bcc2b89dfe0e5adc3806 | [
"MIT"
] | 5 | 2018-04-26T13:11:02.000Z | 2019-06-14T16:12:40.000Z | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import keras
from keras.utils import np_utils
from keras.models import Sequential
from keras.layers import Dense, Activation, Flatten, Dropout
from ker... | 36.893939 | 82 | 0.656947 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import keras
from keras.utils import np_utils
from keras.models import Sequential
from keras.layers import Dense, Activation, Flatten, Dropout
from ker... | true | true |
f7ffc0426e17392c755081a2f23c62440845c239 | 1,564 | py | Python | src/score/score.py | hangzh-msft/MLOpsDatabricks | fc50127b236142a15c102a8c8e44ef1cbb584738 | [
"MIT"
] | null | null | null | src/score/score.py | hangzh-msft/MLOpsDatabricks | fc50127b236142a15c102a8c8e44ef1cbb584738 | [
"MIT"
] | null | null | null | src/score/score.py | hangzh-msft/MLOpsDatabricks | fc50127b236142a15c102a8c8e44ef1cbb584738 | [
"MIT"
] | 1 | 2019-07-17T21:19:18.000Z | 2019-07-17T21:19:18.000Z | import json
import torch
import torch.nn as nn
import torchvision.transforms as transforms
from azorean.core.model import Model
from PIL import Image
class CNN(nn.Module):
def __init__(self):
super(CNN, self).__init__()
self.layer1 = nn.Sequential(
nn.Conv2d(1, 16, kernel_size=5, paddi... | 28.436364 | 65 | 0.590153 | import json
import torch
import torch.nn as nn
import torchvision.transforms as transforms
from azorean.core.model import Model
from PIL import Image
class CNN(nn.Module):
def __init__(self):
super(CNN, self).__init__()
self.layer1 = nn.Sequential(
nn.Conv2d(1, 16, kernel_size=5, paddi... | true | true |
f7ffc23e048810283c9cce996af4b4f5676413f0 | 1,395 | py | Python | setup.py | hachi-88/online-judge-tools | f008cecf010468d8fbde6f7c21bf15f8d9e2b506 | [
"MIT"
] | 1 | 2018-11-03T19:17:33.000Z | 2018-11-03T19:17:33.000Z | setup.py | hachi-88/online-judge-tools | f008cecf010468d8fbde6f7c21bf15f8d9e2b506 | [
"MIT"
] | null | null | null | setup.py | hachi-88/online-judge-tools | f008cecf010468d8fbde6f7c21bf15f8d9e2b506 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
from setuptools import setup, find_packages
import imp
def load_module(module_path):
path = None
for name in module_path.split('.'):
file, path, description = imp.find_module(name, path)
path = [ path ]
return imp.load_module(name, file, path[0], description)
version ... | 29.0625 | 61 | 0.616487 |
from setuptools import setup, find_packages
import imp
def load_module(module_path):
path = None
for name in module_path.split('.'):
file, path, description = imp.find_module(name, path)
path = [ path ]
return imp.load_module(name, file, path[0], description)
version = load_module('onlinej... | true | true |
f7ffc2b0d189d0a4f9c7d238ca56f57dc48f5adc | 11,304 | py | Python | code/main.py | guangyizhangbci/EEG_Riemannian | 2d301bf3d06a192da2829c1c54b24d388ddea1dd | [
"MIT"
] | 12 | 2022-02-22T17:15:04.000Z | 2022-03-19T11:41:15.000Z | code/main.py | guangyizhangbci/RFNet | 2d301bf3d06a192da2829c1c54b24d388ddea1dd | [
"MIT"
] | null | null | null | code/main.py | guangyizhangbci/RFNet | 2d301bf3d06a192da2829c1c54b24d388ddea1dd | [
"MIT"
] | null | null | null | from __future__ import print_function, division
import tensorflow as tf
import matplotlib.pyplot as plt
import sys, os
import numpy as np
from tqdm import tqdm
from rich.progress import track
from time import time
import pyriemann
import yaml
import argparse
from scipy.stats import pearsonr
from sklearn.preprocessing i... | 41.255474 | 223 | 0.662863 | from __future__ import print_function, division
import tensorflow as tf
import matplotlib.pyplot as plt
import sys, os
import numpy as np
from tqdm import tqdm
from rich.progress import track
from time import time
import pyriemann
import yaml
import argparse
from scipy.stats import pearsonr
from sklearn.preprocessing i... | true | true |
f7ffc4fb4300a0490128225281deb11ff866f150 | 1,889 | py | Python | bin/test_file.py | rodrigomelo9/uvm-python | e3127eba2cc1519a61dc6f736d862a8dcd6fce20 | [
"Apache-2.0"
] | 140 | 2020-01-18T00:14:17.000Z | 2022-03-29T10:57:24.000Z | bin/test_file.py | Mohsannaeem/uvm-python | 1b8768a1358d133465ede9cadddae651664b1d53 | [
"Apache-2.0"
] | 24 | 2020-01-18T18:40:58.000Z | 2021-03-25T17:39:07.000Z | bin/test_file.py | Mohsannaeem/uvm-python | 1b8768a1358d133465ede9cadddae651664b1d53 | [
"Apache-2.0"
] | 34 | 2020-01-18T12:22:59.000Z | 2022-02-11T07:03:11.000Z | # File header
# Header row2
import_var = "ABC"
# Also move this as a comment
# for 'comment_this_func.
#
# With extra empty line
def comment_this_func(aaa):
return aaa * 2
## Move this as class comment docstring
## Add this to class
class ABC():
def do_not_comment_this(self):
pass
# Nothing to ... | 19.474227 | 55 | 0.588142 |
import_var = "ABC"
#
# With extra empty line
def comment_this_func(aaa):
return aaa * 2
## Move this as class comment docstring
## Add this to class
class ABC():
def do_not_comment_this(self):
pass
# Nothing to do here
test_var = ""
# Is this indent?
def __init__(self, name): ... | true | true |
f7ffc5786cdb18ff1e24ceb8dd4e2d64c44ff421 | 1,879 | py | Python | replacy/test_helper.py | writerai/replaCy | 00a5ff923ebc876165805b267ae8a69d7fdc6405 | [
"MIT"
] | 18 | 2021-11-09T04:19:46.000Z | 2022-03-16T11:18:04.000Z | replacy/test_helper.py | weisisheng/replaCy | 00a5ff923ebc876165805b267ae8a69d7fdc6405 | [
"MIT"
] | 69 | 2020-02-27T19:37:07.000Z | 2021-07-02T17:19:50.000Z | replacy/test_helper.py | weisisheng/replaCy | 00a5ff923ebc876165805b267ae8a69d7fdc6405 | [
"MIT"
] | 4 | 2020-06-11T23:54:26.000Z | 2021-03-18T21:29:59.000Z | import unittest
from typing import Any, Dict, List, Tuple
import spacy
from replacy import ReplaceMatcher
from replacy.db import get_match_dict
class MatchDictTestHelper(unittest.TestCase):
@staticmethod
def generate_cases(match_dict: Dict[str, Any]) -> Tuple[List[Tuple[str, str]], List[Tuple[str, str]]]:
... | 40.847826 | 106 | 0.671634 | import unittest
from typing import Any, Dict, List, Tuple
import spacy
from replacy import ReplaceMatcher
from replacy.db import get_match_dict
class MatchDictTestHelper(unittest.TestCase):
@staticmethod
def generate_cases(match_dict: Dict[str, Any]) -> Tuple[List[Tuple[str, str]], List[Tuple[str, str]]]:
... | true | true |
f7ffc65a73da4dfbcb0939bcbd5b54e6b9cf2382 | 4,722 | py | Python | src/c3nav/mapdata/render/geometry/altitudearea.py | johnjohndoe/c3nav | a17f863a3512e305595c16b0300796b6bae81241 | [
"Apache-2.0"
] | 132 | 2016-11-12T01:45:23.000Z | 2022-03-08T15:17:10.000Z | src/c3nav/mapdata/render/geometry/altitudearea.py | johnjohndoe/c3nav | a17f863a3512e305595c16b0300796b6bae81241 | [
"Apache-2.0"
] | 66 | 2016-09-29T09:46:19.000Z | 2022-03-11T23:26:18.000Z | src/c3nav/mapdata/render/geometry/altitudearea.py | johnjohndoe/c3nav | a17f863a3512e305595c16b0300796b6bae81241 | [
"Apache-2.0"
] | 42 | 2016-09-29T08:34:57.000Z | 2022-03-08T15:17:15.000Z | from collections import deque
from itertools import chain
import numpy as np
from c3nav.mapdata.models import AltitudeArea
from c3nav.mapdata.render.geometry.hybrid import HybridGeometry
class AltitudeAreaGeometries:
def __init__(self, altitudearea=None, colors=None, obstacles=None):
if altitudearea is ... | 45.84466 | 111 | 0.568827 | from collections import deque
from itertools import chain
import numpy as np
from c3nav.mapdata.models import AltitudeArea
from c3nav.mapdata.render.geometry.hybrid import HybridGeometry
class AltitudeAreaGeometries:
def __init__(self, altitudearea=None, colors=None, obstacles=None):
if altitudearea is ... | true | true |
f7ffc6993a268caf48434eb6fc61b32051c9617a | 7,988 | py | Python | opentelemetry-sdk/tests/metrics/test_metric_reader_storage.py | bgranetzke/opentelemetry-python | f81381cf8aca64a707d934f20c6c27d40b949dce | [
"Apache-2.0"
] | null | null | null | opentelemetry-sdk/tests/metrics/test_metric_reader_storage.py | bgranetzke/opentelemetry-python | f81381cf8aca64a707d934f20c6c27d40b949dce | [
"Apache-2.0"
] | null | null | null | opentelemetry-sdk/tests/metrics/test_metric_reader_storage.py | bgranetzke/opentelemetry-python | f81381cf8aca64a707d934f20c6c27d40b949dce | [
"Apache-2.0"
] | null | null | null | # Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 38.038095 | 108 | 0.683525 |
from unittest.mock import Mock, patch
from opentelemetry.sdk._metrics.aggregation import DropAggregation
from opentelemetry.sdk._metrics.instrument import Counter
from opentelemetry.sdk._metrics.measurement import Measurement
from opentelemetry.sdk._metrics.metric_reader_storage import (
MetricReader... | true | true |
f7ffc6e3e47bc3b5d96b26ae3ea298bc61889322 | 3,518 | py | Python | scripting/models.py | NicolasKiely/percms | dbfae2406a9ea79c273197d96c5b0e70010ad114 | [
"MIT"
] | null | null | null | scripting/models.py | NicolasKiely/percms | dbfae2406a9ea79c273197d96c5b0e70010ad114 | [
"MIT"
] | 9 | 2016-09-15T05:12:36.000Z | 2016-10-27T21:38:40.000Z | scripting/models.py | NicolasKiely/percms | dbfae2406a9ea79c273197d96c5b0e70010ad114 | [
"MIT"
] | null | null | null | from __future__ import unicode_literals
from django.db import models
from django.core.urlresolvers import reverse
from common.core import view_link, edit_link
# Languages
langs = (
('py', 'Python'),
('js', 'Javascript')
)
class Script(models.Model):
''' Executable script handle '''
name = models.Cha... | 35.18 | 87 | 0.614554 | from __future__ import unicode_literals
from django.db import models
from django.core.urlresolvers import reverse
from common.core import view_link, edit_link
langs = (
('py', 'Python'),
('js', 'Javascript')
)
class Script(models.Model):
name = models.CharField('Script Name', max_length=255)
catego... | true | true |
f7ffc6e72ca5734cd6f20a437de6634e65ba36bd | 1,747 | py | Python | juriscraper/oral_args/united_states/state/md.py | EvandoBlanco/juriscraper | 3d16af258620d4ba1b4827f66ef69e8a2c5a0484 | [
"BSD-2-Clause"
] | 228 | 2015-01-23T04:41:39.000Z | 2022-03-30T09:52:20.000Z | juriscraper/oral_args/united_states/state/md.py | EvandoBlanco/juriscraper | 3d16af258620d4ba1b4827f66ef69e8a2c5a0484 | [
"BSD-2-Clause"
] | 331 | 2015-01-05T18:53:40.000Z | 2022-03-29T23:43:30.000Z | juriscraper/oral_args/united_states/state/md.py | EvandoBlanco/juriscraper | 3d16af258620d4ba1b4827f66ef69e8a2c5a0484 | [
"BSD-2-Clause"
] | 84 | 2015-01-03T01:19:21.000Z | 2022-03-01T08:09:32.000Z | """Scraper for Maryland Supreme Court Oral Argument Audio
This scraper has an interesting history. It was briefly running on the live
site, but we realized shortly after starting it that the scraper was
downloading video, not audio!
Seeing that we weren't ready for video, we disabled this scraper and deleted
any trac... | 34.254902 | 93 | 0.616485 |
from juriscraper.OralArgumentSiteLinear import OralArgumentSiteLinear
class Site(OralArgumentSiteLinear):
def __init__(self, *args, **kwargs):
super(Site, self).__init__(*args, **kwargs)
self.court_id = self.__module__
self.url = "http://www.courts.state.md.us/coappeals/webcasts/webcastar... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.