hexsha stringlengths 40 40 | size int64 4 996k | ext stringclasses 8
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 4 996k | avg_line_length float64 1.33 58.2k | max_line_length int64 2 323k | alphanum_fraction float64 0 0.97 | content_no_comment stringlengths 0 946k | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f724461d9b5f371de5e8cc03ae8c7e10e9f3cfa1 | 2,813 | py | Python | task_manager/tasks/migrations/0001_initial.py | rabilrbl/task_manager | 10c96df8f41caf2db6a0ec2aa7cb961135412843 | [
"BSD-3-Clause"
] | null | null | null | task_manager/tasks/migrations/0001_initial.py | rabilrbl/task_manager | 10c96df8f41caf2db6a0ec2aa7cb961135412843 | [
"BSD-3-Clause"
] | null | null | null | task_manager/tasks/migrations/0001_initial.py | rabilrbl/task_manager | 10c96df8f41caf2db6a0ec2aa7cb961135412843 | [
"BSD-3-Clause"
] | null | null | null | # Generated by Django 3.2.12 on 2022-02-16 17:52
import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUT... | 52.092593 | 202 | 0.614646 |
import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
... | true | true |
f724467171d010ee0e4c6085d11642893a2e975d | 430 | py | Python | packages/python/plotly/plotly/validators/barpolar/marker/colorbar/title/_text.py | mastermind88/plotly.py | efa70710df1af22958e1be080e105130042f1839 | [
"MIT"
] | null | null | null | packages/python/plotly/plotly/validators/barpolar/marker/colorbar/title/_text.py | mastermind88/plotly.py | efa70710df1af22958e1be080e105130042f1839 | [
"MIT"
] | null | null | null | packages/python/plotly/plotly/validators/barpolar/marker/colorbar/title/_text.py | mastermind88/plotly.py | efa70710df1af22958e1be080e105130042f1839 | [
"MIT"
] | null | null | null | import _plotly_utils.basevalidators
class TextValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self, plotly_name="text", parent_name="barpolar.marker.colorbar.title", **kwargs
):
super(TextValidator, self).__init__(
plotly_name=plotly_name,
parent_... | 30.714286 | 88 | 0.65814 | import _plotly_utils.basevalidators
class TextValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self, plotly_name="text", parent_name="barpolar.marker.colorbar.title", **kwargs
):
super(TextValidator, self).__init__(
plotly_name=plotly_name,
parent_... | true | true |
f7244861300db686a544ca4278551c0acac34d9c | 2,864 | py | Python | code/week 6/rat_in_a_maze.py | c235gsy/Sustech_Data-Structure-and-Algorithm-Analysis | fcbd450216e9e62cd3365ad2a8ccab00b9eb679f | [
"MIT"
] | 1 | 2020-01-04T13:35:29.000Z | 2020-01-04T13:35:29.000Z | code/week 6/rat_in_a_maze.py | c235gsy/Sustech_Data-Structure-and-Algorithm-Analysis | fcbd450216e9e62cd3365ad2a8ccab00b9eb679f | [
"MIT"
] | null | null | null | code/week 6/rat_in_a_maze.py | c235gsy/Sustech_Data-Structure-and-Algorithm-Analysis | fcbd450216e9e62cd3365ad2a8ccab00b9eb679f | [
"MIT"
] | null | null | null |
class Queue:
# A container with a first-in-first-out (FIFO) queuing policy.
def __init__(self):
self.list = []
def push(self,item):
# Enqueue the 'item' into the queue
self.list.insert(0, item)
def pop(self):
# Dequeue the earliest enqueued item still in the queue. Th... | 29.525773 | 112 | 0.511522 |
class Queue:
def __init__(self):
self.list = []
def push(self,item):
self.list.insert(0, item)
def pop(self):
return self.list.pop()
def is_empty(self):
return len(self.list) == 0
global maze
maze = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,... | true | true |
f72448dcbaaf3b3cb88177c88c779358a33a7210 | 545 | py | Python | lib/models/__init__.py | ablattmann/pose_estimation_hrnet | 67d5a3446979c2abe54578ee4bba3787862d4077 | [
"MIT"
] | null | null | null | lib/models/__init__.py | ablattmann/pose_estimation_hrnet | 67d5a3446979c2abe54578ee4bba3787862d4077 | [
"MIT"
] | null | null | null | lib/models/__init__.py | ablattmann/pose_estimation_hrnet | 67d5a3446979c2abe54578ee4bba3787862d4077 | [
"MIT"
] | null | null | null | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (Bin.Xiao@microsoft.com)
# ------------------------------------------------------------------------------
from __future__ import absolute_import
from __futu... | 32.058824 | 80 | 0.585321 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
| true | true |
f72449514abd4834918b9dc32df86e5d6d182d1c | 2,299 | py | Python | magnum/tests/functional/tempest_tests/config.py | mail2nsrajesh/magnum | 2e7e5a77967028c961337177ce577eb936c3845c | [
"Apache-2.0"
] | null | null | null | magnum/tests/functional/tempest_tests/config.py | mail2nsrajesh/magnum | 2e7e5a77967028c961337177ce577eb936c3845c | [
"Apache-2.0"
] | null | null | null | magnum/tests/functional/tempest_tests/config.py | mail2nsrajesh/magnum | 2e7e5a77967028c961337177ce577eb936c3845c | [
"Apache-2.0"
] | null | null | null | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | 33.808824 | 77 | 0.628099 |
from __future__ import print_function
from oslo_config import cfg
from tempest import config
service_available_group = cfg.OptGroup(name="service_available",
title="Available OpenStack Services")
ServiceAvailableGroup = [
cfg.BoolOpt("magnum",
... | true | true |
f7244962c5bfd8e1aa5c08eb18369e6d57850268 | 1,912 | py | Python | EnvironmentAM2315MuxSensor.py | MBI-Div-B/pytango-EnvironmentAM2315Mux | ebbea69d2c954b6d1e59e49a31eb36ec60929bad | [
"MIT"
] | null | null | null | EnvironmentAM2315MuxSensor.py | MBI-Div-B/pytango-EnvironmentAM2315Mux | ebbea69d2c954b6d1e59e49a31eb36ec60929bad | [
"MIT"
] | null | null | null | EnvironmentAM2315MuxSensor.py | MBI-Div-B/pytango-EnvironmentAM2315Mux | ebbea69d2c954b6d1e59e49a31eb36ec60929bad | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2020 MBI-Division-B
# MIT License, refer to LICENSE file
# Author: Luca Barbera / Email: barbera@mbi-berlin.de
from tango import AttrWriteType, DevState, DebugIt, ErrorIt, InfoIt, DeviceProxy
from tango.server import Device, attribute, command, device_... | 28.537313 | 80 | 0.582636 |
from tango import AttrWriteType, DevState, DebugIt, ErrorIt, InfoIt, DeviceProxy
from tango.server import Device, attribute, command, device_property
class EnvironmentAM2315MuxSensor(Device):
CtrlDevice = device_property(
dtype="str",
default_value="domain/family/memeber",
)
... | true | true |
f7244a801802bebba70ac938a121a24fcb049c4f | 1,578 | py | Python | nssrc/com/citrix/netscaler/nitro/resource/config/router/routerdynamicrouting_args.py | guardicore/nitro-python | 5346a5086134aead80968f15a41ff527adaa0ec1 | [
"Apache-2.0"
] | null | null | null | nssrc/com/citrix/netscaler/nitro/resource/config/router/routerdynamicrouting_args.py | guardicore/nitro-python | 5346a5086134aead80968f15a41ff527adaa0ec1 | [
"Apache-2.0"
] | null | null | null | nssrc/com/citrix/netscaler/nitro/resource/config/router/routerdynamicrouting_args.py | guardicore/nitro-python | 5346a5086134aead80968f15a41ff527adaa0ec1 | [
"Apache-2.0"
] | null | null | null | #
# Copyright (c) 2021 Citrix Systems, 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... | 25.868852 | 101 | 0.709125 |
class routerdynamicrouting_args :
def __init__(self) :
self._commandstring = None
self._nodeid = None
@property
def commandstring(self) :
try :
return self._commandstring
except Exception as e:
raise e
@commandstring.setter
def commandstring(self, commandstring) :
try :
self._... | true | true |
f7244c2c22cf9787986fc05f8c297d20c042b807 | 14,326 | py | Python | aries_cloudagent/wallet/tests/test_routes.py | jcourt562/aries-cloudagent-python | de291184c59006391a76317826983dd1eb0ada5d | [
"Apache-2.0"
] | 1 | 2020-11-30T05:47:54.000Z | 2020-11-30T05:47:54.000Z | aries_cloudagent/wallet/tests/test_routes.py | jcourt562/aries-cloudagent-python | de291184c59006391a76317826983dd1eb0ada5d | [
"Apache-2.0"
] | 1 | 2020-02-25T19:01:16.000Z | 2020-02-25T19:01:16.000Z | aries_cloudagent/wallet/tests/test_routes.py | jcourt562/aries-cloudagent-python | de291184c59006391a76317826983dd1eb0ada5d | [
"Apache-2.0"
] | 2 | 2020-02-18T20:34:01.000Z | 2021-03-12T16:18:30.000Z | from asynctest import TestCase as AsyncTestCase
from asynctest import mock as async_mock
import pytest
from aiohttp.web import HTTPForbidden
from ...config.injection_context import InjectionContext
from ...ledger.base import BaseLedger
from ...wallet.base import BaseWallet, DIDInfo
from .. import routes as test_modu... | 42.259587 | 88 | 0.644144 | from asynctest import TestCase as AsyncTestCase
from asynctest import mock as async_mock
import pytest
from aiohttp.web import HTTPForbidden
from ...config.injection_context import InjectionContext
from ...ledger.base import BaseLedger
from ...wallet.base import BaseWallet, DIDInfo
from .. import routes as test_modu... | true | true |
f7244d3b8570046485a9f0792f05527b6f08760b | 62 | py | Python | app/db/repos/base/protocols/statements/__init__.py | maxzhenzhera/my_vocab_backend | 2e9f968374e0bc2fcc0ae40830ca40f3cf5754d1 | [
"MIT"
] | null | null | null | app/db/repos/base/protocols/statements/__init__.py | maxzhenzhera/my_vocab_backend | 2e9f968374e0bc2fcc0ae40830ca40f3cf5754d1 | [
"MIT"
] | null | null | null | app/db/repos/base/protocols/statements/__init__.py | maxzhenzhera/my_vocab_backend | 2e9f968374e0bc2fcc0ae40830ca40f3cf5754d1 | [
"MIT"
] | null | null | null | from .returnable import Returnable
__all__ = ['Returnable']
| 12.4 | 34 | 0.758065 | from .returnable import Returnable
__all__ = ['Returnable']
| true | true |
f7244e8ebbd013097871e683eb9e56711f004cd7 | 461 | py | Python | EDUREKA/Course.3/Case.Study.1.Programs/distanceCalculation.py | linkeshkanna/ProblemSolving | 8286ce66fbe82a78e1a19396da2d888d755d4cf4 | [
"Apache-2.0"
] | null | null | null | EDUREKA/Course.3/Case.Study.1.Programs/distanceCalculation.py | linkeshkanna/ProblemSolving | 8286ce66fbe82a78e1a19396da2d888d755d4cf4 | [
"Apache-2.0"
] | null | null | null | EDUREKA/Course.3/Case.Study.1.Programs/distanceCalculation.py | linkeshkanna/ProblemSolving | 8286ce66fbe82a78e1a19396da2d888d755d4cf4 | [
"Apache-2.0"
] | null | null | null | import math
from math import radians
lat1 = 13.0827
lat2 = 9.4533
long1 = 80.2707
long2 = 77.8024
R = 6371
teta1 = radians(lat1)
teta2 = radians(lat2)
teta = radians(lat2 - lat1)
landa = radians(long2 - long1)
a = math.sin(teta/2) * math.sin(teta/2) + math.cos(teta1) * math.cos(teta2) * math.sin(landa/2) * math.sin... | 19.208333 | 115 | 0.661605 | import math
from math import radians
lat1 = 13.0827
lat2 = 9.4533
long1 = 80.2707
long2 = 77.8024
R = 6371
teta1 = radians(lat1)
teta2 = radians(lat2)
teta = radians(lat2 - lat1)
landa = radians(long2 - long1)
a = math.sin(teta/2) * math.sin(teta/2) + math.cos(teta1) * math.cos(teta2) * math.sin(landa/2) * math.sin... | true | true |
f7244e9d2237fe01ddaeb6e8e95ca04552be563e | 3,688 | py | Python | airiam/terraform/entity_terraformers/IAMPolicyDocumentTransformer.py | metahertz/AirIAM | 212f84e1b1a51c7a614384f91b220e7f2a57a079 | [
"Apache-2.0"
] | 501 | 2020-03-04T16:00:54.000Z | 2022-03-30T17:31:10.000Z | airiam/terraform/entity_terraformers/IAMPolicyDocumentTransformer.py | rckasa/AirIAM | 5a99dc25354c1bc6525dbaf25a3afcd472f71b2f | [
"Apache-2.0"
] | 34 | 2020-03-23T08:12:18.000Z | 2022-02-13T08:50:39.000Z | airiam/terraform/entity_terraformers/IAMPolicyDocumentTransformer.py | rckasa/AirIAM | 5a99dc25354c1bc6525dbaf25a3afcd472f71b2f | [
"Apache-2.0"
] | 51 | 2020-04-16T06:43:29.000Z | 2022-03-20T14:20:24.000Z | import json
from airiam.terraform.entity_terraformers.BaseEntityTransformer import BaseEntityTransformer
class IAMPolicyDocumentTransformer(BaseEntityTransformer):
def __init__(self, entity_json: dict, policy_name, principal_name=None):
policy_document_name = f"{policy_name}_document"
if principa... | 38.821053 | 138 | 0.632863 | import json
from airiam.terraform.entity_terraformers.BaseEntityTransformer import BaseEntityTransformer
class IAMPolicyDocumentTransformer(BaseEntityTransformer):
def __init__(self, entity_json: dict, policy_name, principal_name=None):
policy_document_name = f"{policy_name}_document"
if principa... | true | true |
f7244effc59fcc20c066ca606a185366478f6693 | 620 | py | Python | smpc_demo_platform/benchmarking/views.py | Safe-DEED/mpc-mock-up | 7c12b94d50bcde8480da8a7abf93c32b2708e2aa | [
"MIT"
] | null | null | null | smpc_demo_platform/benchmarking/views.py | Safe-DEED/mpc-mock-up | 7c12b94d50bcde8480da8a7abf93c32b2708e2aa | [
"MIT"
] | null | null | null | smpc_demo_platform/benchmarking/views.py | Safe-DEED/mpc-mock-up | 7c12b94d50bcde8480da8a7abf93c32b2708e2aa | [
"MIT"
] | null | null | null | from django.views.generic.base import TemplateView
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
# decorators = [login_required, ]
# @method_decorator(decorators, name='dispatch')
class BenchmarkViewAppCGOne(TemplateView):
template_name = "benchmar... | 31 | 68 | 0.774194 | from django.views.generic.base import TemplateView
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
class BenchmarkViewAppCGOne(TemplateView):
template_name = "benchmarking/app-x3-Z63/benchmarking-home.html"
def get_context_data(self, **kwargs)... | true | true |
f72450ed27bed040eb378e87323d130b0d5efc33 | 143 | py | Python | utests/test_parsers.py | Zephor5/zspider | 49178415137d67d7c88f2904bcb204df32082204 | [
"MIT"
] | 12 | 2015-12-23T10:13:31.000Z | 2021-04-25T17:12:39.000Z | utests/test_parsers.py | Zephor5/zspider | 49178415137d67d7c88f2904bcb204df32082204 | [
"MIT"
] | 1 | 2022-03-02T14:53:18.000Z | 2022-03-02T14:53:18.000Z | utests/test_parsers.py | Zephor5/zspider | 49178415137d67d7c88f2904bcb204df32082204 | [
"MIT"
] | 1 | 2017-09-18T08:51:51.000Z | 2017-09-18T08:51:51.000Z | # coding=utf-8
import unittest
__author__ = "zephor"
# noinspection PyUnresolvedReferences
class TestNewspaper(unittest.TestCase):
pass
| 14.3 | 39 | 0.783217 |
import unittest
__author__ = "zephor"
class TestNewspaper(unittest.TestCase):
pass
| true | true |
f7245165fdf913d8a10e8d0815498a4fecb991a0 | 2,721 | py | Python | lumbermill/modifier/Permutate.py | dstore-dbap/LumberMill | b7cbadc209a83386871735b8ad88b61da917a6ab | [
"Apache-2.0"
] | 15 | 2015-12-14T19:07:28.000Z | 2022-02-28T13:32:11.000Z | lumbermill/modifier/Permutate.py | dstore-dbap/LumberMill | b7cbadc209a83386871735b8ad88b61da917a6ab | [
"Apache-2.0"
] | null | null | null | lumbermill/modifier/Permutate.py | dstore-dbap/LumberMill | b7cbadc209a83386871735b8ad88b61da917a6ab | [
"Apache-2.0"
] | 4 | 2017-02-08T10:49:55.000Z | 2019-03-19T18:47:46.000Z | # -*- coding: utf-8 -*-
import itertools
import sys
from lumbermill.BaseThreadedModule import BaseThreadedModule
from lumbermill.utils.Decorators import ModuleDocstringParser
@ModuleDocstringParser
class Permutate(BaseThreadedModule):
"""
Creates successive len('target_fields') length permutations of element... | 38.871429 | 123 | 0.606027 |
import itertools
import sys
from lumbermill.BaseThreadedModule import BaseThreadedModule
from lumbermill.utils.Decorators import ModuleDocstringParser
@ModuleDocstringParser
class Permutate(BaseThreadedModule):
module_type = "modifier"
def handleEvent(self, event):
try:
context_data =... | true | true |
f72451c6dd941af7a8fa151c731d1b07245f0b6c | 8,252 | py | Python | tests/test_utils.py | austinjp/textacy | dddfdbf0e0ab3bf756bc4eda042eab1001aac709 | [
"Apache-2.0"
] | 1,929 | 2016-02-14T08:30:38.000Z | 2022-03-31T03:00:35.000Z | tests/test_utils.py | austinjp/textacy | dddfdbf0e0ab3bf756bc4eda042eab1001aac709 | [
"Apache-2.0"
] | 304 | 2016-02-18T15:52:22.000Z | 2022-03-31T18:06:54.000Z | tests/test_utils.py | austinjp/textacy | dddfdbf0e0ab3bf756bc4eda042eab1001aac709 | [
"Apache-2.0"
] | 285 | 2016-03-20T04:25:08.000Z | 2022-03-24T11:31:17.000Z | import datetime
import pathlib
import pytest
from textacy import utils
@pytest.mark.parametrize(
"val,val_type,col_type,expected",
[
(None, int, list, None),
(1, int, list, [1]),
([1, 2], int, tuple, (1, 2)),
((1, 1.0), (int, float), set, {1, 1.0}),
],
)
def test_to_colle... | 32.234375 | 88 | 0.491032 | import datetime
import pathlib
import pytest
from textacy import utils
@pytest.mark.parametrize(
"val,val_type,col_type,expected",
[
(None, int, list, None),
(1, int, list, [1]),
([1, 2], int, tuple, (1, 2)),
((1, 1.0), (int, float), set, {1, 1.0}),
],
)
def test_to_colle... | true | true |
f72453a57dbfc168b184e62aede21ddeafb3650f | 2,970 | py | Python | cerebro/storage/local.py | Abhishek2304/Cerebro-System-Ray | 1e2f2ae291cd449573f87bb83fb2bda12e606b3a | [
"Apache-2.0"
] | 16 | 2020-05-09T03:55:38.000Z | 2022-02-27T01:06:09.000Z | cerebro/storage/local.py | Abhishek2304/Cerebro-System-Ray | 1e2f2ae291cd449573f87bb83fb2bda12e606b3a | [
"Apache-2.0"
] | 16 | 2020-04-20T20:47:10.000Z | 2021-12-02T05:11:09.000Z | cerebro/storage/local.py | Abhishek2304/Cerebro-System-Ray | 1e2f2ae291cd449573f87bb83fb2bda12e606b3a | [
"Apache-2.0"
] | 6 | 2020-06-08T01:27:03.000Z | 2021-12-02T12:06:44.000Z | # Copyright 2020 Supun Nakandala, Yuhao Zhang, and Arun Kumar. All Rights Reserved.
# Copyright 2019 Uber Technologies, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License ... | 36.666667 | 120 | 0.676768 |
from __future__ import absolute_import
from __future__ import print_function
import contextlib
import errno
import os
import pyarrow as pa
from .base import FilesystemStore
class LocalStore(FilesystemStore):
FS_PREFIX = 'file://'
def __init__(self, prefix_path, train_path=None, val_path=No... | true | true |
f7245409b3ef11681b481c7e78e544f12653dcc6 | 714 | py | Python | pyhfo/ui/adjust_spines.py | andersonbrisil/pyhfo | 0fdbe834442550117dc9d9c8f611989bb600db62 | [
"MIT"
] | null | null | null | pyhfo/ui/adjust_spines.py | andersonbrisil/pyhfo | 0fdbe834442550117dc9d9c8f611989bb600db62 | [
"MIT"
] | null | null | null | pyhfo/ui/adjust_spines.py | andersonbrisil/pyhfo | 0fdbe834442550117dc9d9c8f611989bb600db62 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Function adjust spines
Created on Fri Apr 17 10:18:30 2015
@author: anderson
"""
def adjust_spines(ax, spines):
for loc, spine in ax.spines.items():
if loc in spines:
spine.set_position(('outward', 2)) # outward by 10 points
spine.set_smart_bounds(False... | 25.5 | 70 | 0.591036 |
def adjust_spines(ax, spines):
for loc, spine in ax.spines.items():
if loc in spines:
spine.set_position(('outward', 2))
spine.set_smart_bounds(False)
else:
spine.set_color('none')
# turn off ticks where there is no spine
if 'left' in spines:
... | true | true |
f7245440fe7dba32ffeb3a85b4b83af243aba25b | 290 | py | Python | ceuclid.py | jprzywoski/faster-python | 44252bf0a746dd862d752efbe2012a8a404ec7bf | [
"MIT"
] | null | null | null | ceuclid.py | jprzywoski/faster-python | 44252bf0a746dd862d752efbe2012a8a404ec7bf | [
"MIT"
] | null | null | null | ceuclid.py | jprzywoski/faster-python | 44252bf0a746dd862d752efbe2012a8a404ec7bf | [
"MIT"
] | null | null | null | import ctypes
from numpy.ctypeslib import ndpointer
lib = ctypes.cdll.LoadLibrary('./libdist.so')
fn = lib.dist
fn.restype = ctypes.c_double
fn.argtypes = [
ndpointer(ctypes.c_double),
ndpointer(ctypes.c_double),
ctypes.c_size_t
]
def dist(x, y):
return fn(x, y, len(x))
| 18.125 | 45 | 0.7 | import ctypes
from numpy.ctypeslib import ndpointer
lib = ctypes.cdll.LoadLibrary('./libdist.so')
fn = lib.dist
fn.restype = ctypes.c_double
fn.argtypes = [
ndpointer(ctypes.c_double),
ndpointer(ctypes.c_double),
ctypes.c_size_t
]
def dist(x, y):
return fn(x, y, len(x))
| true | true |
f724555c65e6b8b852f9d596dad3446f0fbf8099 | 448 | py | Python | chap_7/decay_plot.py | jieyanzhu/codes-effective-computation-in-physics | 0c99f2da9d462229e6b174a010d7c7b08af4482b | [
"MIT"
] | null | null | null | chap_7/decay_plot.py | jieyanzhu/codes-effective-computation-in-physics | 0c99f2da9d462229e6b174a010d7c7b08af4482b | [
"MIT"
] | 1 | 2021-12-23T10:09:01.000Z | 2021-12-23T12:06:25.000Z | chap_7/decay_plot.py | jieyanzhu/codes-effective-computation-in-physics | 0c99f2da9d462229e6b174a010d7c7b08af4482b | [
"MIT"
] | null | null | null | import numpy as np
# as in the previous example, load decays.csv into a NumPy array
decaydata = np.loadtxt('decays.csv', delimiter=',', skiprows=1)
# provide handles for the x and y columns
time = decaydata[:,0]
decays = decaydata[:,1]
# import the matplotlib plotting functionality
import pylab as plt
plt.plot(time... | 22.4 | 64 | 0.734375 | import numpy as np
decaydata = np.loadtxt('decays.csv', delimiter=',', skiprows=1)
time = decaydata[:,0]
decays = decaydata[:,1]
import pylab as plt
plt.plot(time, decays)
plt.xlabel('Time (s)')
plt.ylabel('Decays')
plt.title('Decays')
plt.grid(True)
plt.savefig("decays_matplotlib.png")
| true | true |
f72455bce16e4d2b4c4851dc371a6ac3b783489a | 1,136 | py | Python | oautom/execution/lambda_execution.py | FabienArcellier/oautom | ed818a34ca726355b1227d3485052793e159b177 | [
"MIT"
] | null | null | null | oautom/execution/lambda_execution.py | FabienArcellier/oautom | ed818a34ca726355b1227d3485052793e159b177 | [
"MIT"
] | null | null | null | oautom/execution/lambda_execution.py | FabienArcellier/oautom | ed818a34ca726355b1227d3485052793e159b177 | [
"MIT"
] | null | null | null | # pylint: disable=useless-super-delegation
import json
from concurrent.futures import ThreadPoolExecutor, Future
import boto3
from oautom import get_logger
from oautom.execution.execution import Execution
class LambdaExecution(Execution):
def __init__(self, name: str, flow: 'Flow', lambda_function: str, payloa... | 29.128205 | 90 | 0.681338 |
import json
from concurrent.futures import ThreadPoolExecutor, Future
import boto3
from oautom import get_logger
from oautom.execution.execution import Execution
class LambdaExecution(Execution):
def __init__(self, name: str, flow: 'Flow', lambda_function: str, payload: dict = {}):
super().__init__(na... | true | true |
f72455eb2dee4eaf4803e76cccf48e4cb510f279 | 1,423 | py | Python | cam_lecture/scripts/edge_filter_compressed.py | yasutomo57jp/ros_lecture | 811afaded5a5780fa1291bd41196d80446da1e53 | [
"MIT"
] | 110 | 2018-11-13T15:04:35.000Z | 2022-03-27T20:48:03.000Z | cam_lecture/scripts/edge_filter_compressed.py | yasutomo57jp/ros_lecture | 811afaded5a5780fa1291bd41196d80446da1e53 | [
"MIT"
] | 4 | 2020-07-16T13:32:22.000Z | 2022-01-11T01:08:12.000Z | cam_lecture/scripts/edge_filter_compressed.py | yasutomo57jp/ros_lecture | 811afaded5a5780fa1291bd41196d80446da1e53 | [
"MIT"
] | 57 | 2019-07-02T23:43:17.000Z | 2022-03-27T20:47:28.000Z | #!/usr/bin/env python
import rospy
import sys
import cv2
from sensor_msgs.msg import Image, CompressedImage, CameraInfo
from cv_bridge import CvBridge, CvBridgeError
import numpy as np
class cvBridgeDemo:
def __init__(self):
self.node_name = "cv_bridge_demo_compressed"
rospy.init_node(self.node_nam... | 33.880952 | 108 | 0.650738 |
import rospy
import sys
import cv2
from sensor_msgs.msg import Image, CompressedImage, CameraInfo
from cv_bridge import CvBridge, CvBridgeError
import numpy as np
class cvBridgeDemo:
def __init__(self):
self.node_name = "cv_bridge_demo_compressed"
rospy.init_node(self.node_name)
rospy.on_s... | false | true |
f724577d79ac37b03a6ecb734534f38b37edce0a | 14,449 | py | Python | skimage/measure/tests/test_regionprops.py | jjhelmus/scikit-image | b9b5fde0821fe8bcece2528b30d012c65c64ad6f | [
"BSD-3-Clause"
] | 2 | 2017-03-30T11:22:11.000Z | 2019-03-03T05:18:01.000Z | skimage/measure/tests/test_regionprops.py | jjhelmus/scikit-image | b9b5fde0821fe8bcece2528b30d012c65c64ad6f | [
"BSD-3-Clause"
] | null | null | null | skimage/measure/tests/test_regionprops.py | jjhelmus/scikit-image | b9b5fde0821fe8bcece2528b30d012c65c64ad6f | [
"BSD-3-Clause"
] | 1 | 2019-12-17T14:53:28.000Z | 2019-12-17T14:53:28.000Z | from numpy.testing import assert_array_equal, assert_almost_equal, \
assert_array_almost_equal, assert_raises, assert_equal
import numpy as np
import math
from skimage.measure._regionprops import (regionprops, PROPS, perimeter,
_parse_docs)
SAMPLE = np.array(
[[0, 0,... | 31.479303 | 82 | 0.637207 | from numpy.testing import assert_array_equal, assert_almost_equal, \
assert_array_almost_equal, assert_raises, assert_equal
import numpy as np
import math
from skimage.measure._regionprops import (regionprops, PROPS, perimeter,
_parse_docs)
SAMPLE = np.array(
[[0, 0,... | true | true |
f724579a93aae45369d068c1ff4226dc640ec527 | 1,153 | py | Python | Easy21/plot_cuts.py | vuk119/RL | 2f5309bfff719b2965060492a19d008ed8382856 | [
"MIT"
] | null | null | null | Easy21/plot_cuts.py | vuk119/RL | 2f5309bfff719b2965060492a19d008ed8382856 | [
"MIT"
] | null | null | null | Easy21/plot_cuts.py | vuk119/RL | 2f5309bfff719b2965060492a19d008ed8382856 | [
"MIT"
] | null | null | null | """
Some useful plot functions
"""
import matplotlib.pyplot as plt
import numpy as np
def matrix_surf(m, xlimits=None, ylimits=None, **kwargs):
if xlimits is None:
xlimits = [0, m.shape[0]]
if ylimits is None:
ylimits = [0, m.shape[1]]
Y, X = np.meshgrid(np.arange(ylimits[0], ylimits[1... | 18.901639 | 92 | 0.548135 |
import matplotlib.pyplot as plt
import numpy as np
def matrix_surf(m, xlimits=None, ylimits=None, **kwargs):
if xlimits is None:
xlimits = [0, m.shape[0]]
if ylimits is None:
ylimits = [0, m.shape[1]]
Y, X = np.meshgrid(np.arange(ylimits[0], ylimits[1]), np.arange(xlimits[0], xlimits[1])... | true | true |
f724596b02b40510e329925892cf1f8457e42c59 | 2,489 | py | Python | progs/Eval/docReader.py | feddy/Argumentation-Mining | ed2915552d373bdfebf92d4c1d0a356d37bd1f7d | [
"Apache-2.0"
] | 57 | 2017-04-24T21:53:24.000Z | 2022-03-29T11:12:13.000Z | progs/Eval/docReader.py | feddy/Argumentation-Mining | ed2915552d373bdfebf92d4c1d0a356d37bd1f7d | [
"Apache-2.0"
] | 4 | 2017-08-22T07:13:31.000Z | 2020-09-02T05:47:52.000Z | progs/Eval/docReader.py | feddy/Argumentation-Mining | ed2915552d373bdfebf92d4c1d0a356d37bd1f7d | [
"Apache-2.0"
] | 22 | 2017-10-01T06:58:19.000Z | 2021-11-04T00:59:46.000Z | #! /usr/bin/python
import sys
def readDocs(fn):
docs=[]
doc=[]
for line in open(fn):
line = line.strip()
if line=="":
if doc!=[]: docs.append(doc)
doc=[]
else:
doc.append(line)
if doc!=[]:
docs.append(doc)
return docs
def readDocsFine(fn,field=5):
docs=[]
doc=[[]]
lastLabel = None
for ... | 22.026549 | 72 | 0.505424 |
import sys
def readDocs(fn):
docs=[]
doc=[]
for line in open(fn):
line = line.strip()
if line=="":
if doc!=[]: docs.append(doc)
doc=[]
else:
doc.append(line)
if doc!=[]:
docs.append(doc)
return docs
def readDocsFine(fn,field=5):
docs=[]
doc=[[]]
lastLabel = None
for line in open(fn):
... | false | true |
f7245a27daac0be722083cf7badfe71aa73117d0 | 110 | py | Python | torsionfit/tests/test_import.py | ChayaSt/torsionfit | 0b810b6da4a930b13c3ab8f8b700c6834824173b | [
"MIT"
] | 14 | 2015-10-09T15:46:09.000Z | 2020-11-25T15:30:28.000Z | torsionfit/tests/test_import.py | ChayaSt/torsionfit | 0b810b6da4a930b13c3ab8f8b700c6834824173b | [
"MIT"
] | 25 | 2015-08-28T02:09:08.000Z | 2019-08-06T19:29:41.000Z | torsionfit/tests/test_import.py | ChayaSt/torsionfit | 0b810b6da4a930b13c3ab8f8b700c6834824173b | [
"MIT"
] | 3 | 2015-05-14T19:34:03.000Z | 2015-07-27T21:46:36.000Z | #!/usr/bin/python
def test_import():
"""
Testing import of torsionfit.
"""
import torsionfit
| 13.75 | 33 | 0.609091 |
def test_import():
import torsionfit
| true | true |
f7245a5a8dda4747976414d44dfdefe86c9c2717 | 1,861 | py | Python | pyvoqc/cirq/voqc_optimization.py | akshajgaur/pyvoqc | 6352d64542be5fed72e7cae941d4a2a7db012a4f | [
"MIT"
] | 1 | 2021-11-17T10:50:50.000Z | 2021-11-17T10:50:50.000Z | pyvoqc/cirq/voqc_optimization.py | akshajgaur/pyvoqc | 6352d64542be5fed72e7cae941d4a2a7db012a4f | [
"MIT"
] | 5 | 2021-03-14T20:13:25.000Z | 2021-04-10T01:15:05.000Z | pyvoqc/cirq/voqc_optimization.py | akshajgaur/pyvoqc | 6352d64542be5fed72e7cae941d4a2a7db012a4f | [
"MIT"
] | 2 | 2021-03-13T16:16:34.000Z | 2022-01-27T19:28:15.000Z | from cirq import circuits, ops, protocols
import cirq
from cirq.contrib.qasm_import import circuit_from_qasm, qasm
import re
import os
from cirq import decompose
from cirq.circuits import Circuit
from pyvoqc.formatting.format_from_qasm import format_from_qasm
from pyvoqc.formatting.rzq_to_rz import rzq_to_rz
from pyvoq... | 36.490196 | 152 | 0.661472 | from cirq import circuits, ops, protocols
import cirq
from cirq.contrib.qasm_import import circuit_from_qasm, qasm
import re
import os
from cirq import decompose
from cirq.circuits import Circuit
from pyvoqc.formatting.format_from_qasm import format_from_qasm
from pyvoqc.formatting.rzq_to_rz import rzq_to_rz
from pyvoq... | true | true |
f7245abaa8a5cb38551388a2aee2cf80e1403e41 | 12,195 | py | Python | Scripts/plot_ProfileVar_Monthly_FDR.py | zmlabe/StratoVari | c5549f54482a2b05e89bded3e3b0b3c9faa686f3 | [
"MIT"
] | 4 | 2019-11-23T19:44:21.000Z | 2020-02-20T16:54:45.000Z | Scripts/plot_ProfileVar_Monthly_FDR.py | zmlabe/StratoVari | c5549f54482a2b05e89bded3e3b0b3c9faa686f3 | [
"MIT"
] | null | null | null | Scripts/plot_ProfileVar_Monthly_FDR.py | zmlabe/StratoVari | c5549f54482a2b05e89bded3e3b0b3c9faa686f3 | [
"MIT"
] | 2 | 2019-06-21T19:27:55.000Z | 2021-02-12T19:13:22.000Z | """
Plot vertical plots of PAMIP data for each month from November to April using
the ensemble mean (300)
Notes
-----
Author : Zachary Labe
Date : 26 June 2019
"""
### Import modules
import numpy as np
import matplotlib.pyplot as plt
import datetime
import read_MonthlyData as MO
import statsmodels.stats.mul... | 36.8429 | 83 | 0.526117 |
tlib.pyplot as plt
import datetime
import read_MonthlyData as MO
import statsmodels.stats.multitest as fdr
import cmocean
import itertools
ectoryfigure = '/home/zlabe/Desktop/STRATOVARI/'
w.month)
currentdy = str(now.day)
currentyr = str(now.year)
currenttime = currentmn + '_' + currentdy + '_' + currentyr
titletim... | true | true |
f7245c8c7d5a9be02f2a22ebc20f3d4370dc8234 | 1,216 | py | Python | package.py | rittikaadhikari/stock-recommendation | 1f14276a955301b1c6fa1c00bd88b00cf5668d8c | [
"MIT"
] | null | null | null | package.py | rittikaadhikari/stock-recommendation | 1f14276a955301b1c6fa1c00bd88b00cf5668d8c | [
"MIT"
] | null | null | null | package.py | rittikaadhikari/stock-recommendation | 1f14276a955301b1c6fa1c00bd88b00cf5668d8c | [
"MIT"
] | null | null | null | # Inspired by npm's package.json file
name = 'hisa'
version = '0.1.0'
release = '0.1.0'
description = 'A stock market predictor and model builder'
long_description = ['README.md']
keywords = ['neural', 'network', 'machine', 'deep',
'learning', 'tensorflow', 'stock', ... | 34.742857 | 74 | 0.591283 |
name = 'hisa'
version = '0.1.0'
release = '0.1.0'
description = 'A stock market predictor and model builder'
long_description = ['README.md']
keywords = ['neural', 'network', 'machine', 'deep',
'learning', 'tensorflow', 'stock', 'market', 'prediction']
authors ... | true | true |
f7245d00c96a3042401b96defdbc1bd8590b3469 | 425 | py | Python | raspberrypi/blinkgpio24.py | jbrucepayne/pitoys | 49a60dd62f57e1bf5f463fa11dbf3a070ef152f1 | [
"MIT"
] | null | null | null | raspberrypi/blinkgpio24.py | jbrucepayne/pitoys | 49a60dd62f57e1bf5f463fa11dbf3a070ef152f1 | [
"MIT"
] | null | null | null | raspberrypi/blinkgpio24.py | jbrucepayne/pitoys | 49a60dd62f57e1bf5f463fa11dbf3a070ef152f1 | [
"MIT"
] | null | null | null | #!/usr/bin/python
import RPi.GPIO as GPIO
import datetime
import time
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(24, GPIO.OUT)
print "Starting to blink GPIO 24" + datetime.datetime.now().isoformat()
while True:
print "GPIO On : " + datetime.datetime.now().isoformat()
GPIO.output(24, True)
time.slee... | 26.5625 | 71 | 0.72 |
import RPi.GPIO as GPIO
import datetime
import time
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(24, GPIO.OUT)
print "Starting to blink GPIO 24" + datetime.datetime.now().isoformat()
while True:
print "GPIO On : " + datetime.datetime.now().isoformat()
GPIO.output(24, True)
time.sleep(2)
print "GPI... | false | true |
f7245ff14c37b2aedccbcae8d5af768476c65b57 | 587 | py | Python | setup.py | dimitri-yatsenko/adamacs | c83ce744d207fb5fa3e7069a15cff4a52b9dcf52 | [
"MIT"
] | null | null | null | setup.py | dimitri-yatsenko/adamacs | c83ce744d207fb5fa3e7069a15cff4a52b9dcf52 | [
"MIT"
] | null | null | null | setup.py | dimitri-yatsenko/adamacs | c83ce744d207fb5fa3e7069a15cff4a52b9dcf52 | [
"MIT"
] | null | null | null | from setuptools import setup
with open('README.md') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
setup(
name='adamacs',
version='0.0.1',
description='Architectures for Data Management and Computational Support.',
long_description=readme,
author='Daniel Müller-Kom... | 22.576923 | 79 | 0.623509 | from setuptools import setup
with open('README.md') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
setup(
name='adamacs',
version='0.0.1',
description='Architectures for Data Management and Computational Support.',
long_description=readme,
author='Daniel Müller-Kom... | true | true |
f7246097ee00e1071047af06705d6ed6469d67cb | 7,066 | py | Python | tensorflow/contrib/keras/python/keras/models_test.py | DEVESHTARASIA/tensorflow | d3edb8c60ed4fd831d62833ed22f5c23486c561c | [
"Apache-2.0"
] | 384 | 2017-02-21T18:38:04.000Z | 2022-02-22T07:30:25.000Z | tensorflow/contrib/keras/python/keras/models_test.py | DEVESHTARASIA/tensorflow | d3edb8c60ed4fd831d62833ed22f5c23486c561c | [
"Apache-2.0"
] | 15 | 2017-03-01T20:18:43.000Z | 2020-05-07T10:33:51.000Z | tensorflow/contrib/keras/python/keras/models_test.py | DEVESHTARASIA/tensorflow | d3edb8c60ed4fd831d62833ed22f5c23486c561c | [
"Apache-2.0"
] | 81 | 2017-02-21T19:31:19.000Z | 2022-02-22T07:30:24.000Z | # Copyright 2016 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... | 32.865116 | 80 | 0.649731 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import tempfile
import numpy as np
from tensorflow.contrib.keras.python import keras
from tensorflow.python.platform import test
try:
import h5py
except ImportError:
h5py = Non... | true | true |
f72460e93b5cc9a2ba178d43a0407e7595709d8c | 399 | py | Python | run.py | palazzem/gello | 19fe9e4aa8de485dd829a87047ec64f89b5fa7ee | [
"Apache-2.0"
] | 44 | 2018-03-28T14:22:23.000Z | 2022-03-15T07:25:06.000Z | run.py | palazzem/gello | 19fe9e4aa8de485dd829a87047ec64f89b5fa7ee | [
"Apache-2.0"
] | 44 | 2018-03-28T14:19:03.000Z | 2022-02-16T10:24:57.000Z | run.py | palazzem/gello | 19fe9e4aa8de485dd829a87047ec64f89b5fa7ee | [
"Apache-2.0"
] | 12 | 2018-03-28T14:15:43.000Z | 2021-07-19T17:33:20.000Z | # -*- coding: utf-8 -*-
#
# Unless explicitly stated otherwise all files in this repository are licensed
# under the Apache 2 License.
#
# This product includes software developed at Datadog
# (https://www.datadoghq.com/).
#
# Copyright 2018 Datadog, Inc.
#
"""run.py
Run the application locally by runnnig:
`pyt... | 16.625 | 78 | 0.689223 |
from app import app
if __name__ == '__main__':
app.run()
| true | true |
f7246108e996bd99236ce11f115ac45903250e54 | 399 | py | Python | code/poc/emergency.py | a10pepo/parrot_ar_drone | af3c15379772a7e86082957776ed8c39193170ec | [
"MIT"
] | null | null | null | code/poc/emergency.py | a10pepo/parrot_ar_drone | af3c15379772a7e86082957776ed8c39193170ec | [
"MIT"
] | 3 | 2021-06-08T20:51:39.000Z | 2022-03-12T00:13:08.000Z | code/poc/emergency.py | a10pepo/parrot_ar_drone | af3c15379772a7e86082957776ed8c39193170ec | [
"MIT"
] | 1 | 2020-02-03T16:24:38.000Z | 2020-02-03T16:24:38.000Z | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 18 18:19:15 2019
@author: pepo
"""
import libardrone
import pygame
from time import sleep
import time
import cv2
drone = libardrone.ARDrone()
def operation(sleep):
t1 = time.time()
t2=t1
while t2-t1<sleep:
drone.turn_left()
t2=time.time()
... | 12.090909 | 35 | 0.606516 |
import libardrone
import pygame
from time import sleep
import time
import cv2
drone = libardrone.ARDrone()
def operation(sleep):
t1 = time.time()
t2=t1
while t2-t1<sleep:
drone.turn_left()
t2=time.time()
def main():
drone.land()
if __name__ == '__main__':
main() | true | true |
f724637d889f2486a08417116366b6d3968dc1b4 | 503 | py | Python | ports/gprs_a9/examples/example_31_ssl.py | sebi5361/micropython | 6c054cd124bc6229bee127128264dc0829dea53c | [
"MIT"
] | 79 | 2019-02-07T09:04:50.000Z | 2022-02-20T06:54:44.000Z | ports/gprs_a9/examples/example_31_ssl.py | sebi5361/micropython | 6c054cd124bc6229bee127128264dc0829dea53c | [
"MIT"
] | 100 | 2019-05-16T09:25:23.000Z | 2021-09-20T07:46:54.000Z | ports/gprs_a9/examples/example_31_ssl.py | sebi5361/micropython | 6c054cd124bc6229bee127128264dc0829dea53c | [
"MIT"
] | 25 | 2019-03-20T08:16:57.000Z | 2022-03-11T17:59:36.000Z | # Micropython a9g example
# Source: https://github.com/pulkin/micropython
# Author: pulkin
# Demonstrates how to wrap sockets into ssl tunnel
import cellular
import socket
import ssl
cellular.gprs("internet", "", "")
print("IP", socket.get_local_ip())
host = "httpstat.us"
port = 443
s = socket.socket()
s.connect((host,... | 23.952381 | 70 | 0.719682 |
import cellular
import socket
import ssl
cellular.gprs("internet", "", "")
print("IP", socket.get_local_ip())
host = "httpstat.us"
port = 443
s = socket.socket()
s.connect((host, port))
s = ssl.wrap_socket(s)
message = "GET /200 HTTP/1.1\r\nHost: {}\r\nConnection: close\r\n\r\n"
s.write(message.format(host))
print(... | true | true |
f7246452a8b54521f9de02de28a010c82e5a7bdd | 675 | py | Python | script/dbus_mock.py | lingxiao-Zhu/electron | 2d85b1f8f527d55f884904dbfdde50ee66a49830 | [
"MIT"
] | 88,283 | 2016-04-04T19:29:13.000Z | 2022-03-31T23:33:33.000Z | script/dbus_mock.py | lingxiao-Zhu/electron | 2d85b1f8f527d55f884904dbfdde50ee66a49830 | [
"MIT"
] | 27,327 | 2016-04-04T19:38:58.000Z | 2022-03-31T22:34:10.000Z | script/dbus_mock.py | lingxiao-Zhu/electron | 2d85b1f8f527d55f884904dbfdde50ee66a49830 | [
"MIT"
] | 15,972 | 2016-04-04T19:32:06.000Z | 2022-03-31T08:54:00.000Z | #!/usr/bin/env python
import os
import subprocess
import sys
from dbusmock import DBusTestCase
from lib.config import is_verbose_mode
def stop():
DBusTestCase.stop_dbus(DBusTestCase.system_bus_pid)
DBusTestCase.stop_dbus(DBusTestCase.session_bus_pid)
def start():
log = sys.stdout if is_verbose_mode() e... | 22.5 | 72 | 0.734815 |
import os
import subprocess
import sys
from dbusmock import DBusTestCase
from lib.config import is_verbose_mode
def stop():
DBusTestCase.stop_dbus(DBusTestCase.system_bus_pid)
DBusTestCase.stop_dbus(DBusTestCase.session_bus_pid)
def start():
log = sys.stdout if is_verbose_mode() else open(os.devnull, ... | true | true |
f7246744af0401037d527244f3f9bd85914a3e69 | 3,357 | py | Python | train_scripts/lognet.py | franciscovargas/TeviotDataScienceGame | 77bdffb87b2a25490ca175b3a2f96459067e4ccb | [
"MIT"
] | null | null | null | train_scripts/lognet.py | franciscovargas/TeviotDataScienceGame | 77bdffb87b2a25490ca175b3a2f96459067e4ccb | [
"MIT"
] | null | null | null | train_scripts/lognet.py | franciscovargas/TeviotDataScienceGame | 77bdffb87b2a25490ca175b3a2f96459067e4ccb | [
"MIT"
] | null | null | null | from keras.layers.convolutional import Convolution2D
from keras.layers.convolutional import MaxPooling2D
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.optimizers import SGD, Adam
import numpy as np
import theano as th
from keras.utils.np_utils import to_... | 24.683824 | 97 | 0.634793 | from keras.layers.convolutional import Convolution2D
from keras.layers.convolutional import MaxPooling2D
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.optimizers import SGD, Adam
import numpy as np
import theano as th
from keras.utils.np_utils import to_... | false | true |
f724678f5e7ade231a5e84c6bdf82ae0868ec843 | 40,659 | py | Python | applications/admin/languages/he.py | misl6/web2py | 4191d4c48c37c66cc7eb293b610a6b6e86870571 | [
"BSD-3-Clause"
] | 1 | 2019-09-05T03:54:51.000Z | 2019-09-05T03:54:51.000Z | applications/admin/languages/he.py | misl6/web2py | 4191d4c48c37c66cc7eb293b610a6b6e86870571 | [
"BSD-3-Clause"
] | null | null | null | applications/admin/languages/he.py | misl6/web2py | 4191d4c48c37c66cc7eb293b610a6b6e86870571 | [
"BSD-3-Clause"
] | 1 | 2019-09-05T03:54:52.000Z | 2019-09-05T03:54:52.000Z | # -*- coding: utf-8 -*-
{
'!langcode!': 'he-il',
'!langname!': 'עברית',
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"עדכן" הוא ביטוי אופציונאלי, כגון "field1=newvalue". אינך יוכל להשתמש בjoin, בעת שימוש ב"עדכן" או "מחק".',
'"User Exception" debug ... | 56.004132 | 823 | 0.710618 |
{
'!langcode!': 'he-il',
'!langname!': 'עברית',
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"עדכן" הוא ביטוי אופציונאלי, כגון "field1=newvalue". אינך יוכל להשתמש בjoin, בעת שימוש ב"עדכן" או "מחק".',
'"User Exception" debug mode. ': '"User Excepti... | true | true |
f72467ab96456a59cb16d087533c917c2a6562da | 3,363 | py | Python | google/ads/google_ads/v1/proto/services/asset_service_pb2_grpc.py | jiulongw/google-ads-python | 6f5256eb1eeb5a9a95c8cdb9b97988d3a676282e | [
"Apache-2.0"
] | 1 | 2019-11-30T23:42:39.000Z | 2019-11-30T23:42:39.000Z | google/ads/google_ads/v1/proto/services/asset_service_pb2_grpc.py | jiulongw/google-ads-python | 6f5256eb1eeb5a9a95c8cdb9b97988d3a676282e | [
"Apache-2.0"
] | null | null | null | google/ads/google_ads/v1/proto/services/asset_service_pb2_grpc.py | jiulongw/google-ads-python | 6f5256eb1eeb5a9a95c8cdb9b97988d3a676282e | [
"Apache-2.0"
] | 1 | 2020-09-30T17:04:06.000Z | 2020-09-30T17:04:06.000Z | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.ads.google_ads.v1.proto.resources import asset_pb2 as google_dot_ads_dot_googleads__v1_dot_proto_dot_resources_dot_asset__pb2
from google.ads.google_ads.v1.proto.services import asset_service_pb2 as google_dot_ads_dot_googlea... | 46.068493 | 152 | 0.803152 |
import grpc
from google.ads.google_ads.v1.proto.resources import asset_pb2 as google_dot_ads_dot_googleads__v1_dot_proto_dot_resources_dot_asset__pb2
from google.ads.google_ads.v1.proto.services import asset_service_pb2 as google_dot_ads_dot_googleads__v1_dot_proto_dot_services_dot_asset__service__pb2
class AssetSe... | true | true |
f72468636003b664ce87050e414e28fea873cd2a | 6,582 | py | Python | uhd_restpy/testplatform/sessions/ixnetwork/impairment/link/link.py | OpenIxia/ixnetwork_restpy | f628db450573a104f327cf3c737ca25586e067ae | [
"MIT"
] | 20 | 2019-05-07T01:59:14.000Z | 2022-02-11T05:24:47.000Z | uhd_restpy/testplatform/sessions/ixnetwork/impairment/link/link.py | OpenIxia/ixnetwork_restpy | f628db450573a104f327cf3c737ca25586e067ae | [
"MIT"
] | 60 | 2019-04-03T18:59:35.000Z | 2022-02-22T12:05:05.000Z | uhd_restpy/testplatform/sessions/ixnetwork/impairment/link/link.py | OpenIxia/ixnetwork_restpy | f628db450573a104f327cf3c737ca25586e067ae | [
"MIT"
] | 13 | 2019-05-20T10:48:31.000Z | 2021-10-06T07:45:44.000Z | # MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# 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,... | 36.164835 | 158 | 0.647068 |
from uhd_restpy.base import Base
from uhd_restpy.files import Files
from typing import List, Any, Union
class Link(Base):
__slots__ = ()
_SDM_NAME = 'link'
_SDM_ATT_MAP = {
'ForwardingInterruption': 'forwardingInterruption',
'Name': 'name',
'RxPortName': 'rxPo... | true | true |
f724688f8543cbeb74c6f94451f45052c8b2c1af | 11,189 | py | Python | plugins/modules/oracle_profile.py | blaf-cgi/ansible-oracle-modules | 37905c6ad91808a96f0085c9c1069e166f2e17b4 | [
"MIT"
] | 8 | 2020-08-11T04:21:24.000Z | 2021-12-03T16:21:56.000Z | plugins/modules/oracle_profile.py | blaf-cgi/ansible-oracle-modules | 37905c6ad91808a96f0085c9c1069e166f2e17b4 | [
"MIT"
] | 4 | 2021-03-13T09:09:28.000Z | 2022-01-07T12:38:02.000Z | plugins/modules/oracle_profile.py | blaf-cgi/ansible-oracle-modules | 37905c6ad91808a96f0085c9c1069e166f2e17b4 | [
"MIT"
] | 3 | 2021-03-16T13:48:57.000Z | 2022-03-02T10:43:47.000Z | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
module: oracle_profile
short_description: Manage profiles in an Oracle database
description:
- Manage profiles in an Oracle database
version_added: "0.8.0"
optio... | 32.620991 | 168 | 0.602377 |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
module: oracle_profile
short_description: Manage profiles in an Oracle database
description:
- Manage profiles in an Oracle database
version_added: "0.8.0"
options:
name:
description:
... | true | true |
f72468caade31cb02d08f32af7db7f38ca7ca5c2 | 1,858 | py | Python | azure_iot_hub/azure/templates/led_matrix_esp32_iot_hub/__init__.py | codycodes/gix-mkrfridays-iot | 8e41040114e58b55a07ecdef7c0f4a669a0b27dc | [
"MIT"
] | 2 | 2020-05-17T05:04:22.000Z | 2020-05-19T17:14:59.000Z | azure_iot_hub/azure/templates/led_matrix_esp32_iot_hub/__init__.py | codycodes/gix-mkrfridays-iot | 8e41040114e58b55a07ecdef7c0f4a669a0b27dc | [
"MIT"
] | 18 | 2020-05-13T22:51:50.000Z | 2020-10-07T04:44:16.000Z | azure_iot_hub/azure/templates/led_matrix_esp32_iot_hub/__init__.py | codycodes/gix-mkrfridays-iot | 8e41040114e58b55a07ecdef7c0f4a669a0b27dc | [
"MIT"
] | 2 | 2020-04-24T21:25:42.000Z | 2020-05-16T19:00:50.000Z | import logging
import azure.functions as func
from azure.iot.hub import IoTHubRegistryManager
# Note that Azure Key Vault doesn't support underscores
# and some other special chars;
# we substitute with a hyphen for underscore
CONNECTION_STRING = "{c2d connection string}"
DEVICE_ID = "{device to invoke}"
ME... | 32.034483 | 70 | 0.599569 | import logging
import azure.functions as func
from azure.iot.hub import IoTHubRegistryManager
# and some other special chars;
# we substitute with a hyphen for underscore
CONNECTION_STRING = "{c2d connection string}"
DEVICE_ID = "{device to invoke}"
MESSAGE_COUNT = 1
def iothub_messaging_sample_run(msg... | true | true |
f72469575b1cfc70bf9f89f7c27364ebc94398cb | 4,622 | py | Python | images/orbit-controller/src/orbit_controller/webhooks/imagereplication_pod_webhook.py | srinivasreddych/aws-orbit-workbench | 2d154addff58d26f5459a73c06148aaf5e9fad46 | [
"Apache-2.0"
] | 94 | 2021-03-19T19:55:11.000Z | 2022-03-31T19:50:01.000Z | images/orbit-controller/src/orbit_controller/webhooks/imagereplication_pod_webhook.py | srinivasreddych/aws-orbit-workbench | 2d154addff58d26f5459a73c06148aaf5e9fad46 | [
"Apache-2.0"
] | 410 | 2021-03-19T18:04:48.000Z | 2022-03-22T13:56:53.000Z | images/orbit-controller/src/orbit_controller/webhooks/imagereplication_pod_webhook.py | srinivasreddych/aws-orbit-workbench | 2d154addff58d26f5459a73c06148aaf5e9fad46 | [
"Apache-2.0"
] | 24 | 2021-03-19T23:16:23.000Z | 2022-03-04T01:05:18.000Z | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | 35.553846 | 119 | 0.650151 |
import logging
import os
from copy import deepcopy
from typing import Any, Dict, List, Optional
import kopf
from orbit_controller import ORBIT_API_GROUP, ORBIT_API_VERSION, dynamic_client
from orbit_controller.utils import imagereplication_utils
CONFIG: Dict[str, Any]
@kopf.on.startup()
def configure(... | true | true |
f724699755ba91bea524160dc912b306d1e17208 | 40 | py | Python | boa3_test/example/tuple_test/BoolTuple.py | jplippi/neo3-boa | 052be4adebb665113715bb80067d954f7ad85ad5 | [
"Apache-2.0"
] | 25 | 2020-07-22T19:37:43.000Z | 2022-03-08T03:23:55.000Z | boa3_test/example/tuple_test/BoolTuple.py | jplippi/neo3-boa | 052be4adebb665113715bb80067d954f7ad85ad5 | [
"Apache-2.0"
] | 419 | 2020-04-23T17:48:14.000Z | 2022-03-31T13:17:45.000Z | boa3_test/example/tuple_test/BoolTuple.py | jplippi/neo3-boa | 052be4adebb665113715bb80067d954f7ad85ad5 | [
"Apache-2.0"
] | 15 | 2020-05-21T21:54:24.000Z | 2021-11-18T06:17:24.000Z | def Main():
a = (True, True, False)
| 13.333333 | 27 | 0.525 | def Main():
a = (True, True, False)
| true | true |
f72469d5195720193ad83e59ae342ad8847b12fa | 11,453 | py | Python | planner_svg_gen.py | jc0a20/myplannergen | b1a19733fb393bae6159f12cfb1d239bb81d0c25 | [
"MIT"
] | null | null | null | planner_svg_gen.py | jc0a20/myplannergen | b1a19733fb393bae6159f12cfb1d239bb81d0c25 | [
"MIT"
] | 2 | 2020-05-01T13:54:12.000Z | 2020-05-01T13:55:24.000Z | planner_svg_gen.py | jc0a20/myplannergen | b1a19733fb393bae6159f12cfb1d239bb81d0c25 | [
"MIT"
] | null | null | null | import configparser
import os
import re
import subprocess
import sys
import PyPDF2
config = configparser.ConfigParser()
config.read('config.ini', encoding='utf-8')
INKSCAPE_PATH = config['DEFAULT']['InkscapePath']
def replace_text(target_doc, target_str, replace_str, id_str):
pattern = '''id="''' + id_str + '''"... | 38.56229 | 115 | 0.628045 | import configparser
import os
import re
import subprocess
import sys
import PyPDF2
config = configparser.ConfigParser()
config.read('config.ini', encoding='utf-8')
INKSCAPE_PATH = config['DEFAULT']['InkscapePath']
def replace_text(target_doc, target_str, replace_str, id_str):
pattern = '''id="''' + id_str + '''"... | true | true |
f7246ae56a8cd487abd73fdf982a117465640f8f | 6,658 | py | Python | pciids/pciids.py | ilkermanap/python-pciids | 9a2fcb00d3e0100b9de331047133a42e98242deb | [
"MIT"
] | 5 | 2018-02-12T13:45:45.000Z | 2020-06-04T09:24:52.000Z | pciids/pciids.py | ilkermanap/python-pciids | 9a2fcb00d3e0100b9de331047133a42e98242deb | [
"MIT"
] | 2 | 2016-03-17T09:22:01.000Z | 2020-01-12T23:04:35.000Z | pciids/pciids.py | ilkermanap/python-pciids | 9a2fcb00d3e0100b9de331047133a42e98242deb | [
"MIT"
] | 4 | 2018-09-04T12:57:58.000Z | 2021-07-02T01:01:26.000Z | import os
import bz2
import requests
import glob
global HOME
HOME = "https://pci-ids.ucw.cz"
class Vendor:
"""
Class for vendors. This is the top level class
for the devices belong to a specific vendor.
self.devices is the device dictionary
subdevices are in each device.
"""
def __init__(s... | 30.541284 | 92 | 0.49249 | import os
import bz2
import requests
import glob
global HOME
HOME = "https://pci-ids.ucw.cz"
class Vendor:
def __init__(self, vendorStr):
self.ID = vendorStr.split()[0]
self.name = vendorStr.replace("%s " % self.ID,"")
self.devices = {}
def addDevice(self, deviceStr):
s = devi... | true | true |
f7246b1f729e630e5873f854feff0a703ae952c5 | 3,564 | py | Python | test/functional/feature_notifications.py | cisnes/PINECOIN | a0252cace17ecc1208a07368c0b893d3878459d8 | [
"MIT"
] | null | null | null | test/functional/feature_notifications.py | cisnes/PINECOIN | a0252cace17ecc1208a07368c0b893d3878459d8 | [
"MIT"
] | null | null | null | test/functional/feature_notifications.py | cisnes/PINECOIN | a0252cace17ecc1208a07368c0b893d3878459d8 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) 2014-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the -alertnotify, -blocknotify and -walletnotify options."""
import os
from test_framework.addres... | 48.821918 | 152 | 0.670034 |
import os
from test_framework.address import ADDRESS_BCRT1_UNSPENDABLE
from test_framework.test_framework import PineCoinTestFramework
from test_framework.util import assert_equal, wait_until, connect_nodes_bi
class NotificationsTest(PineCoinTestFramework):
def set_test_params(self):
self.num_nodes =... | true | true |
f7246b36becdc63ea725194e371727a55e6be4c1 | 3,932 | py | Python | test/functional/test_framework/blocktools.py | tmiholdings/tmi | f1b6027f025dafc40616cde076df2f4b8cdae8a2 | [
"MIT"
] | null | null | null | test/functional/test_framework/blocktools.py | tmiholdings/tmi | f1b6027f025dafc40616cde076df2f4b8cdae8a2 | [
"MIT"
] | null | null | null | test/functional/test_framework/blocktools.py | tmiholdings/tmi | f1b6027f025dafc40616cde076df2f4b8cdae8a2 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) 2015-2016 The TMIcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Utilities for manipulating blocks and transactions."""
from .mininode import *
from .script import CSc... | 35.423423 | 104 | 0.709054 |
from .mininode import *
from .script import CScript, OP_TRUE, OP_CHECKSIG, OP_RETURN
def create_block(hashprev, coinbase, nTime=None):
block = CBlock()
if nTime is None:
import time
block.nTime = int(time.time()+600)
else:
block.nTime = nTime
block.hashPrevBlock = hashprev... | true | true |
f7246bf98a05892332d4bb0c595fed3c4643f2dc | 2,401 | py | Python | src/pudl/__init__.py | erictleung/pudl | 32bfbf3a959114f766b630f5b873a93b7a930c71 | [
"MIT"
] | null | null | null | src/pudl/__init__.py | erictleung/pudl | 32bfbf3a959114f766b630f5b873a93b7a930c71 | [
"MIT"
] | null | null | null | src/pudl/__init__.py | erictleung/pudl | 32bfbf3a959114f766b630f5b873a93b7a930c71 | [
"MIT"
] | null | null | null | """The Public Utility Data Liberation (PUDL) Project."""
# Create a parent logger for all PUDL loggers to inherit from
import logging
import pkg_resources
import pudl.analysis.mcoe
import pudl.cli
import pudl.constants
import pudl.convert.datapkg_to_sqlite
import pudl.convert.epacems_to_parquet
import pudl.convert.f... | 35.835821 | 76 | 0.82299 |
import logging
import pkg_resources
import pudl.analysis.mcoe
import pudl.cli
import pudl.constants
import pudl.convert.datapkg_to_sqlite
import pudl.convert.epacems_to_parquet
import pudl.convert.ferc1_to_sqlite
import pudl.convert.flatten_datapkgs
import pudl.etl
import pudl.extract.eia860
import pudl.extract.eia... | true | true |
f7246c03ec5401f98478d3072cffa65821a40e6d | 5,510 | py | Python | test/functional/p2p_disconnect_ban.py | Simple-Software-Solutions/RBX-Core | 8cf0dfda708233e080e8729cec0b5014218386e3 | [
"MIT"
] | null | null | null | test/functional/p2p_disconnect_ban.py | Simple-Software-Solutions/RBX-Core | 8cf0dfda708233e080e8729cec0b5014218386e3 | [
"MIT"
] | null | null | null | test/functional/p2p_disconnect_ban.py | Simple-Software-Solutions/RBX-Core | 8cf0dfda708233e080e8729cec0b5014218386e3 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test node disconnect and ban behavior"""
import time
from test_framework.test_framework import RbxTest... | 48.333333 | 156 | 0.659891 |
import time
from test_framework.test_framework import RbxTestFramework
from test_framework.util import (
assert_equal,
connect_nodes,
assert_raises_rpc_error,
wait_until,
)
class DisconnectBanTest(RbxTestFramework):
def set_test_params(self):
self.num_nodes = 2
def run_test(self):... | true | true |
f7246cc917719e28deb7b06b6817fd9d7b3f055b | 1,758 | py | Python | core/src/zeit/edit/browser/resources.py | rickdg/vivi | 16134ac954bf8425646d4ad47bdd1f372e089355 | [
"BSD-3-Clause"
] | 5 | 2019-05-16T09:51:29.000Z | 2021-05-31T09:30:03.000Z | core/src/zeit/edit/browser/resources.py | rickdg/vivi | 16134ac954bf8425646d4ad47bdd1f372e089355 | [
"BSD-3-Clause"
] | 107 | 2019-05-24T12:19:02.000Z | 2022-03-23T15:05:56.000Z | core/src/zeit/edit/browser/resources.py | rickdg/vivi | 16134ac954bf8425646d4ad47bdd1f372e089355 | [
"BSD-3-Clause"
] | 3 | 2020-08-14T11:01:17.000Z | 2022-01-08T17:32:19.000Z | from zeit.cms.browser.resources import SplitDirResource, Library
import zeit.cms.browser.resources
import zeit.find.browser.resources
lib_css = Library('zeit.edit', 'resources')
lib_js = Library('zeit.edit.js', 'js')
SplitDirResource('editor.css')
SplitDirResource('fold.js', depends=[zeit.cms.browser.resources.base... | 27.046154 | 70 | 0.713879 | from zeit.cms.browser.resources import SplitDirResource, Library
import zeit.cms.browser.resources
import zeit.find.browser.resources
lib_css = Library('zeit.edit', 'resources')
lib_js = Library('zeit.edit.js', 'js')
SplitDirResource('editor.css')
SplitDirResource('fold.js', depends=[zeit.cms.browser.resources.base... | true | true |
f7246cd07aed951d4878742924bcbfb2fe5565c2 | 329 | py | Python | factioncli/commands/credentials.py | joncave/CLI | e12113594574bd4ca112895c6df59d1ae1c2094f | [
"BSD-3-Clause"
] | null | null | null | factioncli/commands/credentials.py | joncave/CLI | e12113594574bd4ca112895c6df59d1ae1c2094f | [
"BSD-3-Clause"
] | null | null | null | factioncli/commands/credentials.py | joncave/CLI | e12113594574bd4ca112895c6df59d1ae1c2094f | [
"BSD-3-Clause"
] | null | null | null | from cliff.lister import Lister
from factioncli.processing.config import get_passwords
class Credentials(Lister):
"Returns a list of the default credentials for this instance of Faction"
def take_action(self, parsed_args):
passwords = get_passwords()
return ("Type", "Username", "Password"), p... | 29.909091 | 76 | 0.738602 | from cliff.lister import Lister
from factioncli.processing.config import get_passwords
class Credentials(Lister):
def take_action(self, parsed_args):
passwords = get_passwords()
return ("Type", "Username", "Password"), passwords
| true | true |
f7246fb1d3475e6a8f8ea2b2fd45ec7d3e10c62f | 16,568 | py | Python | venv/Lib/site-packages/scipy/sparse/linalg/tests/test_interface.py | EkremBayar/bayar | aad1a32044da671d0b4f11908416044753360b39 | [
"MIT"
] | 353 | 2020-12-10T10:47:17.000Z | 2022-03-31T23:08:29.000Z | venv/Lib/site-packages/scipy/sparse/linalg/tests/test_interface.py | EkremBayar/bayar | aad1a32044da671d0b4f11908416044753360b39 | [
"MIT"
] | 80 | 2020-12-10T09:54:22.000Z | 2022-03-30T22:08:45.000Z | venv/Lib/site-packages/scipy/sparse/linalg/tests/test_interface.py | EkremBayar/bayar | aad1a32044da671d0b4f11908416044753360b39 | [
"MIT"
] | 63 | 2020-12-10T17:10:34.000Z | 2022-03-28T16:27:07.000Z | """Test functions for the sparse.linalg.interface module
"""
from functools import partial
from itertools import product
import operator
import pytest
from pytest import raises as assert_raises, warns
from numpy.testing import assert_, assert_equal
import numpy as np
import scipy.sparse as sparse
from scipy.sparse.l... | 36.736142 | 78 | 0.506639 |
from functools import partial
from itertools import product
import operator
import pytest
from pytest import raises as assert_raises, warns
from numpy.testing import assert_, assert_equal
import numpy as np
import scipy.sparse as sparse
from scipy.sparse.linalg import interface
from scipy.sparse.sputils import matri... | true | true |
f7246fd41a52c4c852543dc3cdc9672346ec9dbe | 6,333 | py | Python | doc/source/conf.py | gaohao95/cffi | 8d1a4ec54db0f3f0e18e4a68c2bdc7f32d0fdd8b | [
"MIT"
] | 1 | 2017-01-05T00:59:03.000Z | 2017-01-05T00:59:03.000Z | doc/source/conf.py | gaohao95/cffi | 8d1a4ec54db0f3f0e18e4a68c2bdc7f32d0fdd8b | [
"MIT"
] | null | null | null | doc/source/conf.py | gaohao95/cffi | 8d1a4ec54db0f3f0e18e4a68c2bdc7f32d0fdd8b | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
#
# CFFI documentation build configuration file, created by
# sphinx-quickstart on Thu Jun 14 16:37:47 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All co... | 32.476923 | 80 | 0.722722 |
import sys, os
extensions = ['sphinx.ext.autodoc']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'CFFI'
copyright = u'2012-2015, Armin Rigo, Maciej Fijalkowski'
# |version| and |release|, also used in various other places throughout the
# buil... | true | true |
f72470edb12a542373c15f2c30a033702b46467a | 1,325 | py | Python | tests/test_erd.py | Datateer/erd-python | 528b876bf5adf6114cd1e0aac6a2be14006fd2eb | [
"MIT"
] | 1 | 2021-09-13T06:05:48.000Z | 2021-09-13T06:05:48.000Z | tests/test_erd.py | Datateer/erd-python | 528b876bf5adf6114cd1e0aac6a2be14006fd2eb | [
"MIT"
] | 2 | 2021-01-22T11:20:34.000Z | 2022-01-18T07:20:09.000Z | tests/test_erd.py | Datateer/erd-python | 528b876bf5adf6114cd1e0aac6a2be14006fd2eb | [
"MIT"
] | null | null | null | #!/usr/bin/env python
"""Tests for `erd` package."""
import unittest
from click.testing import CliRunner
from erd import erd
from erd import cli
class TestErd(unittest.TestCase):
"""Tests for `erd` package."""
def setUp(self):
"""Set up test fixtures, if any."""
def tearDown(self):
"... | 25.980392 | 74 | 0.658113 |
import unittest
from click.testing import CliRunner
from erd import erd
from erd import cli
class TestErd(unittest.TestCase):
def setUp(self):
def tearDown(self):
def test_000_something(self):
def test_command_line_interface(self):
runner = CliRunner()
result = runner.invoke(c... | true | true |
f7247100061d6774afb40c4bea380d62cdfa96b7 | 11,258 | py | Python | modnet/matbench/benchmark.py | sparks-baird/modnet | 2b4a88aa8a3323756b6daee52450569cddd0068b | [
"MIT"
] | 32 | 2020-05-22T11:47:37.000Z | 2022-03-28T12:55:40.000Z | modnet/matbench/benchmark.py | sparks-baird/modnet | 2b4a88aa8a3323756b6daee52450569cddd0068b | [
"MIT"
] | 43 | 2020-06-12T21:09:15.000Z | 2022-03-28T21:05:43.000Z | modnet/matbench/benchmark.py | sparks-baird/modnet | 2b4a88aa8a3323756b6daee52450569cddd0068b | [
"MIT"
] | 22 | 2020-06-19T12:03:02.000Z | 2022-01-17T16:13:38.000Z | import os
from collections import defaultdict
from traceback import print_exc
from typing import List, Dict, Any, Optional, Tuple, Type
import numpy as np
from modnet.preprocessing import MODData
from modnet.models import MODNetModel
from modnet.utils import LOG
from modnet.hyper_opt import FitGenetic
MATBENCH_SEED ... | 34.012085 | 110 | 0.618671 | import os
from collections import defaultdict
from traceback import print_exc
from typing import List, Dict, Any, Optional, Tuple, Type
import numpy as np
from modnet.preprocessing import MODData
from modnet.models import MODNetModel
from modnet.utils import LOG
from modnet.hyper_opt import FitGenetic
MATBENCH_SEED ... | true | true |
f7247128248055fc8b3fc7e0f99d36f794357c24 | 5,958 | py | Python | utils/evaluation.py | lippman1125/pytorch_FAN | ffc9c968478d55cb0c75c062bb8774923f961110 | [
"BSD-3-Clause"
] | 58 | 2019-03-14T20:13:10.000Z | 2022-03-17T07:59:34.000Z | utils/evaluation.py | lippman1125/pytorch_FAN | ffc9c968478d55cb0c75c062bb8774923f961110 | [
"BSD-3-Clause"
] | 7 | 2019-03-29T05:13:39.000Z | 2021-02-08T23:00:32.000Z | utils/evaluation.py | lippman1125/pytorch_FAN | ffc9c968478d55cb0c75c062bb8774923f961110 | [
"BSD-3-Clause"
] | 8 | 2019-05-29T09:05:32.000Z | 2022-03-12T17:00:02.000Z | from __future__ import absolute_import, print_function
import math
import numpy as np
import matplotlib.pyplot as plt
from random import randint
from .misc import *
from .transforms import transform, transform_preds
__all__ = ['accuracy', 'AverageMeter']
def get_preds(scores):
''' get predictions from score ma... | 31.193717 | 100 | 0.553206 | from __future__ import absolute_import, print_function
import math
import numpy as np
import matplotlib.pyplot as plt
from random import randint
from .misc import *
from .transforms import transform, transform_preds
__all__ = ['accuracy', 'AverageMeter']
def get_preds(scores):
assert scores.dim() == 4, 'Score ... | true | true |
f72471beb538717956885400bdf193fde9f2aea9 | 5,531 | py | Python | api/routes/admin/admin_student_routes.py | NoisyBotDude/MIS-Backend | fa402b0a6d5d6862634b0ed55bc57178856c1eba | [
"MIT"
] | null | null | null | api/routes/admin/admin_student_routes.py | NoisyBotDude/MIS-Backend | fa402b0a6d5d6862634b0ed55bc57178856c1eba | [
"MIT"
] | null | null | null | api/routes/admin/admin_student_routes.py | NoisyBotDude/MIS-Backend | fa402b0a6d5d6862634b0ed55bc57178856c1eba | [
"MIT"
] | null | null | null | from fileinput import filename
from urllib.request import Request
from api.drivers import student
from api.drivers.student import student_drivers
from api.middlewares import authentication_middleware
from api.schemas.admin.admin_request_schema import admin_request_schemas
from api.schemas.student.request_schemas impor... | 31.248588 | 85 | 0.605496 | from fileinput import filename
from urllib.request import Request
from api.drivers import student
from api.drivers.student import student_drivers
from api.middlewares import authentication_middleware
from api.schemas.admin.admin_request_schema import admin_request_schemas
from api.schemas.student.request_schemas impor... | true | true |
f724734a995b0486052f20cb0dc53813c6e312e3 | 6,915 | py | Python | analysis/views/views_karyomapping.py | SACGF/variantgrid | 515195e2f03a0da3a3e5f2919d8e0431babfd9c9 | [
"RSA-MD"
] | 5 | 2021-01-14T03:34:42.000Z | 2022-03-07T15:34:18.000Z | analysis/views/views_karyomapping.py | SACGF/variantgrid | 515195e2f03a0da3a3e5f2919d8e0431babfd9c9 | [
"RSA-MD"
] | 551 | 2020-10-19T00:02:38.000Z | 2022-03-30T02:18:22.000Z | analysis/views/views_karyomapping.py | SACGF/variantgrid | 515195e2f03a0da3a3e5f2919d8e0431babfd9c9 | [
"RSA-MD"
] | null | null | null | import csv
from collections import defaultdict, OrderedDict
from django.core.exceptions import PermissionDenied
from django.http.response import StreamingHttpResponse
from django.shortcuts import get_object_or_404, render, redirect
from django.urls.base import reverse
from django.views.decorators.cache import cache_pa... | 43.21875 | 128 | 0.707881 | import csv
from collections import defaultdict, OrderedDict
from django.core.exceptions import PermissionDenied
from django.http.response import StreamingHttpResponse
from django.shortcuts import get_object_or_404, render, redirect
from django.urls.base import reverse
from django.views.decorators.cache import cache_pa... | true | true |
f724736b6941b37c7e6fc68854f6f1512721115e | 1,762 | py | Python | CondTools/IntegrationTest/python/validate_dt_devdb10_cfg.py | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 852 | 2015-01-11T21:03:51.000Z | 2022-03-25T21:14:00.000Z | CondTools/IntegrationTest/python/validate_dt_devdb10_cfg.py | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 30,371 | 2015-01-02T00:14:40.000Z | 2022-03-31T23:26:05.000Z | CondTools/IntegrationTest/python/validate_dt_devdb10_cfg.py | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 3,240 | 2015-01-02T05:53:18.000Z | 2022-03-31T17:24:21.000Z | # The following comments couldn't be translated into the new config version:
# Configuration file for EventSetupTest_t
import FWCore.ParameterSet.Config as cms
process = cms.Process("TEST")
process.PoolDBESSource = cms.ESSource("PoolDBESSource",
loadAll = cms.bool(True),
toGet = cms.VPSet(cms.PSet(
r... | 30.37931 | 118 | 0.641317 |
# Configuration file for EventSetupTest_t
import FWCore.ParameterSet.Config as cms
process = cms.Process("TEST")
process.PoolDBESSource = cms.ESSource("PoolDBESSource",
loadAll = cms.bool(True),
toGet = cms.VPSet(cms.PSet(
record = cms.string('DTT0Rcd'),
tag = cms.string('MTCC_t0')
),
... | true | true |
f724739e7899ac5f3fc808e74a2261f63bf6be67 | 2,010 | py | Python | 3_text/apache_log_parser_split.py | lluxury/P_U_S_A | 1eb9d1fef74f9ce3618ae950f5223f598510be84 | [
"MIT"
] | null | null | null | 3_text/apache_log_parser_split.py | lluxury/P_U_S_A | 1eb9d1fef74f9ce3618ae950f5223f598510be84 | [
"MIT"
] | null | null | null | 3_text/apache_log_parser_split.py | lluxury/P_U_S_A | 1eb9d1fef74f9ce3618ae950f5223f598510be84 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
"""
USAGE:
apache_log_parser_split.py some_log_file
This script takes one command line argument: the name of a log file
to parse. It then parses the log file and generates a report which
associates remote hosts with number of bytes transferred to them.
"""
import sys
def dictify_logline(line... | 30.454545 | 83 | 0.676617 |
import sys
def dictify_logline(line):
split_line = line.split()
return {'remote_host': split_line[0],
'status': split_line[8],
'bytes_sent': split_line[9],
}
def generate_log_report(logfile):
report_dict = {}
for line in logfile:
line_dict = dictify_logline(line)... | true | true |
f724743cde7860172ea7e6028c7280410480dec1 | 7,225 | py | Python | thx_bot/integration_conversations.py | thxprotocol/telegram-bot | d8c77060740f76ed50aab93cb7c6ca83567d1710 | [
"Apache-2.0"
] | null | null | null | thx_bot/integration_conversations.py | thxprotocol/telegram-bot | d8c77060740f76ed50aab93cb7c6ca83567d1710 | [
"Apache-2.0"
] | null | null | null | thx_bot/integration_conversations.py | thxprotocol/telegram-bot | d8c77060740f76ed50aab93cb7c6ca83567d1710 | [
"Apache-2.0"
] | 3 | 2021-10-31T19:20:39.000Z | 2021-12-04T03:35:23.000Z | from telegram.ext import CommandHandler
from telegram.ext import ConversationHandler
from telegram.ext import Filters
from telegram.ext import MessageHandler
from thx_bot.commands import CHOOSING
from thx_bot.commands import CHOOSING_ADD_MEMBER
from thx_bot.commands import CHOOSING_REWARDS
from thx_bot.commands import... | 37.827225 | 97 | 0.701315 | from telegram.ext import CommandHandler
from telegram.ext import ConversationHandler
from telegram.ext import Filters
from telegram.ext import MessageHandler
from thx_bot.commands import CHOOSING
from thx_bot.commands import CHOOSING_ADD_MEMBER
from thx_bot.commands import CHOOSING_REWARDS
from thx_bot.commands import... | true | true |
f72474b80565c33b2edda35cd6580c085dbf16da | 17,832 | py | Python | pybind/nos/v6_0_2c/rbridge_id/router/router_bgp/router_bgp_attributes/neighbor/peer_grps/neighbor_peer_grp/update_source/__init__.py | shivharis/pybind | 4e1c6d54b9fd722ccec25546ba2413d79ce337e6 | [
"Apache-2.0"
] | null | null | null | pybind/nos/v6_0_2c/rbridge_id/router/router_bgp/router_bgp_attributes/neighbor/peer_grps/neighbor_peer_grp/update_source/__init__.py | shivharis/pybind | 4e1c6d54b9fd722ccec25546ba2413d79ce337e6 | [
"Apache-2.0"
] | null | null | null | pybind/nos/v6_0_2c/rbridge_id/router/router_bgp/router_bgp_attributes/neighbor/peer_grps/neighbor_peer_grp/update_source/__init__.py | shivharis/pybind | 4e1c6d54b9fd722ccec25546ba2413d79ce337e6 | [
"Apache-2.0"
] | 1 | 2021-11-05T22:15:42.000Z | 2021-11-05T22:15:42.000Z |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from d... | 77.868996 | 648 | 0.730316 |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from d... | true | true |
f7247582fc6b8d543be8129bb89d210bd8e927bf | 7,404 | py | Python | experiments/runtime/plot_runtime.py | patriotemeritus/LO-PHI | 8f92c4efb94061cb08b7e9b0ff96346565c12653 | [
"BSD-3-Clause"
] | 28 | 2016-02-26T00:54:16.000Z | 2022-02-24T12:21:15.000Z | experiments/runtime/plot_runtime.py | patriotemeritus/LO-PHI | 8f92c4efb94061cb08b7e9b0ff96346565c12653 | [
"BSD-3-Clause"
] | 2 | 2016-03-15T21:49:09.000Z | 2016-07-12T22:11:39.000Z | experiments/runtime/plot_runtime.py | patriotemeritus/LO-PHI | 8f92c4efb94061cb08b7e9b0ff96346565c12653 | [
"BSD-3-Clause"
] | 9 | 2016-06-08T14:42:28.000Z | 2021-11-11T03:51:34.000Z | """
Make a "broken" horizontal bar plot, i.e. one with gaps, of run times.
(c) 2015 Massachusetts Institute of Technology
"""
import numpy
import pprint
import matplotlib
matplotlib.use('GTKAgg')
import matplotlib.pyplot as plt
label_fontsize = 11
labels = ['Disk Reset',
# 'Power On',
... | 35.596154 | 450 | 0.595354 | """
Make a "broken" horizontal bar plot, i.e. one with gaps, of run times.
(c) 2015 Massachusetts Institute of Technology
"""
import numpy
import pprint
import matplotlib
matplotlib.use('GTKAgg')
import matplotlib.pyplot as plt
label_fontsize = 11
labels = ['Disk Reset',
'OS Boot',
... | false | true |
f72475dc8fb021a442a84a5e411f00ab6c251ab0 | 1,015 | py | Python | mud.py | nparry0/mud | ec520795e2206d5e885c343c13e3ead5d2787cd5 | [
"MIT"
] | 2 | 2018-03-15T06:00:18.000Z | 2018-03-22T03:19:38.000Z | mud.py | nparry0/mud | ec520795e2206d5e885c343c13e3ead5d2787cd5 | [
"MIT"
] | null | null | null | mud.py | nparry0/mud | ec520795e2206d5e885c343c13e3ead5d2787cd5 | [
"MIT"
] | null | null | null | import gevent.server
from mud_telnet_handler import MudTelnetHandler
from game_server import GameServer
import argparse
import logging
# Set up logging
log = logging.getLogger()
handler = logging.StreamHandler()
formatter = logging.Formatter('[%(asctime)s] [%(levelname)s] %(message)s')
handler.setFormatter(formatter)
... | 32.741935 | 114 | 0.770443 | import gevent.server
from mud_telnet_handler import MudTelnetHandler
from game_server import GameServer
import argparse
import logging
log = logging.getLogger()
handler = logging.StreamHandler()
formatter = logging.Formatter('[%(asctime)s] [%(levelname)s] %(message)s')
handler.setFormatter(formatter)
log.addHandler(h... | true | true |
f724762d197c2f0292cdab0ed9ca4350acb293d2 | 37,046 | py | Python | allauth/account/tests.py | pkyad/django-allauth | 1ffd9c2c4a121b9cdcb5814209933ce74d4303c5 | [
"MIT"
] | null | null | null | allauth/account/tests.py | pkyad/django-allauth | 1ffd9c2c4a121b9cdcb5814209933ce74d4303c5 | [
"MIT"
] | null | null | null | allauth/account/tests.py | pkyad/django-allauth | 1ffd9c2c4a121b9cdcb5814209933ce74d4303c5 | [
"MIT"
] | null | null | null | from __future__ import absolute_import
import json
from datetime import timedelta
import django
from django.utils.timezone import now
from django.test.utils import override_settings
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test.client import Client
from django.core imp... | 40.093074 | 95 | 0.582195 | from __future__ import absolute_import
import json
from datetime import timedelta
import django
from django.utils.timezone import now
from django.test.utils import override_settings
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test.client import Client
from django.core imp... | true | true |
f72476a51168fd61ef40256da67527b38bad600a | 5,368 | py | Python | core/cache/decorator.py | prorevizor/noc | 37e44b8afc64318b10699c06a1138eee9e7d6a4e | [
"BSD-3-Clause"
] | 84 | 2017-10-22T11:01:39.000Z | 2022-02-27T03:43:48.000Z | core/cache/decorator.py | prorevizor/noc | 37e44b8afc64318b10699c06a1138eee9e7d6a4e | [
"BSD-3-Clause"
] | 22 | 2017-12-11T07:21:56.000Z | 2021-09-23T02:53:50.000Z | core/cache/decorator.py | prorevizor/noc | 37e44b8afc64318b10699c06a1138eee9e7d6a4e | [
"BSD-3-Clause"
] | 23 | 2017-12-06T06:59:52.000Z | 2022-02-24T00:02:25.000Z | # ----------------------------------------------------------------------
# Decorators
# ----------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# NOC modules
from ... | 39.182482 | 97 | 0.404434 |
from noc.core.perf import metrics
from .base import cache as x_cache
def cachedmethod(cache=None, key="cache-%s", lock=None, ttl=None, version=0):
def decorator(method):
if lock:
def wrapper(self, *args, **kwargs):
perf_key = key.replace("-%s", "").replace("-", "_")
... | true | true |
f72476bf2e961b26c53e96e9358bb4c0a54239b7 | 8,355 | py | Python | tron/Vocab/hubCommands.py | sdss/tron | 886c5c5fb6341ad85e4a9f5d6f5ecb6bbc0d8322 | [
"BSD-3-Clause"
] | null | null | null | tron/Vocab/hubCommands.py | sdss/tron | 886c5c5fb6341ad85e4a9f5d6f5ecb6bbc0d8322 | [
"BSD-3-Clause"
] | null | null | null | tron/Vocab/hubCommands.py | sdss/tron | 886c5c5fb6341ad85e4a9f5d6f5ecb6bbc0d8322 | [
"BSD-3-Clause"
] | null | null | null | __all__ = ['hubCommands']
import sys
import Vocab.InternalCmd as InternalCmd
from tron import Misc, g, hub
from tron.Hub.KV.KVDict import kvAsASCII
class hubCommands(InternalCmd.InternalCmd):
""" All the commands that the "hub" package provides.
The user executes these from the command window:
hub st... | 30.830258 | 95 | 0.518971 | __all__ = ['hubCommands']
import sys
import Vocab.InternalCmd as InternalCmd
from tron import Misc, g, hub
from tron.Hub.KV.KVDict import kvAsASCII
class hubCommands(InternalCmd.InternalCmd):
def __init__(self, **argv):
argv['safeCmds'] = r'^\s*(actors|commanders|actorInfo|version|status|ping)\s*$'
... | true | true |
f7247748c768db7db41eded5f66dc4d97b47480c | 964 | py | Python | mats/model/components/gmm2d.py | StanfordASL/MATS | b31a86eb56728fc6025c71c7202ab425b078e3e5 | [
"MIT"
] | 21 | 2020-12-03T05:27:19.000Z | 2022-01-18T02:24:22.000Z | mats/model/components/gmm2d.py | StanfordASL/MATS | b31a86eb56728fc6025c71c7202ab425b078e3e5 | [
"MIT"
] | 1 | 2022-03-29T14:51:51.000Z | 2022-03-29T14:51:51.000Z | mats/model/components/gmm2d.py | StanfordASL/MATS | b31a86eb56728fc6025c71c7202ab425b078e3e5 | [
"MIT"
] | 5 | 2021-01-09T18:12:47.000Z | 2022-03-22T11:45:56.000Z | import torch
import torch.distributions as td
class GMM2D(td.MixtureSameFamily):
def __init__(self, mixture_distribution, component_distribution):
super(GMM2D, self).__init__(mixture_distribution, component_distribution)
def mode_mode(self):
mode_k = torch.argmax(self.mixture_distribution.pro... | 40.166667 | 110 | 0.691909 | import torch
import torch.distributions as td
class GMM2D(td.MixtureSameFamily):
def __init__(self, mixture_distribution, component_distribution):
super(GMM2D, self).__init__(mixture_distribution, component_distribution)
def mode_mode(self):
mode_k = torch.argmax(self.mixture_distribution.pro... | true | true |
f72477b35e362dbce3d14f182fe8455bd0352f5f | 3,916 | py | Python | ironic/objects/base.py | hpproliant/ironic | 4f62cd97196b2a0068700ffb17456912147778d0 | [
"Apache-2.0"
] | null | null | null | ironic/objects/base.py | hpproliant/ironic | 4f62cd97196b2a0068700ffb17456912147778d0 | [
"Apache-2.0"
] | null | null | null | ironic/objects/base.py | hpproliant/ironic | 4f62cd97196b2a0068700ffb17456912147778d0 | [
"Apache-2.0"
] | null | null | null | # Copyright 2013 IBM Corp.
#
# 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 agree... | 40.371134 | 78 | 0.687692 |
from oslo_versionedobjects import base as object_base
from ironic.objects import fields as object_fields
class IronicObjectRegistry(object_base.VersionedObjectRegistry):
pass
class IronicObject(object_base.VersionedObject):
OBJ_SERIAL_NAMESPACE = 'ironic_object'
OBJ_PROJECT_NAMESPACE = ... | true | true |
f7247810b61f545dbbf06766dccc172c15e03ef6 | 62,418 | py | Python | superset/db_engine_specs.py | emacip/incubator-superset | 594cd7096070a742209851ff9112d5bf4d16a7be | [
"Apache-2.0",
"CC-BY-4.0",
"MIT"
] | 1 | 2019-02-05T04:53:37.000Z | 2019-02-05T04:53:37.000Z | superset/db_engine_specs.py | mankoven/incubator-superset | bab7ee7ecf222250287e591d91b38be583c9a2f3 | [
"Apache-2.0",
"CC-BY-4.0",
"MIT"
] | 7 | 2021-02-02T23:08:19.000Z | 2022-03-29T22:28:16.000Z | superset/db_engine_specs.py | g4brielvs/incubator-superset | 83ee9178328c5193808fe356ceb3090a299477f6 | [
"Apache-2.0",
"CC-BY-4.0",
"MIT"
] | 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... | 37.829091 | 126 | 0.594156 |
from collections import namedtuple
import hashlib
import inspect
import logging
import os
import re
import textwrap
import time
from flask import g
from flask_babel import lazy_gettext as _
import pandas
import sqlalchemy as sqla
from sqlalchemy import Column, select
from sqlalchemy.engine import crea... | true | true |
f724783584f78b08b18463f09ec4dd4c262a7666 | 2,714 | py | Python | lib/metrics.py | ppmdatix/rtdl | a01ecd9ae6b673f4e82e51f804ffd7031c7350a0 | [
"Apache-2.0"
] | 298 | 2021-06-22T15:41:18.000Z | 2022-03-09T07:52:30.000Z | lib/metrics.py | ppmdatix/rtdl | a01ecd9ae6b673f4e82e51f804ffd7031c7350a0 | [
"Apache-2.0"
] | 15 | 2021-07-27T05:39:21.000Z | 2022-02-25T11:33:32.000Z | lib/metrics.py | ppmdatix/rtdl | a01ecd9ae6b673f4e82e51f804ffd7031c7350a0 | [
"Apache-2.0"
] | 37 | 2021-06-25T03:56:37.000Z | 2022-03-10T11:07:51.000Z | import typing as ty
import numpy as np
import scipy.special
import sklearn.metrics as skm
from . import util
def calculate_metrics(
task_type: str,
y: np.ndarray,
prediction: np.ndarray,
classification_mode: str,
y_info: ty.Optional[ty.Dict[str, ty.Any]],
) -> ty.Dict[str, float]:
if task_ty... | 31.55814 | 93 | 0.507369 | import typing as ty
import numpy as np
import scipy.special
import sklearn.metrics as skm
from . import util
def calculate_metrics(
task_type: str,
y: np.ndarray,
prediction: np.ndarray,
classification_mode: str,
y_info: ty.Optional[ty.Dict[str, ty.Any]],
) -> ty.Dict[str, float]:
if task_ty... | true | true |
f724797778a03ff70b6b2d2cacc77e8f0dc791c8 | 1,451 | py | Python | api/tests.py | toast38coza/KongOAuth | 827d6f0cb47c67903f0a0236f56cd20c18bb84bb | [
"MIT"
] | null | null | null | api/tests.py | toast38coza/KongOAuth | 827d6f0cb47c67903f0a0236f56cd20c18bb84bb | [
"MIT"
] | null | null | null | api/tests.py | toast38coza/KongOAuth | 827d6f0cb47c67903f0a0236f56cd20c18bb84bb | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase, override_settings
from django.contrib.auth import get_user_model
import json
import responses
## responses:
def kong_login_success():
responses.add(
responses.POST,
'https://kong:8443/test/oauth2/toke... | 29.612245 | 123 | 0.637491 |
from __future__ import unicode_literals
from django.test import TestCase, override_settings
from django.contrib.auth import get_user_model
import json
import responses
gin_success():
responses.add(
responses.POST,
'https://kong:8443/test/oauth2/token',
body=json.dumps({'refresh_token': 'r... | true | true |
f7247a8886b4c59ba58b43b090bbe0a5d941f51a | 9,304 | py | Python | monai/transforms/__init__.py | marksgraham/MONAI | 42591511e9493fedd70af857344cc91073b867e8 | [
"Apache-2.0"
] | null | null | null | monai/transforms/__init__.py | marksgraham/MONAI | 42591511e9493fedd70af857344cc91073b867e8 | [
"Apache-2.0"
] | null | null | null | monai/transforms/__init__.py | marksgraham/MONAI | 42591511e9493fedd70af857344cc91073b867e8 | [
"Apache-2.0"
] | 1 | 2021-01-19T19:35:00.000Z | 2021-01-19T19:35:00.000Z | # Copyright 2020 - 2021 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in wri... | 22.258373 | 103 | 0.725064 |
from .adaptors import FunctionSignature, adaptor, apply_alias, to_kwargs
from .compose import Compose
from .croppad.array import (
BorderPad,
BoundingRect,
CenterSpatialCrop,
CropForeground,
DivisiblePad,
RandCropByPosNegLabel,
RandSpatialCrop,
RandSpatialCropSamples,
Rand... | true | true |
f7247b2dbd9cf7eb773ad8e4856771996587a897 | 48 | py | Python | samcli/__init__.py | kylelaker/aws-sam-cli | d2917102ef56ac05b9973f96c716612f9638bb62 | [
"BSD-2-Clause",
"Apache-2.0"
] | null | null | null | samcli/__init__.py | kylelaker/aws-sam-cli | d2917102ef56ac05b9973f96c716612f9638bb62 | [
"BSD-2-Clause",
"Apache-2.0"
] | null | null | null | samcli/__init__.py | kylelaker/aws-sam-cli | d2917102ef56ac05b9973f96c716612f9638bb62 | [
"BSD-2-Clause",
"Apache-2.0"
] | null | null | null | """
SAM CLI version
"""
__version__ = "1.13.1"
| 8 | 22 | 0.583333 |
__version__ = "1.13.1"
| true | true |
f7247b7c5f90f8592a8c662974c56a475935ed18 | 1,394 | py | Python | 505 The Maze II.py | krishna13052001/LeetCode | cd6ec626bea61f0bd9e8493622074f9e69a7a1c3 | [
"MIT"
] | 872 | 2015-06-15T12:02:41.000Z | 2022-03-30T08:44:35.000Z | 505 The Maze II.py | nadeemshaikh-github/LeetCode | 3fb14aeea62a960442e47dfde9f964c7ffce32be | [
"MIT"
] | 8 | 2015-06-21T15:11:59.000Z | 2022-02-01T11:22:34.000Z | 505 The Maze II.py | nadeemshaikh-github/LeetCode | 3fb14aeea62a960442e47dfde9f964c7ffce32be | [
"MIT"
] | 328 | 2015-06-28T03:10:35.000Z | 2022-03-29T11:05:28.000Z | #!/usr/bin/python3
"""
premium question
"""
from typing import List
import heapq
dirs = [(0, -1), (0, 1), (-1, 0), (1, 0)]
class Solution:
def shortestDistance(self, maze: List[List[int]], start: List[int], destination: List[int]) -> int:
"""
No friction rolling ball
F[i][j][dir] = min ... | 28.44898 | 121 | 0.444763 |
from typing import List
import heapq
dirs = [(0, -1), (0, 1), (-1, 0), (1, 0)]
class Solution:
def shortestDistance(self, maze: List[List[int]], start: List[int], destination: List[int]) -> int:
m, n = len(maze), len(maze[0])
D = [[float("inf") for _ in range(n)] for _ in range(m)]
i,... | true | true |
f7247bcaf5d604756097f5b9a64dc5e8efcee241 | 1,801 | py | Python | src/augmented_pickle.py | opskrift/expman | 637bbef34d79ce03311889ce310797e78a9f7710 | [
"MIT"
] | null | null | null | src/augmented_pickle.py | opskrift/expman | 637bbef34d79ce03311889ce310797e78a9f7710 | [
"MIT"
] | 16 | 2021-08-04T12:08:00.000Z | 2021-09-12T13:01:27.000Z | src/augmented_pickle.py | opskrift/opskrift | 637bbef34d79ce03311889ce310797e78a9f7710 | [
"MIT"
] | null | null | null | """
Suppose you have some input data sources `data_in` on which you apply some process `F` parameterized by `args`:
data_out = F(data_in, args)
You want to serialize `data_out`, but also don't want to lose `args`,
to preserve the exact setup that generated the output data.
Now suppose you want to inspect `args` ... | 27.287879 | 111 | 0.675736 |
import pickle
from os import PathLike
from typing import Any, Iterable, Union
def write_augmented_pickle(
metadata: Any,
body: Any,
path: Union[str, PathLike],
) -> None:
with open(path, "wb") as fp:
pickle.dump(metadata, fp)
pickle.dump(body, fp)
def read_augmented_pickle(
pat... | true | true |
f7247d937c3d515dd43275659017e44fc03cb44c | 1,247 | py | Python | crawling/crawler.py | LukasTinnes/sPyRat | 42e012e426befa3876e590be2ea83874d5351d12 | [
"Unlicense"
] | null | null | null | crawling/crawler.py | LukasTinnes/sPyRat | 42e012e426befa3876e590be2ea83874d5351d12 | [
"Unlicense"
] | 3 | 2022-02-07T19:53:47.000Z | 2022-02-13T19:51:33.000Z | crawling/crawler.py | LukasTinnes/sPyRat | 42e012e426befa3876e590be2ea83874d5351d12 | [
"Unlicense"
] | null | null | null | from abc import abstractmethod
from crawling.crawler_data_structures.crawl_data import CrawlData
class Crawler:
"""
An abstract class for other Crawlers to inherit from.
A Crawler should open a given file and attempt to find an associated file pattern at every byte in the given file.
"""
@abstrac... | 31.175 | 118 | 0.623095 | from abc import abstractmethod
from crawling.crawler_data_structures.crawl_data import CrawlData
class Crawler:
@abstractmethod
def crawl(self, file: str) -> CrawlData:
...
@abstractmethod
def crawl_in_range(self, file: str, start_byte: int, end_byte: int) -> CrawlData:
...
@abs... | true | true |
f7247d9b14431ca407254cad9d929acd151162dc | 9,493 | py | Python | docs/conf.py | benedikt-mangold/obfuscate | 4e51b3c3c6d3d869a742f036234632c77cebcb54 | [
"MIT"
] | null | null | null | docs/conf.py | benedikt-mangold/obfuscate | 4e51b3c3c6d3d869a742f036234632c77cebcb54 | [
"MIT"
] | 1 | 2021-06-01T14:48:09.000Z | 2021-06-01T14:48:09.000Z | docs/conf.py | benedikt-mangold/obfuscate | 4e51b3c3c6d3d869a742f036234632c77cebcb54 | [
"MIT"
] | null | null | null | # This file is execfile()d with the current directory set to its containing dir.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
#
# All configuration values have a default; values that are comme... | 33.54417 | 89 | 0.696092 |
import os
import sys
import inspect
import shutil
__location__ = os.path.join(
os.getcwd(), os.path.dirname(inspect.getfile(inspect.currentframe()))
)
sys.path.insert(0, os.path.join(__location__, "../src"))
# setup.py install" in the RTD Advanced Settings.
# Additionally it helps us to avoid ... | true | true |
f7247db16c62de200bc2c5deee5c7ca83220e585 | 4,738 | py | Python | test/streams.py | gonsp/LotterySampling | 92ff14f602c05d747708b522cf05b9f9066c43e0 | [
"MIT"
] | 4 | 2020-06-03T15:17:28.000Z | 2020-09-29T20:52:15.000Z | test/streams.py | gonsp/LotterySampling | 92ff14f602c05d747708b522cf05b9f9066c43e0 | [
"MIT"
] | null | null | null | test/streams.py | gonsp/LotterySampling | 92ff14f602c05d747708b522cf05b9f9066c43e0 | [
"MIT"
] | null | null | null | import itertools
import math
import numpy as np
from abc import abstractmethod
from io import TextIOWrapper
from sorted_list import SortedList
class Stream():
def __init__(self, length, save=True):
self.length = length
self.N = 0
self.n = 0
self.save = save
self.elements =... | 27.387283 | 154 | 0.580625 | import itertools
import math
import numpy as np
from abc import abstractmethod
from io import TextIOWrapper
from sorted_list import SortedList
class Stream():
def __init__(self, length, save=True):
self.length = length
self.N = 0
self.n = 0
self.save = save
self.elements =... | true | true |
f7247e8a17813fa402740c3c525d9fef0664b3d9 | 116 | py | Python | web-app/backend/apps/common/routes/__init__.py | titoeb/kfserving | b072a76842b57e904dbdf46a136474a22051500d | [
"Apache-2.0"
] | 47 | 2022-01-02T09:59:15.000Z | 2022-01-25T11:11:17.000Z | web-app/backend/apps/common/routes/__init__.py | titoeb/kfserving | b072a76842b57e904dbdf46a136474a22051500d | [
"Apache-2.0"
] | 7 | 2021-08-31T23:55:06.000Z | 2022-03-02T11:34:58.000Z | web-app/backend/apps/common/routes/__init__.py | titoeb/kfserving | b072a76842b57e904dbdf46a136474a22051500d | [
"Apache-2.0"
] | 4 | 2022-01-27T08:59:15.000Z | 2022-02-27T14:42:19.000Z | from flask import Blueprint
bp = Blueprint("base_routes", __name__)
from . import delete, get # noqa: F401, E402
| 19.333333 | 45 | 0.732759 | from flask import Blueprint
bp = Blueprint("base_routes", __name__)
from . import delete, get
| true | true |
f7247ef6bd54462db7b045b5ea78324bc3752082 | 256 | py | Python | sessioncontroller/settings.py | synteny/AuroraBot | 179919e1e6cc5f24d9cf3e9295d0f043174a6169 | [
"MIT"
] | 2 | 2015-11-27T11:08:24.000Z | 2018-03-21T15:35:08.000Z | sessioncontroller/settings.py | synteny/AuroraBot | 179919e1e6cc5f24d9cf3e9295d0f043174a6169 | [
"MIT"
] | 2 | 2015-10-27T15:06:09.000Z | 2015-10-28T12:53:12.000Z | sessioncontroller/settings.py | synteny/AuroraBot | 179919e1e6cc5f24d9cf3e9295d0f043174a6169 | [
"MIT"
] | null | null | null | import os
TELEGRAM_TOKEN = os.environ['TELEGRAM_TOKEN']
DATABASE = {
'HOST': os.getenv('DB_PORT_3306_TCP_ADDR', 'localhost'),
'USER': os.getenv('DB_MYSQL_USER', 'root'),
'PASSWORD': os.getenv('DB_MYSQL_PASSWORD', ''),
'NAME': 'aurora',
}
| 23.272727 | 60 | 0.652344 | import os
TELEGRAM_TOKEN = os.environ['TELEGRAM_TOKEN']
DATABASE = {
'HOST': os.getenv('DB_PORT_3306_TCP_ADDR', 'localhost'),
'USER': os.getenv('DB_MYSQL_USER', 'root'),
'PASSWORD': os.getenv('DB_MYSQL_PASSWORD', ''),
'NAME': 'aurora',
}
| true | true |
f7247f14b21d4ad2ba934ab6dab587b66188f368 | 8,305 | py | Python | fpn/operator_py/fpn_roi_pooling.py | CosmosHua/Deformable-ConvNets | 6aeda878a95bcb55eadffbe125804e730574de8d | [
"MIT"
] | 3,976 | 2017-05-05T13:48:27.000Z | 2022-03-30T13:37:48.000Z | fpn/operator_py/fpn_roi_pooling.py | CosmosHua/Deformable-ConvNets | 6aeda878a95bcb55eadffbe125804e730574de8d | [
"MIT"
] | 259 | 2017-05-06T13:30:11.000Z | 2022-03-16T14:11:16.000Z | fpn/operator_py/fpn_roi_pooling.py | CosmosHua/Deformable-ConvNets | 6aeda878a95bcb55eadffbe125804e730574de8d | [
"MIT"
] | 1,051 | 2017-05-05T14:55:57.000Z | 2022-03-23T01:02:47.000Z | # --------------------------------------------------------
# Deformable Convolutional Networks
# Copyright (c) 2017 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Modified by Haozhi Qi, Yuwen Xiong
# --------------------------------------------------------
import mxnet as mx
import numpy as np
... | 56.114865 | 184 | 0.593618 |
import mxnet as mx
import numpy as np
from mxnet.contrib import autograd
import gc
class FPNROIPoolingOperator(mx.operator.CustomOp):
def __init__(self, feat_strides, pooled_height, pooled_width, output_dim, with_deformable):
self.pooled_height = pooled_height
self.pooled_width = pooled_wid... | true | true |
f7247f42ef9c871c8ebd07fc747da69ad689d3a3 | 405 | py | Python | 05/iterator_example.py | alissonit/pythontrap | b7780913d49af2142be4a9674ac435e2a67da201 | [
"MIT"
] | null | null | null | 05/iterator_example.py | alissonit/pythontrap | b7780913d49af2142be4a9674ac435e2a67da201 | [
"MIT"
] | null | null | null | 05/iterator_example.py | alissonit/pythontrap | b7780913d49af2142be4a9674ac435e2a67da201 | [
"MIT"
] | 1 | 2021-03-15T18:26:14.000Z | 2021-03-15T18:26:14.000Z | #CONSTRUINDO UMA CLASSE ITERATOR
class GenItem(object):
def __init__(self, first, last):
self.first = first
self.last = last
def __iter__(self):
return self
def __next__(self):
if self.first > self.last:
raise StopIteration
else:
self.first +... | 22.5 | 36 | 0.577778 |
class GenItem(object):
def __init__(self, first, last):
self.first = first
self.last = last
def __iter__(self):
return self
def __next__(self):
if self.first > self.last:
raise StopIteration
else:
self.first += 1
return self.firs... | true | true |
f72480521f1fad6394a1656241b51fbd1c7d3230 | 14,939 | py | Python | Lib/site-packages/wx-3.0-msw/wx/lib/gridmovers.py | jickieduan/python27 | c752b552396bbed68d8555080d475718cea2edd0 | [
"bzip2-1.0.6"
] | 1 | 2021-02-13T22:40:50.000Z | 2021-02-13T22:40:50.000Z | Lib/site-packages/wx-3.0-msw/wx/lib/gridmovers.py | jickieduan/python27 | c752b552396bbed68d8555080d475718cea2edd0 | [
"bzip2-1.0.6"
] | 1 | 2018-07-28T20:07:04.000Z | 2018-07-30T18:28:34.000Z | Lib/site-packages/wx-3.0-msw/wx/lib/gridmovers.py | jickieduan/python27 | c752b552396bbed68d8555080d475718cea2edd0 | [
"bzip2-1.0.6"
] | 2 | 2019-12-02T01:39:10.000Z | 2021-02-13T22:41:00.000Z | #----------------------------------------------------------------------------
# Name: GridColMover.py
# Purpose: Grid Column Mover Extension
#
# Author: Gerrit van Dyk (email: gerritvd@decillion.net)
#
# Version 0.1
# Date: Nov 19, 2002
# RCS-ID: $Id$
# Licence: wxWindows lic... | 30.240891 | 77 | 0.522391 |
import wx
import wx.grid
wxEVT_COMMAND_GRID_COL_MOVE = wx.NewEventType()
wxEVT_COMMAND_GRID_ROW_MOVE = wx.NewEventType()
EVT_GRID_COL_MOVE = wx.PyEventBinder(wxEVT_COMMAND_GRID_COL_MOVE, 1)
EVT_GRID_ROW_MOVE = wx.PyEventBinder(wxEVT_COMMAND_GRID_ROW_MOVE, 1)
class GridColMoveEvent(w... | true | true |
f7248062a2abc3c1b4355687c2e16191aa358970 | 28,942 | py | Python | front-end/testsuite-python-lib/Python-2.3/Lib/test/test_re.py | MalloyPower/parsing-python | b2bca5eed07ea2af7a2001cd4f63becdfb0570be | [
"MIT"
] | 1 | 2020-11-26T18:53:46.000Z | 2020-11-26T18:53:46.000Z | front-end/testsuite-python-lib/Python-2.3/Lib/test/test_re.py | MalloyPower/parsing-python | b2bca5eed07ea2af7a2001cd4f63becdfb0570be | [
"MIT"
] | null | null | null | front-end/testsuite-python-lib/Python-2.3/Lib/test/test_re.py | MalloyPower/parsing-python | b2bca5eed07ea2af7a2001cd4f63becdfb0570be | [
"MIT"
] | 1 | 2019-04-11T11:27:01.000Z | 2019-04-11T11:27:01.000Z | import sys
sys.path = ['.'] + sys.path
from test.test_support import verbose, run_unittest
import re
from sre import Scanner
import sys, os, traceback
# Misc tests from Tim Peters' re.doc
# WARNING: Don't change details in these tests if you don't know
# what you're doing. Some of these tests were carefuly modeled t... | 46.530547 | 85 | 0.478854 | import sys
sys.path = ['.'] + sys.path
from test.test_support import verbose, run_unittest
import re
from sre import Scanner
import sys, os, traceback
# WARNING: Don't change details in these tests if you don't know
# what you're doing. Some of these tests were carefuly modeled to
import unittest
class ReTests(u... | false | true |
f72480fcb8551a59e4a32a3f79265c45343d673d | 26,964 | py | Python | fair/forward.py | shaheen19/FAIR | 345c23b3d35918729e7aa49ecb39047494c48a6e | [
"Apache-2.0"
] | 1 | 2019-09-15T02:35:47.000Z | 2019-09-15T02:35:47.000Z | fair/forward.py | shaheen19/FAIR | 345c23b3d35918729e7aa49ecb39047494c48a6e | [
"Apache-2.0"
] | null | null | null | fair/forward.py | shaheen19/FAIR | 345c23b3d35918729e7aa49ecb39047494c48a6e | [
"Apache-2.0"
] | null | null | null | from __future__ import division
import inspect
import numpy as np
import warnings
from scipy.optimize import root
from .ancil import natural, cmip6_volcanic, cmip6_solar, historical_scaling
from .constants import molwt, lifetime, radeff
from .constants.general import M_ATMOS, ppm_gtc
from .defaults import carbon, ther... | 37.870787 | 83 | 0.528371 | from __future__ import division
import inspect
import numpy as np
import warnings
from scipy.optimize import root
from .ancil import natural, cmip6_volcanic, cmip6_solar, historical_scaling
from .constants import molwt, lifetime, radeff
from .constants.general import M_ATMOS, ppm_gtc
from .defaults import carbon, ther... | true | true |
f7248131aa87bcae1465dd9f6fc9da5036cc235d | 29,226 | py | Python | absl/flags/tests/_validators_test.py | mcx/abseil-py | 58ead8c22230a2493006fa0ab9f76776b6e7280f | [
"Apache-2.0"
] | 1,969 | 2017-04-24T22:21:29.000Z | 2022-03-30T13:27:09.000Z | absl/flags/tests/_validators_test.py | mcx/abseil-py | 58ead8c22230a2493006fa0ab9f76776b6e7280f | [
"Apache-2.0"
] | 111 | 2017-09-27T05:45:53.000Z | 2022-03-29T16:48:49.000Z | absl/flags/tests/_validators_test.py | mcx/abseil-py | 58ead8c22230a2493006fa0ab9f76776b6e7280f | [
"Apache-2.0"
] | 240 | 2017-09-26T01:18:10.000Z | 2022-03-31T06:24:40.000Z | # Copyright 2017 The Abseil Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 39.22953 | 80 | 0.685622 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import warnings
from absl.flags import _defines
from absl.flags import _exceptions
from absl.flags import _flagvalues
from absl.flags import _validators
from absl.testing import absltest
clas... | true | true |
f72481a010acb7f8d898500cf94f600286f5da8d | 64,856 | py | Python | pybit/__init__.py | leftcoastgeek/pybit | 3564bd08a5e34c95a15f8a03b100282ddffd3edf | [
"MIT"
] | null | null | null | pybit/__init__.py | leftcoastgeek/pybit | 3564bd08a5e34c95a15f8a03b100282ddffd3edf | [
"MIT"
] | null | null | null | pybit/__init__.py | leftcoastgeek/pybit | 3564bd08a5e34c95a15f8a03b100282ddffd3edf | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
pybit
------------------------
pybit is a lightweight and high-performance API connector for the
RESTful and WebSocket APIs of the Bybit exchange.
Documentation can be found at
https://github.com/verata-veritatis/pybit
:copyright: (c) 2020-2021 verata-veritatis
:license: MIT License
"""... | 33.691429 | 125 | 0.556926 |
import time
import hmac
import json
import logging
import threading
import requests
import websocket
from datetime import datetime as dt
from concurrent.futures import ThreadPoolExecutor
from .exceptions import FailedRequestError, InvalidRequestError
try:
from simplejson.errors import JSONDecodeError
except ... | true | true |
f72482536502a08c92fdd47d1959c93914af950f | 1,330 | py | Python | Competition Codes/packageFunction.py | Harrdy2018/2018-Huawei-Code-Craft | 62fa76c658746550b2e5c8ef059a5c748e93c06c | [
"Apache-2.0"
] | 1 | 2019-04-08T04:15:51.000Z | 2019-04-08T04:15:51.000Z | Competition Codes/packageFunction.py | Harrdy2018/2018-Huawei-Code-Craft | 62fa76c658746550b2e5c8ef059a5c748e93c06c | [
"Apache-2.0"
] | null | null | null | Competition Codes/packageFunction.py | Harrdy2018/2018-Huawei-Code-Craft | 62fa76c658746550b2e5c8ef059a5c748e93c06c | [
"Apache-2.0"
] | 2 | 2018-04-16T10:11:24.000Z | 2019-06-28T06:30:28.000Z | #coding=utf-8
def MultiplePackage(N,C,weight,value,num,physic):
'''
多重背包问题(每个物品都有次数限制)
:param N: 预测的虚拟机种类,如N=pre_num
:param C:输入文件是CPU,那么背包总容量就是MEM,如C=
:param weight: 每个物品的容量数组表示,如weight=[0,5,4,7,2,6]
:param value: 每个物品的价值数组表示,如value=[0,12,3,10,3,6]
:param num:每个物品的个数限制,如num=[0,2,4,1,5,3]
... | 35 | 69 | 0.52406 |
def MultiplePackage(N,C,weight,value,num,physic):
f=[[0 for col in range(C+1)] for row in range(N+1)]
for i in range(1,N+1):
for j in range(1,C+1):
max_num_i=min(j/weight[i],num[i])
f[i][j]=f[i-1][j]
for k in range(max_num_i+1):
... | true | true |
f72482abf2030cf6d190809b6914b9bdbeec552b | 3,074 | py | Python | users/migrations/0001_initial.py | SohailAQ/Rest_Alpha | 326009217f16164c7f4667e7b3dbb82e43cf2469 | [
"MIT"
] | null | null | null | users/migrations/0001_initial.py | SohailAQ/Rest_Alpha | 326009217f16164c7f4667e7b3dbb82e43cf2469 | [
"MIT"
] | null | null | null | users/migrations/0001_initial.py | SohailAQ/Rest_Alpha | 326009217f16164c7f4667e7b3dbb82e43cf2469 | [
"MIT"
] | null | null | null | # Generated by Django 3.2.8 on 2021-10-21 16:43
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0012_alter_user_first_name_m... | 65.404255 | 329 | 0.656474 |
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
]
operations = [
... | true | true |
f72482c36144879a71a381f8ffacbf087f5e4594 | 28,655 | py | Python | sdk/python/pulumi_kubernetes/core/v1/Event.py | polivbr/pulumi-kubernetes | 36a5fb34240a38a60b52a5f4e55e66e248d9305f | [
"Apache-2.0"
] | 277 | 2018-06-18T14:57:09.000Z | 2022-03-29T04:05:06.000Z | sdk/python/pulumi_kubernetes/core/v1/Event.py | polivbr/pulumi-kubernetes | 36a5fb34240a38a60b52a5f4e55e66e248d9305f | [
"Apache-2.0"
] | 1,447 | 2018-06-20T00:58:34.000Z | 2022-03-31T21:28:43.000Z | sdk/python/pulumi_kubernetes/core/v1/Event.py | polivbr/pulumi-kubernetes | 36a5fb34240a38a60b52a5f4e55e66e248d9305f | [
"Apache-2.0"
] | 95 | 2018-06-30T03:30:05.000Z | 2022-03-29T04:05:09.000Z | # coding=utf-8
# *** WARNING: this file was generated by pulumigen. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
from . import outp... | 48.322091 | 401 | 0.658873 |
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
from . import outputs
from ... import meta as _meta
from ._inputs import *
__all__ = ['EventInitArgs', 'Event']
@pulumi.input_type
class EventInitArgs:
def __init... | true | true |
f724835605b65f1f1e1ae6d86dd97f931443263b | 2,525 | py | Python | stats.py | JoKalliauer/resvg-test-suite | c1a0e510bcdb89275b30caeb3725208304a26754 | [
"MIT"
] | 1 | 2021-06-02T11:21:41.000Z | 2021-06-02T11:21:41.000Z | stats.py | adarshkrtiwari/resvg-test-suite | c2cb84b630332ea585fc54ba62e62d35fb4a33dd | [
"MIT"
] | null | null | null | stats.py | adarshkrtiwari/resvg-test-suite | c2cb84b630332ea585fc54ba62e62d35fb4a33dd | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Usage:
# ./stats.py results.csv chart.svg
# ./stats.py official.csv official_chart.svg
import argparse
import csv
import json
import subprocess
UNKNOWN = 0
PASSED = 1
FAILED = 2
CRASHED = 3
PARTIAL = 4
OUT_OF_SCOPE = 5
class RowData:
def __init__(self, name, ... | 22.747748 | 81 | 0.486337 |
import argparse
import csv
import json
import subprocess
UNKNOWN = 0
PASSED = 1
FAILED = 2
CRASHED = 3
PARTIAL = 4
OUT_OF_SCOPE = 5
class RowData:
def __init__(self, name, flags):
self.name = name
self.flags = flags
parser = argparse.ArgumentParser()
parser.add_... | true | true |
f724837677091a92b829fe1dee99ea0c985b84da | 4,804 | py | Python | docs/conf.py | cartovarc/mac-to-ip | 94098096297fe3d64022ecc850923d3cdc9691b1 | [
"MIT"
] | null | null | null | docs/conf.py | cartovarc/mac-to-ip | 94098096297fe3d64022ecc850923d3cdc9691b1 | [
"MIT"
] | null | null | null | docs/conf.py | cartovarc/mac-to-ip | 94098096297fe3d64022ecc850923d3cdc9691b1 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
#
# mac_to_ip documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# A... | 29.472393 | 77 | 0.684013 |
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
import mac_to_ip
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = 'MAC to IP'
copyright = "2021, Carlos Tovar"
author = "... | true | true |
f72483c20810353d6391f7a8ef332c319e49ecf0 | 2,956 | py | Python | pygyver/etl/ometria.py | madedotcom/pygyver | 77da52570951c4ddaba3d60f36a82c64828a9121 | [
"MIT"
] | 1 | 2020-11-25T11:33:11.000Z | 2020-11-25T11:33:11.000Z | pygyver/etl/ometria.py | madedotcom/pygyver | 77da52570951c4ddaba3d60f36a82c64828a9121 | [
"MIT"
] | 21 | 2020-04-17T17:21:05.000Z | 2021-05-21T13:34:51.000Z | pygyver/etl/ometria.py | madedotcom/pygyver | 77da52570951c4ddaba3d60f36a82c64828a9121 | [
"MIT"
] | 2 | 2021-03-05T14:13:00.000Z | 2021-12-30T18:36:40.000Z | """
Ometria API
http://docs.ometria.com/apis/data_api_v2/
- the env vars for the authentication are stored on the kubernetes cluster
under 'ometria-access-credentials'
- functionality:
set api credentials
send custom events
"""
import logging
import os
import requests
class OmetriaExecutor:
"""
Ometr... | 30.163265 | 76 | 0.579838 | import logging
import os
import requests
class OmetriaExecutor:
def __init__(self, env: str):
self.env = env
self.api_endpoint = "https://api.ometria.com/v2"
self.api_key = None
self.api_headers = None
self.payload = None
self.response = None
self.set_api_c... | true | true |
f724846c02029786eec80ed57f3b3c256cf3045a | 1,366 | py | Python | src/csharp/CSharpTemplate.py | slash-under/codenn | 747a7c5c6788256cdb1564d0936b5ea91f43ba6c | [
"MIT"
] | 216 | 2016-06-28T18:44:28.000Z | 2022-03-26T10:24:03.000Z | src/csharp/CSharpTemplate.py | slash-under/codenn | 747a7c5c6788256cdb1564d0936b5ea91f43ba6c | [
"MIT"
] | 17 | 2016-07-22T23:43:27.000Z | 2021-06-09T16:36:54.000Z | src/csharp/CSharpTemplate.py | slash-under/codenn | 747a7c5c6788256cdb1564d0936b5ea91f43ba6c | [
"MIT"
] | 86 | 2016-07-02T06:56:31.000Z | 2021-09-14T06:24:46.000Z |
import antlr4
from csharp.CSharp4Lexer import CSharp4Lexer
import re
def parseCSharp(code):
code = code.replace('\\n', '\n')
parsedVersion = []
stream = antlr4.InputStream(code)
lexer = CSharp4Lexer(stream)
toks = antlr4.CommonTokenStream(lexer)
toks.fetch(500)
identifiers = {}
identCount = 0
for t... | 32.52381 | 201 | 0.635432 |
import antlr4
from csharp.CSharp4Lexer import CSharp4Lexer
import re
def parseCSharp(code):
code = code.replace('\\n', '\n')
parsedVersion = []
stream = antlr4.InputStream(code)
lexer = CSharp4Lexer(stream)
toks = antlr4.CommonTokenStream(lexer)
toks.fetch(500)
identifiers = {}
identCount = 0
for t... | false | true |
f724849d81b90b9dba25cf9ce12481c3d66b2f7c | 38,765 | py | Python | airflow/models/baseoperator.py | subrays/airflow | 3c8c0b3b6411762a4e4977e519374d9fb16b541d | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | null | null | null | airflow/models/baseoperator.py | subrays/airflow | 3c8c0b3b6411762a4e4977e519374d9fb16b541d | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | null | null | null | airflow/models/baseoperator.py | subrays/airflow | 3c8c0b3b6411762a4e4977e519374d9fb16b541d | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
#
# 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
#... | 38.765 | 102 | 0.629176 |
from abc import ABCMeta, abstractmethod
from cached_property import cached_property
import copy
import functools
import logging
import sys
import warnings
from datetime import timedelta, datetime
from typing import Callable, Dict, Iterable, List, Optional, Set
import jinja2
import six
from airflow ... | true | true |
f72484a7592ee8ca18c8b0897a938b18606428a4 | 6,800 | py | Python | bindings/python/ensmallen_graph/datasets/string/paraprevotellaxylaniphila.py | caufieldjh/ensmallen_graph | 14e98b1cdbc73193a84a913d7d4f2b2b3eb2c43a | [
"MIT"
] | null | null | null | bindings/python/ensmallen_graph/datasets/string/paraprevotellaxylaniphila.py | caufieldjh/ensmallen_graph | 14e98b1cdbc73193a84a913d7d4f2b2b3eb2c43a | [
"MIT"
] | null | null | null | bindings/python/ensmallen_graph/datasets/string/paraprevotellaxylaniphila.py | caufieldjh/ensmallen_graph | 14e98b1cdbc73193a84a913d7d4f2b2b3eb2c43a | [
"MIT"
] | null | null | null | """
This file offers the methods to automatically retrieve the graph Paraprevotella xylaniphila.
The graph is automatically retrieved from the STRING repository.
Report
---------------------
At the time of rendering these methods (please see datetime below), the graph
had the following characteristics:
Datetime: ... | 35.602094 | 223 | 0.708529 | from typing import Dict
from ..automatic_graph_retrieval import AutomaticallyRetrievedGraph
from ...ensmallen_graph import EnsmallenGraph
def ParaprevotellaXylaniphila(
directed: bool = False,
verbose: int = 2,
cache_path: str = "graphs/string",
**additional_graph_kwargs: Dict
) -> EnsmallenGraph:
... | true | true |
f72484fc095b2c9a1f53f18824e2c7709dcae682 | 874 | py | Python | spec_parser/spec_parser/util.py | Parnassius/domify | 262a9b9bf68fd627d963f23abb68c06f424180f2 | [
"MIT"
] | null | null | null | spec_parser/spec_parser/util.py | Parnassius/domify | 262a9b9bf68fd627d963f23abb68c06f424180f2 | [
"MIT"
] | 5 | 2022-03-01T19:53:28.000Z | 2022-03-28T01:32:30.000Z | spec_parser/spec_parser/util.py | Parnassius/domify | 262a9b9bf68fd627d963f23abb68c06f424180f2 | [
"MIT"
] | 1 | 2021-11-08T20:36:36.000Z | 2021-11-08T20:36:36.000Z | from typing import Dict, List
import requests
from bs4 import BeautifulSoup # type: ignore[import]
class _RequestCache:
def __init__(self) -> None:
self._cache: Dict[str, BeautifulSoup] = {}
def __call__(self, page: str) -> BeautifulSoup:
if page.endswith(".html"):
page = page[:... | 26.484848 | 83 | 0.621281 | from typing import Dict, List
import requests
from bs4 import BeautifulSoup
class _RequestCache:
def __init__(self) -> None:
self._cache: Dict[str, BeautifulSoup] = {}
def __call__(self, page: str) -> BeautifulSoup:
if page.endswith(".html"):
page = page[:-5]
if page no... | true | true |
f72485a6ca32241a57f395404a0c19eded7aae2d | 415 | py | Python | Data_Structures/Maps_Hash_Dict/DivisiblePairCount2.py | neha07kumari/algo_ds_101 | b5f87feb4aac5ad45d934a609e7e73eedf280f10 | [
"MIT"
] | 1 | 2022-02-11T19:25:01.000Z | 2022-02-11T19:25:01.000Z | Data_Structures/Maps_Hash_Dict/DivisiblePairCount2.py | neha07kumari/algo_ds_101 | b5f87feb4aac5ad45d934a609e7e73eedf280f10 | [
"MIT"
] | 2 | 2020-10-13T06:49:54.000Z | 2020-10-17T07:16:37.000Z | Data_Structures/Maps_Hash_Dict/DivisiblePairCount2.py | neha07kumari/algo_ds_101 | b5f87feb4aac5ad45d934a609e7e73eedf280f10 | [
"MIT"
] | 14 | 2020-10-13T04:20:57.000Z | 2021-10-01T16:16:13.000Z | def DivisiblePairCount(arr) :
count = 0
k = len(arr)
for i in range(0, k):
for j in range(i+1, k):
if (arr[i] % arr[j] == 0 or arr[j] % arr[i] == 0):
count += 1
return count
if __name__ == "__main__":
#give input in form of a list -- [1,2,3]
arr = [int... | 24.411765 | 73 | 0.508434 | def DivisiblePairCount(arr) :
count = 0
k = len(arr)
for i in range(0, k):
for j in range(i+1, k):
if (arr[i] % arr[j] == 0 or arr[j] % arr[i] == 0):
count += 1
return count
if __name__ == "__main__":
arr = [int(item) for item in ''.join(list(input())... | true | true |
f72485e95740971bc6b7f5bd9e29a91909acdc48 | 92 | py | Python | project_mysql/sales/modelsa.py | righ/djangomodel2alchemymap | c156cd14ff7bfd7d858449819072c18059ecdcd0 | [
"MIT"
] | 17 | 2019-08-20T16:58:18.000Z | 2022-01-15T05:00:52.000Z | project_mysql/sales/modelsa.py | righ/djangomodel2alchemymap | c156cd14ff7bfd7d858449819072c18059ecdcd0 | [
"MIT"
] | 4 | 2020-06-02T00:14:38.000Z | 2021-10-14T16:45:13.000Z | project_mysql/sales/modelsa.py | righ/djangomodel2alchemymap | c156cd14ff7bfd7d858449819072c18059ecdcd0 | [
"MIT"
] | 2 | 2019-12-17T13:15:48.000Z | 2021-04-27T09:09:46.000Z | from d2a import transfer
from . import models
transfer(models, globals(), db_type='mysql')
| 18.4 | 44 | 0.76087 | from d2a import transfer
from . import models
transfer(models, globals(), db_type='mysql')
| true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.