hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 958k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f76db338e0e03057b705055df28127aa95b5de6f | 14,984 | py | Python | selftrainingCT.py | TencentYoutuResearch/PersonReID-ACT | 264b1b43f9424c297638ebf6f8f8ace09512ed29 | [
"MIT"
] | 16 | 2021-01-04T03:32:12.000Z | 2022-01-24T05:04:20.000Z | selftrainingCT.py | TencentYoutuResearch/PersonReID-ACT | 264b1b43f9424c297638ebf6f8f8ace09512ed29 | [
"MIT"
] | 1 | 2021-03-09T08:46:23.000Z | 2021-03-09T08:52:42.000Z | selftrainingCT.py | TencentYoutuResearch/PersonReID-ACT | 264b1b43f9424c297638ebf6f8f8ace09512ed29 | [
"MIT"
] | 2 | 2021-01-08T08:31:15.000Z | 2021-02-04T02:06:49.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import
import argparse
import time
import os.path as osp
import os
import numpy as np
import torch
from torch import nn
from torch.nn import init
from torch.backends import cudnn
from torch.utils.data import DataLoader
from ... | 41.392265 | 120 | 0.638014 |
from __future__ import print_function, absolute_import
import argparse
import time
import os.path as osp
import os
import numpy as np
import torch
from torch import nn
from torch.nn import init
from torch.backends import cudnn
from torch.utils.data import DataLoader
from reid import datasets
from reid import models
fr... | true | true |
f76db34e730ff83f22a589ff3359a5be8f03be72 | 2,223 | py | Python | backend/testride_1_32770/urls.py | crowdbotics-apps/testride-1-32770 | fe6c0b11ac674828128b92b5976f4625501b8cc1 | [
"FTL",
"AML",
"RSA-MD"
] | null | null | null | backend/testride_1_32770/urls.py | crowdbotics-apps/testride-1-32770 | fe6c0b11ac674828128b92b5976f4625501b8cc1 | [
"FTL",
"AML",
"RSA-MD"
] | null | null | null | backend/testride_1_32770/urls.py | crowdbotics-apps/testride-1-32770 | fe6c0b11ac674828128b92b5976f4625501b8cc1 | [
"FTL",
"AML",
"RSA-MD"
] | null | null | null | """testride_1_32770 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Cl... | 35.285714 | 87 | 0.711651 |
from django.contrib import admin
from django.urls import path, include, re_path
from django.views.generic.base import TemplateView
from allauth.account.views import confirm_email
from rest_framework import permissions
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
urlpatterns = [
path("",... | true | true |
f76db521d3a30bb34f60901ce3e825ef0c54b443 | 434 | py | Python | fast_rake/tests/test_custom_stopword.py | christophsk/fast-rake | dde99d37b116fa349edc9a6ea1574515f689a65d | [
"MIT"
] | null | null | null | fast_rake/tests/test_custom_stopword.py | christophsk/fast-rake | dde99d37b116fa349edc9a6ea1574515f689a65d | [
"MIT"
] | null | null | null | fast_rake/tests/test_custom_stopword.py | christophsk/fast-rake | dde99d37b116fa349edc9a6ea1574515f689a65d | [
"MIT"
] | null | null | null | """
Single stop word
"""
import pytest
from fast_rake import Rake
@pytest.mark.parametrize("stop_name", ["google", "nltk", "sklearn", "smart"])
def test_custom_stopword(text, stop_name):
custom_stopwords = ["minimal", "linear"]
rake = Rake(stopword_name=stop_name, custom_stopwords=custom_stopwords)
kw = ... | 25.529412 | 77 | 0.700461 | import pytest
from fast_rake import Rake
@pytest.mark.parametrize("stop_name", ["google", "nltk", "sklearn", "smart"])
def test_custom_stopword(text, stop_name):
custom_stopwords = ["minimal", "linear"]
rake = Rake(stopword_name=stop_name, custom_stopwords=custom_stopwords)
kw = rake(text)
assert Tru... | true | true |
f76db568e38f2e4f94ae85995f0c0033ebeb59e2 | 2,206 | py | Python | tests/unit/test_rbac_resolvers_key_value_pair.py | cognifloyd/st2-open-rbac | fb3251223743e497267277fe9f5cef91f41ade34 | [
"Apache-2.0"
] | null | null | null | tests/unit/test_rbac_resolvers_key_value_pair.py | cognifloyd/st2-open-rbac | fb3251223743e497267277fe9f5cef91f41ade34 | [
"Apache-2.0"
] | null | null | null | tests/unit/test_rbac_resolvers_key_value_pair.py | cognifloyd/st2-open-rbac | fb3251223743e497267277fe9f5cef91f41ade34 | [
"Apache-2.0"
] | null | null | null | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | 40.851852 | 99 | 0.757026 |
from __future__ import absolute_import
from st2common.rbac.types import PermissionType
from st2common.rbac.types import ResourceType
from st2common.persistence.keyvalue import KeyValuePair
from st2common.models.db.keyvalue import KeyValuePairDB
from open_rbac.backend import KeyValuePermissionsResolver
from tests.unit.... | true | true |
f76db733c4e19669cfe20356513d45b81a204cd4 | 14,987 | py | Python | grit/format/policy_templates/writers/plist_writer_unittest.py | bpsinc-native/src_tools_grit | 206c6aa4450db4e961d20f8367f33df42bba6a85 | [
"BSD-2-Clause"
] | null | null | null | grit/format/policy_templates/writers/plist_writer_unittest.py | bpsinc-native/src_tools_grit | 206c6aa4450db4e961d20f8367f33df42bba6a85 | [
"BSD-2-Clause"
] | null | null | null | grit/format/policy_templates/writers/plist_writer_unittest.py | bpsinc-native/src_tools_grit | 206c6aa4450db4e961d20f8367f33df42bba6a85 | [
"BSD-2-Clause"
] | null | null | null | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
'''Unit tests for grit.format.policy_templates.writers.plist_writer'''
import os
import sys
if __name__ == '__main__':
sys.path... | 28.224105 | 104 | 0.479682 |
import os
import sys
if __name__ == '__main__':
sys.path.append(os.path.join(os.path.dirname(__file__), '../../../..'))
import unittest
from grit.format.policy_templates.writers import writer_unittest_common
class PListWriterUnittest(writer_unittest_common.WriterUnittestCommon):
def _GetExpectedOutputs(self... | true | true |
f76db7433d995ce25140229a14c67af6d8d1b498 | 168 | py | Python | booking/wsgi.py | SanyaDeath/liis-ngng-booking | d81bc70606e1b11641e9a7fd4ce64f9434f7cefb | [
"BSD-3-Clause"
] | null | null | null | booking/wsgi.py | SanyaDeath/liis-ngng-booking | d81bc70606e1b11641e9a7fd4ce64f9434f7cefb | [
"BSD-3-Clause"
] | null | null | null | booking/wsgi.py | SanyaDeath/liis-ngng-booking | d81bc70606e1b11641e9a7fd4ce64f9434f7cefb | [
"BSD-3-Clause"
] | null | null | null | import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'booking.settings')
application = get_wsgi_application()
| 21 | 67 | 0.827381 | import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'booking.settings')
application = get_wsgi_application()
| true | true |
f76db75e5ea50db1522a8239e99003018aec6242 | 8,521 | py | Python | docs/source/conf.py | garnaat/botocore | 157ae7e9e2d8b23c7e0f8694f4354fe80791f0d3 | [
"Apache-2.0"
] | null | null | null | docs/source/conf.py | garnaat/botocore | 157ae7e9e2d8b23c7e0f8694f4354fe80791f0d3 | [
"Apache-2.0"
] | null | null | null | docs/source/conf.py | garnaat/botocore | 157ae7e9e2d8b23c7e0f8694f4354fe80791f0d3 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
#
# botocore documentation build configuration file, created by
# sphinx-quickstart on Sun Dec 2 07:26:23 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.
#
# Al... | 32.033835 | 80 | 0.717169 |
import sys, os
from botocore.session import get_session
from botocore.docs import generate_docs
generate_docs(os.path.dirname(os.path.abspath(__file__)), get_session())
extensions = ['sphinx.ext.autodoc']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'botocore'
copyri... | true | true |
f76db7838c51dcb19a478d47bfc92ed1e0c7ed2d | 2,561 | py | Python | great_expectations/data_context/store/checkpoint_store.py | sushrut9898/great_expectations | 3adad1262b2bef2be585238dd71fb61a8896bb9c | [
"Apache-2.0"
] | 2 | 2022-01-28T15:51:32.000Z | 2022-02-02T05:07:58.000Z | great_expectations/data_context/store/checkpoint_store.py | sushrut9898/great_expectations | 3adad1262b2bef2be585238dd71fb61a8896bb9c | [
"Apache-2.0"
] | null | null | null | great_expectations/data_context/store/checkpoint_store.py | sushrut9898/great_expectations | 3adad1262b2bef2be585238dd71fb61a8896bb9c | [
"Apache-2.0"
] | null | null | null | import json
import logging
import random
from typing import Dict
from great_expectations.data_context.store import ConfigurationStore
from great_expectations.data_context.types.base import CheckpointConfig
from great_expectations.data_context.types.resource_identifiers import (
ConfigurationIdentifier,
)
logger =... | 36.070423 | 112 | 0.678251 | import json
import logging
import random
from typing import Dict
from great_expectations.data_context.store import ConfigurationStore
from great_expectations.data_context.types.base import CheckpointConfig
from great_expectations.data_context.types.resource_identifiers import (
ConfigurationIdentifier,
)
logger =... | true | true |
f76db7d6a8876ba1eb088ecd05ef0e4d3df748ce | 1,997 | py | Python | hc/front/tests/test_add_sms.py | Lemmah/healthchecks-clone | 7341ca89757950868c0d24debd7618349f25b094 | [
"BSD-3-Clause"
] | null | null | null | hc/front/tests/test_add_sms.py | Lemmah/healthchecks-clone | 7341ca89757950868c0d24debd7618349f25b094 | [
"BSD-3-Clause"
] | 2 | 2020-06-05T19:20:35.000Z | 2021-06-10T20:55:28.000Z | hc/front/tests/test_add_sms.py | cogzidel/yourhealthchecks | a17315b523beef2e56e657227103212082aa84a7 | [
"BSD-3-Clause"
] | 1 | 2021-05-21T19:50:52.000Z | 2021-05-21T19:50:52.000Z | from django.test.utils import override_settings
from hc.api.models import Channel
from hc.test import BaseTestCase
@override_settings(TWILIO_ACCOUNT="foo", TWILIO_AUTH="foo", TWILIO_FROM="123")
class AddSmsTestCase(BaseTestCase):
url = "/integrations/add_sms/"
def test_instructions_work(self):
self.c... | 35.660714 | 78 | 0.670005 | from django.test.utils import override_settings
from hc.api.models import Channel
from hc.test import BaseTestCase
@override_settings(TWILIO_ACCOUNT="foo", TWILIO_AUTH="foo", TWILIO_FROM="123")
class AddSmsTestCase(BaseTestCase):
url = "/integrations/add_sms/"
def test_instructions_work(self):
self.c... | true | true |
f76db899cda5c826f9dc230a898b08c85b2dead5 | 13,821 | py | Python | utils.py | Diego-II/Datadriven-GPVAD | ef033eb317553dc60464e07d8b5ba4f67bcf4a8d | [
"MIT"
] | 60 | 2021-02-12T23:47:08.000Z | 2022-03-29T15:32:15.000Z | utils.py | Diego-II/Datadriven-GPVAD | ef033eb317553dc60464e07d8b5ba4f67bcf4a8d | [
"MIT"
] | 11 | 2021-05-13T07:03:02.000Z | 2022-01-24T12:36:38.000Z | utils.py | Diego-II/Datadriven-GPVAD | ef033eb317553dc60464e07d8b5ba4f67bcf4a8d | [
"MIT"
] | 9 | 2021-05-11T02:59:43.000Z | 2022-02-07T09:46:49.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import collections
import sys
from loguru import logger
from pprint import pformat
from typing import List
import numpy as np
import pandas as pd
import scipy
import six
import sklearn.preprocessing as pre
import torch
import tqdm
import yaml
import augment
import datase... | 32.52 | 169 | 0.653932 |
import collections
import sys
from loguru import logger
from pprint import pformat
from typing import List
import numpy as np
import pandas as pd
import scipy
import six
import sklearn.preprocessing as pre
import torch
import tqdm
import yaml
import augment
import dataset
DEFAULT_ARGS = {
'outputpath': 'experim... | true | true |
f76db980aa413b044c05a335d5181646dd072deb | 260,838 | py | Python | instances/passenger_demand/pas-20210422-1717-int14000000000000001e/50.py | LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure | bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11 | [
"BSD-3-Clause"
] | null | null | null | instances/passenger_demand/pas-20210422-1717-int14000000000000001e/50.py | LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure | bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11 | [
"BSD-3-Clause"
] | null | null | null | instances/passenger_demand/pas-20210422-1717-int14000000000000001e/50.py | LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure | bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11 | [
"BSD-3-Clause"
] | null | null | null |
"""
PASSENGERS
"""
numPassengers = 26956
passenger_arriving = (
(8, 5, 7, 6, 3, 4, 2, 0, 2, 0, 0, 0, 0, 10, 8, 3, 6, 4, 2, 4, 3, 1, 3, 1, 3, 0), # 0
(13, 9, 4, 9, 2, 2, 4, 2, 1, 2, 0, 0, 0, 6, 6, 5, 2, 3, 2, 1, 0, 4, 2, 0, 1, 0), # 1
(7, 3, 7, 13, 11, 6, 4, 3, 3, 1, 1, 0, 0, 10, 7, 6, 4, 4, 6, 3, 1, 5, 2, 1, 1,... | 278.971123 | 492 | 0.771797 |
numPassengers = 26956
passenger_arriving = (
(8, 5, 7, 6, 3, 4, 2, 0, 2, 0, 0, 0, 0, 10, 8, 3, 6, 4, 2, 4, 3, 1, 3, 1, 3, 0), (13, 9, 4, 9, 2, 2, 4, 2, 1, 2, 0, 0, 0, 6, 6, 5, 2, 3, 2, 1, 0, 4, 2, 0, 1, 0), (7, 3, 7, 13, 11, 6, 4, 3, 3, 1, 1, 0, 0, 10, 7, 6, 4, 4, 6, 3, 1, 5, 2, 1, 1, 0), (15, 11, 9, 3, 6, 5, 3,... | true | true |
f76db9d9047afcd22814c1c8ba0659a389ddbb14 | 4,047 | py | Python | tests/rest/test_evidence_list_by_document.py | UniStuttgart-VISUS/damast | 05ceb150e86227d81f0f4bb441af6d4f8bce65ee | [
"MIT"
] | 2 | 2021-12-22T17:01:02.000Z | 2022-01-18T17:05:48.000Z | tests/rest/test_evidence_list_by_document.py | UniStuttgart-VISUS/damast | 05ceb150e86227d81f0f4bb441af6d4f8bce65ee | [
"MIT"
] | 94 | 2021-12-22T11:21:57.000Z | 2022-03-31T22:40:56.000Z | tests/rest/test_evidence_list_by_document.py | UniStuttgart-VISUS/damast | 05ceb150e86227d81f0f4bb441af6d4f8bce65ee | [
"MIT"
] | 1 | 2022-01-04T09:04:47.000Z | 2022-01-04T09:04:47.000Z | import pytest
import re
import psycopg2.extras
import damast
from damast.postgres_rest_api.util import NumericRangeEncoder
import flask
import json
from functools import namedtuple
from conftest import get_headers
from database.testdata import annotation_table, document_table, evidence_table, person_instance_table, pl... | 38.542857 | 166 | 0.668396 | import pytest
import re
import psycopg2.extras
import damast
from damast.postgres_rest_api.util import NumericRangeEncoder
import flask
import json
from functools import namedtuple
from conftest import get_headers
from database.testdata import annotation_table, document_table, evidence_table, person_instance_table, pl... | true | true |
f76dbaaa77984dcd07e86e76bd96dabb22f736ee | 317 | py | Python | yeahp-backend/yeahp/element.py | flaudanum/Yet-another-AHP | 6eba8a842156ce1651c8dbe243034427f72361d9 | [
"MIT"
] | null | null | null | yeahp-backend/yeahp/element.py | flaudanum/Yet-another-AHP | 6eba8a842156ce1651c8dbe243034427f72361d9 | [
"MIT"
] | null | null | null | yeahp-backend/yeahp/element.py | flaudanum/Yet-another-AHP | 6eba8a842156ce1651c8dbe243034427f72361d9 | [
"MIT"
] | null | null | null | # coding: UTF-8
"""
Definition of class Element
"""
class Element:
@property
def description(self):
"""
:return: Description of the element
:rtype: :obj:`str`
"""
return self._description
def __init__(self, description):
self._description = description
| 16.684211 | 43 | 0.589905 |
class Element:
@property
def description(self):
return self._description
def __init__(self, description):
self._description = description
| true | true |
f76dbab6dad752dfed03f4b7c9620c70f55045e2 | 1,418 | py | Python | broker/eblocbroker_scripts/update_data_price.py | ebloc/ebloc-broker | 776a8d9d4642ed1ba4726c94da68d61bd81c098b | [
"MIT"
] | 3 | 2021-12-11T19:26:57.000Z | 2021-12-30T00:17:23.000Z | broker/eblocbroker_scripts/update_data_price.py | ebloc/ebloc-broker | 776a8d9d4642ed1ba4726c94da68d61bd81c098b | [
"MIT"
] | null | null | null | broker/eblocbroker_scripts/update_data_price.py | ebloc/ebloc-broker | 776a8d9d4642ed1ba4726c94da68d61bd81c098b | [
"MIT"
] | 1 | 2021-09-18T11:38:07.000Z | 2021-09-18T11:38:07.000Z | #!/usr/bin/env python3
from broker import cfg
from broker._utils.tools import log
from broker._utils.web3_tools import get_tx_status
from broker.config import env
from broker.errors import QuietExit
from broker.utils import print_tb
def _update_data_price():
Ebb = cfg.Ebb
if not Ebb.does_provider_exist(env.P... | 30.170213 | 105 | 0.703808 |
from broker import cfg
from broker._utils.tools import log
from broker._utils.web3_tools import get_tx_status
from broker.config import env
from broker.errors import QuietExit
from broker.utils import print_tb
def _update_data_price():
Ebb = cfg.Ebb
if not Ebb.does_provider_exist(env.PROVIDER_ID):
lo... | true | true |
f76dbab7b84c0ea2144dc04b04793890b3e37c64 | 269 | py | Python | src/manager/__init__.py | DeepLearnPhysics/larcv-viewer | 5d5eb65e409e80a2ee229464bb7b714deec05462 | [
"MIT"
] | 1 | 2021-07-13T13:34:20.000Z | 2021-07-13T13:34:20.000Z | src/manager/__init__.py | DeepLearnPhysics/larcv-viewer | 5d5eb65e409e80a2ee229464bb7b714deec05462 | [
"MIT"
] | 3 | 2018-01-17T16:13:23.000Z | 2018-01-17T17:28:02.000Z | src/manager/__init__.py | DeepLearnPhysics/larcv-viewer | 5d5eb65e409e80a2ee229464bb7b714deec05462 | [
"MIT"
] | 1 | 2019-09-24T20:43:01.000Z | 2019-09-24T20:43:01.000Z | from .event_meta import event_meta
from .evd_manager_base import evd_manager_base
from .evd_manager_2D import evd_manager_2D
from .evd_manager_3D import evd_manager_3D
try:
import pyqtgraph.opengl as gl
# from .evdmanager import evd_manager_3D
except:
pass
| 26.9 | 46 | 0.817844 | from .event_meta import event_meta
from .evd_manager_base import evd_manager_base
from .evd_manager_2D import evd_manager_2D
from .evd_manager_3D import evd_manager_3D
try:
import pyqtgraph.opengl as gl
except:
pass
| true | true |
f76dbbb0d9d0fd284d527ae6b64d175283628650 | 843 | py | Python | textworld/envs/wrappers/limit.py | JohnnySun8/TextWorld | 9a54e9d642f7605a0f3ebba3285cdd04047975e2 | [
"MIT"
] | 307 | 2019-05-07T01:51:55.000Z | 2022-03-31T19:35:47.000Z | textworld/envs/wrappers/limit.py | JohnnySun8/TextWorld | 9a54e9d642f7605a0f3ebba3285cdd04047975e2 | [
"MIT"
] | 84 | 2019-05-08T14:24:36.000Z | 2022-03-31T14:35:16.000Z | textworld/envs/wrappers/limit.py | JohnnySun8/TextWorld | 9a54e9d642f7605a0f3ebba3285cdd04047975e2 | [
"MIT"
] | 70 | 2019-05-21T21:36:56.000Z | 2022-02-28T12:04:27.000Z | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
from typing import Tuple, Mapping, Any
from textworld.core import Environment, Wrapper
class Limit(Wrapper):
"""
Environment wrapper to limit the number of steps.
"""
def __init__(self, env: Environment,... | 27.193548 | 66 | 0.655991 |
from typing import Tuple, Mapping, Any
from textworld.core import Environment, Wrapper
class Limit(Wrapper):
def __init__(self, env: Environment, max_episode_steps: int):
super().__init__(env)
self.max_episode_steps = max_episode_steps
self.nb_steps = 0
def reset(self) -> Tuple[st... | true | true |
f76dbe590db9aaab1d4b280a07d8ac1186410d38 | 681 | py | Python | profiles_api/permissions.py | hjquiroga/profiles-rest-api | 2d62bafb69d4a0dd7ed401e13e490c4d7fd697b3 | [
"MIT"
] | null | null | null | profiles_api/permissions.py | hjquiroga/profiles-rest-api | 2d62bafb69d4a0dd7ed401e13e490c4d7fd697b3 | [
"MIT"
] | null | null | null | profiles_api/permissions.py | hjquiroga/profiles-rest-api | 2d62bafb69d4a0dd7ed401e13e490c4d7fd697b3 | [
"MIT"
] | null | null | null | from rest_framework import permissions
class UpdateOwnProfile(permissions.BasePermission):
"""Allow users to edit their own profile"""
def has_object_permission(self, request, view, obj):
"""Check user is trying to edit their own profile"""
if request.method in permissions.SAFE_METHODS:
... | 30.954545 | 60 | 0.69163 | from rest_framework import permissions
class UpdateOwnProfile(permissions.BasePermission):
def has_object_permission(self, request, view, obj):
if request.method in permissions.SAFE_METHODS:
return True
return obj.id == request.user.id
class UpdateOwnStatus(permissions.BasePermissio... | true | true |
f76dbe6dfffa6190160b042bf2883a2b0328339e | 1,269 | py | Python | _33_34_EXAM_PREPARATION/9_08_2019_Retake/_1_Username.py | YordanPetrovDS/Python_Fundamentals | 81163054cd3ac780697eaa43f099cc455f253a0c | [
"MIT"
] | null | null | null | _33_34_EXAM_PREPARATION/9_08_2019_Retake/_1_Username.py | YordanPetrovDS/Python_Fundamentals | 81163054cd3ac780697eaa43f099cc455f253a0c | [
"MIT"
] | null | null | null | _33_34_EXAM_PREPARATION/9_08_2019_Retake/_1_Username.py | YordanPetrovDS/Python_Fundamentals | 81163054cd3ac780697eaa43f099cc455f253a0c | [
"MIT"
] | null | null | null | username = input()
input_command = input()
while input_command != "Sign up":
tokens = input_command.split()
command = tokens[0]
if command == "Case":
case = tokens[1]
if case == "lower":
username = username.lower()
else:
username = username.upper()
pr... | 31.725 | 76 | 0.564224 | username = input()
input_command = input()
while input_command != "Sign up":
tokens = input_command.split()
command = tokens[0]
if command == "Case":
case = tokens[1]
if case == "lower":
username = username.lower()
else:
username = username.upper()
pr... | true | true |
f76dc06bde30df1c666016c6723a6510e85850cc | 1,939 | py | Python | zhangwei_helper/function/WindowsService.py | zwzw911/zhangwei_helper | 8696533f5df50464d619a35834ec19d514a1b13b | [
"MIT"
] | null | null | null | zhangwei_helper/function/WindowsService.py | zwzw911/zhangwei_helper | 8696533f5df50464d619a35834ec19d514a1b13b | [
"MIT"
] | null | null | null | zhangwei_helper/function/WindowsService.py | zwzw911/zhangwei_helper | 8696533f5df50464d619a35834ec19d514a1b13b | [
"MIT"
] | null | null | null | #! /usr/bin/env python3
# -*- coding:utf-8 -*-
'''
if_service_exists(): Boolean:服务是否存在
if_service_running(): Booleans:服务是否运行
start_run_service(): 无法以admin运行
'''
import os, subprocess, time
import ctypes, sys
# from tool import bat
import zhangwei_helper.function.Os as self_os
import zhangwei_helper.enum.SelfEnum as sel... | 33.431034 | 83 | 0.570913 | import os, subprocess, time
import ctypes, sys
import zhangwei_helper.function.Os as self_os
import zhangwei_helper.enum.SelfEnum as self_enum
def if_service_exists(service='MySQL'):
task = subprocess.Popen('sc query state= all | find /i "DISPLAY_NAME: %s"'
% service,
... | true | true |
f76dc26d0ab2dceb4dabfac844545590ff7d5635 | 12,546 | py | Python | cunet/ftanet/evaluator.py | genisplaja/cunet | 58a200c84810f20099265e30200327eefddb3eff | [
"AFL-3.0"
] | null | null | null | cunet/ftanet/evaluator.py | genisplaja/cunet | 58a200c84810f20099265e30200327eefddb3eff | [
"AFL-3.0"
] | null | null | null | cunet/ftanet/evaluator.py | genisplaja/cunet | 58a200c84810f20099265e30200327eefddb3eff | [
"AFL-3.0"
] | null | null | null | import re
import numpy as np
import pandas as pd
import numpy
import glob
from tqdm import tqdm
import random
import pickle
from numpy.core.fromnumeric import std
import mir_eval
from cfp import cfp_process
from tensorflow import keras
import os
import tensorflow as tf
from tensorflow.keras import backe... | 35.044693 | 117 | 0.620835 | import re
import numpy as np
import pandas as pd
import numpy
import glob
from tqdm import tqdm
import random
import pickle
from numpy.core.fromnumeric import std
import mir_eval
from cfp import cfp_process
from tensorflow import keras
import os
import tensorflow as tf
from tensorflow.keras import backe... | true | true |
f76dc29c633ea91e016bb1306ee2634ad3ba767d | 12,183 | py | Python | GoogleScraper/scrape_config.py | seraph115/GoogleScraper | 4bb6db2f941f606d8373110e496c8745f7882ef0 | [
"Apache-2.0"
] | null | null | null | GoogleScraper/scrape_config.py | seraph115/GoogleScraper | 4bb6db2f941f606d8373110e496c8745f7882ef0 | [
"Apache-2.0"
] | null | null | null | GoogleScraper/scrape_config.py | seraph115/GoogleScraper | 4bb6db2f941f606d8373110e496c8745f7882ef0 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""
This is the basic GoogleScraper configuration file.
All options are basic Python data types. You may use all of Python's language
capabilities to specify settings in this file.
"""
"""
[OUTPUT]
Settings which control how GoogleScraper represents it's results
and handles output.
"""
# How... | 31.644156 | 117 | 0.742674 |
print_results = 'all'
database_name = 'google_scraper'
output_filename = ''
# Whether sqlalchemy should log all stuff to stdout
# useful for devs. Don't set this to True if you don't know
# what you are doing.
log_sqlalchemy = False
# Set the debug level of the application. Use the string representation
# instea... | true | true |
f76dc2cbfee057cdbb76ab87638d1d8f23a4dedf | 4,769 | py | Python | src/ftd/offset.py | FabienTaxil/ftd | a36e0ca59eb60e216a5de1eb93d1089a7f080ec7 | [
"MIT"
] | 3 | 2022-01-26T23:43:16.000Z | 2022-02-11T07:50:49.000Z | src/ftd/offset.py | lixaft/ftd | a36e0ca59eb60e216a5de1eb93d1089a7f080ec7 | [
"MIT"
] | null | null | null | src/ftd/offset.py | lixaft/ftd | a36e0ca59eb60e216a5de1eb93d1089a7f080ec7 | [
"MIT"
] | null | null | null | """Provide utilities related to offsets."""
import logging
import math
from maya import cmds
from maya.api import OpenMaya
import ftd.attribute
import ftd.connection
__all__ = [
"group",
"inverse_group",
"matrix",
"matrix_to_group",
"reset_matrix",
"unmatrix",
]
LOG = logging.getLogger(__nam... | 30.570513 | 79 | 0.623191 | import logging
import math
from maya import cmds
from maya.api import OpenMaya
import ftd.attribute
import ftd.connection
__all__ = [
"group",
"inverse_group",
"matrix",
"matrix_to_group",
"reset_matrix",
"unmatrix",
]
LOG = logging.getLogger(__name__)
def group(node, suffix="offset"):
... | true | true |
f76dc3274e4b15ecd73b6617589a51d2db2ab135 | 457 | py | Python | setup.py | mekhti/t4Playout | 1e45c93b48d4ce12c345108a5b2e31d33e395b24 | [
"MIT"
] | null | null | null | setup.py | mekhti/t4Playout | 1e45c93b48d4ce12c345108a5b2e31d33e395b24 | [
"MIT"
] | 2 | 2019-12-18T00:05:30.000Z | 2020-07-09T07:42:02.000Z | setup.py | mekhti/t4Playout | 1e45c93b48d4ce12c345108a5b2e31d33e395b24 | [
"MIT"
] | null | null | null | from setuptools import setup
setup(
name='t4Playout',
version='0.1',
packages=['conf', 'Playout', 'Playout.Apps', 'Playout.Admin', 'Playout.Tests', 'Playout.Views', 'Playout.Models',
'Playout.management', 'Playout.management.commands', 'Playout.migrations', 't4Playout'],
url='https://www.... | 32.642857 | 117 | 0.656455 | from setuptools import setup
setup(
name='t4Playout',
version='0.1',
packages=['conf', 'Playout', 'Playout.Apps', 'Playout.Admin', 'Playout.Tests', 'Playout.Views', 'Playout.Models',
'Playout.management', 'Playout.management.commands', 'Playout.migrations', 't4Playout'],
url='https://www.... | true | true |
f76dc39c1494c9340f3b5bfe6b309c48b8530925 | 162 | py | Python | anuvaad-etl/anuvaad-extractor/document-processor/ocr/ocr-tesseract-server/src/utilities/app_context.py | srihari-nagaraj/anuvaad | b09b01a033a033e97db6e404c088e0e6332053e4 | [
"MIT"
] | null | null | null | anuvaad-etl/anuvaad-extractor/document-processor/ocr/ocr-tesseract-server/src/utilities/app_context.py | srihari-nagaraj/anuvaad | b09b01a033a033e97db6e404c088e0e6332053e4 | [
"MIT"
] | null | null | null | anuvaad-etl/anuvaad-extractor/document-processor/ocr/ocr-tesseract-server/src/utilities/app_context.py | srihari-nagaraj/anuvaad | b09b01a033a033e97db6e404c088e0e6332053e4 | [
"MIT"
] | null | null | null |
LOG_WITHOUT_CONTEXT = {'metadata':{'module':'Tesseract-OCR'}}
def init():
global app_context
app_context = {
'application_context' : None
}
| 18 | 61 | 0.635802 |
LOG_WITHOUT_CONTEXT = {'metadata':{'module':'Tesseract-OCR'}}
def init():
global app_context
app_context = {
'application_context' : None
}
| true | true |
f76dc4e2dad20395849c5f9d28ce1de9256d3b42 | 9,532 | py | Python | cat9kthousandeyesctl/thousandeyes/__init__.py | CiscoSE/cat9kthousandeyesctl | e7642cd20e7a586d386d45da490df1fb33f31e33 | [
"BSD-Source-Code"
] | 8 | 2021-04-13T19:44:00.000Z | 2022-02-09T18:00:31.000Z | cat9kthousandeyesctl/thousandeyes/__init__.py | CiscoSE/cat9kthousandeyesctl | e7642cd20e7a586d386d45da490df1fb33f31e33 | [
"BSD-Source-Code"
] | null | null | null | cat9kthousandeyesctl/thousandeyes/__init__.py | CiscoSE/cat9kthousandeyesctl | e7642cd20e7a586d386d45da490df1fb33f31e33 | [
"BSD-Source-Code"
] | 2 | 2021-04-16T11:56:17.000Z | 2021-05-15T13:48:05.000Z | """
Orchestration of Thousand Eyes agents on Catalyst 9000
"""
from rich.table import Table
from .progressbar import Progressbar
from .netconf import Netconf
from .configs import Configs
from .deploy import Deploy
from .status import Status
from .undeploy import Undeploy
class Thousandeyes:
""" Class for Deploy a... | 32.094276 | 94 | 0.428452 | from rich.table import Table
from .progressbar import Progressbar
from .netconf import Netconf
from .configs import Configs
from .deploy import Deploy
from .status import Status
from .undeploy import Undeploy
class Thousandeyes:
class Configs(Configs):
pass
def __init__(self, cfg):
self.sta... | true | true |
f76dc520853741787d231f6bd6b83fa4af4f00c1 | 17,893 | py | Python | python/pyspark/streaming/snappy/tests.py | alexBaiJW/snappydata | adf4664d824cf4d2b7a65ce4eb4903bfce8c4f78 | [
"Apache-2.0"
] | 1 | 2018-05-02T07:09:29.000Z | 2018-05-02T07:09:29.000Z | python/pyspark/streaming/snappy/tests.py | lichar-cheng/snappydata | e2775f5a39c9d54081cba534daece97b526bbaff | [
"Apache-2.0"
] | null | null | null | python/pyspark/streaming/snappy/tests.py | lichar-cheng/snappydata | e2775f5a39c9d54081cba534daece97b526bbaff | [
"Apache-2.0"
] | null | null | null | #
# Copyright (c) 2017 SnappyData, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you
#
# may not use this file except in compliance with the License. You
# may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | 39.153173 | 166 | 0.634773 |
import os
from datetime import date, datetime
import sys
import time
import tempfile
import struct
import shutil
from pyspark.streaming.tests import PySparkStreamingTestCase, BasicOperationTests, CheckpointTests, StreamingListenerTests, StreamingContextTests, WindowFunctionTests
from pyspark.streaming.snappy.context ... | true | true |
f76dc629c7f58dbd4f2c3da596919e9178328948 | 174 | py | Python | solutions/beecrowd/2987/2987.py | deniscostadsc/playground | 11fa8e2b708571940451f005e1f55af0b6e5764a | [
"MIT"
] | 18 | 2015-01-22T04:08:51.000Z | 2022-01-08T22:36:47.000Z | solutions/beecrowd/2987/2987.py | deniscostadsc/playground | 11fa8e2b708571940451f005e1f55af0b6e5764a | [
"MIT"
] | 4 | 2016-04-25T12:32:46.000Z | 2021-06-15T18:01:30.000Z | solutions/beecrowd/2987/2987.py | deniscostadsc/playground | 11fa8e2b708571940451f005e1f55af0b6e5764a | [
"MIT"
] | 25 | 2015-03-02T06:21:51.000Z | 2021-09-12T20:49:21.000Z | import sys
from string import ascii_uppercase
letters = ['-'] + list(ascii_uppercase)
for letter in sys.stdin:
letter = letter.strip()
print(letters.index(letter))
| 19.333333 | 39 | 0.718391 | import sys
from string import ascii_uppercase
letters = ['-'] + list(ascii_uppercase)
for letter in sys.stdin:
letter = letter.strip()
print(letters.index(letter))
| true | true |
f76dc65958f216aea62cb7f9049f5e7416a75000 | 1,573 | py | Python | opticspy/test/PSF.py | benJephunneh/opticspy | a0b841f60f7c053b05444c0e8886cd4a99c4d082 | [
"MIT"
] | null | null | null | opticspy/test/PSF.py | benJephunneh/opticspy | a0b841f60f7c053b05444c0e8886cd4a99c4d082 | [
"MIT"
] | null | null | null | opticspy/test/PSF.py | benJephunneh/opticspy | a0b841f60f7c053b05444c0e8886cd4a99c4d082 | [
"MIT"
] | null | null | null | import numpy as np
from numpy import sqrt as sqrt
from numpy import cos as cos
from numpy import sin as sin
import matplotlib.pyplot as plt
from matplotlib import cm as cm
from matplotlib.ticker import LinearLocator as LinearLocator
from matplotlib.ticker import FormatStrFormatter as FormatStrFormatter
from numpy.fft i... | 26.661017 | 70 | 0.684679 | import numpy as np
from numpy import sqrt as sqrt
from numpy import cos as cos
from numpy import sin as sin
import matplotlib.pyplot as plt
from matplotlib import cm as cm
from matplotlib.ticker import LinearLocator as LinearLocator
from matplotlib.ticker import FormatStrFormatter as FormatStrFormatter
from numpy.fft i... | true | true |
f76dc75554c1b302bdfd7ec86e7d7a85701d547b | 919 | py | Python | read_csv.py | yangzhou95/learn-tensorflow | 6def45659ebf7aa9f74f1efe1ff6465b8db5ee93 | [
"MIT"
] | null | null | null | read_csv.py | yangzhou95/learn-tensorflow | 6def45659ebf7aa9f74f1efe1ff6465b8db5ee93 | [
"MIT"
] | null | null | null | read_csv.py | yangzhou95/learn-tensorflow | 6def45659ebf7aa9f74f1efe1ff6465b8db5ee93 | [
"MIT"
] | null | null | null | # read csv to model
import tensorflow as tf
import numpy as np
import os
def read_csv(batch_size, file_name, record_defaults=1):
fileName_queue=tf.train.string_input_producer(os.path.dirname(__file__)+"/"+file_name)
reader = tf.TextLineReader(skip_header_lines=1)
key, value=reader.read(fileName_queue,name... | 39.956522 | 120 | 0.74864 | import tensorflow as tf
import numpy as np
import os
def read_csv(batch_size, file_name, record_defaults=1):
fileName_queue=tf.train.string_input_producer(os.path.dirname(__file__)+"/"+file_name)
reader = tf.TextLineReader(skip_header_lines=1)
key, value=reader.read(fileName_queue,name='read_op')
... | true | true |
f76dc83e979240cb0f09cff09258f633cd20251d | 1,507 | py | Python | setup.py | byt3bl33d3r/arpspoof | 83594671338218dd80d6328485179cf62f943c9d | [
"BSD-3-Clause"
] | 184 | 2015-01-16T16:15:23.000Z | 2022-03-12T11:21:23.000Z | setup.py | un1que00/arpspoof | 83594671338218dd80d6328485179cf62f943c9d | [
"BSD-3-Clause"
] | 6 | 2015-05-17T13:00:30.000Z | 2019-12-05T05:36:42.000Z | setup.py | un1que00/arpspoof | 83594671338218dd80d6328485179cf62f943c9d | [
"BSD-3-Clause"
] | 71 | 2015-04-08T09:50:04.000Z | 2022-03-14T06:01:40.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read().replace('.. :changelog:', ... | 25.116667 | 105 | 0.623092 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read().replace('.. :changelog:', '')
requirements = [
'scapy'
]
test_requ... | true | true |
f76dc8498304e4dd6f9d4f99aeedb5e36b9556a4 | 21,557 | py | Python | AppletLoader.py | SimiCode/Grail-Web-Browser | 16b86d3215068d334eacf6153b71a748eed53d3d | [
"CNRI-Jython"
] | 6 | 2019-06-17T06:13:01.000Z | 2021-08-22T02:13:36.000Z | AppletLoader.py | SimiCode/Grail-Web-Browser | 16b86d3215068d334eacf6153b71a748eed53d3d | [
"CNRI-Jython"
] | null | null | null | AppletLoader.py | SimiCode/Grail-Web-Browser | 16b86d3215068d334eacf6153b71a748eed53d3d | [
"CNRI-Jython"
] | 2 | 2016-08-18T12:14:44.000Z | 2019-12-06T17:20:21.000Z | """Implement applet loading, possibly asynchronous."""
import os
import regex
import string
import urllib
import urlparse
from Tkinter import *
from BaseReader import BaseReader
from Bastion import Bastion
# Pattern for valid CODE attribute; group(2) extracts module name
codeprog = regex.compile('^\(.*/\)?\([_a-zA-Z... | 33.062883 | 79 | 0.587048 | """Implement applet loading, possibly asynchronous."""
import os
import regex
import string
import urllib
import urlparse
from Tkinter import *
from BaseReader import BaseReader
from Bastion import Bastion
codeprog = regex.compile('^\(.*/\)?\([_a-zA-Z][_a-zA-Z0-9]*\)\.py$')
CLEANUP_HANDLER_NAME = "__cleanup__"
cl... | false | true |
f76dc93a9c8eaa31b54e75d155d1f116c70833a1 | 9,950 | py | Python | Real Topology Graph/GNN Model 2/Fully Connected Graph/test_n3_cyclic.py | HusseinLezzaik/Consensus-Algorithm-for-2-Mobile-Robots | 0109c78106dff7640a8fc5601e0333b5397f5b4e | [
"MIT"
] | 9 | 2021-04-20T08:12:47.000Z | 2022-02-18T02:25:29.000Z | Real Topology Graph/GNN Model 2/Fully Connected Graph/test_n3_cyclic.py | HusseinLezzaik/Deep-Learning-for-Multi-Robotics | ecdb28793cc1f5fa6cded752908105ec37e9bfc7 | [
"MIT"
] | null | null | null | Real Topology Graph/GNN Model 2/Fully Connected Graph/test_n3_cyclic.py | HusseinLezzaik/Deep-Learning-for-Multi-Robotics | ecdb28793cc1f5fa6cded752908105ec37e9bfc7 | [
"MIT"
] | 1 | 2021-11-16T08:16:36.000Z | 2021-11-16T08:16:36.000Z | """
Consensus Algorithm for 3 Mobile robots using MLP Model Cyclic Graph Implementation
Scene: Robot 1, Robot 2, Robot 3
Inputs: Mx, My, Phix, Phiy
Outputs: Ux, Uy
"""
import torch
import MLP_Model
import math
import numpy as np
import rclpy
from rclpy.node import Node
from tf2_msgs.msg import TFMessage
from std_ms... | 38.416988 | 158 | 0.571759 | import torch
import MLP_Model
import math
import numpy as np
import rclpy
from rclpy.node import Node
from tf2_msgs.msg import TFMessage
from std_msgs.msg import Float32
import time
L = 1
d = 0.5
FILE = "model.pth"
loaded_model = MLP_Model.MLP()
loaded_model.load_state_dict(torch.load(FILE))
loaded_model.eval()
def ... | true | true |
f76dc973359b1f05d856a3f1fb773a78c3bcbc06 | 205 | py | Python | abandoned/webspring/mutagens/__init__.py | fretboardfreak/code | 0e9bc521e30684247d5d19717a5a938d31151fe3 | [
"Apache-2.0"
] | 1 | 2016-01-01T17:50:10.000Z | 2016-01-01T17:50:10.000Z | abandoned/webspring/mutagens/__init__.py | fretboardfreak/code | 0e9bc521e30684247d5d19717a5a938d31151fe3 | [
"Apache-2.0"
] | null | null | null | abandoned/webspring/mutagens/__init__.py | fretboardfreak/code | 0e9bc521e30684247d5d19717a5a938d31151fe3 | [
"Apache-2.0"
] | null | null | null | """This package contains a collection of Mutagens.
A Mutagen is a class that takes an input and generates an output. Typically
the output has been mutated in some way from the input's original form.
"""
| 34.166667 | 76 | 0.770732 | true | true | |
f76dc9cc1774cf6c0b093a7de7d2362b8da1102e | 4,803 | py | Python | shape-reconstruction/implicit-geometric-regularization/datasets.py | shikisawamura/nnabla-examples | baf4e4cc620dedbf4368683325c0fb868676850d | [
"Apache-2.0"
] | null | null | null | shape-reconstruction/implicit-geometric-regularization/datasets.py | shikisawamura/nnabla-examples | baf4e4cc620dedbf4368683325c0fb868676850d | [
"Apache-2.0"
] | null | null | null | shape-reconstruction/implicit-geometric-regularization/datasets.py | shikisawamura/nnabla-examples | baf4e4cc620dedbf4368683325c0fb868676850d | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2017-2020 Sony Corporation. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | 33.354167 | 95 | 0.661045 |
from __future__ import division
import glob
import os
import numpy as np
from scipy import spatial
import open3d as o3d
import nnabla as nn
import nnabla.logger as logger
import nnabla.monitor as M
import nnabla.functions as F
import nnabla.parametric_functions as PF
from nnabla.utils.data_iterator import data_itera... | true | true |
f76dca393bc4a9539db06099ac3836fa3a3285f2 | 5,743 | py | Python | HW2/LittleGo.py | sanromra/CSCI561 | 510427dd3300c8c0ce645b7a68d44ca6017ffe9d | [
"MIT"
] | 1 | 2022-01-22T00:52:27.000Z | 2022-01-22T00:52:27.000Z | HW2/LittleGo.py | sanromra/CSCI561 | 510427dd3300c8c0ce645b7a68d44ca6017ffe9d | [
"MIT"
] | null | null | null | HW2/LittleGo.py | sanromra/CSCI561 | 510427dd3300c8c0ce645b7a68d44ca6017ffe9d | [
"MIT"
] | null | null | null | import sys
from pathlib import Path
sys.path.insert(1, str(Path.cwd()))
from GoBoard import Board
from GoRandomPlayer import GoRandomPlayer
from GoQLearner import GoQLearner
from AlphaBeta import AlphaBeta
from tqdm import tqdm
#from PerfectPlayer import PerfectPlayer
#from SmartPlayer import SmartPlayer
PLAYER_BLAC... | 38.543624 | 158 | 0.618666 | import sys
from pathlib import Path
sys.path.insert(1, str(Path.cwd()))
from GoBoard import Board
from GoRandomPlayer import GoRandomPlayer
from GoQLearner import GoQLearner
from AlphaBeta import AlphaBeta
from tqdm import tqdm
PLAYER_BLACK = 1
PLAYER_WHITE = 2
def play(board, player1, player2, learn):
player1.... | true | true |
f76dcb446cd3dd78e4984b9f9a765b2aa27e2904 | 1,040 | py | Python | unzip_files.py | tslima/copy-files-from-g-drive | d12cf6eca1fb4e4ac8b65404a71c3560f72d60ef | [
"MIT"
] | null | null | null | unzip_files.py | tslima/copy-files-from-g-drive | d12cf6eca1fb4e4ac8b65404a71c3560f72d60ef | [
"MIT"
] | null | null | null | unzip_files.py | tslima/copy-files-from-g-drive | d12cf6eca1fb4e4ac8b65404a71c3560f72d60ef | [
"MIT"
] | null | null | null | import zipfile
from os import listdir
from os.path import isfile, join, splitext
import concurrent.futures
def unzip_file(file):
try:
print(f'Unzinping file: {file}')
with zipfile.ZipFile(file, 'r') as zip_ref:
zip_ref.extractall(splitext(file)[0])
return {'status':'OK', 'file... | 31.515152 | 81 | 0.591346 | import zipfile
from os import listdir
from os.path import isfile, join, splitext
import concurrent.futures
def unzip_file(file):
try:
print(f'Unzinping file: {file}')
with zipfile.ZipFile(file, 'r') as zip_ref:
zip_ref.extractall(splitext(file)[0])
return {'status':'OK', 'file... | true | true |
f76dcb5687c2ab77e411e7ef3c4de64200d99c66 | 1,172 | py | Python | python/paddle/fluid/tests/unittests/test_dygraph_sharding_stage2.py | zmxdream/Paddle | 04f042a5d507ad98f7f2cfc3cbc44b06d7a7f45c | [
"Apache-2.0"
] | 2 | 2021-11-12T11:31:12.000Z | 2021-12-05T10:30:28.000Z | python/paddle/fluid/tests/unittests/test_dygraph_sharding_stage2.py | zmxdream/Paddle | 04f042a5d507ad98f7f2cfc3cbc44b06d7a7f45c | [
"Apache-2.0"
] | 1 | 2020-09-08T01:45:28.000Z | 2020-09-08T01:45:28.000Z | python/paddle/fluid/tests/unittests/test_dygraph_sharding_stage2.py | zmxdream/Paddle | 04f042a5d507ad98f7f2cfc3cbc44b06d7a7f45c | [
"Apache-2.0"
] | 5 | 2021-12-10T11:20:06.000Z | 2022-02-18T05:18:12.000Z | # Copyright (c) 2021 PaddlePaddle 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 appli... | 33.485714 | 74 | 0.782423 |
from __future__ import print_function
import unittest
import paddle.fluid as fluid
from test_parallel_dygraph_dataparallel import TestMultipleGpus
class TestDygraphShardingStage2(TestMultipleGpus):
def test_dygraph_sharding_optimizer_stage2(self):
self.run_mnist_2gpu('dygraph_sharding_stage2.py')
... | true | true |
f76dcbb45354af11544d34a14d91fdda01772f35 | 412 | py | Python | hotline/db/db_abstract.py | wearhacks/hackathon_hotline | d256cfc365d0bb4764853b2be03b8c1b4eabab99 | [
"MIT"
] | null | null | null | hotline/db/db_abstract.py | wearhacks/hackathon_hotline | d256cfc365d0bb4764853b2be03b8c1b4eabab99 | [
"MIT"
] | null | null | null | hotline/db/db_abstract.py | wearhacks/hackathon_hotline | d256cfc365d0bb4764853b2be03b8c1b4eabab99 | [
"MIT"
] | null | null | null | from abc import ABCMeta, abstractmethod
class AbstractClient(metaclass=ABCMeta):
@abstractmethod
def connect(self):
pass
@abstractmethod
def get(self, table_name, key):
pass
@abstractmethod
def set(self, table_name, data):
pass
@abstractmethod
def update(self... | 17.166667 | 40 | 0.626214 | from abc import ABCMeta, abstractmethod
class AbstractClient(metaclass=ABCMeta):
@abstractmethod
def connect(self):
pass
@abstractmethod
def get(self, table_name, key):
pass
@abstractmethod
def set(self, table_name, data):
pass
@abstractmethod
def update(self... | true | true |
f76dcbdaf1505438a64fcb322ac96d5599ab4d72 | 411 | py | Python | travelapp/migrations/backup/0012_trip_subbed.py | cy4ok/my-region | 8f3155354d13bc93b38b3ed824f6f0f380dac6b4 | [
"MIT"
] | null | null | null | travelapp/migrations/backup/0012_trip_subbed.py | cy4ok/my-region | 8f3155354d13bc93b38b3ed824f6f0f380dac6b4 | [
"MIT"
] | 1 | 2021-03-23T16:22:13.000Z | 2021-03-23T16:22:13.000Z | travelapp/migrations/backup/0012_trip_subbed.py | cy4ok/my-region | 8f3155354d13bc93b38b3ed824f6f0f380dac6b4 | [
"MIT"
] | null | null | null | # Generated by Django 3.1.6 on 2021-02-18 15:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('travelapp', '0011_auto_20210218_1837'),
]
operations = [
migrations.AddField(
model_name='trip',
name='subbed',
... | 21.631579 | 77 | 0.608273 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('travelapp', '0011_auto_20210218_1837'),
]
operations = [
migrations.AddField(
model_name='trip',
name='subbed',
field=models.IntegerField(default=0, ver... | true | true |
f76dcde3e992dc56735cd799544aaae0d663313b | 749 | py | Python | scratch/scratch/urls.py | jarshwah/django-scratch | aaeb2a2e5d6d0cc64e6ecb13262be8d8a72ffa9b | [
"BSD-2-Clause"
] | null | null | null | scratch/scratch/urls.py | jarshwah/django-scratch | aaeb2a2e5d6d0cc64e6ecb13262be8d8a72ffa9b | [
"BSD-2-Clause"
] | null | null | null | scratch/scratch/urls.py | jarshwah/django-scratch | aaeb2a2e5d6d0cc64e6ecb13262be8d8a72ffa9b | [
"BSD-2-Clause"
] | null | null | null | """scratch URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based... | 34.045455 | 77 | 0.708945 | from django.contrib import admin
from django.urls import path
urlpatterns = [
path('admin/', admin.site.urls),
]
| true | true |
f76dce3061eb9e0501304dd6cf0eaa7d0ffffb83 | 9,856 | py | Python | app/recipe/tests/test_recipe_api.py | agarciapnp/recipe-api-travis-fix | 4ce5743c56b52d9f5ac7487025474dde731b4cc1 | [
"MIT"
] | 205 | 2018-12-23T01:16:25.000Z | 2022-03-23T19:02:27.000Z | app/recipe/tests/test_recipe_api.py | agarciapnp/recipe-api-travis-fix | 4ce5743c56b52d9f5ac7487025474dde731b4cc1 | [
"MIT"
] | 5 | 2020-09-28T23:20:51.000Z | 2021-07-01T23:19:03.000Z | app/recipe/tests/test_recipe_api.py | khabdrick/recipe-app-api | 4ee2ec98d45d34083dd7fab4c35289a2d73c7c32 | [
"MIT"
] | 201 | 2018-11-18T05:42:04.000Z | 2022-03-28T20:09:44.000Z | import tempfile
import os
from PIL import Image
from django.contrib.auth import get_user_model
from django.test import TestCase
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APIClient
from core.models import Recipe, Tag, Ingredient
from recipe.serializers import ... | 34.704225 | 78 | 0.645901 | import tempfile
import os
from PIL import Image
from django.contrib.auth import get_user_model
from django.test import TestCase
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APIClient
from core.models import Recipe, Tag, Ingredient
from recipe.serializers import ... | true | true |
f76dce74f5f7f63819e58e78720151e3e05a4826 | 551 | py | Python | pycaret/tests/test_preprocess.py | BitEconomics/pycaret | 9fdd3cce82dbb118e752b252783815a617df5896 | [
"MIT"
] | 1 | 2021-01-29T19:44:40.000Z | 2021-01-29T19:44:40.000Z | pycaret/tests/test_preprocess.py | BitEconomics/pycaret | 9fdd3cce82dbb118e752b252783815a617df5896 | [
"MIT"
] | null | null | null | pycaret/tests/test_preprocess.py | BitEconomics/pycaret | 9fdd3cce82dbb118e752b252783815a617df5896 | [
"MIT"
] | null | null | null | import os, sys
sys.path.insert(0, os.path.abspath(".."))
import pandas as pd
import pytest
import pycaret.datasets
import pycaret.internal.preprocess
def test():
# loading dataset
data = pycaret.datasets.get_data("juice")
target = "Purchase"
# preprocess all in one
pipe = pycaret.internal.preproc... | 23.956522 | 120 | 0.713249 | import os, sys
sys.path.insert(0, os.path.abspath(".."))
import pandas as pd
import pytest
import pycaret.datasets
import pycaret.internal.preprocess
def test():
data = pycaret.datasets.get_data("juice")
target = "Purchase"
pipe = pycaret.internal.preprocess.Preprocess_Path_One(train_data=data, t... | true | true |
f76dcec16c6ad61388fa5ad1fb2bc25a248ebb91 | 727 | py | Python | SimpleCalculator.py | kchittamori/Python | b3ef9ef2b8ce24510ca189c422ac98846f36b71f | [
"MIT"
] | 12 | 2019-12-27T07:32:35.000Z | 2022-02-20T20:15:08.000Z | SimpleCalculator.py | ian-njuguna11/Python | 4a4df7aa1c7b106bdcaf189d02f798e3c58a9bee | [
"MIT"
] | 1 | 2020-10-01T14:14:31.000Z | 2020-10-01T14:14:58.000Z | SimpleCalculator.py | ian-njuguna11/Python | 4a4df7aa1c7b106bdcaf189d02f798e3c58a9bee | [
"MIT"
] | 22 | 2019-10-06T20:30:25.000Z | 2022-01-11T16:31:14.000Z | def add(a,b):
return a+b
def subtract(a,b):
return a-b
def multiply(a,b):
return a*b
def divide(a,b):
try:
return a/b
except ZeroDivisionError:
return "Zero Division Error"
print("Select Operation")
print("1.Add")
print("2.Subtract")
print("3.Multiply")
print("4.Divide")
choice = input("E... | 20.771429 | 47 | 0.620358 | def add(a,b):
return a+b
def subtract(a,b):
return a-b
def multiply(a,b):
return a*b
def divide(a,b):
try:
return a/b
except ZeroDivisionError:
return "Zero Division Error"
print("Select Operation")
print("1.Add")
print("2.Subtract")
print("3.Multiply")
print("4.Divide")
choice = input("E... | true | true |
f76dcefa4e3f2088540350ca0b5b58936b764a91 | 502 | py | Python | admin/admin/wsgi.py | EricGip/PythonMicroServices | f0d7df9a21f981af053faba922accb23cdee9c09 | [
"MIT"
] | null | null | null | admin/admin/wsgi.py | EricGip/PythonMicroServices | f0d7df9a21f981af053faba922accb23cdee9c09 | [
"MIT"
] | null | null | null | admin/admin/wsgi.py | EricGip/PythonMicroServices | f0d7df9a21f981af053faba922accb23cdee9c09 | [
"MIT"
] | null | null | null | """
WSGI config for admin project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
from dotenv import load_dotenv, find_... | 20.916667 | 78 | 0.782869 |
import os
from django.core.wsgi import get_wsgi_application
from dotenv import load_dotenv, find_dotenv
load_dotenv(find_dotenv(usecwd=True))
api_key = os.getenv("mqKey")
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'admin.settings')
application = get_wsgi_application()
| true | true |
f76dcf9a7dc3059942201ffd025d96c6e8c216db | 1,943 | py | Python | setup.py | xlysander12/LyricsGenius | 73972d1c21114627ef0be92866ed3ecc9b590ea8 | [
"MIT"
] | null | null | null | setup.py | xlysander12/LyricsGenius | 73972d1c21114627ef0be92866ed3ecc9b590ea8 | [
"MIT"
] | null | null | null | setup.py | xlysander12/LyricsGenius | 73972d1c21114627ef0be92866ed3ecc9b590ea8 | [
"MIT"
] | null | null | null | # LyricsGenius
# Copyright 2018 John W. Miller
# See LICENSE for details.
import sys
import re
from os import path
from setuptools import find_packages, setup
assert sys.version_info[0] == 3, "LyricsGenius requires Python 3."
VERSIONFILE = "lyricsgenius/__init__.py"
ver_file = open(VERSIONFILE, "rt").read()
VSRE = r... | 26.616438 | 73 | 0.63613 |
import sys
import re
from os import path
from setuptools import find_packages, setup
assert sys.version_info[0] == 3, "LyricsGenius requires Python 3."
VERSIONFILE = "lyricsgenius/__init__.py"
ver_file = open(VERSIONFILE, "rt").read()
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
mo = re.search(VSRE, ver_file, re.M)
... | true | true |
f76dd0b9ba1d6a78b9ddf2d22c8358b33452576d | 5,086 | py | Python | misaghestan/subscriptions/urls.py | Misaghlb/django-saas-membership | 7a8ec806943305ebc88b453d117a3755323126ca | [
"MIT"
] | null | null | null | misaghestan/subscriptions/urls.py | Misaghlb/django-saas-membership | 7a8ec806943305ebc88b453d117a3755323126ca | [
"MIT"
] | null | null | null | misaghestan/subscriptions/urls.py | Misaghlb/django-saas-membership | 7a8ec806943305ebc88b453d117a3755323126ca | [
"MIT"
] | null | null | null | """URLs for the Flexible Subscriptions app."""
# pylint: disable=line-too-long
import importlib
from django.conf.urls import url
from . import views
from .conf import SETTINGS
# Retrieve the proper subscribe view
SubscribeView = getattr( # pylint: disable=invalid-name
importlib.import_module(SETTINGS['subscribe_... | 31.202454 | 132 | 0.565081 | import importlib
from django.conf.urls import url
from . import views
from .conf import SETTINGS
SubscribeView = getattr( importlib.import_module(SETTINGS['subscribe_view']['module']),
SETTINGS['subscribe_view']['class']
)
urlpatterns = [
url(
r'^subscribe/$',
views.SubscribeList.as_view... | true | true |
f76dd1d1cc5bbf5fb97ca4c8e391e7529e40d225 | 1,253 | py | Python | tilenol/widgets/base.py | paulie-g/tilenol | 6e52c558d1c698ef8320e6ef32771af2864c1c49 | [
"MIT"
] | 42 | 2015-01-19T15:43:16.000Z | 2021-09-19T15:20:58.000Z | tilenol/widgets/base.py | paulie-g/tilenol | 6e52c558d1c698ef8320e6ef32771af2864c1c49 | [
"MIT"
] | 2 | 2015-05-30T03:15:17.000Z | 2019-02-28T16:37:02.000Z | tilenol/widgets/base.py | tailhook/tilenol | 3b71f6600d437a4e5f167315683e7f0137cd3788 | [
"MIT"
] | 11 | 2015-10-04T06:01:02.000Z | 2022-03-26T18:46:46.000Z | from abc import abstractmethod, ABCMeta
from collections import namedtuple
from cairo import SolidPattern
from zorro.di import has_dependencies, dependency
from .bar import Bar
from tilenol.theme import Theme
@has_dependencies
class Widget(metaclass=ABCMeta):
bar = dependency(Bar, 'bar')
stretched = False
... | 25.571429 | 60 | 0.650439 | from abc import abstractmethod, ABCMeta
from collections import namedtuple
from cairo import SolidPattern
from zorro.di import has_dependencies, dependency
from .bar import Bar
from tilenol.theme import Theme
@has_dependencies
class Widget(metaclass=ABCMeta):
bar = dependency(Bar, 'bar')
stretched = False
... | true | true |
f76dd2df8ea563c8d2e37e7435322a923bb4c65a | 4,253 | py | Python | tests/integration/pricing/v1/voice/test_country.py | fefi95/twilio-python | b9bfea293b6133fe84d4d8d3ac4e2a75381c3881 | [
"MIT"
] | 1 | 2019-12-30T21:46:55.000Z | 2019-12-30T21:46:55.000Z | tests/integration/pricing/v1/voice/test_country.py | fefi95/twilio-python | b9bfea293b6133fe84d4d8d3ac4e2a75381c3881 | [
"MIT"
] | null | null | null | tests/integration/pricing/v1/voice/test_country.py | fefi95/twilio-python | b9bfea293b6133fe84d4d8d3ac4e2a75381c3881 | [
"MIT"
] | null | null | null | # coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class CountryTestCase(Integrati... | 31.738806 | 105 | 0.430049 |
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class CountryTestCase(IntegrationTestCase):
def test_list_request(self):
self.holodeck.mock(Response(500, ''))
with self.assertRa... | true | true |
f76dd3a27dd5ce86e076eaf01494d95b317d459d | 25,927 | py | Python | CellProfiler-Analyst.py | DavidStirling/CellProfiler-Analyst | 7a0bfcb5cc7db067844595bdbb90f3132f9a8ea9 | [
"MIT"
] | 98 | 2015-02-05T18:22:04.000Z | 2022-03-29T12:06:48.000Z | CellProfiler-Analyst.py | DavidStirling/CellProfiler-Analyst | 7a0bfcb5cc7db067844595bdbb90f3132f9a8ea9 | [
"MIT"
] | 268 | 2015-01-14T15:43:24.000Z | 2022-02-13T22:04:37.000Z | CellProfiler-Analyst.py | DavidStirling/CellProfiler-Analyst | 7a0bfcb5cc7db067844595bdbb90f3132f9a8ea9 | [
"MIT"
] | 64 | 2015-06-30T22:26:03.000Z | 2022-03-11T01:06:13.000Z | # =============================================================================
#
# Main file for CellProfiler-Analyst
#
# =============================================================================
import sys
import os
import os.path
import logging
from cpa.dimensionreduction import DimensionReduction
from cpa... | 47.14 | 199 | 0.639989 |
import sys
import os
import os.path
import logging
from cpa.dimensionreduction import DimensionReduction
from cpa.guiutils import create_status_bar
from cpa.util.version import display_version
from cpa.properties import Properties
from cpa.dbconnect import DBConnect
from cpa.classifier import Classifier
from cpa.ta... | true | true |
f76dd57e4ed5fc5a1f82685d7b67f69e83d0610d | 1,861 | py | Python | homeassistant/components/automation/trace.py | MrDelik/core | 93a66cc357b226389967668441000498a10453bb | [
"Apache-2.0"
] | 30,023 | 2016-04-13T10:17:53.000Z | 2020-03-02T12:56:31.000Z | homeassistant/components/automation/trace.py | MrDelik/core | 93a66cc357b226389967668441000498a10453bb | [
"Apache-2.0"
] | 31,101 | 2020-03-02T13:00:16.000Z | 2022-03-31T23:57:36.000Z | homeassistant/components/automation/trace.py | MrDelik/core | 93a66cc357b226389967668441000498a10453bb | [
"Apache-2.0"
] | 11,956 | 2016-04-13T18:42:31.000Z | 2020-03-02T09:32:12.000Z | """Trace support for automation."""
from __future__ import annotations
from contextlib import contextmanager
from typing import Any
from homeassistant.components.trace import ActionTrace, async_store_trace
from homeassistant.components.trace.const import CONF_STORED_TRACES
from homeassistant.core import Context
from... | 29.078125 | 77 | 0.688877 | from __future__ import annotations
from contextlib import contextmanager
from typing import Any
from homeassistant.components.trace import ActionTrace, async_store_trace
from homeassistant.components.trace.const import CONF_STORED_TRACES
from homeassistant.core import Context
from .const import DOMAIN
class Autom... | true | true |
f76dd59c48a68e12d0a80c53a3eab2aafd6df53a | 28,556 | py | Python | python/ray/serve/master.py | Yeachan-Heo/ray | a73c488c74b1e01da3961db2eb538c43c29753f5 | [
"Apache-2.0"
] | null | null | null | python/ray/serve/master.py | Yeachan-Heo/ray | a73c488c74b1e01da3961db2eb538c43c29753f5 | [
"Apache-2.0"
] | null | null | null | python/ray/serve/master.py | Yeachan-Heo/ray | a73c488c74b1e01da3961db2eb538c43c29753f5 | [
"Apache-2.0"
] | null | null | null | import asyncio
from collections import defaultdict
import os
import random
import time
import ray
import ray.cloudpickle as pickle
from ray.serve.backend_worker import create_backend_worker
from ray.serve.constants import (ASYNC_CONCURRENCY, SERVE_ROUTER_NAME,
SERVE_PROXY_NAME, SERVE_M... | 43.663609 | 79 | 0.626278 | import asyncio
from collections import defaultdict
import os
import random
import time
import ray
import ray.cloudpickle as pickle
from ray.serve.backend_worker import create_backend_worker
from ray.serve.constants import (ASYNC_CONCURRENCY, SERVE_ROUTER_NAME,
SERVE_PROXY_NAME, SERVE_M... | true | true |
f76dd73c755d1c8aa546adabd3e189c50fdeb5cb | 10,300 | py | Python | mytools/yolo2coco.py | jstzwjr/mmdetection | 1c2878eb4f4da2978dcd9a05f9d0247726680213 | [
"Apache-2.0"
] | null | null | null | mytools/yolo2coco.py | jstzwjr/mmdetection | 1c2878eb4f4da2978dcd9a05f9d0247726680213 | [
"Apache-2.0"
] | null | null | null | mytools/yolo2coco.py | jstzwjr/mmdetection | 1c2878eb4f4da2978dcd9a05f9d0247726680213 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# encoding: utf-8
'''
@file: yolo2coco.py
@author: wangjianong
@time: 2020/2/21 16:04
@desc:yolo格式转coco
'''
import os
import cv2
import os
import mmcv
import random
import tqdm
from PIL import Image
import re
import datetime
#data format must be:r
#yolo: label_id(start from 0) xc yc w h
#custom... | 35.034014 | 159 | 0.527767 |
import os
import cv2
import os
import mmcv
import random
import tqdm
from PIL import Image
import re
import datetime
data_format = 'yolo'
filter_empty = False
dataset_name = 'pressing_plate_dataset'
company_name = 'dhzl'
class_labels = ['bg','yp90','yp45','yp0','rp90','rp0','gp0','yp135','r90','w45','y90','y45']
c... | true | true |
f76dd88dee8b988330387b2a7944c7d0fa58951f | 2,098 | py | Python | droidlet/interpreter/robot/dance.py | ali-senguel/fairo | 1ec5d8ecbdfc782de63a92aad9bf8534110ce762 | [
"MIT"
] | 669 | 2020-11-21T01:20:20.000Z | 2021-09-13T13:25:16.000Z | droidlet/interpreter/robot/dance.py | ali-senguel/fairo | 1ec5d8ecbdfc782de63a92aad9bf8534110ce762 | [
"MIT"
] | 324 | 2020-12-07T18:20:34.000Z | 2021-09-14T17:17:18.000Z | droidlet/interpreter/robot/dance.py | ali-senguel/fairo | 1ec5d8ecbdfc782de63a92aad9bf8534110ce762 | [
"MIT"
] | 56 | 2021-01-04T19:57:40.000Z | 2021-09-13T21:20:08.000Z | """
Copyright (c) Facebook, Inc. and its affiliates.
"""
"""This file has functions to implement different dances for the agent.
"""
import time
import math
from .tasks import Move, Dance
konami_dance = [
{"translate": (0, 1, 0)},
{"translate": (0, 1, 0)},
{"translate": (0, -1, 0)},
{"translate": (0,... | 27.973333 | 92 | 0.558151 |
import time
import math
from .tasks import Move, Dance
konami_dance = [
{"translate": (0, 1, 0)},
{"translate": (0, 1, 0)},
{"translate": (0, -1, 0)},
{"translate": (0, -1, 0)},
{"translate": (0, 0, -1)},
{"translate": (0, 0, 1)},
{"translate": (0, 0, -1)},
{"translate": (0, 0, 1)},
]... | true | true |
f76dd9232e41d52dd0f31b4c7506d9ef5ac7479d | 970 | py | Python | xlsxwriter/test/comparison/test_utf8_07.py | timgates42/XlsxWriter | 129044ed821de67895b4562c6b71f90eba5be6b4 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | xlsxwriter/test/comparison/test_utf8_07.py | timgates42/XlsxWriter | 129044ed821de67895b4562c6b71f90eba5be6b4 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | xlsxwriter/test/comparison/test_utf8_07.py | timgates42/XlsxWriter | 129044ed821de67895b4562c6b71f90eba5be6b4 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | ###############################################################################
# _*_ coding: utf-8
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2020, John McNamara, jmcnamara@cpan.org
#
from __future__ import unicode_literals
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook... | 24.871795 | 79 | 0.623711 | from __future__ import unicode_literals
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
def setUp(self):
self.set_filename('utf8_07.xlsx')
def test_create_file(self):
workbook = Workbook(self.got_file... | true | true |
f76dd954521669095fda991587f128b6875f75ea | 2,844 | py | Python | src/com/facebook/buck/util/versioncontrol/rawmanifest.py | zhangshuai930822/BUCK | 296a5355e3209b409b729035f7724680d2be6f84 | [
"Apache-2.0"
] | null | null | null | src/com/facebook/buck/util/versioncontrol/rawmanifest.py | zhangshuai930822/BUCK | 296a5355e3209b409b729035f7724680d2be6f84 | [
"Apache-2.0"
] | null | null | null | src/com/facebook/buck/util/versioncontrol/rawmanifest.py | zhangshuai930822/BUCK | 296a5355e3209b409b729035f7724680d2be6f84 | [
"Apache-2.0"
] | null | null | null | # rawmanifest.py
#
# Copyright 2013-2016 Facebook, Inc.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
"""Output (a subset of) the manifest as a bser serialisation
Outputs raw manifest data
The manifest can be updated with the c... | 31.252747 | 95 | 0.616385 | from __future__ import absolute_import
from mercurial import (
cmdutil,
match,
node,
util,
)
from itertools import chain
cmdtable = {}
command = cmdutil.command(cmdtable)
testedwith = 'internal'
@command(
'rawmanifest', [
['o', 'output', '', 'direct output to a file rather than STDOUT'... | true | true |
f76dda3633a140c089ac3ce525c17fe2567f642e | 433 | py | Python | tests/notifiers/test_sms_notifier.py | ontruck/django-ontruck | c61504fee596a3541c34256c970b9384b4565bbb | [
"BSD-3-Clause"
] | 1 | 2020-03-23T11:29:53.000Z | 2020-03-23T11:29:53.000Z | tests/notifiers/test_sms_notifier.py | ontruck/django-ontruck | c61504fee596a3541c34256c970b9384b4565bbb | [
"BSD-3-Clause"
] | 24 | 2020-03-23T10:31:19.000Z | 2022-02-10T10:25:58.000Z | tests/notifiers/test_sms_notifier.py | ontruck/django-ontruck | c61504fee596a3541c34256c970b9384b4565bbb | [
"BSD-3-Clause"
] | null | null | null | from django_ontruck.notifiers import AsyncNotifier, Notifier
from ..test_app.notifiers import DummySMSNotifier
def test_sms_notifier(mocker):
notifier = DummySMSNotifier(phone_number='123', delayed=False)
assert isinstance(notifier, Notifier)
notifier.send()
def test_sms_async_notifier(mocker):
not... | 25.470588 | 66 | 0.7806 | from django_ontruck.notifiers import AsyncNotifier, Notifier
from ..test_app.notifiers import DummySMSNotifier
def test_sms_notifier(mocker):
notifier = DummySMSNotifier(phone_number='123', delayed=False)
assert isinstance(notifier, Notifier)
notifier.send()
def test_sms_async_notifier(mocker):
not... | true | true |
f76ddac685a48c69b912e5de2bdf3a853ea6bd31 | 2,307 | py | Python | tests/models/symbol/fdi_dems_log_retrieve_chunk_details_test.py | NetApp/santricity-webapi-pythonsdk | 1d3df4a00561192f4cdcdd1890f4d27547ed2de2 | [
"BSD-3-Clause-Clear"
] | 5 | 2016-08-23T17:52:22.000Z | 2019-05-16T08:45:30.000Z | tests/models/symbol/fdi_dems_log_retrieve_chunk_details_test.py | NetApp/santricity-webapi-pythonsdk | 1d3df4a00561192f4cdcdd1890f4d27547ed2de2 | [
"BSD-3-Clause-Clear"
] | 2 | 2016-11-10T05:30:21.000Z | 2019-04-05T15:03:37.000Z | tests/models/symbol/fdi_dems_log_retrieve_chunk_details_test.py | NetApp/santricity-webapi-pythonsdk | 1d3df4a00561192f4cdcdd1890f4d27547ed2de2 | [
"BSD-3-Clause-Clear"
] | 7 | 2016-08-25T16:11:44.000Z | 2021-02-22T05:31:25.000Z | #!/usr/bin/env python
# coding: utf-8
"""
The Clear BSD License
Copyright (c) – 2016, NetApp, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions... | 60.710526 | 845 | 0.785869 |
import unittest
from netapp.santricity.models.symbol.fdi_dems_log_retrieve_chunk_details import FdiDemsLogRetrieveChunkDetails
class FdiDemsLogRetrieveChunkDetailsTest(unittest.TestCase):
def test_fdi_dems_log_retrieve_chunk_details(self):
fdi_dems_log_retrieve_chunk_details_obj = Fd... | true | true |
f76ddb8eb1072f88a6aa789def738f33c01c1023 | 801 | py | Python | setup.py | Jerodsun/robin_stocks | a89ee16237bd3c5321cfa42ae656b7ab433e2890 | [
"MIT"
] | null | null | null | setup.py | Jerodsun/robin_stocks | a89ee16237bd3c5321cfa42ae656b7ab433e2890 | [
"MIT"
] | null | null | null | setup.py | Jerodsun/robin_stocks | a89ee16237bd3c5321cfa42ae656b7ab433e2890 | [
"MIT"
] | null | null | null | from setuptools import setup
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(name='robin_stocks_sun',
version='0.9.8.8',
description='A Python wrapper around the... | 29.666667 | 99 | 0.662921 | from setuptools import setup
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(name='robin_stocks_sun',
version='0.9.8.8',
description='A Python wrapper around the... | true | true |
f76ddbaf3d7f4aa77e8b9c2c09d5122b17cdc91c | 3,906 | py | Python | tests/test_git.py | FollowTheProcess/pytoil | b13acb14f015ae5399d7697bdc3e0e475dff03ec | [
"Apache-2.0"
] | 6 | 2021-05-08T20:31:03.000Z | 2022-03-08T01:25:43.000Z | tests/test_git.py | FollowTheProcess/pytoil | b13acb14f015ae5399d7697bdc3e0e475dff03ec | [
"Apache-2.0"
] | 116 | 2021-07-08T11:21:22.000Z | 2022-03-30T14:04:51.000Z | tests/test_git.py | FollowTheProcess/pytoil | b13acb14f015ae5399d7697bdc3e0e475dff03ec | [
"Apache-2.0"
] | null | null | null | """
Tests for the git module.
Author: Tom Fleet
Created: 19/06/2021
"""
import shutil
import subprocess
from pathlib import Path
import pytest
from pytest_mock import MockerFixture
from pytoil.exceptions import GitNotInstalledError
from pytoil.git import Git
def test_git_instanciation_default():
git = Git()
... | 23.96319 | 88 | 0.647209 |
import shutil
import subprocess
from pathlib import Path
import pytest
from pytest_mock import MockerFixture
from pytoil.exceptions import GitNotInstalledError
from pytoil.git import Git
def test_git_instanciation_default():
git = Git()
assert git.git == shutil.which("git")
def test_git_instanciation_p... | true | true |
f76ddc89ede3283c681043d8a4947652aea6a970 | 2,451 | py | Python | girlfriend/tools/gf_test_data.py | chihongze/girlfriend | e00e62a21be5d5a08799550d56ae1509b51bfffd | [
"MIT"
] | 83 | 2016-02-19T02:40:04.000Z | 2022-02-15T04:48:53.000Z | girlfriend/tools/gf_test_data.py | chihongze/girlfriend | e00e62a21be5d5a08799550d56ae1509b51bfffd | [
"MIT"
] | 2 | 2016-04-11T13:11:57.000Z | 2016-09-05T11:38:19.000Z | girlfriend/tools/gf_test_data.py | chihongze/girlfriend | e00e62a21be5d5a08799550d56ae1509b51bfffd | [
"MIT"
] | 15 | 2016-04-11T13:07:52.000Z | 2022-01-07T10:47:28.000Z | # coding: utf-8
"""该工具用于生成sqlite3测试数据
用法:
gf_test_data 在当前目录下生成数据文件
gf_test_data -f /file/data 在指定目录下生成测试数据
"""
import os
import sys
import sqlite3
import os.path
import argparse
from girlfriend.util.script import show_msg_and_exit
CREATE_USER_TABLE = """
create table user (
id integer primary key not nul... | 21.690265 | 77 | 0.571195 |
import os
import sys
import sqlite3
import os.path
import argparse
from girlfriend.util.script import show_msg_and_exit
CREATE_USER_TABLE = """
create table user (
id integer primary key not null,
email text not null,
name text not null,
login_date date not null
)
"""
CREATE_CAT_TABLE = """
create table cat... | true | true |
f76ddcb9fcf0aa3403c9be17e222e1f18dc867ca | 1,029 | py | Python | src/Transformers/TrueStaticTransformer.py | BlackBeard98/Code-Generation | 769ef8fd9162c0fae6326dc9d08e20bb5d20c067 | [
"MIT"
] | 1 | 2021-11-03T01:24:21.000Z | 2021-11-03T01:24:21.000Z | src/Transformers/TrueStaticTransformer.py | BlackBeard98/Code-Generation | 769ef8fd9162c0fae6326dc9d08e20bb5d20c067 | [
"MIT"
] | null | null | null | src/Transformers/TrueStaticTransformer.py | BlackBeard98/Code-Generation | 769ef8fd9162c0fae6326dc9d08e20bb5d20c067 | [
"MIT"
] | null | null | null | import sys
sys.path.append("..")
from CGPython import CodeGenerationTransformer
from CGPython.Commands import ModifyMethodCommand
from ast import ClassDef, FunctionDef, Name
class TrueStaticTransformer(CodeGenerationTransformer):
def Transform(self):
def func(cmd:ModifyMethodCommand, name:str):
return cmd.Decora... | 44.73913 | 109 | 0.638484 | import sys
sys.path.append("..")
from CGPython import CodeGenerationTransformer
from CGPython.Commands import ModifyMethodCommand
from ast import ClassDef, FunctionDef, Name
class TrueStaticTransformer(CodeGenerationTransformer):
def Transform(self):
def func(cmd:ModifyMethodCommand, name:str):
return cmd.Decora... | true | true |
f76ddccf38e73645eb7f6e5623cf8eefc35f9886 | 216 | py | Python | hello/models.py | choudharykartik1717/python-docs-hello-django | 854d24d61598c7058debb8a7ff5ae3f5f02f4572 | [
"MIT"
] | null | null | null | hello/models.py | choudharykartik1717/python-docs-hello-django | 854d24d61598c7058debb8a7ff5ae3f5f02f4572 | [
"MIT"
] | null | null | null | hello/models.py | choudharykartik1717/python-docs-hello-django | 854d24d61598c7058debb8a7ff5ae3f5f02f4572 | [
"MIT"
] | null | null | null | from django.db import models
# Create your models here.
class Post(models.Model):
title=models.CharField(max_length=120,null=True,blank=True)
desc = models.CharField(max_length=250,null=True,blank=True)
| 30.857143 | 64 | 0.75463 | from django.db import models
class Post(models.Model):
title=models.CharField(max_length=120,null=True,blank=True)
desc = models.CharField(max_length=250,null=True,blank=True)
| true | true |
f76ddcd5da3196b0f6d1aaab858d7c352033fcac | 9,928 | py | Python | usnparser/usn.py | lc4nt/USN-Journal-Parser | 743b7f6bc9566c6fc3eee52aa20bc9cefdcd8149 | [
"Apache-2.0"
] | 91 | 2015-11-03T17:44:37.000Z | 2022-03-18T15:31:01.000Z | usnparser/usn.py | lc4nt/USN-Journal-Parser | 743b7f6bc9566c6fc3eee52aa20bc9cefdcd8149 | [
"Apache-2.0"
] | 7 | 2015-12-06T23:43:33.000Z | 2021-12-29T21:39:04.000Z | usnparser/usn.py | lc4nt/USN-Journal-Parser | 743b7f6bc9566c6fc3eee52aa20bc9cefdcd8149 | [
"Apache-2.0"
] | 19 | 2015-11-04T16:56:32.000Z | 2022-01-24T15:01:30.000Z | #!/usr/bin/python
#
# Copyright 2017 Adam Witt
#
# 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... | 37.323308 | 129 | 0.607776 |
from __future__ import print_function
import os
import sys
import json
import struct
import collections
from argparse import ArgumentParser
from datetime import datetime,timedelta
reasons = collections.OrderedDict()
reasons[0x1] = u'DATA_OVERWRITE'
reasons[0x2] = u'DATA_EXTEND'
reasons[0x4] = u'DATA_TRUNCATION'
re... | true | true |
f76ddd8357714fff7b7995223eff833292cd4c6b | 29,463 | py | Python | pypy/objspace/std/stringmethods.py | yxzoro/pypy | 6e47b3d3e5513d9639a21554963a6ace172ccfee | [
"Apache-2.0",
"OpenSSL"
] | null | null | null | pypy/objspace/std/stringmethods.py | yxzoro/pypy | 6e47b3d3e5513d9639a21554963a6ace172ccfee | [
"Apache-2.0",
"OpenSSL"
] | null | null | null | pypy/objspace/std/stringmethods.py | yxzoro/pypy | 6e47b3d3e5513d9639a21554963a6ace172ccfee | [
"Apache-2.0",
"OpenSSL"
] | null | null | null | """Functionality shared between bytes/bytearray/unicode"""
from rpython.rlib import jit
from rpython.rlib.objectmodel import specialize, newlist_hint
from rpython.rlib.rarithmetic import ovfcheck
from rpython.rlib.rstring import (
find, rfind, count, endswith, replace, rsplit, split, startswith)
from pypy.interpre... | 36.239852 | 83 | 0.575196 |
from rpython.rlib import jit
from rpython.rlib.objectmodel import specialize, newlist_hint
from rpython.rlib.rarithmetic import ovfcheck
from rpython.rlib.rstring import (
find, rfind, count, endswith, replace, rsplit, split, startswith)
from pypy.interpreter.error import OperationError, oefmt
from pypy.interprete... | true | true |
f76ddf027dcadb2851875bcc1b289764548a6071 | 2,677 | py | Python | 2018/advent4.py | smokeytheblair/adventcode2018 | 2f39660fe9be616d783c40bced4612d3f11a4196 | [
"MIT"
] | null | null | null | 2018/advent4.py | smokeytheblair/adventcode2018 | 2f39660fe9be616d783c40bced4612d3f11a4196 | [
"MIT"
] | null | null | null | 2018/advent4.py | smokeytheblair/adventcode2018 | 2f39660fe9be616d783c40bced4612d3f11a4196 | [
"MIT"
] | null | null | null | import sys
from datetime import datetime
import re
def print_usage(name):
print("python3 {} <input_file>".format(name))
def find_most_asleep(notes):
print("finding most asleep time...")
sleeping_minutes = {}
sleepiest_guard = {}
guard_id = 0
asleep_time = 0
wake_time = 0
for tim... | 29.417582 | 107 | 0.611132 | import sys
from datetime import datetime
import re
def print_usage(name):
print("python3 {} <input_file>".format(name))
def find_most_asleep(notes):
print("finding most asleep time...")
sleeping_minutes = {}
sleepiest_guard = {}
guard_id = 0
asleep_time = 0
wake_time = 0
for tim... | true | true |
f76ddf4d95a4fe2d0052cf8acab51c7c73e035c2 | 7,991 | py | Python | BaseTools/Source/Python/GenFds/FfsFileStatement.py | sscargal/ipmctl | 48e4cdc8682e9efafc838bda66d4af282c29dc11 | [
"BSD-3-Clause"
] | 151 | 2018-06-01T20:14:34.000Z | 2022-03-13T08:34:07.000Z | BaseTools/Source/Python/GenFds/FfsFileStatement.py | sscargal/ipmctl | 48e4cdc8682e9efafc838bda66d4af282c29dc11 | [
"BSD-3-Clause"
] | 179 | 2018-06-21T18:07:54.000Z | 2022-03-30T16:06:39.000Z | BaseTools/Source/Python/GenFds/FfsFileStatement.py | sscargal/ipmctl | 48e4cdc8682e9efafc838bda66d4af282c29dc11 | [
"BSD-3-Clause"
] | 58 | 2018-06-07T21:59:15.000Z | 2022-03-16T23:26:38.000Z | ## @file
# process FFS generation from FILE statement
#
# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full... | 44.642458 | 141 | 0.558628 |
import Ffs
import Rule
import Common.LongFilePathOs as os
import StringIO
import subprocess
from GenFdsGlobalVariable import GenFdsGlobalVariable
from CommonDataClass.FdfClass import FileStatementClassObject
from Common import EdkLogger
from Common.BuildToolError import *
from Common.Misc import GuidStruct... | true | true |
f76ddf5dfc59a8abd692e6cf0e59b111e0d2b551 | 15,506 | py | Python | configs/future3d/htc_GIOU.py | rechardgu0816/Instance-segmentation-tianchi | 1d950cfd92ea9b4861fa189709d1cee3fc1b59aa | [
"MIT"
] | 2 | 2020-08-18T05:46:53.000Z | 2020-08-18T05:48:34.000Z | configs/future3d/htc_GIOU.py | rechardgu0816/Instance-segmentation-tianchi | 1d950cfd92ea9b4861fa189709d1cee3fc1b59aa | [
"MIT"
] | null | null | null | configs/future3d/htc_GIOU.py | rechardgu0816/Instance-segmentation-tianchi | 1d950cfd92ea9b4861fa189709d1cee3fc1b59aa | [
"MIT"
] | null | null | null | model = dict(
type='HybridTaskCascade',
# pretrained='open-mmlab://resnext101_64x4d',
backbone=dict(
type='ResNeXt',
depth=101,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
norm_eval=True,
... | 35.893519 | 117 | 0.470141 | model = dict(
type='HybridTaskCascade',
backbone=dict(
type='ResNeXt',
depth=101,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
norm_eval=True,
style='pytorch',
groups=64,
b... | false | true |
f76ddfb9ef32b4ec6ba69e7ee82bb62d9e7fc167 | 1,287 | py | Python | tests/timesheet/test_to_lines.py | simonbru/taxi | 3940f520b6d61b5ac7c851c38dfd05da2f65b647 | [
"WTFPL"
] | 17 | 2016-02-02T14:10:49.000Z | 2021-11-30T00:04:29.000Z | tests/timesheet/test_to_lines.py | simonbru/taxi | 3940f520b6d61b5ac7c851c38dfd05da2f65b647 | [
"WTFPL"
] | 70 | 2015-01-08T17:02:42.000Z | 2021-09-21T20:08:07.000Z | tests/timesheet/test_to_lines.py | simonbru/taxi | 3940f520b6d61b5ac7c851c38dfd05da2f65b647 | [
"WTFPL"
] | 8 | 2015-08-23T12:50:36.000Z | 2021-11-26T10:33:45.000Z | import datetime
from taxi.timesheet import Entry
from . import create_timesheet
def test_to_lines_returns_all_lines():
contents = """10.10.2012
foo 09:00-10:00 baz
bar -11:00 foobar"""
t = create_timesheet(contents, True)
lines = t.entries.to_lines()
assert lines == ['10.10.2012', 'foo 09:00-1... | 25.235294 | 73 | 0.592852 | import datetime
from taxi.timesheet import Entry
from . import create_timesheet
def test_to_lines_returns_all_lines():
contents = """10.10.2012
foo 09:00-10:00 baz
bar -11:00 foobar"""
t = create_timesheet(contents, True)
lines = t.entries.to_lines()
assert lines == ['10.10.2012', 'foo 09:00-1... | true | true |
f76de0ca4855411317d65312ae9dad66e2056125 | 1,172 | py | Python | functionaltests/api/common/apputils.py | devdattakulkarni/test-solum | 4e9ddb82d217116aa2c30a6f2581080cbdfae325 | [
"Apache-2.0"
] | null | null | null | functionaltests/api/common/apputils.py | devdattakulkarni/test-solum | 4e9ddb82d217116aa2c30a6f2581080cbdfae325 | [
"Apache-2.0"
] | null | null | null | functionaltests/api/common/apputils.py | devdattakulkarni/test-solum | 4e9ddb82d217116aa2c30a6f2581080cbdfae325 | [
"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 t... | 31.675676 | 75 | 0.680034 |
import random
import string
def get_sample_data(languagepack=''):
data = dict()
s = string.lowercase
data["name"] = "test_app" + ''.join(random.sample(s, 5))
data["description"] = "descp"
data["languagepack"] = languagepack
data["trigger_actions"] = ["test", "build", "deploy"]
data["ports... | true | true |
f76de113981c32c8fba69d5886599571dd1a5559 | 4,635 | py | Python | tests/metrics/test_modis_evi.py | natgeosociety/marapp-metrics | f3883452fbbe4101c7a6a6481316fe78246c8be2 | [
"Apache-2.0"
] | null | null | null | tests/metrics/test_modis_evi.py | natgeosociety/marapp-metrics | f3883452fbbe4101c7a6a6481316fe78246c8be2 | [
"Apache-2.0"
] | 4 | 2020-11-25T12:03:26.000Z | 2022-01-22T13:58:02.000Z | tests/metrics/test_modis_evi.py | natgeosociety/marapp-metrics | f3883452fbbe4101c7a6a6481316fe78246c8be2 | [
"Apache-2.0"
] | 1 | 2021-02-23T18:58:10.000Z | 2021-02-23T18:58:10.000Z | """
Copyright 2018-2020 National Geographic Society
Use of this software does not constitute endorsement by National Geographic
Society (NGS). The NGS name and NGS logo may not be used for any purpose without
written permission from NGS.
Licensed under the Apache License, Version 2.0 (the "License"); you ma... | 31.530612 | 87 | 0.675512 |
import pytest
from marapp_metrics.metrics.base.metric_base import MetricComputeException
from marapp_metrics.helpers.util import abspath
from marapp_metrics.metrics.modis_evi import ModisEvi
from ..util import (
json_reader,
traverse_nested,
deepgetattr,
geojson_reader,
json_writer,
)
@pytest.ma... | true | true |
f76de25e4d82ef4d876f6bb949fbf38a46b70ef4 | 7,919 | py | Python | salt/returners/sqlite3_return.py | markgras/salt | d66cd3c935533c63870b83228b978ce43e0ef70d | [
"Apache-2.0"
] | 9,425 | 2015-01-01T05:59:24.000Z | 2022-03-31T20:44:05.000Z | salt/returners/sqlite3_return.py | markgras/salt | d66cd3c935533c63870b83228b978ce43e0ef70d | [
"Apache-2.0"
] | 33,507 | 2015-01-01T00:19:56.000Z | 2022-03-31T23:48:20.000Z | salt/returners/sqlite3_return.py | markgras/salt | d66cd3c935533c63870b83228b978ce43e0ef70d | [
"Apache-2.0"
] | 5,810 | 2015-01-01T19:11:45.000Z | 2022-03-31T02:37:20.000Z | """
Insert minion return data into a sqlite3 database
:maintainer: Mickey Malone <mickey.malone@gmail.com>
:maturity: New
:depends: None
:platform: All
Sqlite3 is a serverless database that lives in a single file.
In order to use this returner the database file must exist,
have the appropriate sche... | 26.935374 | 107 | 0.637959 |
import datetime
import logging
import salt.returners
import salt.utils.jid
import salt.utils.json
try:
import sqlite3
HAS_SQLITE3 = True
except ImportError:
HAS_SQLITE3 = False
log = logging.getLogger(__name__)
__virtualname__ = "sqlite3"
def __virtual__():
if not HAS_SQLITE3:
return Fal... | true | true |
f76de32e59ad30271b48b7608ecfad0abe73365b | 2,206 | py | Python | 4-motokimura/spacenet6_model/configs/load_config.py | motokimura/SpaceNet_SAR_Buildings_Solutions | c208d0070124e087d4c2f8dfaade5a8c1a132498 | [
"Apache-2.0"
] | 60 | 2020-07-29T23:31:18.000Z | 2022-03-20T02:02:47.000Z | 4-motokimura/spacenet6_model/configs/load_config.py | Z-Zheng/SpaceNet_SAR_Buildings_Solutions | 6a9c3962d987d985384d0d41a187f5fbfadac82c | [
"Apache-2.0"
] | 9 | 2021-01-15T08:57:15.000Z | 2021-11-04T04:27:41.000Z | 4-motokimura/spacenet6_model/configs/load_config.py | Z-Zheng/SpaceNet_SAR_Buildings_Solutions | 6a9c3962d987d985384d0d41a187f5fbfadac82c | [
"Apache-2.0"
] | 16 | 2020-07-30T12:56:03.000Z | 2021-08-13T16:55:05.000Z | import argparse
import os.path
from .defaults import get_default_config
from ..utils import config_filename, experiment_subdir, weight_best_filename
def _load_previous_experiment(config, exp_id, exp_log_dir):
"""
"""
exp_log_dir = exp_log_dir if exp_log_dir else config.LOG_ROOT
exp_subdir = experimen... | 24.786517 | 78 | 0.641886 | import argparse
import os.path
from .defaults import get_default_config
from ..utils import config_filename, experiment_subdir, weight_best_filename
def _load_previous_experiment(config, exp_id, exp_log_dir):
exp_log_dir = exp_log_dir if exp_log_dir else config.LOG_ROOT
exp_subdir = experiment_subdir(exp_id)... | true | true |
f76de4172b5cc16d13b523046f9ee974205235a6 | 932 | py | Python | Problem 001-150 Python/pb119.py | Adamssss/projectEuler | 25881b1bd82876e81197756f62ab5b0d73e3e6c8 | [
"MIT"
] | 2 | 2015-02-11T05:47:42.000Z | 2015-02-11T05:47:51.000Z | Problem 001-150 Python/pb119.py | Adamssss/projectEuler | 25881b1bd82876e81197756f62ab5b0d73e3e6c8 | [
"MIT"
] | 1 | 2015-04-13T06:36:21.000Z | 2015-04-13T06:36:21.000Z | Problem 001-150 Python/pb119.py | Adamssss/projectEuler | 25881b1bd82876e81197756f62ab5b0d73e3e6c8 | [
"MIT"
] | null | null | null | import math
import time
t1 = time.time()
def digt(num):
n = num
digt = 0
while n > 0:
digt += n%10
n = n//10
return digt
temp = []
for i in range(2,200):
for j in range(2,50-i//10):
t = round(math.pow(i,j))
if digt(t) == i:
temp.append(t)
def quickSor... | 16.068966 | 80 | 0.404506 | import math
import time
t1 = time.time()
def digt(num):
n = num
digt = 0
while n > 0:
digt += n%10
n = n//10
return digt
temp = []
for i in range(2,200):
for j in range(2,50-i//10):
t = round(math.pow(i,j))
if digt(t) == i:
temp.append(t)
def quickSor... | true | true |
f76de77cae670af47a9e66871b85847708742a14 | 1,594 | py | Python | nilearn/_utils/compat.py | darya-chyzhyk/nilearn | c2a597586314ee1fe9da260d7d7ee00ef8b4eef5 | [
"BSD-2-Clause"
] | 8 | 2019-05-29T09:38:30.000Z | 2021-01-20T03:36:59.000Z | nilearn/_utils/compat.py | darya-chyzhyk/nilearn | c2a597586314ee1fe9da260d7d7ee00ef8b4eef5 | [
"BSD-2-Clause"
] | 12 | 2021-03-09T03:01:16.000Z | 2022-03-11T23:59:36.000Z | nilearn/_utils/compat.py | darya-chyzhyk/nilearn | c2a597586314ee1fe9da260d7d7ee00ef8b4eef5 | [
"BSD-2-Clause"
] | 1 | 2020-07-17T12:49:49.000Z | 2020-07-17T12:49:49.000Z | """
Compatibility layer for Python 3/Python 2 single codebase
"""
import sys
import hashlib
from distutils.version import LooseVersion
import nibabel
if sys.version_info[0] == 3:
import pickle
import io
import urllib
from base64 import encodebytes
_encodebytes = encodebytes
_basestring = st... | 23.101449 | 63 | 0.625471 | import sys
import hashlib
from distutils.version import LooseVersion
import nibabel
if sys.version_info[0] == 3:
import pickle
import io
import urllib
from base64 import encodebytes
_encodebytes = encodebytes
_basestring = str
cPickle = pickle
StringIO = io.StringIO
BytesIO = io... | true | true |
f76debb0016efb737f8da51bee3cbc9fe6e9aca6 | 62 | py | Python | dynamic_initial_data/tests/fake_app_2/fixtures/initial_data.py | wesokes/django-dynamic-initial-data | ff5e6838d3e2052fc9f2547714339f7d42e48709 | [
"MIT"
] | 9 | 2015-05-13T17:27:41.000Z | 2021-01-18T01:06:16.000Z | dynamic_initial_data/tests/fake_app_2/fixtures/initial_data.py | wesokes/django-dynamic-initial-data | ff5e6838d3e2052fc9f2547714339f7d42e48709 | [
"MIT"
] | 9 | 2015-03-26T20:51:49.000Z | 2021-04-12T16:21:18.000Z | dynamic_initial_data/tests/fake_app_2/fixtures/initial_data.py | wesokes/django-dynamic-initial-data | ff5e6838d3e2052fc9f2547714339f7d42e48709 | [
"MIT"
] | 9 | 2015-03-26T19:21:02.000Z | 2019-06-06T18:11:24.000Z | from fake import BadPath
assert(BadPath) # pragma: no cover
| 15.5 | 35 | 0.758065 | from fake import BadPath
assert(BadPath) | true | true |
f76debd696a8df38dc5fd4272a6c2bb1b8f8d823 | 1,660 | py | Python | main.py | marcheiligers/tenvis-th661-ctrl | ace225f64e695f2f90535bf3d97000589a351478 | [
"MIT"
] | 1 | 2020-09-26T06:06:29.000Z | 2020-09-26T06:06:29.000Z | main.py | marcheiligers/tenvis-th661-ctrl | ace225f64e695f2f90535bf3d97000589a351478 | [
"MIT"
] | null | null | null | main.py | marcheiligers/tenvis-th661-ctrl | ace225f64e695f2f90535bf3d97000589a351478 | [
"MIT"
] | null | null | null | import time
import os
import requests
from threading import Timer
class TenvisTH661:
def __init__(self, ip, username, password):
self.ip = ip
self.username = username
self.password = password
def pan_left(self, time=1.0):
return self.move('left', time)
def pan_right(self, time=1.0):
retur... | 25.538462 | 114 | 0.641566 | import time
import os
import requests
from threading import Timer
class TenvisTH661:
def __init__(self, ip, username, password):
self.ip = ip
self.username = username
self.password = password
def pan_left(self, time=1.0):
return self.move('left', time)
def pan_right(self, time=1.0):
retur... | true | true |
f76decc2d94b5d52c5c57878bef3ace5b6603125 | 10,004 | py | Python | contrib/spendfrom/spendfrom.py | monetaproject/moneta | e76cf3264be333583cc2732136ac3a7c46c80cce | [
"MIT"
] | 1 | 2015-05-04T01:31:01.000Z | 2015-05-04T01:31:01.000Z | contrib/spendfrom/spendfrom.py | monetaproject/moneta | e76cf3264be333583cc2732136ac3a7c46c80cce | [
"MIT"
] | null | null | null | contrib/spendfrom/spendfrom.py | monetaproject/moneta | e76cf3264be333583cc2732136ac3a7c46c80cce | [
"MIT"
] | null | null | null | #!/usr/bin/env python
#
# Use the raw transactions API to spend monetas received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a monetad or Monet... | 37.328358 | 111 | 0.631447 |
from decimal import *
import getpass
import math
import os
import os.path
import platform
import sys
import time
from jsonrpc import ServiceProxy, json
BASE_FEE=Decimal("0.001")
def check_json_precision():
n = Decimal("20000000.00000003")
satoshis = int(json.loads(json.dumps(float(n)))*1.0e8)
if satoshis... | true | true |
f76dee5f6370432b3931146ded67eda4175a2100 | 4,396 | py | Python | src/ir/function.py | ssarangi/python_type_inference | d04c4021b8a3f971015703f78f5742b002fbe9dd | [
"MIT"
] | null | null | null | src/ir/function.py | ssarangi/python_type_inference | d04c4021b8a3f971015703f78f5742b002fbe9dd | [
"MIT"
] | null | null | null | src/ir/function.py | ssarangi/python_type_inference | d04c4021b8a3f971015703f78f5742b002fbe9dd | [
"MIT"
] | null | null | null | __author__ = 'sarangis'
from src.ir.exceptions import *
from src.ir.validator import *
from src.ir.instructions import Instruction, BasicBlock
class Global:
def __init__(self, name, initializer):
self.__name = name
self.__initializer = initializer
@property
def name(self):
return... | 25.12 | 83 | 0.583485 | __author__ = 'sarangis'
from src.ir.exceptions import *
from src.ir.validator import *
from src.ir.instructions import Instruction, BasicBlock
class Global:
def __init__(self, name, initializer):
self.__name = name
self.__initializer = initializer
@property
def name(self):
return... | false | true |
f76dee73167777e9a895bbcfc0146630af8626e7 | 1,796 | py | Python | examples/starkex-cairo/starkware/cairo/lang/compiler/identifier_utils.py | LatticeLabVentures/BeamNet | e4a755dbc52b4eaef73074b22d4431df88394b4a | [
"CC0-1.0"
] | null | null | null | examples/starkex-cairo/starkware/cairo/lang/compiler/identifier_utils.py | LatticeLabVentures/BeamNet | e4a755dbc52b4eaef73074b22d4431df88394b4a | [
"CC0-1.0"
] | null | null | null | examples/starkex-cairo/starkware/cairo/lang/compiler/identifier_utils.py | LatticeLabVentures/BeamNet | e4a755dbc52b4eaef73074b22d4431df88394b4a | [
"CC0-1.0"
] | null | null | null | from typing import Dict
from starkware.cairo.lang.compiler.identifier_definition import (
IdentifierDefinition, MemberDefinition, OffsetReferenceDefinition, ReferenceDefinition)
from starkware.cairo.lang.compiler.identifier_manager import (
IdentifierManager, IdentifierSearchResult)
from starkware.cairo.lang.c... | 37.416667 | 95 | 0.744989 | from typing import Dict
from starkware.cairo.lang.compiler.identifier_definition import (
IdentifierDefinition, MemberDefinition, OffsetReferenceDefinition, ReferenceDefinition)
from starkware.cairo.lang.compiler.identifier_manager import (
IdentifierManager, IdentifierSearchResult)
from starkware.cairo.lang.c... | true | true |
f76deed0e75b783ef0143cb540b319df868d4ab3 | 101 | py | Python | core/__init__.py | ivclab/CondConvContinual | e98d0e3bc70767a5e5517fc9f1451dcea4884275 | [
"BSD-3-Clause"
] | 13 | 2020-10-23T07:53:02.000Z | 2022-02-06T05:40:59.000Z | core/__init__.py | ivclab/CondConvContinual | e98d0e3bc70767a5e5517fc9f1451dcea4884275 | [
"BSD-3-Clause"
] | null | null | null | core/__init__.py | ivclab/CondConvContinual | e98d0e3bc70767a5e5517fc9f1451dcea4884275 | [
"BSD-3-Clause"
] | null | null | null | from .register import *
from .schedulers import *
from .optimizers import *
from .backbones import *
| 20.2 | 25 | 0.762376 | from .register import *
from .schedulers import *
from .optimizers import *
from .backbones import *
| true | true |
f76deefa906eb36cd950bcdafa97983da0ae7c71 | 3,559 | py | Python | tests/datastructures/test_linkedlist.py | deniscostadsc/becoming-a-better-programmer | ec993d494ef5e9272429cc4d2ed1e7ffbe8e1bfd | [
"MIT"
] | 1 | 2020-05-04T11:28:35.000Z | 2020-05-04T11:28:35.000Z | tests/datastructures/test_linkedlist.py | deniscostadsc/becoming-a-better-programmer | ec993d494ef5e9272429cc4d2ed1e7ffbe8e1bfd | [
"MIT"
] | null | null | null | tests/datastructures/test_linkedlist.py | deniscostadsc/becoming-a-better-programmer | ec993d494ef5e9272429cc4d2ed1e7ffbe8e1bfd | [
"MIT"
] | null | null | null | import pytest
from datastructures import LinkedList
@pytest.fixture
def linked_list():
return LinkedList()
def test_linked_list_size_is_initially_zero(linked_list):
assert len(linked_list) == 0
def test_append_item_to_linked_list(linked_list):
linked_list.append(1)
assert len(linked_list) == 1
... | 27.804688 | 68 | 0.738129 | import pytest
from datastructures import LinkedList
@pytest.fixture
def linked_list():
return LinkedList()
def test_linked_list_size_is_initially_zero(linked_list):
assert len(linked_list) == 0
def test_append_item_to_linked_list(linked_list):
linked_list.append(1)
assert len(linked_list) == 1
... | true | true |
f76def786ebe4cf70e4e9ba983b84bf58f8b0ab7 | 2,279 | py | Python | lib/buildtools.py | slyd0g/shad0w | 17046376438bc9187bc054e49f10e175acef940e | [
"MIT"
] | 1 | 2021-03-24T05:27:46.000Z | 2021-03-24T05:27:46.000Z | lib/buildtools.py | slyd0g/shad0w | 17046376438bc9187bc054e49f10e175acef940e | [
"MIT"
] | null | null | null | lib/buildtools.py | slyd0g/shad0w | 17046376438bc9187bc054e49f10e175acef940e | [
"MIT"
] | null | null | null | import os
from lib import shellcode
def clone_source_files():
# move the source files of the beacon over
# to the build directory
# put us in the correct dir (this obviously needs to be inside docker)
os.chdir("/root/shad0w/beacon")
# why reinvent the wheel? lets jus use cp
os.popen("cp src/... | 27.792683 | 145 | 0.676613 | import os
from lib import shellcode
def clone_source_files():
os.chdir("/root/shad0w/beacon")
os.popen("cp src/*.c build/")
os.popen("cp src/*.h build/")
os.popen("cp src/Makefile build/")
return
def update_settings_file(shad0wbuild):
settings_path = "/root/sha... | true | true |
f76defb236b1c76105e5759cdd1e037c4e6f50b9 | 710 | py | Python | metaranker/losses/pairwise.py | thunlp/MetaAdaptRank | 5e80520b003b0a3a5fad817edf65cf76222438dd | [
"MIT"
] | 4 | 2021-05-30T09:34:45.000Z | 2021-09-07T02:46:01.000Z | metaranker/losses/.ipynb_checkpoints/pairwise-checkpoint.py | thunlp/MetaAdaptRank | 5e80520b003b0a3a5fad817edf65cf76222438dd | [
"MIT"
] | null | null | null | metaranker/losses/.ipynb_checkpoints/pairwise-checkpoint.py | thunlp/MetaAdaptRank | 5e80520b003b0a3a5fad817edf65cf76222438dd | [
"MIT"
] | 1 | 2021-07-26T01:51:11.000Z | 2021-07-26T01:51:11.000Z | import torch
from torch import nn
from torch.autograd import Variable
class PairWise(nn.Module):
def __init__(
self,
margin=1
):
super(PairWise, self).__init__()
self.tanh = nn.Tanh()
self.loss_fct = nn.MarginRankingLoss(
margin=margin,
reductio... | 24.482759 | 68 | 0.553521 | import torch
from torch import nn
from torch.autograd import Variable
class PairWise(nn.Module):
def __init__(
self,
margin=1
):
super(PairWise, self).__init__()
self.tanh = nn.Tanh()
self.loss_fct = nn.MarginRankingLoss(
margin=margin,
reductio... | true | true |
f76defc32d9a73e3261c9252550683c7ffddb77b | 726 | py | Python | script.py | VishalRK11/Extract-and-Copy-Files-using-Python | 3357ef78e04ce3510063e0702c7b8dfd2bf207e6 | [
"MIT"
] | null | null | null | script.py | VishalRK11/Extract-and-Copy-Files-using-Python | 3357ef78e04ce3510063e0702c7b8dfd2bf207e6 | [
"MIT"
] | null | null | null | script.py | VishalRK11/Extract-and-Copy-Files-using-Python | 3357ef78e04ce3510063e0702c7b8dfd2bf207e6 | [
"MIT"
] | null | null | null | __author__ = 'Vishal'
import os
import shutil
def copy_files():
current_dir = "" # Enter the path of the directory, from where you want to copy, here.
destination_dir = "" # Enter the path of your destination directory.
extensions = () # Enter the extensions of the files you want to copy.
... | 30.25 | 92 | 0.600551 | __author__ = 'Vishal'
import os
import shutil
def copy_files():
current_dir = "" destination_dir = "" extensions = ()
os.chdir(current_dir)
for root, dir, files in os.walk('.'):
for file in files:
if os.path.splitext(file)[1] in extensions:
src ... | true | true |
f76df04fafe33ec4198ed826c173a0970619001c | 1,853 | py | Python | SCRAPE/Lib/site-packages/twisted/internet/test/test_kqueuereactor.py | Chinmoy-Prasad-Dutta/scrapy_scraper | 09f6abfc3bcf10ee28f486d83b450c89a07e066e | [
"MIT"
] | 4,612 | 2015-01-01T12:57:23.000Z | 2022-03-30T01:08:23.000Z | SCRAPE/Lib/site-packages/twisted/internet/test/test_kqueuereactor.py | Chinmoy-Prasad-Dutta/scrapy_scraper | 09f6abfc3bcf10ee28f486d83b450c89a07e066e | [
"MIT"
] | 1,243 | 2015-01-23T17:23:59.000Z | 2022-03-28T13:46:17.000Z | SCRAPE/Lib/site-packages/twisted/internet/test/test_kqueuereactor.py | Chinmoy-Prasad-Dutta/scrapy_scraper | 09f6abfc3bcf10ee28f486d83b450c89a07e066e | [
"MIT"
] | 1,236 | 2015-01-13T14:41:26.000Z | 2022-03-17T07:12:36.000Z | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.internet.kqueuereactor}.
"""
import errno
from zope.interface import implementer
from twisted.trial.unittest import TestCase
try:
from twisted.internet.kqreactor import KQueueReactor, _IKQueue
kqueueSkip = None... | 25.383562 | 79 | 0.660011 |
import errno
from zope.interface import implementer
from twisted.trial.unittest import TestCase
try:
from twisted.internet.kqreactor import KQueueReactor, _IKQueue
kqueueSkip = None
except ImportError:
kqueueSkip = "KQueue not available."
def _fakeKEvent(*args, **kwargs):
def makeFakeKQueue(testKQ... | true | true |
f76df11a2766d33c838a54e9eeb69a1dde5a403b | 1,036 | py | Python | tests/unit/settings_tests.py | DrOctogon/unwash_ecom | f78fc87f5dbca86a483ca9cfa7fb6f302d15b741 | [
"BSD-3-Clause"
] | 2 | 2015-12-11T00:19:15.000Z | 2021-11-14T19:44:42.000Z | tests/unit/settings_tests.py | DrOctogon/unwash_ecom | f78fc87f5dbca86a483ca9cfa7fb6f302d15b741 | [
"BSD-3-Clause"
] | 1 | 2021-12-13T20:48:46.000Z | 2021-12-13T20:48:46.000Z | tests/unit/settings_tests.py | DrOctogon/unwash_ecom | f78fc87f5dbca86a483ca9cfa7fb6f302d15b741 | [
"BSD-3-Clause"
] | 2 | 2018-12-27T09:42:38.000Z | 2018-12-27T10:21:07.000Z | from django.test import TestCase
from django.template import loader, base
import oscar
class TestOscarCoreAppsList(TestCase):
def test_includes_oscar_itself(self):
core_apps = oscar.OSCAR_CORE_APPS
self.assertTrue('oscar' in core_apps)
def test_can_be_retrieved_through_fn(self):
cor... | 30.470588 | 66 | 0.687259 | from django.test import TestCase
from django.template import loader, base
import oscar
class TestOscarCoreAppsList(TestCase):
def test_includes_oscar_itself(self):
core_apps = oscar.OSCAR_CORE_APPS
self.assertTrue('oscar' in core_apps)
def test_can_be_retrieved_through_fn(self):
cor... | true | true |
f76df25ddc5cf3694a013b3f936029080cc1b033 | 2,328 | py | Python | salt/daemons/test/test_minion.py | dr4Ke/salt | 8ffa4903c9ed10c81e1a6c7b967dc9532f320c0b | [
"Apache-2.0"
] | 1 | 2015-08-20T21:55:17.000Z | 2015-08-20T21:55:17.000Z | salt/daemons/test/test_minion.py | dr4Ke/salt | 8ffa4903c9ed10c81e1a6c7b967dc9532f320c0b | [
"Apache-2.0"
] | null | null | null | salt/daemons/test/test_minion.py | dr4Ke/salt | 8ffa4903c9ed10c81e1a6c7b967dc9532f320c0b | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Runs minion floscript
'''
# pylint: skip-file
import os
import stat
from ioflo.base.odicting import odict
from ioflo.base.consoling import getConsole
console = getConsole()
import salt.daemons.flo
FLO_DIR_PATH = os.path.join(
os.path.dirname(os.path.dirname(os.p... | 27.714286 | 71 | 0.632302 | '''
Runs minion floscript
'''
import os
import stat
from ioflo.base.odicting import odict
from ioflo.base.consoling import getConsole
console = getConsole()
import salt.daemons.flo
FLO_DIR_PATH = os.path.join(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'flo'
)
def test():
""" Execute run.... | false | true |
f76df454cf0186d33d5b61da367beeb27f22f66e | 2,683 | py | Python | tests/cli_tests.py | JoshBarr/python-mammoth | e24c3d90fee2bcc4c2c3ad47e38c0cbba42945d8 | [
"BSD-2-Clause"
] | 1 | 2015-08-15T21:53:03.000Z | 2015-08-15T21:53:03.000Z | tests/cli_tests.py | JoshBarr/python-mammoth | e24c3d90fee2bcc4c2c3ad47e38c0cbba42945d8 | [
"BSD-2-Clause"
] | null | null | null | tests/cli_tests.py | JoshBarr/python-mammoth | e24c3d90fee2bcc4c2c3ad47e38c0cbba42945d8 | [
"BSD-2-Clause"
] | null | null | null | import os
import base64
from nose.tools import istest, assert_equal
import spur
import tempman
from .testing import test_path
_local = spur.LocalShell()
@istest
def html_is_printed_to_stdout_if_output_file_is_not_set():
docx_path = test_path("single-paragraph.docx")
result = _local.run(["mammoth", docx_pat... | 38.884058 | 168 | 0.702572 | import os
import base64
from nose.tools import istest, assert_equal
import spur
import tempman
from .testing import test_path
_local = spur.LocalShell()
@istest
def html_is_printed_to_stdout_if_output_file_is_not_set():
docx_path = test_path("single-paragraph.docx")
result = _local.run(["mammoth", docx_pat... | true | true |
f76df5105a66653b76995d1574795f7f1482a645 | 1,672 | py | Python | Competitive Programming/Binary Trees/Height of Binary Tree.py | shreejitverma/GeeksforGeeks | d7bcb166369fffa9a031a258e925b6aff8d44e6c | [
"MIT"
] | 2 | 2022-02-18T05:14:28.000Z | 2022-03-08T07:00:08.000Z | Competitive Programming/Binary Trees/Height of Binary Tree.py | shivaniverma1/Competitive-Programming-1 | d7bcb166369fffa9a031a258e925b6aff8d44e6c | [
"MIT"
] | 6 | 2022-01-13T04:31:04.000Z | 2022-03-12T01:06:16.000Z | Competitive Programming/Binary Trees/Height of Binary Tree.py | shivaniverma1/Competitive-Programming-1 | d7bcb166369fffa9a031a258e925b6aff8d44e6c | [
"MIT"
] | 2 | 2022-02-14T19:53:53.000Z | 2022-02-18T05:14:30.000Z | '''
https://www.geeksforgeeks.org/write-a-c-program-to-find-the-maximum-depth-or-height-of-a-tree/
https://practice.geeksforgeeks.org/problems/height-of-binary-tree/1
Height of Binary Tree
Medium Accuracy: 65.76% Submissions: 100k+ Points: 4
Given a binary tree, find its height.
Example 1:
Input:
1
/ \
... | 20.144578 | 236 | 0.657895 |
class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def maxDepth(node):
if node is None:
return 0
else:
lDepth = maxDepth(node.left)
rDepth = maxDepth(node.right)
if (lDepth > rDepth)... | true | true |
f76df547ff4c89689b5132fe601d15ed16a19177 | 57,960 | py | Python | fmsync2/core/controll/ControllDDD.py | progress/Flowmon-Various-Scripts | e21d6334366eae3af7a1a8bf2f5735e1460d2aa0 | [
"Apache-2.0"
] | null | null | null | fmsync2/core/controll/ControllDDD.py | progress/Flowmon-Various-Scripts | e21d6334366eae3af7a1a8bf2f5735e1460d2aa0 | [
"Apache-2.0"
] | null | null | null | fmsync2/core/controll/ControllDDD.py | progress/Flowmon-Various-Scripts | e21d6334366eae3af7a1a8bf2f5735e1460d2aa0 | [
"Apache-2.0"
] | null | null | null | # Controll class to work with Flowmon API
from core.FlowmonDDD import FlowmonDDD
class ControllDDD:
def __init__(self, app, master, slave, func, db, first):
self.app = app
self.first = first
self.master = master
self.slave = slave
self.func = func
self.db = db
... | 53.518006 | 131 | 0.466805 | from core.FlowmonDDD import FlowmonDDD
class ControllDDD:
def __init__(self, app, master, slave, func, db, first):
self.app = app
self.first = first
self.master = master
self.slave = slave
self.func = func
self.db = db
self.version = 4
def sync(self):
... | true | true |
f76df55ddb01a5f7860f8f76f3090371ef8019a6 | 684 | py | Python | tests/test_unit.py | panubo/deploy | e834db852e21e805ee98ea3cf9b862d5e997f056 | [
"BSD-3-Clause"
] | 2 | 2015-12-02T16:57:06.000Z | 2016-03-09T19:47:14.000Z | tests/test_unit.py | panubo/deploy | e834db852e21e805ee98ea3cf9b862d5e997f056 | [
"BSD-3-Clause"
] | null | null | null | tests/test_unit.py | panubo/deploy | e834db852e21e805ee98ea3cf9b862d5e997f056 | [
"BSD-3-Clause"
] | null | null | null | import unittest
from deploy import Unit
class TestUnit(unittest.TestCase):
def test_create(self):
i = Unit('foo', 'inactive', 'spawn')
self.assertEqual(i.__str__(), 'foo')
self.assertEqual(i.name, 'foo')
self.assertEqual(i.state, 'inactive')
self.assertEqual(i.required_a... | 26.307692 | 52 | 0.621345 | import unittest
from deploy import Unit
class TestUnit(unittest.TestCase):
def test_create(self):
i = Unit('foo', 'inactive', 'spawn')
self.assertEqual(i.__str__(), 'foo')
self.assertEqual(i.name, 'foo')
self.assertEqual(i.state, 'inactive')
self.assertEqual(i.required_a... | true | true |
f76df5a0c0cf1fa104c318b379843052049ef3c2 | 251 | py | Python | awsgen/command/listprofiles.py | mvallim/aws-gen-cli | 45fdb4c014e3581912ecb5fc3eda59847b7bb5cc | [
"BSD-3-Clause"
] | 7 | 2018-11-08T13:30:47.000Z | 2022-03-09T12:50:57.000Z | awsgen/command/listprofiles.py | mvallim/aws-gen-cli | 45fdb4c014e3581912ecb5fc3eda59847b7bb5cc | [
"BSD-3-Clause"
] | null | null | null | awsgen/command/listprofiles.py | mvallim/aws-gen-cli | 45fdb4c014e3581912ecb5fc3eda59847b7bb5cc | [
"BSD-3-Clause"
] | null | null | null | import logging
from awsgen.applications.profile import ProfileApp
class ListProfiles(object):
log = logging.getLogger(__name__)
def __init__(self, parser=None):
pass
def action(self, args):
ProfileApp().list()
| 17.928571 | 50 | 0.669323 | import logging
from awsgen.applications.profile import ProfileApp
class ListProfiles(object):
log = logging.getLogger(__name__)
def __init__(self, parser=None):
pass
def action(self, args):
ProfileApp().list()
| true | true |
f76df70d90f8c8102cf329126535c2e0a905ef38 | 6,238 | py | Python | make_pdf/business_cards.py | nishio/idea-generation | 7d7fa08456243dc63c9c80d15244f39b73814ad9 | [
"MIT"
] | 3 | 2019-07-12T23:08:42.000Z | 2021-03-09T04:28:50.000Z | make_pdf/business_cards.py | nishio/idea-generation | 7d7fa08456243dc63c9c80d15244f39b73814ad9 | [
"MIT"
] | null | null | null | make_pdf/business_cards.py | nishio/idea-generation | 7d7fa08456243dc63c9c80d15244f39b73814ad9 | [
"MIT"
] | null | null | null | """
Layout landscape PDF in 2 columns 5 rows (intended to print as a bisuness card)
It won't work now and I think it should be rewrited, see 25up.pdf
"""
import sys
import getopt
from PyPDF2 import PdfFileWriter, PdfFileReader
def main(argv):
size = (91, 55)
margin = (14, 11)
padding = (5, 5, 5, 5)
ou... | 34.655556 | 124 | 0.539115 | """
Layout landscape PDF in 2 columns 5 rows (intended to print as a bisuness card)
It won't work now and I think it should be rewrited, see 25up.pdf
"""
import sys
import getopt
from PyPDF2 import PdfFileWriter, PdfFileReader
def main(argv):
size = (91, 55)
margin = (14, 11)
padding = (5, 5, 5, 5)
ou... | false | true |
f76df72c543d51fc4d08575a0536b2d4c7112664 | 1,120 | py | Python | test_synonym.py | gavinzbq/synonym | b3141f0b67a45d69b0f5b83edd58226c711a413a | [
"MIT"
] | 7 | 2017-06-22T14:37:24.000Z | 2020-04-14T02:57:12.000Z | test_synonym.py | gavinzbq/synonym | b3141f0b67a45d69b0f5b83edd58226c711a413a | [
"MIT"
] | 2 | 2020-03-28T08:31:36.000Z | 2021-03-25T21:43:56.000Z | test_synonym.py | gavinzbq/synonym | b3141f0b67a45d69b0f5b83edd58226c711a413a | [
"MIT"
] | null | null | null | #!/usr/bin/env python
"""Tests for synonym."""
import unittest
from synonym import synonym
class SynonymTestCase(unittest.TestCase):
def return_synonym(self, query):
parser = synonym.get_parser()
args = vars(parser.parse_args(query.split(' ')))
return synonym.synonym(args)
def setU... | 27.317073 | 59 | 0.642857 |
import unittest
from synonym import synonym
class SynonymTestCase(unittest.TestCase):
def return_synonym(self, query):
parser = synonym.get_parser()
args = vars(parser.parse_args(query.split(' ')))
return synonym.synonym(args)
def setUp(self):
self.queries = ['display', 'ma... | true | true |
f76df72cd9f090ea13cc253dd4f9cdb8a83b5ae8 | 2,833 | py | Python | mobile/src/ristomele/gui/print_service.py | antocuni/ristomele | 1f335e5b499558e86eacb6100ed70fb6f750009c | [
"MIT"
] | null | null | null | mobile/src/ristomele/gui/print_service.py | antocuni/ristomele | 1f335e5b499558e86eacb6100ed70fb6f750009c | [
"MIT"
] | null | null | null | mobile/src/ristomele/gui/print_service.py | antocuni/ristomele | 1f335e5b499558e86eacb6100ed70fb6f750009c | [
"MIT"
] | null | null | null | import time
import Queue
import threading
from contextlib import contextmanager
from kivy.utils import platform
from kivy.event import EventDispatcher
from kivy.properties import (StringProperty, ObjectProperty)
from kivy.clock import Clock, mainthread
from ristomele.logger import Logger
from ristomele.gui.error import... | 33.329412 | 77 | 0.574303 | import time
import Queue
import threading
from contextlib import contextmanager
from kivy.utils import platform
from kivy.event import EventDispatcher
from kivy.properties import (StringProperty, ObjectProperty)
from kivy.clock import Clock, mainthread
from ristomele.logger import Logger
from ristomele.gui.error import... | false | true |
f76df867448bdf1708e5409049d1ae36f1361ce5 | 763 | py | Python | interview/leet/128_Longest_Consecutive_Sequence_v2.py | eroicaleo/LearningPython | 297d46eddce6e43ce0c160d2660dff5f5d616800 | [
"MIT"
] | 1 | 2020-10-12T13:33:29.000Z | 2020-10-12T13:33:29.000Z | interview/leet/128_Longest_Consecutive_Sequence_v2.py | eroicaleo/LearningPython | 297d46eddce6e43ce0c160d2660dff5f5d616800 | [
"MIT"
] | null | null | null | interview/leet/128_Longest_Consecutive_Sequence_v2.py | eroicaleo/LearningPython | 297d46eddce6e43ce0c160d2660dff5f5d616800 | [
"MIT"
] | 1 | 2016-11-09T07:28:45.000Z | 2016-11-09T07:28:45.000Z | #!/usr/bin/env python
# See the explanation in
# The key is, for d[n], if it's boundary
# it stores the longest consecutive numbers.
# whenever a new n inserted, the boundary which d[n] is in will be updated
class Solution:
def longestConsecutive(self, nums) -> int:
from collections import defaultdict
... | 23.121212 | 74 | 0.555701 |
# it stores the longest consecutive numbers.
# whenever a new n inserted, the boundary which d[n] is in will be updated
class Solution:
def longestConsecutive(self, nums) -> int:
from collections import defaultdict
d, r = defaultdict(int), 0
for n in nums:
if d[n] == 0:
... | true | true |
f76df8bb5f5dc056f1f4ad3d28dd9e4bb92fe5c3 | 3,308 | py | Python | tests/stress/weather-pro/invoke_ourweather.py | henryse/pi-weather-pro | edc44820295492a0437ec36a7a868bb56c309f77 | [
"Apache-2.0"
] | null | null | null | tests/stress/weather-pro/invoke_ourweather.py | henryse/pi-weather-pro | edc44820295492a0437ec36a7a868bb56c309f77 | [
"Apache-2.0"
] | null | null | null | tests/stress/weather-pro/invoke_ourweather.py | henryse/pi-weather-pro | edc44820295492a0437ec36a7a868bb56c309f77 | [
"Apache-2.0"
] | null | null | null | import urllib.request
import datetime
import argparse
import json
import sqlite3
import os.path
# --url=192.168.0.58 --method=OutdoorTemperature
def get_page(path, sub_path):
complete_url = 'http://' + path + '/' + sub_path
with urllib.request.urlopen(complete_url) as response:
full_response = respo... | 37.168539 | 118 | 0.649033 | import urllib.request
import datetime
import argparse
import json
import sqlite3
import os.path
def get_page(path, sub_path):
complete_url = 'http://' + path + '/' + sub_path
with urllib.request.urlopen(complete_url) as response:
full_response = response.read()
return full_response
def file_op... | true | true |
f76df9af781cc0824f3f6567de76917f166b9257 | 692 | py | Python | order/migrations/0013_auto_20201203_1742.py | hhdMrLion/Product-System | e870225ab10c32688a87426d5943d922c47c4404 | [
"MIT"
] | 1 | 2021-06-18T03:03:42.000Z | 2021-06-18T03:03:42.000Z | order/migrations/0013_auto_20201203_1742.py | hhdMrLion/Product-System | e870225ab10c32688a87426d5943d922c47c4404 | [
"MIT"
] | null | null | null | order/migrations/0013_auto_20201203_1742.py | hhdMrLion/Product-System | e870225ab10c32688a87426d5943d922c47c4404 | [
"MIT"
] | null | null | null | # Generated by Django 2.2.16 on 2020-12-03 09:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('order', '0012_auto_20201203_1452'),
]
operations = [
migrations.AddField(
model_name='order',
name='o... | 28.833333 | 134 | 0.560694 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('order', '0012_auto_20201203_1452'),
]
operations = [
migrations.AddField(
model_name='order',
name='order_date',
field=models.CharField(bl... | true | true |
f76dfb4400ffeef594d4b838923c0b2ad07b012d | 7,789 | py | Python | assemble_recipe.py | Team-IO/MCTools | e9fb1dbb0c314d2ad72481e89d0575e2be35cda6 | [
"Apache-2.0"
] | null | null | null | assemble_recipe.py | Team-IO/MCTools | e9fb1dbb0c314d2ad72481e89d0575e2be35cda6 | [
"Apache-2.0"
] | null | null | null | assemble_recipe.py | Team-IO/MCTools | e9fb1dbb0c314d2ad72481e89d0575e2be35cda6 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python
# Copyright 2015 Oliver Kahrmann / Team I/O
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicabl... | 28.119134 | 146 | 0.671588 |
import json
import io
import re
import math
import sys
import getopt
def main(argv):
try:
opts, args = getopt.getopt(argv, 'hdi:l:o:', ['help'])
except getopt.GetoptError:
usage()
sys.exit(2)
inFiles = list()
lFiles = list()
outFileName = ''
global _debug
_debug = 0
global translations
transl... | false | true |
f76dfbb0829a217ee1acdb2eea3d6c56def26f17 | 4,697 | py | Python | poptimizer/portfolio/optimizer.py | WLM1ke/poptimizer | 084ac14ca6212a5b14bea5bbc9bb575da077ffb0 | [
"Unlicense"
] | 94 | 2018-12-04T13:14:16.000Z | 2022-03-31T17:53:11.000Z | poptimizer/portfolio/optimizer.py | WLM1ke/poptimizer | 084ac14ca6212a5b14bea5bbc9bb575da077ffb0 | [
"Unlicense"
] | 55 | 2019-11-25T21:18:50.000Z | 2022-02-16T07:06:50.000Z | poptimizer/portfolio/optimizer.py | WLM1ke/poptimizer | 084ac14ca6212a5b14bea5bbc9bb575da077ffb0 | [
"Unlicense"
] | 25 | 2019-05-14T19:04:09.000Z | 2022-03-21T05:22:28.000Z | """Оптимизатор портфеля."""
import numpy as np
import pandas as pd
from scipy import stats
from poptimizer import config
from poptimizer.portfolio import metrics
from poptimizer.portfolio.portfolio import CASH, Portfolio
class Optimizer:
"""Предлагает сделки для улучшения метрики портфеля."""
def __init__(s... | 36.130769 | 103 | 0.634022 | import numpy as np
import pandas as pd
from scipy import stats
from poptimizer import config
from poptimizer.portfolio import metrics
from poptimizer.portfolio.portfolio import CASH, Portfolio
class Optimizer:
def __init__(self, portfolio: Portfolio, p_value: float = config.P_VALUE):
self._portfolio = p... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.