hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 958k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f733f7bdc6ccb83dcd5f5ed040f02a8015dd3bc6 | 3,400 | py | Python | src/main/python/foil/unification.py | stefano-bragaglia/PyFoil | eb558659f2d0e1298ebd7b854c3ecdeb1a007bda | [
"BSD-2-Clause"
] | null | null | null | src/main/python/foil/unification.py | stefano-bragaglia/PyFoil | eb558659f2d0e1298ebd7b854c3ecdeb1a007bda | [
"BSD-2-Clause"
] | null | null | null | src/main/python/foil/unification.py | stefano-bragaglia/PyFoil | eb558659f2d0e1298ebd7b854c3ecdeb1a007bda | [
"BSD-2-Clause"
] | null | null | null | import re
from collections import namedtuple
from typing import Dict
from typing import List
from typing import Optional
from typing import Union
Value = Union[bool, float, int, str]
Variable = str
Term = Union[Value, Variable]
Substitution = Dict[Variable, Term]
Step = namedtuple('Step', ['index', 'literal', 'substi... | 28.571429 | 101 | 0.612941 | import re
from collections import namedtuple
from typing import Dict
from typing import List
from typing import Optional
from typing import Union
Value = Union[bool, float, int, str]
Variable = str
Term = Union[Value, Variable]
Substitution = Dict[Variable, Term]
Step = namedtuple('Step', ['index', 'literal', 'substi... | true | true |
f733fa1ac2c27ec458218e283208cab0e78418f3 | 133 | py | Python | discord_karaoke/src/decorators/__init__.py | artemetr/discord-karaoke-bot | cd77739c31dde7a39399f946d954896075371aee | [
"MIT"
] | null | null | null | discord_karaoke/src/decorators/__init__.py | artemetr/discord-karaoke-bot | cd77739c31dde7a39399f946d954896075371aee | [
"MIT"
] | 3 | 2022-03-23T22:14:43.000Z | 2022-03-25T19:06:53.000Z | discord_karaoke/src/decorators/__init__.py | artemetr/discord-karaoke-bot | cd77739c31dde7a39399f946d954896075371aee | [
"MIT"
] | null | null | null | from .allowed_channels import allowed_channels
from .allowed_guilds import allowed_guilds
from .direct_message import direct_message
| 33.25 | 46 | 0.887218 | from .allowed_channels import allowed_channels
from .allowed_guilds import allowed_guilds
from .direct_message import direct_message
| true | true |
f733fd5a8e7d851d3b7e442b98201f652fb344be | 85,612 | py | Python | openshift/installer/vendored/openshift-ansible-git-2016-04-27/roles/openshift_facts/library/openshift_facts.py | fahlmant/openshift-tools | dbb4f16ccde3404c36c23108c45ca7b67138ee12 | [
"Apache-2.0"
] | null | null | null | openshift/installer/vendored/openshift-ansible-git-2016-04-27/roles/openshift_facts/library/openshift_facts.py | fahlmant/openshift-tools | dbb4f16ccde3404c36c23108c45ca7b67138ee12 | [
"Apache-2.0"
] | 3 | 2016-12-01T23:01:36.000Z | 2016-12-02T00:16:48.000Z | openshift/installer/vendored/openshift-ansible-git-2016-04-27/roles/openshift_facts/library/openshift_facts.py | fahlmant/openshift-tools | dbb4f16ccde3404c36c23108c45ca7b67138ee12 | [
"Apache-2.0"
] | 2 | 2018-10-16T05:11:13.000Z | 2018-11-07T01:46:29.000Z | #!/usr/bin/python
# pylint: disable=too-many-lines
# -*- coding: utf-8 -*-
# vim: expandtab:tabstop=4:shiftwidth=4
# Reason: Disable pylint too-many-lines because we don't want to split up this file.
# Status: Permanently disabled to keep this module as self-contained as possible.
"""Ansible module for retrieving and ... | 41.001916 | 129 | 0.579335 |
# Status: Permanently disabled to keep this module as self-contained as possible.
DOCUMENTATION = '''
---
module: openshift_facts
short_description: Cluster Facts
author: Jason DeTiberus
requirements: [ ]
'''
EXAMPLES = '''
'''
import ConfigParser
import copy
import os
import StringIO
import yaml
from distutils... | true | true |
f733fd6fdb137cc32d29187bb72ab56c79af93fe | 8,011 | py | Python | pytests/epengine/documentkeys.py | cgghali/TAF | 1de8dec77ad781c373e18d9c285befd534ac203a | [
"Apache-2.0"
] | null | null | null | pytests/epengine/documentkeys.py | cgghali/TAF | 1de8dec77ad781c373e18d9c285befd534ac203a | [
"Apache-2.0"
] | null | null | null | pytests/epengine/documentkeys.py | cgghali/TAF | 1de8dec77ad781c373e18d9c285befd534ac203a | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from basetestcase import BaseTestCase
from couchbase_helper.documentgenerator import doc_generator
from membase.api.rest_client import RestConnection
from couchbase_helper.document import View
class DocumentKeysTests(BaseTestCase):
def setUp(self):
super(DocumentKeysTests, self).s... | 44.505556 | 82 | 0.580202 |
from basetestcase import BaseTestCase
from couchbase_helper.documentgenerator import doc_generator
from membase.api.rest_client import RestConnection
from couchbase_helper.document import View
class DocumentKeysTests(BaseTestCase):
def setUp(self):
super(DocumentKeysTests, self).setUp()
nodes_in... | true | true |
f733fdf221450419c3d7c93286b3d35fe0b70e32 | 12,168 | py | Python | models/mli/model_skopes_rules.py | pragnesh-ai/driverlessai-recipes | 97371a2d2cd853cdeeb15037f462af96d81a7c0b | [
"Apache-2.0"
] | 194 | 2019-04-23T10:25:13.000Z | 2022-03-29T04:19:28.000Z | models/mli/model_skopes_rules.py | pragnesh-ai/driverlessai-recipes | 97371a2d2cd853cdeeb15037f462af96d81a7c0b | [
"Apache-2.0"
] | 50 | 2019-06-24T20:17:51.000Z | 2022-03-16T20:05:37.000Z | models/mli/model_skopes_rules.py | pragnesh-ai/driverlessai-recipes | 97371a2d2cd853cdeeb15037f462af96d81a7c0b | [
"Apache-2.0"
] | 85 | 2019-03-27T12:26:43.000Z | 2022-01-27T13:15:37.000Z | """Skopes rules """
import uuid
import os
import datatable as dt
import numpy as np
from h2oaicore.models import CustomModel
from sklearn.preprocessing import LabelEncoder
from h2oaicore.systemutils import physical_cores_count
from h2oaicore.systemutils import user_dir, remove, config
from h2oaicore.systemutils import... | 42.397213 | 127 | 0.591387 |
import uuid
import os
import datatable as dt
import numpy as np
from h2oaicore.models import CustomModel
from sklearn.preprocessing import LabelEncoder
from h2oaicore.systemutils import physical_cores_count
from h2oaicore.systemutils import user_dir, remove, config
from h2oaicore.systemutils import make_experiment_log... | true | true |
f733fdfd6251a8d71a648d7c85c3dac02509dfc4 | 75 | py | Python | cumulogenesis.py | stelligent/cumulogenesis | f5a3587aebd2592642c98cb4ad93d52a927dceeb | [
"MIT"
] | 1 | 2021-03-22T21:50:10.000Z | 2021-03-22T21:50:10.000Z | cumulogenesis.py | stelligent/cumulogenesis | f5a3587aebd2592642c98cb4ad93d52a927dceeb | [
"MIT"
] | 1 | 2021-03-25T22:23:04.000Z | 2021-03-25T22:23:04.000Z | cumulogenesis.py | stelligent/cumulogenesis | f5a3587aebd2592642c98cb4ad93d52a927dceeb | [
"MIT"
] | 1 | 2019-04-03T19:09:34.000Z | 2019-04-03T19:09:34.000Z | #!/usr/bin/env python
from cumulogenesis.interfaces import cli
cli.run()
| 12.5 | 40 | 0.76 |
from cumulogenesis.interfaces import cli
cli.run()
| true | true |
f733fe3381230dc5d35efe6c185f98aa454d97ea | 1,378 | py | Python | scripts/train_volleyball_stage2_dynamic.py | daniel-richter/DIN_GAR | f97759038936ad36359cb8c0d9ff0951d2482e25 | [
"MIT"
] | 14 | 2021-11-29T08:11:07.000Z | 2022-02-26T14:23:28.000Z | scripts/train_volleyball_stage2_dynamic.py | daniel-richter/DIN_GAR | f97759038936ad36359cb8c0d9ff0951d2482e25 | [
"MIT"
] | 9 | 2021-08-31T11:55:49.000Z | 2021-11-21T03:29:33.000Z | scripts/train_volleyball_stage2_dynamic.py | daniel-richter/DIN_GAR | f97759038936ad36359cb8c0d9ff0951d2482e25 | [
"MIT"
] | 6 | 2021-09-16T11:41:54.000Z | 2021-11-10T09:27:19.000Z | import sys
sys.path.append(".")
from train_net_dynamic import *
cfg=Config('volleyball')
cfg.inference_module_name = 'dynamic_volleyball'
cfg.device_list = "0,1"
cfg.use_gpu = True
cfg.use_multi_gpu = True
cfg.training_stage = 2
cfg.train_backbone = True
cfg.test_before_train = False
cfg.test_interval_epoch = 1
# vg... | 24.607143 | 71 | 0.727866 | import sys
sys.path.append(".")
from train_net_dynamic import *
cfg=Config('volleyball')
cfg.inference_module_name = 'dynamic_volleyball'
cfg.device_list = "0,1"
cfg.use_gpu = True
cfg.use_multi_gpu = True
cfg.training_stage = 2
cfg.train_backbone = True
cfg.test_before_train = False
cfg.test_interval_epoch = 1
cfg... | true | true |
f733ffc85633950fbe996e09698c90caf6a8e6e8 | 8,278 | py | Python | test_tesseract.py | mlissner/tesseract-performance-testing | f0040987ef9ccbaf65eb786301637fcdb00ef3b5 | [
"MIT"
] | 2 | 2016-08-25T23:36:42.000Z | 2018-03-15T20:51:58.000Z | test_tesseract.py | mlissner/tesseract-performance-testing | f0040987ef9ccbaf65eb786301637fcdb00ef3b5 | [
"MIT"
] | null | null | null | test_tesseract.py | mlissner/tesseract-performance-testing | f0040987ef9ccbaf65eb786301637fcdb00ef3b5 | [
"MIT"
] | null | null | null | import glob
import os
import subprocess
import tempfile
import time
import cStringIO
from wand.color import Color
from wand.image import Image
PATH = './test_assets/*.pdf'
def temp_name():
""" returns a temporary file-name """
tmpfile = tempfile.NamedTemporaryFile(prefix="tess_")
return tmpfile.name
d... | 33.51417 | 76 | 0.553395 | import glob
import os
import subprocess
import tempfile
import time
import cStringIO
from wand.color import Color
from wand.image import Image
PATH = './test_assets/*.pdf'
def temp_name():
tmpfile = tempfile.NamedTemporaryFile(prefix="tess_")
return tmpfile.name
def convert_to_txt(tmp_file_prefix):
te... | true | true |
f73400680cc5eaab78a41bb4860f6f92218c7d1e | 1,297 | py | Python | src/test/python/hellopymsdl_test/test__main__.py | St4rG00se/pymsdl_template | 779ffcf0fc249e44a406c6b02f439923f5d4caad | [
"MIT"
] | 1 | 2022-03-04T17:05:16.000Z | 2022-03-04T17:05:16.000Z | src/test/python/hellopymsdl_test/test__main__.py | St4rG00se/pymsdl_template | 779ffcf0fc249e44a406c6b02f439923f5d4caad | [
"MIT"
] | null | null | null | src/test/python/hellopymsdl_test/test__main__.py | St4rG00se/pymsdl_template | 779ffcf0fc249e44a406c6b02f439923f5d4caad | [
"MIT"
] | 1 | 2022-02-22T10:10:47.000Z | 2022-02-22T10:10:47.000Z | """Main file tests"""
from typing import Final
from unittest.mock import patch, MagicMock, call
class TestHello:
"""hello function Tests"""
class TestNominalCase:
@patch('hellopymsdl.service.MessageService.MessageService')
@patch('builtins.print')
def test_call_hello__should__print_m... | 34.131579 | 94 | 0.619121 | from typing import Final
from unittest.mock import patch, MagicMock, call
class TestHello:
class TestNominalCase:
@patch('hellopymsdl.service.MessageService.MessageService')
@patch('builtins.print')
def test_call_hello__should__print_message_from_message_service(
self, pr... | true | true |
f73400dfe689e91c4c2b457c4be1a0a41380fd6a | 1,555 | py | Python | pandas/tests/arrays/integer/conftest.py | AdrianMastronardi/pandas | 67045903306ac4a1cab108177e92df30d99912b4 | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"MIT-0",
"ECL-2.0",
"BSD-3-Clause"
] | 1 | 2019-11-01T08:44:40.000Z | 2019-11-01T08:44:40.000Z | pandas/tests/arrays/integer/conftest.py | AdrianMastronardi/pandas | 67045903306ac4a1cab108177e92df30d99912b4 | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"MIT-0",
"ECL-2.0",
"BSD-3-Clause"
] | null | null | null | pandas/tests/arrays/integer/conftest.py | AdrianMastronardi/pandas | 67045903306ac4a1cab108177e92df30d99912b4 | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"MIT-0",
"ECL-2.0",
"BSD-3-Clause"
] | null | null | null | import numpy as np
import pytest
import pandas as pd
from pandas.core.arrays.integer import (
Int8Dtype,
Int16Dtype,
Int32Dtype,
Int64Dtype,
UInt8Dtype,
UInt16Dtype,
UInt32Dtype,
UInt64Dtype,
)
@pytest.fixture(
params=[
Int8Dtype,
Int16Dtype,
Int32Dtype,
... | 22.536232 | 79 | 0.65209 | import numpy as np
import pytest
import pandas as pd
from pandas.core.arrays.integer import (
Int8Dtype,
Int16Dtype,
Int32Dtype,
Int64Dtype,
UInt8Dtype,
UInt16Dtype,
UInt32Dtype,
UInt64Dtype,
)
@pytest.fixture(
params=[
Int8Dtype,
Int16Dtype,
Int32Dtype,
... | true | true |
f73403c9f579d7c74df8240d768267a178688da7 | 5,629 | py | Python | sonnet/python/modules/layer_norm.py | gaoxuesong/sonnet | 40995a58744bbadc2e875c5c87e744896bdc4249 | [
"Apache-2.0"
] | 1 | 2021-06-04T06:21:24.000Z | 2021-06-04T06:21:24.000Z | sonnet/python/modules/layer_norm.py | gaoxuesong/sonnet | 40995a58744bbadc2e875c5c87e744896bdc4249 | [
"Apache-2.0"
] | null | null | null | sonnet/python/modules/layer_norm.py | gaoxuesong/sonnet | 40995a58744bbadc2e875c5c87e744896bdc4249 | [
"Apache-2.0"
] | null | null | null | # Copyright 2017 The Sonnet Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | 31.982955 | 80 | 0.67099 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from sonnet.python.modules import base
from sonnet.python.modules import util
import tensorflow as tf
class LayerNorm(base.AbstractModule):
GAMMA = "gamma"
BETA = "beta"
POSSIBLE... | true | true |
f73403edf303e50a99fe3939c97df68dfd5476b7 | 258 | py | Python | manage.py | msattel/strike_me_happy | c4bffa6a61f9b2066d4bf0fa41741f68553ec710 | [
"Apache-2.0"
] | null | null | null | manage.py | msattel/strike_me_happy | c4bffa6a61f9b2066d4bf0fa41741f68553ec710 | [
"Apache-2.0"
] | null | null | null | manage.py | msattel/strike_me_happy | c4bffa6a61f9b2066d4bf0fa41741f68553ec710 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "strike_me_happy.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| 23.454545 | 79 | 0.77907 |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "strike_me_happy.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| true | true |
f734047a23619f9f882b1d1a2e95f92ba54a9bbf | 24,574 | py | Python | tests/server/test_handlers.py | iPieter/kiwi | 76b66872fce68873809a0dea112e2ed552ae5b63 | [
"Apache-2.0"
] | null | null | null | tests/server/test_handlers.py | iPieter/kiwi | 76b66872fce68873809a0dea112e2ed552ae5b63 | [
"Apache-2.0"
] | 1 | 2021-01-24T13:34:51.000Z | 2021-01-24T13:34:51.000Z | tests/server/test_handlers.py | iPieter/kiwi | 76b66872fce68873809a0dea112e2ed552ae5b63 | [
"Apache-2.0"
] | null | null | null | import json
import uuid
import mock
import pytest
import os
import kiwi
from kiwi.entities import ViewType
from kiwi.entities.model_registry import RegisteredModel, ModelVersion, \
RegisteredModelTag, ModelVersionTag
from kiwi.exceptions import MlflowException
from kiwi.protos.databricks_pb2 import INTERNAL_ERROR... | 47.348748 | 99 | 0.68601 | import json
import uuid
import mock
import pytest
import os
import kiwi
from kiwi.entities import ViewType
from kiwi.entities.model_registry import RegisteredModel, ModelVersion, \
RegisteredModelTag, ModelVersionTag
from kiwi.exceptions import MlflowException
from kiwi.protos.databricks_pb2 import INTERNAL_ERROR... | true | true |
f73404abc05550c04ed086551a71f3b47aa447fb | 4,716 | py | Python | src/gt4sd/algorithms/conditional_generation/template/core.py | christofid/gt4sd-core | ea4257e8ff24ee7f766d7010ea5955d823eb9ad7 | [
"MIT"
] | 57 | 2022-02-11T22:32:58.000Z | 2022-03-31T23:17:06.000Z | src/gt4sd/algorithms/conditional_generation/template/core.py | christofid/gt4sd-core | ea4257e8ff24ee7f766d7010ea5955d823eb9ad7 | [
"MIT"
] | 31 | 2022-02-11T22:43:22.000Z | 2022-03-31T12:04:00.000Z | src/gt4sd/algorithms/conditional_generation/template/core.py | christofid/gt4sd-core | ea4257e8ff24ee7f766d7010ea5955d823eb9ad7 | [
"MIT"
] | 8 | 2022-02-15T11:13:54.000Z | 2022-03-22T13:56:13.000Z | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge,... | 36.55814 | 111 | 0.689355 |
import logging
from dataclasses import field
from typing import Any, Callable, ClassVar, Dict, Iterable, Optional, TypeVar
from ...core import AlgorithmConfiguration, GeneratorAlgorithm
from ...registry import ApplicationsRegistry
from .implementation import Generator
logger = logging.ge... | true | true |
f7340584474f529132f526642d02bd35b7d1ef3c | 7,394 | py | Python | tests/server/unit/services/test_mapping_service.py | DerekBev/tasking-manager | 6473ba28d0834ee82c9463c254a8b759c9566622 | [
"BSD-2-Clause"
] | 2 | 2019-07-15T19:18:58.000Z | 2020-09-02T18:11:30.000Z | tests/server/unit/services/test_mapping_service.py | DerekBev/tasking-manager | 6473ba28d0834ee82c9463c254a8b759c9566622 | [
"BSD-2-Clause"
] | 28 | 2019-01-04T17:39:00.000Z | 2021-05-06T23:06:24.000Z | tests/server/unit/services/test_mapping_service.py | DerekBev/tasking-manager | 6473ba28d0834ee82c9463c254a8b759c9566622 | [
"BSD-2-Clause"
] | 3 | 2020-02-29T20:46:09.000Z | 2020-11-20T19:44:04.000Z | import unittest
from server.services.mapping_service import MappingService, Task, MappingServiceError, TaskStatus, \
ProjectService, NotFound, StatsService, MappingNotAllowed, UserLicenseError
from server.models.dtos.mapping_dto import MappedTaskDTO, LockTaskDTO
from server.models.postgis.task import TaskHistory, ... | 39.540107 | 112 | 0.712199 | import unittest
from server.services.mapping_service import MappingService, Task, MappingServiceError, TaskStatus, \
ProjectService, NotFound, StatsService, MappingNotAllowed, UserLicenseError
from server.models.dtos.mapping_dto import MappedTaskDTO, LockTaskDTO
from server.models.postgis.task import TaskHistory, ... | true | true |
f73405aa62173fd68710fce3fe875060a712c5b2 | 458 | py | Python | arbitrage/observers/logger.py | acontry/altcoin-arbitrage | ddd1abc46d98e53ec0bd57f7cd82497dd1385683 | [
"MIT"
] | 7 | 2017-04-14T03:35:27.000Z | 2021-12-17T21:39:47.000Z | arbitrage/observers/logger.py | acontry/altcoin-arbitrage | ddd1abc46d98e53ec0bd57f7cd82497dd1385683 | [
"MIT"
] | null | null | null | arbitrage/observers/logger.py | acontry/altcoin-arbitrage | ddd1abc46d98e53ec0bd57f7cd82497dd1385683 | [
"MIT"
] | null | null | null | import logging
from .observer import Observer
import config
class Logger(Observer):
def opportunity(self, profit, volume, buyprice, kask, sellprice, kbid, perc,
weighted_buyprice, weighted_sellprice):
logging.info("profit: %f %s with volume: %f %s - buy at %i (%s) sell at %i (%s) ~%.2f... | 41.636364 | 131 | 0.644105 | import logging
from .observer import Observer
import config
class Logger(Observer):
def opportunity(self, profit, volume, buyprice, kask, sellprice, kbid, perc,
weighted_buyprice, weighted_sellprice):
logging.info("profit: %f %s with volume: %f %s - buy at %i (%s) sell at %i (%s) ~%.2f... | true | true |
f73405dde0b9040c2f5c50a1016e39cf915b9d5d | 16,453 | py | Python | src/trunk/apps/python/scvoice.py | Fran89/seiscomp3 | a25d29966949769d2bce9c0d28db0a2128e00649 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | 1 | 2021-08-04T00:20:17.000Z | 2021-08-04T00:20:17.000Z | src/trunk/apps/python/scvoice.py | Fran89/seiscomp3 | a25d29966949769d2bce9c0d28db0a2128e00649 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null | src/trunk/apps/python/scvoice.py | Fran89/seiscomp3 | a25d29966949769d2bce9c0d28db0a2128e00649 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | 1 | 2022-01-13T02:49:31.000Z | 2022-01-13T02:49:31.000Z | #!/usr/bin/env python
############################################################################
# Copyright (C) by GFZ Potsdam #
# #
# You can redistribute and/or modify this program under the ... | 42.29563 | 308 | 0.575093 |
new event is declared when I see it the first time")
if not self._agencyIDs:
seiscomp3.Logging.info("agencyIDs: []")
else:
seiscomp3.Logging.info("agencyIDs: %s" % (" ".join(self._agencyIDs)))
return True
def run(self):
try:
try:
... | true | true |
f734061f0d85620d2525a90bb81efc3ddacea8d3 | 1,541 | py | Python | keystonemiddleware/tests/unit/audit/test_logging_notifier.py | mahak/keystonemiddleware | 90df936708aee36d77cead548d04cb7db2327f47 | [
"Apache-1.1"
] | 55 | 2015-01-29T20:10:42.000Z | 2022-03-11T04:02:22.000Z | keystonemiddleware/tests/unit/audit/test_logging_notifier.py | mahak/keystonemiddleware | 90df936708aee36d77cead548d04cb7db2327f47 | [
"Apache-1.1"
] | 1 | 2016-08-25T01:01:57.000Z | 2016-08-25T01:01:57.000Z | keystonemiddleware/tests/unit/audit/test_logging_notifier.py | mahak/keystonemiddleware | 90df936708aee36d77cead548d04cb7db2327f47 | [
"Apache-1.1"
] | 49 | 2015-02-02T23:57:09.000Z | 2021-12-17T19:01:53.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
# distributed under t... | 36.690476 | 79 | 0.709929 |
from unittest import mock
import fixtures
from keystonemiddleware.tests.unit.audit import base
class TestLoggingNotifier(base.BaseAuditMiddlewareTest):
def setUp(self):
p = 'keystonemiddleware.audit._notifier.oslo_messaging'
f = fixtures.MockPatch(p, None)
self.messaging_fix... | true | true |
f73406859b04a2189c0bef19acf3f961e5fb1bd8 | 10,164 | py | Python | examples/benchmark/utils/recommendation/movielens.py | Ezra-H/autodist | b5ab28d0d867c22742daa3c1d324fe20c1852bd7 | [
"Apache-2.0"
] | 127 | 2020-07-16T16:33:10.000Z | 2022-03-25T09:58:50.000Z | examples/benchmark/utils/recommendation/movielens.py | Ezra-H/autodist | b5ab28d0d867c22742daa3c1d324fe20c1852bd7 | [
"Apache-2.0"
] | 17 | 2020-07-16T20:03:44.000Z | 2021-02-24T19:53:12.000Z | examples/benchmark/utils/recommendation/movielens.py | Ezra-H/autodist | b5ab28d0d867c22742daa3c1d324fe20c1852bd7 | [
"Apache-2.0"
] | 26 | 2020-07-21T01:23:55.000Z | 2022-02-24T03:43:08.000Z | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 31.273846 | 82 | 0.657222 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import tempfile
import zipfile
import numpy as np
import pandas as pd
import six
from six.moves import urllib
from absl import app as absl_app
from absl import flags
from... | true | true |
f73406bb107336874310c23479d76d9679ca7a7d | 3,159 | py | Python | qa/rpc-tests/auxpow.py | fastcoin-project/fastcoin | 3fbf26b4ff0d216d11aa59ae204e8be9a5337883 | [
"MIT"
] | 6 | 2021-01-04T22:22:57.000Z | 2021-07-19T10:45:51.000Z | qa/rpc-tests/auxpow.py | fastcoin-project/fastcoin | 3fbf26b4ff0d216d11aa59ae204e8be9a5337883 | [
"MIT"
] | null | null | null | qa/rpc-tests/auxpow.py | fastcoin-project/fastcoin | 3fbf26b4ff0d216d11aa59ae204e8be9a5337883 | [
"MIT"
] | 9 | 2021-01-04T00:01:28.000Z | 2021-11-03T05:30:10.000Z | #!/usr/bin/env python3
# Copyright (c) 2013-2021 The Fastcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test AuxPOW RPC interface and constraints
#
from test_framework.test_framework import BitcoinTestFr... | 35.494382 | 87 | 0.646407 |
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework import scrypt_auxpow
class AuxPOWTest (BitcoinTestFramework):
REWARD = 500000
CHAIN_ID = "62"
DIGISHIELD_START = 10
AUXPOW_START = 20
MATURITY_HEIGHT = 60
def setup... | true | true |
f73406c35707349614a6342df1ff196a5574c21f | 2,572 | py | Python | tools/ipc_fuzzer/scripts/remove_close_messages.py | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 14,668 | 2015-01-01T01:57:10.000Z | 2022-03-31T23:33:32.000Z | tools/ipc_fuzzer/scripts/remove_close_messages.py | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 113 | 2015-05-04T09:58:14.000Z | 2022-01-31T19:35:03.000Z | tools/ipc_fuzzer/scripts/remove_close_messages.py | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 5,941 | 2015-01-02T11:32:21.000Z | 2022-03-31T16:35:46.000Z | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Removes WidgetHostMsg_Close and alike from testcases. These messages are an
annoyance for corpus distillation. They cause the browser to exit, so no
furthe... | 30.987952 | 80 | 0.739114 |
from __future__ import print_function
import argparse
import os
import platform
import shutil
import subprocess
import sys
import tempfile
def create_temp_file():
temp_file = tempfile.NamedTemporaryFile(delete=False)
temp_file.close()
return temp_file.name
def main():
desc = 'Remove WidgetHostMsg_Close... | true | true |
f734072f1032589ab024016a3f18c4100381457c | 2,995 | py | Python | earlier-2020/graphs-paper1/print_line_chart.py | transcendentsky/py_tutorials | fed8e6c8d79f854a1cebcfd5c37297a163846208 | [
"Apache-2.0"
] | 1 | 2018-06-18T12:09:33.000Z | 2018-06-18T12:09:33.000Z | earlier-2020/graphs-paper1/print_line_chart.py | transcendentsky/py_tutorials | fed8e6c8d79f854a1cebcfd5c37297a163846208 | [
"Apache-2.0"
] | null | null | null | earlier-2020/graphs-paper1/print_line_chart.py | transcendentsky/py_tutorials | fed8e6c8d79f854a1cebcfd5c37297a163846208 | [
"Apache-2.0"
] | 1 | 2018-06-18T12:13:21.000Z | 2018-06-18T12:13:21.000Z | import csv
# import matplotlib.pyplot as plt
import pylab as plt
import numpy as np
def show_plot(times, epochs, data):
# line chart Or Scatter chart
plt.figure(figsize=(8, 5))
"""
args:
marker='o' ,'x',
color=
"""
plt.plot(epochs, data, color='red', label='0')
# plt.plot(epochs, d... | 29.362745 | 93 | 0.656427 | import csv
import pylab as plt
import numpy as np
def show_plot(times, epochs, data):
plt.figure(figsize=(8, 5))
plt.plot(epochs, data, color='red', label='0')
plt.title('Test')
plt.show()
pace(0, 399, 400)
y2 = plt.linspace(0, 350, 351)
vconf1 = plt.... | true | true |
f734073bb39c45a6569fc573a4b5a957b4ceda16 | 10,054 | py | Python | Samples/MISP/RequestManager.py | collinhunter/security-api-solutions | c42a7a70d07a871aff187ca8580f2bf0b4886713 | [
"MIT"
] | null | null | null | Samples/MISP/RequestManager.py | collinhunter/security-api-solutions | c42a7a70d07a871aff187ca8580f2bf0b4886713 | [
"MIT"
] | null | null | null | Samples/MISP/RequestManager.py | collinhunter/security-api-solutions | c42a7a70d07a871aff187ca8580f2bf0b4886713 | [
"MIT"
] | null | null | null | import requests
import config
import datetime
import os
import json
import copy
from constants import *
class RequestManager:
"""A class that handles submitting TiIndicators to MS Graph API
to use the class:
with RequestManager() as request_manager:
request_manager.handle_indicator(tiindi... | 45.288288 | 154 | 0.65924 | import requests
import config
import datetime
import os
import json
import copy
from constants import *
class RequestManager:
RJUST = 5
def __init__(self, total_indicators):
self.total_indicators = total_indicators
def __enter__(self):
try:
self.existing_indicators_hash_fd =... | true | true |
f7340747d29a1826d093f46d1c243b8b457589b9 | 396 | py | Python | rosters/migrations/0020_largerrulenames.py | gregcowell/roster-wizard | 8a594ba0a6b38fda34bcc924c70a37b1c1692ddf | [
"MIT"
] | 18 | 2019-10-27T02:53:57.000Z | 2021-12-30T06:02:12.000Z | rosters/migrations/0020_largerrulenames.py | gregcowell/roster-wizard | 8a594ba0a6b38fda34bcc924c70a37b1c1692ddf | [
"MIT"
] | 9 | 2020-06-06T02:24:55.000Z | 2021-09-11T03:54:05.000Z | rosters/migrations/0020_largerrulenames.py | gregcowell/roster-wizard | 8a594ba0a6b38fda34bcc924c70a37b1c1692ddf | [
"MIT"
] | 7 | 2020-04-20T03:25:56.000Z | 2021-09-09T06:50:24.000Z | # Generated by Django 2.2.3 on 2019-07-26 07:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rosters', '0019_leavedescription'),
]
operations = [
migrations.AlterField(
model_name='staffrule',
name='staff_rule... | 20.842105 | 50 | 0.608586 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rosters', '0019_leavedescription'),
]
operations = [
migrations.AlterField(
model_name='staffrule',
name='staff_rule_name',
field=models.CharField(max_... | true | true |
f7340855246935b040a51ded058fc0215f55b050 | 2,860 | py | Python | oneflow/compatible_single_client_python/test/xrt/test_softmax_grad.py | xcnick/oneflow | 7b786b27069dec35d2493256011e773988c91f56 | [
"Apache-2.0"
] | null | null | null | oneflow/compatible_single_client_python/test/xrt/test_softmax_grad.py | xcnick/oneflow | 7b786b27069dec35d2493256011e773988c91f56 | [
"Apache-2.0"
] | null | null | null | oneflow/compatible_single_client_python/test/xrt/test_softmax_grad.py | xcnick/oneflow | 7b786b27069dec35d2493256011e773988c91f56 | [
"Apache-2.0"
] | null | null | null | """
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | 32.134831 | 82 | 0.676224 | import unittest
import numpy as np
from oneflow.compatible import single_client as flow
config = flow.function_config()
def make_job(shape, axis, dtype=flow.float32):
config.use_xla_jit(False)
config.use_tensorrt(False)
@flow.global_function(config)
def softmax_grad_job(
y=flow.FixedTensorD... | true | true |
f73408b2ad399bcc363a99b2f737dcef526cb8b2 | 5,233 | py | Python | common/base.py | wrcyyy/appTest | e59c531e7856b3fa495213be6efbf576b7a4caea | [
"MIT"
] | null | null | null | common/base.py | wrcyyy/appTest | e59c531e7856b3fa495213be6efbf576b7a4caea | [
"MIT"
] | null | null | null | common/base.py | wrcyyy/appTest | e59c531e7856b3fa495213be6efbf576b7a4caea | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
------------------------------------
@Project : uiTest
@Time : 2021/3/9 14:17
@Auth : wrc
@Email : wrcyyy@126.com
@File : base.py
@IDE : PyCharm
------------------------------------
"""
import logging
import os
from selenium.webdriver.support.wait import WebDriverWait
from se... | 29.398876 | 101 | 0.540417 |
import logging
import os
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
from utils.fileoperate import FileOperate
class BaseOperation:
def __init__(self, driver):
self.__config_info = FileOperate.read_yaml(
os.path.join(os.path.dirn... | true | true |
f734093a5c93fef3c46192f28befb2535bc7bd6b | 23,429 | py | Python | applications/zcomx/tests/test_job_queue.py | zcomx/zco.mx | 70a7372af5787c2e4dea14b25bab0bbb2b959881 | [
"BSD-3-Clause"
] | null | null | null | applications/zcomx/tests/test_job_queue.py | zcomx/zco.mx | 70a7372af5787c2e4dea14b25bab0bbb2b959881 | [
"BSD-3-Clause"
] | null | null | null | applications/zcomx/tests/test_job_queue.py | zcomx/zco.mx | 70a7372af5787c2e4dea14b25bab0bbb2b959881 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_job_queue.py
Test suite for zcomx/modules/job_queue.py
"""
import datetime
import os
import subprocess
import time
import unittest
from gluon import *
from applications.zcomx.modules.job_queue import \
CLIOption, \
Daemon, \
DaemonSignalError, \
... | 29.544767 | 79 | 0.541679 |
import datetime
import os
import subprocess
import time
import unittest
from gluon import *
from applications.zcomx.modules.job_queue import \
CLIOption, \
Daemon, \
DaemonSignalError, \
IgnorableJob, \
InvalidCLIOptionError, \
InvalidJobOptionError, \
InvalidStatusError, \
Job, \
... | true | true |
f73409964d099723c4d6f502b21eefcdeb932ced | 1,488 | py | Python | wolk_gateway_module/interface/actuator_status_provider.py | Wolkabout/WolkGatewayModule-SDK-Python | 73cb537822d07cb68b0609022f53171ecf663fa4 | [
"Apache-2.0"
] | null | null | null | wolk_gateway_module/interface/actuator_status_provider.py | Wolkabout/WolkGatewayModule-SDK-Python | 73cb537822d07cb68b0609022f53171ecf663fa4 | [
"Apache-2.0"
] | 2 | 2020-11-16T15:10:36.000Z | 2020-11-20T13:10:13.000Z | wolk_gateway_module/interface/actuator_status_provider.py | Wolkabout/WolkGatewayModule-SDK-Python | 73cb537822d07cb68b0609022f53171ecf663fa4 | [
"Apache-2.0"
] | null | null | null | """Stub method for providing current device actuator status."""
# Copyright 2019 WolkAbout Technology s.r.o.
#
# 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.apach... | 36.292683 | 78 | 0.737231 |
from typing import Tuple
from typing import Union
from wolk_gateway_module.model.actuator_state import ActuatorState
def get_actuator_status(
device_key: str, reference: str
) -> Tuple[ActuatorState, Union[bool, int, float, str]]:
raise NotImplementedError
| true | true |
f7340a41d11266271a052dc71a2406320a530885 | 7,923 | py | Python | acd/scores/cd.py | SilanHe/hierarchical-dnn-interpretations | d6f96d0ab6fec48ee53ab930b2660e80525993b9 | [
"MIT"
] | null | null | null | acd/scores/cd.py | SilanHe/hierarchical-dnn-interpretations | d6f96d0ab6fec48ee53ab930b2660e80525993b9 | [
"MIT"
] | null | null | null | acd/scores/cd.py | SilanHe/hierarchical-dnn-interpretations | d6f96d0ab6fec48ee53ab930b2660e80525993b9 | [
"MIT"
] | null | null | null | import torch
import torch.nn.functional as F
from copy import deepcopy
import numpy as np
from scipy.special import expit as sigmoid
from .cd_propagate import *
from .cd_architecture_specific import *
def cd(im_torch: torch.Tensor, model, mask=None, model_type=None, device='cuda', transform=None):
'''Get contextua... | 42.827027 | 145 | 0.638773 | import torch
import torch.nn.functional as F
from copy import deepcopy
import numpy as np
from scipy.special import expit as sigmoid
from .cd_propagate import *
from .cd_architecture_specific import *
def cd(im_torch: torch.Tensor, model, mask=None, model_type=None, device='cuda', transform=None):
model.eval(... | true | true |
f7340bd5568d9d2e74fc3957907b003ad617d70e | 895 | py | Python | setup.py | dennislwy/internet-connection-python | 36360598773aca0a077c237d034caf4f19b784b1 | [
"MIT"
] | null | null | null | setup.py | dennislwy/internet-connection-python | 36360598773aca0a077c237d034caf4f19b784b1 | [
"MIT"
] | null | null | null | setup.py | dennislwy/internet-connection-python | 36360598773aca0a077c237d034caf4f19b784b1 | [
"MIT"
] | null | null | null | from setuptools import setup
from setuptools import find_packages
classifiers = [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
]
setup(
name="interne... | 37.291667 | 143 | 0.688268 | from setuptools import setup
from setuptools import find_packages
classifiers = [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
]
setup(
name="interne... | true | true |
f7340ca89f7353dcd0c8f391724088255d2a8188 | 2,171 | py | Python | pddm/regressors/feedforward_network.py | krishpop/pddm | b1452554a4e318966b8ca3da53978458ac635c5d | [
"Apache-2.0"
] | null | null | null | pddm/regressors/feedforward_network.py | krishpop/pddm | b1452554a4e318966b8ca3da53978458ac635c5d | [
"Apache-2.0"
] | null | null | null | pddm/regressors/feedforward_network.py | krishpop/pddm | b1452554a4e318966b8ca3da53978458ac635c5d | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 31.926471 | 74 | 0.579917 |
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
def feedforward_network(inputStates, inputSize, outputSize, num_fc_layers,
depth_fc_layers, tf_datatype, scope):
with tf.variable_scope(str(scope)):
inputState = tf.layers.flatten(inputStates)
... | true | true |
f7340cc711f3390937a5990e5bd4c691cd341575 | 3,123 | py | Python | hyperLAI/features/hyperLAIdataset.py | AI-sandbox/hyperLAI | 49f1a9d3c645ee0e5b0c2ed16d54ee8df0626689 | [
"MIT"
] | null | null | null | hyperLAI/features/hyperLAIdataset.py | AI-sandbox/hyperLAI | 49f1a9d3c645ee0e5b0c2ed16d54ee8df0626689 | [
"MIT"
] | null | null | null | hyperLAI/features/hyperLAIdataset.py | AI-sandbox/hyperLAI | 49f1a9d3c645ee0e5b0c2ed16d54ee8df0626689 | [
"MIT"
] | null | null | null | import numpy as np
import torch
from torch.utils import data
import sys
from utils.generate_dataset import *
from HypHC.datasets.triples import samples_triples
class HyperLoader(data.Dataset):
def __init__(self, data_dir, split_indices, restrict_labels=[0,1,2,3,4,5,6], chromosome="all"):
'''
Takes ... | 55.767857 | 150 | 0.658982 | import numpy as np
import torch
from torch.utils import data
import sys
from utils.generate_dataset import *
from HypHC.datasets.triples import samples_triples
class HyperLoader(data.Dataset):
def __init__(self, data_dir, split_indices, restrict_labels=[0,1,2,3,4,5,6], chromosome="all"):
self.data_dir = d... | true | true |
f7340d4c7d794f72db0316bab63819772700e43e | 207 | py | Python | flatlib/predictives/__init__.py | UtkuGlsvn/flatlib | 79ecb961ed77393405bc21a11a5874a62103ceef | [
"MIT"
] | null | null | null | flatlib/predictives/__init__.py | UtkuGlsvn/flatlib | 79ecb961ed77393405bc21a11a5874a62103ceef | [
"MIT"
] | null | null | null | flatlib/predictives/__init__.py | UtkuGlsvn/flatlib | 79ecb961ed77393405bc21a11a5874a62103ceef | [
"MIT"
] | null | null | null | """
This file is part of flatlib - (C) FlatAngle
Author: João Ventura (flatangleweb@gmail.com)
This subpackage implements a few traditional
astrology predictive techniques.
""" | 23 | 49 | 0.666667 | true | true | |
f7340d9075ad1031c3712b9f37da8e6741530c98 | 45,409 | py | Python | sequicity/tsd_net.py | qbetterk/user-simulator | 77caca30ff67b9112b1fe5e65e191c6b5e25532c | [
"Apache-2.0"
] | 20 | 2019-11-08T02:28:28.000Z | 2022-02-07T09:20:21.000Z | sequicity/tsd_net.py | qbetterk/user-simulator | 77caca30ff67b9112b1fe5e65e191c6b5e25532c | [
"Apache-2.0"
] | 21 | 2019-11-08T02:27:40.000Z | 2022-03-12T00:02:54.000Z | sequicity/tsd_net.py | qbetterk/user-simulator | 77caca30ff67b9112b1fe5e65e191c6b5e25532c | [
"Apache-2.0"
] | 8 | 2020-02-10T07:28:37.000Z | 2021-09-23T09:42:14.000Z | import torch
from torch import nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
import math
from sequicity.config import global_config as cfg
import copy, random, time, logging
from torch.distributions import Categorical
from sequicity.reader import pad_sequences
... | 48.774436 | 144 | 0.54672 | import torch
from torch import nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
import math
from sequicity.config import global_config as cfg
import copy, random, time, logging
from torch.distributions import Categorical
from sequicity.reader import pad_sequences
... | true | true |
f7340de05effdac17c1c33990b943f2aaef6a299 | 1,785 | py | Python | test/GenerativeGrammarTest.py | zigakleine/AmbientMusicForUniversities | 9008942aa846cd9e8e97615f0270c123f7e499e1 | [
"MIT"
] | 2 | 2021-08-15T12:07:13.000Z | 2021-08-16T06:46:37.000Z | test/GenerativeGrammarTest.py | zigakleine/AmbientMusicForUniversities | 9008942aa846cd9e8e97615f0270c123f7e499e1 | [
"MIT"
] | null | null | null | test/GenerativeGrammarTest.py | zigakleine/AmbientMusicForUniversities | 9008942aa846cd9e8e97615f0270c123f7e499e1 | [
"MIT"
] | null | null | null | '''
import re
import random
class ContextFreeGrammar:
def __init__(self, start_symbol, production_rules):
self.start_symbol = start_symbol
self.production_rules = production_rules
def expand(self):
return self.expand_rec(self.start_symbol)
def expand_rec(self, symbol_to_expand):... | 26.25 | 111 | 0.672829 | true | true | |
f7340dff6be1d38ab9659dc6728048e7bf4164b4 | 2,045 | py | Python | jp.atcoder/abc116/abc116_c/8404003.py | kagemeka/atcoder-submissions | 91d8ad37411ea2ec582b10ba41b1e3cae01d4d6e | [
"MIT"
] | 1 | 2022-02-09T03:06:25.000Z | 2022-02-09T03:06:25.000Z | jp.atcoder/abc116/abc116_c/8404003.py | kagemeka/atcoder-submissions | 91d8ad37411ea2ec582b10ba41b1e3cae01d4d6e | [
"MIT"
] | 1 | 2022-02-05T22:53:18.000Z | 2022-02-09T01:29:30.000Z | jp.atcoder/abc116/abc116_c/8404003.py | kagemeka/atcoder-submissions | 91d8ad37411ea2ec582b10ba41b1e3cae01d4d6e | [
"MIT"
] | null | null | null | # 2019-11-12 01:01:32(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float... | 24.939024 | 63 | 0.378973 |
import sys
main():
n, *h = [int(x) for x in sys.stdin.read().split()]
if n == 1:
print(h[0])
sys.exit()
mountain = [0]
valley = [0]
flat = 0
i = 0
while True:
if h[i] == h[i+1]:
if i < n-2:
i += 1
c... | true | true |
f7340e4cab27af3a24dc37ceb74bd27979d5d231 | 2,743 | py | Python | migrations/versions/2f182d32410d_.py | vasyanch/stepik_flask-delivery | 975f3b42ad7a19df420f5c03fe4e3d39bfe27988 | [
"MIT"
] | null | null | null | migrations/versions/2f182d32410d_.py | vasyanch/stepik_flask-delivery | 975f3b42ad7a19df420f5c03fe4e3d39bfe27988 | [
"MIT"
] | null | null | null | migrations/versions/2f182d32410d_.py | vasyanch/stepik_flask-delivery | 975f3b42ad7a19df420f5c03fe4e3d39bfe27988 | [
"MIT"
] | null | null | null | """empty message
Revision ID: 2f182d32410d
Revises:
Create Date: 2020-04-29 01:27:52.576633
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2f182d32410d'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... | 34.721519 | 65 | 0.658768 | from alembic import op
import sqlalchemy as sa
revision = '2f182d32410d'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
op.create_table('dishes',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('title', sa.String(), nullable=False),
sa.Column('price', sa.Inte... | true | true |
f7340ec44f8cb1d35e72adb5e22372f0c8339663 | 928 | py | Python | neigh1/signals.py | SteveMitto/neighborhood | 1f79c0cb807ffd91b80e2d663ab142572f7f1931 | [
"MIT"
] | null | null | null | neigh1/signals.py | SteveMitto/neighborhood | 1f79c0cb807ffd91b80e2d663ab142572f7f1931 | [
"MIT"
] | 8 | 2020-06-06T00:20:09.000Z | 2022-02-10T10:40:46.000Z | neigh1/signals.py | SteveMitto/neighborhood | 1f79c0cb807ffd91b80e2d663ab142572f7f1931 | [
"MIT"
] | null | null | null | from django.dispatch import receiver
from django.db.models.signals import pre_save,post_save
from django.contrib.auth.models import User
from django.contrib.auth.signals import user_logged_out,user_logged_in
from .models import Profile
@receiver(post_save, sender=User)
def create_user_profile(sender, instance, created... | 32 | 70 | 0.77694 | from django.dispatch import receiver
from django.db.models.signals import pre_save,post_save
from django.contrib.auth.models import User
from django.contrib.auth.signals import user_logged_out,user_logged_in
from .models import Profile
@receiver(post_save, sender=User)
def create_user_profile(sender, instance, created... | true | true |
f7340ecfbf45c6ede4d081d244d7681a1fc8a7ac | 2,209 | py | Python | sudoku/reduce.py | hawkfish/sudoku | eaae1aa3080032266db0fcfc8a6520a9cb5690fe | [
"MIT"
] | null | null | null | sudoku/reduce.py | hawkfish/sudoku | eaae1aa3080032266db0fcfc8a6520a9cb5690fe | [
"MIT"
] | null | null | null | sudoku/reduce.py | hawkfish/sudoku | eaae1aa3080032266db0fcfc8a6520a9cb5690fe | [
"MIT"
] | null | null | null | # !/usr/bin/python3
from sudoku.cells import *
from sudoku.regions import *
class ReduceError(BaseException):
pass
# Remove all used values from a cell
def reduceCellByValues(cell, used):
reduced = []
for value in cell:
if not used[value]: reduced.append(value)
if not len(reduced): raise R... | 27.6125 | 77 | 0.645088 |
from sudoku.cells import *
from sudoku.regions import *
class ReduceError(BaseException):
pass
def reduceCellByValues(cell, used):
reduced = []
for value in cell:
if not used[value]: reduced.append(value)
if not len(reduced): raise ReduceError
return reduced
def reduceCellByRegion(c... | true | true |
f7340f0f2accd24dc284f64500dd1dfd6566f91a | 474 | py | Python | examples/object_detection_tflite.py | Lynchez/deepvision | d1d6242dc6f85c4e7a9190b2994fd80535a2c218 | [
"MIT"
] | 6 | 2021-05-04T12:30:26.000Z | 2021-09-11T15:46:56.000Z | examples/object_detection_tflite.py | Lynchez/fastcv | d1d6242dc6f85c4e7a9190b2994fd80535a2c218 | [
"MIT"
] | null | null | null | examples/object_detection_tflite.py | Lynchez/fastcv | d1d6242dc6f85c4e7a9190b2994fd80535a2c218 | [
"MIT"
] | null | null | null | import cv2
from deepvision import TFlite
# open webcam
webcam = cv2.VideoCapture(0)
tflite = TFlite()
# loop through frames
while webcam.isOpened():
# read frame from webcam
status, frame = webcam.read()
frame = tflite.detect_objects(frame)
# display output
cv2.imshow("Real-time object detection"... | 22.571429 | 51 | 0.679325 | import cv2
from deepvision import TFlite
webcam = cv2.VideoCapture(0)
tflite = TFlite()
while webcam.isOpened():
status, frame = webcam.read()
frame = tflite.detect_objects(frame)
cv2.imshow("Real-time object detection", frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
... | true | true |
f7340f2385707e1f520f9566cbf5594f2dc11f59 | 141,254 | py | Python | prolog/interpreter/parsing.py | cosmoharrigan/pyrolog | b250e3ec0109049dea09419f2ad6a8ed14d92ff0 | [
"MIT"
] | 19 | 2015-04-05T14:36:11.000Z | 2022-02-07T21:47:57.000Z | prolog/interpreter/parsing.py | cosmoharrigan/pyrolog | b250e3ec0109049dea09419f2ad6a8ed14d92ff0 | [
"MIT"
] | null | null | null | prolog/interpreter/parsing.py | cosmoharrigan/pyrolog | b250e3ec0109049dea09419f2ad6a8ed14d92ff0 | [
"MIT"
] | 4 | 2017-02-06T23:51:14.000Z | 2021-11-13T08:06:43.000Z | import py
from rpython.rlib.parsing.ebnfparse import parse_ebnf
from rpython.rlib.parsing.regexparse import parse_regex
from rpython.rlib.parsing.lexer import Lexer, DummyLexer
from rpython.rlib.parsing.deterministic import DFA, LexerError
from rpython.rlib.parsing.tree import Nonterminal, Symbol, RPythonVisitor
from r... | 22.571748 | 884 | 0.359317 | import py
from rpython.rlib.parsing.ebnfparse import parse_ebnf
from rpython.rlib.parsing.regexparse import parse_regex
from rpython.rlib.parsing.lexer import Lexer, DummyLexer
from rpython.rlib.parsing.deterministic import DFA, LexerError
from rpython.rlib.parsing.tree import Nonterminal, Symbol, RPythonVisitor
from r... | false | true |
f73410e401dbaa34b6ceee1385cd1bcc00af7447 | 966 | py | Python | beer/types/mempool_item.py | petrus-hanks/flax-blockchain | 6e180dc84ca24c757555c9947f44bd724b1af3eb | [
"Apache-2.0"
] | 8 | 2021-07-08T00:11:49.000Z | 2022-02-09T04:28:40.000Z | beer/types/mempool_item.py | petrus-hanks/flax-blockchain | 6e180dc84ca24c757555c9947f44bd724b1af3eb | [
"Apache-2.0"
] | 15 | 2021-07-29T06:37:42.000Z | 2021-08-29T17:26:08.000Z | beer/types/mempool_item.py | petrus-hanks/flax-blockchain | 6e180dc84ca24c757555c9947f44bd724b1af3eb | [
"Apache-2.0"
] | 3 | 2021-10-04T17:51:04.000Z | 2022-03-01T04:23:01.000Z | from dataclasses import dataclass
from typing import List
from beer.consensus.cost_calculator import NPCResult
from beer.types.blockchain_format.coin import Coin
from beer.types.blockchain_format.program import SerializedProgram
from beer.types.blockchain_format.sized_bytes import bytes32
from beer.types.spend_bundle ... | 27.6 | 66 | 0.76501 | from dataclasses import dataclass
from typing import List
from beer.consensus.cost_calculator import NPCResult
from beer.types.blockchain_format.coin import Coin
from beer.types.blockchain_format.program import SerializedProgram
from beer.types.blockchain_format.sized_bytes import bytes32
from beer.types.spend_bundle ... | true | true |
f734112f18de9c64644d82da3c43167201edc406 | 6,823 | py | Python | kafka-utils/tests/bai_kafka_utils/test_fetcher_event.py | gavinmbell/benchmark-ai-1 | a697e67d68b843fe9350e55871dad867bab5d51d | [
"Apache-2.0"
] | 6 | 2020-09-29T09:03:04.000Z | 2022-03-14T06:52:25.000Z | kafka-utils/tests/bai_kafka_utils/test_fetcher_event.py | gavinmbell/benchmark-ai-1 | a697e67d68b843fe9350e55871dad867bab5d51d | [
"Apache-2.0"
] | null | null | null | kafka-utils/tests/bai_kafka_utils/test_fetcher_event.py | gavinmbell/benchmark-ai-1 | a697e67d68b843fe9350e55871dad867bab5d51d | [
"Apache-2.0"
] | 4 | 2020-10-01T07:49:22.000Z | 2021-06-16T19:44:12.000Z | from bai_kafka_utils.events import (
BenchmarkDoc,
VisitedService,
FetcherBenchmarkEvent,
DownloadableContent,
FetcherPayload,
FileSystemObject,
)
BIG_FETCHER_JSON = """{
"date": "Thu May 02 16:15:42 UTC 2019",
"authenticated": false,
"payload": {
... | 39.668605 | 116 | 0.44863 | from bai_kafka_utils.events import (
BenchmarkDoc,
VisitedService,
FetcherBenchmarkEvent,
DownloadableContent,
FetcherPayload,
FileSystemObject,
)
BIG_FETCHER_JSON = """{
"date": "Thu May 02 16:15:42 UTC 2019",
"authenticated": false,
"payload": {
... | true | true |
f73412f4b6192da0844dc366a2b07c76cba2888e | 671 | py | Python | _from_pydot/lambdas/utils/dot_to_png.py | owasp-sbot/pbx-gs-python-utils | f448aa36c4448fc04d30c3a5b25640ea4d44a267 | [
"Apache-2.0"
] | 3 | 2018-12-14T15:43:46.000Z | 2019-04-25T07:44:58.000Z | _from_pydot/lambdas/utils/dot_to_png.py | owasp-sbot/pbx-gs-python-utils | f448aa36c4448fc04d30c3a5b25640ea4d44a267 | [
"Apache-2.0"
] | 1 | 2019-05-11T14:19:37.000Z | 2019-05-11T14:51:04.000Z | _from_pydot/lambdas/utils/dot_to_png.py | owasp-sbot/pbx-gs-python-utils | f448aa36c4448fc04d30c3a5b25640ea4d44a267 | [
"Apache-2.0"
] | 4 | 2018-12-27T04:54:14.000Z | 2019-05-11T14:07:47.000Z | from osbot_aws.apis.Lambda import Lambda
from osbot_aws.helpers.Lambda_Helpers import slack_message
def run(event, context):
channel = event.get('channel')
try:
dot_to_svg = Lambda('gw_bot.lambdas.dot_to_svg').invoke
svg_to_png = Lambda('gw_bot.lambdas.svg_to_png').invoke
svg = ... | 39.470588 | 89 | 0.634873 | from osbot_aws.apis.Lambda import Lambda
from osbot_aws.helpers.Lambda_Helpers import slack_message
def run(event, context):
channel = event.get('channel')
try:
dot_to_svg = Lambda('gw_bot.lambdas.dot_to_svg').invoke
svg_to_png = Lambda('gw_bot.lambdas.svg_to_png').invoke
svg = ... | true | true |
f7341316b65044218ec1dd53113d96b181f0c7e8 | 1,108 | py | Python | vb2py/test/testimports.py | ceprio/xl_vb2py | 899fec0301140fd8bd313e8c80b3fa839b3f5ee4 | [
"BSD-3-Clause"
] | null | null | null | vb2py/test/testimports.py | ceprio/xl_vb2py | 899fec0301140fd8bd313e8c80b3fa839b3f5ee4 | [
"BSD-3-Clause"
] | null | null | null | vb2py/test/testimports.py | ceprio/xl_vb2py | 899fec0301140fd8bd313e8c80b3fa839b3f5ee4 | [
"BSD-3-Clause"
] | null | null | null | import vb2py.vbparser
import unittest
class TestImports(unittest.TestCase):
# << Imports tests >>
def testImportClassToModule(self):
"""Import from class to module"""
self.proj = vb2py.vbparser.VBProject()
self.utils = vb2py.vbparser.VBCodeModule(modulename="utils")
self.cls = v... | 30.777778 | 82 | 0.617329 | import vb2py.vbparser
import unittest
class TestImports(unittest.TestCase):
def testImportClassToModule(self):
self.proj = vb2py.vbparser.VBProject()
self.utils = vb2py.vbparser.VBCodeModule(modulename="utils")
self.cls = vb2py.vbparser.VBClassModule(modulename="Cls", classname="Cls")
... | true | true |
f734148db4674d3e295a32e4c427f45aac085654 | 52,109 | py | Python | dataverse_repository_curation_assistant/dataverse_repository_curation_assistant_functions.py | jggautier/dataverse-automating-downloads | 40cf127e7771049165b21b732635cd35848eda5e | [
"CC0-1.0"
] | null | null | null | dataverse_repository_curation_assistant/dataverse_repository_curation_assistant_functions.py | jggautier/dataverse-automating-downloads | 40cf127e7771049165b21b732635cd35848eda5e | [
"CC0-1.0"
] | 1 | 2019-08-30T04:02:08.000Z | 2019-08-30T05:16:46.000Z | dataverse_repository_curation_assistant/dataverse_repository_curation_assistant_functions.py | jggautier/dataverse-automating-downloads | 40cf127e7771049165b21b732635cd35848eda5e | [
"CC0-1.0"
] | null | null | null | # Functions for the curation app
import csv
from dateutil.parser import parse
from functools import reduce
import json
import glob
import os
from os import listdir
import pandas as pd
from pathlib import Path
import re
import requests
import time
from tkinter import Tk, ttk, Frame, Label, IntVar, Checkbutton, filedialo... | 42.537959 | 138 | 0.606824 |
import csv
from dateutil.parser import parse
from functools import reduce
import json
import glob
import os
from os import listdir
import pandas as pd
from pathlib import Path
import re
import requests
import time
from tkinter import Tk, ttk, Frame, Label, IntVar, Checkbutton, filedialog, NORMAL, DISABLED
from tkinter... | true | true |
f73414f87ce5fccc45b190ae55d9f6dc7c6eabfb | 10,224 | py | Python | vspk/v4_0/nubootstrap.py | mohaimenhasan/vspk-python | 4c7b297427048340b250cc3c74d9214dc0d4bde1 | [
"BSD-3-Clause"
] | null | null | null | vspk/v4_0/nubootstrap.py | mohaimenhasan/vspk-python | 4c7b297427048340b250cc3c74d9214dc0d4bde1 | [
"BSD-3-Clause"
] | null | null | null | vspk/v4_0/nubootstrap.py | mohaimenhasan/vspk-python | 4c7b297427048340b250cc3c74d9214dc0d4bde1 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyrigh... | 29.894737 | 250 | 0.611502 |
from .fetchers import NUMetadatasFetcher
from .fetchers import NUGlobalMetadatasFetcher
from bambou import NURESTObject
class NUBootstrap(NURESTObject):
__rest_name__ = "bootstrap"
__resource_name__ = "bootstraps"
ONST_ZFB_MATCH_ATTRIBUTE_NONE = "NONE"
CONS... | true | true |
f73415df562837992d6bfe6789244be417512e7e | 230 | py | Python | automatewithpython/regex/findall/xmasregex.py | Coalemus/Python-Projects | 4b0e0c12a2fdcfbaf491df5715885c61f44bdb1c | [
"MIT"
] | null | null | null | automatewithpython/regex/findall/xmasregex.py | Coalemus/Python-Projects | 4b0e0c12a2fdcfbaf491df5715885c61f44bdb1c | [
"MIT"
] | null | null | null | automatewithpython/regex/findall/xmasregex.py | Coalemus/Python-Projects | 4b0e0c12a2fdcfbaf491df5715885c61f44bdb1c | [
"MIT"
] | null | null | null | #!/bin/zsh
import re
xmasregex = re.compile(r'\d\s\w+')
mtob1 = xmasregex.findall(
"12 drummers, 11 pipers, 10 lords, 9 ladies, 8 maids, 7 swans, 6 geese, 5 rings, 4 birds, 3 hens, 2 doves, 1 partidge"
)
print(mtob1)
| 17.692308 | 122 | 0.647826 |
import re
xmasregex = re.compile(r'\d\s\w+')
mtob1 = xmasregex.findall(
"12 drummers, 11 pipers, 10 lords, 9 ladies, 8 maids, 7 swans, 6 geese, 5 rings, 4 birds, 3 hens, 2 doves, 1 partidge"
)
print(mtob1)
| true | true |
f73416d556fd29e31b2b5e98fd85ef253b840382 | 7,151 | py | Python | contentcuration/contentcuration/viewsets/sync/endpoint.py | DXCanas/content-curation | 06ac2cf2a49d2420cb8a418f5df2bfee53ef644b | [
"MIT"
] | null | null | null | contentcuration/contentcuration/viewsets/sync/endpoint.py | DXCanas/content-curation | 06ac2cf2a49d2420cb8a418f5df2bfee53ef644b | [
"MIT"
] | null | null | null | contentcuration/contentcuration/viewsets/sync/endpoint.py | DXCanas/content-curation | 06ac2cf2a49d2420cb8a418f5df2bfee53ef644b | [
"MIT"
] | null | null | null | """
A view that handles synchronization of changes from the frontend
and deals with processing all the changes to make appropriate
bulk creates, updates, and deletes.
"""
from collections import OrderedDict
from itertools import groupby
from django.conf import settings
from rest_framework.authentication import Session... | 38.037234 | 103 | 0.735561 | from collections import OrderedDict
from itertools import groupby
from django.conf import settings
from rest_framework.authentication import SessionAuthentication
from rest_framework.authentication import TokenAuthentication
from rest_framework.decorators import api_view
from rest_framework.decorators import authentic... | true | true |
f73417474be34d4bc69561d5e19d269147c3150d | 134 | py | Python | tests/data/chefs_in_a_file.py | mjoblin/netdumplings | 1ec3c4d80f302fe749e51171084ac05bbe57a701 | [
"MIT"
] | 2 | 2016-06-02T18:13:38.000Z | 2020-03-05T08:41:10.000Z | tests/data/chefs_in_a_file.py | mjoblin/netdumplings | 1ec3c4d80f302fe749e51171084ac05bbe57a701 | [
"MIT"
] | 5 | 2016-11-25T02:35:51.000Z | 2018-01-13T05:53:06.000Z | tests/data/chefs_in_a_file.py | mjoblin/netdumplings | 1ec3c4d80f302fe749e51171084ac05bbe57a701 | [
"MIT"
] | null | null | null | from netdumplings import DumplingChef
class ChefOneFromFile(DumplingChef):
pass
class ChefTwoFromFile(DumplingChef):
pass
| 13.4 | 37 | 0.791045 | from netdumplings import DumplingChef
class ChefOneFromFile(DumplingChef):
pass
class ChefTwoFromFile(DumplingChef):
pass
| true | true |
f73417a107e1b7e313c65e66400c42e8d9bd57ed | 49,712 | py | Python | boto/mws/connection.py | ninchat/boto | 5a8a043b382955047811134a50c3d17b0c994f93 | [
"MIT"
] | 15 | 2015-03-25T05:24:11.000Z | 2021-12-18T04:24:06.000Z | boto/mws/connection.py | ninchat/boto | 5a8a043b382955047811134a50c3d17b0c994f93 | [
"MIT"
] | null | null | null | boto/mws/connection.py | ninchat/boto | 5a8a043b382955047811134a50c3d17b0c994f93 | [
"MIT"
] | 10 | 2015-04-26T17:56:37.000Z | 2020-09-24T14:01:53.000Z | # Copyright (c) 2012-2014 Andy Davidoff http://www.disruptek.com/
#
# 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... | 42.561644 | 87 | 0.632 |
import xml.sax
import hashlib
import base64
import string
import collections
from boto.connection import AWSQueryConnection
from boto.exception import BotoServerError
import boto.mws.exception
import boto.mws.response
from boto.handler import XmlHandler
__all__ = ['MWSConnection']
api_version_path... | false | true |
f73417fd194f35c59a19fcb4a2152aa67643647a | 43,678 | py | Python | mir_eval/segment.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 5668b5785296b314ea1321057420bcd077dba9ea | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | mir_eval/segment.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 5668b5785296b314ea1321057420bcd077dba9ea | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | mir_eval/segment.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 5668b5785296b314ea1321057420bcd077dba9ea | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | # CREATED:2013-08-13 12:02:42 by Brian McFee <brm2132@columbia.edu>
'''
Evaluation criteria for structural segmentation fall into two categories:
boundary annotation and structural annotation. Boundary annotation is the task
of predicting the times at which structural changes occur, such as when a verse
transitions to... | 38.790409 | 82 | 0.628486 |
import collections
import warnings
import numpy as np
import scipy.stats
import scipy.sparse
import scipy.misc
import scipy.special
from . import util
def validate_boundary(reference_intervals, estimated_intervals, trim):
if trim:
min_size = 2
else:
# If we're not trimming, then ... | true | true |
f7341a25ef54e344f2d21e600a9f6534cbf6773f | 3,201 | py | Python | tests/instrumentation/mysql_tests.py | mvas/apm-agent-python | f4582e90eb5308b915ca51e2e98620fc22af09ec | [
"BSD-3-Clause"
] | null | null | null | tests/instrumentation/mysql_tests.py | mvas/apm-agent-python | f4582e90eb5308b915ca51e2e98620fc22af09ec | [
"BSD-3-Clause"
] | null | null | null | tests/instrumentation/mysql_tests.py | mvas/apm-agent-python | f4582e90eb5308b915ca51e2e98620fc22af09ec | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from elasticapm.instrumentation.packages.mysql import extract_signature
def test_insert():
sql = """INSERT INTO `mytable` (id, name) VALUE ('2323', 'Ron')"""
actual = extract_signature(sql)
assert "INSERT INTO mytable" == actual
def test_update():
sql = """UPDATE `mytable` s... | 23.88806 | 90 | 0.65667 |
from elasticapm.instrumentation.packages.mysql import extract_signature
def test_insert():
sql = """INSERT INTO `mytable` (id, name) VALUE ('2323', 'Ron')"""
actual = extract_signature(sql)
assert "INSERT INTO mytable" == actual
def test_update():
sql = """UPDATE `mytable` set name='Ron' WHERE id ... | true | true |
f7341a9c8be3fa88dd45fd556c704ded0c5a9d36 | 4,597 | py | Python | slicing.py | jw03070/Advanced-DeepSleepNet | b58d71971be28c8517f61731b8ee933a5bbf3f0a | [
"Apache-2.0"
] | 1 | 2020-08-21T06:11:53.000Z | 2020-08-21T06:11:53.000Z | slicing.py | leesk212/Advanced-DeepSleepNet | b58d71971be28c8517f61731b8ee933a5bbf3f0a | [
"Apache-2.0"
] | null | null | null | slicing.py | leesk212/Advanced-DeepSleepNet | b58d71971be28c8517f61731b8ee933a5bbf3f0a | [
"Apache-2.0"
] | 1 | 2020-08-21T06:06:49.000Z | 2020-08-21T06:06:49.000Z | # -*- coding: utf-8 -*-
"""
@author: BSW
"""
import numpy as np
import os
def slicing(filename,data):
wc=1
n1c=1
n2c=1
n3c=1
n4c=1
t=0
npz = np.load(data)
x = npz['x']
y = npz['y']
os.makedirs("./data/"+filename[:-3], exist_ok=True)
os.makedirs("./data/"+filename[... | 39.62931 | 94 | 0.451381 |
import numpy as np
import os
def slicing(filename,data):
wc=1
n1c=1
n2c=1
n3c=1
n4c=1
t=0
npz = np.load(data)
x = npz['x']
y = npz['y']
os.makedirs("./data/"+filename[:-3], exist_ok=True)
os.makedirs("./data/"+filename[:-3]+"/1D_Wake", exist_ok=True)
os.maked... | true | true |
f7341ad925a2f9bab834873ceba073a569039b88 | 811 | py | Python | otcextensions/tests/functional/sdk/mrs/v1/test_service.py | zsoltn/python-otcextensions | 4c0fa22f095ebd5f9636ae72acbae5048096822c | [
"Apache-2.0"
] | 10 | 2018-03-03T17:59:59.000Z | 2020-01-08T10:03:00.000Z | otcextensions/tests/functional/sdk/mrs/v1/test_service.py | zsoltn/python-otcextensions | 4c0fa22f095ebd5f9636ae72acbae5048096822c | [
"Apache-2.0"
] | 208 | 2020-02-10T08:27:46.000Z | 2022-03-29T15:24:21.000Z | otcextensions/tests/functional/sdk/mrs/v1/test_service.py | zsoltn/python-otcextensions | 4c0fa22f095ebd5f9636ae72acbae5048096822c | [
"Apache-2.0"
] | 15 | 2020-04-01T20:45:54.000Z | 2022-03-23T12:45:43.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
# distributed under t... | 32.44 | 75 | 0.759556 |
from openstack import _log
from otcextensions.tests.functional import base
_logger = _log.setup_logging('openstack')
class TestService(base.BaseFunctionalTest):
def test_initialize(self):
client = self.conn.mrs
self.assertIsNotNone(client)
| true | true |
f7341b46721d8f8e196cfa24f2fb38ec8139fec9 | 1,250 | py | Python | falcon_kit/util/alarm.py | PacificBiosciences/falcon3 | fde93d4ed79746cd280006bca6808e6975585738 | [
"BSD-3-Clause-Clear"
] | null | null | null | falcon_kit/util/alarm.py | PacificBiosciences/falcon3 | fde93d4ed79746cd280006bca6808e6975585738 | [
"BSD-3-Clause-Clear"
] | null | null | null | falcon_kit/util/alarm.py | PacificBiosciences/falcon3 | fde93d4ed79746cd280006bca6808e6975585738 | [
"BSD-3-Clause-Clear"
] | 5 | 2020-07-22T14:10:16.000Z | 2021-04-26T17:07:05.000Z | """Special handling for exceptions, for the UI.
"""
def alarm(e):
"""
Write traceback into PBFALCON_ERRFILE (until we stop using pbfalcon).
Write a special JSON object expected by pbcommand.models.common.
"""
import datetime
import os
import traceback
import uuid
from ..io import se... | 32.051282 | 101 | 0.6032 |
def alarm(e):
import datetime
import os
import traceback
import uuid
from ..io import serialize
tb = traceback.format_exc()
errfile = os.environ.get('PBFALCON_ERRFILE')
if errfile:
with open(errfile, 'w') as ofs:
ofs.write(tb)
special = [
... | true | true |
f7341d85b42e46f9636103b6ce706ad11869ce0f | 721 | py | Python | dp/HanoiTowers.py | ykumards/Algorithms | 53767683644c3c766dfc5d7347b1fc71f43256b2 | [
"WTFPL"
] | null | null | null | dp/HanoiTowers.py | ykumards/Algorithms | 53767683644c3c766dfc5d7347b1fc71f43256b2 | [
"WTFPL"
] | null | null | null | dp/HanoiTowers.py | ykumards/Algorithms | 53767683644c3c766dfc5d7347b1fc71f43256b2 | [
"WTFPL"
] | null | null | null | """
Given three towers and n sorted disks placed on it, we
have to move all the disks from one tower to the other
while using the third one as buffer.
There are three rules that each move should follow.
"""
def move(start, buffr, end, n):
"""
By using the recursion from base case to move upwards
we can cha... | 31.347826 | 60 | 0.668516 |
def move(start, buffr, end, n):
if n < 2:
x = start.pop()
return end.append(x)
top = start.pop()
buffr = move(start, end, buffr, n-1)
| true | true |
f7341dfa9ee065b402c636e541f05fc4d8673ba8 | 1,251 | py | Python | ietf/secr/areas/tests.py | hassanakbar4/ietfdb | cabee059092ae776015410640226064331c293b7 | [
"BSD-3-Clause"
] | 25 | 2022-03-05T08:26:52.000Z | 2022-03-30T15:45:42.000Z | ietf/secr/areas/tests.py | hassanakbar4/ietfdb | cabee059092ae776015410640226064331c293b7 | [
"BSD-3-Clause"
] | 219 | 2022-03-04T17:29:12.000Z | 2022-03-31T21:16:14.000Z | ietf/secr/areas/tests.py | hassanakbar4/ietfdb | cabee059092ae776015410640226064331c293b7 | [
"BSD-3-Clause"
] | 22 | 2022-03-04T15:34:34.000Z | 2022-03-28T13:30:59.000Z | from django.urls import reverse
from ietf.group.factories import GroupFactory, GroupEventFactory
from ietf.group.models import Group, GroupEvent
from ietf.person.models import Person
from ietf.utils.test_utils import TestCase
SECR_USER='secretary'
def augment_data():
system = Person.objects.get(name="(System)")... | 35.742857 | 81 | 0.658673 | from django.urls import reverse
from ietf.group.factories import GroupFactory, GroupEventFactory
from ietf.group.models import Group, GroupEvent
from ietf.person.models import Person
from ietf.utils.test_utils import TestCase
SECR_USER='secretary'
def augment_data():
system = Person.objects.get(name="(System)")... | true | true |
f7341e2feffa1989bf80d861c14a2909fd98ccb0 | 549 | py | Python | example/middleware.py | chartbeat/django-social-auth | cf72986ab3c01c1dae2c3baebd00c540fb4250d8 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | 1 | 2019-08-24T00:33:13.000Z | 2019-08-24T00:33:13.000Z | example/middleware.py | tonylampada/django-social-auth | a77c0dd1b160c391098b6c157838d54516f4d334 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null | example/middleware.py | tonylampada/django-social-auth | a77c0dd1b160c391098b6c157838d54516f4d334 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null | from django.core.urlresolvers import reverse
from social_auth.backends.exceptions import AuthAlreadyAssociated
from social_auth.middleware import SocialAuthExceptionMiddleware
class ExampleSocialAuthExceptionMiddleware(SocialAuthExceptionMiddleware):
def get_message(self, request, exception):
if isinstan... | 36.6 | 74 | 0.777778 | from django.core.urlresolvers import reverse
from social_auth.backends.exceptions import AuthAlreadyAssociated
from social_auth.middleware import SocialAuthExceptionMiddleware
class ExampleSocialAuthExceptionMiddleware(SocialAuthExceptionMiddleware):
def get_message(self, request, exception):
if isinstan... | true | true |
f7341e6c9c32a76959a3fd6e6bbc2c1258099c06 | 69 | py | Python | project/db/serializers/__init__.py | sunday-ucheawaji/API- | 07fb4b596cfe8e85b8575a8e70a8c886d3ab627a | [
"MIT"
] | null | null | null | project/db/serializers/__init__.py | sunday-ucheawaji/API- | 07fb4b596cfe8e85b8575a8e70a8c886d3ab627a | [
"MIT"
] | null | null | null | project/db/serializers/__init__.py | sunday-ucheawaji/API- | 07fb4b596cfe8e85b8575a8e70a8c886d3ab627a | [
"MIT"
] | 1 | 2022-02-09T14:13:20.000Z | 2022-02-09T14:13:20.000Z | from db.serializers.reset_serializer import SetNewPasswordSerializer
| 34.5 | 68 | 0.913043 | from db.serializers.reset_serializer import SetNewPasswordSerializer
| true | true |
f7341eb4083ce663caf7f5d6ce40e424cc5a4bb1 | 1,739 | py | Python | example_BYTES.py | djtech-dev/PyVM | 1edda436ce7073d0cecbf16f5cab2509895d953c | [
"MIT"
] | 75 | 2017-09-22T22:36:13.000Z | 2022-03-20T16:18:27.000Z | example_BYTES.py | djtech-dev/PyVM | 1edda436ce7073d0cecbf16f5cab2509895d953c | [
"MIT"
] | 7 | 2019-05-10T19:15:08.000Z | 2021-08-24T16:03:34.000Z | example_BYTES.py | djtech-dev/PyVM | 1edda436ce7073d0cecbf16f5cab2509895d953c | [
"MIT"
] | 14 | 2018-07-02T02:49:46.000Z | 2022-02-22T15:24:47.000Z | import cProfile, pstats, io
import re
import VM
def Stats(pr):
s = io.StringIO()
sortby = 'tottime'
ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
ps.print_stats()
print(s.getvalue())
def parse_code(code: str) -> bytes:
binary = ''
regex = re.compile(r"[0-9a-f]+:\s+([^;]+)\s*;.*", re... | 30.508772 | 98 | 0.53134 | import cProfile, pstats, io
import re
import VM
def Stats(pr):
s = io.StringIO()
sortby = 'tottime'
ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
ps.print_stats()
print(s.getvalue())
def parse_code(code: str) -> bytes:
binary = ''
regex = re.compile(r"[0-9a-f]+:\s+([^;]+)\s*;.*", re... | true | true |
f7341f359fe9b0fe0253f12df1832305e8d83775 | 7,912 | py | Python | configs/ruby/MESI_Two_Level.py | dai-pch/gem5-tnuca | 621df40b549f8ed56bcf4f5fd7498f1816f19732 | [
"BSD-3-Clause"
] | null | null | null | configs/ruby/MESI_Two_Level.py | dai-pch/gem5-tnuca | 621df40b549f8ed56bcf4f5fd7498f1816f19732 | [
"BSD-3-Clause"
] | null | null | null | configs/ruby/MESI_Two_Level.py | dai-pch/gem5-tnuca | 621df40b549f8ed56bcf4f5fd7498f1816f19732 | [
"BSD-3-Clause"
] | null | null | null | # Copyright (c) 2006-2007 The Regents of The University of Michigan
# Copyright (c) 2009 Advanced Micro Devices, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source co... | 39.959596 | 82 | 0.586704 |
import math
import m5
from m5.objects import *
from m5.defines import buildEnv
from Ruby import create_topology
class L1Cache(RubyCache):
latency = 3
class L2Cache(RubyCache):
latency = 15
def define_options(parser):
return
def create_system(options, system, piobus, dm... | true | true |
f7341f4aa30c9f213243b95b20348a2b5e5e243b | 5,910 | py | Python | torchvision/datasets/hmdb51.py | jdsgomes/vision | c890a7e75ebeaaa75ae9ace4c203b7fc145df068 | [
"BSD-3-Clause"
] | 1 | 2022-02-14T09:16:02.000Z | 2022-02-14T09:16:02.000Z | torchvision/datasets/hmdb51.py | jdsgomes/vision | c890a7e75ebeaaa75ae9ace4c203b7fc145df068 | [
"BSD-3-Clause"
] | null | null | null | torchvision/datasets/hmdb51.py | jdsgomes/vision | c890a7e75ebeaaa75ae9ace4c203b7fc145df068 | [
"BSD-3-Clause"
] | null | null | null | import glob
import os
from typing import Optional, Callable, Tuple, Dict, Any, List
from torch import Tensor
from .folder import find_classes, make_dataset
from .video_utils import VideoClips
from .vision import VisionDataset
class HMDB51(VisionDataset):
"""
`HMDB51 <https://serre-lab.clps.brown.edu/resourc... | 38.881579 | 109 | 0.636717 | import glob
import os
from typing import Optional, Callable, Tuple, Dict, Any, List
from torch import Tensor
from .folder import find_classes, make_dataset
from .video_utils import VideoClips
from .vision import VisionDataset
class HMDB51(VisionDataset):
data_url = "https://serre-lab.clps.brown.edu/wp-content/... | true | true |
f7341f69b66c89836096882d08cd417fb7779aaf | 22 | py | Python | privatebeta/__init__.py | fitoria/django-privatebeta | ef65130d3856d9444f0acc85c5bb590d09908d15 | [
"BSD-3-Clause"
] | 1 | 2015-11-05T13:42:05.000Z | 2015-11-05T13:42:05.000Z | privatebeta/__init__.py | fitoria/django-privatebeta | ef65130d3856d9444f0acc85c5bb590d09908d15 | [
"BSD-3-Clause"
] | null | null | null | privatebeta/__init__.py | fitoria/django-privatebeta | ef65130d3856d9444f0acc85c5bb590d09908d15 | [
"BSD-3-Clause"
] | null | null | null | # Let the wookie pass. | 22 | 22 | 0.727273 | true | true | |
f73420d6dbef227e5c9ccc1aa0c988e245d2f75a | 3,508 | py | Python | tools/metag_tools/blat_wrapper.py | ramezrawas/galaxy-1 | c03748dd49c060a68d07bce56eae33e0ba154414 | [
"CC-BY-3.0"
] | 6 | 2018-11-03T22:43:35.000Z | 2022-02-15T17:51:33.000Z | tools/metag_tools/blat_wrapper.py | ramezrawas/galaxy-1 | c03748dd49c060a68d07bce56eae33e0ba154414 | [
"CC-BY-3.0"
] | 7 | 2016-12-07T22:19:37.000Z | 2019-01-30T15:04:26.000Z | tools/metag_tools/blat_wrapper.py | ramezrawas/galaxy-1 | c03748dd49c060a68d07bce56eae33e0ba154414 | [
"CC-BY-3.0"
] | 10 | 2017-04-10T21:40:22.000Z | 2022-02-21T16:50:10.000Z | #!/usr/bin/env python
import os
import sys
import tempfile
assert sys.version_info[:2] >= (2.4)
def stop_err( msg ):
sys.stderr.write( "%s\n" % msg )
sys.exit()
def check_nib_file( dbkey, GALAXY_DATA_INDEX_DIR ):
nib_file = "%s/alignseq.loc" % GALAXY_DATA_INDEX_DIR
nib_path = ''
nibs = {}
... | 31.321429 | 190 | 0.593216 |
import os
import sys
import tempfile
assert sys.version_info[:2] >= (2.4)
def stop_err( msg ):
sys.stderr.write( "%s\n" % msg )
sys.exit()
def check_nib_file( dbkey, GALAXY_DATA_INDEX_DIR ):
nib_file = "%s/alignseq.loc" % GALAXY_DATA_INDEX_DIR
nib_path = ''
nibs = {}
for i, line in enumer... | true | true |
f7342117dd64c1f7fdf5e9c46d12b689ca81aa84 | 1,459 | py | Python | Create_Dataset.py | mariammendha/Researcher--Reality | 76adf1da1d872133d913b27a3c45d9f0d29ffd98 | [
"CC-BY-3.0"
] | null | null | null | Create_Dataset.py | mariammendha/Researcher--Reality | 76adf1da1d872133d913b27a3c45d9f0d29ffd98 | [
"CC-BY-3.0"
] | null | null | null | Create_Dataset.py | mariammendha/Researcher--Reality | 76adf1da1d872133d913b27a3c45d9f0d29ffd98 | [
"CC-BY-3.0"
] | null | null | null | '''
Take the existing Kc_house_data.csv from MongoDb Atlas, parsing for latitude and longitude
It then pipes this data through the WalkScore Api, generating 3 accessibility scores
These 3 scores are then inserted into their associated rows within MongoDb
WalkScore Api: https://www.walkscore.com/professional/walk-sc... | 33.930233 | 125 | 0.69157 |
def rating(address, latitude, longitude):
from walkscore import WalkScoreAPI
api_key = '<Api Key>'
walkscore_api = WalkScoreAPI(api_key=api_key)
result = walkscore_api.get_score(latitude, longitude, address)
return (result.walk_score, result.transit_score, result.bike_score)
import pym... | true | true |
f7342179f51675003c8d0d6b869111edae0eafb7 | 5,501 | py | Python | examples/tutorial_h4l/3b_score.py | aghoshpub/LikelihoodFreeInterference | fd6267104c29e935fa41dc92004dae98ded30626 | [
"MIT"
] | 1 | 2019-09-18T15:24:25.000Z | 2019-09-18T15:24:25.000Z | examples/tutorial_h4l/3b_score.py | aghoshpub/LikelihoodFreeInterference | fd6267104c29e935fa41dc92004dae98ded30626 | [
"MIT"
] | null | null | null | examples/tutorial_h4l/3b_score.py | aghoshpub/LikelihoodFreeInterference | fd6267104c29e935fa41dc92004dae98ded30626 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# coding: utf-8
# # MadMiner particle physics tutorial
#
# # Part 3b: Training a score estimator
#
# Johann Brehmer, Felix Kling, Irina Espejo, and Kyle Cranmer 2018-2019
# In part 3a of this tutorial we will finally train a neural network to estimate likelihood ratios. We assume that you have... | 33.138554 | 992 | 0.718597 |
als
import logging
import numpy as np
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
# get_ipython().magic(u'matplotlib inline')
from madminer.sampling import SampleAugmenter
from madminer import sampling
from madminer.ml import ScoreEstimator
# In[2]:
# MadMiner output
logging.ba... | true | true |
f73421f38d8e149fb253d1d1beb05fe95e33d4fd | 1,350 | py | Python | cogs/help.py | Tutuviz/yunna-bot | 2e76fa41a5029bd96b8e1c2f01462d73d7deeacd | [
"MIT"
] | null | null | null | cogs/help.py | Tutuviz/yunna-bot | 2e76fa41a5029bd96b8e1c2f01462d73d7deeacd | [
"MIT"
] | null | null | null | cogs/help.py | Tutuviz/yunna-bot | 2e76fa41a5029bd96b8e1c2f01462d73d7deeacd | [
"MIT"
] | null | null | null | import discord
from discord.ext import commands
class Help(commands.Cog):
def __init__(self, bot):
self.bot = bot
# Comands
@commands.command(pass_context=True, aliases=("commands", "cmd"))
async def help(self, ctx):
embed = discord.Embed(title="There are all commands I know", descrip... | 58.695652 | 331 | 0.704444 | import discord
from discord.ext import commands
class Help(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True, aliases=("commands", "cmd"))
async def help(self, ctx):
embed = discord.Embed(title="There are all commands I know", description="Yun... | true | true |
f734223bdceb57e4160f18ca5c8236187d3e0af2 | 1,421 | py | Python | gtfs_converter/scheduler.py | etalab/gtfs_converter | c98866a6fcc5454f8bcb4c329b2f710d28e70356 | [
"MIT"
] | 3 | 2020-07-28T14:20:58.000Z | 2021-01-08T20:55:43.000Z | gtfs_converter/scheduler.py | etalab/gtfs_converter | c98866a6fcc5454f8bcb4c329b2f710d28e70356 | [
"MIT"
] | 4 | 2020-05-04T11:01:08.000Z | 2021-08-06T16:50:16.000Z | gtfs_converter/scheduler.py | etalab/gtfs_converter | c98866a6fcc5454f8bcb4c329b2f710d28e70356 | [
"MIT"
] | 1 | 2020-04-29T16:46:46.000Z | 2020-04-29T16:46:46.000Z | from rq_scheduler.scheduler import Scheduler
import rq
from redis import Redis
import os
import sys
import init_log
import logging
def _run_scheduler():
with rq.Connection(Redis.from_url(os.environ.get("REDIS_URL") or "redis://")):
q = rq.Queue()
scheduler = Scheduler(queue=q)
scheduler.... | 25.375 | 82 | 0.613652 | from rq_scheduler.scheduler import Scheduler
import rq
from redis import Redis
import os
import sys
import init_log
import logging
def _run_scheduler():
with rq.Connection(Redis.from_url(os.environ.get("REDIS_URL") or "redis://")):
q = rq.Queue()
scheduler = Scheduler(queue=q)
scheduler.... | true | true |
f734224e5ccc1a5cc4968643172e56daa96e2640 | 16,537 | py | Python | Graphcore/benchmarks/bert/implementations/popart/pack_pretraining_data.py | jqueguiner/training_results_v1.0 | 8200377f425ae24b6ed6c2816b9273aab0996d43 | [
"Apache-2.0"
] | 27 | 2021-07-01T00:34:52.000Z | 2022-03-29T08:49:53.000Z | Graphcore/benchmarks/bert/implementations/popart/pack_pretraining_data.py | jqueguiner/training_results_v1.0 | 8200377f425ae24b6ed6c2816b9273aab0996d43 | [
"Apache-2.0"
] | 21 | 2021-08-31T08:34:50.000Z | 2022-03-17T11:42:10.000Z | Graphcore/benchmarks/bert/implementations/popart/pack_pretraining_data.py | jqueguiner/training_results_v1.0 | 8200377f425ae24b6ed6c2816b9273aab0996d43 | [
"Apache-2.0"
] | 39 | 2021-07-02T00:46:14.000Z | 2022-03-13T16:59:55.000Z | # Copyright (c) 2020 Graphcore Ltd. 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 l... | 46.847025 | 148 | 0.687549 |
import os
import time
import glob
import struct
import random
import argparse
import numpy as np
import pandas as pd
from scipy import optimize
from itertools import repeat, chain
from functools import lru_cache, reduce
from collections import defaultdict
from matplotlib import pyplot as plt
from concurr... | true | true |
f7342279882a08dd430286cdc06a85f6471afcd1 | 1,098 | py | Python | muller_method/urls.py | mhwahdan/muller-method-Django | ad0f578c0d49add64191b7e4bca74e0bbecfb2b2 | [
"MIT"
] | null | null | null | muller_method/urls.py | mhwahdan/muller-method-Django | ad0f578c0d49add64191b7e4bca74e0bbecfb2b2 | [
"MIT"
] | null | null | null | muller_method/urls.py | mhwahdan/muller-method-Django | ad0f578c0d49add64191b7e4bca74e0bbecfb2b2 | [
"MIT"
] | null | null | null | """muller_method URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class... | 34.3125 | 80 | 0.73224 | from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include
from API import urls as api_urls
from calculator import urls as calculator_urls
urlpatterns = [
path('admin/', admin.site.urls),
path('', include(calculator_urls))... | true | true |
f73424a731778f16d203aec5298efed11c687051 | 10,935 | py | Python | LL_AV/GenerateAVFileReputationPenalties/GenerateAVFileReputationPenalties.py | nkrios/LOCKLEVEL | 0ece6c7ea8b84eced38ef3a89ce2e96a7737234f | [
"CC0-1.0"
] | 46 | 2018-07-12T04:38:43.000Z | 2022-03-20T19:25:11.000Z | LL_AV/GenerateAVFileReputationPenalties/GenerateAVFileReputationPenalties.py | nkrios/LOCKLEVEL | 0ece6c7ea8b84eced38ef3a89ce2e96a7737234f | [
"CC0-1.0"
] | null | null | null | LL_AV/GenerateAVFileReputationPenalties/GenerateAVFileReputationPenalties.py | nkrios/LOCKLEVEL | 0ece6c7ea8b84eced38ef3a89ce2e96a7737234f | [
"CC0-1.0"
] | 17 | 2018-07-04T05:07:08.000Z | 2021-09-15T21:42:18.000Z | """
Generate the penalty XML file used by the antivirus file reputation analyzer.
"""
import argparse
import xml.etree.ElementTree as ET
import xml.dom.minidom
import os
import sys
PENALTIES_ELEMENT = 'penalties'
PENALTY_ELEMENT = 'penalty'
REASON_ELEMENT = 'reason'
REMEDIATION_ELEMENT = 'remediation'
... | 45 | 245 | 0.705167 |
import argparse
import xml.etree.ElementTree as ET
import xml.dom.minidom
import os
import sys
PENALTIES_ELEMENT = 'penalties'
PENALTY_ELEMENT = 'penalty'
REASON_ELEMENT = 'reason'
REMEDIATION_ELEMENT = 'remediation'
ID_ATTRIBUTE = 'id'
NAME_ATTRIBUTE = 'name'
VALUE_ATTRIBUTE = 'value'
class Remed... | true | true |
f73424c6a01e6b3045d0f8b6a981195fd7ef3b08 | 562 | py | Python | accounts/migrations/0017_auto_20150815_1613.py | bharathramh92/easy-ecom | 164f1b6e11559386efef474c5f50d33b4ddea792 | [
"Apache-2.0"
] | null | null | null | accounts/migrations/0017_auto_20150815_1613.py | bharathramh92/easy-ecom | 164f1b6e11559386efef474c5f50d33b4ddea792 | [
"Apache-2.0"
] | null | null | null | accounts/migrations/0017_auto_20150815_1613.py | bharathramh92/easy-ecom | 164f1b6e11559386efef474c5f50d33b4ddea792 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0016_auto_20150814_1727'),
]
operations = [
migrations.RemoveField(
model_name='userextended',
... | 23.416667 | 74 | 0.606762 |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0016_auto_20150814_1727'),
]
operations = [
migrations.RemoveField(
model_name='userextended',
name='profile_pi... | true | true |
f734260e0d34c5734639347af6aabfa594fe3c70 | 4,860 | py | Python | docs/conf.py | harvard-nrg/mano | cbb54337f6fcae8905f1a4ab91f7beeac9ce041c | [
"BSD-3-Clause"
] | 1 | 2019-03-22T18:29:12.000Z | 2019-03-22T18:29:12.000Z | docs/conf.py | harvard-nrg/mano | cbb54337f6fcae8905f1a4ab91f7beeac9ce041c | [
"BSD-3-Clause"
] | 5 | 2019-04-08T20:32:29.000Z | 2022-02-21T21:46:11.000Z | docs/conf.py | harvard-nrg/mano | cbb54337f6fcae8905f1a4ab91f7beeac9ce041c | [
"BSD-3-Clause"
] | 1 | 2018-07-24T06:51:09.000Z | 2018-07-24T06:51:09.000Z | from recommonmark.parser import CommonMarkParser
source_parsers = {
'.md': CommonMarkParser,
}
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-d... | 30 | 79 | 0.657819 | from recommonmark.parser import CommonMarkParser
source_parsers = {
'.md': CommonMarkParser,
}
project = u'mano'
copyright = u'2018, Neuroinformatics Research Group'
author = u'Neuroinformatics Research Group'
version = u''
release = u''
extensions = [
]
templates_path = ['_te... | true | true |
f73426a6d09771817c4ae4bd334dd2b536e8b40a | 1,680 | py | Python | tapioca_nessus/tapioca_nessus.py | siteblindado/tapioca-nessus | b1e7896c5c2ee6d4bce5d3caf97004f2be445c7e | [
"MIT"
] | null | null | null | tapioca_nessus/tapioca_nessus.py | siteblindado/tapioca-nessus | b1e7896c5c2ee6d4bce5d3caf97004f2be445c7e | [
"MIT"
] | null | null | null | tapioca_nessus/tapioca_nessus.py | siteblindado/tapioca-nessus | b1e7896c5c2ee6d4bce5d3caf97004f2be445c7e | [
"MIT"
] | null | null | null | # coding: utf-8
import json
from requests.auth import HTTPBasicAuth
from tapioca import (
TapiocaAdapter, generate_wrapper_from_adapter, JSONAdapterMixin)
from .resource_mapping import RESOURCE_MAPPING
class NessusClientAdapter(JSONAdapterMixin, TapiocaAdapter):
api_root = None
resource_mapping = RESOUR... | 31.111111 | 102 | 0.663095 |
import json
from requests.auth import HTTPBasicAuth
from tapioca import (
TapiocaAdapter, generate_wrapper_from_adapter, JSONAdapterMixin)
from .resource_mapping import RESOURCE_MAPPING
class NessusClientAdapter(JSONAdapterMixin, TapiocaAdapter):
api_root = None
resource_mapping = RESOURCE_MAPPING
... | true | true |
f734280e790810cccc43a5498c22c93115eb39ae | 1,436 | py | Python | tests/xl_methods.py | leobelen/pydatajson | bcc6bbbb9d6554c82a658542522330d8e6337731 | [
"MIT"
] | null | null | null | tests/xl_methods.py | leobelen/pydatajson | bcc6bbbb9d6554c82a658542522330d8e6337731 | [
"MIT"
] | null | null | null | tests/xl_methods.py | leobelen/pydatajson | bcc6bbbb9d6554c82a658542522330d8e6337731 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
xl_methods
Métodos ligeramente modificados a partir de abenassi/xlseries para manipular
archivos en formato XLSX (https://github.com/abenassi/xlseries).
"""
from six import string_types, text_type
def compare_cells(wb1, wb2):
"""Compare two excels based on row it... | 25.192982 | 77 | 0.623955 |
from six import string_types, text_type
def compare_cells(wb1, wb2):
for ws1, ws2 in zip(wb1.worksheets, wb2.worksheets):
compare_cells_ws(ws1, ws2)
return True
def compare_cells_ws(ws1, ws2):
for row1, row2 in zip(ws1.rows, ws2.rows):
for cell1, cell2 in zip(row1, row2):
... | true | true |
f73429aa6bd682cc0f815f80c943f752943a6a16 | 1,904 | py | Python | CNNModel.py | night2wolf/CS490-ML-Lab2 | c25e6a58829939eccc84b54a50f14c7d3b0c8c2f | [
"MIT"
] | null | null | null | CNNModel.py | night2wolf/CS490-ML-Lab2 | c25e6a58829939eccc84b54a50f14c7d3b0c8c2f | [
"MIT"
] | null | null | null | CNNModel.py | night2wolf/CS490-ML-Lab2 | c25e6a58829939eccc84b54a50f14c7d3b0c8c2f | [
"MIT"
] | null | null | null | from keras import models, layers
class CNNModel:
@staticmethod
def generateModel(input):
model = models.Sequential()
model.add(layers.Conv2D(filters=32, kernel_size=(5,5), activation='relu', input_shape=input.shape[1:]))
model.add(layers.MaxPool2D(pool_size=(2, 2)))
model.add(la... | 48.820513 | 111 | 0.661765 | from keras import models, layers
class CNNModel:
@staticmethod
def generateModel(input):
model = models.Sequential()
model.add(layers.Conv2D(filters=32, kernel_size=(5,5), activation='relu', input_shape=input.shape[1:]))
model.add(layers.MaxPool2D(pool_size=(2, 2)))
model.add(la... | true | true |
f73429bdedfeb716fa240ffa82ccccfd74287e74 | 375 | py | Python | python/numpy/weldnumpy/__init__.py | hvanhovell/weld | 0d9e55c71f2a4e0040cb0687d3eb53f54ec4ba94 | [
"BSD-3-Clause"
] | null | null | null | python/numpy/weldnumpy/__init__.py | hvanhovell/weld | 0d9e55c71f2a4e0040cb0687d3eb53f54ec4ba94 | [
"BSD-3-Clause"
] | null | null | null | python/numpy/weldnumpy/__init__.py | hvanhovell/weld | 0d9e55c71f2a4e0040cb0687d3eb53f54ec4ba94 | [
"BSD-3-Clause"
] | null | null | null | from weldarray import *
from weldnumpy import *
# FIXME: Should this be in weldnump? pytest gives errors when trying to import
# weldarray in weldnumpy...so keeping it here for now.
def array(arr, *args, **kwargs):
'''
Wrapper around weldarray - first create np.array and then convert to
weldarray.
'''... | 26.785714 | 78 | 0.698667 | from weldarray import *
from weldnumpy import *
def array(arr, *args, **kwargs):
return weldarray(np.array(arr, *args, **kwargs))
| true | true |
f73429e8b78185619483984f8453f70ac968279b | 752 | py | Python | galaxy/main/migrations/0015_auto_20150917_1504.py | maxamillion/galaxy | 0460baf9d2c8da0a0e88c7975eca2e3abcc82f23 | [
"Apache-2.0"
] | 1 | 2017-06-18T21:46:01.000Z | 2017-06-18T21:46:01.000Z | galaxy/main/migrations/0015_auto_20150917_1504.py | maxamillion/galaxy | 0460baf9d2c8da0a0e88c7975eca2e3abcc82f23 | [
"Apache-2.0"
] | 1 | 2021-06-10T23:59:59.000Z | 2021-06-10T23:59:59.000Z | galaxy/main/migrations/0015_auto_20150917_1504.py | connectthefuture/galaxy | 841821957680643e07c1a94fb609f8e4117c19d1 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('main', '0014_auto_20150917_1211'),
]
operations = [
migrations.AlterField(
model_name='role',
name='... | 30.08 | 159 | 0.625 |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('main', '0014_auto_20150917_1211'),
]
operations = [
migrations.AlterField(
model_name='role',
name='categories',
... | true | true |
f7342a7e37fa9c6d1e46a7d7b16847841d76e379 | 1,002 | py | Python | setup.py | virink/flask_waf | 9a0cfafb988c2bf043570e0877b1c3e43881affb | [
"BSD-3-Clause"
] | 10 | 2018-09-29T01:42:01.000Z | 2020-09-06T17:39:39.000Z | setup.py | virink/flask_waf | 9a0cfafb988c2bf043570e0877b1c3e43881affb | [
"BSD-3-Clause"
] | 1 | 2018-09-29T02:41:01.000Z | 2018-09-29T14:35:31.000Z | setup.py | virink/flask_waf | 9a0cfafb988c2bf043570e0877b1c3e43881affb | [
"BSD-3-Clause"
] | 1 | 2019-08-27T17:04:39.000Z | 2019-08-27T17:04:39.000Z | # -*- coding: utf-8 -*-
"""
Flask-Waf
---------
Adds server Waf support to your application.
:copyright: (c) 2018 by Virink
:license: BSD, see LICENSE for more details.
"""
from setuptools import setup
setup(
name='Flask-Waf',
version='1.0',
url='https://github.com/virink/flask_waf',... | 25.05 | 70 | 0.605788 |
from setuptools import setup
setup(
name='Flask-Waf',
version='1.0',
url='https://github.com/virink/flask_waf',
license='BSD',
author='Virink',
author_email='virink@outlook.com',
description='Just a webwaf for log',
long_description=__doc__,
packages=['flask_waf'],
zip_safe=Fa... | true | true |
f7342b52669ad7a60e120c7f62bc0adfaa142f7f | 360 | py | Python | configs/pspnet/pspnet_r50-d8_769x769_40k_cityscapes.py | vietawake/mmSegmentation | 1f643d6d81708ebf5726c48f66d02c70fe99fe00 | [
"Apache-2.0"
] | null | null | null | configs/pspnet/pspnet_r50-d8_769x769_40k_cityscapes.py | vietawake/mmSegmentation | 1f643d6d81708ebf5726c48f66d02c70fe99fe00 | [
"Apache-2.0"
] | null | null | null | configs/pspnet/pspnet_r50-d8_769x769_40k_cityscapes.py | vietawake/mmSegmentation | 1f643d6d81708ebf5726c48f66d02c70fe99fe00 | [
"Apache-2.0"
] | null | null | null | _base_ = [
'../_base_/models/pspnet_r50-d8.py',
'../_base_/datasets/cityscapes_769x769.py', '../_base_/default_runtime.py',
'../_base_/schedules/schedule_40k.py'
]
model = dict(
decode_head=dict(align_corners=True),
auxiliary_head=dict(align_corners=True),
test_cfg=dict(mode='slide', cro... | 36 | 80 | 0.672222 | _base_ = [
'../_base_/models/pspnet_r50-d8.py',
'../_base_/datasets/cityscapes_769x769.py', '../_base_/default_runtime.py',
'../_base_/schedules/schedule_40k.py'
]
model = dict(
decode_head=dict(align_corners=True),
auxiliary_head=dict(align_corners=True),
test_cfg=dict(mode='slide', cro... | true | true |
f7342bb4b595c8de89773e3d4fa123515307cda0 | 3,384 | py | Python | examples/interface/LPAffineDense.py | pjt1988/Elemental | 71d3e2b98829594e9f52980a8b1ef7c1e99c724b | [
"Apache-2.0"
] | 473 | 2015-01-11T03:22:11.000Z | 2022-03-31T05:28:39.000Z | examples/interface/LPAffineDense.py | pjt1988/Elemental | 71d3e2b98829594e9f52980a8b1ef7c1e99c724b | [
"Apache-2.0"
] | 205 | 2015-01-10T20:33:45.000Z | 2021-07-25T14:53:25.000Z | examples/interface/LPAffineDense.py | pjt1988/Elemental | 71d3e2b98829594e9f52980a8b1ef7c1e99c724b | [
"Apache-2.0"
] | 109 | 2015-02-16T14:06:42.000Z | 2022-03-23T21:34:26.000Z | #
# Copyright (c) 2009-2016, Jack Poulson
# All rights reserved.
#
# This file is part of Elemental and is under the BSD 2-Clause License,
# which can be found in the LICENSE file in the root directory, or at
# http://opensource.org/licenses/BSD-2-Clause
#
import El
m = 500
n = 1000
k = 750
testMehrotra = True
... | 25.066667 | 73 | 0.610225 |
import El
m = 500
n = 1000
k = 750
testMehrotra = True
testIPF = False
manualInit = False
display = False
progress = True
worldRank = El.mpi.WorldRank()
worldSize = El.mpi.WorldSize()
def RectangDense(height,width):
A = El.DistMatrix()
El.Gaussian( A, height, width )
return A
A = RectangDense(m,n)
G =... | true | true |
f7342c6447aca358d841aafe7988c715fb43c139 | 291,590 | py | Python | SprityBird/spritybird/python3.5/lib/python3.5/site-packages/plotly/tools.py | MobileAnalytics/iPython-Framework | da0e598308c067cd5c5290a6364b3ffaf2d2418f | [
"MIT"
] | 4 | 2018-07-04T17:20:12.000Z | 2019-07-14T18:07:25.000Z | SprityBird/spritybird/python3.5/lib/python3.5/site-packages/plotly/tools.py | MobileAnalytics/iPython-Framework | da0e598308c067cd5c5290a6364b3ffaf2d2418f | [
"MIT"
] | null | null | null | SprityBird/spritybird/python3.5/lib/python3.5/site-packages/plotly/tools.py | MobileAnalytics/iPython-Framework | da0e598308c067cd5c5290a6364b3ffaf2d2418f | [
"MIT"
] | 1 | 2018-09-03T03:02:06.000Z | 2018-09-03T03:02:06.000Z | # -*- coding: utf-8 -*-
"""
tools
=====
Functions that USERS will possibly want access to.
"""
from __future__ import absolute_import
from collections import OrderedDict
import warnings
import six
import math
import decimal
from plotly import utils
from plotly import exceptions
from plotly import graph_reference
... | 39.181672 | 134 | 0.510714 |
from __future__ import absolute_import
from collections import OrderedDict
import warnings
import six
import math
import decimal
from plotly import utils
from plotly import exceptions
from plotly import graph_reference
from plotly import session
from plotly.files import (CONFIG_FILE, CREDENTIALS_FILE, FILE_CONTENT... | true | true |
f7342d5a9f5798569cd6e83dadbc84ca8f4c2ab8 | 520 | py | Python | pkgs/sdk-pkg/src/genie/libs/sdk/apis/iosxr/lldp/configure.py | jbronikowski/genielibs | 200a34e5fe4838a27b5a80d5973651b2e34ccafb | [
"Apache-2.0"
] | 94 | 2018-04-30T20:29:15.000Z | 2022-03-29T13:40:31.000Z | pkgs/sdk-pkg/src/genie/libs/sdk/apis/iosxr/lldp/configure.py | jbronikowski/genielibs | 200a34e5fe4838a27b5a80d5973651b2e34ccafb | [
"Apache-2.0"
] | 67 | 2018-12-06T21:08:09.000Z | 2022-03-29T18:00:46.000Z | pkgs/sdk-pkg/src/genie/libs/sdk/apis/iosxr/lldp/configure.py | jbronikowski/genielibs | 200a34e5fe4838a27b5a80d5973651b2e34ccafb | [
"Apache-2.0"
] | 49 | 2018-06-29T18:59:03.000Z | 2022-03-10T02:07:59.000Z | """Common configure functions for lldp"""
# Python
import logging
log = logging.getLogger(__name__)
def configure_lldp(device):
""" Enables lldp on target device
Args:
device ('obj'): Device object
Returns:
None
"""
device.configure(['lldp'])
def u... | 21.666667 | 42 | 0.553846 |
import logging
log = logging.getLogger(__name__)
def configure_lldp(device):
device.configure(['lldp'])
def unconfigure_lldp(device):
device.configure('no lldp') | true | true |
f7342dc10025238831db10191fe54509c36df5ef | 1,757 | py | Python | github_poster/loader/duolingo_loader.py | phh95/GitHubPoster | 6bb0eb4cce8f60b9b25a0ae813601dcc13b32f66 | [
"MIT"
] | null | null | null | github_poster/loader/duolingo_loader.py | phh95/GitHubPoster | 6bb0eb4cce8f60b9b25a0ae813601dcc13b32f66 | [
"MIT"
] | null | null | null | github_poster/loader/duolingo_loader.py | phh95/GitHubPoster | 6bb0eb4cce8f60b9b25a0ae813601dcc13b32f66 | [
"MIT"
] | null | null | null | import pendulum
import requests
from github_poster.loader.base_loader import BaseLoader
from github_poster.loader.config import DUOLINGO_CALENDAR_API
class DuolingoLoader(BaseLoader):
unit = "XP"
def __init__(self, from_year, to_year, **kwargs):
super().__init__(from_year, to_year)
self.user... | 30.293103 | 74 | 0.569152 | import pendulum
import requests
from github_poster.loader.base_loader import BaseLoader
from github_poster.loader.config import DUOLINGO_CALENDAR_API
class DuolingoLoader(BaseLoader):
unit = "XP"
def __init__(self, from_year, to_year, **kwargs):
super().__init__(from_year, to_year)
self.user... | true | true |
f7342f4e225e7f068f707b4f2ec284cf601056e1 | 26,885 | py | Python | lib/services/vserver/ncloud_vserver/model/server_instance.py | NaverCloudPlatform/ncloud-sdk-python | 5976dfabd205c615fcf57ac2f0ab67313ee6953c | [
"MIT"
] | 12 | 2018-11-20T04:30:49.000Z | 2021-11-09T12:34:26.000Z | lib/services/vserver/ncloud_vserver/model/server_instance.py | NaverCloudPlatform/ncloud-sdk-python | 5976dfabd205c615fcf57ac2f0ab67313ee6953c | [
"MIT"
] | 1 | 2019-01-24T15:56:15.000Z | 2019-05-31T07:56:55.000Z | lib/services/vserver/ncloud_vserver/model/server_instance.py | NaverCloudPlatform/ncloud-sdk-python | 5976dfabd205c615fcf57ac2f0ab67313ee6953c | [
"MIT"
] | 6 | 2018-06-29T03:45:50.000Z | 2022-03-18T01:51:45.000Z | # coding: utf-8
"""
vserver
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from ncloud_vserver.model.common_code import CommonCode # noqa: F401,E501
class ServerInstance(object):
"""NOTE: This class is auto generated by the... | 31.929929 | 689 | 0.650921 |
import pprint
import re
import six
from ncloud_vserver.model.common_code import CommonCode
class ServerInstance(object):
swagger_types = {
'server_instance_no': 'str',
'server_name': 'str',
'server_description': 'str',
'cpu_count': 'int',
'memory_size': 'int',
... | true | true |
f73430eb46e3d4244ec8ada9522ec81546a1cbb7 | 18,521 | py | Python | tensorflow_text/python/ops/sentencepiece_tokenizer_test.py | vbod/text | 07c044b8b851ace1e9a033c9597cdb1bee2d69e0 | [
"Apache-2.0"
] | null | null | null | tensorflow_text/python/ops/sentencepiece_tokenizer_test.py | vbod/text | 07c044b8b851ace1e9a033c9597cdb1bee2d69e0 | [
"Apache-2.0"
] | null | null | null | tensorflow_text/python/ops/sentencepiece_tokenizer_test.py | vbod/text | 07c044b8b851ace1e9a033c9597cdb1bee2d69e0 | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# Copyright 2020 TF.Text 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 ag... | 41.157778 | 85 | 0.606933 |
import sys
import tempfile
from absl.testing import parameterized
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.eager import context
from tensorflow.python.eager import def_function
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dt... | true | true |
f7343149bcb9f8ac184634f891b354142315a99b | 1,318 | py | Python | projectile.py | jmkinder1/code-samples | 9c6cd3c6f16579a6c1f5210779b8ec6ad53fbdba | [
"BSD-3-Clause"
] | 5 | 2021-07-17T05:19:00.000Z | 2022-01-05T05:39:50.000Z | projectile.py | jmkinder1/code-samples | 9c6cd3c6f16579a6c1f5210779b8ec6ad53fbdba | [
"BSD-3-Clause"
] | null | null | null | projectile.py | jmkinder1/code-samples | 9c6cd3c6f16579a6c1f5210779b8ec6ad53fbdba | [
"BSD-3-Clause"
] | 8 | 2020-12-26T23:41:27.000Z | 2022-02-24T22:18:41.000Z | # projectile.py
# -----------------------------------------------------------------------------
# Calculate how long an object is in the air when thrown from a specified height
# with a range of initial speeds assuming constant acceleration due to gravity:
# 0.5 * g * t**2 - v0 * t - y0 = 0
# -------------------------... | 48.814815 | 87 | 0.636571 |
import numpy as np
initial_speed = 0.0
impact_time = 0.0
g = 9.8066
initial_height = 2.0
speed_increment = 5.0
cutoff_time = 10.0
while impact_time < cutoff_time:
impact_time = (np.sqrt(initial_speed**2 + 2 * g * initial_height) + initial_speed) / g
print("speed= {} m/s; time= {:.1f} ... | true | true |
f73431baeb0c90da847b750fe45e3a856b6a9533 | 3,748 | py | Python | model/functional.py | yil8/GPN | e0ccba70db6f1d3264f8d3dd38fc4c62bcebd7ad | [
"Apache-2.0"
] | 16 | 2019-03-01T17:52:52.000Z | 2021-12-31T09:39:01.000Z | model/functional.py | xiamenwcy/GPN | e0ccba70db6f1d3264f8d3dd38fc4c62bcebd7ad | [
"Apache-2.0"
] | 1 | 2021-05-12T11:24:05.000Z | 2021-05-12T17:44:46.000Z | model/functional.py | xiamenwcy/GPN | e0ccba70db6f1d3264f8d3dd38fc4c62bcebd7ad | [
"Apache-2.0"
] | 5 | 2019-04-02T03:42:02.000Z | 2020-08-01T20:40:15.000Z | import torch
import torch.nn.functional as F
import numpy as np
# Original author: Francisco Massa:
# https://github.com/fmassa/object-detection.torch
# Ported to PyTorch by Max deGroot (02/01/2017)
def nms(boxes, scores, overlap=0.7):
"""Apply non-maximum suppression at test time to avoid detecting too many
... | 33.168142 | 79 | 0.602721 | import torch
import torch.nn.functional as F
import numpy as np
def nms(boxes, scores, overlap=0.7):
keep = scores.new(scores.size(0)).zero_().long()
if boxes.numel() == 0:
return keep
x1 = boxes[:, 0]
y1 = boxes[:, 1]
x2 = boxes[:, 2]
y2 = boxes[:, 3]
area = torch.mul(x2 - x1,... | true | true |
f734325c72b04acb108ec2de3b0506cfa207023f | 62,690 | py | Python | tests/nat/nat_helpers.py | stephengao-ragilenetworks/sonic-mgmt | b7ce8f6592f12ee8a7a0daca9a4337d5eaf9313f | [
"Apache-2.0"
] | 1 | 2020-10-15T05:52:17.000Z | 2020-10-15T05:52:17.000Z | tests/nat/nat_helpers.py | stephengao-ragilenetworks/sonic-mgmt | b7ce8f6592f12ee8a7a0daca9a4337d5eaf9313f | [
"Apache-2.0"
] | 4 | 2019-07-26T08:42:01.000Z | 2020-12-16T08:34:52.000Z | tests/nat/nat_helpers.py | stephengao-ragilenetworks/sonic-mgmt | b7ce8f6592f12ee8a7a0daca9a4337d5eaf9313f | [
"Apache-2.0"
] | null | null | null | import re
import os
import time
import logging
import json
from collections import namedtuple
import ptf.mask as mask
import ptf.packet as packet
import ptf.testutils as testutils
from tests.common.errors import RunAnsibleModuleFail
from tests.common.helpers.assertions import pytest_assert
from jinja2 import Environme... | 47.348943 | 161 | 0.627628 | import re
import os
import time
import logging
import json
from collections import namedtuple
import ptf.mask as mask
import ptf.packet as packet
import ptf.testutils as testutils
from tests.common.errors import RunAnsibleModuleFail
from tests.common.helpers.assertions import pytest_assert
from jinja2 import Environme... | true | true |
f73432ee58b79c9c931bae7337e94822d4ebdfa3 | 876 | py | Python | company/migrations/0024_auto_20161220_1751.py | uktrade/directory-api | 45a9024a7ecc2842895201cbb51420ba9e57a168 | [
"MIT"
] | 2 | 2017-06-02T09:09:08.000Z | 2021-01-18T10:26:53.000Z | company/migrations/0024_auto_20161220_1751.py | konradko/directory-api | e9cd05b1deaf575e94352c46ddbd1857d8119fda | [
"MIT"
] | 629 | 2016-10-10T09:35:52.000Z | 2022-03-25T15:04:04.000Z | company/migrations/0024_auto_20161220_1751.py | konradko/directory-api | e9cd05b1deaf575e94352c46ddbd1857d8119fda | [
"MIT"
] | 5 | 2017-06-22T10:02:22.000Z | 2022-03-14T17:55:21.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.9.10 on 2016-12-20 17:51
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('company', '0023_auto_20161219_1730'),
]
operations = [
migrations.AddField(... | 28.258065 | 85 | 0.593607 |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('company', '0023_auto_20161219_1730'),
]
operations = [
migrations.AddField(
model_name='company',
name='facebook_url',
... | true | true |
f734331cbfdb47aab2dbbef75b0eeb01f8ce15b8 | 413 | py | Python | seedstars_contacts/wsgi.py | ruidacosta/seedstars-contacts | 6b39cf0c688adc3fbc5d032ee30e3271588c6ec3 | [
"MIT"
] | null | null | null | seedstars_contacts/wsgi.py | ruidacosta/seedstars-contacts | 6b39cf0c688adc3fbc5d032ee30e3271588c6ec3 | [
"MIT"
] | null | null | null | seedstars_contacts/wsgi.py | ruidacosta/seedstars-contacts | 6b39cf0c688adc3fbc5d032ee30e3271588c6ec3 | [
"MIT"
] | null | null | null | """
WSGI config for seedstars_contacts project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("D... | 24.294118 | 78 | 0.79661 |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "seedstars_contacts.settings")
application = get_wsgi_application()
| true | true |
f73435251244e0ae957d0fc4c9b83da5333bdf6a | 16,707 | py | Python | hphp/hack/test/hh_codesynthesis/codesynthesis_test.py | jjergus/hhvm | 7f94d3da259c9443792327e0a61af1a6778d53b9 | [
"PHP-3.01",
"Zend-2.0"
] | null | null | null | hphp/hack/test/hh_codesynthesis/codesynthesis_test.py | jjergus/hhvm | 7f94d3da259c9443792327e0a61af1a6778d53b9 | [
"PHP-3.01",
"Zend-2.0"
] | null | null | null | hphp/hack/test/hh_codesynthesis/codesynthesis_test.py | jjergus/hhvm | 7f94d3da259c9443792327e0a61af1a6778d53b9 | [
"PHP-3.01",
"Zend-2.0"
] | null | null | null | #!/usr/bin/env python3
# pyre-strict
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the "hack" directory of this source tree.
import tempfile
import unittest
from hphp.hack.src.hh_codesynthesis import hh_codesynthesis, hackGenera... | 32.440777 | 133 | 0.553481 |
import tempfile
import unittest
from hphp.hack.src.hh_codesynthesis import hh_codesynthesis, hackGenerator
from hphp.hack.src.hh_codesynthesis.hh_codesynthesis import ClingoContext
class GenerateLogicRulesTest(unittest.TestCase):
def test_depth_less_than_nodes(self) -> None:
ClingoContext.number_of... | true | true |
f734353463d9f084656926c5976d0185d41c41a7 | 7,041 | py | Python | container_service_extension/lib/pksclient/api/usage_api.py | arunmk/container-service-extension | 5e67df64fd5ed7fbb664d449356cb983cecbca12 | [
"BSD-3-Clause"
] | 81 | 2017-07-05T19:42:41.000Z | 2022-03-09T22:04:05.000Z | container_service_extension/lib/pksclient/api/usage_api.py | arunmk/container-service-extension | 5e67df64fd5ed7fbb664d449356cb983cecbca12 | [
"BSD-3-Clause"
] | 670 | 2017-07-05T16:48:02.000Z | 2022-03-31T13:40:53.000Z | container_service_extension/lib/pksclient/api/usage_api.py | arunmk/container-service-extension | 5e67df64fd5ed7fbb664d449356cb983cecbca12 | [
"BSD-3-Clause"
] | 64 | 2017-07-05T16:32:55.000Z | 2022-03-23T09:36:03.000Z | # coding: utf-8
"""
PKS
PKS API # noqa: E501
OpenAPI spec version: 1.1.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
# python 2 and python 3 compatibility library
import six
from container_service_extension.lib.pksclient.api_cl... | 33.369668 | 109 | 0.592814 |
from __future__ import absolute_import
import six
from container_service_extension.lib.pksclient.api_client import ApiClient
class UsageApi(object):
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def get_us... | true | true |
f73437decdc2b3be3f553e9d269d83a639111390 | 3,340 | py | Python | pogom/pgoapi/protos/POGOProtos/Inventory/InventoryDelta_pb2.py | tier4fusion/pogom-updated | 31c4db3dfc85b19abb39c2e43f5efa530c65159e | [
"MIT"
] | 2,557 | 2016-07-19T22:20:45.000Z | 2022-01-25T10:53:35.000Z | pogom/pgoapi/protos/POGOProtos/Inventory/InventoryDelta_pb2.py | tier4fusion/pogom-updated | 31c4db3dfc85b19abb39c2e43f5efa530c65159e | [
"MIT"
] | 1,360 | 2016-07-20T02:06:42.000Z | 2021-07-27T12:46:40.000Z | pogom/pgoapi/protos/POGOProtos/Inventory/InventoryDelta_pb2.py | tier4fusion/pogom-updated | 31c4db3dfc85b19abb39c2e43f5efa530c65159e | [
"MIT"
] | 607 | 2016-07-20T03:34:04.000Z | 2022-01-05T14:57:09.000Z | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: POGOProtos/Inventory/InventoryDelta.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf... | 38.390805 | 365 | 0.78503 |
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google... | true | true |
f73439a039a68664196ccfefac524b885ff036d1 | 1,663 | py | Python | accelerator/examples/printer.py | eBay/accelerator | 218d9a5e4451ac72b9e65df6c5b32e37d25136c8 | [
"Apache-2.0"
] | 143 | 2018-04-20T18:50:41.000Z | 2022-02-06T07:07:35.000Z | accelerator/examples/printer.py | exaxorg/accelerator | d6132f215585b98d2ad14c5d74d2c937fbd940e2 | [
"Apache-2.0"
] | null | null | null | accelerator/examples/printer.py | exaxorg/accelerator | d6132f215585b98d2ad14c5d74d2c937fbd940e2 | [
"Apache-2.0"
] | 29 | 2018-04-20T18:50:43.000Z | 2021-04-27T18:42:23.000Z | # This isn't intended as an example, it's just here to simplify all the
# output formating the examples do.
from accelerator import colour
class Printer:
def __init__(self, indent=0):
self._indent = indent
self._last_indent = 0
self._unindent = []
def _prefix(self, txt):
for c in txt:
if not c.isspace()... | 24.455882 | 90 | 0.659651 |
from accelerator import colour
class Printer:
def __init__(self, indent=0):
self._indent = indent
self._last_indent = 0
self._unindent = []
def _prefix(self, txt):
for c in txt:
if not c.isspace():
break
yield c
yield None
def _print(self, a, indent, *attrs):
txt = ' '.join(str(v) for v i... | true | true |
f7343a622d7f533789cc7b05b9b75120bde054ca | 76,341 | py | Python | fluids/compressible.py | celikten/fluids | acfd9a06acef18817693f6296aadf8d1c7cabee4 | [
"MIT"
] | 218 | 2016-01-04T07:44:46.000Z | 2022-03-30T08:06:36.000Z | fluids/compressible.py | celikten/fluids | acfd9a06acef18817693f6296aadf8d1c7cabee4 | [
"MIT"
] | 47 | 2016-04-20T06:06:10.000Z | 2022-03-04T14:45:39.000Z | fluids/compressible.py | celikten/fluids | acfd9a06acef18817693f6296aadf8d1c7cabee4 | [
"MIT"
] | 65 | 2016-01-29T03:28:01.000Z | 2022-01-26T16:17:05.000Z | # -*- coding: utf-8 -*-
"""Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2016, 2017, 2018, 2019, 2020 Caleb Bell <Caleb.Andrew.Bell@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (t... | 39.270062 | 198 | 0.62564 |
from __future__ import division
from math import sqrt, log, pi, exp, isinf
from fluids.constants import R
from fluids.numerics import secant, newton, ridder, lambertw
__all__ = ['Panhandle_A', 'Panhandle_B', 'Weymouth', 'Spitzglass_high',
'Spitzglass_low', 'Oliphant', 'Fritzsche', 'Muller', 'IGT', 'isothe... | true | true |
f7343c31f576b59257d7b79941143a08aa3e5c0d | 7,758 | py | Python | code/supporting_functions.py | AhmedElshaarany/RoboND-Rover-Project | 9dad356d4585bb567ee436062afdd82d9d7eb4de | [
"MIT"
] | null | null | null | code/supporting_functions.py | AhmedElshaarany/RoboND-Rover-Project | 9dad356d4585bb567ee436062afdd82d9d7eb4de | [
"MIT"
] | null | null | null | code/supporting_functions.py | AhmedElshaarany/RoboND-Rover-Project | 9dad356d4585bb567ee436062afdd82d9d7eb4de | [
"MIT"
] | null | null | null | import numpy as np
import cv2
from PIL import Image
from io import BytesIO, StringIO
import base64
import time
# Define a function to convert telemetry strings to float independent of decimal convention
def convert_to_float(string_to_convert):
if ',' in string_to_convert:
float_value = np.float(strin... | 48.792453 | 107 | 0.62645 | import numpy as np
import cv2
from PIL import Image
from io import BytesIO, StringIO
import base64
import time
def convert_to_float(string_to_convert):
if ',' in string_to_convert:
float_value = np.float(string_to_convert.replace(',','.'))
else:
float_value = np.float(string_to_co... | true | true |
f7343d001b8ca38d7c2dca8af4bbbaa19f18099d | 12,159 | py | Python | Training/pytorch/train.py | QinchengZhang/PathologySegmentation | 7a2c21346739a79c33e7a7ccc081018821868eb7 | [
"MIT"
] | 3 | 2020-10-25T06:18:21.000Z | 2021-12-23T01:42:56.000Z | Training/pytorch/train.py | QinchengZhang/PathologySegmentation | 7a2c21346739a79c33e7a7ccc081018821868eb7 | [
"MIT"
] | null | null | null | Training/pytorch/train.py | QinchengZhang/PathologySegmentation | 7a2c21346739a79c33e7a7ccc081018821868eb7 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
'''
Author: TJUZQC
Date: 2020-10-26 10:26:51
LastEditors: TJUZQC
LastEditTime: 2020-11-20 19:23:55
Description: None
'''
import argparse
import logging
import os
import sys
import numpy as np
import torch
import torch.nn as nn
import yaml
from torch import optim
from torch.utils.data import Dat... | 41.640411 | 109 | 0.555062 |
import argparse
import logging
import os
import sys
import numpy as np
import torch
import torch.nn as nn
import yaml
from torch import optim
from torch.utils.data import DataLoader, random_split
from torch.utils.tensorboard import SummaryWriter
from tqdm import tqdm
from evaluation import eval_net
from models impor... | true | true |
f7343d1941a5745d36121531142f0fb145e90236 | 1,464 | py | Python | mr_database/databaseconnection.py | SorenSeeberg/MrDatabase | 07d39c1f227d9ceaffe7e409f0915776901dd3e9 | [
"MIT"
] | null | null | null | mr_database/databaseconnection.py | SorenSeeberg/MrDatabase | 07d39c1f227d9ceaffe7e409f0915776901dd3e9 | [
"MIT"
] | 1 | 2018-05-28T11:55:49.000Z | 2018-06-11T16:51:45.000Z | mr_database/databaseconnection.py | SorenSeeberg/MrDatabase | 07d39c1f227d9ceaffe7e409f0915776901dd3e9 | [
"MIT"
] | null | null | null | import sqlite3 as sqlite
class ConType:
query = 0
mutation = 1
batch = 2
class DatabaseConnection:
is_batching = False
def __init__(self, database_object: 'MrDatabase', con_type: int=ConType.mutation):
self.database_object = database_object
self.con_type: int = con_type
... | 24.4 | 86 | 0.605874 | import sqlite3 as sqlite
class ConType:
query = 0
mutation = 1
batch = 2
class DatabaseConnection:
is_batching = False
def __init__(self, database_object: 'MrDatabase', con_type: int=ConType.mutation):
self.database_object = database_object
self.con_type: int = con_type
... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.