hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 417k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 1
class | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f70f6c2e837dc663e4225ba197c388dee678dd48 | 624 | py | Python | Algorithms/0091_Decode_Ways/Python/Decode_Ways_Solution_1.py | lht19900714/Leetcode_Solutions | dac7a038329a5c1f8a78e86cc6f49116b963f1fb | [
"MIT"
] | null | null | null | Algorithms/0091_Decode_Ways/Python/Decode_Ways_Solution_1.py | lht19900714/Leetcode_Solutions | dac7a038329a5c1f8a78e86cc6f49116b963f1fb | [
"MIT"
] | null | null | null | Algorithms/0091_Decode_Ways/Python/Decode_Ways_Solution_1.py | lht19900714/Leetcode_Solutions | dac7a038329a5c1f8a78e86cc6f49116b963f1fb | [
"MIT"
] | null | null | null |
# Space: O(n)
# Time: O(n)
class Solution:
def numDecodings(self, s: str) -> int:
if len(s) == 0: return 0
self.cache = {}
self.cache[''] = 1
def recursive(string):
if string in self.cache: return self.cache[string]
if string[0] == '0': return 0
... | 19.5 | 62 | 0.491987 |
class Solution:
def numDecodings(self, s: str) -> int:
if len(s) == 0: return 0
self.cache = {}
self.cache[''] = 1
def recursive(string):
if string in self.cache: return self.cache[string]
if string[0] == '0': return 0
if len(string) == 1: ret... | true | true |
f70f6d36aba38dbe1415ec7683f3960500689480 | 968 | py | Python | tempest/api/compute/security_groups/base.py | KiranPawar72/tempest | 1fef3dd92b083055793065dd0693454735ec2c01 | [
"Apache-2.0"
] | 3 | 2016-07-15T12:27:23.000Z | 2021-04-23T04:41:10.000Z | tempest/api/compute/security_groups/base.py | LIS/lis-tempest | 8e6403b2d6de81c5d18ed867b4977385c8278b75 | [
"Apache-2.0"
] | null | null | null | tempest/api/compute/security_groups/base.py | LIS/lis-tempest | 8e6403b2d6de81c5d18ed867b4977385c8278b75 | [
"Apache-2.0"
] | 12 | 2016-07-14T18:13:05.000Z | 2017-07-08T18:45:42.000Z | # Copyright 2012 OpenStack Foundation
# 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 requ... | 37.230769 | 78 | 0.737603 |
from tempest.api.compute import base
class BaseSecurityGroupsTest(base.BaseV2ComputeTest):
@classmethod
def setup_credentials(cls):
cls.set_network_resources(network=True, subnet=True)
super(BaseSecurityGroupsTest, cls).setup_credentials()
| true | true |
f70f6ea82999764663604c0defd9f8fd956a3e54 | 43 | py | Python | embedvideos/__init__.py | vkaracic/EmbedVideosXBlock | e0cd04b41d655d8e8e69c6c9c4c0a41c22600965 | [
"MIT"
] | null | null | null | embedvideos/__init__.py | vkaracic/EmbedVideosXBlock | e0cd04b41d655d8e8e69c6c9c4c0a41c22600965 | [
"MIT"
] | null | null | null | embedvideos/__init__.py | vkaracic/EmbedVideosXBlock | e0cd04b41d655d8e8e69c6c9c4c0a41c22600965 | [
"MIT"
] | null | null | null | from .embedvideos import EmbedVideosXBlock
| 21.5 | 42 | 0.883721 | from .embedvideos import EmbedVideosXBlock
| true | true |
f70f70495df42bcff3545d60f74aba312be6b44a | 228 | py | Python | vininfo/__init__.py | ghilesmeddour/vininfo | 63cbf7dcdd9d106fb9c9a56d5c4f11c3dd794b1d | [
"BSD-3-Clause"
] | 60 | 2018-07-28T14:53:57.000Z | 2022-02-22T12:11:24.000Z | vininfo/__init__.py | ghilesmeddour/vininfo | 63cbf7dcdd9d106fb9c9a56d5c4f11c3dd794b1d | [
"BSD-3-Clause"
] | 16 | 2018-07-30T08:57:08.000Z | 2021-12-25T09:20:03.000Z | vininfo/__init__.py | ghilesmeddour/vininfo | 63cbf7dcdd9d106fb9c9a56d5c4f11c3dd794b1d | [
"BSD-3-Clause"
] | 29 | 2018-07-30T08:36:07.000Z | 2022-03-09T12:02:06.000Z | from .toolbox import Vin
from .exceptions import ValidationError, VininfoException
VERSION = (1, 6, 0)
"""Application version number tuple."""
VERSION_STR = '.'.join(map(str, VERSION))
"""Application version number string.""" | 25.333333 | 57 | 0.736842 | from .toolbox import Vin
from .exceptions import ValidationError, VininfoException
VERSION = (1, 6, 0)
VERSION_STR = '.'.join(map(str, VERSION)) | true | true |
f70f70dc9554cc5a86433d7d1c74bb4e02d3ad76 | 46,498 | py | Python | gbxml/gbxml.py | building-energy/gbxml | 039edf6e33cccbb76dcda5fbb871aeb950ad0a87 | [
"MIT"
] | 5 | 2020-04-24T15:59:45.000Z | 2022-02-23T14:40:14.000Z | gbxml/gbxml.py | building-energy/gbxml | 039edf6e33cccbb76dcda5fbb871aeb950ad0a87 | [
"MIT"
] | 2 | 2021-07-05T12:09:09.000Z | 2022-02-05T07:05:59.000Z | gbxml/gbxml.py | building-energy/gbxml | 039edf6e33cccbb76dcda5fbb871aeb950ad0a87 | [
"MIT"
] | 1 | 2020-04-24T15:59:48.000Z | 2020-04-24T15:59:48.000Z | # -*- coding: utf-8 -*-
from lxml import etree
import pkgutil
from io import BytesIO
from . import xml_functions, construction_functions, layer_functions
from . import surface_functions, space_functions, building_functions
from . import opening_functions, zone_functions
class Gbxml():
"A class that represents a ... | 31.652825 | 93 | 0.549486 |
from lxml import etree
import pkgutil
from io import BytesIO
from . import xml_functions, construction_functions, layer_functions
from . import surface_functions, space_functions, building_functions
from . import opening_functions, zone_functions
class Gbxml():
def __init__(self,
gbxml_fp=... | true | true |
f70f71544831b4d1ffff7c6948b00d3bdd751afe | 38,151 | py | Python | google/net/proto2/python/internal/python_message.py | vladushakov987/appengine_python3 | 0dd481c73e2537a50ee10f1b79cd65938087e555 | [
"Apache-2.0"
] | null | null | null | google/net/proto2/python/internal/python_message.py | vladushakov987/appengine_python3 | 0dd481c73e2537a50ee10f1b79cd65938087e555 | [
"Apache-2.0"
] | null | null | null | google/net/proto2/python/internal/python_message.py | vladushakov987/appengine_python3 | 0dd481c73e2537a50ee10f1b79cd65938087e555 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 30.182753 | 86 | 0.720925 |
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import str
from builtins import range
from builtins import object
import sys
import six
from six.moves import range
if sys.version_info[0] < 3:
try:
from io impor... | true | true |
f70f7266246a72a1f47bb872e52660dc84524048 | 167 | py | Python | REL/ner/__init__.py | theblackcat102/REL | 9daaf924d3b7ee75ba0738fd218ddbaeab989bd8 | [
"MIT"
] | 210 | 2020-02-27T14:10:57.000Z | 2022-03-30T01:32:52.000Z | REL/ner/__init__.py | theblackcat102/REL | 9daaf924d3b7ee75ba0738fd218ddbaeab989bd8 | [
"MIT"
] | 69 | 2020-03-06T09:58:43.000Z | 2022-03-31T16:24:35.000Z | REL/ner/__init__.py | cnnlabs/REL | 7e680a13fb26cb23d9ba9ea45efd01cb4c6c7871 | [
"MIT"
] | 57 | 2020-02-28T15:52:33.000Z | 2022-03-16T11:28:19.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from REL.ner.base import NERBase, Span
from REL.ner.flair_wrapper import load_flair_ner
from REL.ner.ngram import Cmns
| 23.857143 | 48 | 0.748503 |
from REL.ner.base import NERBase, Span
from REL.ner.flair_wrapper import load_flair_ner
from REL.ner.ngram import Cmns
| true | true |
f70f729a2c7bd23c7413efdf4accb9acf8f8503f | 411 | py | Python | main.py | deadaf/tickets-bot | 1f72668a6843cb67daa77e911057775f9d9a37f1 | [
"MIT"
] | 5 | 2021-02-05T05:50:29.000Z | 2021-08-17T16:09:59.000Z | main.py | deadaf/tickets-bot | 1f72668a6843cb67daa77e911057775f9d9a37f1 | [
"MIT"
] | null | null | null | main.py | deadaf/tickets-bot | 1f72668a6843cb67daa77e911057775f9d9a37f1 | [
"MIT"
] | 3 | 2021-03-20T13:01:16.000Z | 2022-03-05T12:38:24.000Z | import discord
from discord.ext import commands
from discord.ext.commands import has_permissions, MissingPermissions
import json
import asyncio
bot = commands.Bot(command_prefix=".")
bot.remove_command("help")
@bot.event
async def on_ready():
print("Bot running with:")
print("Username: ", bot.user.name)
p... | 19.571429 | 68 | 0.729927 | import discord
from discord.ext import commands
from discord.ext.commands import has_permissions, MissingPermissions
import json
import asyncio
bot = commands.Bot(command_prefix=".")
bot.remove_command("help")
@bot.event
async def on_ready():
print("Bot running with:")
print("Username: ", bot.user.name)
p... | true | true |
f70f73cdbebb8824480c01d15f16886fcde78be7 | 914 | py | Python | corehq/motech/dhis2/migrations/0006_sqldhis2connection.py | dimagilg/commcare-hq | ea1786238eae556bb7f1cbd8d2460171af1b619c | [
"BSD-3-Clause"
] | 471 | 2015-01-10T02:55:01.000Z | 2022-03-29T18:07:18.000Z | corehq/motech/dhis2/migrations/0006_sqldhis2connection.py | dimagilg/commcare-hq | ea1786238eae556bb7f1cbd8d2460171af1b619c | [
"BSD-3-Clause"
] | 14,354 | 2015-01-01T07:38:23.000Z | 2022-03-31T20:55:14.000Z | corehq/motech/dhis2/migrations/0006_sqldhis2connection.py | dimagilg/commcare-hq | ea1786238eae556bb7f1cbd8d2460171af1b619c | [
"BSD-3-Clause"
] | 175 | 2015-01-06T07:16:47.000Z | 2022-03-29T13:27:01.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.11.26 on 2020-01-14 21:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('dhis2', '0005_delete_jsonapilog'),
]
operations = [
mi... | 31.517241 | 114 | 0.601751 |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('dhis2', '0005_delete_jsonapilog'),
]
operations = [
migrations.CreateModel(
name='SQLDhis2Connection',
... | true | true |
f70f74b17c66f2afe1b4d538e6f2c4b8da58986d | 37,822 | py | Python | src/pip/_internal/index/package_finder.py | Shivansh-007/pip | 0c284520c6d068cb25ac89d9dbee0456c2eba23a | [
"MIT"
] | 1 | 2022-03-14T20:15:00.000Z | 2022-03-14T20:15:00.000Z | src/pip/_internal/index/package_finder.py | Shivansh-007/pip | 0c284520c6d068cb25ac89d9dbee0456c2eba23a | [
"MIT"
] | 1 | 2022-01-27T19:09:25.000Z | 2022-01-27T19:09:25.000Z | src/pip/_internal/index/package_finder.py | Shivansh-007/pip | 0c284520c6d068cb25ac89d9dbee0456c2eba23a | [
"MIT"
] | 1 | 2021-09-27T11:14:58.000Z | 2021-09-27T11:14:58.000Z | """Routines related to PyPI, indexes"""
# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
import enum
import functools
import itertools
import logging
import re
from typing import FrozenSet, Iterable, List, Optional, Set, Tuple, Union
from pip._vendor.packaging impo... | 36.684772 | 88 | 0.631749 |
import enum
import functools
import itertools
import logging
import re
from typing import FrozenSet, Iterable, List, Optional, Set, Tuple, Union
from pip._vendor.packaging import specifiers
from pip._vendor.packaging.tags import Tag
from pip._vendor.packaging.utils import canonicalize_name
from pip._vendor.packagi... | true | true |
f70f74c49693a3c8825166a36842545400ad789b | 2,992 | py | Python | algorithms/anchor_detector.py | songheony/AAA-multi | 80a988d8d312664d8ca19dee82c844183cf4f55d | [
"MIT"
] | null | null | null | algorithms/anchor_detector.py | songheony/AAA-multi | 80a988d8d312664d8ca19dee82c844183cf4f55d | [
"MIT"
] | null | null | null | algorithms/anchor_detector.py | songheony/AAA-multi | 80a988d8d312664d8ca19dee82c844183cf4f55d | [
"MIT"
] | 1 | 2021-03-01T06:58:15.000Z | 2021-03-01T06:58:15.000Z | from .aaa_util import eval_results, get_summary, convert_df
class AnchorDetector:
def __init__(self, offline):
self.offline = offline
def initialize(self, seq_info):
self.seq_info = seq_info
self.previous_offline = None
def fixed_detect(self, frame_idx, duration):
feedbac... | 35.2 | 85 | 0.60127 | from .aaa_util import eval_results, get_summary, convert_df
class AnchorDetector:
def __init__(self, offline):
self.offline = offline
def initialize(self, seq_info):
self.seq_info = seq_info
self.previous_offline = None
def fixed_detect(self, frame_idx, duration):
feedbac... | true | true |
f70f74dd4d6743c0e5a61696e8f4284ad3a589ae | 300 | py | Python | maxsmi/tests/test_maxsmi.py | t-kimber/maxsmi | d7d52a9ba95efb6b4219928425bb5de965c4b3b5 | [
"MIT"
] | 1 | 2021-01-22T17:56:54.000Z | 2021-01-22T17:56:54.000Z | maxsmi/tests/test_maxsmi.py | t-kimber/maxsmi | d7d52a9ba95efb6b4219928425bb5de965c4b3b5 | [
"MIT"
] | 12 | 2020-10-16T10:13:56.000Z | 2021-04-14T07:25:05.000Z | maxsmi/tests/test_maxsmi.py | t-kimber/maxsmi | d7d52a9ba95efb6b4219928425bb5de965c4b3b5 | [
"MIT"
] | null | null | null | """
Unit and regression test for the maxsmi package.
"""
# Import package, test suite, and other packages as needed
# import maxsmi
# import pytest
import sys
def test_maxsmi_imported():
"""Sample test, will always pass so long as import statement worked"""
assert "maxsmi" in sys.modules
| 21.428571 | 74 | 0.73 |
import sys
def test_maxsmi_imported():
assert "maxsmi" in sys.modules
| true | true |
f70f75b56fefe5b1ddf643a702b9df5d8dde9dd9 | 1,130 | py | Python | catalyst/assets/__init__.py | guilhermeprokisch/catalyst | 21e096b261912d9e905584178d6ee626072c23cb | [
"Apache-2.0"
] | null | null | null | catalyst/assets/__init__.py | guilhermeprokisch/catalyst | 21e096b261912d9e905584178d6ee626072c23cb | [
"Apache-2.0"
] | null | null | null | catalyst/assets/__init__.py | guilhermeprokisch/catalyst | 21e096b261912d9e905584178d6ee626072c23cb | [
"Apache-2.0"
] | null | null | null | #
# Copyright 2015 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | 26.27907 | 75 | 0.69646 |
from ._assets import (
Asset,
Equity,
Future,
make_asset_array,
CACHE_FILE_TEMPLATE
)
from .assets import (
AssetFinder,
AssetConvertible,
PricingDataAssociable,
)
from .asset_db_schema import ASSET_DB_VERSION
from .asset_writer import AssetDBWriter
__all_... | true | true |
f70f76797352e63f38e9029343013e191ad89605 | 3,744 | py | Python | ansible/plugins/action/sros.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 5668b5785296b314ea1321057420bcd077dba9ea | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | 1 | 2022-01-25T22:52:58.000Z | 2022-01-25T22:52:58.000Z | ansible/plugins/action/sros.py | EnjoyLifeFund/Debian_py36_packages | 1985d4c73fabd5f08f54b922e73a9306e09c77a5 | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | ansible/plugins/action/sros.py | EnjoyLifeFund/Debian_py36_packages | 1985d4c73fabd5f08f54b922e73a9306e09c77a5 | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | #
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is d... | 36.705882 | 118 | 0.654647 |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
import copy
from ansible import constants as C
from ansible.plugins.action.normal import ActionModule as _ActionModule
from ansible.module_utils.sros import sros_argument_spec
from ansible.module_utils... | true | true |
f70f78983d59b550f32fb5bc0b61b997923e1baf | 11,459 | py | Python | graphsense/model/entity_tags.py | iknaio/graphsense-python | b61c66b6ec0bb9720036ae61777e90ce63a971cc | [
"MIT"
] | null | null | null | graphsense/model/entity_tags.py | iknaio/graphsense-python | b61c66b6ec0bb9720036ae61777e90ce63a971cc | [
"MIT"
] | 1 | 2022-02-24T11:21:49.000Z | 2022-02-24T11:21:49.000Z | graphsense/model/entity_tags.py | INTERPOL-Innovation-Centre/GraphSense-Maltego-transform | 2a9b352289ab64903a7012c5d84cb4c6d8172ade | [
"MIT"
] | null | null | null | """
GraphSense API
GraphSense API # noqa: E501
The version of the OpenAPI document: 0.5.1
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from graphsense.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal,
M... | 42.128676 | 121 | 0.569421 |
import re
import sys
from graphsense.model_utils import (
ApiTypeError,
ModelComposed,
ModelNormal,
ModelSimple,
cached_property,
change_keys_js_to_python,
convert_js_args_to_python_args,
date,
datetime,
file_type,
none_type,
validate_get_composed_info,
)
from ..... | true | true |
f70f79489ce5d6799a41c07cf1757179521b1ce4 | 2,632 | py | Python | the_mechanic_backend/apps/stock/migrations/0003_sparecustomer_spareorder_sparesold.py | muthukumar4999/the-mechanic-backend | 1e31affddf60d2de72445a85dd2055bdeba6f670 | [
"MIT"
] | null | null | null | the_mechanic_backend/apps/stock/migrations/0003_sparecustomer_spareorder_sparesold.py | muthukumar4999/the-mechanic-backend | 1e31affddf60d2de72445a85dd2055bdeba6f670 | [
"MIT"
] | 5 | 2020-06-05T22:30:20.000Z | 2021-09-08T01:12:27.000Z | the_mechanic_backend/apps/stock/migrations/0003_sparecustomer_spareorder_sparesold.py | muthukumar4999/the-mechanic-backend | 1e31affddf60d2de72445a85dd2055bdeba6f670 | [
"MIT"
] | null | null | null | # Generated by Django 2.1.5 on 2019-03-31 18:24
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('accounts', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODE... | 49.660377 | 178 | 0.602204 |
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('accounts', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('stock', '0002_spare_store'),
... | true | true |
f70f797573bfd52476fcff70d64ce151275711dc | 3,122 | py | Python | meteors.py | Stafferson/YandexLycP2 | f5c50cc89ca6716612f0b91f2e22315c414d5541 | [
"MIT"
] | null | null | null | meteors.py | Stafferson/YandexLycP2 | f5c50cc89ca6716612f0b91f2e22315c414d5541 | [
"MIT"
] | null | null | null | meteors.py | Stafferson/YandexLycP2 | f5c50cc89ca6716612f0b91f2e22315c414d5541 | [
"MIT"
] | null | null | null | import os
import sys
import random
import pygame
def load_image(name, colorkey=None): # not sure if this method is needed
fullname = os.path.join('data', name)
# если файл не существует, то выходим
if not os.path.isfile(fullname):
print(f"Файл с изображением '{fullname}' не найден")
sys.e... | 35.078652 | 100 | 0.601217 | import os
import sys
import random
import pygame
def load_image(name, colorkey=None):
fullname = os.path.join('data', name)
if not os.path.isfile(fullname):
print(f"Файл с изображением '{fullname}' не найден")
sys.exit()
image = pygame.image.load(fullname)
return image
enemi... | true | true |
f70f79ef125a14fdd24574d066c3d6d527e43b4f | 330 | py | Python | flask_app/__init__.py | maawoo/S1GRASS-Webapp | b34335f2aaa64dff075b955b98ad01f062ba9891 | [
"Unlicense"
] | null | null | null | flask_app/__init__.py | maawoo/S1GRASS-Webapp | b34335f2aaa64dff075b955b98ad01f062ba9891 | [
"Unlicense"
] | 1 | 2020-09-10T12:18:37.000Z | 2020-09-10T12:18:37.000Z | flask_app/__init__.py | maawoo/S1GRASS-Webapp | b34335f2aaa64dff075b955b98ad01f062ba9891 | [
"Unlicense"
] | 2 | 2020-09-09T13:37:45.000Z | 2021-04-23T18:57:24.000Z | from config import Config
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_bootstrap import Bootstrap
app = Flask(__name__)
app.config.from_object(Config)
db = SQLAlchemy(app)
migrate = Migrate(app, db)
bootstrap = Bootstrap(app)
from flask_app import route... | 22 | 39 | 0.818182 | from config import Config
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_bootstrap import Bootstrap
app = Flask(__name__)
app.config.from_object(Config)
db = SQLAlchemy(app)
migrate = Migrate(app, db)
bootstrap = Bootstrap(app)
from flask_app import route... | true | true |
f70f7a2b99b2903b8866d778aaaf850f6f9f1fa1 | 6,688 | py | Python | gammapy/utils/testing.py | Rishank2610/gammapy | 3cd64fdb2c53c8e5c697a9b85ef8d0486bff0b76 | [
"BSD-3-Clause"
] | 1 | 2017-11-22T17:07:56.000Z | 2017-11-22T17:07:56.000Z | gammapy/utils/testing.py | Rishank2610/gammapy | 3cd64fdb2c53c8e5c697a9b85ef8d0486bff0b76 | [
"BSD-3-Clause"
] | null | null | null | gammapy/utils/testing.py | Rishank2610/gammapy | 3cd64fdb2c53c8e5c697a9b85ef8d0486bff0b76 | [
"BSD-3-Clause"
] | 1 | 2019-09-04T14:03:33.000Z | 2019-09-04T14:03:33.000Z | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Utilities for testing"""
import os
import sys
from numpy.testing import assert_allclose
import astropy.units as u
from astropy.coordinates import SkyCoord
from astropy.time import Time
__all__ = [
"requires_dependency",
"requires_data",
"mp... | 27.866667 | 80 | 0.643541 |
import os
import sys
from numpy.testing import assert_allclose
import astropy.units as u
from astropy.coordinates import SkyCoord
from astropy.time import Time
__all__ = [
"requires_dependency",
"requires_data",
"mpl_plot_check",
"assert_quantity_allclose",
"assert_skycoord_allclose",
"assert_... | true | true |
f70f7a739c8358bfeaf9b03fd0832dae1581d974 | 1,088 | py | Python | src/snlayers/snconv1d.py | Zihang97/PAGAN | 9233fc54ecf49d6a82bb0794333d61f707439a68 | [
"MIT"
] | 29 | 2019-11-04T12:46:17.000Z | 2022-02-19T10:06:16.000Z | src/snlayers/snconv1d.py | Zihang97/PAGAN | 9233fc54ecf49d6a82bb0794333d61f707439a68 | [
"MIT"
] | 2 | 2020-07-05T04:15:57.000Z | 2021-04-10T03:45:09.000Z | src/snlayers/snconv1d.py | Zihang97/PAGAN | 9233fc54ecf49d6a82bb0794333d61f707439a68 | [
"MIT"
] | 9 | 2020-05-04T01:23:37.000Z | 2021-07-13T06:47:02.000Z | # coding=utf-8
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules import conv
from torch.nn.modules.utils import _single
from ..functions.max_sv import max_singular_value
class SNConv1d(conv._ConvNd):
def __init__(self, in_channels, out_channels, kernel_size, stride=1, paddin... | 36.266667 | 117 | 0.682904 |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules import conv
from torch.nn.modules.utils import _single
from ..functions.max_sv import max_singular_value
class SNConv1d(conv._ConvNd):
def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=... | true | true |
f70f7a9a71e9c09452054da1066ca9dc4f363773 | 678 | py | Python | tf_agents/agents/sac/__init__.py | FlorisHoogenboom/agents | 2cd5a61e1838b52012271f1fb8617c29a55279a9 | [
"Apache-2.0"
] | 16 | 2020-09-23T06:21:49.000Z | 2022-03-28T05:45:04.000Z | tf_agents/agents/sac/__init__.py | FlorisHoogenboom/agents | 2cd5a61e1838b52012271f1fb8617c29a55279a9 | [
"Apache-2.0"
] | 13 | 2019-06-18T03:36:39.000Z | 2019-08-28T18:30:29.000Z | tf_agents/agents/sac/__init__.py | FlorisHoogenboom/agents | 2cd5a61e1838b52012271f1fb8617c29a55279a9 | [
"Apache-2.0"
] | 6 | 2020-10-09T06:33:23.000Z | 2022-02-03T16:16:36.000Z | # coding=utf-8
# Copyright 2018 The TF-Agents 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... | 37.666667 | 74 | 0.759587 |
from tf_agents.agents.sac import sac_agent
| true | true |
f70f7ac9a07e731a63b7367bb5601c7b352c07cb | 6,766 | py | Python | src/classifiers.py | samirsahoo007/Naive-Bayes-and-Decision-Tree-Classifiers | 619c5c0b17438d1014f7ca7e4ce13cc44c45de3c | [
"MIT"
] | 1 | 2020-11-17T16:09:13.000Z | 2020-11-17T16:09:13.000Z | src/classifiers.py | samirsahoo007/Naive-Bayes-and-Decision-Tree-Classifiers | 619c5c0b17438d1014f7ca7e4ce13cc44c45de3c | [
"MIT"
] | null | null | null | src/classifiers.py | samirsahoo007/Naive-Bayes-and-Decision-Tree-Classifiers | 619c5c0b17438d1014f7ca7e4ce13cc44c45de3c | [
"MIT"
] | 4 | 2019-07-05T02:03:02.000Z | 2022-01-21T22:12:16.000Z | # -*- coding: utf-8 -*- #
"""*********************************************************************************************"""
# FileName [ classifiers.py ]
# Synopsis [ 'Naive Bayes' and 'Decision Tree' training, testing, and tunning functions ]
# Author [ Ting-Wei Liu (Andi611) ]
# Copyright [... | 31.915094 | 149 | 0.649571 |
n.model_selection import cross_val_score
from sklearn import metrics
from sklearn import tree
DISTRIBUTION = 'Multinominal'
cross_validate = False
self.MODEL = MODEL
if self.MODEL == 'NEWS':
self.models = { 'Guassian' : GaussianNB(),
'Multinominal' : MultinomialNB(alpha=0.065),
'Comp... | true | true |
f70f7cdaa34aef41cecf2fa32f6c3bc75d3c6636 | 19 | py | Python | xontrib/avox_poetry/__init__.py | jnoortheen/xontrib-avox-poetry | aef6fd087108ec66c53e473d9492ae99c357a00e | [
"MIT"
] | 3 | 2021-02-21T05:46:52.000Z | 2021-12-01T16:07:31.000Z | xontrib/avox_poetry/__init__.py | jnoortheen/xontrib-avox-poetry | aef6fd087108ec66c53e473d9492ae99c357a00e | [
"MIT"
] | 3 | 2021-03-03T22:49:35.000Z | 2022-03-17T15:40:19.000Z | xontrib/avox_poetry/__init__.py | jnoortheen/xontrib-avox-poetry | aef6fd087108ec66c53e473d9492ae99c357a00e | [
"MIT"
] | 1 | 2022-03-20T18:20:54.000Z | 2022-03-20T18:20:54.000Z | from . import venv
| 9.5 | 18 | 0.736842 | from . import venv
| true | true |
f70f7e6d8c477abc39ccd009b82ebc37062afbec | 561 | py | Python | Curve/Parms.py | olesmith/SmtC | dfae5097f02192b60aae05b9d02404fcfe893be3 | [
"CC0-1.0"
] | null | null | null | Curve/Parms.py | olesmith/SmtC | dfae5097f02192b60aae05b9d02404fcfe893be3 | [
"CC0-1.0"
] | null | null | null | Curve/Parms.py | olesmith/SmtC | dfae5097f02192b60aae05b9d02404fcfe893be3 | [
"CC0-1.0"
] | null | null | null |
class Curve_Parms():
def Curve_Parms_Paths(self):
return [str(self.a),str(self.b),str(self.c),str(self.NFrames)]
def Curve_Parms_Path(self):
return "/".join( self.Curve_Parms_Paths() )
def Curve_Parms_FileName(self,cname,fname,ext="svg"):
fnames=self.Curve_Parms_Paths()... | 22.44 | 71 | 0.561497 |
class Curve_Parms():
def Curve_Parms_Paths(self):
return [str(self.a),str(self.b),str(self.c),str(self.NFrames)]
def Curve_Parms_Path(self):
return "/".join( self.Curve_Parms_Paths() )
def Curve_Parms_FileName(self,cname,fname,ext="svg"):
fnames=self.Curve_Parms_Paths()... | true | true |
f70f7e730fa4c4fa5d6d670b19ebb19549c82ecc | 79,847 | py | Python | src/opserver/test/test_analytics_uve.py | codilime/contrail-controller-arch | e87a974950fc1bbdc2b834212dbdfee5e94008de | [
"Apache-2.0"
] | null | null | null | src/opserver/test/test_analytics_uve.py | codilime/contrail-controller-arch | e87a974950fc1bbdc2b834212dbdfee5e94008de | [
"Apache-2.0"
] | null | null | null | src/opserver/test/test_analytics_uve.py | codilime/contrail-controller-arch | e87a974950fc1bbdc2b834212dbdfee5e94008de | [
"Apache-2.0"
] | 1 | 2020-07-04T12:08:02.000Z | 2020-07-04T12:08:02.000Z | #!/usr/bin/env python
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
#
# analytics_uvetest.py
#
# UVE and Alarm tests
#
import os
import sys
import threading
threading._DummyThread._Thread__stop = lambda x: 42
import signal
import gevent
from gevent import monkey
monkey.patch_all()
import unitt... | 42.471809 | 85 | 0.36218 |
import os
import sys
import threading
threading._DummyThread._Thread__stop = lambda x: 42
import signal
import gevent
from gevent import monkey
monkey.patch_all()
import unittest
import testtools
import fixtures
import socket
from utils.util import obj_to_dict, find_buildroot
from utils.analytics_fixture im... | true | true |
f70f7f844b3f8ee5ade345d734bba14d2d862c60 | 8,736 | py | Python | PyPowerDNS/api.py | TheDJVG/PyPowerDNS | 2e0e47c3bb7a7b20c08ddfa6f0cd93e663d02dc7 | [
"MIT"
] | 1 | 2021-04-05T21:40:34.000Z | 2021-04-05T21:40:34.000Z | PyPowerDNS/api.py | TheDJVG/PyPowerDNS | 2e0e47c3bb7a7b20c08ddfa6f0cd93e663d02dc7 | [
"MIT"
] | 1 | 2020-09-21T15:00:44.000Z | 2020-09-22T00:38:15.000Z | PyPowerDNS/api.py | TheDJVG/PyPowerDNS | 2e0e47c3bb7a7b20c08ddfa6f0cd93e663d02dc7 | [
"MIT"
] | null | null | null | from .objects import Server, Zone, RRSet, Record, Comment, Cryptokey, Metadata, SearchResult, StatisticItem, \
MapStatisticItem, RingStatisticItem, SimpleStatisticItem, CacheFlushResult
from .exceptions import PDNSApiException, PDNSApiNotFound
import json
from functools import partial
import requests
import loggin... | 38.484581 | 110 | 0.615156 | from .objects import Server, Zone, RRSet, Record, Comment, Cryptokey, Metadata, SearchResult, StatisticItem, \
MapStatisticItem, RingStatisticItem, SimpleStatisticItem, CacheFlushResult
from .exceptions import PDNSApiException, PDNSApiNotFound
import json
from functools import partial
import requests
import loggin... | true | true |
f70f80addbf2038f17208bc47e55b1fabb3e74e7 | 5,534 | py | Python | ezcoach/ezcoach/agent.py | Pawel-M/EZ-Coach | ee078b8ab7409730e99cb38653d03aa574ab914b | [
"MIT"
] | 1 | 2021-09-14T13:17:33.000Z | 2021-09-14T13:17:33.000Z | ezcoach/ezcoach/agent.py | Pawel-M/EZ-Coach | ee078b8ab7409730e99cb38653d03aa574ab914b | [
"MIT"
] | null | null | null | ezcoach/ezcoach/agent.py | Pawel-M/EZ-Coach | ee078b8ab7409730e99cb38653d03aa574ab914b | [
"MIT"
] | null | null | null | """
The agent module contains three abstract classes that are subclassed in order to create algorithms.
The classes are:
* Player - for an algorithm that cannot learn and can only play
* Learner - for a learning algorithm controlling a single agent
* MultiLearner - for a learning algorithm of controlling a number of a... | 36.893333 | 117 | 0.669859 | import abc
from typing import List, Iterable
from ezcoach.enviroment import Manifest
class Player(abc.ABC):
@abc.abstractmethod
def initialize(self, manifest: Manifest):
@abc.abstractmethod
def act(self, state):
@classmethod
def __subclasshook__(cls, obj):
if cls is Player:
... | true | true |
f70f81401c08d654abb1e9dcd49531c69b6cbd11 | 8,969 | py | Python | ceilometer/tests/alarm/test_notifier.py | NeCTAR-RC/ceilometer | 25cb8740b83bfbf5c526be816fa3ae10f936bff5 | [
"Apache-2.0"
] | 1 | 2015-02-26T03:23:09.000Z | 2015-02-26T03:23:09.000Z | ceilometer/tests/alarm/test_notifier.py | NeCTAR-RC/ceilometer | 25cb8740b83bfbf5c526be816fa3ae10f936bff5 | [
"Apache-2.0"
] | null | null | null | ceilometer/tests/alarm/test_notifier.py | NeCTAR-RC/ceilometer | 25cb8740b83bfbf5c526be816fa3ae10f936bff5 | [
"Apache-2.0"
] | null | null | null | # -*- encoding: utf-8 -*-
#
# Copyright © 2013 eNovance
#
# Author: Julien Danjou <julien@danjou.info>
#
# 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/... | 42.709524 | 79 | 0.563051 |
import six.moves.urllib.parse as urlparse
import mock
import requests
from ceilometer.alarm import service
from ceilometer.openstack.common import context
from ceilometer.openstack.common.fixture import config
from ceilometer.openstack.common import test
DATA_JSON = ('{"current": "ALARM", "alarm_id... | true | true |
f70f82382935e2fef97fc4bfb9b6127666b2db6e | 1,793 | py | Python | app.py | ds19991999/CKUser | c66ebda6ef5068a79b816de2c57a443b25d7096d | [
"MIT"
] | null | null | null | app.py | ds19991999/CKUser | c66ebda6ef5068a79b816de2c57a443b25d7096d | [
"MIT"
] | null | null | null | app.py | ds19991999/CKUser | c66ebda6ef5068a79b816de2c57a443b25d7096d | [
"MIT"
] | null | null | null | #!/usr/bin/python3
# -*- coding:utf-8 -*-
from ckuser import client,server
import os
def print_client_menu():
print("用户菜单:")
print("-"*25)
print("0"+"-"*10+"显示用户菜单"+"-"*10)
print("1"+"-"*10+"显示服务菜单"+"-"*10)
print("2"+"-"*10+"用户登录系统"+"-"*10)
print("3"+"-"*10+"用户修改信息"+"-"*10)
print("4"+"-"*10+"用户注册信息"+"-"*10)
pr... | 19.703297 | 34 | 0.557167 |
from ckuser import client,server
import os
def print_client_menu():
print("用户菜单:")
print("-"*25)
print("0"+"-"*10+"显示用户菜单"+"-"*10)
print("1"+"-"*10+"显示服务菜单"+"-"*10)
print("2"+"-"*10+"用户登录系统"+"-"*10)
print("3"+"-"*10+"用户修改信息"+"-"*10)
print("4"+"-"*10+"用户注册信息"+"-"*10)
print("6"+"-"*10+"退出系统")
def print_server... | true | true |
f70f84ea78513abd82f40253fd127865d7f56a02 | 2,181 | py | Python | sound_factory/sound_factory.py | jphacks/C_2008 | 65d7a1d3a90045b149397cdd1e038ab648bb842e | [
"MIT"
] | 2 | 2020-11-28T05:10:48.000Z | 2020-11-29T01:23:53.000Z | sound_factory/sound_factory.py | jphacks/C_2008 | 65d7a1d3a90045b149397cdd1e038ab648bb842e | [
"MIT"
] | 5 | 2020-11-01T06:34:02.000Z | 2020-11-01T06:37:46.000Z | sound_factory/sound_factory.py | jphacks/C_2008 | 65d7a1d3a90045b149397cdd1e038ab648bb842e | [
"MIT"
] | null | null | null | import os
import re
import argparse
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.preprocessing.image import load_img, img_to_array
IMAGE_SHAPE = [(224, 224), (240, 240), (260, 260), (300, 300), (380, 380), (456, 456), (528, 528), (600, 600)]
def main(paths : list, mod... | 41.942308 | 149 | 0.604768 | import os
import re
import argparse
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.preprocessing.image import load_img, img_to_array
IMAGE_SHAPE = [(224, 224), (240, 240), (260, 260), (300, 300), (380, 380), (456, 456), (528, 528), (600, 600)]
def main(paths : list, mod... | true | true |
f70f862db871c216db3b2e5ea714abdc5fdf04bd | 3,238 | py | Python | scripts/load_file_into_mod.py | strategineer/crusader_kings_3_mods | e290c3e8e542875c0ced2d1b7a013eb85b2037fb | [
"MIT"
] | null | null | null | scripts/load_file_into_mod.py | strategineer/crusader_kings_3_mods | e290c3e8e542875c0ced2d1b7a013eb85b2037fb | [
"MIT"
] | null | null | null | scripts/load_file_into_mod.py | strategineer/crusader_kings_3_mods | e290c3e8e542875c0ced2d1b7a013eb85b2037fb | [
"MIT"
] | null | null | null | #!/usr/bin/python3
import os
import sys
from shutil import copyfile
import argparse
from pathlib import Path
import logging
logging.basicConfig(level=logging.INFO)
NUMBERED_FILENAME_SPLIT_CHARACTER = "_"
parser = argparse.ArgumentParser(description='')
parser.add_argument('filepath', help='')
parser.add_argument('--... | 39.012048 | 149 | 0.774552 |
import os
import sys
from shutil import copyfile
import argparse
from pathlib import Path
import logging
logging.basicConfig(level=logging.INFO)
NUMBERED_FILENAME_SPLIT_CHARACTER = "_"
parser = argparse.ArgumentParser(description='')
parser.add_argument('filepath', help='')
parser.add_argument('--force', '-f', acti... | true | true |
f70f86fe1ee1ad646b17cffe4377c00e9ea1c90b | 13,474 | py | Python | chapter05/blackjack.py | bhomaidan1990/reinforcement-learning-an-introduction | fbf020d9da2daec3194a17f968ef29d12ebde6f6 | [
"MIT"
] | 12,197 | 2016-10-04T03:34:49.000Z | 2022-03-31T12:55:36.000Z | chapter05/blackjack.py | bhomaidan1990/reinforcement-learning-an-introduction | fbf020d9da2daec3194a17f968ef29d12ebde6f6 | [
"MIT"
] | 134 | 2016-11-01T06:06:51.000Z | 2022-02-07T00:12:01.000Z | chapter05/blackjack.py | bhomaidan1990/reinforcement-learning-an-introduction | fbf020d9da2daec3194a17f968ef29d12ebde6f6 | [
"MIT"
] | 4,738 | 2016-09-27T07:38:23.000Z | 2022-03-31T10:09:14.000Z | #######################################################################
# Copyright (C) #
# 2016-2018 Shangtong Zhang(zhangshangtong.cpp@gmail.com) #
# 2016 Kenta Shimada(hyperkentakun@gmail.com) #
# 2017 Nicky van Foreest(vanfore... | 36.318059 | 113 | 0.635149 | _sum -= 12
dealer_card -= 1
if usable_ace:
states_usable_ace_count[player_sum, dealer_card] += 1
states_usable_ace[player_sum, dealer_card] += reward
else:
states_no_usable_ace_count[player_sum, dealer_card] += 1
states_... | true | true |
f70f874944a8646dbb751573e99b3ab43f3e5dcf | 1,826 | py | Python | image_preprocessing.py | kpullak/PlantPhenotyping | a0b5bd68787b0850ad1d4d56cab7767cc4f2dc61 | [
"Apache-2.0"
] | null | null | null | image_preprocessing.py | kpullak/PlantPhenotyping | a0b5bd68787b0850ad1d4d56cab7767cc4f2dc61 | [
"Apache-2.0"
] | null | null | null | image_preprocessing.py | kpullak/PlantPhenotyping | a0b5bd68787b0850ad1d4d56cab7767cc4f2dc61 | [
"Apache-2.0"
] | null | null | null | import os
import cv2
source_path = './test_images/'
def processImage(filename, mImage):
if '2019' in filename:
# ----------------------------------
# Remove noise - by applying guassian blur on src image
mImage = cv2.GaussianBlur(mImage, (5, 5), cv2.BORDER_DEFAULT)
# pink rgb values - 255, 153, 255
# whit... | 33.814815 | 93 | 0.646769 | import os
import cv2
source_path = './test_images/'
def processImage(filename, mImage):
if '2019' in filename:
mImage = cv2.GaussianBlur(mImage, (5, 5), cv2.BORDER_DEFAULT)
mImage[mImage >= 128] = 200
mImage[mImage < 128] = 0
new_name = source_path + os.path.splitext(filename)[0] +... | true | true |
f70f87745a9dddf3fca3ea25b23a3a50d07f934b | 765 | py | Python | kur/engine/__init__.py | greedyuser/kur | ba6588ebfa5dec66d1e462c180618cc115fd38ef | [
"Apache-2.0"
] | 867 | 2016-12-05T20:24:23.000Z | 2022-02-18T09:07:14.000Z | kur/engine/__init__.py | greedyuser/kur | ba6588ebfa5dec66d1e462c180618cc115fd38ef | [
"Apache-2.0"
] | 90 | 2017-01-14T22:46:23.000Z | 2021-02-09T13:32:27.000Z | kur/engine/__init__.py | greedyuser/kur | ba6588ebfa5dec66d1e462c180618cc115fd38ef | [
"Apache-2.0"
] | 135 | 2017-01-18T19:21:20.000Z | 2022-01-24T16:57:59.000Z | """
Copyright 2016 Deepgram
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
distri... | 34.772727 | 79 | 0.789542 |
from .engine import Engine, ScopeStack
from .passthrough_engine import PassthroughEngine
from .jinja_engine import JinjaEngine
| true | true |
f70f8807470cc0430f7ec49eed3f61f2abc42cb2 | 14,684 | py | Python | sphinx_ext/design_choice.py | friendly-traceback/docs | 413a1d6980b605e2305d5b0ab5757f098a1700c1 | [
"CC0-1.0"
] | null | null | null | sphinx_ext/design_choice.py | friendly-traceback/docs | 413a1d6980b605e2305d5b0ab5757f098a1700c1 | [
"CC0-1.0"
] | 3 | 2021-07-17T17:19:47.000Z | 2022-02-01T13:39:12.000Z | sphinx_ext/design_choice.py | friendly-traceback/docs | 413a1d6980b605e2305d5b0ab5757f098a1700c1 | [
"CC0-1.0"
] | 1 | 2021-07-11T12:59:46.000Z | 2021-07-11T12:59:46.000Z | """
design_choice
~~~~~~~~~~~~~~
IMPORTANT: This is a straightforward adaptation of sphinx's todo extension
done by search/replace.
Allow design_choices to be inserted into your documentation.
Inclusion of design_choices can be switched of by a configuration variable.
The design_choice_li... | 36.078624 | 127 | 0.649346 |
import warnings
from typing import Any, Dict, Iterable, List, Tuple, cast
from docutils import nodes
from docutils.nodes import Element, Node
from docutils.parsers.rst import directives
from docutils.parsers.rst.directives.admonitions import BaseAdmonition
import sphinx
from sphinx import addnodes
from sphinx.appli... | true | true |
f70f8831567b456197e476ae0d16b0a4367f7af6 | 4,769 | py | Python | src/alias/azext_alias/_validators.py | PoisonousJohn/azure-cli-extensions | cf0d7b6c031ba844dd5e43cc4e07533b85ef1269 | [
"MIT"
] | 1 | 2018-09-22T14:53:04.000Z | 2018-09-22T14:53:04.000Z | src/alias/azext_alias/_validators.py | PoisonousJohn/azure-cli-extensions | cf0d7b6c031ba844dd5e43cc4e07533b85ef1269 | [
"MIT"
] | null | null | null | src/alias/azext_alias/_validators.py | PoisonousJohn/azure-cli-extensions | cf0d7b6c031ba844dd5e43cc4e07533b85ef1269 | [
"MIT"
] | null | null | null | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 38.772358 | 117 | 0.681275 |
import re
import shlex
from knack.util import CLIError
import azext_alias
from azext_alias.argument import get_placeholders
from azext_alias._const import (
COLLISION_CHECK_LEVEL_DEPTH,
INVALID_ALIAS_COMMAND_ERROR,
EMPTY_ALIAS_ERROR,
INVALID_STARTING_CHAR_ERROR,
INCONSISTENT_ARG_ERROR,
CO... | true | true |
f70f8a2f41f8fdb18d9b0a96c1d23e7abc0f59f7 | 1,752 | py | Python | python/lvmieb/exceptions.py | sdss/OsuActor | bf3d92448e07cefc4c1346db04b1eb9b7e00dd41 | [
"BSD-3-Clause"
] | 2 | 2021-07-30T04:38:30.000Z | 2021-08-13T13:34:04.000Z | python/lvmieb/exceptions.py | sdss/OsuActor | bf3d92448e07cefc4c1346db04b1eb9b7e00dd41 | [
"BSD-3-Clause"
] | 4 | 2021-06-03T12:01:00.000Z | 2021-08-14T09:34:12.000Z | python/lvmieb/exceptions.py | sdss/osuactor | bf3d92448e07cefc4c1346db04b1eb9b7e00dd41 | [
"BSD-3-Clause"
] | 2 | 2021-05-04T06:19:39.000Z | 2021-05-11T08:35:02.000Z | # -*- coding: utf-8 -*-
#
# Licensed under a 3-clause BSD license.
#
# @Author: Changgon Kim, Mingeyong Yang, Taeeun Kim
# @Date: 2021-04-26 17:14
# @Last modified by: Changgon Kim
from __future__ import absolute_import, division, print_function
class LvmIebError(Exception):
"""A custom core LvmIeb exceptio... | 23.052632 | 84 | 0.695205 |
from __future__ import absolute_import, division, print_function
class LvmIebError(Exception):
def __init__(self, message=None):
message = "There has been an error" if not message else message
super(LvmIebError, self).__init__(message)
class LvmIebNotImplemented(LvmIebError):
def... | true | true |
f70f8a6fdb098ef333f9170579450717e8ff2c68 | 12,261 | py | Python | common/manager.py | hxwork/OMNet | be88a734e7327def365e1875bbc7cd2fea1539b0 | [
"MIT"
] | null | null | null | common/manager.py | hxwork/OMNet | be88a734e7327def365e1875bbc7cd2fea1539b0 | [
"MIT"
] | null | null | null | common/manager.py | hxwork/OMNet | be88a734e7327def365e1875bbc7cd2fea1539b0 | [
"MIT"
] | 1 | 2021-11-14T12:56:40.000Z | 2021-11-14T12:56:40.000Z | import os
from collections import defaultdict
import numpy as np
import torch
from termcolor import colored
from torch.utils.tensorboard import SummaryWriter
from common import utils
class Manager():
def __init__(self, model, optimizer, scheduler, params, dataloaders, logger):
# params stat... | 45.077206 | 136 | 0.581437 | import os
from collections import defaultdict
import numpy as np
import torch
from termcolor import colored
from torch.utils.tensorboard import SummaryWriter
from common import utils
class Manager():
def __init__(self, model, optimizer, scheduler, params, dataloaders, logger):
self... | true | true |
f70f8c67ca5c8f4c4bc0844a6821081bdf4ce0d1 | 33,589 | py | Python | Cogs/Strike.py | camielverdult/CorpBot.py | 56cf3ee736625525d05f9f447b31e34baf93596d | [
"MIT"
] | null | null | null | Cogs/Strike.py | camielverdult/CorpBot.py | 56cf3ee736625525d05f9f447b31e34baf93596d | [
"MIT"
] | null | null | null | Cogs/Strike.py | camielverdult/CorpBot.py | 56cf3ee736625525d05f9f447b31e34baf93596d | [
"MIT"
] | null | null | null | import asyncio
import discord
import time
import parsedatetime
from datetime import datetime
from operator import itemgetter
from discord.ext import commands
from Cogs import ReadableTime
from Cogs import DisplayName
from Cogs import Nullify
def setup(bot):
# Add the bot and deps
settings = bot.... | 42.46397 | 139 | 0.541397 | import asyncio
import discord
import time
import parsedatetime
from datetime import datetime
from operator import itemgetter
from discord.ext import commands
from Cogs import ReadableTime
from Cogs import DisplayName
from Cogs import Nullify
def setup(bot):
settings = bot.get_cog("Settings")
... | true | true |
f70f8da0066e2601d4d7d9e6e313a05b5a080127 | 19,727 | py | Python | src/watchdog/observers/inotify_c.py | rec/watchdog | 0224e4424daea365a41125c6691c3477ee1bf86f | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | src/watchdog/observers/inotify_c.py | rec/watchdog | 0224e4424daea365a41125c6691c3477ee1bf86f | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | src/watchdog/observers/inotify_c.py | rec/watchdog | 0224e4424daea365a41125c6691c3477ee1bf86f | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
#
# Copyright 2011 Yesudeep Mangalapilly <yesudeep@gmail.com>
# Copyright 2012 Google, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.o... | 33.54932 | 114 | 0.596441 |
from __future__ import with_statement
import os
import errno
import struct
import threading
import ctypes
import ctypes.util
from functools import reduce
from ctypes import c_int, c_char_p, c_uint32
from watchdog.utils import has_attribute
from watchdog.utils import UnsupportedLibc
from watchdog.utils.... | true | true |
f70f8e73132e3e8bee5eadba32f1938ebaba2aa7 | 319 | py | Python | example/routes.py | fitahol/aiohttprest | b9f1a386b22ad03e53f2f0e74ed3b29da5bcc220 | [
"Apache-2.0"
] | 1 | 2017-03-14T23:39:55.000Z | 2017-03-14T23:39:55.000Z | example/routes.py | fitahol/aiohttprest | b9f1a386b22ad03e53f2f0e74ed3b29da5bcc220 | [
"Apache-2.0"
] | null | null | null | example/routes.py | fitahol/aiohttprest | b9f1a386b22ad03e53f2f0e74ed3b29da5bcc220 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# coding=utf-8
"""
__created__ = '06/01/2017'
__author__ = 'deling.ma'
"""
from aio_rest.routes import RouteCollector, Route
from example.views import publish, IndexView
routes = RouteCollector(prefix='/app', routes=[
Route('/', IndexView),
Route('/publish', publish, method='GET'),
])
| 19.9375 | 49 | 0.689655 |
from aio_rest.routes import RouteCollector, Route
from example.views import publish, IndexView
routes = RouteCollector(prefix='/app', routes=[
Route('/', IndexView),
Route('/publish', publish, method='GET'),
])
| true | true |
f70f8ec2299360b366ee181be4fd170341ad6326 | 869 | py | Python | Inflearn_SungKim/1.LinearRegression/LinearRegression(placeholders).py | shinhaha/tensorflow | 4647017a727985d64c5b0addee92f0ec516952c1 | [
"MIT"
] | null | null | null | Inflearn_SungKim/1.LinearRegression/LinearRegression(placeholders).py | shinhaha/tensorflow | 4647017a727985d64c5b0addee92f0ec516952c1 | [
"MIT"
] | null | null | null | Inflearn_SungKim/1.LinearRegression/LinearRegression(placeholders).py | shinhaha/tensorflow | 4647017a727985d64c5b0addee92f0ec516952c1 | [
"MIT"
] | null | null | null | import tensorflow as tf
#placeholder variable(scalar)
X=tf.placeholder(tf.float32,shape=[None])
Y=tf.placeholder(tf.float32,shape=[None])
W=tf.Variable(tf.random_normal([1]),name='weight')
b=tf.Variable(tf.random_normal([1]),name='bias')
hypothesis=X*W+b
#average
cost=tf.reduce_mean(tf.square(hypothesis-Y))
optimiz... | 27.15625 | 63 | 0.727273 | import tensorflow as tf
X=tf.placeholder(tf.float32,shape=[None])
Y=tf.placeholder(tf.float32,shape=[None])
W=tf.Variable(tf.random_normal([1]),name='weight')
b=tf.Variable(tf.random_normal([1]),name='bias')
hypothesis=X*W+b
cost=tf.reduce_mean(tf.square(hypothesis-Y))
optimizer=tf.train.GradientDescentOptimizer(... | true | true |
f70f8f560c5f80a9cb4578a691c38108667a8423 | 1,211 | py | Python | deel/model/lstm.py | ghelia/deel | 6ff67d7246daf12d1884357010dd82842fbc31d1 | [
"MIT"
] | null | null | null | deel/model/lstm.py | ghelia/deel | 6ff67d7246daf12d1884357010dd82842fbc31d1 | [
"MIT"
] | null | null | null | deel/model/lstm.py | ghelia/deel | 6ff67d7246daf12d1884357010dd82842fbc31d1 | [
"MIT"
] | null | null | null | import chainer
import chainer.functions as F
import chainer.links as L
"""
Based on chainer official example
https://github.com/pfnet/chainer/tree/master/examples/ptb
Modified by shi3z March 28,2016
"""
class RNNLM(chainer.Chain):
"""Recurrent neural net languabe model for penn tree bank corpus.
This is... | 28.162791 | 80 | 0.618497 | import chainer
import chainer.functions as F
import chainer.links as L
class RNNLM(chainer.Chain):
def __init__(self, n_input_units=1000,n_vocab=100, n_units=100, train=True):
super(RNNLM, self).__init__(
inputVector= L.Linear(n_input_units, n_units),
embed=L.EmbedID(n_vocab, n_uni... | true | true |
f70f910ce1791081915a783482feb7b0db02c894 | 5,716 | py | Python | src/films/tests/test_hdrfilm.py | tizian/layer-laboratory | 008cc94b76127e9eb74227fcd3d0145da8ddec30 | [
"CNRI-Python"
] | 7 | 2020-07-24T03:19:59.000Z | 2022-03-30T10:56:12.000Z | src/films/tests/test_hdrfilm.py | tizian/layer-laboratory | 008cc94b76127e9eb74227fcd3d0145da8ddec30 | [
"CNRI-Python"
] | 1 | 2021-04-07T22:30:23.000Z | 2021-04-08T00:55:36.000Z | src/films/tests/test_hdrfilm.py | tizian/layer-laboratory | 008cc94b76127e9eb74227fcd3d0145da8ddec30 | [
"CNRI-Python"
] | 2 | 2020-06-08T08:25:09.000Z | 2021-04-05T22:13:08.000Z | import mitsuba
import pytest
import os
import enoki as ek
def test01_construct(variant_scalar_rgb):
from mitsuba.core.xml import load_string
# With default reconstruction filter
film = load_string("""<film version="2.0.0" type="hdrfilm"></film>""")
assert film is not None
assert film.reconstructi... | 39.42069 | 101 | 0.603569 | import mitsuba
import pytest
import os
import enoki as ek
def test01_construct(variant_scalar_rgb):
from mitsuba.core.xml import load_string
film = load_string("""<film version="2.0.0" type="hdrfilm"></film>""")
assert film is not None
assert film.reconstruction_filter() is not None
fi... | true | true |
f70f925d50a5f908572efb96b2f9609c818088a6 | 2,959 | py | Python | tests/test_inline_functions/test_query.py | pyansys/pyansys | adf51893be746c632f40a9dc8c9247dbee138dda | [
"MIT"
] | 1 | 2021-08-19T14:08:34.000Z | 2021-08-19T14:08:34.000Z | tests/test_inline_functions/test_query.py | pyansys/pyansys | adf51893be746c632f40a9dc8c9247dbee138dda | [
"MIT"
] | null | null | null | tests/test_inline_functions/test_query.py | pyansys/pyansys | adf51893be746c632f40a9dc8c9247dbee138dda | [
"MIT"
] | null | null | null | import pytest
class TestParseParameter:
@pytest.mark.parametrize(
"values",
[
("PARAMETER test = 4", 4.0),
("PARAMETER=4", 4.0),
("PARAMETER WARNING = 4", 4.0),
("PARAMETER = _=4", 4.0),
("WARNING = PARAMETER = 4", 4.0),
("PAR... | 32.516484 | 79 | 0.57756 | import pytest
class TestParseParameter:
@pytest.mark.parametrize(
"values",
[
("PARAMETER test = 4", 4.0),
("PARAMETER=4", 4.0),
("PARAMETER WARNING = 4", 4.0),
("PARAMETER = _=4", 4.0),
("WARNING = PARAMETER = 4", 4.0),
("PAR... | true | true |
f70f94b36a95bfd5abb974ec2563582a58d0197b | 169 | py | Python | app/src/imports/requests.py | jkulak/spotify-grabtrack | e6cd16709195ca6d2e186a3b8cc7ce1419b6aace | [
"MIT"
] | null | null | null | app/src/imports/requests.py | jkulak/spotify-grabtrack | e6cd16709195ca6d2e186a3b8cc7ce1419b6aace | [
"MIT"
] | 13 | 2022-02-10T20:07:49.000Z | 2022-03-27T20:07:21.000Z | app/src/imports/requests.py | jkulak/spotify-grabtrack | e6cd16709195ca6d2e186a3b8cc7ce1419b6aace | [
"MIT"
] | null | null | null | import requests_cache
from requests_cache import SQLiteCache
requests_cache.install_cache(
"grabtrack_sqlite_cache", SQLiteCache("spotify_api_cache", timeout=30)
)
| 24.142857 | 74 | 0.83432 | import requests_cache
from requests_cache import SQLiteCache
requests_cache.install_cache(
"grabtrack_sqlite_cache", SQLiteCache("spotify_api_cache", timeout=30)
)
| true | true |
f70f95230083e964837c7ccf662a8d3e815a9abf | 3,469 | py | Python | gui/mon/views.py | erigones/esdc-ce | 2e39211a8f5132d66e574d3a657906c7d3c406fe | [
"Apache-2.0"
] | 97 | 2016-11-15T14:44:23.000Z | 2022-03-13T18:09:15.000Z | gui/mon/views.py | erigones/esdc-ce | 2e39211a8f5132d66e574d3a657906c7d3c406fe | [
"Apache-2.0"
] | 334 | 2016-11-17T19:56:57.000Z | 2022-03-18T10:45:53.000Z | gui/mon/views.py | erigones/esdc-ce | 2e39211a8f5132d66e574d3a657906c7d3c406fe | [
"Apache-2.0"
] | 33 | 2017-01-02T16:04:13.000Z | 2022-02-07T19:20:24.000Z | import json
from re import match
from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_POST
from django.shortcuts import redirect, render
from gui.mon.forms import BaseAlertFilterForm
from gui.utils import collect_view_data
from gui.decorators import ajax_required,... | 29.649573 | 86 | 0.742289 | import json
from re import match
from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_POST
from django.shortcuts import redirect, render
from gui.mon.forms import BaseAlertFilterForm
from gui.utils import collect_view_data
from gui.decorators import ajax_required,... | true | true |
f70f9523490f01a422da6c46e57bf7055ca504f2 | 515 | py | Python | ucp_intro/07_mad_lib_game.py | matiasmasca/python | 7631583820d51e3132bdb793fed28cc83f4877a2 | [
"MIT"
] | null | null | null | ucp_intro/07_mad_lib_game.py | matiasmasca/python | 7631583820d51e3132bdb793fed28cc83f4877a2 | [
"MIT"
] | null | null | null | ucp_intro/07_mad_lib_game.py | matiasmasca/python | 7631583820d51e3132bdb793fed28cc83f4877a2 | [
"MIT"
] | null | null | null | # Primer juego...
print("Mi poesia:")
print("Las rosas son Rojas")
print("Las violetas son Azules")
print("Y yo te amo a ti")
# Mad Libs
# ingresar palabras random, adjetivos, verbos, sustantivos.
print("Ahora te toca a vos")
print("")
color = input("Ingrese un color: ")
sustantivo_plular = input("Ingrese un sustanti... | 24.52381 | 62 | 0.702913 |
print("Mi poesia:")
print("Las rosas son Rojas")
print("Las violetas son Azules")
print("Y yo te amo a ti")
print("Ahora te toca a vos")
print("")
color = input("Ingrese un color: ")
sustantivo_plular = input("Ingrese un sustantivo en plural: ")
celebridad = input("Ingrese el nombre de una celebridad: ")
print("... | true | true |
f70f96b662e9909e240adb12a588cfe7baf1df63 | 14,338 | py | Python | src/pytorch_metric_learning/utils/logging_presets.py | kvzhao/pytorch-metric-learning | 9c8a94bd1a906317d5834f26d8a94e59d578b825 | [
"MIT"
] | 2 | 2020-08-11T03:42:15.000Z | 2022-01-11T07:25:30.000Z | src/pytorch_metric_learning/utils/logging_presets.py | FadouaKhm/pytorch-metric-learning | 9eb792bcfc1616b599e6ee457514e3cb3a7235dd | [
"MIT"
] | null | null | null | src/pytorch_metric_learning/utils/logging_presets.py | FadouaKhm/pytorch-metric-learning | 9eb792bcfc1616b599e6ee457514e3cb3a7235dd | [
"MIT"
] | 1 | 2021-03-15T04:24:52.000Z | 2021-03-15T04:24:52.000Z | import logging
from . import common_functions as c_f
import os
import torch
from collections import defaultdict
import sqlite3
# You can write your own hooks for logging.
# But if you'd like something that just works, then use this HookContainer.
# You'll need to install record-keeper and tensorboard.
# pip ... | 52.328467 | 160 | 0.625122 | import logging
from . import common_functions as c_f
import os
import torch
from collections import defaultdict
import sqlite3
# You'll need to install record-keeper and tensorboard.
class HookContainer:
def __init__(self, record_keeper,
record_group_name_prefix=None,
... | true | true |
f70f96f0024b1699103a63385d86facba9fae422 | 9,937 | py | Python | xfer/contrib/xfer_leap/synthetic_data.py | apaleyes/xfer | 99cd83424bc7e76a2c2def9d5b1dacd06f6e9eb5 | [
"Apache-2.0"
] | null | null | null | xfer/contrib/xfer_leap/synthetic_data.py | apaleyes/xfer | 99cd83424bc7e76a2c2def9d5b1dacd06f6e9eb5 | [
"Apache-2.0"
] | null | null | null | xfer/contrib/xfer_leap/synthetic_data.py | apaleyes/xfer | 99cd83424bc7e76a2c2def9d5b1dacd06f6e9eb5 | [
"Apache-2.0"
] | null | null | null | # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in th... | 39.748 | 118 | 0.603301 |
import os
import random
import numpy as np
import matplotlib.pyplot as plt
from mxnet.gluon.data import ArrayDataset
import mxnet
from .data import MetaTaskDataContainer, TaskDataContainer
from .config import DEFAULT_CONFIG_SYNTHETIC
class MetaTaskSynthetic(MetaTaskDataContainer):
def __init__(self... | true | true |
f70f977c652da15ff9173d2b3951c11786d65299 | 6,282 | py | Python | solution/10. regular-expression-match.py | sundaycat/Leetcode-Practice | 65c3ab0f967331a095fd8a6eb2f3d7765cbf7d5a | [
"MIT"
] | null | null | null | solution/10. regular-expression-match.py | sundaycat/Leetcode-Practice | 65c3ab0f967331a095fd8a6eb2f3d7765cbf7d5a | [
"MIT"
] | null | null | null | solution/10. regular-expression-match.py | sundaycat/Leetcode-Practice | 65c3ab0f967331a095fd8a6eb2f3d7765cbf7d5a | [
"MIT"
] | null | null | null | '''
A: suffix solution
1. subproblems: define dp(i, j) = is_match(s[i:], p[j:]), suffix
2. guess,
2.1 the current char in p is a '*'
- use '*', repeat the char before it
- do not use '*', skip to next char after '*'
2.2 current char in s and p are match, s[i] == p[j] or ... | 32.381443 | 109 | 0.446832 | class Solution:
def isMatch(self, s: str, p: str) -> bool:
return self.dp_bottom_up_suffix(s, p)
def dfs_suffix(self, s, p, i, j, memo):
if (i, j) in memo:
return memo[(i, j)]
if i >= len(s) and... | true | true |
f70f988e2189afa8f9091db3302eee4536752431 | 5,172 | py | Python | opentamp/src/policy_hooks/vae/run_training.py | Algorithmic-Alignment-Lab/openTAMP-legacy | 3b7c3be164cc968ad77a928286d6460cd70a670e | [
"MIT"
] | 2 | 2022-03-09T19:48:20.000Z | 2022-03-26T17:31:07.000Z | opentamp/src/policy_hooks/vae/run_training.py | Algorithmic-Alignment-Lab/OpenTAMP | eecb950bd273da8cbed4394487630e8453f2c242 | [
"MIT"
] | null | null | null | opentamp/src/policy_hooks/vae/run_training.py | Algorithmic-Alignment-Lab/OpenTAMP | eecb950bd273da8cbed4394487630e8453f2c242 | [
"MIT"
] | null | null | null | import argparse
import imp
import importlib
import random
from opentamp.src.policy_hooks.vae.vae_main import MultiProcessMain
def load_config(args, reload_module=None):
config_file = args.config
if config_file != '':
if reload_module is not None:
config_module = reload_module
... | 45.769912 | 130 | 0.683875 | import argparse
import imp
import importlib
import random
from opentamp.src.policy_hooks.vae.vae_main import MultiProcessMain
def load_config(args, reload_module=None):
config_file = args.config
if config_file != '':
if reload_module is not None:
config_module = reload_module
... | true | true |
f70f9b444405e0c9fb473ff45e8dc0b8422e10c7 | 2,325 | py | Python | tests/test_action_tag_category_create.py | lingfish/stackstorm-vsphere | 49199f5ebdc05b70b7504962e104642b0c30ba30 | [
"Apache-2.0"
] | null | null | null | tests/test_action_tag_category_create.py | lingfish/stackstorm-vsphere | 49199f5ebdc05b70b7504962e104642b0c30ba30 | [
"Apache-2.0"
] | 2 | 2019-03-25T18:03:02.000Z | 2019-03-26T13:13:59.000Z | tests/test_action_tag_category_create.py | lingfish/stackstorm-vsphere | 49199f5ebdc05b70b7504962e104642b0c30ba30 | [
"Apache-2.0"
] | 1 | 2021-03-05T10:12:21.000Z | 2021-03-05T10:12:21.000Z | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | 38.114754 | 79 | 0.669247 |
import mock
from tag_category_create import CategoryCreate
from vsphere_base_action_test_case import VsphereBaseActionTestCase
__all__ = [
'CategoryCreateTestCase'
]
class CategoryCreateTestCase(VsphereBaseActionTestCase):
__test__ = True
action_cls = CategoryCreate
@mock.patch("vmwar... | true | true |
f70f9c881df168564cbf2431bbc2ebdf7e7f7ded | 18,480 | py | Python | tensorflow/contrib/data/python/ops/readers.py | idharmateja/tensorflow | 4e108ef30d7cd7ae5e1c550ec5ae27e79b8c6e39 | [
"Apache-2.0"
] | 13 | 2018-07-23T18:53:35.000Z | 2021-11-18T19:56:45.000Z | tensorflow/contrib/data/python/ops/readers.py | DandelionCN/tensorflow | 1712002ad02f044f7569224bf465e0ea00e6a6c4 | [
"Apache-2.0"
] | null | null | null | tensorflow/contrib/data/python/ops/readers.py | DandelionCN/tensorflow | 1712002ad02f044f7569224bf465e0ea00e6a6c4 | [
"Apache-2.0"
] | 13 | 2018-09-07T13:28:38.000Z | 2020-07-17T15:06:24.000Z | # Copyright 2017 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... | 39.152542 | 80 | 0.676082 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.data.python.ops import interleave_ops
from tensorflow.contrib.data.python.ops import shuffle_ops
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.d... | true | true |
f70f9fbd792e49e3bb17519f8daf955fc3b614b8 | 3,041 | py | Python | projects/api/main.py | lborro/projects | c971c2fc65cdb09310d0b3782cd7119203aa4db3 | [
"Apache-2.0"
] | null | null | null | projects/api/main.py | lborro/projects | c971c2fc65cdb09310d0b3782cd7119203aa4db3 | [
"Apache-2.0"
] | null | null | null | projects/api/main.py | lborro/projects | c971c2fc65cdb09310d0b3782cd7119203aa4db3 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""WSGI server."""
import argparse
import sys
from flask import Flask, jsonify
from flask_cors import CORS
from werkzeug.exceptions import BadRequest, NotFound, MethodNotAllowed, \
Forbidden, InternalServerError
from projects.api.compare_results import bp as compare_results_blueprint
from ... | 33.054348 | 100 | 0.74515 |
import argparse
import sys
from flask import Flask, jsonify
from flask_cors import CORS
from werkzeug.exceptions import BadRequest, NotFound, MethodNotAllowed, \
Forbidden, InternalServerError
from projects.api.compare_results import bp as compare_results_blueprint
from projects.api.experiments import bp as expe... | true | true |
f70fa0d1d8aad41a969517b69bc42c6dd87cbd53 | 2,411 | py | Python | codes/preprocess/collect_noise.py | yicrane/Real-SR | a6e380b791129b80fe58bf282089c0cfd9159b36 | [
"Apache-2.0"
] | null | null | null | codes/preprocess/collect_noise.py | yicrane/Real-SR | a6e380b791129b80fe58bf282089c0cfd9159b36 | [
"Apache-2.0"
] | null | null | null | codes/preprocess/collect_noise.py | yicrane/Real-SR | a6e380b791129b80fe58bf282089c0cfd9159b36 | [
"Apache-2.0"
] | 1 | 2021-07-07T13:56:30.000Z | 2021-07-07T13:56:30.000Z | from PIL import Image
import numpy as np
import os.path as osp
import glob
import os
import argparse
import yaml
parser = argparse.ArgumentParser(description='create a dataset')
parser.add_argument('--dataset', default='df2k', type=str, help='selecting different datasets')
parser.add_argument('--artifacts', default=''... | 33.957746 | 113 | 0.623393 | from PIL import Image
import numpy as np
import os.path as osp
import glob
import os
import argparse
import yaml
parser = argparse.ArgumentParser(description='create a dataset')
parser.add_argument('--dataset', default='df2k', type=str, help='selecting different datasets')
parser.add_argument('--artifacts', default=''... | true | true |
f70fa0e5384e444c718b501e35ff39db46d5b99a | 6,872 | py | Python | pennylane/transforms/__init__.py | XanaduAI/pennylane | 0620b8a8bb56ff55bfc2130619fa0a5a1af2b2a4 | [
"Apache-2.0"
] | 539 | 2018-11-13T08:45:42.000Z | 2020-07-27T18:17:16.000Z | pennylane/transforms/__init__.py | XanaduAI/pennylane | 0620b8a8bb56ff55bfc2130619fa0a5a1af2b2a4 | [
"Apache-2.0"
] | 588 | 2018-11-14T10:21:47.000Z | 2020-07-28T06:27:14.000Z | pennylane/transforms/__init__.py | XanaduAI/pennylane | 0620b8a8bb56ff55bfc2130619fa0a5a1af2b2a4 | [
"Apache-2.0"
] | 165 | 2018-11-13T18:58:56.000Z | 2020-07-27T17:18:17.000Z | # Copyright 2018-2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or... | 30.008734 | 113 | 0.766589 |
from .batch_transform import batch_transform, map_batch_transform
from .qfunc_transforms import make_tape, single_tape_transform, qfunc_transform
from .op_transforms import op_transform
from .adjoint import adjoint
from .batch_params import batch_params
from .batch_input import batch_input
from .classical... | true | true |
f70fa191b2427b7e00ffd7084a2710be0b35e10c | 10,735 | py | Python | src/m3_calling_functions_returning_values.py | DavidMutchler/03-AccumulatorsAndFunctionsWithParameters | 548b9a527357e4a18c6ab3e0cc84c907c6e33d87 | [
"MIT"
] | null | null | null | src/m3_calling_functions_returning_values.py | DavidMutchler/03-AccumulatorsAndFunctionsWithParameters | 548b9a527357e4a18c6ab3e0cc84c907c6e33d87 | [
"MIT"
] | null | null | null | src/m3_calling_functions_returning_values.py | DavidMutchler/03-AccumulatorsAndFunctionsWithParameters | 548b9a527357e4a18c6ab3e0cc84c907c6e33d87 | [
"MIT"
] | 66 | 2018-03-08T12:57:23.000Z | 2020-11-09T18:59:08.000Z | """
This module demonstrates and practices:
-- using ARGUMENTs in function CALLs,
-- having PARAMETERs in function DEFINITIONs, and
-- RETURNING a value from a function,
possibly CAPTURING the RETURNED VALUE in a VARIABLE.
-- UNIT TESTING.
Authors: David Mutchler, Valerie Galluzzi, Mark Hays, Amanda St... | 41.447876 | 77 | 0.469213 |
import m3t_tester
def main():
run_test_sum_of_digits()
run_test_digits_in_cube()
run_test_digits_in_power()
run_test_fancy_sums_of_digits()
def run_test_sum_of_digits():
... | true | true |
f70fa2944e0e3fcde401f3381a70b6633f36db93 | 5,384 | py | Python | indieauth/views.py | wivn/feed-reader | 1b4524fcdfc79391a5cf982ce9c5681e600f4303 | [
"MIT"
] | null | null | null | indieauth/views.py | wivn/feed-reader | 1b4524fcdfc79391a5cf982ce9c5681e600f4303 | [
"MIT"
] | null | null | null | indieauth/views.py | wivn/feed-reader | 1b4524fcdfc79391a5cf982ce9c5681e600f4303 | [
"MIT"
] | null | null | null | from django.shortcuts import render, HttpResponseRedirect
from django.urls import reverse
from urllib.parse import urlencode, unquote
import requests
from bs4 import BeautifulSoup
from django.utils.crypto import get_random_string
from django.contrib import messages
from urllib.parse import urlparse, urljoin
from django... | 40.481203 | 120 | 0.717125 | from django.shortcuts import render, HttpResponseRedirect
from django.urls import reverse
from urllib.parse import urlencode, unquote
import requests
from bs4 import BeautifulSoup
from django.utils.crypto import get_random_string
from django.contrib import messages
from urllib.parse import urlparse, urljoin
from django... | true | true |
f70fa2ec4e8ddf2e3938910c093b9fd6af4215c2 | 8,957 | py | Python | mpf/devices/switch.py | cloudjor/mpf | 1cf6bf18b0d81120383b0b128b0ebbfa1c62717c | [
"MIT"
] | null | null | null | mpf/devices/switch.py | cloudjor/mpf | 1cf6bf18b0d81120383b0b128b0ebbfa1c62717c | [
"MIT"
] | null | null | null | mpf/devices/switch.py | cloudjor/mpf | 1cf6bf18b0d81120383b0b128b0ebbfa1c62717c | [
"MIT"
] | null | null | null | """Contains the Switch parent class."""
import asyncio
from functools import partial
from mpf.core.device_monitor import DeviceMonitor
from mpf.core.machine import MachineController
from mpf.core.system_wide_device import SystemWideDevice
from mpf.core.utility_functions import Util
from mpf.core.platform import Switch... | 43.692683 | 119 | 0.635927 | import asyncio
from functools import partial
from mpf.core.device_monitor import DeviceMonitor
from mpf.core.machine import MachineController
from mpf.core.system_wide_device import SystemWideDevice
from mpf.core.utility_functions import Util
from mpf.core.platform import SwitchConfig
from mpf.devices.device_mixins im... | true | true |
f70fa4716a8ad9de69464eb03d1b8acc667bcf25 | 8,629 | py | Python | lucida/speechrecognition/kaldi_gstreamer_asr/kaldigstserver/decoder2.py | extremenelson/sirius | 0bad428bb763fe404d01db5d9e08ee33a8f3776c | [
"BSD-3-Clause"
] | 1,808 | 2015-12-23T09:38:57.000Z | 2022-03-24T05:55:03.000Z | lucida/speechrecognition/kaldi_gstreamer_asr/kaldigstserver/decoder2.py | extremenelson/sirius | 0bad428bb763fe404d01db5d9e08ee33a8f3776c | [
"BSD-3-Clause"
] | 164 | 2015-12-22T17:32:16.000Z | 2022-01-30T16:19:28.000Z | lucida/speechrecognition/kaldi_gstreamer_asr/kaldigstserver/decoder2.py | mrinformatics/lucida1604 | f17fba20be9765c3464437f40e97278bba29b9d5 | [
"BSD-3-Clause"
] | 554 | 2015-12-23T11:29:34.000Z | 2022-02-08T05:31:49.000Z | """
Created on May 17, 2013
@author: tanel
"""
import gi
gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst
GObject.threads_init()
Gst.init(None)
import logging
import thread
import os
logger = logging.getLogger(__name__)
import pdb
class DecoderPipeline2(object):
def __init__(self, conf=... | 38.013216 | 106 | 0.644918 | import gi
gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst
GObject.threads_init()
Gst.init(None)
import logging
import thread
import os
logger = logging.getLogger(__name__)
import pdb
class DecoderPipeline2(object):
def __init__(self, conf={}):
logger.info("Creating decoder using... | true | true |
f70fa47cf19e266644db800bdfe629f660dc9d2e | 419 | py | Python | Mundo 2 - Exercicios/61Exercicio.py | andrezzadede/Curso_Python_Guanabara_Mundo_2 | e4ebf171f74809f8a65e846c59978db95c5d3b1b | [
"MIT"
] | null | null | null | Mundo 2 - Exercicios/61Exercicio.py | andrezzadede/Curso_Python_Guanabara_Mundo_2 | e4ebf171f74809f8a65e846c59978db95c5d3b1b | [
"MIT"
] | null | null | null | Mundo 2 - Exercicios/61Exercicio.py | andrezzadede/Curso_Python_Guanabara_Mundo_2 | e4ebf171f74809f8a65e846c59978db95c5d3b1b | [
"MIT"
] | null | null | null | print('---------- Bem vindo ao exercicio 61 ------')
print('\033[32m Reçaca o desafio 51. Lendo o primeiro termo e a razao de uma PA. Mostrando os 10 primeiros termos da progressa usando a estrutura while\033[m')
primeiro = int(input('Primeiro termo: '))
razao = int(input('Razão: '))
termo = primeiro
c = 1
while c... | 18.217391 | 159 | 0.618138 | print('---------- Bem vindo ao exercicio 61 ------')
print('\033[32m Reçaca o desafio 51. Lendo o primeiro termo e a razao de uma PA. Mostrando os 10 primeiros termos da progressa usando a estrutura while\033[m')
primeiro = int(input('Primeiro termo: '))
razao = int(input('Razão: '))
termo = primeiro
c = 1
while c... | true | true |
f70fa4df361d80f9ecacef1088f93b318fd49fe6 | 2,056 | py | Python | docs/conf.py | Moody-Tunes/spotify-client | 496c72d915d92c29795a31a18cc9af26a9015b4b | [
"MIT"
] | 1 | 2020-12-21T02:35:18.000Z | 2020-12-21T02:35:18.000Z | docs/conf.py | Moody-Tunes/spotify-client | 496c72d915d92c29795a31a18cc9af26a9015b4b | [
"MIT"
] | 9 | 2020-09-04T15:35:23.000Z | 2021-04-24T02:10:56.000Z | docs/conf.py | Moody-Tunes/spotify-client | 496c72d915d92c29795a31a18cc9af26a9015b4b | [
"MIT"
] | 2 | 2020-12-21T02:35:24.000Z | 2020-12-29T07:38:16.000Z | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If exte... | 35.448276 | 79 | 0.669747 |
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
project = 'spotify-client'
copyright = '2020, MoodyTunes'
author = 'MoodyTunes'
with open("../VERSION", "r") as version_file:
version = version_file.read().strip()
release = version
extensions = ['sphinx.ext.autodoc']
pygments_s... | true | true |
f70fa5c21d44574a534aa9a438155cd0428d003d | 946 | py | Python | decorator/send_commands_netmiko.py | levs72/pyneng-examples | d6288292dcf9d1ebc5a9db4a0d620bd11b4a2df9 | [
"MIT"
] | 11 | 2021-04-05T09:30:23.000Z | 2022-03-09T13:27:56.000Z | decorator/send_commands_netmiko.py | levs72/pyneng-examples | d6288292dcf9d1ebc5a9db4a0d620bd11b4a2df9 | [
"MIT"
] | null | null | null | decorator/send_commands_netmiko.py | levs72/pyneng-examples | d6288292dcf9d1ebc5a9db4a0d620bd11b4a2df9 | [
"MIT"
] | 11 | 2021-04-06T03:44:35.000Z | 2022-03-04T21:20:40.000Z | from netmiko import ConnectHandler
import yaml
from pprint import pprint
def send_show_command(device, show_command):
with ConnectHandler(**device) as ssh:
ssh.enable()
result = ssh.send_command(show_command)
return result
def send_config_commands(device, config_commands):
with ConnectHa... | 27.028571 | 87 | 0.707188 | from netmiko import ConnectHandler
import yaml
from pprint import pprint
def send_show_command(device, show_command):
with ConnectHandler(**device) as ssh:
ssh.enable()
result = ssh.send_command(show_command)
return result
def send_config_commands(device, config_commands):
with ConnectHa... | true | true |
f70fa6b243087d007e8f52414d27fa83ded92b20 | 2,335 | py | Python | venv/Lib/site-packages/IPython/html/widgets/widget_container.py | Tyranicangel/dtrans | a5e23d200a310701bb357bff09e35a5629a3f7a3 | [
"BSD-3-Clause"
] | 8 | 2021-12-14T21:30:01.000Z | 2022-02-14T11:30:03.000Z | IPython/html/widgets/widget_container.py | khinsen/ipython | dfd5cb1d3e34048593ba537dacdbef08fe766624 | [
"BSD-3-Clause-Clear"
] | 1 | 2021-09-11T14:30:32.000Z | 2021-09-11T14:30:32.000Z | IPython/html/widgets/widget_container.py | khinsen/ipython | dfd5cb1d3e34048593ba537dacdbef08fe766624 | [
"BSD-3-Clause-Clear"
] | 2 | 2016-12-19T02:27:46.000Z | 2019-07-29T02:53:54.000Z | """ContainerWidget class.
Represents a container that can be used to group other widgets.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the ... | 37.063492 | 82 | 0.544325 |
from .widget import DOMWidget
from IPython.utils.traitlets import Unicode, Tuple, TraitError
class ContainerWidget(DOMWidget):
_view_name = Unicode('ContainerView', sync=True)
children = Tuple()
_children = Tuple(sync=True)
def __init__(self, **kwargs):
super(Co... | true | true |
f70fa6ee938b2345b273950c3d615a8cb65e74f1 | 3,036 | py | Python | inst/CnaAnnotator.py | jalavery/gnomeR | b0031bd5eb1c8c5636910d0b779a8808947245f5 | [
"MIT"
] | 15 | 2020-02-20T18:20:15.000Z | 2021-12-23T08:49:09.000Z | inst/CnaAnnotator.py | jalavery/gnomeR | b0031bd5eb1c8c5636910d0b779a8808947245f5 | [
"MIT"
] | 36 | 2020-02-21T20:23:41.000Z | 2022-03-04T21:12:44.000Z | inst/CnaAnnotator.py | MSKCC-Epi-Bio/gnomeR | 4f165774eb3c5f442881a915ee70e18a5f33b387 | [
"MIT"
] | 9 | 2020-02-17T23:43:35.000Z | 2022-03-21T12:01:36.000Z | import argparse
# from AnnotatorCore import *
import sys
import csv
import requests
import os.path
import logging
import re
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from datetime import date
import logging
logging.basicConfig(level=logging.INFO)
log = logging.getLogger('CnaAnnotator')
d... | 44.647059 | 239 | 0.693676 | import argparse
import sys
import csv
import requests
import os.path
import logging
import re
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from datetime import date
import logging
logging.basicConfig(level=logging.INFO)
log = logging.getLogger('CnaAnnotator')
def main(argv):
if argv.he... | true | true |
f70fa803280ab9f216b7ca2a38b01efb67cd1f5e | 3,693 | py | Python | tmot/matching.py | JunweiLiang/Object_Detection_Tracking | f86caaec97669a6da56f1b402cca4e179a85d2f0 | [
"MIT"
] | 328 | 2019-05-27T03:09:02.000Z | 2022-03-31T05:12:04.000Z | tmot/matching.py | AnjaliPC/Object_Detection_Tracking | f86caaec97669a6da56f1b402cca4e179a85d2f0 | [
"MIT"
] | 43 | 2019-06-05T14:04:09.000Z | 2022-01-25T03:16:39.000Z | tmot/matching.py | AnjaliPC/Object_Detection_Tracking | f86caaec97669a6da56f1b402cca4e179a85d2f0 | [
"MIT"
] | 107 | 2019-05-27T06:26:38.000Z | 2022-03-25T03:32:58.000Z | import numpy as np
import scipy
from scipy.spatial.distance import cdist
import lap # 0.4.0
from cython_bbox import bbox_overlaps as bbox_ious
from . import kalman_filter
def merge_matches(m1, m2, shape):
O,P,Q = shape
m1 = np.asarray(m1)
m2 = np.asarray(m2)
M1 = scipy.sparse.coo_matrix... | 33.572727 | 125 | 0.638776 | import numpy as np
import scipy
from scipy.spatial.distance import cdist
import lap
from cython_bbox import bbox_overlaps as bbox_ious
from . import kalman_filter
def merge_matches(m1, m2, shape):
O,P,Q = shape
m1 = np.asarray(m1)
m2 = np.asarray(m2)
M1 = scipy.sparse.coo_matrix((np.one... | true | true |
f70fa88268e7f2a8c55619f7c4dd3c7747d1770a | 149 | py | Python | tardis/io/setup_package.py | chvogl/tardis | e444ffeebef92811165ec982a5c23785932a7f8e | [
"BSD-3-Clause"
] | 1 | 2016-03-24T13:14:25.000Z | 2016-03-24T13:14:25.000Z | tardis/io/setup_package.py | chvogl/tardis | e444ffeebef92811165ec982a5c23785932a7f8e | [
"BSD-3-Clause"
] | 6 | 2015-03-16T10:31:40.000Z | 2019-02-21T17:56:55.000Z | tardis/io/setup_package.py | chvogl/tardis | e444ffeebef92811165ec982a5c23785932a7f8e | [
"BSD-3-Clause"
] | 5 | 2015-03-17T18:56:20.000Z | 2019-02-12T12:53:15.000Z | # Licensed under a 3-clause BSD style license - see LICENSE.rst
def get_package_data():
return {'tardis.io.tests':['data/*.dat', 'data/*.yml']}
| 29.8 | 63 | 0.677852 |
def get_package_data():
return {'tardis.io.tests':['data/*.dat', 'data/*.yml']}
| true | true |
f70fa8b722e119309bc970211e06b4c03d657183 | 1,320 | py | Python | tests/test_stat.py | cailab-tamu/scTenifoldXct | d25ded8dfb7f2951217a30ab71eccd6b060178f6 | [
"MIT"
] | null | null | null | tests/test_stat.py | cailab-tamu/scTenifoldXct | d25ded8dfb7f2951217a30ab71eccd6b060178f6 | [
"MIT"
] | null | null | null | tests/test_stat.py | cailab-tamu/scTenifoldXct | d25ded8dfb7f2951217a30ab71eccd6b060178f6 | [
"MIT"
] | null | null | null | import pytest
import itertools
import pandas as pd
import numpy as np
from scTenifoldXct.core import null_test
def generate_fake_df_nn(n_ligand=3000, n_receptors=3000, n_cands=200):
gene_names = [f"GENE{i}" for i in range(max(n_ligand, n_receptors))]
iteration = itertools.product(gene_names, gene_names)
... | 34.736842 | 100 | 0.666667 | import pytest
import itertools
import pandas as pd
import numpy as np
from scTenifoldXct.core import null_test
def generate_fake_df_nn(n_ligand=3000, n_receptors=3000, n_cands=200):
gene_names = [f"GENE{i}" for i in range(max(n_ligand, n_receptors))]
iteration = itertools.product(gene_names, gene_names)
... | true | true |
f70fa8cb9d7f1e49ef9b56b7615433e16e26661d | 852 | py | Python | dataExtractor.py | bdburak/AmazonReviewSentimentAnalysis | 8e68d27f5ecd6c5e1b0c153f79c8b3ea1767ea50 | [
"MIT"
] | null | null | null | dataExtractor.py | bdburak/AmazonReviewSentimentAnalysis | 8e68d27f5ecd6c5e1b0c153f79c8b3ea1767ea50 | [
"MIT"
] | 1 | 2021-04-28T18:26:41.000Z | 2021-04-28T18:26:41.000Z | dataExtractor.py | bdburak/AmazonReviewSentimentAnalysis | 8e68d27f5ecd6c5e1b0c153f79c8b3ea1767ea50 | [
"MIT"
] | null | null | null | #Review Seperator
def reviewToList(strDataLocation): #reviewToList(str_DataLocation)
file = open(strDataLocation)
listFile=(file.readlines())
firstReviewItem=0
lastReviewItem=0
listReviews = []
reviewText =""
for item in range(len(listFile)):
if('<review_text>\n'==listFile[item]):
... | 25.818182 | 84 | 0.564554 |
def reviewToList(strDataLocation):
file = open(strDataLocation)
listFile=(file.readlines())
firstReviewItem=0
lastReviewItem=0
listReviews = []
reviewText =""
for item in range(len(listFile)):
if('<review_text>\n'==listFile[item]):
firstReviewItem = item+1
if('<... | true | true |
f70fa8ec2ca8e6448f8e67c80257b049471e9c70 | 6,343 | py | Python | lab_4/main.py | SoullessDark/2020-2-level-labs | 9555eb5a86a0f330b2f99e991928b0337f519b7a | [
"MIT"
] | null | null | null | lab_4/main.py | SoullessDark/2020-2-level-labs | 9555eb5a86a0f330b2f99e991928b0337f519b7a | [
"MIT"
] | null | null | null | lab_4/main.py | SoullessDark/2020-2-level-labs | 9555eb5a86a0f330b2f99e991928b0337f519b7a | [
"MIT"
] | null | null | null | """
Lab 4
"""
import re
from ngrams.ngram_trie import NGramTrie
def tokenize_by_sentence(text: str) -> tuple:
if not isinstance(text, str):
raise ValueError
sents = re.split(r'[.?!]', text)
tokenized_sent = []
for sent in sents:
tokens = re.sub(r'[^a-z \n]', '', sent.lower()).split()... | 29.365741 | 108 | 0.612329 | import re
from ngrams.ngram_trie import NGramTrie
def tokenize_by_sentence(text: str) -> tuple:
if not isinstance(text, str):
raise ValueError
sents = re.split(r'[.?!]', text)
tokenized_sent = []
for sent in sents:
tokens = re.sub(r'[^a-z \n]', '', sent.lower()).split()
if t... | true | true |
f70fa93743ec576b39568159579d16544248a1ec | 83 | py | Python | conf/apps.py | invernoa/Conferences | 9e821948311dc9c28323ede8a26764899fc05255 | [
"MIT"
] | 41 | 2019-01-02T09:36:54.000Z | 2022-02-20T13:13:05.000Z | conf/apps.py | invernoa/Conferences | 9e821948311dc9c28323ede8a26764899fc05255 | [
"MIT"
] | 15 | 2019-09-30T05:40:20.000Z | 2022-02-17T19:28:41.000Z | conf/apps.py | invernoa/Conferences | 9e821948311dc9c28323ede8a26764899fc05255 | [
"MIT"
] | 23 | 2019-02-18T10:50:10.000Z | 2022-01-06T07:53:18.000Z | from django.apps import AppConfig
class ConfConfig(AppConfig):
name = 'conf'
| 13.833333 | 33 | 0.73494 | from django.apps import AppConfig
class ConfConfig(AppConfig):
name = 'conf'
| true | true |
f70facb47d95871efcad46d686499cc18bc105f0 | 937 | py | Python | Rendering/Core/Testing/Python/TestCgShader.py | collects/VTK | 004944f0d54df673c38b3d4016a4bee74fa7d813 | [
"BSD-3-Clause"
] | null | null | null | Rendering/Core/Testing/Python/TestCgShader.py | collects/VTK | 004944f0d54df673c38b3d4016a4bee74fa7d813 | [
"BSD-3-Clause"
] | null | null | null | Rendering/Core/Testing/Python/TestCgShader.py | collects/VTK | 004944f0d54df673c38b3d4016a4bee74fa7d813 | [
"BSD-3-Clause"
] | 2 | 2019-09-09T22:42:12.000Z | 2020-10-22T07:10:08.000Z | #!/usr/bin/env python
renWin = vtk.vtkRenderWindow()
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
renderer = vtk.vtkRenderer()
renWin.AddRenderer(renderer)
src1 = vtk.vtkSphereSource()
src1.SetRadius(5)
src1.SetPhiResolution(20)
src1.SetThetaResolution(20)
mapper = vtk.vtkPolyDataMapper()
mapper... | 31.233333 | 52 | 0.781217 |
renWin = vtk.vtkRenderWindow()
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
renderer = vtk.vtkRenderer()
renWin.AddRenderer(renderer)
src1 = vtk.vtkSphereSource()
src1.SetRadius(5)
src1.SetPhiResolution(20)
src1.SetThetaResolution(20)
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(s... | true | true |
f70fad1a401b33614f837e3bfd9c10fa8a5570aa | 1,451 | py | Python | tests/lib/utils.py | booneng/mobly | 539788309c7631c20fa5381937e10f9cd997e2d0 | [
"Apache-2.0"
] | 532 | 2016-11-07T22:01:00.000Z | 2022-03-30T17:11:40.000Z | tests/lib/utils.py | booneng/mobly | 539788309c7631c20fa5381937e10f9cd997e2d0 | [
"Apache-2.0"
] | 528 | 2016-11-22T01:42:19.000Z | 2022-03-24T02:27:15.000Z | tests/lib/utils.py | booneng/mobly | 539788309c7631c20fa5381937e10f9cd997e2d0 | [
"Apache-2.0"
] | 169 | 2016-11-18T15:12:26.000Z | 2022-03-24T01:22:08.000Z | # Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 36.275 | 78 | 0.731909 |
from mobly import records
def validate_test_result(result):
buckets = [
(result.passed, records.TestResultEnums.TEST_RESULT_PASS),
(result.failed, records.TestResultEnums.TEST_RESULT_FAIL),
(result.error, records.TestResultEnums.TEST_RESULT_ERROR),
(result.skipped, records.Te... | true | true |
f70fad449b902120499a1dec1a4d6c495074a31f | 607 | py | Python | venv/Lib/site-packages/tensorflow/python/keras/api/_v2/keras/applications/resnet/__init__.py | rexliu3/StockTradingBotCloud | 46b732b9c05f73bc0e856a3c4a16854b6d12e18e | [
"MIT"
] | null | null | null | venv/Lib/site-packages/tensorflow/python/keras/api/_v2/keras/applications/resnet/__init__.py | rexliu3/StockTradingBotCloud | 46b732b9c05f73bc0e856a3c4a16854b6d12e18e | [
"MIT"
] | null | null | null | venv/Lib/site-packages/tensorflow/python/keras/api/_v2/keras/applications/resnet/__init__.py | rexliu3/StockTradingBotCloud | 46b732b9c05f73bc0e856a3c4a16854b6d12e18e | [
"MIT"
] | 1 | 2020-06-28T11:47:47.000Z | 2020-06-28T11:47:47.000Z | # This file is MACHINE GENERATED! Do not edit.
# Generated by: tensorflow/python/tools/api/generator/create_python_api.py script.
"""ResNet models for Keras.
"""
from __future__ import print_function as _print_function
import sys as _sys
from tensorflow.python.keras.applications.resnet import ResNet101
from tensorfl... | 35.705882 | 82 | 0.84514 |
from __future__ import print_function as _print_function
import sys as _sys
from tensorflow.python.keras.applications.resnet import ResNet101
from tensorflow.python.keras.applications.resnet import ResNet152
from tensorflow.python.keras.applications.resnet import ResNet50
from tensorflow.python.keras.applications.... | true | true |
f70faf3f1a8e372280b0a707e88d882149db4909 | 3,167 | py | Python | batch_netmeta.py | gesiscss/Homophilic_Directed_ScaleFree_Networks | a0d27b44eaafdda46b6d3379859fa428398ef476 | [
"Apache-2.0"
] | 1 | 2022-03-23T15:34:38.000Z | 2022-03-23T15:34:38.000Z | batch_netmeta.py | gesiscss/Homophilic_Directed_ScaleFree_Networks | a0d27b44eaafdda46b6d3379859fa428398ef476 | [
"Apache-2.0"
] | 2 | 2019-02-02T13:54:53.000Z | 2019-02-04T09:15:51.000Z | batch_netmeta.py | gesiscss/Homophilic_Directed_ScaleFree_Networks | a0d27b44eaafdda46b6d3379859fa428398ef476 | [
"Apache-2.0"
] | null | null | null | ################################################################
# System's dependencies
################################################################
import os
import sys
import time
import argparse
################################################################
# Local dependencies
##############################... | 43.383562 | 128 | 0.487843 | MM), str(hmm), str(_N), str(_d), str(_mindiff)])
path = os.path.join(output,dataset,"network_metadata.csv")
io.save_text("{}\n{}".format(t1,t2), path)
################################################################
# Main
################################################################
if __name__ == "__m... | true | true |
f70fb01bb8bfa089b4844ff0143d97c5770f6f22 | 2,502 | py | Python | scripts/rpc/__init__.py | kacperg/spdk | 4906323d47b1bf5290152e85b9a6fac1970cdfed | [
"BSD-3-Clause"
] | null | null | null | scripts/rpc/__init__.py | kacperg/spdk | 4906323d47b1bf5290152e85b9a6fac1970cdfed | [
"BSD-3-Clause"
] | null | null | null | scripts/rpc/__init__.py | kacperg/spdk | 4906323d47b1bf5290152e85b9a6fac1970cdfed | [
"BSD-3-Clause"
] | null | null | null | import json
import sys
from . import app
from . import bdev
from . import iscsi
from . import log
from . import lvol
from . import nbd
from . import net
from . import nvmf
from . import pmem
from . import subsystem
from . import vhost
def start_subsystem_init(client):
return client.call('start_subsystem_init')
... | 26.903226 | 102 | 0.593525 | import json
import sys
from . import app
from . import bdev
from . import iscsi
from . import log
from . import lvol
from . import nbd
from . import net
from . import nvmf
from . import pmem
from . import subsystem
from . import vhost
def start_subsystem_init(client):
return client.call('start_subsystem_init')
... | true | true |
f70fb0261784177b0d3669369a858adf97f9b9a9 | 5,250 | py | Python | practices/week6/assignment_exercise_3.py | andreyyec/Texas_Tech_AI | e4e8e41c65b41a1a684f1f65d21cf5427abdb046 | [
"MIT"
] | null | null | null | practices/week6/assignment_exercise_3.py | andreyyec/Texas_Tech_AI | e4e8e41c65b41a1a684f1f65d21cf5427abdb046 | [
"MIT"
] | 5 | 2020-01-28T22:57:31.000Z | 2022-02-10T00:37:58.000Z | practices/week6/assignment_exercise_3.py | andreyyec/Texas_Tech_AI | e4e8e41c65b41a1a684f1f65d21cf5427abdb046 | [
"MIT"
] | null | null | null | import numpy as np
import pandas as pd
import pickle
import tensorflow as tf
import sklearn.metrics
import matplotlib.pyplot as plt
# Load the training and test data from the Pickle file
with open("../datasets/credit_card_default_dataset.pickle", "rb") as f:
train_data, train_labels, test_data, test_labels = pic... | 35 | 127 | 0.719238 | import numpy as np
import pandas as pd
import pickle
import tensorflow as tf
import sklearn.metrics
import matplotlib.pyplot as plt
with open("../datasets/credit_card_default_dataset.pickle", "rb") as f:
train_data, train_labels, test_data, test_labels = pickle.load(f)
n_inputs = train_data.shape[1]
nsamples ... | true | true |
f70fb188e60fc3f2ee8fa90f4379d87b3fd93cae | 169 | py | Python | src/user/views/__init__.py | ResearchHub/ResearchHub-Backend-Open | d36dca33afae2d442690694bb2ab17180d84bcd3 | [
"MIT"
] | 18 | 2021-05-20T13:20:16.000Z | 2022-02-11T02:40:18.000Z | src/user/views/__init__.py | ResearchHub/ResearchHub-Backend-Open | d36dca33afae2d442690694bb2ab17180d84bcd3 | [
"MIT"
] | 109 | 2021-05-21T20:14:23.000Z | 2022-03-31T20:56:10.000Z | src/user/views/__init__.py | ResearchHub/ResearchHub-Backend-Open | d36dca33afae2d442690694bb2ab17180d84bcd3 | [
"MIT"
] | 4 | 2021-05-17T13:47:53.000Z | 2022-02-12T10:48:21.000Z | # flake8: noqa
from user.views.user_views import *
from user.views.gatekeeper_view import GatekeeperViewSet
from user.views.organization_view import OrganizationViewSet
| 33.8 | 60 | 0.857988 |
from user.views.user_views import *
from user.views.gatekeeper_view import GatekeeperViewSet
from user.views.organization_view import OrganizationViewSet
| true | true |
f70fb191003034cfa869b208b1b4a32aa36da6d7 | 4,198 | py | Python | python_modules/dagster/dagster_tests/core_tests/config_types_tests/test_config_spec.py | JPeer264/dagster-fork | 32cc87a36134be7c442fa85d6867eb1d3301aea0 | [
"Apache-2.0"
] | 1 | 2020-09-19T16:35:59.000Z | 2020-09-19T16:35:59.000Z | python_modules/dagster/dagster_tests/core_tests/config_types_tests/test_config_spec.py | JPeer264/dagster-fork | 32cc87a36134be7c442fa85d6867eb1d3301aea0 | [
"Apache-2.0"
] | null | null | null | python_modules/dagster/dagster_tests/core_tests/config_types_tests/test_config_spec.py | JPeer264/dagster-fork | 32cc87a36134be7c442fa85d6867eb1d3301aea0 | [
"Apache-2.0"
] | null | null | null | import pytest
from dagster import DagsterInvalidConfigDefinitionError, Noneable, Selector, execute_solid, solid
def test_kitchen_sink():
@solid(
config_schema={
'str_field': str,
'int_field': int,
'list_int': [int],
'list_list_int': [[int]],
'di... | 32.045802 | 97 | 0.610052 | import pytest
from dagster import DagsterInvalidConfigDefinitionError, Noneable, Selector, execute_solid, solid
def test_kitchen_sink():
@solid(
config_schema={
'str_field': str,
'int_field': int,
'list_int': [int],
'list_list_int': [[int]],
'di... | true | true |
f70fb27cfab9dd0b2e6b5adae0010670d24a0187 | 1,579 | py | Python | test_Calculator/testing/test_cal_plus.py | XuXuClassMate/My_Test_PyProject | 5822455af47f5855d1db4c388c2c973c440a4d3f | [
"Apache-2.0"
] | null | null | null | test_Calculator/testing/test_cal_plus.py | XuXuClassMate/My_Test_PyProject | 5822455af47f5855d1db4c388c2c973c440a4d3f | [
"Apache-2.0"
] | null | null | null | test_Calculator/testing/test_cal_plus.py | XuXuClassMate/My_Test_PyProject | 5822455af47f5855d1db4c388c2c973c440a4d3f | [
"Apache-2.0"
] | null | null | null | """
1、case顺序:加-除-减-乘
2、fixture方法在case前打印【开始计算】,结束后打印【计算结束】
3、fixture方法存在在conftest.py,设置scope=module
4、控制case只执行顺序为:加-减-乘-除
5、结合allure生成本地测试报告
"""
import allure
import pytest
import yaml
from test_Calculator.src.calculator import Calculator
def get_data():
with open('./data.yml') as data_x:
data = yaml.saf... | 27.701754 | 89 | 0.645345 | import allure
import pytest
import yaml
from test_Calculator.src.calculator import Calculator
def get_data():
with open('./data.yml') as data_x:
data = yaml.safe_load(data_x)
data_data = data['datas']
data_name = data['ids']
return [data_data, data_name]
data = get_data()
get_ca... | true | true |
f70fb2c5d6c94d72c11d58d67c3da8ca3e2648c3 | 2,641 | py | Python | siamesenetwork/siamesePreTrainedEmbeddings.py | pengfei99/openfood | 2b65af02ce34bf8193d357ef3661da749d2d9671 | [
"MIT"
] | 2 | 2021-09-13T14:46:24.000Z | 2021-09-13T14:46:35.000Z | siamesenetwork/siamesePreTrainedEmbeddings.py | pengfei99/openfood | 2b65af02ce34bf8193d357ef3661da749d2d9671 | [
"MIT"
] | null | null | null | siamesenetwork/siamesePreTrainedEmbeddings.py | pengfei99/openfood | 2b65af02ce34bf8193d357ef3661da749d2d9671 | [
"MIT"
] | null | null | null | # !/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Define the siamese network for one-shot learning,
for french short labels
02/06/2021
@author: milena-git, from jeremylhour courtesy
"""
import torch
import torch.nn as nn
def _createEmbeddingLayer(weights_matrix, non_trainable=False):
"""
_createEmbeddingLay... | 33.43038 | 105 | 0.658463 |
import torch
import torch.nn as nn
def _createEmbeddingLayer(weights_matrix, non_trainable=False):
weights_matrix = torch.tensor(weights_matrix)
num_embeddings, embedding_dim = weights_matrix.size()
emb_layer = nn.Embedding(num_embeddings, embedding_dim)
emb_layer.load_state_dict({'weight': weights_... | true | true |
f70fb3476d36e16a6599d538e8c7c982416ef57c | 2,165 | py | Python | test/PR_test/unit_test/op/numpyop/univariate/test_autocontrast.py | DwijayDS/fastestimator | 9b288cb2bd870f971ec4cee09d0b3205e1316a94 | [
"Apache-2.0"
] | 57 | 2019-05-21T21:29:26.000Z | 2022-02-23T05:55:21.000Z | test/PR_test/unit_test/op/numpyop/univariate/test_autocontrast.py | vbvg2008/fastestimator | 6061a4fbbeb62a2194ef82ba8017f651710d0c65 | [
"Apache-2.0"
] | 93 | 2019-05-23T18:36:07.000Z | 2022-03-23T17:15:55.000Z | test/PR_test/unit_test/op/numpyop/univariate/test_autocontrast.py | vbvg2008/fastestimator | 6061a4fbbeb62a2194ef82ba8017f651710d0c65 | [
"Apache-2.0"
] | 47 | 2019-05-09T15:41:37.000Z | 2022-03-26T17:00:08.000Z | # Copyright 2021 The FastEstimator 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 appl... | 42.45098 | 89 | 0.655427 |
import unittest
import numpy as np
from fastestimator.op.numpyop.univariate import AutoContrast
class TestAutoContrast(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.single_input = [np.random.randint(0, 256, size=(28, 28, 3)).astype(np.uint8)]
cls.single_output_shape... | true | true |
f70fb44b8b726f2718970f214122633936106d39 | 3,774 | py | Python | pythonsdk/face/face_pb2_grpc.py | jjrobotcn/andy4 | 4a0cb57aa5f318a3099fbfe6198620555b3a45af | [
"MIT"
] | null | null | null | pythonsdk/face/face_pb2_grpc.py | jjrobotcn/andy4 | 4a0cb57aa5f318a3099fbfe6198620555b3a45af | [
"MIT"
] | null | null | null | pythonsdk/face/face_pb2_grpc.py | jjrobotcn/andy4 | 4a0cb57aa5f318a3099fbfe6198620555b3a45af | [
"MIT"
] | null | null | null | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from . import face_pb2 as face__pb2
class FaceServiceStub(object):
"""faceRecognition.FaceService 人脸服务
"""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
""... | 35.271028 | 101 | 0.645999 |
import grpc
from . import face_pb2 as face__pb2
class FaceServiceStub(object):
def __init__(self, channel):
self.Compare = channel.unary_unary(
'/faceRecognition.FaceService/Compare',
request_serializer=face__pb2.CompareRequest.SerializeToString,
response... | true | true |
f70fb47f91fd9a5618daafe068d611e8a5784530 | 1,876 | py | Python | setup.py | wbogen/cardio | b8826295b7e27168441e2595e9592aff77cf7722 | [
"Apache-2.0"
] | 250 | 2017-11-22T14:41:57.000Z | 2022-02-02T22:41:28.000Z | setup.py | supertime1/cardio | 58087b21295ebe18fb5a5dfbb68479b39ddb4971 | [
"Apache-2.0"
] | 34 | 2017-11-23T18:27:20.000Z | 2020-09-10T11:55:16.000Z | setup.py | supertime1/cardio | 58087b21295ebe18fb5a5dfbb68479b39ddb4971 | [
"Apache-2.0"
] | 85 | 2017-11-23T13:07:31.000Z | 2021-11-24T08:34:07.000Z | """
CardIO is a library that works with electrocardiograms.
Documentation - https://analysiscenter.github.io/cardio/
"""
from setuptools import setup, find_packages
import re
with open('cardio/__init__.py', 'r') as f:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE).group(1)
... | 30.258065 | 99 | 0.584755 |
from setuptools import setup, find_packages
import re
with open('cardio/__init__.py', 'r') as f:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE).group(1)
with open('docs/index.rst', 'r') as f:
long_description = f.read()
setup(
name='cardio',
packages=find_pa... | true | true |
f70fb4b707686268baecdf75a4c2e0bd818d3206 | 15,820 | py | Python | Password-Locker/run.py | HASSAN1A/Password-Locker | bea88438936fa9ffa174d6f9c7941046d713092b | [
"MIT"
] | 2 | 2021-05-19T12:58:21.000Z | 2021-05-28T14:03:02.000Z | Password-Locker/run.py | HASSAN1A/Password-Locker | bea88438936fa9ffa174d6f9c7941046d713092b | [
"MIT"
] | null | null | null | Password-Locker/run.py | HASSAN1A/Password-Locker | bea88438936fa9ffa174d6f9c7941046d713092b | [
"MIT"
] | null | null | null | #!/usr/bin/env python3.8
from account import Account
from credential import Credential
from termcolor import colored, cprint
import os
import time
import pickle
# Functions that implement the behaviours in account class.
def create_account(username, fname, lname, p_word):
'''
Function to create new account
... | 38.77451 | 123 | 0.468078 |
from account import Account
from credential import Credential
from termcolor import colored, cprint
import os
import time
import pickle
def create_account(username, fname, lname, p_word):
new_account = Account(username, fname, lname, p_word)
return new_account
def save_account(account):
account.save_... | true | true |
f70fb5030be554ad24d7c738e890f3d047427e38 | 4,209 | py | Python | config/jobs/kubernetes/kops/build-pipeline.py | celestehorgan/test-infra | 3a4d5a94f214381ecca8146aef354bba29b0ac67 | [
"Apache-2.0"
] | null | null | null | config/jobs/kubernetes/kops/build-pipeline.py | celestehorgan/test-infra | 3a4d5a94f214381ecca8146aef354bba29b0ac67 | [
"Apache-2.0"
] | null | null | null | config/jobs/kubernetes/kops/build-pipeline.py | celestehorgan/test-infra | 3a4d5a94f214381ecca8146aef354bba29b0ac67 | [
"Apache-2.0"
] | null | null | null | # Copyright 2020 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | 32.376923 | 117 | 0.628415 |
import json
template = """
# Verify the latest-ci version from the {{branch}} branch of kops
# Runs a small subset of the e2e tests.
# Publishes the version to latest-ci-updown-green on success.
- interval: 60m
name: {{name}}
decorate: true
decoration_config:
timeout: 45m
labels:
preset-s... | true | true |
f70fb6a161b5ea492c9c47948d6ae0810e774828 | 828 | py | Python | src/utils/api/permissions.py | jsmesami/naovoce | 235c6e05ef37be23d3b9bd0b76d80080c58617a0 | [
"BSD-3-Clause"
] | 18 | 2016-02-23T15:34:58.000Z | 2022-02-28T08:15:30.000Z | src/utils/api/permissions.py | jsmesami/naovoce | 235c6e05ef37be23d3b9bd0b76d80080c58617a0 | [
"BSD-3-Clause"
] | 66 | 2016-03-15T19:59:09.000Z | 2022-03-11T23:25:41.000Z | src/utils/api/permissions.py | jsmesami/naovoce | 235c6e05ef37be23d3b9bd0b76d80080c58617a0 | [
"BSD-3-Clause"
] | 7 | 2016-03-24T09:13:07.000Z | 2018-09-16T17:04:50.000Z | from rest_framework import permissions
class IsAuthenticated(permissions.BasePermission):
def has_permission(self, request, view):
return (
request.user
and request.user.is_authenticated
and request.user.is_email_verified
)
class IsAuthenticatedOrReadOnly(perm... | 27.6 | 60 | 0.678744 | from rest_framework import permissions
class IsAuthenticated(permissions.BasePermission):
def has_permission(self, request, view):
return (
request.user
and request.user.is_authenticated
and request.user.is_email_verified
)
class IsAuthenticatedOrReadOnly(perm... | true | true |
f70fb71ce3042a4cc28deea40be606cfe703d92d | 11,029 | py | Python | ncappzoo/tensorflow/topcoder_andresduque/supporting/inferences.py | yockgen/movidius | cc32f1951a4d00d2250bb0d2b9000c5f2435b41a | [
"MIT"
] | 1 | 2018-11-23T01:48:59.000Z | 2018-11-23T01:48:59.000Z | ncappzoo/tensorflow/topcoder_andresduque/supporting/inferences.py | yockgen/movidius | cc32f1951a4d00d2250bb0d2b9000c5f2435b41a | [
"MIT"
] | null | null | null | ncappzoo/tensorflow/topcoder_andresduque/supporting/inferences.py | yockgen/movidius | cc32f1951a4d00d2250bb0d2b9000c5f2435b41a | [
"MIT"
] | 1 | 2020-10-01T15:38:04.000Z | 2020-10-01T15:38:04.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
#~ The MIT License (MIT)
#~ Copyright 2018 ©klo86min
#~ 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 with... | 33.625 | 140 | 0.602684 |
import argparse
import csv
import cv2
import mvnc.mvncapi as mvnc
import numpy as np
import os.path
IMAGE_DIM = 299
| true | true |
f70fb7c77d935e9a4bdb46140f8bc3e6d53a17ee | 2,501 | py | Python | radio_bridge/tests/unit/test_dtmf_decoder.py | Kami/raspberry-pi-ham-radio | 7ff9180e3a4d645b92e07ce92cbcbf73c7a0a628 | [
"Apache-2.0"
] | 2 | 2020-10-26T06:16:52.000Z | 2021-11-15T11:05:29.000Z | radio_bridge/tests/unit/test_dtmf_decoder.py | Kami/raspberry-pi-ham-radio | 7ff9180e3a4d645b92e07ce92cbcbf73c7a0a628 | [
"Apache-2.0"
] | null | null | null | radio_bridge/tests/unit/test_dtmf_decoder.py | Kami/raspberry-pi-ham-radio | 7ff9180e3a4d645b92e07ce92cbcbf73c7a0a628 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright 2020 Tomaz Muraus
#
# 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 ... | 36.246377 | 79 | 0.594562 |
import os
import unittest
from radio_bridge.dtmf import FFTDTMFDecoderImplementation
__all__ = ["TestFFTDTMFDecoder"]
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
FIXTURES_DIR = os.path.abspath(os.path.join(BASE_DIR, "../fixtures/dtmf"))
class TestFFTDTMFDecoder(unittest.TestCase):
def ... | true | true |
f70fb837d095c7afa802c8994d156aba293785e2 | 4,084 | py | Python | sharinator/settings.py | Technikradio/sharinator | 3aa72d01d3829520c9627320d044af14fda913b8 | [
"BSD-3-Clause"
] | null | null | null | sharinator/settings.py | Technikradio/sharinator | 3aa72d01d3829520c9627320d044af14fda913b8 | [
"BSD-3-Clause"
] | 9 | 2020-05-31T16:24:49.000Z | 2020-06-19T17:42:56.000Z | sharinator/settings.py | Technikradio/sharinator | 3aa72d01d3829520c9627320d044af14fda913b8 | [
"BSD-3-Clause"
] | null | null | null | """
Django settings for sharinator project.
Generated by 'django-admin startproject' using Django 2.2.4.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os... | 26.012739 | 91 | 0.698335 |
import os
from django.contrib.messages import constants as messages
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'ofj2gu)@$2xahppvk%25217+y!-1d4#@1-*#)c6zssk%&s87ai'
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.adm... | true | true |
f70fb89aca0288cdc68dc3bcc49697d7f2d22348 | 2,530 | py | Python | tests/py3/test_property_map.py | agarwalrounak/qmt | 6fb8ee55fb9d544b72f6dc0c275000914e03af06 | [
"MIT"
] | 1 | 2018-09-30T00:45:53.000Z | 2018-09-30T00:45:53.000Z | tests/py3/test_property_map.py | imagineagents/qmt | 5e8a7001cc020979636e492448abcfd894396038 | [
"MIT"
] | null | null | null | tests/py3/test_property_map.py | imagineagents/qmt | 5e8a7001cc020979636e492448abcfd894396038 | [
"MIT"
] | null | null | null | import numpy as np
from qmt.geometry import PropertyMap, MaterialPropertyMap
from qmt.materials import Materials
class DummyPartMap:
def __init__(self, part_ids):
assert len(part_ids) == 2
self.partIds = part_ids
def __call__(self, x):
assert np.ndim(x) >= 1
x = np.asanyarray... | 40.15873 | 99 | 0.608696 | import numpy as np
from qmt.geometry import PropertyMap, MaterialPropertyMap
from qmt.materials import Materials
class DummyPartMap:
def __init__(self, part_ids):
assert len(part_ids) == 2
self.partIds = part_ids
def __call__(self, x):
assert np.ndim(x) >= 1
x = np.asanyarray... | true | true |
f70fb93da9d51c1f9838f67977dbbd4aef65562e | 4,576 | py | Python | tensorflow/python/kernel_tests/batch_scatter_ops_test.py | abhaikollara/tensorflow | 4f96df3659696990cb34d0ad07dc67843c4225a9 | [
"Apache-2.0"
] | 848 | 2019-12-03T00:16:17.000Z | 2022-03-31T22:53:17.000Z | tensorflow/python/kernel_tests/batch_scatter_ops_test.py | abhaikollara/tensorflow | 4f96df3659696990cb34d0ad07dc67843c4225a9 | [
"Apache-2.0"
] | 656 | 2019-12-03T00:48:46.000Z | 2022-03-31T18:41:54.000Z | tensorflow/python/kernel_tests/batch_scatter_ops_test.py | abhaikollara/tensorflow | 4f96df3659696990cb34d0ad07dc67843c4225a9 | [
"Apache-2.0"
] | 506 | 2019-12-03T00:46:26.000Z | 2022-03-30T10:34:56.000Z | # Copyright 2015 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... | 35.472868 | 80 | 0.644231 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.framework... | true | true |
f70fb9ac8a380f47eb700eb0aa4f64af7b5fd5bd | 2,144 | py | Python | nova/scheduler/filters/retry_filter.py | teresa-ho/stx-nova | 1f82323439da2449edbbaed2fe1c8414a550c86f | [
"Apache-2.0"
] | null | null | null | nova/scheduler/filters/retry_filter.py | teresa-ho/stx-nova | 1f82323439da2449edbbaed2fe1c8414a550c86f | [
"Apache-2.0"
] | null | null | null | nova/scheduler/filters/retry_filter.py | teresa-ho/stx-nova | 1f82323439da2449edbbaed2fe1c8414a550c86f | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2012 OpenStack Foundation
# 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 ... | 35.147541 | 78 | 0.661381 |
from oslo_log import log as logging
from nova.i18n import _LI
from nova.scheduler import filters
LOG = logging.getLogger(__name__)
class RetryFilter(filters.BaseHostFilter):
RUN_ON_REBUILD = False
def host_passes(self, host_state, spec_obj):
retry = spec_obj.retry
... | true | true |
f70fb9ca8e2cc531992c308148f77617cc1fff51 | 10,495 | py | Python | server/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/tests/identifier_completer_test.py | hkdb/sysconf | 99d334f7309657647059c4b37f25e33dffc81fc3 | [
"MIT"
] | 10 | 2020-07-21T21:59:54.000Z | 2021-07-19T11:01:47.000Z | server/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/tests/identifier_completer_test.py | hkdb/sysconf | 99d334f7309657647059c4b37f25e33dffc81fc3 | [
"MIT"
] | null | null | null | server/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/tests/identifier_completer_test.py | hkdb/sysconf | 99d334f7309657647059c4b37f25e33dffc81fc3 | [
"MIT"
] | 1 | 2021-01-30T18:17:01.000Z | 2021-01-30T18:17:01.000Z | # Copyright (C) 2020 ycmd contributors
#
# This file is part of ycmd.
#
# ycmd is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ycmd... | 34.409836 | 80 | 0.536541 |
import os
from hamcrest import assert_that, empty, equal_to, contains_exactly
from ycmd.user_options_store import DefaultOptions
from ycmd.completers.all import identifier_completer as ic
from ycmd.completers.all.identifier_completer import IdentifierCompleter
from ycmd.request_wrap import RequestWrap
... | true | true |
f70fba585f35db352b62ef695402806501bee0cf | 5,147 | py | Python | models/eweights.py | RemiBe/Crack | 334df92c5598f2a3249cae022e570ab32068ba79 | [
"Apache-2.0"
] | 1 | 2021-09-16T01:13:51.000Z | 2021-09-16T01:13:51.000Z | models/eweights.py | RemiBe/crack | 334df92c5598f2a3249cae022e570ab32068ba79 | [
"Apache-2.0"
] | null | null | null | models/eweights.py | RemiBe/crack | 334df92c5598f2a3249cae022e570ab32068ba79 | [
"Apache-2.0"
] | null | null | null | """Edge weights.
"""
__author__ = "Rémi Barat"
__version__ = "1.0"
import math
import random
from crack.models.weights import condition_models, format_crit
#####################################################
### Format the models for init_EWeights functions ###
##################################################... | 30.099415 | 172 | 0.592967 |
__author__ = "Rémi Barat"
__version__ = "1.0"
import math
import random
from crack.models.weights import condition_models, format_crit
| true | true |
f70fbb21c94acb9d07d8e2e1ca75454e92d0eaf5 | 28,076 | py | Python | game_client.py | wenlianglaw/Tetris-in-Python | d4f0a22c4827e7eeb44c55def3f024e0c6932ebe | [
"MIT"
] | 1 | 2021-06-25T20:43:19.000Z | 2021-06-25T20:43:19.000Z | game_client.py | wenlianglaw/Tetris-in-Python | d4f0a22c4827e7eeb44c55def3f024e0c6932ebe | [
"MIT"
] | null | null | null | game_client.py | wenlianglaw/Tetris-in-Python | d4f0a22c4827e7eeb44c55def3f024e0c6932ebe | [
"MIT"
] | null | null | null | # This file defines the back end of the Tetris game
#
# GameState is the base class of GameClient.
#
# GameClient.Run() will start two threads:
# - _ProcessActions: Process the action list every x seconds
# - _AutoDrop: Auto drops the current piece.
#
# GameClient:
# - current piece
# - held piece
# - piece list... | 32.799065 | 123 | 0.63036 |
import copy
import queue
import threading
import time
from threading import Lock
from typing import Tuple, List
import numpy as np
import actions
import shape
DEFAULT_LENGTH = 20
DEFAULT_WIDTH = 10
MAP_PADDING_SIZE = 4
REFILL_THRESHOLD = 5
MAXIMUM_LOCK_TIME = 4
INCREMENTAL_LOCK_TIME = ... | true | true |
f70fbcc4d201ff1d88c227e27e1344dec0d9a084 | 5,208 | py | Python | homeassistant/components/upnp/__init__.py | Juggler00/home-assistant | 3f87d413813de84935ea67b5212c55348524447f | [
"Apache-2.0"
] | 1 | 2021-04-08T06:02:25.000Z | 2021-04-08T06:02:25.000Z | homeassistant/components/upnp/__init__.py | ayonix/home-assistant | 8fda70537736db9a73c0a863800d6bb4df67f5fc | [
"Apache-2.0"
] | null | null | null | homeassistant/components/upnp/__init__.py | ayonix/home-assistant | 8fda70537736db9a73c0a863800d6bb4df67f5fc | [
"Apache-2.0"
] | null | null | null | """
Will open a port in your router for Home Assistant and provide statistics.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/upnp/
"""
import asyncio
from ipaddress import ip_address
import aiohttp
import voluptuous as vol
from homeassistant.config_e... | 30.635294 | 79 | 0.699117 | import asyncio
from ipaddress import ip_address
import aiohttp
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers import dispatcher
from homeassistan... | true | true |
f70fbcdfcc1d45f5ca92376a915b19a073966d04 | 8,295 | py | Python | components/diagnostics/diagnose_me/component.py | areshytko/pipelines | 9e818e9d13569614b7188a7bff47770ae449827c | [
"Apache-2.0"
] | null | null | null | components/diagnostics/diagnose_me/component.py | areshytko/pipelines | 9e818e9d13569614b7188a7bff47770ae449827c | [
"Apache-2.0"
] | null | null | null | components/diagnostics/diagnose_me/component.py | areshytko/pipelines | 9e818e9d13569614b7188a7bff47770ae449827c | [
"Apache-2.0"
] | null | null | null | # Copyright 2020 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 35.75431 | 98 | 0.642917 |
from typing import Any, List, NamedTuple, Optional
def run_diagnose_me(
bucket: str,
execution_mode: str,
project_id: str,
target_apis: str,
quota_check: Optional[List[Any]] = None,
) -> NamedTuple('Outputs', [('bucket', str), ('project_id', str)]):
import subprocess
subpr... | true | true |
f70fbd594ac7cc796d70fbf753d9788864624349 | 135,700 | py | Python | test/test_binary_ufuncs.py | ZackPashkin/pytorch | 5b1f5c8f17ec4067dc9f9df98bbcc6757ab24444 | [
"Intel"
] | 1 | 2022-01-25T15:48:31.000Z | 2022-01-25T15:48:31.000Z | test/test_binary_ufuncs.py | ZackPashkin/pytorch | 5b1f5c8f17ec4067dc9f9df98bbcc6757ab24444 | [
"Intel"
] | null | null | null | test/test_binary_ufuncs.py | ZackPashkin/pytorch | 5b1f5c8f17ec4067dc9f9df98bbcc6757ab24444 | [
"Intel"
] | null | null | null | import torch
import numpy as np
import itertools
from itertools import product
import math
import random
import unittest
import warnings
import operator
from functools import partial
from torch._six import inf, nan
from torch.testing._internal.common_utils import (
TestCase, iter_indices, TEST_WITH_ASAN, run_test... | 46.203609 | 131 | 0.584753 | import torch
import numpy as np
import itertools
from itertools import product
import math
import random
import unittest
import warnings
import operator
from functools import partial
from torch._six import inf, nan
from torch.testing._internal.common_utils import (
TestCase, iter_indices, TEST_WITH_ASAN, run_test... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.