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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c46aabc654962175d4c60a0f2c647f7ad0ed11f | 435 | py | Python | leetcode/34.py | windniw/just-for-fun | 54e5c2be145f3848811bfd127f6a89545e921570 | [
"Apache-2.0"
] | 1 | 2019-08-28T23:15:25.000Z | 2019-08-28T23:15:25.000Z | leetcode/34.py | windniw/just-for-fun | 54e5c2be145f3848811bfd127f6a89545e921570 | [
"Apache-2.0"
] | null | null | null | leetcode/34.py | windniw/just-for-fun | 54e5c2be145f3848811bfd127f6a89545e921570 | [
"Apache-2.0"
] | null | null | null | """
link: https://leetcode-cn.com/problems/find-first-and-last-position-of-element-in-sorted-array
problem: 返回 target 在 nums 中的区间,不存在时返回 [-1, -1]
solution: 二分
"""
class Solution:
def searchRange(self, nums: List[int], target: int) -> List[int]:
a = bisect.bisect_left(nums, target)
b = bisect.bis... | 24.166667 | 94 | 0.593103 | class Solution:
def searchRange(self, nums: List[int], target: int) -> List[int]:
a = bisect.bisect_left(nums, target)
b = bisect.bisect_right(nums, target)
if a == b:
return [-1, -1]
else:
return [a, b - 1]
| true | true |
1c46aad880355143649c5f0dc5f7f6f388eb64a8 | 3,783 | py | Python | pytest_ethereum/plugins.py | jacqueswww/pytest-ethereum | d45b441bd582eb4a17c37debd1dabf061a3e56eb | [
"MIT"
] | null | null | null | pytest_ethereum/plugins.py | jacqueswww/pytest-ethereum | d45b441bd582eb4a17c37debd1dabf061a3e56eb | [
"MIT"
] | null | null | null | pytest_ethereum/plugins.py | jacqueswww/pytest-ethereum | d45b441bd582eb4a17c37debd1dabf061a3e56eb | [
"MIT"
] | null | null | null | import json
from pathlib import Path
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple
from eth_utils import to_dict, to_hex, to_tuple
import pytest
from vyper import compiler
from web3 import Web3
from ethpm import Package
from ethpm.tools import builder as b
from ethpm.typing import Manifest
f... | 28.877863 | 85 | 0.680941 | import json
from pathlib import Path
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple
from eth_utils import to_dict, to_hex, to_tuple
import pytest
from vyper import compiler
from web3 import Web3
from ethpm import Package
from ethpm.tools import builder as b
from ethpm.typing import Manifest
f... | true | true |
1c46ab3936f9d783c9129bd39881ccdee4abfb5d | 25,848 | py | Python | tools/efrotools/pybuild.py | nitingupta910/ballistica | 7c8c645592ac184e80e409c14c7607f91fcc89df | [
"MIT"
] | 317 | 2020-04-04T00:33:10.000Z | 2022-03-28T01:07:09.000Z | tools/efrotools/pybuild.py | Alshahriah/ballistica | 326f6677a0118667e93ce9034849622ebef706fa | [
"MIT"
] | 315 | 2020-04-04T22:33:10.000Z | 2022-03-31T22:50:02.000Z | tools/efrotools/pybuild.py | Alshahriah/ballistica | 326f6677a0118667e93ce9034849622ebef706fa | [
"MIT"
] | 97 | 2020-04-04T01:32:17.000Z | 2022-03-16T19:02:59.000Z | # Released under the MIT License. See LICENSE for details.
#
"""Functionality related to building python for ios, android, etc."""
from __future__ import annotations
import os
from typing import TYPE_CHECKING
from efrotools import PYVER, run, readfile, writefile, replace_one
if TYPE_CHECKING:
from typing import... | 41.757674 | 79 | 0.548205 |
from __future__ import annotations
import os
from typing import TYPE_CHECKING
from efrotools import PYVER, run, readfile, writefile, replace_one
if TYPE_CHECKING:
from typing import Any
ENABLE_OPENSSL = True
NEWER_PY_TEST = True
PY_VER_EXACT_ANDROID = '3.9.7'
PY_VER_EXACT_APPLE = '3.9.6'
PRUNE_LIB_NAMES = [
... | true | true |
1c46ad650091fd8eb656b4ce0564489819168982 | 2,955 | py | Python | conans/test/unittests/util/local_db_test.py | Wonders11/conan | 28ec09f6cbf1d7e27ec27393fd7bbc74891e74a8 | [
"MIT"
] | 6,205 | 2015-12-01T13:40:05.000Z | 2022-03-31T07:30:25.000Z | conans/test/unittests/util/local_db_test.py | Wonders11/conan | 28ec09f6cbf1d7e27ec27393fd7bbc74891e74a8 | [
"MIT"
] | 8,747 | 2015-12-01T16:28:48.000Z | 2022-03-31T23:34:53.000Z | conans/test/unittests/util/local_db_test.py | Mattlk13/conan | 005fc53485557b0a570bb71670f2ca9c66082165 | [
"MIT"
] | 961 | 2015-12-01T16:56:43.000Z | 2022-03-31T13:50:52.000Z | import os
import unittest
import uuid
import six
import pytest
from conans.client.store.localdb import LocalDB
from conans.test.utils.test_files import temp_folder
class LocalStoreTest(unittest.TestCase):
def test_localdb(self):
tmp_dir = temp_folder()
db_file = os.path.join(tmp_dir, "dbfile")
... | 38.376623 | 99 | 0.671743 | import os
import unittest
import uuid
import six
import pytest
from conans.client.store.localdb import LocalDB
from conans.test.utils.test_files import temp_folder
class LocalStoreTest(unittest.TestCase):
def test_localdb(self):
tmp_dir = temp_folder()
db_file = os.path.join(tmp_dir, "dbfile")
... | true | true |
1c46ae0e3f4a04853fd12feddc7987c8067cadb2 | 934 | py | Python | django_angular_url/templatetags/django_angular_url_tags.py | rafitorres/django-angular-url | c9734f54370f4fb0d2d7bfd2248107ba93126aac | [
"MIT"
] | 1 | 2018-06-17T19:28:24.000Z | 2018-06-17T19:28:24.000Z | django_angular_url/templatetags/django_angular_url_tags.py | rafitorres/django-angular-url | c9734f54370f4fb0d2d7bfd2248107ba93126aac | [
"MIT"
] | null | null | null | django_angular_url/templatetags/django_angular_url_tags.py | rafitorres/django-angular-url | c9734f54370f4fb0d2d7bfd2248107ba93126aac | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
from django.template import Library
from django.core.exceptions import ImproperlyConfigured
from django.utils.safestring import mark_safe
from django_angular_url.core.urlresolvers import get_urls
register = Library()
@register.simple_tag(na... | 32.206897 | 72 | 0.671306 | from __future__ import unicode_literals
import json
from django.template import Library
from django.core.exceptions import ImproperlyConfigured
from django.utils.safestring import mark_safe
from django_angular_url.core.urlresolvers import get_urls
register = Library()
@register.simple_tag(name='load_djng_urls', tak... | true | true |
1c46af2a12398dfe071582314575709997860fcd | 5,438 | py | Python | Dell/benchmarks/rnnt/implementations/DSS8440x8A100-PCIE-80GB/bind_launch.py | gglin001/training_results_v1.1 | 58fd4103f0f465bda6eb56a06a74b7bbccbbcf24 | [
"Apache-2.0"
] | null | null | null | Dell/benchmarks/rnnt/implementations/DSS8440x8A100-PCIE-80GB/bind_launch.py | gglin001/training_results_v1.1 | 58fd4103f0f465bda6eb56a06a74b7bbccbbcf24 | [
"Apache-2.0"
] | null | null | null | Dell/benchmarks/rnnt/implementations/DSS8440x8A100-PCIE-80GB/bind_launch.py | gglin001/training_results_v1.1 | 58fd4103f0f465bda6eb56a06a74b7bbccbbcf24 | [
"Apache-2.0"
] | null | null | null | import sys
import subprocess
import os
import socket
from argparse import ArgumentParser, REMAINDER
import torch
def parse_args():
"""
Helper function parsing the command line options
@retval ArgumentParser
"""
parser = ArgumentParser(description="PyTorch distributed training launch "
... | 40.887218 | 109 | 0.578338 | import sys
import subprocess
import os
import socket
from argparse import ArgumentParser, REMAINDER
import torch
def parse_args():
parser = ArgumentParser(description="PyTorch distributed training launch "
"helper utilty that will spawn up "
... | true | true |
1c46b0e8e1b0e69a358fe2773d36f1292eb76c39 | 141 | py | Python | escapement/__init__.py | willingc/escapement | a02cc5f4367acf6cbc7f0734744b5093b4b02597 | [
"MIT"
] | null | null | null | escapement/__init__.py | willingc/escapement | a02cc5f4367acf6cbc7f0734744b5093b4b02597 | [
"MIT"
] | null | null | null | escapement/__init__.py | willingc/escapement | a02cc5f4367acf6cbc7f0734744b5093b4b02597 | [
"MIT"
] | null | null | null | """Top-level package for Escapement."""
__author__ = """Carol Willing"""
__email__ = "willingc@willingconsulting.com"
__version__ = "0.1.0"
| 23.5 | 44 | 0.716312 |
__author__ = """Carol Willing"""
__email__ = "willingc@willingconsulting.com"
__version__ = "0.1.0"
| true | true |
1c46b17b4df598ba18d2b2ad0e6b4ffe03ea914e | 2,378 | py | Python | gemd/demo/measurement_example.py | ventura-rivera/gemd-python | 078eed39de852f830111b77306c2f35146de8ec3 | [
"Apache-2.0"
] | null | null | null | gemd/demo/measurement_example.py | ventura-rivera/gemd-python | 078eed39de852f830111b77306c2f35146de8ec3 | [
"Apache-2.0"
] | null | null | null | gemd/demo/measurement_example.py | ventura-rivera/gemd-python | 078eed39de852f830111b77306c2f35146de8ec3 | [
"Apache-2.0"
] | null | null | null | """Demonstrate attaching measurements to a material."""
import random
import string
from gemd.entity.attribute.property import Property
from gemd.entity.object import MeasurementRun
from gemd.entity.value.nominal_real import NominalReal
from gemd.entity.value.normal_real import NormalReal
from gemd.enumeration import ... | 31.706667 | 82 | 0.616905 | import random
import string
from gemd.entity.attribute.property import Property
from gemd.entity.object import MeasurementRun
from gemd.entity.value.nominal_real import NominalReal
from gemd.entity.value.normal_real import NormalReal
from gemd.enumeration import Origin
thickness = 4.0 length = 80.0 width = 10.0 sp... | true | true |
1c46b284df73fbe899299978530eccccf17a8af1 | 3,066 | py | Python | vqa_image_preprocess.py | strieb/VisualQuestionAnswering | 28f6ae1f2abd839145306a1d4f34ee84271cf3c1 | [
"MIT"
] | 1 | 2020-04-23T09:15:33.000Z | 2020-04-23T09:15:33.000Z | vqa_image_preprocess.py | strieb/VisualQuestionAnswering | 28f6ae1f2abd839145306a1d4f34ee84271cf3c1 | [
"MIT"
] | null | null | null | vqa_image_preprocess.py | strieb/VisualQuestionAnswering | 28f6ae1f2abd839145306a1d4f34ee84271cf3c1 | [
"MIT"
] | null | null | null | import json
from collections import Counter
import re
from VQA.PythonHelperTools.vqaTools.vqa import VQA
import random
import numpy as np
from keras.preprocessing.image import load_img, img_to_array, ImageDataGenerator
from matplotlib import pyplot as plt
import os
import VQAModel
from keras.applications.xception impor... | 37.851852 | 109 | 0.643509 | import json
from collections import Counter
import re
from VQA.PythonHelperTools.vqaTools.vqa import VQA
import random
import numpy as np
from keras.preprocessing.image import load_img, img_to_array, ImageDataGenerator
from matplotlib import pyplot as plt
import os
import VQAModel
from keras.applications.xception impor... | true | true |
1c46b394ee538fa30ae70b23a0b2eab1f2c3432d | 554 | py | Python | fn_isitPhishing/fn_isitPhishing/lib/isitphishing_util.py | rudimeyer/resilient-community-apps | 7a46841ba41fa7a1c421d4b392b0a3ca9e36bd00 | [
"MIT"
] | 1 | 2020-08-25T03:43:07.000Z | 2020-08-25T03:43:07.000Z | fn_isitPhishing/fn_isitPhishing/lib/isitphishing_util.py | rudimeyer/resilient-community-apps | 7a46841ba41fa7a1c421d4b392b0a3ca9e36bd00 | [
"MIT"
] | 1 | 2019-07-08T16:57:48.000Z | 2019-07-08T16:57:48.000Z | fn_isitPhishing/fn_isitPhishing/lib/isitphishing_util.py | rudimeyer/resilient-community-apps | 7a46841ba41fa7a1c421d4b392b0a3ca9e36bd00 | [
"MIT"
] | null | null | null | import sys
import base64
def get_license_key(name, license):
# Compute the base64 license key. This key will be provided to you by Vade Secure,
# and has the following format: <CUSTOMER_NAME>:<CUSTOMER_LICENSE>.
url_key = u'{0}:{1}'.format(name, license)
# It must be Base64-encoded. Handled different... | 34.625 | 86 | 0.689531 | import sys
import base64
def get_license_key(name, license):
url_key = u'{0}:{1}'.format(name, license)
if sys.version_info[0] == 2:
auth_token = base64.b64encode(bytes(url_key).encode("utf-8"))
else:
auth_token = base64.b64encode(bytes(url_key, 'ascii')).decode('ascii')
... | true | true |
1c46b5a4c2eb213dddaa023db5903639152bb058 | 110 | py | Python | padaquant/__init__.py | felipm13/PadaQuant | 09c13d60dee2a75488e101391ab09e9845a66cb5 | [
"MIT"
] | 1 | 2019-06-21T01:13:29.000Z | 2019-06-21T01:13:29.000Z | padaquant/__init__.py | felipm13/PadaQuant | 09c13d60dee2a75488e101391ab09e9845a66cb5 | [
"MIT"
] | null | null | null | padaquant/__init__.py | felipm13/PadaQuant | 09c13d60dee2a75488e101391ab09e9845a66cb5 | [
"MIT"
] | null | null | null | import sys
from padaquant.asset_manager import asset_manager
from padaquant.blackscholes import blackscholes
| 22 | 49 | 0.881818 | import sys
from padaquant.asset_manager import asset_manager
from padaquant.blackscholes import blackscholes
| true | true |
1c46b5bee90335b45c1737463373c781e1e0b924 | 1,811 | py | Python | python/ray/tests/test_scheduling_2.py | daobook/ray | af9f1ef4dc160e0671206556b387f8017f3c3930 | [
"Apache-2.0"
] | 33 | 2020-05-27T14:25:24.000Z | 2022-03-22T06:11:30.000Z | python/ray/tests/test_scheduling_2.py | daobook/ray | af9f1ef4dc160e0671206556b387f8017f3c3930 | [
"Apache-2.0"
] | 115 | 2021-01-19T04:40:50.000Z | 2022-03-26T07:09:00.000Z | python/ray/tests/test_scheduling_2.py | daobook/ray | af9f1ef4dc160e0671206556b387f8017f3c3930 | [
"Apache-2.0"
] | 5 | 2020-08-06T15:53:07.000Z | 2022-02-09T03:31:31.000Z | import numpy as np
import platform
import pytest
import sys
import time
import ray
@pytest.mark.skipif(
platform.system() == "Windows", reason="Failing on Windows. Multi node.")
def test_load_balancing_under_constrained_memory(ray_start_cluster):
# This test ensures that tasks are being assigned to all rayle... | 30.694915 | 77 | 0.663722 | import numpy as np
import platform
import pytest
import sys
import time
import ray
@pytest.mark.skipif(
platform.system() == "Windows", reason="Failing on Windows. Multi node.")
def test_load_balancing_under_constrained_memory(ray_start_cluster):
cluster = ray_start_cluster
num_nodes = 3
num_... | true | true |
1c46b5cfbdc2bcd213cc2381fa6bb4cc7a0d00c3 | 323 | py | Python | tests/naip/test_stac.py | lossyrob/stactools | 68f416de38d91738a62c1b090a9c40cc2e56a9f6 | [
"Apache-2.0"
] | 1 | 2022-03-28T19:13:53.000Z | 2022-03-28T19:13:53.000Z | tests/naip/test_stac.py | lossyrob/stactools | 68f416de38d91738a62c1b090a9c40cc2e56a9f6 | [
"Apache-2.0"
] | 3 | 2021-08-12T18:06:50.000Z | 2022-03-29T14:20:33.000Z | tests/test_stac.py | stactools-packages/naip | 1f13cc86664436a10f7942ab06547f7e3d8b8928 | [
"Apache-2.0"
] | null | null | null | import unittest
from stactools.naip.stac import create_collection
class StacTest(unittest.TestCase):
def test_create_collection(self):
collection = create_collection(seasons=[2011, 2013, 2015, 2017, 2019])
collection.set_self_href('http://example.com/collection.json')
collection.validate... | 26.916667 | 78 | 0.739938 | import unittest
from stactools.naip.stac import create_collection
class StacTest(unittest.TestCase):
def test_create_collection(self):
collection = create_collection(seasons=[2011, 2013, 2015, 2017, 2019])
collection.set_self_href('http://example.com/collection.json')
collection.validate... | true | true |
1c46b5f9d0a2b7779bfbb2eb9b3e116a5cd194b6 | 493 | py | Python | Lib/site-packages/plotly/validators/scattercarpet/_uid.py | tytanya/my-first-blog | 2b40adb0816c3546e90ad6ca1e7fb50d924c1536 | [
"bzip2-1.0.6"
] | 12 | 2020-04-18T18:10:22.000Z | 2021-12-06T10:11:15.000Z | plotly/validators/scattercarpet/_uid.py | Vesauza/plotly.py | e53e626d59495d440341751f60aeff73ff365c28 | [
"MIT"
] | 6 | 2021-03-18T22:27:08.000Z | 2022-03-11T23:40:50.000Z | plotly/validators/scattercarpet/_uid.py | Vesauza/plotly.py | e53e626d59495d440341751f60aeff73ff365c28 | [
"MIT"
] | 6 | 2020-04-18T23:07:08.000Z | 2021-11-18T07:53:06.000Z | import _plotly_utils.basevalidators
class UidValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self, plotly_name='uid', parent_name='scattercarpet', **kwargs
):
super(UidValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | 29 | 70 | 0.614604 | import _plotly_utils.basevalidators
class UidValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self, plotly_name='uid', parent_name='scattercarpet', **kwargs
):
super(UidValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | true | true |
1c46b67a3322491426a8dcefbb023986ece49b17 | 26,977 | py | Python | src/olympia/activity/models.py | elyse0/addons-server | 44fa4946b4b82f7003687b590b8c82c10c418e9e | [
"BSD-3-Clause"
] | null | null | null | src/olympia/activity/models.py | elyse0/addons-server | 44fa4946b4b82f7003687b590b8c82c10c418e9e | [
"BSD-3-Clause"
] | 760 | 2021-05-17T07:59:30.000Z | 2022-03-31T11:14:15.000Z | src/olympia/activity/models.py | championshuttler/addons-server | 5d4c1bfbed2fc509ecc1f3f5065955996e057eeb | [
"BSD-3-Clause"
] | null | null | null | import json
import string
import uuid
from collections import defaultdict
from copy import copy
from datetime import datetime
from django.apps import apps
from django.conf import settings
from django.db import models
from django.utils import timezone
from django.utils.functional import cached_property
from django.uti... | 35.87367 | 88 | 0.586907 | import json
import string
import uuid
from collections import defaultdict
from copy import copy
from datetime import datetime
from django.apps import apps
from django.conf import settings
from django.db import models
from django.utils import timezone
from django.utils.functional import cached_property
from django.uti... | true | true |
1c46b6c6d53ac094d8f4c8e0d1401edb439f6fc3 | 4,863 | py | Python | tests/core/test_virtual_group.py | TileDB-Inc/TileDB-CF-Py | 9aab0fe9ba7346a1846c7458a5d08b123dcf90a8 | [
"MIT"
] | 12 | 2021-06-07T16:51:32.000Z | 2022-03-10T12:48:00.000Z | tests/core/test_virtual_group.py | TileDB-Inc/TileDB-CF-Py | 9aab0fe9ba7346a1846c7458a5d08b123dcf90a8 | [
"MIT"
] | 72 | 2021-04-28T21:49:41.000Z | 2022-02-24T13:58:11.000Z | tests/core/test_virtual_group.py | TileDB-Inc/TileDB-CF-Py | 9aab0fe9ba7346a1846c7458a5d08b123dcf90a8 | [
"MIT"
] | 3 | 2021-08-11T16:33:37.000Z | 2021-12-01T20:31:12.000Z | # Copyright 2021 TileDB Inc.
# Licensed under the MIT License.
import numpy as np
import pytest
import tiledb
from tiledb.cf import GroupSchema, VirtualGroup
_row = tiledb.Dim(name="rows", domain=(1, 4), tile=4, dtype=np.uint64)
_col = tiledb.Dim(name="cols", domain=(1, 4), tile=4, dtype=np.uint64)
_attr_a = tiledb... | 34.006993 | 88 | 0.631298 | import numpy as np
import pytest
import tiledb
from tiledb.cf import GroupSchema, VirtualGroup
_row = tiledb.Dim(name="rows", domain=(1, 4), tile=4, dtype=np.uint64)
_col = tiledb.Dim(name="cols", domain=(1, 4), tile=4, dtype=np.uint64)
_attr_a = tiledb.Attr(name="a", dtype=np.uint64)
_attr_b = tiledb.Attr(name="b"... | true | true |
1c46bab99d58eea58a638a070fe13030e84bce32 | 14,212 | py | Python | tensorflow/contrib/timeseries/examples/lstm.py | uve/tensorflow | e08079463bf43e5963acc41da1f57e95603f8080 | [
"Apache-2.0"
] | null | null | null | tensorflow/contrib/timeseries/examples/lstm.py | uve/tensorflow | e08079463bf43e5963acc41da1f57e95603f8080 | [
"Apache-2.0"
] | null | null | null | tensorflow/contrib/timeseries/examples/lstm.py | uve/tensorflow | e08079463bf43e5963acc41da1f57e95603f8080 | [
"Apache-2.0"
] | null | null | null | # 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... | 47.373333 | 88 | 0.700113 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
from os import path
import tempfile
import numpy
import tensorflow as tf
from tensorflow.contrib.timeseries.python.timeseries import estimators as ts_estimators
from tensorflow.... | true | true |
1c46bc0e536a5b58bd77d13f7adfafa098ff3d02 | 2,906 | py | Python | initialExp/classifiers/iscx_naive_bayes.py | bakkerjarr/NetTrafClassificationExploration | 66febafcbe4820851784ae72c50a49c28fa91df4 | [
"Apache-2.0"
] | null | null | null | initialExp/classifiers/iscx_naive_bayes.py | bakkerjarr/NetTrafClassificationExploration | 66febafcbe4820851784ae72c50a49c28fa91df4 | [
"Apache-2.0"
] | null | null | null | initialExp/classifiers/iscx_naive_bayes.py | bakkerjarr/NetTrafClassificationExploration | 66febafcbe4820851784ae72c50a49c28fa91df4 | [
"Apache-2.0"
] | null | null | null | # Copyright 2016 Jarrod N. Bakker
#
# 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 writi... | 38.746667 | 74 | 0.63627 |
from numpy import float32 as np_float
import numpy.core.multiarray as np_array
from sklearn.naive_bayes import GaussianNB
import iscx_result_calc as rc
__author__ = "Jarrod N. Bakker"
class NaiveBayesCls:
NAME = "Naive_Bayes"
def __init__(self, data, labels, skf):
self._data = data
self.... | true | true |
1c46bc96f2ea4fe428bfdde14733d08a8f455696 | 84,164 | py | Python | core/domain/state_domain.py | SamriddhiMishra/oppia | 9f239ce13c11e60e64ca7c04726a55755231d530 | [
"Apache-2.0"
] | null | null | null | core/domain/state_domain.py | SamriddhiMishra/oppia | 9f239ce13c11e60e64ca7c04726a55755231d530 | [
"Apache-2.0"
] | null | null | null | core/domain/state_domain.py | SamriddhiMishra/oppia | 9f239ce13c11e60e64ca7c04726a55755231d530 | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
#
# Copyright 2018 The Oppia 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 requi... | 41.256863 | 80 | 0.624032 |
from __future__ import absolute_import from __future__ import unicode_literals
import collections
import copy
import logging
from constants import constants
from core.domain import customization_args_util
from core.domain import html_cleaner
from core.domain import interaction_registry
from core.domain import par... | true | true |
1c46bcd3d9c7631a1c1fc9bbcad0750ae3adc519 | 159 | py | Python | src/dash_init.py | JavaScriipt/iHashTag | 3b6e95fde0e4b7f35e074c0b0733f2b98bc7763a | [
"CC0-1.0"
] | null | null | null | src/dash_init.py | JavaScriipt/iHashTag | 3b6e95fde0e4b7f35e074c0b0733f2b98bc7763a | [
"CC0-1.0"
] | null | null | null | src/dash_init.py | JavaScriipt/iHashTag | 3b6e95fde0e4b7f35e074c0b0733f2b98bc7763a | [
"CC0-1.0"
] | null | null | null | import os
file = open("resultados.txt", "w")
file.write("Timestamp, Muy Positivos, Muy Negativos, Neutros, Negativos, Muy Negativos, Average\n")
file.close()
| 26.5 | 99 | 0.735849 | import os
file = open("resultados.txt", "w")
file.write("Timestamp, Muy Positivos, Muy Negativos, Neutros, Negativos, Muy Negativos, Average\n")
file.close()
| true | true |
1c46bcdb1d10c9fe63a5f971609c2b06295d9890 | 1,926 | py | Python | setup.py | wj-Mcat/python-wechaty-puppet-official-account | 92e762b0345c1faab2563d6da302efa4de273425 | [
"Apache-2.0"
] | null | null | null | setup.py | wj-Mcat/python-wechaty-puppet-official-account | 92e762b0345c1faab2563d6da302efa4de273425 | [
"Apache-2.0"
] | null | null | null | setup.py | wj-Mcat/python-wechaty-puppet-official-account | 92e762b0345c1faab2563d6da302efa4de273425 | [
"Apache-2.0"
] | null | null | null | """
setup
"""
import os
import semver
import setuptools
def versioning(version: str) -> str:
"""
version to specification
X.Y.Z -> X.Y.devZ
"""
sem_ver = semver.parse(version)
major = sem_ver['major']
minor = sem_ver['minor']
patch = str(sem_ver['patch'])
fin_ver = '%d.%d.%s' % ... | 23.204819 | 76 | 0.609034 | import os
import semver
import setuptools
def versioning(version: str) -> str:
sem_ver = semver.parse(version)
major = sem_ver['major']
minor = sem_ver['minor']
patch = str(sem_ver['patch'])
fin_ver = '%d.%d.%s' % (
major,
minor,
patch,
)
return fin_ver
def ge... | true | true |
1c46bf0877dd01db082a6f46e72eeec5ee132dde | 5,847 | py | Python | scripts/inspect_un_data_sets.py | arwhyte/SI664-scripts | 99daaac123ebdbfb0fbca59251f711efb9a7d39f | [
"MIT"
] | null | null | null | scripts/inspect_un_data_sets.py | arwhyte/SI664-scripts | 99daaac123ebdbfb0fbca59251f711efb9a7d39f | [
"MIT"
] | null | null | null | scripts/inspect_un_data_sets.py | arwhyte/SI664-scripts | 99daaac123ebdbfb0fbca59251f711efb9a7d39f | [
"MIT"
] | 1 | 2018-12-08T16:43:45.000Z | 2018-12-08T16:43:45.000Z | import logging
import os
import pandas as pd
import sys as sys
def main(argv=None):
"""
Utilize Pandas library to read in both UNSD M49 country and area .csv file
(tab delimited) as well as the UNESCO heritage site .csv file (tab delimited).
Extract regions, sub-regions, intermediate regions, country and areas, a... | 43.962406 | 94 | 0.783308 | import logging
import os
import pandas as pd
import sys as sys
def main(argv=None):
if argv is None:
argv = sys.argv
msg = [
'Source file read {0}',
'UNSD M49 regions written to file {0}',
'UNSD M49 sub-regions written to file {0}',
'UNSD M49 intermediate regions written to file {0}',
'UNSD M49 countri... | true | true |
1c46bf9669398d790db830f2381d8c2ac1675ffc | 4,642 | py | Python | tests/unit/workflows/java_gradle/test_gradle.py | verdimrc/aws-lambda-builders | 67f42dd936fd4f0c517c38acb8b6a170156549ec | [
"Apache-2.0"
] | 1 | 2020-07-21T20:16:12.000Z | 2020-07-21T20:16:12.000Z | tests/unit/workflows/java_gradle/test_gradle.py | verdimrc/aws-lambda-builders | 67f42dd936fd4f0c517c38acb8b6a170156549ec | [
"Apache-2.0"
] | 1 | 2020-06-26T12:36:39.000Z | 2020-06-26T12:36:39.000Z | tests/unit/workflows/java_gradle/test_gradle.py | verdimrc/aws-lambda-builders | 67f42dd936fd4f0c517c38acb8b6a170156549ec | [
"Apache-2.0"
] | 1 | 2020-04-02T19:12:39.000Z | 2020-04-02T19:12:39.000Z | import subprocess
from unittest import TestCase
from mock import patch
from aws_lambda_builders.binary_path import BinaryPath
from aws_lambda_builders.workflows.java_gradle.gradle import (
SubprocessGradle,
GradleExecutionError,
BuildFileNotFoundError,
)
class FakePopen:
def __init__(self, out=b"out... | 40.719298 | 119 | 0.673632 | import subprocess
from unittest import TestCase
from mock import patch
from aws_lambda_builders.binary_path import BinaryPath
from aws_lambda_builders.workflows.java_gradle.gradle import (
SubprocessGradle,
GradleExecutionError,
BuildFileNotFoundError,
)
class FakePopen:
def __init__(self, out=b"out... | true | true |
1c46c13896c2f68690261b134a22b45479e29be0 | 4,599 | py | Python | test/connector/exchange/crypto_com/test_crypto_com_order_book_tracker.py | BGTCapital/hummingbot | 2c50f50d67cedccf0ef4d8e3f4c8cdce3dc87242 | [
"Apache-2.0"
] | 3,027 | 2019-04-04T18:52:17.000Z | 2022-03-30T09:38:34.000Z | test/connector/exchange/crypto_com/test_crypto_com_order_book_tracker.py | BGTCapital/hummingbot | 2c50f50d67cedccf0ef4d8e3f4c8cdce3dc87242 | [
"Apache-2.0"
] | 4,080 | 2019-04-04T19:51:11.000Z | 2022-03-31T23:45:21.000Z | test/connector/exchange/crypto_com/test_crypto_com_order_book_tracker.py | BGTCapital/hummingbot | 2c50f50d67cedccf0ef4d8e3f4c8cdce3dc87242 | [
"Apache-2.0"
] | 1,342 | 2019-04-04T20:50:53.000Z | 2022-03-31T15:22:36.000Z | #!/usr/bin/env python
from os.path import join, realpath
import sys; sys.path.insert(0, realpath(join(__file__, "../../../../../")))
import math
import time
import asyncio
import logging
import unittest
from typing import Dict, Optional, List
from hummingbot.core.event.event_logger import EventLogger
from hummingbot.co... | 42.583333 | 122 | 0.688845 | from os.path import join, realpath
import sys; sys.path.insert(0, realpath(join(__file__, "../../../../../")))
import math
import time
import asyncio
import logging
import unittest
from typing import Dict, Optional, List
from hummingbot.core.event.event_logger import EventLogger
from hummingbot.core.event.events import... | true | true |
1c46c1a3d3a1d1d7895e4b0c6561df3c3c4494fb | 4,771 | py | Python | library/wait_for_pid.py | dusennn/clickhouse-ansible | e1fb665c2afc095c9a46087bf948b633e7bcd6f6 | [
"Apache-2.0"
] | 2 | 2021-09-27T10:16:17.000Z | 2021-09-27T10:18:20.000Z | library/wait_for_pid.py | dusennn/clickhouse-ansible | e1fb665c2afc095c9a46087bf948b633e7bcd6f6 | [
"Apache-2.0"
] | null | null | null | library/wait_for_pid.py | dusennn/clickhouse-ansible | e1fb665c2afc095c9a46087bf948b633e7bcd6f6 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import binascii
import datetime
import math
import re
import select
import socket
import sys
import time
import os
from ansible.module_utils._text import to_native
def main():
module = AnsibleModule(
argument_spec = dict(
pid=dict(default=None, type=... | 35.080882 | 123 | 0.530916 |
import binascii
import datetime
import math
import re
import select
import socket
import sys
import time
import os
from ansible.module_utils._text import to_native
def main():
module = AnsibleModule(
argument_spec = dict(
pid=dict(default=None, type='int'),
pid_file=dict(default=N... | true | true |
1c46c33547965d1902ac5b6fd51ac5393e78bf60 | 3,694 | py | Python | nengo/utils/tests/test_ensemble.py | HugoChateauLaurent/nengo | 749893186ee09aa6c621a40da3ffd3878114db9c | [
"BSD-2-Clause"
] | null | null | null | nengo/utils/tests/test_ensemble.py | HugoChateauLaurent/nengo | 749893186ee09aa6c621a40da3ffd3878114db9c | [
"BSD-2-Clause"
] | null | null | null | nengo/utils/tests/test_ensemble.py | HugoChateauLaurent/nengo | 749893186ee09aa6c621a40da3ffd3878114db9c | [
"BSD-2-Clause"
] | null | null | null | from __future__ import absolute_import
import numpy as np
import mpl_toolkits.mplot3d
import pytest
import nengo
from nengo.dists import Uniform
from nengo.utils.ensemble import response_curves, tuning_curves
def plot_tuning_curves(plt, eval_points, activities):
if eval_points.ndim <= 2:
plt.plot(eval_p... | 33.581818 | 79 | 0.692204 | from __future__ import absolute_import
import numpy as np
import mpl_toolkits.mplot3d
import pytest
import nengo
from nengo.dists import Uniform
from nengo.utils.ensemble import response_curves, tuning_curves
def plot_tuning_curves(plt, eval_points, activities):
if eval_points.ndim <= 2:
plt.plot(eval_p... | true | true |
1c46c3bd574a713b7791ae587b09e515b813b794 | 584 | py | Python | tock/employees/migrations/0024_auto_20171229_1156.py | mikiec84/tock | 15318a45b2b144360e4d7e15db655467a45c2ab9 | [
"CC0-1.0"
] | 134 | 2015-02-02T18:42:03.000Z | 2022-01-20T04:27:06.000Z | tock/employees/migrations/0024_auto_20171229_1156.py | mikiec84/tock | 15318a45b2b144360e4d7e15db655467a45c2ab9 | [
"CC0-1.0"
] | 1,220 | 2015-03-19T01:57:30.000Z | 2022-03-23T21:52:15.000Z | tock/employees/migrations/0024_auto_20171229_1156.py | mikiec84/tock | 15318a45b2b144360e4d7e15db655467a45c2ab9 | [
"CC0-1.0"
] | 49 | 2015-03-09T15:44:33.000Z | 2022-01-19T02:02:37.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2017-12-29 16:56
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('employees', '0023_userdata_organization'),
]
opera... | 26.545455 | 137 | 0.667808 | from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('employees', '0023_userdata_organization'),
]
operations = [
migrations.AlterField(
model_name='userdata... | true | true |
1c46c3de0b7231d58a348ef921880f2a3b454ce7 | 64,803 | py | Python | Base Converter/main.py | mrif449/simple-python-projects | 1d57b861f2d54568ebab955722f782a351a57f21 | [
"MIT"
] | null | null | null | Base Converter/main.py | mrif449/simple-python-projects | 1d57b861f2d54568ebab955722f782a351a57f21 | [
"MIT"
] | null | null | null | Base Converter/main.py | mrif449/simple-python-projects | 1d57b861f2d54568ebab955722f782a351a57f21 | [
"MIT"
] | null | null | null | print("Welcome to Base Converter Calculator!!!")
print("You can select your calculation mode by entering the serial number, or write 'close' stop calculating.")
print()
print("Note: You can also close the whole program by pressing Enter after closing calculation menu or manually.")
#Options:
print("Basic Bases:"... | 38.141848 | 114 | 0.290496 | print("Welcome to Base Converter Calculator!!!")
print("You can select your calculation mode by entering the serial number, or write 'close' stop calculating.")
print()
print("Note: You can also close the whole program by pressing Enter after closing calculation menu or manually.")
print("Basic Bases:")
print("D... | true | true |
1c46c40e2bfd9e44bd757c0752d89f57ed80ef32 | 9,575 | py | Python | env/lib/python3.8/site-packages/plotly/graph_objs/scattergl/marker/colorbar/_tickformatstop.py | acrucetta/Chicago_COVI_WebApp | a37c9f492a20dcd625f8647067394617988de913 | [
"MIT",
"Unlicense"
] | 11,750 | 2015-10-12T07:03:39.000Z | 2022-03-31T20:43:15.000Z | env/lib/python3.8/site-packages/plotly/graph_objs/scattergl/marker/colorbar/_tickformatstop.py | acrucetta/Chicago_COVI_WebApp | a37c9f492a20dcd625f8647067394617988de913 | [
"MIT",
"Unlicense"
] | 2,951 | 2015-10-12T00:41:25.000Z | 2022-03-31T22:19:26.000Z | env/lib/python3.8/site-packages/plotly/graph_objs/scattergl/marker/colorbar/_tickformatstop.py | acrucetta/Chicago_COVI_WebApp | a37c9f492a20dcd625f8647067394617988de913 | [
"MIT",
"Unlicense"
] | 2,623 | 2015-10-15T14:40:27.000Z | 2022-03-28T16:05:50.000Z | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Tickformatstop(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scattergl.marker.colorbar"
_path_str = "scattergl.marker.colorbar.tickformatstop"
_v... | 33.714789 | 85 | 0.571488 | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Tickformatstop(_BaseTraceHierarchyType):
_parent_path_str = "scattergl.marker.colorbar"
_path_str = "scattergl.marker.colorbar.tickformatstop"
_valid_props = {"dtickrange", "enabled", "na... | true | true |
1c46c46c1f4c709d35888c5eb3d047bbc9d4d31c | 351 | py | Python | src/code-challenges/codewars/5KYU/productFib/test_productFib.py | maltewirz/code-challenges | 97777b10963f19bc587ddd984f0526b221c081f8 | [
"MIT"
] | 1 | 2020-08-30T07:52:20.000Z | 2020-08-30T07:52:20.000Z | src/code-challenges/codewars/5KYU/productFib/test_productFib.py | maltewirz/code-challenges | 97777b10963f19bc587ddd984f0526b221c081f8 | [
"MIT"
] | 6 | 2020-08-12T07:05:04.000Z | 2021-08-23T06:10:10.000Z | src/code-challenges/codewars/5KYU/productFib/test_productFib.py | maltewirz/code-challenges | 97777b10963f19bc587ddd984f0526b221c081f8 | [
"MIT"
] | null | null | null | from productFib import productFib
import unittest
class Test(unittest.TestCase):
def test_1(self):
result = productFib(4895)
self.assertEqual(result, [55, 89, True])
# def test_2(self):
# result = productFib(5895)
# self.assertEqual(result, [89, 144, False])
if __name__ == "... | 20.647059 | 52 | 0.641026 | from productFib import productFib
import unittest
class Test(unittest.TestCase):
def test_1(self):
result = productFib(4895)
self.assertEqual(result, [55, 89, True])
if __name__ == "__main__":
unittest.main()
| true | true |
1c46c4949b4efa2afa8ed0d4db1bfe2610a1a4ad | 622 | py | Python | generateFileList.py | mrzhu666/USCL | 8a4741046ef8f337b1e9439d1575db670a11355c | [
"MIT"
] | null | null | null | generateFileList.py | mrzhu666/USCL | 8a4741046ef8f337b1e9439d1575db670a11355c | [
"MIT"
] | null | null | null | generateFileList.py | mrzhu666/USCL | 8a4741046ef8f337b1e9439d1575db670a11355c | [
"MIT"
] | null | null | null | import cv2
import os
import pickle
from numpy.core.fromnumeric import shape
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from tqdm import tqdm
from typing import Tuple
from collections import defaultdict
from sklearn.model_selection import train_test_split
from IgAModel66.setting import config... | 23.037037 | 68 | 0.803859 | import cv2
import os
import pickle
from numpy.core.fromnumeric import shape
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from tqdm import tqdm
from typing import Tuple
from collections import defaultdict
from sklearn.model_selection import train_test_split
from IgAModel66.setting import config... | true | true |
1c46c54cd215d2279abe7d5e268fcf2822b63cd3 | 903 | py | Python | ultimatepython/data_structures/dict.py | Benczus/ultimate-python | 2bcc8233af7b21388b587812d3e5124189b8cdec | [
"MIT"
] | 1 | 2020-09-07T12:50:18.000Z | 2020-09-07T12:50:18.000Z | ultimatepython/data_structures/dict.py | Benczus/ultimate-python | 2bcc8233af7b21388b587812d3e5124189b8cdec | [
"MIT"
] | null | null | null | ultimatepython/data_structures/dict.py | Benczus/ultimate-python | 2bcc8233af7b21388b587812d3e5124189b8cdec | [
"MIT"
] | null | null | null | def main():
# Let's create a dictionary with student keys and GPA values
student_gpa = {"john": 3.5,
"jane": 4.0,
"bob": 2.8,
"mary": 3.2}
# There are four student records in this dictionary
assert len(student_gpa) == 4
# Each student has a ... | 28.21875 | 64 | 0.601329 | def main():
student_gpa = {"john": 3.5,
"jane": 4.0,
"bob": 2.8,
"mary": 3.2}
# There are four student records in this dictionary
assert len(student_gpa) == 4
# Each student has a name key and a GPA value
assert len(student_gpa.keys()) =... | true | true |
1c46c6c3ff147c8e547e3aaf58bce039d6e667a5 | 5,134 | py | Python | SCons/Scanner/DirTests.py | jcassagnol-public/scons | 8eaf585a893757e68c9e4a6e25d375021fa5eab7 | [
"MIT"
] | null | null | null | SCons/Scanner/DirTests.py | jcassagnol-public/scons | 8eaf585a893757e68c9e4a6e25d375021fa5eab7 | [
"MIT"
] | null | null | null | SCons/Scanner/DirTests.py | jcassagnol-public/scons | 8eaf585a893757e68c9e4a6e25d375021fa5eab7 | [
"MIT"
] | null | null | null | # MIT License
#
# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, ... | 39.19084 | 105 | 0.614725 |
import os.path
import unittest
import TestCmd
import SCons.Node.FS
import SCons.Scanner.Dir
from SCons.SConsign import current_sconsign_filename
class DummyEnvironment:
def __init__(self, root):
self.fs = SCons.Node.FS.FS(root)
def Dir(self, name):
return self.fs.Dir(name)
def Entry(sel... | true | true |
1c46c7815098b0d623f6f7a150989694f53aa6f2 | 877 | py | Python | show/gearbox.py | sg893052/sonic-utilities | fdb79b8d65b8ca22232f4e6b140f593dd01613d5 | [
"Apache-2.0"
] | 91 | 2016-03-23T14:24:41.000Z | 2022-03-18T20:25:37.000Z | show/gearbox.py | sg893052/sonic-utilities | fdb79b8d65b8ca22232f4e6b140f593dd01613d5 | [
"Apache-2.0"
] | 1,495 | 2017-02-15T10:49:10.000Z | 2022-03-31T18:49:56.000Z | show/gearbox.py | sg893052/sonic-utilities | fdb79b8d65b8ca22232f4e6b140f593dd01613d5 | [
"Apache-2.0"
] | 466 | 2016-04-25T09:31:23.000Z | 2022-03-31T06:54:17.000Z | import click
import utilities_common.cli as clicommon
@click.group(cls=clicommon.AliasedGroup)
def gearbox():
"""Show gearbox info"""
pass
# 'phys' subcommand ("show gearbox phys")
@gearbox.group(cls=clicommon.AliasedGroup)
def phys():
"""Show external PHY information"""
pass
# 'status' subcommand (... | 25.057143 | 58 | 0.729761 | import click
import utilities_common.cli as clicommon
@click.group(cls=clicommon.AliasedGroup)
def gearbox():
pass
@gearbox.group(cls=clicommon.AliasedGroup)
def phys():
pass
@phys.command()
@click.pass_context
def status(ctx):
clicommon.run_command("gearboxutil phys status")
@gearbox.group(cls=clicomm... | true | true |
1c46c7dc238b0a632c7b17c278cc27218f17eb00 | 6,095 | py | Python | software/metax/WeightDBUtilities.py | adellanno/MetaXcan | cfc9e369bbf5630e0c9488993cd877f231c5d02e | [
"MIT"
] | 83 | 2016-07-19T20:14:52.000Z | 2022-03-28T17:02:39.000Z | software/metax/WeightDBUtilities.py | adellanno/MetaXcan | cfc9e369bbf5630e0c9488993cd877f231c5d02e | [
"MIT"
] | 75 | 2016-02-25T16:43:17.000Z | 2022-03-30T14:19:03.000Z | software/metax/WeightDBUtilities.py | adellanno/MetaXcan | cfc9e369bbf5630e0c9488993cd877f231c5d02e | [
"MIT"
] | 71 | 2016-02-11T17:10:32.000Z | 2022-03-30T20:15:19.000Z | __author__ = 'heroico'
import sqlite3
import os
from collections import OrderedDict
from . import Exceptions
class GeneEntry:
def __init__(self, gene, gene_name, n_snps, R2, pval,qval):
self.gene = gene
self.gene_name = gene_name
self.n_snps = n_snps
self.pred_perf_R2 = R2
... | 35.643275 | 183 | 0.612961 | __author__ = 'heroico'
import sqlite3
import os
from collections import OrderedDict
from . import Exceptions
class GeneEntry:
def __init__(self, gene, gene_name, n_snps, R2, pval,qval):
self.gene = gene
self.gene_name = gene_name
self.n_snps = n_snps
self.pred_perf_R2 = R2
... | true | true |
1c46c9cfeb9efcce9902f255edbe15907ddf263e | 4,994 | py | Python | tests/http/test_fedclient.py | SimmyD/synapse | 26f2f1ca9a8ce6c32e574f0f0e60bb24b773c4e3 | [
"Apache-2.0"
] | null | null | null | tests/http/test_fedclient.py | SimmyD/synapse | 26f2f1ca9a8ce6c32e574f0f0e60bb24b773c4e3 | [
"Apache-2.0"
] | null | null | null | tests/http/test_fedclient.py | SimmyD/synapse | 26f2f1ca9a8ce6c32e574f0f0e60bb24b773c4e3 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright 2018 New Vector Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | 31.607595 | 79 | 0.647777 |
from mock import Mock
from twisted.internet.defer import TimeoutError
from twisted.internet.error import ConnectingCancelledError, DNSLookupError
from twisted.web.client import ResponseNeverReceived
from synapse.http.matrixfederationclient import MatrixFederationHttpClient
from tests.unittest import HomeserverTestC... | true | true |
1c46c9e13c1fa6ba1e653f1f33dbebace96b8941 | 1,046 | py | Python | release/stubs.min/Autodesk/Revit/DB/Structure/__init___parts/RebarShapeConstraintSagittaLength.py | htlcnn/ironpython-stubs | 780d829e2104b2789d5f4d6f32b0ec9f2930ca03 | [
"MIT"
] | 182 | 2017-06-27T02:26:15.000Z | 2022-03-30T18:53:43.000Z | release/stubs.min/Autodesk/Revit/DB/Structure/__init___parts/RebarShapeConstraintSagittaLength.py | htlcnn/ironpython-stubs | 780d829e2104b2789d5f4d6f32b0ec9f2930ca03 | [
"MIT"
] | 28 | 2017-06-27T13:38:23.000Z | 2022-03-15T11:19:44.000Z | release/stubs.min/Autodesk/Revit/DB/Structure/__init___parts/RebarShapeConstraintSagittaLength.py | htlcnn/ironpython-stubs | 780d829e2104b2789d5f4d6f32b0ec9f2930ca03 | [
"MIT"
] | 67 | 2017-06-28T09:43:59.000Z | 2022-03-20T21:17:10.000Z | class RebarShapeConstraintSagittaLength(RebarShapeConstraint,IDisposable):
"""
A constraint that can be applied to a RebarShapeDefinitionByArc
and drives the height of the arc.
RebarShapeConstraintSagittaLength(paramId: ElementId)
"""
def Dispose(self):
""" Dispose(self: RebarShapeConstraint,... | 34.866667 | 215 | 0.716061 | class RebarShapeConstraintSagittaLength(RebarShapeConstraint,IDisposable):
def Dispose(self):
pass
def ReleaseUnmanagedResources(self,*args):
pass
def __enter__(self,*args):
pass
def __exit__(self,*args):
pass
def __init__(self,*args):
pass
@staticmethod
def __new__(self,paramId):
pass
| true | true |
1c46ca25cd91c0be4a40c520f78d8264149c79a3 | 5,959 | py | Python | tests/unit/streamalert_cli/terraform/test_alert_processor.py | Meliairon/streamalert | 3b774a59d260b2822cd156e837781bd34f3625f7 | [
"Apache-2.0"
] | null | null | null | tests/unit/streamalert_cli/terraform/test_alert_processor.py | Meliairon/streamalert | 3b774a59d260b2822cd156e837781bd34f3625f7 | [
"Apache-2.0"
] | null | null | null | tests/unit/streamalert_cli/terraform/test_alert_processor.py | Meliairon/streamalert | 3b774a59d260b2822cd156e837781bd34f3625f7 | [
"Apache-2.0"
] | null | null | null | """
Copyright 2017-present Airbnb, 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, sof... | 44.470149 | 92 | 0.538345 | import unittest
from nose.tools import assert_equal
from streamalert_cli.config import CLIConfig
from streamalert_cli.terraform import alert_processor
class TestAlertProcessor(unittest.TestCase):
def setUp(self):
self.config = dict(CLIConfig(config_path='tests/unit/conf'))
self.alert_proc_confi... | true | true |
1c46cac18042c8dda9c7d3d35fb6a33fff5a1530 | 4,385 | py | Python | praisetheflesh/praisetheflesh/settings.py | robertraya/portfoliowebsite | 2a27b86c8cbb63a40025ecc35bc286d2f9654adf | [
"CC0-1.0"
] | null | null | null | praisetheflesh/praisetheflesh/settings.py | robertraya/portfoliowebsite | 2a27b86c8cbb63a40025ecc35bc286d2f9654adf | [
"CC0-1.0"
] | null | null | null | praisetheflesh/praisetheflesh/settings.py | robertraya/portfoliowebsite | 2a27b86c8cbb63a40025ecc35bc286d2f9654adf | [
"CC0-1.0"
] | null | null | null | """
Django settings for praisetheflesh project.
Generated by 'django-admin startproject' using Django 3.0.8.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
impor... | 25.346821 | 91 | 0.697834 |
import os
import django_heroku
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = os.getenv('SECRET_KEY', 'Optional default value')
DEBUG = False
ALLOWED_HOSTS = ['praisetheflesh.herokuapp.com', '127.0.0.1', 'praisetheflesh.com']
# Application definition
INSTALLED_APPS = [
... | true | true |
1c46cb1e70f734ca59a3951c76d89d67602e1d81 | 2,141 | py | Python | main.py | mzas/j2v | adf63ddd62a356faf845cf7fcb01dbdc81bf163e | [
"Apache-2.0"
] | null | null | null | main.py | mzas/j2v | adf63ddd62a356faf845cf7fcb01dbdc81bf163e | [
"Apache-2.0"
] | null | null | null | main.py | mzas/j2v | adf63ddd62a356faf845cf7fcb01dbdc81bf163e | [
"Apache-2.0"
] | null | null | null | from j2v.generation.processor import MainProcessor
from j2v.utils.config import generator_config
import argparse
import datetime
import time
from j2v.utils.helpers import is_truthy
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--json_files", nargs=argparse.ONE_OR_MORE, type... | 61.171429 | 120 | 0.708547 | from j2v.generation.processor import MainProcessor
from j2v.utils.config import generator_config
import argparse
import datetime
import time
from j2v.utils.helpers import is_truthy
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--json_files", nargs=argparse.ONE_OR_MORE, type... | true | true |
1c46cd2745257059eee9d1a34c553a3af73b903b | 799 | py | Python | profiles_api/migrations/0003_profilefeeditem.py | AbdElRahman24597/profiles-rest-api | 4fd19af745b015b234f9382276b1ac75aaca7a26 | [
"MIT"
] | null | null | null | profiles_api/migrations/0003_profilefeeditem.py | AbdElRahman24597/profiles-rest-api | 4fd19af745b015b234f9382276b1ac75aaca7a26 | [
"MIT"
] | null | null | null | profiles_api/migrations/0003_profilefeeditem.py | AbdElRahman24597/profiles-rest-api | 4fd19af745b015b234f9382276b1ac75aaca7a26 | [
"MIT"
] | null | null | null | # Generated by Django 2.2 on 2021-04-30 14:11
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('profiles_api', '0002_auto_20210428_1320'),
]
operations = [
migrations.Creat... | 31.96 | 126 | 0.638298 |
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('profiles_api', '0002_auto_20210428_1320'),
]
operations = [
migrations.CreateModel(
name='ProfileFeedItem',
... | true | true |
1c46cdeac23e702966e16a34fc97f70d095e595d | 3,325 | py | Python | continue.py | shivam-kotwalia/KittiSeg | 598ae9f4f797b850001eea1dbb270e128bb78d7d | [
"MIT"
] | 11 | 2017-06-06T21:18:24.000Z | 2019-11-04T14:58:10.000Z | continue.py | rgalvaomesquita/KittiSeg | ac93c2f0f83bf84f2ba0d645f819b2bbeeeaf58d | [
"MIT-0",
"MIT"
] | null | null | null | continue.py | rgalvaomesquita/KittiSeg | ac93c2f0f83bf84f2ba0d645f819b2bbeeeaf58d | [
"MIT-0",
"MIT"
] | 5 | 2017-04-28T09:08:54.000Z | 2020-04-10T23:58:48.000Z | """
Trains, evaluates and saves the KittiSeg model.
-------------------------------------------------
The MIT License (MIT)
Copyright (c) 2017 Marvin Teichmann
More details: https://github.com/MarvinTeichmann/KittiSeg/blob/master/LICENSE
"""
from __future__ import absolute_import
from __future__ import division
fro... | 29.954955 | 79 | 0.628872 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import commentjson
import logging
import os
import sys
import collections
def dict_merge(dct, merge_dct):
for k, v in merge_dct.iteritems():
if (k in dct and isinstance(d... | true | true |
1c46cf40bbac327ea35c8b14b39b6f7814418ca2 | 52,022 | py | Python | spikeinterface/sortingcomponents/template_matching.py | scratchrealm/spikeinterface | 17cfcd6f0c30c9933c11e560daf750366e12a151 | [
"MIT"
] | null | null | null | spikeinterface/sortingcomponents/template_matching.py | scratchrealm/spikeinterface | 17cfcd6f0c30c9933c11e560daf750366e12a151 | [
"MIT"
] | null | null | null | spikeinterface/sortingcomponents/template_matching.py | scratchrealm/spikeinterface | 17cfcd6f0c30c9933c11e560daf750366e12a151 | [
"MIT"
] | null | null | null | """Sorting components: template matching."""
import numpy as np
import scipy.spatial
from tqdm import tqdm
import sklearn, scipy
import scipy
from threadpoolctl import threadpool_limits
try:
import numba
from numba import jit, prange
HAVE_NUMBA = True
except ImportError:
HAVE_NUMBA = False
from s... | 36.532303 | 153 | 0.606647 |
import numpy as np
import scipy.spatial
from tqdm import tqdm
import sklearn, scipy
import scipy
from threadpoolctl import threadpool_limits
try:
import numba
from numba import jit, prange
HAVE_NUMBA = True
except ImportError:
HAVE_NUMBA = False
from spikeinterface.core import WaveformExtractor
f... | true | true |
1c46d1d4784a0d62c8a99280915d87553433d406 | 170 | py | Python | recepcao/admin.py | alantinoco/recepcao-edificio-comercial | dcbfa9fd93f71b2bec15681b947371f8af3e815f | [
"MIT"
] | null | null | null | recepcao/admin.py | alantinoco/recepcao-edificio-comercial | dcbfa9fd93f71b2bec15681b947371f8af3e815f | [
"MIT"
] | null | null | null | recepcao/admin.py | alantinoco/recepcao-edificio-comercial | dcbfa9fd93f71b2bec15681b947371f8af3e815f | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import *
admin.site.register(Sala)
admin.site.register(Usuario)
admin.site.register(Visitante)
admin.site.register(Visita)
| 21.25 | 32 | 0.811765 | from django.contrib import admin
from .models import *
admin.site.register(Sala)
admin.site.register(Usuario)
admin.site.register(Visitante)
admin.site.register(Visita)
| true | true |
1c46d206debfc3cfd0af0e2eb1216cafaca41f24 | 3,325 | py | Python | ucscsdk/mometa/storage/StorageSnapshotCtx.py | parag-may4/ucscsdk | 2ea762fa070330e3a4e2c21b46b157469555405b | [
"Apache-2.0"
] | 9 | 2016-12-22T08:39:25.000Z | 2019-09-10T15:36:19.000Z | ucscsdk/mometa/storage/StorageSnapshotCtx.py | parag-may4/ucscsdk | 2ea762fa070330e3a4e2c21b46b157469555405b | [
"Apache-2.0"
] | 10 | 2017-01-31T06:59:56.000Z | 2021-11-09T09:14:37.000Z | ucscsdk/mometa/storage/StorageSnapshotCtx.py | parag-may4/ucscsdk | 2ea762fa070330e3a4e2c21b46b157469555405b | [
"Apache-2.0"
] | 13 | 2016-11-14T07:42:58.000Z | 2022-02-10T17:32:05.000Z | """This module contains the general information for StorageSnapshotCtx ManagedObject."""
from ...ucscmo import ManagedObject
from ...ucsccoremeta import UcscVersion, MoPropertyMeta, MoMeta
from ...ucscmeta import VersionMeta
class StorageSnapshotCtxConsts():
LUN_CFG_ACTION_DELETE = "delete"
LUN_CFG_ACTION_OF... | 54.508197 | 249 | 0.657444 |
from ...ucscmo import ManagedObject
from ...ucsccoremeta import UcscVersion, MoPropertyMeta, MoMeta
from ...ucscmeta import VersionMeta
class StorageSnapshotCtxConsts():
LUN_CFG_ACTION_DELETE = "delete"
LUN_CFG_ACTION_OFFLINE = "offline"
LUN_CFG_ACTION_ONLINE = "online"
LUN_CFG_ACTION_RESTORE_SNAPSHO... | true | true |
1c46d21702697c85163d3d5adbdd640e38fb9d31 | 417 | py | Python | tina/assimp/pfm.py | xuhao1/taichi_three | 25fdf047da4c93df36a047a0be3cc47225d328c9 | [
"MIT"
] | 152 | 2020-06-17T09:08:59.000Z | 2022-03-30T13:48:49.000Z | tina/assimp/pfm.py | xuhao1/taichi_three | 25fdf047da4c93df36a047a0be3cc47225d328c9 | [
"MIT"
] | 46 | 2020-06-20T15:15:57.000Z | 2022-03-24T20:03:18.000Z | tina/assimp/pfm.py | xuhao1/taichi_three | 25fdf047da4c93df36a047a0be3cc47225d328c9 | [
"MIT"
] | 27 | 2020-06-20T14:25:55.000Z | 2022-03-12T08:11:31.000Z | import numpy as np
import sys
def pfmwrite(path, im):
im = im.swapaxes(0, 1)
scale = max(1e-10, -im.min(), im.max())
h, w = im.shape[:2]
with open(path, 'wb') as f:
f.write(b'PF\n' if len(im.shape) >= 3 else b'Pf\n')
f.write(f'{w} {h}\n'.encode())
f.write(f'{scale if sys.byteord... | 32.076923 | 76 | 0.553957 | import numpy as np
import sys
def pfmwrite(path, im):
im = im.swapaxes(0, 1)
scale = max(1e-10, -im.min(), im.max())
h, w = im.shape[:2]
with open(path, 'wb') as f:
f.write(b'PF\n' if len(im.shape) >= 3 else b'Pf\n')
f.write(f'{w} {h}\n'.encode())
f.write(f'{scale if sys.byteord... | true | true |
1c46d21fab526fc9bb640abb06ed75334c27fafe | 677 | py | Python | setup.py | tianhuil/checkpoint | 842d1cff0cbe5926a36f1927fb75b5dcbaf4ec31 | [
"Apache-2.0"
] | null | null | null | setup.py | tianhuil/checkpoint | 842d1cff0cbe5926a36f1927fb75b5dcbaf4ec31 | [
"Apache-2.0"
] | null | null | null | setup.py | tianhuil/checkpoint | 842d1cff0cbe5926a36f1927fb75b5dcbaf4ec31 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
from distutils.core import setup
setup(
name='checkpoint',
version='0.1',
description='Setup',
author='Tianhui Michael Li',
author_email='test@example.com',
url='https://github.com/tianhuil/checkpoint/',
packages=['checkpoint'],
classifiers=[
'Development Status :: 3 - Alpha'... | 27.08 | 57 | 0.646972 |
from distutils.core import setup
setup(
name='checkpoint',
version='0.1',
description='Setup',
author='Tianhui Michael Li',
author_email='test@example.com',
url='https://github.com/tianhuil/checkpoint/',
packages=['checkpoint'],
classifiers=[
'Development Status :: 3 - Alpha',
'Environment :: ... | true | true |
1c46d3b7b10037122d1f0238ad1b6a580936df6a | 4,834 | py | Python | TestTickAlpha-Iota.py | nikorasen/Project_S.U.I.T.U.P. | 4f2873346bd3954d455e2e4e19a84f20c58d1ab2 | [
"MIT"
] | null | null | null | TestTickAlpha-Iota.py | nikorasen/Project_S.U.I.T.U.P. | 4f2873346bd3954d455e2e4e19a84f20c58d1ab2 | [
"MIT"
] | null | null | null | TestTickAlpha-Iota.py | nikorasen/Project_S.U.I.T.U.P. | 4f2873346bd3954d455e2e4e19a84f20c58d1ab2 | [
"MIT"
] | null | null | null | import tkinter as tk
import feedparser
import datetime
import time
from tkinter import messagebox
import re
def Spyder(): #Crawls the links in the sources file, saves them to a txt file
All_Articles=''
try:
with open('Sources.txt', 'r') as Srcs:
for line in Srcs:
Link=line
... | 40.621849 | 163 | 0.522342 | import tkinter as tk
import feedparser
import datetime
import time
from tkinter import messagebox
import re
def Spyder(): All_Articles=''
try:
with open('Sources.txt', 'r') as Srcs:
for line in Srcs:
Link=line
Link=Link.strip('\n') Feed=feedpar... | true | true |
1c46d3bf5256bb38fc04428e212b3c747382289c | 27,516 | py | Python | exchangelib/autodiscover/discovery.py | denisovkv/exchangelib | fcb4cdac9f41e97f849ddab46ebf7cb9b6ca5d7f | [
"BSD-2-Clause"
] | null | null | null | exchangelib/autodiscover/discovery.py | denisovkv/exchangelib | fcb4cdac9f41e97f849ddab46ebf7cb9b6ca5d7f | [
"BSD-2-Clause"
] | null | null | null | exchangelib/autodiscover/discovery.py | denisovkv/exchangelib | fcb4cdac9f41e97f849ddab46ebf7cb9b6ca5d7f | [
"BSD-2-Clause"
] | null | null | null | import logging
import time
from urllib.parse import urlparse
import dns.resolver
from ..configuration import Configuration
from ..credentials import OAuth2Credentials
from ..errors import AutoDiscoverFailed, AutoDiscoverCircularRedirect, TransportError, RedirectError, UnauthorizedError
from ..protocol import Protocol... | 47.523316 | 141 | 0.641409 | import logging
import time
from urllib.parse import urlparse
import dns.resolver
from ..configuration import Configuration
from ..credentials import OAuth2Credentials
from ..errors import AutoDiscoverFailed, AutoDiscoverCircularRedirect, TransportError, RedirectError, UnauthorizedError
from ..protocol import Protocol... | true | true |
1c46d49bbe5567ce4f5689afc64fec986b8a50d0 | 439 | py | Python | projects/golem_integration/tests/browser/find/find_element_not_found.py | kangchenwei/keyautotest2 | f980d46cabfc128b2099af3d33968f236923063f | [
"MIT"
] | null | null | null | projects/golem_integration/tests/browser/find/find_element_not_found.py | kangchenwei/keyautotest2 | f980d46cabfc128b2099af3d33968f236923063f | [
"MIT"
] | null | null | null | projects/golem_integration/tests/browser/find/find_element_not_found.py | kangchenwei/keyautotest2 | f980d46cabfc128b2099af3d33968f236923063f | [
"MIT"
] | null | null | null | from golem import actions
from golem.core.exceptions import ElementNotFound
description = 'Verify the webdriver.find method throws error when element is not found'
def test(data):
actions.navigate(data.env.url+'elements/')
browser = actions.get_browser()
selector = '.invalid-selector-value'
actions.st... | 27.4375 | 87 | 0.71754 | from golem import actions
from golem.core.exceptions import ElementNotFound
description = 'Verify the webdriver.find method throws error when element is not found'
def test(data):
actions.navigate(data.env.url+'elements/')
browser = actions.get_browser()
selector = '.invalid-selector-value'
actions.st... | true | true |
1c46d4f59678cd4c42ab336c2ddd37684bf8a54e | 580 | py | Python | tests/spline.py | parmes/solfec-2.0 | 3329d3e1e4d58fefaf976c04bab19284aef45bc2 | [
"MIT"
] | 1 | 2020-06-21T23:52:25.000Z | 2020-06-21T23:52:25.000Z | tests/spline.py | parmes/solfec-2.0 | 3329d3e1e4d58fefaf976c04bab19284aef45bc2 | [
"MIT"
] | 1 | 2020-05-01T14:44:01.000Z | 2020-05-01T23:50:36.000Z | tests/spline.py | parmes/solfec-2.0 | 3329d3e1e4d58fefaf976c04bab19284aef45bc2 | [
"MIT"
] | 2 | 2020-06-21T23:59:21.000Z | 2021-12-09T09:49:50.000Z | # Solfec-2.0 input command test: SPLINE
import sys, os
d0 = os.path.dirname(os.path.realpath(sys.argv[1]))
spl0 = SPLINE (os.path.join(d0,'spline.txt'));
spl1 = SPLINE (os.path.join(d0,'spline.txt'), cache = 10)
lst2 = [0, 10, 1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6, 16];
spl2 = SPLINE (lst2);
lst3 = [[0, 10], [1, 11],... | 26.363636 | 71 | 0.593103 | import sys, os
d0 = os.path.dirname(os.path.realpath(sys.argv[1]))
spl0 = SPLINE (os.path.join(d0,'spline.txt'));
spl1 = SPLINE (os.path.join(d0,'spline.txt'), cache = 10)
lst2 = [0, 10, 1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6, 16];
spl2 = SPLINE (lst2);
lst3 = [[0, 10], [1, 11], [2, 12], [3, 13], [4, 14], [5, 15], [6,... | true | true |
1c46d5eee6f5de64e17b1f5566525b7d8e6e6eb6 | 1,597 | py | Python | application/tictactoe/datastore.py | Deephan/tic-tac-toe-for-slack | d3aa7e9c2bc52d8afad6d8057ebb60373b100a78 | [
"Apache-2.0"
] | null | null | null | application/tictactoe/datastore.py | Deephan/tic-tac-toe-for-slack | d3aa7e9c2bc52d8afad6d8057ebb60373b100a78 | [
"Apache-2.0"
] | 4 | 2016-07-05T16:11:31.000Z | 2016-07-05T16:16:26.000Z | application/tictactoe/datastore.py | Deephan/tic-tac-toe-for-slack | d3aa7e9c2bc52d8afad6d8057ebb60373b100a78 | [
"Apache-2.0"
] | null | null | null | '''
datastore.py
Datastore module for the game of Tic-Tac-Toe
Note: This module currently does nothing. Work to be done to store the state of the game.
'''
class DataStore:
class State(ndb.Model):
""" Stores the current state of the board """
board = ndb.StringProperty()
... | 27.067797 | 93 | 0.513463 |
class DataStore:
class State(ndb.Model):
board = ndb.StringProperty()
moves = ndb.IntegerProperty()
date = ndb.DateTimeProperty(auto_now_add=True)
def retrieveState():
query = State.query()
states = query.order(-State.date).fetch(1)
lastState = []
turns... | true | true |
1c46d65620086f1fc1ed2ef78050ec11a4ddc8ca | 670 | py | Python | pythran/tests/cases/projection_simplex.py | davidbrochart/pythran | 24b6c8650fe99791a4091cbdc2c24686e86aa67c | [
"BSD-3-Clause"
] | 1,647 | 2015-01-13T01:45:38.000Z | 2022-03-28T01:23:41.000Z | pythran/tests/cases/projection_simplex.py | davidbrochart/pythran | 24b6c8650fe99791a4091cbdc2c24686e86aa67c | [
"BSD-3-Clause"
] | 1,116 | 2015-01-01T09:52:05.000Z | 2022-03-18T21:06:40.000Z | pythran/tests/cases/projection_simplex.py | davidbrochart/pythran | 24b6c8650fe99791a4091cbdc2c24686e86aa67c | [
"BSD-3-Clause"
] | 180 | 2015-02-12T02:47:28.000Z | 2022-03-14T10:28:18.000Z | #from https://gist.github.com/mblondel/c99e575a5207c76a99d714e8c6e08e89
#pythran export projection_simplex(float[], int)
#runas import numpy as np; np.random.seed(0); x = np.random.rand(10); projection_simplex(x, 1)
import numpy as np
def projection_simplex(v, z=1):
"""
Old implementation for test and benchmar... | 33.5 | 94 | 0.653731 |
import numpy as np
def projection_simplex(v, z=1):
n_features = v.shape[0]
u = np.sort(v)[::-1]
cssv = np.cumsum(u) - z
ind = np.arange(n_features) + 1
cond = u - cssv / ind > 0
rho = ind[cond][-1]
theta = cssv[cond][-1] / float(rho)
w = np.maximum(v - theta, 0)
return w
| true | true |
1c46d68712cfe5660bca7d1c26bdad8cf4708df8 | 3,921 | py | Python | feedler/admin.py | pcoder/public-health-ch | cebc4849653560c54238b67814074353ff7c01f3 | [
"MIT"
] | 2 | 2020-10-29T16:27:21.000Z | 2021-06-07T12:47:46.000Z | feedler/admin.py | pcoder/public-health-ch | cebc4849653560c54238b67814074353ff7c01f3 | [
"MIT"
] | 11 | 2017-05-09T10:50:28.000Z | 2021-12-15T17:01:23.000Z | feedler/admin.py | pcoder/public-health-ch | cebc4849653560c54238b67814074353ff7c01f3 | [
"MIT"
] | 4 | 2017-04-24T13:06:55.000Z | 2021-06-04T02:18:32.000Z | # -*- coding: utf-8 -*-
from django.db import models
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from django.conf.urls import url
from django.urls import reverse
from django.utils.functional import cached_property
from django.utils.translation import u... | 38.821782 | 143 | 0.694211 |
from django.db import models
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from django.conf.urls import url
from django.urls import reverse
from django.utils.functional import cached_property
from django.utils.translation import ugettext as _
from django... | true | true |
1c46d82743933279d3da7a04509b37c438837201 | 1,295 | py | Python | wazimap/tests/test_geo.py | anoited007/country-dashboard | 577bbcc4992e24c484650895fabbcdf4343e1bdb | [
"MIT"
] | 16 | 2017-10-19T03:36:41.000Z | 2022-03-03T11:46:20.000Z | wazimap/tests/test_geo.py | ChrisAchinga/wazimap | a66a1524030a8b98e7ea0dfb270d1946ca75b3b2 | [
"MIT"
] | 66 | 2016-02-15T08:59:29.000Z | 2017-09-21T14:00:43.000Z | wazimap/tests/test_geo.py | ChrisAchinga/wazimap | a66a1524030a8b98e7ea0dfb270d1946ca75b3b2 | [
"MIT"
] | 18 | 2017-10-06T12:26:37.000Z | 2021-08-30T01:38:37.000Z | from django.test import TestCase
from django.conf import settings
from wazimap.geo import geo_data, GeoData
class GeoTestCase(TestCase):
def test_versioned_geos(self):
# create two geos at different versions
cpt11 = geo_data.geo_model.objects.create(geo_level='municipality', geo_code='cpt', long_... | 43.166667 | 138 | 0.695753 | from django.test import TestCase
from django.conf import settings
from wazimap.geo import geo_data, GeoData
class GeoTestCase(TestCase):
def test_versioned_geos(self):
cpt11 = geo_data.geo_model.objects.create(geo_level='municipality', geo_code='cpt', long_name='City of Cape Town', version='2011'... | true | true |
1c46d8fd89313610b00380ac3e01e23cbd64aab7 | 11,884 | py | Python | chemdataextractor/cli/pos.py | gubschk/CDEWIP | fb628593417df5f955eb1fa62176b7cb3c322ebc | [
"MIT"
] | null | null | null | chemdataextractor/cli/pos.py | gubschk/CDEWIP | fb628593417df5f955eb1fa62176b7cb3c322ebc | [
"MIT"
] | null | null | null | chemdataextractor/cli/pos.py | gubschk/CDEWIP | fb628593417df5f955eb1fa62176b7cb3c322ebc | [
"MIT"
] | 1 | 2021-02-21T02:51:39.000Z | 2021-02-21T02:51:39.000Z | # -*- coding: utf-8 -*-
"""
chemdataextractor.cli.pos
~~~~~~~~~~~~~~~~~~~~~~~~~
Part of speech tagging commands.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import click
from ..doc import Document, Text
from ..nlp.... | 44.676692 | 133 | 0.588186 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import click
from ..doc import Document, Text
from ..nlp.corpus import genia_training, wsj_training, wsj_evaluation, genia_evaluation
from ..nlp.pos import TAGS, ChemApPosTagger, Chem... | true | true |
1c46da710b690df0d6804fd81ba494ce167bd99d | 394 | py | Python | serempre_todo/task/api/views.py | pygabo/Serempre | 6b29e337abd8d1b3f71ee889d318a2d473d6c744 | [
"MIT"
] | null | null | null | serempre_todo/task/api/views.py | pygabo/Serempre | 6b29e337abd8d1b3f71ee889d318a2d473d6c744 | [
"MIT"
] | null | null | null | serempre_todo/task/api/views.py | pygabo/Serempre | 6b29e337abd8d1b3f71ee889d318a2d473d6c744 | [
"MIT"
] | null | null | null | # Rest Framework
from rest_framework import viewsets
from rest_framework.permissions import IsAuthenticated
# Serializer
from serempre_todo.task.api.serializers import TaskSerializer
# Model
from serempre_todo.task.models import Task
class TaskViewSet(viewsets.ModelViewSet):
serializer_class = TaskSerializer
... | 26.266667 | 61 | 0.819797 | from rest_framework import viewsets
from rest_framework.permissions import IsAuthenticated
from serempre_todo.task.api.serializers import TaskSerializer
from serempre_todo.task.models import Task
class TaskViewSet(viewsets.ModelViewSet):
serializer_class = TaskSerializer
permission_classes = [IsAuthenticated... | true | true |
1c46db55722edfbae9a686a7bac404d67cd50321 | 3,930 | py | Python | contractor_plugins/Manual/models.py | T3kton/contractor_plugins | a42c87f4d0713b2a461739f528f92fa572a7fec7 | [
"MIT"
] | null | null | null | contractor_plugins/Manual/models.py | T3kton/contractor_plugins | a42c87f4d0713b2a461739f528f92fa572a7fec7 | [
"MIT"
] | null | null | null | contractor_plugins/Manual/models.py | T3kton/contractor_plugins | a42c87f4d0713b2a461739f528f92fa572a7fec7 | [
"MIT"
] | 2 | 2017-05-05T03:39:11.000Z | 2018-05-11T13:06:25.000Z | from django.db import models
from django.core.exceptions import ValidationError
from cinp.orm_django import DjangoCInP as CInP
from contractor.Site.models import Site
from contractor.Building.models import Foundation, Complex, FOUNDATION_SUBCLASS_LIST, COMPLEX_SUBCLASS_LIST
from contractor.BluePrint.models import Fou... | 28.071429 | 152 | 0.708142 | from django.db import models
from django.core.exceptions import ValidationError
from cinp.orm_django import DjangoCInP as CInP
from contractor.Site.models import Site
from contractor.Building.models import Foundation, Complex, FOUNDATION_SUBCLASS_LIST, COMPLEX_SUBCLASS_LIST
from contractor.BluePrint.models import Fou... | true | true |
1c46dbb5413dcfd3678d4b0e6bd04adac93c69db | 1,330 | py | Python | src/shardBackup/copy.py | babarnescocke/shardBackup | ff62869ffd319b627edf2a2a4f5084ed19713f03 | [
"BSD-3-Clause"
] | null | null | null | src/shardBackup/copy.py | babarnescocke/shardBackup | ff62869ffd319b627edf2a2a4f5084ed19713f03 | [
"BSD-3-Clause"
] | null | null | null | src/shardBackup/copy.py | babarnescocke/shardBackup | ff62869ffd319b627edf2a2a4f5084ed19713f03 | [
"BSD-3-Clause"
] | null | null | null | from subprocess import run
from sys import exit
from shutil import copy2
import os # for unclear reasons importing just os.stat and os.chown doesn't work
import stat
def rsync(fobject0, fobject1): # takes two file objects and transmits 0 to 1
"""
a call to copying using rsync
>>>rsync('./.gitkeep','/other/... | 35.945946 | 155 | 0.626316 | from subprocess import run
from sys import exit
from shutil import copy2
import os import stat
def rsync(fobject0, fobject1): # takes two file objects and transmits 0 to 1
try:
run(['rsync', #rsync is a major program
'-avzz', #a = archive, v= verbose, zz=compress
'-n', # n = simula... | true | true |
1c46dc5e623025be88f670a423523abba08c29d5 | 1,368 | py | Python | Diabetes_API/app.py | 18bce1151/proj | 96c0a299ccaec29a02a9486d192a7215f5a12566 | [
"Unlicense"
] | 86 | 2020-11-26T17:38:51.000Z | 2022-03-10T11:35:08.000Z | Diabetes_API/app.py | 18bce1151/proj | 96c0a299ccaec29a02a9486d192a7215f5a12566 | [
"Unlicense"
] | null | null | null | Diabetes_API/app.py | 18bce1151/proj | 96c0a299ccaec29a02a9486d192a7215f5a12566 | [
"Unlicense"
] | 62 | 2020-11-27T05:16:06.000Z | 2022-03-27T15:23:55.000Z | from flask import Flask, render_template, url_for, flash, redirect
import joblib
from flask import request
import numpy as np
app = Flask(__name__, template_folder='templates')
@app.route("/")
@app.route("/Diabetes")
def cancer():
return render_template("diabetes.html")
def ValuePredictor(to_predic... | 35.076923 | 134 | 0.679094 | from flask import Flask, render_template, url_for, flash, redirect
import joblib
from flask import request
import numpy as np
app = Flask(__name__, template_folder='templates')
@app.route("/")
@app.route("/Diabetes")
def cancer():
return render_template("diabetes.html")
def ValuePredictor(to_predic... | true | true |
1c46ded6115ecd16b3a79fe253d63b64f0698442 | 18,126 | py | Python | python/cloudtik/tests/test_cloudtik.py | jerrychenhf/cloudtik | 5ceab948c5c8b2e00f644d2fb801311572aaf381 | [
"Apache-2.0"
] | 2 | 2022-03-28T05:03:57.000Z | 2022-03-28T09:00:48.000Z | python/cloudtik/tests/test_cloudtik.py | jerrychenhf/cloudtik | 5ceab948c5c8b2e00f644d2fb801311572aaf381 | [
"Apache-2.0"
] | 12 | 2022-03-29T05:07:18.000Z | 2022-03-31T13:57:57.000Z | python/cloudtik/tests/test_cloudtik.py | jerrychenhf/cloudtik | 5ceab948c5c8b2e00f644d2fb801311572aaf381 | [
"Apache-2.0"
] | 6 | 2022-03-28T05:04:24.000Z | 2022-03-29T01:22:22.000Z | from enum import Enum
import os
import re
from subprocess import CalledProcessError
import tempfile
import threading
import time
import unittest
import yaml
import copy
from jsonschema.exceptions import ValidationError
from typing import Dict, Callable, List, Optional
from cloudtik.core._private.utils import prepare_c... | 32.138298 | 108 | 0.5667 | from enum import Enum
import os
import re
from subprocess import CalledProcessError
import tempfile
import threading
import time
import unittest
import yaml
import copy
from jsonschema.exceptions import ValidationError
from typing import Dict, Callable, List, Optional
from cloudtik.core._private.utils import prepare_c... | true | true |
1c46e01057545892b524898477fb51b8ed2373e5 | 1,140 | py | Python | frida_mode/test/png/persistent/get_symbol_addr.py | hamzzi/AFLplusplus | 95f47ac3a4d23b28a573a0614893d7aac5f5d4b4 | [
"Apache-2.0"
] | 2,104 | 2020-03-19T16:17:10.000Z | 2022-03-31T16:22:30.000Z | frida_mode/test/png/persistent/get_symbol_addr.py | hamzzi/AFLplusplus | 95f47ac3a4d23b28a573a0614893d7aac5f5d4b4 | [
"Apache-2.0"
] | 788 | 2020-03-19T14:54:09.000Z | 2022-03-31T17:38:00.000Z | frida_mode/test/png/persistent/get_symbol_addr.py | hamzzi/AFLplusplus | 95f47ac3a4d23b28a573a0614893d7aac5f5d4b4 | [
"Apache-2.0"
] | 518 | 2020-03-21T01:24:55.000Z | 2022-03-30T21:05:53.000Z | #!/usr/bin/python3
import argparse
from elftools.elf.elffile import ELFFile
def process_file(file, symbol, base):
with open(file, 'rb') as f:
elf = ELFFile(f)
symtab = elf.get_section_by_name('.symtab')
mains = symtab.get_symbol_by_name(symbol)
if len(mains) != 1:
print ... | 30.810811 | 74 | 0.598246 | import argparse
from elftools.elf.elffile import ELFFile
def process_file(file, symbol, base):
with open(file, 'rb') as f:
elf = ELFFile(f)
symtab = elf.get_section_by_name('.symtab')
mains = symtab.get_symbol_by_name(symbol)
if len(mains) != 1:
print ("Failed to find ma... | true | true |
1c46e1353606f6ac2e8eadd47d685475e3efc0f6 | 946 | py | Python | crypto.py | Esshahn/cryptoticker | 6fb32712e380cb2a0605bafcfa64fe7fdf0367b7 | [
"MIT"
] | null | null | null | crypto.py | Esshahn/cryptoticker | 6fb32712e380cb2a0605bafcfa64fe7fdf0367b7 | [
"MIT"
] | null | null | null | crypto.py | Esshahn/cryptoticker | 6fb32712e380cb2a0605bafcfa64fe7fdf0367b7 | [
"MIT"
] | null | null | null | # -------------------------------------------------
# Cryptoticker
# Python Script to get the current prices of crypto currencies
# and send an email with the current prices
# 2021 Ingo Hinterding
# https://github.com/Esshahn/cryptoticker
# -------------------------------------------------
from tracker import *
from d... | 26.277778 | 62 | 0.620507 |
from tracker import *
from downloader import *
config = load_json("user-data.json")
data = download_latest_crypto_data(config)
save_file("crypto-data.json", json.dumps(data))
crypto_all = load_json("crypto-data.json")
crypto = crypto_all["data"]
user_all = load_json("user-data.json")
symbols = user_all["symbol... | true | true |
1c46e16e22d0b4bc1b34d28281a937a613893ce7 | 27,393 | py | Python | python/mxnet/base.py | ChrisQiqiang/mxnet-combination | 015c02f8fa1b22133202e1c70488c439cd9e726d | [
"BSL-1.0",
"Apache-2.0"
] | null | null | null | python/mxnet/base.py | ChrisQiqiang/mxnet-combination | 015c02f8fa1b22133202e1c70488c439cd9e726d | [
"BSL-1.0",
"Apache-2.0"
] | null | null | null | python/mxnet/base.py | ChrisQiqiang/mxnet-combination | 015c02f8fa1b22133202e1c70488c439cd9e726d | [
"BSL-1.0",
"Apache-2.0"
] | null | null | null | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 32.113716 | 150 | 0.639032 |
from __future__ import absolute_import
import re
import atexit
import ctypes
import os
import sys
import inspect
import platform
import numpy as _np
from . import libinfo
__all__ = ['MXNetError']
try:
basestring
long
except NameError:
basestring = str
long = int
integer_types = (int, long, _np.int... | true | true |
1c46e19fe76854e8b0b97098ce1dda2257aca5d4 | 4,533 | py | Python | includes/NopSCAD/scripts/c14n_stl.py | codysandahl/3dprinting | 98d588864e5ba5826c7ed16959aa7b1040a760b3 | [
"MIT"
] | null | null | null | includes/NopSCAD/scripts/c14n_stl.py | codysandahl/3dprinting | 98d588864e5ba5826c7ed16959aa7b1040a760b3 | [
"MIT"
] | null | null | null | includes/NopSCAD/scripts/c14n_stl.py | codysandahl/3dprinting | 98d588864e5ba5826c7ed16959aa7b1040a760b3 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
#
# NopSCADlib Copyright Chris Palmer 2018
# nop.head@gmail.com
# hydraraptor.blogspot.com
#
# This file is part of NopSCADlib.
#
# NopSCADlib 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 Foundatio... | 38.415254 | 138 | 0.578425 |
# This scrip orders each triangle to start with the lowest vertex first (comparing x, then y, then z)
# It then sorts the triangles to start with the one with the lowest vertices first (comparing first vertex, second, then third)
# This has no effect on the model but makes the STL consistent. I.e. it makes a canonica... | true | true |
1c46e1ea720a2cd127402c538d9c90de250108a5 | 3,717 | py | Python | twisted/internet/test/test_time.py | hawkowl/twisted | c413aac3888dea2202c0dc26f978d7f88b4b837a | [
"Unlicense",
"MIT"
] | 9,953 | 2019-04-03T23:41:04.000Z | 2022-03-31T11:54:44.000Z | stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/test/test_time.py | W4LKURE/learn_python3_spider | 98dd354a41598b31302641f9a0ea49d1ecfa0fb1 | [
"MIT"
] | 44 | 2019-05-27T10:59:29.000Z | 2022-03-31T14:14:29.000Z | stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/test/test_time.py | W4LKURE/learn_python3_spider | 98dd354a41598b31302641f9a0ea49d1ecfa0fb1 | [
"MIT"
] | 2,803 | 2019-04-06T13:15:33.000Z | 2022-03-31T07:42:01.000Z | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for implementations of L{IReactorTime}.
"""
__metaclass__ = type
from twisted.python.log import msg
from twisted.python.runtime import platform
from twisted.trial.unittest import SkipTest
from twisted.internet.test.reactormixins impor... | 32.893805 | 80 | 0.651601 |
__metaclass__ = type
from twisted.python.log import msg
from twisted.python.runtime import platform
from twisted.trial.unittest import SkipTest
from twisted.internet.test.reactormixins import ReactorBuilder
from twisted.internet.interfaces import IReactorTime, IReactorThreads
class TimeTestsBuilder(ReactorBuilder... | true | true |
1c46e2c4714a5d7a0da9a84287a162ed818906e7 | 3,529 | py | Python | backend/schedule_worker/utils/generate_graph.py | evemorgen/GdzieJestMojTramwajProject | 65a090ae4222053a2a0a1b145df5196f3658065c | [
"MIT"
] | null | null | null | backend/schedule_worker/utils/generate_graph.py | evemorgen/GdzieJestMojTramwajProject | 65a090ae4222053a2a0a1b145df5196f3658065c | [
"MIT"
] | null | null | null | backend/schedule_worker/utils/generate_graph.py | evemorgen/GdzieJestMojTramwajProject | 65a090ae4222053a2a0a1b145df5196f3658065c | [
"MIT"
] | null | null | null | import os
import logging
import networkx as nx
import matplotlib.pyplot as plt
import json
from geopy.distance import vincenty
from collections import deque
from db import MpkDb as DbApi
from utils import Config
def czy_skrzyzowanie(przystanek, skrzyzowania, wariant, punkty):
for skrzyzowanie in skrzyzowania:
... | 39.651685 | 141 | 0.614338 | import os
import logging
import networkx as nx
import matplotlib.pyplot as plt
import json
from geopy.distance import vincenty
from collections import deque
from db import MpkDb as DbApi
from utils import Config
def czy_skrzyzowanie(przystanek, skrzyzowania, wariant, punkty):
for skrzyzowanie in skrzyzowania:
... | true | true |
1c46e31c48f99fa5dabe9c956cd41ecd0c86bcaf | 5,840 | py | Python | src/retrieval_core/models/modules/da.py | RImbriaco/OML | 4998cdebc3ac553ccd53b4caacf24d8c3d8fc07b | [
"MIT"
] | 2 | 2021-09-08T12:33:05.000Z | 2021-09-14T09:40:43.000Z | src/retrieval_core/models/modules/da.py | RImbriaco/OML | 4998cdebc3ac553ccd53b4caacf24d8c3d8fc07b | [
"MIT"
] | null | null | null | src/retrieval_core/models/modules/da.py | RImbriaco/OML | 4998cdebc3ac553ccd53b4caacf24d8c3d8fc07b | [
"MIT"
] | 1 | 2021-09-08T12:35:10.000Z | 2021-09-08T12:35:10.000Z | import torch
from torch import nn
"""
Attention module as implemented in "Dual Attention Network for Scene
Segmentation" https://arxiv.org/abs/1809.02983
"""
class ActivatedBatchNorm(nn.Module):
def __init__(self, num_features, activation='relu', **kwargs):
"""
Pre-activates tensor with activatio... | 30.899471 | 86 | 0.610445 | import torch
from torch import nn
class ActivatedBatchNorm(nn.Module):
def __init__(self, num_features, activation='relu', **kwargs):
super().__init__()
activation_map = {
'relu': nn.ReLU,
'leaky_relu': nn.LeakyReLU,
'elu': nn.ELU,
}
if activati... | true | true |
1c46e32070cf0c01bff98632cd40042af2562b9c | 22,730 | py | Python | plugins/sqlfluff-templater-dbt/sqlfluff_templater_dbt/templater.py | fdw/sqlfluff | e49c974e3fc886a28b358b59442d9471e6f6e89d | [
"MIT"
] | null | null | null | plugins/sqlfluff-templater-dbt/sqlfluff_templater_dbt/templater.py | fdw/sqlfluff | e49c974e3fc886a28b358b59442d9471e6f6e89d | [
"MIT"
] | null | null | null | plugins/sqlfluff-templater-dbt/sqlfluff_templater_dbt/templater.py | fdw/sqlfluff | e49c974e3fc886a28b358b59442d9471e6f6e89d | [
"MIT"
] | null | null | null | """Defines the templaters."""
from collections import deque
from contextlib import contextmanager
import os
import os.path
import logging
from typing import List, Optional, Iterator, Tuple, Any, Dict, Deque
from dataclasses import dataclass
from functools import partial
from dbt.version import get_installed_version
... | 39.054983 | 109 | 0.593797 |
from collections import deque
from contextlib import contextmanager
import os
import os.path
import logging
from typing import List, Optional, Iterator, Tuple, Any, Dict, Deque
from dataclasses import dataclass
from functools import partial
from dbt.version import get_installed_version
from dbt.config.runtime import... | true | true |
1c46e354feed5cf4980e4dc9638c9d72ef429a1d | 7,419 | py | Python | east/utils/image_utils.py | embracesource-cv-com/keras-east | 0733a9a99c4446a30c8b8e1d62e102391f7a854a | [
"Apache-2.0"
] | 12 | 2019-04-01T01:58:13.000Z | 2019-12-10T02:54:18.000Z | east/utils/image_utils.py | embracesource-cv-com/keras-east | 0733a9a99c4446a30c8b8e1d62e102391f7a854a | [
"Apache-2.0"
] | 5 | 2019-04-22T16:00:02.000Z | 2020-08-12T07:03:05.000Z | east/utils/image_utils.py | embracesource-cv-com/keras-east | 0733a9a99c4446a30c8b8e1d62e102391f7a854a | [
"Apache-2.0"
] | 1 | 2019-05-24T11:34:44.000Z | 2019-05-24T11:34:44.000Z | # -*- coding: utf-8 -*-
"""
File Name: image
Description : 图像处理工具类
Author : mick.yi
date: 2019/2/18
"""
import skimage
from skimage import io, transform
import numpy as np
import matplotlib.pyplot as plt
import random
def load_image(image_path):
"""
加载图像
:p... | 28.755814 | 117 | 0.579189 | import skimage
from skimage import io, transform
import numpy as np
import matplotlib.pyplot as plt
import random
def load_image(image_path):
image = plt.imread(image_path)
if len(image.shape) == 2:
image = np.expand_dims(image, axis=2)
image = np.tile(image, (1, 1, 3))
eli... | true | true |
1c46e48e2e3f579a1cdbebb866e2f56a6b6f6241 | 201 | py | Python | rpc/client.py | yuriscosta/tads-sistemas-distribuidos | 1bdcd3ff87bb5ecc2a722ef70bb4e7fd7c8540da | [
"MIT"
] | 1 | 2017-10-18T03:04:49.000Z | 2017-10-18T03:04:49.000Z | rpc/client.py | yuriscosta/tads-sistemas-distribuidos | 1bdcd3ff87bb5ecc2a722ef70bb4e7fd7c8540da | [
"MIT"
] | 1 | 2020-06-05T17:51:11.000Z | 2020-06-05T17:51:11.000Z | rpc/client.py | yuriscosta/tads-sistemas-distribuidos | 1bdcd3ff87bb5ecc2a722ef70bb4e7fd7c8540da | [
"MIT"
] | null | null | null | import xmlrpc.client
s = xmlrpc.client.ServerProxy('http://localhost:8000')
print(s.pow(2,3))
print(s.add(2,3))
print(s.mul(5,2))
# Gerando erros
print(s.pow(0,0))
print(s.add(1))
print(s.sub(1, 2))
| 16.75 | 54 | 0.676617 | import xmlrpc.client
s = xmlrpc.client.ServerProxy('http://localhost:8000')
print(s.pow(2,3))
print(s.add(2,3))
print(s.mul(5,2))
print(s.pow(0,0))
print(s.add(1))
print(s.sub(1, 2))
| true | true |
1c46e5e885ba5b8a6ca6466a4c60eccdef77f19e | 9,122 | py | Python | src/rosdep2/platforms/debian.py | gavanderhoorn/rosdep | 641433af01bb217b807af6adda2b9f7a0c55f727 | [
"BSD-3-Clause"
] | null | null | null | src/rosdep2/platforms/debian.py | gavanderhoorn/rosdep | 641433af01bb217b807af6adda2b9f7a0c55f727 | [
"BSD-3-Clause"
] | null | null | null | src/rosdep2/platforms/debian.py | gavanderhoorn/rosdep | 641433af01bb217b807af6adda2b9f7a0c55f727 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# Copyright (c) 2009, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# not... | 36.931174 | 116 | 0.676168 |
from __future__ import print_function
import subprocess
import sys
from rospkg.os_detect import OS_DEBIAN, OS_LINARO, OS_UBUNTU, OS_ELEMENTARY, OsDetect
from .pip import PIP_INSTALLER
from .gem import GEM_INSTALLER
from .source import SOURCE_INSTALLER
from ..installers import PackageManagerInstaller
from ..shell_ut... | true | true |
1c46e7371d0f642717b0dbe3ec998d628839b8d6 | 6,710 | py | Python | novelle/views/routes.py | sahuashi/novelle | 04295f4060af763a23a299219da73ba46c1ed626 | [
"MIT"
] | null | null | null | novelle/views/routes.py | sahuashi/novelle | 04295f4060af763a23a299219da73ba46c1ed626 | [
"MIT"
] | null | null | null | novelle/views/routes.py | sahuashi/novelle | 04295f4060af763a23a299219da73ba46c1ed626 | [
"MIT"
] | null | null | null | import os
import requests
from flask import Blueprint, render_template, flash, request, redirect, url_for, current_app
from flask_login import login_required, logout_user, login_user, current_user
from sqlalchemy import exc
from novelle.models import db, User, Book
from novelle.forms import Form
router = Blueprint('ro... | 37.909605 | 124 | 0.628167 | import os
import requests
from flask import Blueprint, render_template, flash, request, redirect, url_for, current_app
from flask_login import login_required, logout_user, login_user, current_user
from sqlalchemy import exc
from novelle.models import db, User, Book
from novelle.forms import Form
router = Blueprint('ro... | true | true |
1c46e82782628298655f1652a3e4cd46980848c8 | 5,161 | py | Python | Synaptic-Flow/Utils/metrics.py | santosh-b/Alleviate-Robust-Overfitting | c369ab2eaf51ba02a15f45db77a8c9292c8dbbf8 | [
"MIT"
] | null | null | null | Synaptic-Flow/Utils/metrics.py | santosh-b/Alleviate-Robust-Overfitting | c369ab2eaf51ba02a15f45db77a8c9292c8dbbf8 | [
"MIT"
] | null | null | null | Synaptic-Flow/Utils/metrics.py | santosh-b/Alleviate-Robust-Overfitting | c369ab2eaf51ba02a15f45db77a8c9292c8dbbf8 | [
"MIT"
] | null | null | null | import torch
import torch.nn as nn
import numpy as np
import pandas as pd
from prune import *
from Layers import layers
def summary(model, scores, flops, prunable):
r"""Summary of compression results for a model.
"""
rows = []
for name, module in model.named_modules():
for pname, param in modu... | 43.369748 | 104 | 0.550281 | import torch
import torch.nn as nn
import numpy as np
import pandas as pd
from prune import *
from Layers import layers
def summary(model, scores, flops, prunable):
rows = []
for name, module in model.named_modules():
for pname, param in module.named_parameters(recurse=False):
pruned = pru... | true | true |
1c46e8c37c4ba356c3728913dc60e567bdcb344e | 9,642 | py | Python | server/vcr-server/vcr_server/utils/solrqueue.py | brianorwhatever/aries-vcr | 96bb31a2f96406dfa2832dbd7790c46b60981e13 | [
"Apache-2.0"
] | 38 | 2019-01-07T02:49:55.000Z | 2020-01-27T17:26:09.000Z | server/vcr-server/vcr_server/utils/solrqueue.py | brianorwhatever/aries-vcr | 96bb31a2f96406dfa2832dbd7790c46b60981e13 | [
"Apache-2.0"
] | 364 | 2019-01-07T20:22:15.000Z | 2020-03-10T21:59:23.000Z | server/vcr-server/vcr_server/utils/solrqueue.py | brianorwhatever/aries-vcr | 96bb31a2f96406dfa2832dbd7790c46b60981e13 | [
"Apache-2.0"
] | 34 | 2019-01-04T19:16:04.000Z | 2020-02-20T19:24:25.000Z | import logging
import threading
import os
from queue import Empty, Full, Queue
from haystack.utils import get_identifier
from api.v2.search.index import TxnAwareSearchIndex
LOGGER = logging.getLogger(__name__)
# this will kill the vcr-api process
RTI_ABORT_ON_ERRORS = os.getenv("RTI_ABORT_ON_ERRORS", "TRUE").upper... | 42.663717 | 157 | 0.581 | import logging
import threading
import os
from queue import Empty, Full, Queue
from haystack.utils import get_identifier
from api.v2.search.index import TxnAwareSearchIndex
LOGGER = logging.getLogger(__name__)
RTI_ABORT_ON_ERRORS = os.getenv("RTI_ABORT_ON_ERRORS", "TRUE").upper()
ABORT_ON_ERRORS = RTI_ABORT_ON_ERR... | true | true |
1c46e8ebc705732b535b16f3a42154c4df52a3d9 | 82 | py | Python | tests/conftest.py | mishc9/flake_rba | eda1e80436f401871dba61a4c769204c2cbcfc65 | [
"MIT"
] | null | null | null | tests/conftest.py | mishc9/flake_rba | eda1e80436f401871dba61a4c769204c2cbcfc65 | [
"MIT"
] | null | null | null | tests/conftest.py | mishc9/flake_rba | eda1e80436f401871dba61a4c769204c2cbcfc65 | [
"MIT"
] | null | null | null | import pytest
@pytest.fixture
def fixture_template():
return "Hello World!"
| 11.714286 | 25 | 0.731707 | import pytest
@pytest.fixture
def fixture_template():
return "Hello World!"
| true | true |
1c46ea4290b2b9e013c4b3a29287456e61b6ca89 | 1,429 | py | Python | tests/plugins/inventory/test_nsot.py | omershtivi/nornir | 0bbded1dcf38245c75aadf74706ea8547b2a0e73 | [
"Apache-2.0"
] | 1 | 2019-04-10T08:14:59.000Z | 2019-04-10T08:14:59.000Z | tests/plugins/inventory/test_nsot.py | omershtivi/nornir | 0bbded1dcf38245c75aadf74706ea8547b2a0e73 | [
"Apache-2.0"
] | null | null | null | tests/plugins/inventory/test_nsot.py | omershtivi/nornir | 0bbded1dcf38245c75aadf74706ea8547b2a0e73 | [
"Apache-2.0"
] | null | null | null | import json
import os
from nornir.plugins.inventory import nsot
# We need import below to load fixtures
import pytest # noqa
BASE_PATH = os.path.join(os.path.dirname(__file__), "nsot")
def get_inv(requests_mock, case, **kwargs):
for i in ["interfaces", "sites", "devices"]:
with open("{}/{}/{}.json".f... | 31.755556 | 84 | 0.615815 | import json
import os
from nornir.plugins.inventory import nsot
import pytest
BASE_PATH = os.path.join(os.path.dirname(__file__), "nsot")
def get_inv(requests_mock, case, **kwargs):
for i in ["interfaces", "sites", "devices"]:
with open("{}/{}/{}.json".format(BASE_PATH, case, i), "r") as f:
... | true | true |
1c46eb9b38a94e1016136f4df0089ae4ec1eaff0 | 1,112 | py | Python | hexi/service/pipeline/inputManager.py | tunstek/hexi | ebb00e4e47ac90d96a26179a5786d768d95c4bd5 | [
"MIT"
] | 14 | 2017-10-07T23:19:09.000Z | 2021-10-08T12:13:59.000Z | hexi/service/pipeline/inputManager.py | tunstek/hexi | ebb00e4e47ac90d96a26179a5786d768d95c4bd5 | [
"MIT"
] | 1 | 2018-07-16T17:03:43.000Z | 2018-07-16T17:03:43.000Z | hexi/service/pipeline/inputManager.py | tunstek/hexi | ebb00e4e47ac90d96a26179a5786d768d95c4bd5 | [
"MIT"
] | 6 | 2018-05-18T14:25:26.000Z | 2021-03-28T12:37:21.000Z | import asyncio
import time
from hexi.service import event
from hexi.service.pipeline.BaseManager import BaseManager
from hexi.util import deque
from hexi.plugin.InputPlugin import InputPlugin
EMPTY_SIGNAL = [0, 0, 0, 0, 0, 0]
class InputManager(BaseManager):
def __init__(self):
super().__init__('input', 'inpu... | 30.054054 | 79 | 0.735612 | import asyncio
import time
from hexi.service import event
from hexi.service.pipeline.BaseManager import BaseManager
from hexi.util import deque
from hexi.plugin.InputPlugin import InputPlugin
EMPTY_SIGNAL = [0, 0, 0, 0, 0, 0]
class InputManager(BaseManager):
def __init__(self):
super().__init__('input', 'inpu... | true | true |
1c46ec3f4bcd5dfd904476a655c486582328757a | 7,446 | py | Python | tensorflow_io/python/experimental/numpy_dataset_ops.py | lgeiger/io | 90be860451a705e2fbe8cfdec3c30030112b5c69 | [
"Apache-2.0"
] | 558 | 2018-11-09T22:45:27.000Z | 2022-03-24T04:59:36.000Z | tensorflow_io/python/experimental/numpy_dataset_ops.py | lgeiger/io | 90be860451a705e2fbe8cfdec3c30030112b5c69 | [
"Apache-2.0"
] | 1,122 | 2018-12-09T03:30:40.000Z | 2022-03-31T16:22:15.000Z | tensorflow_io/python/experimental/numpy_dataset_ops.py | lgeiger/io | 90be860451a705e2fbe8cfdec3c30030112b5c69 | [
"Apache-2.0"
] | 319 | 2018-12-09T00:18:47.000Z | 2022-03-30T21:49:46.000Z | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 36.861386 | 87 | 0.480526 |
import numpy as np
import tensorflow as tf
from tensorflow_io.python.ops import core_ops
class NumpyIODataset(tf.data.Dataset):
def __init__(self, a, internal=True):
with tf.name_scope("NumpyIODataset"):
assert internal
entries = a
def p(entry):
add... | true | true |
1c46ec4630ef2346b753d3b1c8de606804d39144 | 5,523 | py | Python | azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/security_rule_py3.py | Christina-Kang/azure-sdk-for-python | bbf982eb06aab04b8151f69f1d230b7f5fb96ebf | [
"MIT"
] | 1 | 2022-03-30T22:39:15.000Z | 2022-03-30T22:39:15.000Z | azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/security_rule_py3.py | Christina-Kang/azure-sdk-for-python | bbf982eb06aab04b8151f69f1d230b7f5fb96ebf | [
"MIT"
] | 54 | 2016-03-25T17:25:01.000Z | 2018-10-22T17:27:54.000Z | azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/security_rule_py3.py | Christina-Kang/azure-sdk-for-python | bbf982eb06aab04b8151f69f1d230b7f5fb96ebf | [
"MIT"
] | 2 | 2017-01-20T18:25:46.000Z | 2017-05-12T21:31:47.000Z | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 49.756757 | 316 | 0.668296 |
from .sub_resource import SubResource
class SecurityRule(SubResource):
_validation = {
'protocol': {'required': True},
'source_address_prefix': {'required': True},
'destination_address_prefix': {'required': True},
'access': {'required': True},
'direction': {'required': Tr... | true | true |
1c46ed5b7d03f873e983faa920d777e35b56c1ae | 3,714 | py | Python | test_tflite.py | kzm4269/keras-yolo3 | 06b2b522213cb901f4a7133b87aab04079e41aff | [
"MIT"
] | null | null | null | test_tflite.py | kzm4269/keras-yolo3 | 06b2b522213cb901f4a7133b87aab04079e41aff | [
"MIT"
] | null | null | null | test_tflite.py | kzm4269/keras-yolo3 | 06b2b522213cb901f4a7133b87aab04079e41aff | [
"MIT"
] | 1 | 2019-09-17T01:28:59.000Z | 2019-09-17T01:28:59.000Z | import argparse
import sys
from pathlib import Path
import numpy as np
import tensorflow as tf
import keras
from PIL import Image
import matplotlib.pyplot as plt
from yolo3.model import yolo_eval
from yolo3.utils import letterbox_image
def predict_keras(model_path):
model = keras.models.load_model(model_path, c... | 35.371429 | 134 | 0.631125 | import argparse
import sys
from pathlib import Path
import numpy as np
import tensorflow as tf
import keras
from PIL import Image
import matplotlib.pyplot as plt
from yolo3.model import yolo_eval
from yolo3.utils import letterbox_image
def predict_keras(model_path):
model = keras.models.load_model(model_path, c... | true | true |
1c46edebef8140280b53e681b1f63cdbf8683804 | 15,791 | py | Python | tests/support/unit.py | byteskeptical/salt | 637fe0b04f38b2274191b005d73b3c6707d7f400 | [
"Apache-2.0"
] | 5 | 2018-05-01T20:51:14.000Z | 2021-11-09T05:43:00.000Z | tests/support/unit.py | byteskeptical/salt | 637fe0b04f38b2274191b005d73b3c6707d7f400 | [
"Apache-2.0"
] | 12 | 2015-04-15T22:17:42.000Z | 2016-03-22T08:46:27.000Z | tests/support/unit.py | byteskeptical/salt | 637fe0b04f38b2274191b005d73b3c6707d7f400 | [
"Apache-2.0"
] | 7 | 2017-09-29T18:49:53.000Z | 2021-11-09T05:42:49.000Z | # -*- coding: utf-8 -*-
'''
:codeauthor: Pedro Algarvio (pedro@algarvio.me)
============================
Unittest Compatibility Layer
============================
Compatibility layer to use :mod:`unittest <python2:unittest>` under Python
2.7 or `unittest2`_ under Python 2.6 without having to ... | 40.283163 | 135 | 0.604142 |
from __future__ import absolute_import, print_function, unicode_literals
import os
import sys
import logging
from unittest import (
TestLoader as _TestLoader,
TextTestRunner as _TextTestRunner,
TestCase as _TestCase,
expectedFailure,
TestSuite as _TestSuite,
skip,
skipIf,
TestResult,
... | true | true |
1c46efa6f932098b01ac8f6ff7f969b913d9d383 | 1,307 | py | Python | demo.py | foamliu/Image-Matching | 3213a8a574fa7bcc476d3de1c7370c268bf817a7 | [
"MIT"
] | 12 | 2019-04-12T06:56:59.000Z | 2020-05-03T00:47:33.000Z | demo.py | foamliu/Image-Matching | 3213a8a574fa7bcc476d3de1c7370c268bf817a7 | [
"MIT"
] | 1 | 2019-05-15T02:05:46.000Z | 2019-05-17T17:57:34.000Z | demo.py | foamliu/Image-Matching | 3213a8a574fa7bcc476d3de1c7370c268bf817a7 | [
"MIT"
] | 2 | 2019-05-28T07:03:45.000Z | 2020-03-20T09:49:15.000Z | import math
import cv2 as cv
import numpy as np
import torch
from PIL import Image
from torchvision import transforms
from models import ResNetMatchModel
def get_image(file):
img = cv.imread(file)
img = img[..., ::-1] # RGB
img = Image.fromarray(img, 'RGB') # RGB
img = transformer(img)
img = i... | 22.929825 | 74 | 0.635042 | import math
import cv2 as cv
import numpy as np
import torch
from PIL import Image
from torchvision import transforms
from models import ResNetMatchModel
def get_image(file):
img = cv.imread(file)
img = img[..., ::-1] img = Image.fromarray(img, 'RGB') img = transformer(img)
img = img.to(device... | true | true |
1c46efb1d180176edecbf36aaf6099e81619e829 | 4,855 | py | Python | torchflare/metrics/fbeta_meter.py | glenn-jocher/torchflare | 3c55b5a0761f2e85dd6da95767c6ec03f0f5baad | [
"Apache-2.0"
] | 1 | 2021-06-12T12:39:04.000Z | 2021-06-12T12:39:04.000Z | torchflare/metrics/fbeta_meter.py | weidao-Shi/torchflare | 3c55b5a0761f2e85dd6da95767c6ec03f0f5baad | [
"Apache-2.0"
] | null | null | null | torchflare/metrics/fbeta_meter.py | weidao-Shi/torchflare | 3c55b5a0761f2e85dd6da95767c6ec03f0f5baad | [
"Apache-2.0"
] | null | null | null | """Implements FBeta and F1-score."""
import torch
from torchflare.metrics.meters import MetricMeter, _BaseInputHandler
class FBeta(_BaseInputHandler, MetricMeter):
"""Computes Fbeta Score.
Supports binary,multiclass and multilabel cases.
"""
def __init__(
self,
beta: float,
... | 27.429379 | 91 | 0.581462 | import torch
from torchflare.metrics.meters import MetricMeter, _BaseInputHandler
class FBeta(_BaseInputHandler, MetricMeter):
def __init__(
self,
beta: float,
num_classes: int,
threshold: float = 0.5,
average: str = "macro",
multilabel: bool = False,
):
... | true | true |
1c46f06b69ffba498e3069692b46574d299220a8 | 5,492 | py | Python | tests/data/embeddings_test.py | richarajpal/deep_qa | d918335a1bed71b9cfccf1d5743321cee9c61952 | [
"Apache-2.0"
] | 459 | 2017-02-08T13:40:17.000Z | 2021-12-12T12:57:48.000Z | tests/data/embeddings_test.py | richarajpal/deep_qa | d918335a1bed71b9cfccf1d5743321cee9c61952 | [
"Apache-2.0"
] | 176 | 2017-01-26T01:19:41.000Z | 2018-04-22T19:16:01.000Z | tests/data/embeddings_test.py | richarajpal/deep_qa | d918335a1bed71b9cfccf1d5743321cee9c61952 | [
"Apache-2.0"
] | 154 | 2017-01-26T01:00:30.000Z | 2021-02-05T10:44:42.000Z | # pylint: disable=no-self-use,invalid-name
import gzip
import numpy
import pytest
from deep_qa.common.checks import ConfigurationError
from deep_qa.data.data_indexer import DataIndexer
from deep_qa.data.embeddings import PretrainedEmbeddings
from deep_qa.models.text_classification import ClassificationModel
from deep_... | 51.327103 | 101 | 0.64512 | import gzip
import numpy
import pytest
from deep_qa.common.checks import ConfigurationError
from deep_qa.data.data_indexer import DataIndexer
from deep_qa.data.embeddings import PretrainedEmbeddings
from deep_qa.models.text_classification import ClassificationModel
from deep_qa.testing.test_case import DeepQaTestCase
... | true | true |
1c46f19ef96c73dc748b7707cea8dbf4595a8711 | 2,871 | py | Python | worker/view.py | photonle/bot | 3689d3bfb177bb4b2efe207311283e63118fa427 | [
"MIT"
] | 1 | 2020-03-18T14:50:59.000Z | 2020-03-18T14:50:59.000Z | worker/view.py | photonle/bot | 3689d3bfb177bb4b2efe207311283e63118fa427 | [
"MIT"
] | 3 | 2020-03-17T14:07:43.000Z | 2021-02-14T13:28:22.000Z | worker/view.py | photonle/bot | 3689d3bfb177bb4b2efe207311283e63118fa427 | [
"MIT"
] | 1 | 2020-05-17T15:19:31.000Z | 2020-05-17T15:19:31.000Z | from shutil import copy
import sqlite3
import sys
sys.stdout = open("report.txt", "w", encoding="utf8")
copy('photon.db', 'photon.read.db')
conn = sqlite3.connect('photon.read.db')
curs = conn.cursor()
curs.execute("SELECT * FROM (SELECT path, COUNT(*) as count FROM files GROUP BY path) WHERE count > 1 ORDER BY coun... | 58.591837 | 223 | 0.676071 | from shutil import copy
import sqlite3
import sys
sys.stdout = open("report.txt", "w", encoding="utf8")
copy('photon.db', 'photon.read.db')
conn = sqlite3.connect('photon.read.db')
curs = conn.cursor()
curs.execute("SELECT * FROM (SELECT path, COUNT(*) as count FROM files GROUP BY path) WHERE count > 1 ORDER BY coun... | true | true |
1c46f2088730032fec400cd35792bfc6b4aa4935 | 3,714 | py | Python | Lesson 04/walkthrough.py | NoelKocheril/Python101 | b0e923e1ec3e936babbd57a310ec72b13e07ac57 | [
"WTFPL"
] | null | null | null | Lesson 04/walkthrough.py | NoelKocheril/Python101 | b0e923e1ec3e936babbd57a310ec72b13e07ac57 | [
"WTFPL"
] | null | null | null | Lesson 04/walkthrough.py | NoelKocheril/Python101 | b0e923e1ec3e936babbd57a310ec72b13e07ac57 | [
"WTFPL"
] | null | null | null | # Defines a function
# def my_func():
# print("Hello, World!")
# Calls a function
# my_func()
# Repeats a function
# for j in range(10):
# my_func()
# myName = "Noel Kocheril"
# def hello(fname):
# print(f"Hello {fname}")
# hello() # Missing an argument
# hello("Noel")
# hello("Vit")
# hello("Sha... | 13.407942 | 70 | 0.522348 |
# sumOfNumbers(5)
# -> result = 5 + sumOfNumbers(4)
# -> result = 5 + 4 + sumOfNumbers(3) -> 0
# """
def factorial(x):
if x > 0:
result = x * factorial(x - 1)
print(result)
return result
elif x == 0:
... | true | true |
1c46f24731b57cf200f9345b0298f65fdfe81f08 | 1,237 | py | Python | ecom/urls.py | dongmokevin/ecomv1 | abb3dc5a5476c379c029b8299e820c1979d5eb14 | [
"MIT"
] | null | null | null | ecom/urls.py | dongmokevin/ecomv1 | abb3dc5a5476c379c029b8299e820c1979d5eb14 | [
"MIT"
] | null | null | null | ecom/urls.py | dongmokevin/ecomv1 | abb3dc5a5476c379c029b8299e820c1979d5eb14 | [
"MIT"
] | null | null | null | """ecom URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based vi... | 35.342857 | 80 | 0.704931 | from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('core.urls')),
path('basket/', include('basket.urls', namespace='basket')),
path('payment... | true | true |
1c46f4a9f5384283addc48510e60b1443d6e5e60 | 898 | py | Python | python/hsml/utils/tensor.py | robzor92/models-api | d83ebd775acab4fad94cd4c6a38107635e4b4880 | [
"Apache-2.0"
] | null | null | null | python/hsml/utils/tensor.py | robzor92/models-api | d83ebd775acab4fad94cd4c6a38107635e4b4880 | [
"Apache-2.0"
] | null | null | null | python/hsml/utils/tensor.py | robzor92/models-api | d83ebd775acab4fad94cd4c6a38107635e4b4880 | [
"Apache-2.0"
] | null | null | null | #
# Copyright 2021 Logical Clocks AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | 32.071429 | 76 | 0.7049 |
class Tensor:
def __init__(self, data_type: None, shape: None):
self.data_type = data_type
self.shape = shape
def to_dict(self):
return {"shape": self.shape, "dataType": self.data_type}
| true | true |
1c46f50f3cb0a12eb3ccbd5ce2ef644903c88627 | 12,415 | py | Python | homeassistant/components/alarmdecoder/config_flow.py | DavidDeSloovere/core | 909a20b36d4df6724c955c2ae28cb82fe6d50c2e | [
"Apache-2.0"
] | 4 | 2020-08-10T20:02:24.000Z | 2022-01-31T02:14:22.000Z | homeassistant/components/alarmdecoder/config_flow.py | jagadeeshvenkatesh/core | 1bd982668449815fee2105478569f8e4b5670add | [
"Apache-2.0"
] | 78 | 2020-07-23T07:13:08.000Z | 2022-03-31T06:02:04.000Z | homeassistant/components/alarmdecoder/config_flow.py | jagadeeshvenkatesh/core | 1bd982668449815fee2105478569f8e4b5670add | [
"Apache-2.0"
] | 3 | 2022-01-17T20:10:54.000Z | 2022-01-17T20:17:22.000Z | """Config flow for AlarmDecoder."""
import logging
from adext import AdExt
from alarmdecoder.devices import SerialDevice, SocketDevice
from alarmdecoder.util import NoDeviceError
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components.binary_sensor import DEVICE_CLASSES
from ho... | 33.920765 | 105 | 0.560129 | import logging
from adext import AdExt
from alarmdecoder.devices import SerialDevice, SocketDevice
from alarmdecoder.util import NoDeviceError
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components.binary_sensor import DEVICE_CLASSES
from homeassistant.const import CONF_HOST, ... | true | true |
1c46f51d76f2d9918be20948b378e49153ec1648 | 7,109 | py | Python | svgpathtools/svg_io_sax.py | Vrroom/svgpathtools | b9621c9c340337cd044ae21c83e2917cd010dc8f | [
"MIT"
] | 2 | 2018-05-08T05:31:15.000Z | 2022-01-27T11:51:04.000Z | svgpathtools/svg_io_sax.py | taoari/svgpathtools | 9b1b8e78e10b99d6ca3d4b28e5b6b0d1596b8dc2 | [
"MIT"
] | null | null | null | svgpathtools/svg_io_sax.py | taoari/svgpathtools | 9b1b8e78e10b99d6ca3d4b28e5b6b0d1596b8dc2 | [
"MIT"
] | 3 | 2018-01-15T18:08:06.000Z | 2018-10-11T09:19:49.000Z | """(Experimental) replacement for import/export functionality SAX
"""
# External dependencies
from __future__ import division, absolute_import, print_function
import os
from xml.etree.ElementTree import iterparse, Element, ElementTree, SubElement
# Internal dependencies
from .parser import parse_path
from .parser im... | 35.723618 | 80 | 0.544943 |
from __future__ import division, absolute_import, print_function
import os
from xml.etree.ElementTree import iterparse, Element, ElementTree, SubElement
from .parser import parse_path
from .parser import parse_transform
from .svg_to_paths import (path2pathd, ellipse2pathd, line2pathd,
polyl... | true | true |
1c46f578bdd65913273fe1b4661b4a5a024c948b | 301 | py | Python | 3. Python Advanced (September 2021)/3.2 Python OOP (October 2021)/01. First Steps In OOP/04_car.py | kzborisov/SoftUni | ccb2b8850adc79bfb2652a45124c3ff11183412e | [
"MIT"
] | 1 | 2021-02-07T07:51:12.000Z | 2021-02-07T07:51:12.000Z | 3. Python Advanced (September 2021)/3.2 Python OOP (October 2021)/01. First Steps In OOP/04_car.py | kzborisov/softuni | 9c5b45c74fa7d9748e9b3ea65a5ae4e15c142751 | [
"MIT"
] | null | null | null | 3. Python Advanced (September 2021)/3.2 Python OOP (October 2021)/01. First Steps In OOP/04_car.py | kzborisov/softuni | 9c5b45c74fa7d9748e9b3ea65a5ae4e15c142751 | [
"MIT"
] | null | null | null | class Car:
def __init__(self, name, model, engine):
self.name = name
self.model = model
self.engine = engine
def get_info(self):
return f"This is {self.name} {self.model} with engine {self.engine}"
car = Car("Kia", "Rio", "1.3L B3 I4")
print(car.get_info())
| 23.153846 | 76 | 0.598007 | class Car:
def __init__(self, name, model, engine):
self.name = name
self.model = model
self.engine = engine
def get_info(self):
return f"This is {self.name} {self.model} with engine {self.engine}"
car = Car("Kia", "Rio", "1.3L B3 I4")
print(car.get_info())
| true | true |
1c46f59fb85d988d23d303ed82be39df0f9802c3 | 1,990 | py | Python | contact_form/tests/views.py | nunataksoftware/django-contact-form-updated | ad3da22a6c12c78e59fe05bf4e4f9f5a1e654e03 | [
"BSD-3-Clause"
] | null | null | null | contact_form/tests/views.py | nunataksoftware/django-contact-form-updated | ad3da22a6c12c78e59fe05bf4e4f9f5a1e654e03 | [
"BSD-3-Clause"
] | null | null | null | contact_form/tests/views.py | nunataksoftware/django-contact-form-updated | ad3da22a6c12c78e59fe05bf4e4f9f5a1e654e03 | [
"BSD-3-Clause"
] | null | null | null | from django.conf import settings
from django.core import mail
from django.core.urlresolvers import reverse
from django.test import TestCase
class ViewTests(TestCase):
urls = 'contact_form.urls'
def test_get(self):
"""
HTTP GET on the form view just shows the form.
"""
... | 29.701493 | 65 | 0.522613 | from django.conf import settings
from django.core import mail
from django.core.urlresolvers import reverse
from django.test import TestCase
class ViewTests(TestCase):
urls = 'contact_form.urls'
def test_get(self):
contact_url = reverse('contact_form')
response = self.client.get(conta... | true | true |
1c46f61d2a6ed620777848b6db1e240c81c79142 | 16,339 | py | Python | cadnano/util.py | mctrinh/cadnano2.5 | d8254f24eef5fd77b4fb2b1a9642a8eea2e3c736 | [
"BSD-3-Clause"
] | 1 | 2022-03-27T14:37:32.000Z | 2022-03-27T14:37:32.000Z | cadnano/util.py | mctrinh/cadnano2.5 | d8254f24eef5fd77b4fb2b1a9642a8eea2e3c736 | [
"BSD-3-Clause"
] | null | null | null | cadnano/util.py | mctrinh/cadnano2.5 | d8254f24eef5fd77b4fb2b1a9642a8eea2e3c736 | [
"BSD-3-Clause"
] | 1 | 2021-01-22T02:29:38.000Z | 2021-01-22T02:29:38.000Z | """
util.py
"""
import argparse
import inspect
import logging
import logging.handlers
import os
import platform
import string
import sys
from os import path
from traceback import extract_stack
logger = logging.getLogger(__name__)
IS_PY_3 = int(sys.version_info[0] > 2)
def clamp(x, min_x, max_x):
if x < min_x:
... | 34.253669 | 113 | 0.63988 | import argparse
import inspect
import logging
import logging.handlers
import os
import platform
import string
import sys
from os import path
from traceback import extract_stack
logger = logging.getLogger(__name__)
IS_PY_3 = int(sys.version_info[0] > 2)
def clamp(x, min_x, max_x):
if x < min_x:
return mi... | true | true |
1c46fa3e618557a23f27ae9321e98729cbf11428 | 37 | py | Python | src/trex/error.py | cnk113/TREX | add83d8108f3602c5bbe7b37f60ff19f89b2236d | [
"MIT"
] | null | null | null | src/trex/error.py | cnk113/TREX | add83d8108f3602c5bbe7b37f60ff19f89b2236d | [
"MIT"
] | 1 | 2022-03-18T01:56:53.000Z | 2022-03-24T19:35:58.000Z | src/trex/error.py | cnk113/TREX | add83d8108f3602c5bbe7b37f60ff19f89b2236d | [
"MIT"
] | 1 | 2022-03-23T03:07:42.000Z | 2022-03-23T03:07:42.000Z | class TrexError(Exception):
pass
| 12.333333 | 27 | 0.72973 | class TrexError(Exception):
pass
| true | true |
1c46fc394f4f2e4a1722f7dab063575db81ae159 | 2,360 | py | Python | rematchrSite/rematchrApp/migrations/0003_auto_20150319_1243.py | ctames/rematchr | 4a22c3e4b1c22b64008e4996bdde9d4657c5294b | [
"MIT"
] | null | null | null | rematchrSite/rematchrApp/migrations/0003_auto_20150319_1243.py | ctames/rematchr | 4a22c3e4b1c22b64008e4996bdde9d4657c5294b | [
"MIT"
] | null | null | null | rematchrSite/rematchrApp/migrations/0003_auto_20150319_1243.py | ctames/rematchr | 4a22c3e4b1c22b64008e4996bdde9d4657c5294b | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('rematchrApp', '0002_auto_20150226_1336'),... | 30.649351 | 89 | 0.563559 | from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('rematchrApp', '0002_auto_20150226_1336'),
]
operations =... | true | true |
1c46fd08a6227a33592d9bcc9675ca8b875b746f | 13,736 | py | Python | src/part2.py | shelonsky/Spark-Project-on-Demographic-Analysis-of-Turkey | 91a6d28e125bdd14b5b44a1ea426c2728b7aa9c3 | [
"MIT"
] | 1 | 2021-12-30T14:19:18.000Z | 2021-12-30T14:19:18.000Z | src/part2.py | shelonsky/Spark-Project-on-Demographic-Analysis-of-Turkey | 91a6d28e125bdd14b5b44a1ea426c2728b7aa9c3 | [
"MIT"
] | null | null | null | src/part2.py | shelonsky/Spark-Project-on-Demographic-Analysis-of-Turkey | 91a6d28e125bdd14b5b44a1ea426c2728b7aa9c3 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# @Time : 2021/5/30 16:06
# @Author : Xiao Lulu
#!/usr/bin/env python
# coding: utf-8
# In[2]:
import pyspark.sql.functions as F
from pyspark.sql import Row
from pyspark.sql.functions import *
from pyspark import SparkContext, SparkConf
from pyspark.sql import SparkSession
import re
from... | 39.585014 | 118 | 0.692268 |
import pyspark.sql.functions as F
from pyspark.sql import Row
from pyspark.sql.functions import *
from pyspark import SparkContext, SparkConf
from pyspark.sql import SparkSession
import re
from pyspark.sql.types import *
from pyspark.sql.window import Window
from pyspark.sql.functions import rank, col
from pyspark.... | true | true |
1c46fdcf707a39d6008c2679f4330a4c105e612a | 7,835 | py | Python | coffee.py | capjamesg/hypertext-coffee-pot | 2cf5987493066063908b467568a7c54c71c2ff66 | [
"MIT"
] | null | null | null | coffee.py | capjamesg/hypertext-coffee-pot | 2cf5987493066063908b467568a7c54c71c2ff66 | [
"MIT"
] | null | null | null | coffee.py | capjamesg/hypertext-coffee-pot | 2cf5987493066063908b467568a7c54c71c2ff66 | [
"MIT"
] | null | null | null | from config import *
import datetime
import logging
import socket
import json
import os
logging.basicConfig(filename="coffeepot.log", level=logging.DEBUG)
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((HOST, PORT))
pouring_milk = None
last_request = None
# rewrite the currently brewing fi... | 35.292793 | 126 | 0.596171 | from config import *
import datetime
import logging
import socket
import json
import os
logging.basicConfig(filename="coffeepot.log", level=logging.DEBUG)
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((HOST, PORT))
pouring_milk = None
last_request = None
with open("currently_brewing.json"... | true | true |
1c46fde441f196ee5cc51a5ec50072e5a1d3b4aa | 7,281 | py | Python | scripts/fig/util.py | ucbrise/snoopy | da4c98e3876c10cf52aa51ece3b62c5e8b8e335a | [
"Apache-2.0"
] | 9 | 2021-11-10T20:34:00.000Z | 2022-03-23T02:30:29.000Z | scripts/fig/util.py | ucbrise/snoopy | da4c98e3876c10cf52aa51ece3b62c5e8b8e335a | [
"Apache-2.0"
] | null | null | null | scripts/fig/util.py | ucbrise/snoopy | da4c98e3876c10cf52aa51ece3b62c5e8b8e335a | [
"Apache-2.0"
] | 4 | 2021-09-30T05:12:06.000Z | 2022-03-18T03:05:21.000Z | import json
import math
import random
from collections import defaultdict
from scipy.special import lambertw
def parseData(filename):
results = []
f = open(filename, "r")
for line in f:
elems = line.split()
result = {
"clients": int(elems[0]),
"data_size": int(elems[... | 33.708333 | 106 | 0.573136 | import json
import math
import random
from collections import defaultdict
from scipy.special import lambertw
def parseData(filename):
results = []
f = open(filename, "r")
for line in f:
elems = line.split()
result = {
"clients": int(elems[0]),
"data_size": int(elems[... | true | true |
1c4702f1d0d7fa1c75b6ea73d0e090f76d63480b | 2,601 | py | Python | explore/viz/continuous.py | idc9/explore | ce8aa039de96b1dd9fecc19fa098c222863ac3ce | [
"MIT"
] | null | null | null | explore/viz/continuous.py | idc9/explore | ce8aa039de96b1dd9fecc19fa098c222863ac3ce | [
"MIT"
] | null | null | null | explore/viz/continuous.py | idc9/explore | ce8aa039de96b1dd9fecc19fa098c222863ac3ce | [
"MIT"
] | 1 | 2021-02-05T20:31:51.000Z | 2021-02-05T20:31:51.000Z | import matplotlib.pyplot as plt
import pandas as pd
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import StandardScaler
from scipy.stats import pearsonr
from explore.utils import safe_apply
from explore.viz.utils import bold, ABLine2D, fmt_pval
def plot_scatter(x, y, alpha=0.05, standa... | 30.964286 | 87 | 0.582468 | import matplotlib.pyplot as plt
import pandas as pd
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import StandardScaler
from scipy.stats import pearsonr
from explore.utils import safe_apply
from explore.viz.utils import bold, ABLine2D, fmt_pval
def plot_scatter(x, y, alpha=0.05, standa... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.