hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 417k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 1
class | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f75925a4f86606e7e5d628ab6f2f4c5eb8c139b5 | 4,160 | py | Python | openpnm/io/Pandas.py | Jimmy-INL/OpenPNM | 1546fa1ac2204443bde916f2037fac383c5069ae | [
"MIT"
] | 1 | 2020-06-08T19:48:00.000Z | 2020-06-08T19:48:00.000Z | openpnm/io/Pandas.py | Jimmy-INL/OpenPNM | 1546fa1ac2204443bde916f2037fac383c5069ae | [
"MIT"
] | null | null | null | openpnm/io/Pandas.py | Jimmy-INL/OpenPNM | 1546fa1ac2204443bde916f2037fac383c5069ae | [
"MIT"
] | null | null | null | import numpy as np
import scipy as sp
from flatdict import FlatDict
from collections import namedtuple
from openpnm.io import Dict, GenericIO
from openpnm.utils import sanitize_dict, logging
logger = logging.getLogger(__name__)
class Pandas(GenericIO):
r"""
Combines all data arrays into a Pandas DataFrame obj... | 39.245283 | 79 | 0.59976 | import numpy as np
import scipy as sp
from flatdict import FlatDict
from collections import namedtuple
from openpnm.io import Dict, GenericIO
from openpnm.utils import sanitize_dict, logging
logger = logging.getLogger(__name__)
class Pandas(GenericIO):
@classmethod
def to_dataframe(cls, network=None, phases=[... | true | true |
f7592610596be2206314014a248d230d99e9df83 | 35,286 | py | Python | tests/integration/local/invoke/test_integrations_cli.py | ramosbugs/aws-sam-cli | 98be672418f76bf1cc54db7528988b8a1c6a6b52 | [
"Apache-2.0"
] | null | null | null | tests/integration/local/invoke/test_integrations_cli.py | ramosbugs/aws-sam-cli | 98be672418f76bf1cc54db7528988b8a1c6a6b52 | [
"Apache-2.0"
] | null | null | null | tests/integration/local/invoke/test_integrations_cli.py | ramosbugs/aws-sam-cli | 98be672418f76bf1cc54db7528988b8a1c6a6b52 | [
"Apache-2.0"
] | 1 | 2021-11-29T19:10:17.000Z | 2021-11-29T19:10:17.000Z | import json
import shutil
import os
import copy
import tempfile
from unittest import skipIf
from parameterized import parameterized
from subprocess import Popen, PIPE, TimeoutExpired
from timeit import default_timer as timer
import pytest
import docker
from tests.integration.local.invoke.layer_utils import LayerUtils... | 36.794578 | 143 | 0.659213 | import json
import shutil
import os
import copy
import tempfile
from unittest import skipIf
from parameterized import parameterized
from subprocess import Popen, PIPE, TimeoutExpired
from timeit import default_timer as timer
import pytest
import docker
from tests.integration.local.invoke.layer_utils import LayerUtils... | true | true |
f7592656a565808c832c5c275ed76b3d13157350 | 1,476 | py | Python | zerver/webhooks/buildbot/tests.py | TylerPham2000/zulip | 2e7aaba0dde5517b4a55cb0bd782f009be45e3ba | [
"Apache-2.0"
] | 2 | 2020-11-12T12:28:46.000Z | 2020-11-16T11:17:46.000Z | zerver/webhooks/buildbot/tests.py | TylerPham2000/zulip | 2e7aaba0dde5517b4a55cb0bd782f009be45e3ba | [
"Apache-2.0"
] | 1 | 2021-08-05T14:46:02.000Z | 2021-08-05T14:46:02.000Z | zerver/webhooks/buildbot/tests.py | TylerPham2000/zulip | 2e7aaba0dde5517b4a55cb0bd782f009be45e3ba | [
"Apache-2.0"
] | 1 | 2021-08-05T14:27:13.000Z | 2021-08-05T14:27:13.000Z | from zerver.lib.test_classes import WebhookTestCase
class BuildbotHookTests(WebhookTestCase):
STREAM_NAME = "buildbot"
URL_TEMPLATE = "/api/v1/external/buildbot?api_key={api_key}&stream={stream}"
FIXTURE_DIR_NAME = "buildbot"
def test_build_started(self) -> None:
expected_topic = "buildbot-he... | 49.2 | 157 | 0.699864 | from zerver.lib.test_classes import WebhookTestCase
class BuildbotHookTests(WebhookTestCase):
STREAM_NAME = "buildbot"
URL_TEMPLATE = "/api/v1/external/buildbot?api_key={api_key}&stream={stream}"
FIXTURE_DIR_NAME = "buildbot"
def test_build_started(self) -> None:
expected_topic = "buildbot-he... | true | true |
f75926b621d7bd5458d3e89385204c86711ae819 | 1,676 | py | Python | scripts/init.py | liangsun/firstblog | e7b0bd3e42746b91f31cec6142fec28796426256 | [
"BSD-3-Clause"
] | null | null | null | scripts/init.py | liangsun/firstblog | e7b0bd3e42746b91f31cec6142fec28796426256 | [
"BSD-3-Clause"
] | null | null | null | scripts/init.py | liangsun/firstblog | e7b0bd3e42746b91f31cec6142fec28796426256 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
#fileencoding=utf-8
import time
import logging
import hashlib
from scaff import Scaffold
def hash_pwd(pwd, salt):
return hashlib.sha1(pwd+'|'+salt).hexdigest()[:16]
class Runner(Scaffold):
def main(self):
logging.info('Start to build index...')
self.db.user.ensure_index... | 31.622642 | 110 | 0.522673 |
import time
import logging
import hashlib
from scaff import Scaffold
def hash_pwd(pwd, salt):
return hashlib.sha1(pwd+'|'+salt).hexdigest()[:16]
class Runner(Scaffold):
def main(self):
logging.info('Start to build index...')
self.db.user.ensure_index([('mail', 1)], unique=True)
sel... | true | true |
f75926c5185daeefd0b628166a9801a5875b45fb | 16,325 | py | Python | fw_heudiconv/backend_funcs/convert.py | krmurtha/fw-heudiconv | cf41f7e6eb770317ab7c0aec051b4567ab634d01 | [
"BSD-3-Clause"
] | null | null | null | fw_heudiconv/backend_funcs/convert.py | krmurtha/fw-heudiconv | cf41f7e6eb770317ab7c0aec051b4567ab634d01 | [
"BSD-3-Clause"
] | null | null | null | fw_heudiconv/backend_funcs/convert.py | krmurtha/fw-heudiconv | cf41f7e6eb770317ab7c0aec051b4567ab634d01 | [
"BSD-3-Clause"
] | null | null | null | import logging
import re
import pdb
import operator
import pprint
import mimetypes
import flywheel
import json
import pandas as pd
from os import path
from pathvalidate import is_valid_filename
from pathlib import Path
from fw_heudiconv.cli.export import get_nested
logger = logging.getLogger('fw-heudiconv-curator')
... | 33.729339 | 117 | 0.526799 | import logging
import re
import pdb
import operator
import pprint
import mimetypes
import flywheel
import json
import pandas as pd
from os import path
from pathvalidate import is_valid_filename
from pathlib import Path
from fw_heudiconv.cli.export import get_nested
logger = logging.getLogger('fw-heudiconv-curator')
... | true | true |
f7592898a6060fa4986bb4d99efadd7f7bda97c3 | 3,061 | py | Python | tests/test_utils_get_static_file.py | loonghao/dayu_widgets | 42758872993197880f68d141ee1ce314f9b2cfea | [
"MIT"
] | null | null | null | tests/test_utils_get_static_file.py | loonghao/dayu_widgets | 42758872993197880f68d141ee1ce314f9b2cfea | [
"MIT"
] | null | null | null | tests/test_utils_get_static_file.py | loonghao/dayu_widgets | 42758872993197880f68d141ee1ce314f9b2cfea | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test get_static_file function.
"""
# Import future modules
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Import built-in modules
import os
# Import third-party modules
from dayu_widgets import CUSTOM_STA... | 31.885417 | 78 | 0.653055 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from dayu_widgets import CUSTOM_STATIC_FOLDERS
from dayu_widgets import DEFAULT_STATIC_FOLDER
from dayu_widgets import utils
import pytest
@pytest.fixture(scope="module", name="custom_folder")... | true | true |
f75928cfbbb913435e6ee3c60a3be8811842e445 | 13,503 | py | Python | tools/train_net.py | StadlerMaximilian/Detectron.pytorch | b7a7c053b15da21418f53d9e97f4652d0d139523 | [
"MIT"
] | null | null | null | tools/train_net.py | StadlerMaximilian/Detectron.pytorch | b7a7c053b15da21418f53d9e97f4652d0d139523 | [
"MIT"
] | null | null | null | tools/train_net.py | StadlerMaximilian/Detectron.pytorch | b7a7c053b15da21418f53d9e97f4652d0d139523 | [
"MIT"
] | null | null | null | """ Training Script """
import argparse
import distutils.util
import os
import sys
import pickle
import resource
import traceback
import logging
from collections import defaultdict
import numpy as np
import yaml
import torch
from torch.autograd import Variable
import torch.nn as nn
import cv2
cv2.setNumThreads(0) # ... | 36.201072 | 103 | 0.648004 |
import argparse
import distutils.util
import os
import sys
import pickle
import resource
import traceback
import logging
from collections import defaultdict
import numpy as np
import yaml
import torch
from torch.autograd import Variable
import torch.nn as nn
import cv2
cv2.setNumThreads(0)
import _init_paths
imp... | true | true |
f75928e53175aa09a47075cf723776211c28cb1c | 242 | py | Python | setup.py | dosisod/vimonous | 3e2bd74decfe922702d944a6a5ddbb25aeca2d51 | [
"MIT"
] | null | null | null | setup.py | dosisod/vimonous | 3e2bd74decfe922702d944a6a5ddbb25aeca2d51 | [
"MIT"
] | null | null | null | setup.py | dosisod/vimonous | 3e2bd74decfe922702d944a6a5ddbb25aeca2d51 | [
"MIT"
] | null | null | null | from setuptools import setup
setup(
name="vimonous",
version="0.0.0",
description="Venomous file parser powered with Python and Vim",
license="MIT",
packages=["vimonous"],
author="dosisod",
url="https://github.com/dosisod/vimonous"
)
| 20.166667 | 64 | 0.72314 | from setuptools import setup
setup(
name="vimonous",
version="0.0.0",
description="Venomous file parser powered with Python and Vim",
license="MIT",
packages=["vimonous"],
author="dosisod",
url="https://github.com/dosisod/vimonous"
)
| true | true |
f759291a9b889532433b133745164006cd72e6b6 | 28,950 | py | Python | sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/operations/_instances_operations.py | vincenttran-msft/azure-sdk-for-python | 348b56f9f03eeb3f7b502eed51daf494ffff874d | [
"MIT"
] | 2,728 | 2015-01-09T10:19:32.000Z | 2022-03-31T14:50:33.000Z | sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/operations/_instances_operations.py | v-xuto/azure-sdk-for-python | 9c6296d22094c5ede410bc83749e8df8694ccacc | [
"MIT"
] | 17,773 | 2015-01-05T15:57:17.000Z | 2022-03-31T23:50:25.000Z | sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/operations/_instances_operations.py | v-xuto/azure-sdk-for-python | 9c6296d22094c5ede410bc83749e8df8694ccacc | [
"MIT"
] | 1,916 | 2015-01-19T05:05:41.000Z | 2022-03-31T19:36:44.000Z | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 50.347826 | 205 | 0.656304 |
from typing import TYPE_CHECKING
import warnings
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport impor... | true | true |
f7592a30e067030f3c6433bc2419db06c0db8da8 | 833 | py | Python | webdriver/tests/get_window_rect/get.py | meyerweb/wpt | f04261533819893c71289614c03434c06856c13e | [
"BSD-3-Clause"
] | 14,668 | 2015-01-01T01:57:10.000Z | 2022-03-31T23:33:32.000Z | webdriver/tests/get_window_rect/get.py | meyerweb/wpt | f04261533819893c71289614c03434c06856c13e | [
"BSD-3-Clause"
] | 7,642 | 2018-05-28T09:38:03.000Z | 2022-03-31T20:55:48.000Z | webdriver/tests/get_window_rect/get.py | meyerweb/wpt | f04261533819893c71289614c03434c06856c13e | [
"BSD-3-Clause"
] | 5,941 | 2015-01-02T11:32:21.000Z | 2022-03-31T16:35:46.000Z | from tests.support.asserts import assert_error, assert_success
def get_window_rect(session):
return session.transport.send(
"GET", "session/{session_id}/window/rect".format(**vars(session)))
def test_no_top_browsing_context(session, closed_window):
response = get_window_rect(session)
assert_erro... | 26.03125 | 74 | 0.713085 | from tests.support.asserts import assert_error, assert_success
def get_window_rect(session):
return session.transport.send(
"GET", "session/{session_id}/window/rect".format(**vars(session)))
def test_no_top_browsing_context(session, closed_window):
response = get_window_rect(session)
assert_erro... | true | true |
f7592d389a1fe5a541b5c1ddbad64c82968a36d9 | 681 | py | Python | api/src/repository/UserRepository.py | thalesgelinger/truco-alpha | 93ef8a7479a1b6e5e9f79d03f9d8b46b28d143c1 | [
"MIT"
] | null | null | null | api/src/repository/UserRepository.py | thalesgelinger/truco-alpha | 93ef8a7479a1b6e5e9f79d03f9d8b46b28d143c1 | [
"MIT"
] | 3 | 2022-02-13T19:31:36.000Z | 2022-02-27T09:44:42.000Z | api/src/repository/UserRepository.py | thalesgelinger/truco-alpha | 93ef8a7479a1b6e5e9f79d03f9d8b46b28d143c1 | [
"MIT"
] | null | null | null | from python_framework import Repository
import User
@Repository(model = User.User)
class UserRepository:
def findAll(self) :
return self.repository.findAllAndCommit(self.model)
def existsByKey(self,key) :
return self.repository.existsByKeyAndCommit(key, self.model)
def findByKey(self,key... | 27.24 | 70 | 0.706314 | from python_framework import Repository
import User
@Repository(model = User.User)
class UserRepository:
def findAll(self) :
return self.repository.findAllAndCommit(self.model)
def existsByKey(self,key) :
return self.repository.existsByKeyAndCommit(key, self.model)
def findByKey(self,key... | true | true |
f7592dcddece4aefc0acb356b32eef6d5d9017ef | 4,058 | py | Python | pyXSteam/IAPWS_R4.py | drunsinn/pyXSteam | 8d1f178fa59ee99b269fd1d3b88d5cf4b8ad74af | [
"BSD-3-Clause"
] | 27 | 2015-03-14T09:24:41.000Z | 2022-03-19T16:39:48.000Z | pyXSteam/IAPWS_R4.py | drunsinn/pyXSteam | 8d1f178fa59ee99b269fd1d3b88d5cf4b8ad74af | [
"BSD-3-Clause"
] | 6 | 2017-10-11T15:13:02.000Z | 2021-03-24T08:05:51.000Z | pyXSteam/IAPWS_R4.py | drunsinn/pyXSteam | 8d1f178fa59ee99b269fd1d3b88d5cf4b8ad74af | [
"BSD-3-Clause"
] | 13 | 2017-10-11T08:07:06.000Z | 2021-07-25T01:28:46.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math
import logging
logger = logging.getLogger(__name__)
"""
IAPWS R4-84(2007)
Revised Release on Viscosity and Thermal Conductivity of Heavy Water Substance
http://www.iapws.org/relguide/TransD2O-2007.pdf
"""
def myHW_rhoT_R4(rho, T):
"""Viscosity as a funct... | 30.283582 | 106 | 0.555446 |
import math
import logging
logger = logging.getLogger(__name__)
def myHW_rhoT_R4(rho, T):
logger.debug("myHW_rhoT_R4 input: ρ {} kg/m^3, T {} K".format(rho, T))
T_star = 643.847
rho_star = 358
my_star = 55.2651
T_dash = T / T_star
rho_dash = rho / rho_star
A = [1.0, 0.940695, 0... | true | true |
f7592e4f96998fe68d5d0980f14dece98a3c71e2 | 5,738 | py | Python | cm/app/api_v1/transactions.py | HotMaps/dh_economic_assessment | 28393250b8f7a68552b90f7d8612fef216cc69e0 | [
"Apache-2.0"
] | null | null | null | cm/app/api_v1/transactions.py | HotMaps/dh_economic_assessment | 28393250b8f7a68552b90f7d8612fef216cc69e0 | [
"Apache-2.0"
] | 1 | 2022-03-08T21:10:00.000Z | 2022-03-08T21:10:00.000Z | cm/app/api_v1/transactions.py | HotMaps/dh_economic_assessment | 28393250b8f7a68552b90f7d8612fef216cc69e0 | [
"Apache-2.0"
] | null | null | null |
from flask import request, abort, jsonify ,url_for, g,flash
from . import api
from .. import SIGNATURE,CM_NAME
import json
import requests
import logging
import os
from flask import send_from_directory
from app import helper
from app import constant
from app.api_v1 import errors
import socket
from . import calculati... | 36.547771 | 634 | 0.664169 |
from flask import request, abort, jsonify ,url_for, g,flash
from . import api
from .. import SIGNATURE,CM_NAME
import json
import requests
import logging
import os
from flask import send_from_directory
from app import helper
from app import constant
from app.api_v1 import errors
import socket
from . import calculati... | true | true |
f7592f2fcdd39590c1159f62405d208086d683ce | 984 | py | Python | tests/test_pitch.py | ian-otieno/pitches-app | 8ea5e9cc77ee66261cc85a71c669b3ef0b391027 | [
"MIT"
] | null | null | null | tests/test_pitch.py | ian-otieno/pitches-app | 8ea5e9cc77ee66261cc85a71c669b3ef0b391027 | [
"MIT"
] | null | null | null | tests/test_pitch.py | ian-otieno/pitches-app | 8ea5e9cc77ee66261cc85a71c669b3ef0b391027 | [
"MIT"
] | null | null | null | import unittest
from app.models import Pitch, User
class PitchTest(unittest.TestCase):
def setUp(self):
self.user_iano=User(username='ian', password='', email='joseph@gmail.com')
self.new_pitch=Pitch(title='iano', description='time is money', category='business', user=self.user_iano)
def tearD... | 37.846154 | 113 | 0.689024 | import unittest
from app.models import Pitch, User
class PitchTest(unittest.TestCase):
def setUp(self):
self.user_iano=User(username='ian', password='', email='joseph@gmail.com')
self.new_pitch=Pitch(title='iano', description='time is money', category='business', user=self.user_iano)
def tearD... | true | true |
f7592f6688a48a8b5ba98fefa813c69c18151b09 | 4,332 | py | Python | scripts/algorithm_evaluation_fixtures.py | comic/comic-django | 4f534fae2c7d2102e94991667398aef12394e32e | [
"Apache-2.0"
] | 7 | 2016-11-05T07:16:30.000Z | 2017-11-23T03:38:03.000Z | scripts/algorithm_evaluation_fixtures.py | comic/comic-django | 4f534fae2c7d2102e94991667398aef12394e32e | [
"Apache-2.0"
] | 113 | 2015-05-26T09:27:59.000Z | 2018-03-21T10:45:56.000Z | scripts/algorithm_evaluation_fixtures.py | comic/comic-django | 4f534fae2c7d2102e94991667398aef12394e32e | [
"Apache-2.0"
] | 7 | 2015-07-16T20:11:22.000Z | 2017-06-06T02:41:24.000Z | import os
from contextlib import contextmanager
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.files.base import ContentFile
from grandchallenge.algorithms.models import Algorithm, AlgorithmImage
from grandchallenge.archives.models import Archive, ArchiveItem
from gra... | 28.12987 | 77 | 0.691367 | import os
from contextlib import contextmanager
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.files.base import ContentFile
from grandchallenge.algorithms.models import Algorithm, AlgorithmImage
from grandchallenge.archives.models import Archive, ArchiveItem
from gra... | true | true |
f7592f75c8056d3e1656aa67abb73c92bd84aa2b | 1,669 | py | Python | scholars/courses/migrations/0017_auto_20170812_0545.py | shirishgoyal/scholars | c89a87b0f8338e75cb5da0d0d20a4a340deb694e | [
"MIT"
] | null | null | null | scholars/courses/migrations/0017_auto_20170812_0545.py | shirishgoyal/scholars | c89a87b0f8338e75cb5da0d0d20a4a340deb694e | [
"MIT"
] | 14 | 2017-05-16T21:05:40.000Z | 2021-06-10T20:38:00.000Z | scholars/courses/migrations/0017_auto_20170812_0545.py | shirishgoyal/scholars | c89a87b0f8338e75cb5da0d0d20a4a340deb694e | [
"MIT"
] | 3 | 2016-10-04T21:33:11.000Z | 2019-02-03T01:04:39.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-12 05:45
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('courses', '0016_coursemember_... | 34.770833 | 150 | 0.629718 |
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('courses', '0016_coursemember_dri'),
]
operations = [
migrations.AddField(
... | true | true |
f75931f0e7bfde06089a1d50e064f567f77c7b55 | 1,519 | py | Python | test/unittests/study/mri/test_coregistered.py | szho42/banana | 131804803e6293716e9d11cbb6f3ca244b2931f9 | [
"Apache-2.0"
] | null | null | null | test/unittests/study/mri/test_coregistered.py | szho42/banana | 131804803e6293716e9d11cbb6f3ca244b2931f9 | [
"Apache-2.0"
] | null | null | null | test/unittests/study/mri/test_coregistered.py | szho42/banana | 131804803e6293716e9d11cbb6f3ca244b2931f9 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
from nipype import config
config.enable_debug_mode()
from arcana.data import InputFilesets # @IgnorePep8
from banana.file_format import nifti_gz_format, text_matrix_format # @IgnorePep8
from banana.study.mri.coregistered import ( # @IgnorePep8
CoregisteredStudy, CoregisteredToMatrixStudy)
f... | 46.030303 | 81 | 0.705727 |
from nipype import config
config.enable_debug_mode()
from arcana.data import InputFilesets
from banana.file_format import nifti_gz_format, text_matrix_format
from banana.study.mri.coregistered import (
CoregisteredStudy, CoregisteredToMatrixStudy)
from banana.testing import BaseTestCase as TestCase
class... | true | true |
f759325999f4f96c9c86a7b7e1b89633c480b9fb | 308 | py | Python | grl/envs/valid_actions_multi_agent_env.py | indylab/xdo | 1ddd92aa56ba10fa468396de8f8824c83ba9d0ba | [
"MIT"
] | 12 | 2021-03-12T07:18:52.000Z | 2022-03-15T22:30:44.000Z | grl/envs/valid_actions_multi_agent_env.py | indylab/xdo | 1ddd92aa56ba10fa468396de8f8824c83ba9d0ba | [
"MIT"
] | 1 | 2021-11-22T16:39:46.000Z | 2022-02-02T22:13:03.000Z | grl/envs/valid_actions_multi_agent_env.py | indylab/xdo | 1ddd92aa56ba10fa468396de8f8824c83ba9d0ba | [
"MIT"
] | 4 | 2021-06-21T03:54:45.000Z | 2022-01-13T10:28:26.000Z | from abc import abstractmethod
from ray.rllib.env import MultiAgentEnv
class ValidActionsMultiAgentEnv(MultiAgentEnv):
@abstractmethod
def __init__(self):
super(ValidActionsMultiAgentEnv, self).__init__()
self.observation_length = None
self.orig_observation_length = None
| 23.692308 | 57 | 0.753247 | from abc import abstractmethod
from ray.rllib.env import MultiAgentEnv
class ValidActionsMultiAgentEnv(MultiAgentEnv):
@abstractmethod
def __init__(self):
super(ValidActionsMultiAgentEnv, self).__init__()
self.observation_length = None
self.orig_observation_length = None
| true | true |
f75932eb992b566e7d07e4767d9068c74a653c1d | 4,891 | py | Python | codes/3_1.py | inspurer/ImageProcess | f826c36f3ae17bee5694c3f1748f9e5319a46fd9 | [
"MIT"
] | 1 | 2020-11-10T11:35:30.000Z | 2020-11-10T11:35:30.000Z | codes/3_1.py | inspurer/ImageProcess | f826c36f3ae17bee5694c3f1748f9e5319a46fd9 | [
"MIT"
] | null | null | null | codes/3_1.py | inspurer/ImageProcess | f826c36f3ae17bee5694c3f1748f9e5319a46fd9 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# pc_type lenovo
# create_time: 2019/11/9 15:15
# file_name: 3_1.py
import cv2
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import random
# 设置中文字体和负号正常显示
plt.rcParams['font.sans-serif'] = ['SimHei'] # 指定默认字体
plt.rcParams['axes.unicode_minus'] =... | 28.436047 | 127 | 0.618074 |
import cv2
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import random
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
sns.set_context("paper")
sns.set_style('whitegrid')
sns.set(font='SimHei')
def sp_noise(image,prob):
output = np.ze... | true | true |
f75934d75f04c5fa25a4d0e67328088585bcc8bc | 101 | py | Python | app/config.py | chauvoluuhuong/developer_review | 1ca6d2436b3f2e643d38b7427eaf6a1a490895f5 | [
"MIT"
] | null | null | null | app/config.py | chauvoluuhuong/developer_review | 1ca6d2436b3f2e643d38b7427eaf6a1a490895f5 | [
"MIT"
] | null | null | null | app/config.py | chauvoluuhuong/developer_review | 1ca6d2436b3f2e643d38b7427eaf6a1a490895f5 | [
"MIT"
] | null | null | null | import os
# DEBUG has to be to False in a production enrironment for security reasons
DEBUG = True
| 16.833333 | 75 | 0.772277 | import os
DEBUG = True
| true | true |
f7593684124bd78864a4383783dd93bc415dfa48 | 5,593 | py | Python | src/pretalx/orga/forms/mails.py | chriswolfdesign/pretalx | fb6bcf090a5c92e55a79851d60dfc716309da557 | [
"Apache-2.0"
] | null | null | null | src/pretalx/orga/forms/mails.py | chriswolfdesign/pretalx | fb6bcf090a5c92e55a79851d60dfc716309da557 | [
"Apache-2.0"
] | null | null | null | src/pretalx/orga/forms/mails.py | chriswolfdesign/pretalx | fb6bcf090a5c92e55a79851d60dfc716309da557 | [
"Apache-2.0"
] | null | null | null | from django import forms
from django.utils.translation import gettext_lazy as _
from i18nfield.forms import I18nModelForm
from pretalx.common.mixins.forms import ReadOnlyFlag
from pretalx.mail.context import get_context_explanation
from pretalx.mail.models import MailTemplate, QueuedMail
from pretalx.person.models imp... | 38.308219 | 94 | 0.569104 | from django import forms
from django.utils.translation import gettext_lazy as _
from i18nfield.forms import I18nModelForm
from pretalx.common.mixins.forms import ReadOnlyFlag
from pretalx.mail.context import get_context_explanation
from pretalx.mail.models import MailTemplate, QueuedMail
from pretalx.person.models imp... | true | true |
f75938d11392a925f4ed11a3cf688b25180988a5 | 1,279 | py | Python | solutions/0036_ValidSudoku.py | alexwawl/leetcode-solutions-javascript-python | d9da4c7ed9418070092b6f6eaf513ff54eecbb61 | [
"MIT"
] | 11 | 2019-08-05T21:44:53.000Z | 2021-04-07T17:05:33.000Z | solutions/0036_ValidSudoku.py | alexwawl/leetcode-solutions-javascript-python | d9da4c7ed9418070092b6f6eaf513ff54eecbb61 | [
"MIT"
] | null | null | null | solutions/0036_ValidSudoku.py | alexwawl/leetcode-solutions-javascript-python | d9da4c7ed9418070092b6f6eaf513ff54eecbb61 | [
"MIT"
] | 6 | 2019-09-18T22:29:32.000Z | 2021-04-12T19:03:33.000Z | class Solution(object):
def isValidSudoku(self, board):
"""
:type board: List[List[str]]
:rtype: bool
"""
def is_valid(arr):
dict = {}
tmp = []
for el in arr:
if el != '.':
tmp.append(el)
... | 31.975 | 87 | 0.42846 | class Solution(object):
def isValidSudoku(self, board):
def is_valid(arr):
dict = {}
tmp = []
for el in arr:
if el != '.':
tmp.append(el)
dict[el] = True
return len(dict.keys()) == len(tmp)
... | true | true |
f75938e964105709b813fba093280b03145b953e | 3,450 | py | Python | UML2ER/contracts/HContract02_CompleteLHS.py | levilucio/SyVOLT | 7526ec794d21565e3efcc925a7b08ae8db27d46a | [
"MIT"
] | 3 | 2017-06-02T19:26:27.000Z | 2021-06-14T04:25:45.000Z | UML2ER/contracts/HContract02_CompleteLHS.py | levilucio/SyVOLT | 7526ec794d21565e3efcc925a7b08ae8db27d46a | [
"MIT"
] | 8 | 2016-08-24T07:04:07.000Z | 2017-05-26T16:22:47.000Z | UML2ER/contracts/HContract02_CompleteLHS.py | levilucio/SyVOLT | 7526ec794d21565e3efcc925a7b08ae8db27d46a | [
"MIT"
] | 1 | 2019-10-31T06:00:23.000Z | 2019-10-31T06:00:23.000Z | from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HContract02_CompleteLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HContract02_CompleteLHS
"""
# Flag this instance as compiled now
self.is_compiled = True
... | 32.242991 | 102 | 0.681739 | from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HContract02_CompleteLHS(HimesisPreConditionPatternLHS):
def __init__(self):
self.is_compiled = True
super(HContract02_CompleteLHS, self).__init__(name='HContract02_CompleteLHS', num_nodes=0, edges=[])
self.add_edges([])
... | true | true |
f759399d75d777a9404c8b2cdc860629512132ce | 59 | py | Python | assembler/pyas/__main__.py | gaborpelesz/from-the-transistors | 089a642928f17343ff1ccb297317017c58b6a018 | [
"MIT"
] | null | null | null | assembler/pyas/__main__.py | gaborpelesz/from-the-transistors | 089a642928f17343ff1ccb297317017c58b6a018 | [
"MIT"
] | null | null | null | assembler/pyas/__main__.py | gaborpelesz/from-the-transistors | 089a642928f17343ff1ccb297317017c58b6a018 | [
"MIT"
] | null | null | null | from . import entry
if __name__ == '__main__':
entry() | 14.75 | 26 | 0.644068 | from . import entry
if __name__ == '__main__':
entry() | true | true |
f7593ad6c110b389ec9ba7ac2a18a6f4120ed1c5 | 3,279 | py | Python | pyais/util.py | mjakob/pyais | 7c4e71fe59dbfc082e13c8946c2ba24cd657e55a | [
"MIT"
] | 1 | 2021-04-10T02:15:41.000Z | 2021-04-10T02:15:41.000Z | pyais/util.py | mjakob/pyais | 7c4e71fe59dbfc082e13c8946c2ba24cd657e55a | [
"MIT"
] | null | null | null | pyais/util.py | mjakob/pyais | 7c4e71fe59dbfc082e13c8946c2ba24cd657e55a | [
"MIT"
] | null | null | null | from collections import OrderedDict
from functools import partial, reduce
from operator import xor
from typing import Generator, Sequence, Any
from bitarray import bitarray # type: ignore
from_bytes = partial(int.from_bytes, byteorder="big")
from_bytes_signed = partial(int.from_bytes, byteorder="big", signed=True)
... | 28.763158 | 106 | 0.618176 | from collections import OrderedDict
from functools import partial, reduce
from operator import xor
from typing import Generator, Sequence, Any
from bitarray import bitarray
from_bytes = partial(int.from_bytes, byteorder="big")
from_bytes_signed = partial(int.from_bytes, byteorder="big", signed=True)
def decode_in... | true | true |
f7593af4eeca08f2e9001895e487bd08ba12abce | 729 | py | Python | vsutillib/vsutillib-pyqt6/vsutillib/pyqt6/__init__.py | akai10tsuki/vsutillib | 6d623171cc2a5c66a94fb508bfc312abeab49ff2 | [
"MIT"
] | null | null | null | vsutillib/vsutillib-pyqt6/vsutillib/pyqt6/__init__.py | akai10tsuki/vsutillib | 6d623171cc2a5c66a94fb508bfc312abeab49ff2 | [
"MIT"
] | null | null | null | vsutillib/vsutillib-pyqt6/vsutillib/pyqt6/__init__.py | akai10tsuki/vsutillib | 6d623171cc2a5c66a94fb508bfc312abeab49ff2 | [
"MIT"
] | null | null | null | """
PySide2 related classes and functions
"""
# classes
from .classes import (
checkColor,
DualProgressBar,
HorizontalLine,
LineOutput,
QActionWidget,
QComboLineEdit,
QFileListWidget,
QFormatLabel,
QGroupSignal,
QMenuWidget,
QOutputTextWidget,
QProgressIndicator,
QP... | 16.953488 | 51 | 0.702332 |
from .classes import (
checkColor,
DualProgressBar,
HorizontalLine,
LineOutput,
QActionWidget,
QComboLineEdit,
QFileListWidget,
QFormatLabel,
QGroupSignal,
QMenuWidget,
QOutputTextWidget,
QProgressIndicator,
QPushButtonWidget,
QRunInThread,
QSignalLogHandle... | true | true |
f7593b939f3f5f0f0c30716c26397b7cb4816a62 | 2,236 | py | Python | uasyncio_iostream/v3/primitives/delay_ms.py | petrkr/micropython-samples | 7429834c6967579f7de8dd2fe0cd9515a3ff3d09 | [
"MIT"
] | 1 | 2020-11-06T20:26:18.000Z | 2020-11-06T20:26:18.000Z | uasyncio_iostream/v3/primitives/delay_ms.py | aivarannamaa/micropython-samples | 7004aa7370d847e6de179b84f9accb1c917ca1b0 | [
"MIT"
] | null | null | null | uasyncio_iostream/v3/primitives/delay_ms.py | aivarannamaa/micropython-samples | 7004aa7370d847e6de179b84f9accb1c917ca1b0 | [
"MIT"
] | null | null | null | import uasyncio as asyncio
import utime as time
from . import launch
# Usage:
# from primitives.delay_ms import Delay_ms
class Delay_ms:
verbose = False
def __init__(self, func=None, args=(), can_alloc=True, duration=1000):
self.func = func
self.args = args
self.can_alloc = can_alloc
... | 36.655738 | 74 | 0.616726 | import uasyncio as asyncio
import utime as time
from . import launch
class Delay_ms:
verbose = False
def __init__(self, func=None, args=(), can_alloc=True, duration=1000):
self.func = func
self.args = args
self.can_alloc = can_alloc
self.duration = duration
self._tst... | true | true |
f7593c1b6ba3e453bd0653328e4f1a9c17b8f432 | 2,724 | py | Python | userbot/plugins/corona_virus.py | githubMaster1-ux/PhoeniX | a5c1867f408de1fba3ce2fa045de37615796d941 | [
"MIT"
] | 1 | 2020-08-02T17:20:14.000Z | 2020-08-02T17:20:14.000Z | userbot/plugins/corona_virus.py | githubMaster1-ux/PhoeniX | a5c1867f408de1fba3ce2fa045de37615796d941 | [
"MIT"
] | null | null | null | userbot/plugins/corona_virus.py | githubMaster1-ux/PhoeniX | a5c1867f408de1fba3ce2fa045de37615796d941 | [
"MIT"
] | null | null | null | """CoronaVirus LookUp
"""
from covid import Covid
from userbot.utils import admin_cmd
import datetime
from telethon import events
from telethon.errors.rpcerrorlist import YouBlockedUserError
from telethon.tl.functions.account import UpdateNotifySettingsRequest
from sql.global_variables_sql import SYNTAX, MODU... | 36.810811 | 110 | 0.650147 |
from covid import Covid
from userbot.utils import admin_cmd
import datetime
from telethon import events
from telethon.errors.rpcerrorlist import YouBlockedUserError
from telethon.tl.functions.account import UpdateNotifySettingsRequest
from sql.global_variables_sql import SYNTAX, MODULE_LIST
@borg.on(admin_cm... | true | true |
f7593ce349b98119e16bc8ec0371db3bfbe90745 | 1,025 | py | Python | script/wall_stop.py | ei0410/pimouse_run_corridor | e93985c47271c529876c8ffdfff395ca3a809a56 | [
"BSD-3-Clause"
] | null | null | null | script/wall_stop.py | ei0410/pimouse_run_corridor | e93985c47271c529876c8ffdfff395ca3a809a56 | [
"BSD-3-Clause"
] | null | null | null | script/wall_stop.py | ei0410/pimouse_run_corridor | e93985c47271c529876c8ffdfff395ca3a809a56 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
import rospy, copy
from geometry_msgs.msg import Twist
from std_srvs.srv import Trigger, TriggerResponse
from pimouse_ros.msg import LightSensorValues
class WallStop():
def __init__(self):
self.cmd_vel = rospy.Publisher('/cmd_vel', Twist, queue_size=1)
self.sensor_values = Li... | 31.060606 | 76 | 0.679024 |
import rospy, copy
from geometry_msgs.msg import Twist
from std_srvs.srv import Trigger, TriggerResponse
from pimouse_ros.msg import LightSensorValues
class WallStop():
def __init__(self):
self.cmd_vel = rospy.Publisher('/cmd_vel', Twist, queue_size=1)
self.sensor_values = LightSensorValues()
... | true | true |
f7593d20c747e2a784cb4090ffa73695d89512f8 | 951 | py | Python | pyzoo/zoo/pipeline/api/torch/zoo_pickle_module.py | limn2o4/analytics-zoo | 78d6ce10976a7e1320ff5ebdf431db93a439ec56 | [
"Apache-2.0"
] | 2,970 | 2017-06-08T00:24:43.000Z | 2022-03-30T12:14:55.000Z | pyzoo/zoo/pipeline/api/torch/zoo_pickle_module.py | limn2o4/analytics-zoo | 78d6ce10976a7e1320ff5ebdf431db93a439ec56 | [
"Apache-2.0"
] | 3,530 | 2017-05-09T08:29:10.000Z | 2022-03-21T02:11:45.000Z | pyzoo/zoo/pipeline/api/torch/zoo_pickle_module.py | limn2o4/analytics-zoo | 78d6ce10976a7e1320ff5ebdf431db93a439ec56 | [
"Apache-2.0"
] | 972 | 2017-05-09T07:03:50.000Z | 2022-03-23T07:48:48.000Z | #
# Copyright 2018 Analytics Zoo Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 36.576923 | 83 | 0.770768 |
from cloudpickle import *
from cloudpickle import CloudPickler as Pickler
from pickle import Unpickler
| true | true |
f7593f0d4088dcc1c8e534d39b63446ab09e43ea | 343 | py | Python | tests/test_ray.py | Maik93/NURBS-Python | 44d87a972c694371462378672429f2acc24249b2 | [
"MIT"
] | 382 | 2016-09-22T16:21:47.000Z | 2022-03-27T18:23:16.000Z | tests/test_ray.py | Maik93/NURBS-Python | 44d87a972c694371462378672429f2acc24249b2 | [
"MIT"
] | 143 | 2017-02-10T03:45:09.000Z | 2022-03-31T05:24:05.000Z | tests/test_ray.py | Maik93/NURBS-Python | 44d87a972c694371462378672429f2acc24249b2 | [
"MIT"
] | 123 | 2016-06-10T14:11:37.000Z | 2022-03-28T11:39:00.000Z | import pytest
from geomdl import ray
from geomdl.ray import Ray, RayIntersection
def test_ray_intersect():
r2 = Ray((5.0, 181.34), (13.659999999999997, 176.34))
r3 = Ray((19.999779996773235, 189.9998729810778), (19.999652977851035, 180.00009298430456))
t0, t1, res = ray.intersect(r2, r3)
assert res !=... | 28.583333 | 95 | 0.717201 | import pytest
from geomdl import ray
from geomdl.ray import Ray, RayIntersection
def test_ray_intersect():
r2 = Ray((5.0, 181.34), (13.659999999999997, 176.34))
r3 = Ray((19.999779996773235, 189.9998729810778), (19.999652977851035, 180.00009298430456))
t0, t1, res = ray.intersect(r2, r3)
assert res !=... | true | true |
f759405eae3f0972d492d671bf41c7e59cc6fc60 | 1,965 | py | Python | ch01_arrays_and_strings/1.5_one-away.py | appletreeisyellow/cracking-the-coding-interview | dc04c1c1e75a58bd543a298520f4595425f38104 | [
"MIT"
] | null | null | null | ch01_arrays_and_strings/1.5_one-away.py | appletreeisyellow/cracking-the-coding-interview | dc04c1c1e75a58bd543a298520f4595425f38104 | [
"MIT"
] | null | null | null | ch01_arrays_and_strings/1.5_one-away.py | appletreeisyellow/cracking-the-coding-interview | dc04c1c1e75a58bd543a298520f4595425f38104 | [
"MIT"
] | null | null | null | import unittest
"""
1.5 One Away
There are three types of edits that can be performed on
strings: insert a character, remove a character, or
replace a character. Given two strings, write a function
to check if they are one edit (or zero edits) away.
EXAMPLE
pale, ple -> true
pales, pale -> true
pa... | 23.392857 | 84 | 0.619338 | import unittest
def is_one_away(str1, str2):
len1 = len(str1)
len2 = len(str2)
if len1 == len2:
return is_one_char_replaceable(str1, str2)
elif len1 + 1 == len2:
return is_one_char_insertable(str1, str2)
elif len2 + 1 == len1:
return is_one_char_insertable(str2, str1)
else:
return False
d... | true | true |
f7594226145e6e4d06699331ef3feb14b77158ee | 11,270 | py | Python | twindb_backup/cli.py | RyanCPeters/backup | 4dc19602989fe7dc49ca409d786fc833d1fcabf9 | [
"Apache-2.0"
] | null | null | null | twindb_backup/cli.py | RyanCPeters/backup | 4dc19602989fe7dc49ca409d786fc833d1fcabf9 | [
"Apache-2.0"
] | null | null | null | twindb_backup/cli.py | RyanCPeters/backup | 4dc19602989fe7dc49ca409d786fc833d1fcabf9 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Entry points for twindb-backup tool
"""
from __future__ import print_function
import shutil
import socket
import sys
import tempfile
import traceback
import os
# from typing import Union, List, Tuple, AnyStr
import click
from twindb_backup import (
# setup_logging,
LOG,
__vers... | 27.026379 | 80 | 0.659184 |
from __future__ import print_function
import shutil
import socket
import sys
import tempfile
import traceback
import os
import click
from twindb_backup import (
LOG,
__version__,
LOCK_FILE,
INTERVALS,
MEDIA_TYPES,
)
from twindb_backup.backup import run_backup_job
from twindb_backup.cache.c... | true | true |
f75942f62b8bdf2c62c2580e61b08f2c4f2c83c8 | 931 | py | Python | webserver/routers.py | AutumnSky/smart-drone | d48ea8a7c6da5e0970f3e387ab7c0e6a152f9e5d | [
"MIT"
] | 11 | 2021-05-20T18:16:41.000Z | 2022-03-21T02:50:37.000Z | webserver/routers.py | AutumnSky/smart-drone | d48ea8a7c6da5e0970f3e387ab7c0e6a152f9e5d | [
"MIT"
] | null | null | null | webserver/routers.py | AutumnSky/smart-drone | d48ea8a7c6da5e0970f3e387ab7c0e6a152f9e5d | [
"MIT"
] | 3 | 2021-07-08T10:24:16.000Z | 2022-03-30T16:02:24.000Z | from typing import (
Any,
)
from aiohttp import web
import inspect
class ClassRouteTableDef(web.RouteTableDef):
def __repr__(self) -> str:
return "<ClassRouteTableDef count={}>".format(len(self._items))
def route(self,
method: str,
path: str,
**kwargs: Any):
def inner(handler: Any) -> Any:
#... | 26.6 | 83 | 0.709989 | from typing import (
Any,
)
from aiohttp import web
import inspect
class ClassRouteTableDef(web.RouteTableDef):
def __repr__(self) -> str:
return "<ClassRouteTableDef count={}>".format(len(self._items))
def route(self,
method: str,
path: str,
**kwargs: Any):
def inner(handler: Any) -> Any:
... | true | true |
f75943019b40153e93902f623214d5c646b71842 | 2,310 | py | Python | research/object_detection_inference_test1.py | koheikawata/objectdetectiontest | a4cb01911fa3d0e10bd2c9aa3fd985113af10b1b | [
"MIT"
] | null | null | null | research/object_detection_inference_test1.py | koheikawata/objectdetectiontest | a4cb01911fa3d0e10bd2c9aa3fd985113af10b1b | [
"MIT"
] | null | null | null | research/object_detection_inference_test1.py | koheikawata/objectdetectiontest | a4cb01911fa3d0e10bd2c9aa3fd985113af10b1b | [
"MIT"
] | null | null | null | import numpy as np
import os
import tensorflow as tf
import time
import json
from PIL import Image
from object_detection.utils import ops as utils_ops
from object_detection.utils import label_map_util
THRESHOLD = 0.6
LABEL_PATH = 'object_detection/test1/pascal_label_map.pbtxt'
MODEL_PATH = 'object_detection/test1/out... | 39.827586 | 102 | 0.752814 | import numpy as np
import os
import tensorflow as tf
import time
import json
from PIL import Image
from object_detection.utils import ops as utils_ops
from object_detection.utils import label_map_util
THRESHOLD = 0.6
LABEL_PATH = 'object_detection/test1/pascal_label_map.pbtxt'
MODEL_PATH = 'object_detection/test1/out... | true | true |
f759437ada91a66b6fb489d96b3bf88ad2d186f2 | 1,856 | py | Python | config.py | jfernan2/PRInspector | c09aad3b49263d3c679fd6cfd307de404425f924 | [
"MIT"
] | null | null | null | config.py | jfernan2/PRInspector | c09aad3b49263d3c679fd6cfd307de404425f924 | [
"MIT"
] | null | null | null | config.py | jfernan2/PRInspector | c09aad3b49263d3c679fd6cfd307de404425f924 | [
"MIT"
] | null | null | null | IS_TEST = True
REPOSITORY = 'cms-sw/cmssw'
def get_repo_url():
return 'https://github.com/' + REPOSITORY + '/'
CERN_SSO_CERT_FILE = 'private/cert.pem'
CERN_SSO_KEY_FILE = 'private/cert.key'
CERN_SSO_COOKIES_LOCATION = 'private/'
TWIKI_CONTACTS_URL = 'https://ppdcontacts.web.cern.ch/PPDContacts/ppd_contacts'
TWI... | 27.294118 | 98 | 0.581358 | IS_TEST = True
REPOSITORY = 'cms-sw/cmssw'
def get_repo_url():
return 'https://github.com/' + REPOSITORY + '/'
CERN_SSO_CERT_FILE = 'private/cert.pem'
CERN_SSO_KEY_FILE = 'private/cert.key'
CERN_SSO_COOKIES_LOCATION = 'private/'
TWIKI_CONTACTS_URL = 'https://ppdcontacts.web.cern.ch/PPDContacts/ppd_contacts'
TWI... | true | true |
f75943fc43311dedc50e029b538f333df27b4cd0 | 23,348 | py | Python | api/tests/opentrons/hardware_control/test_instruments.py | Opentrons/protocol_framework | ebbd6b2fe984edd6ecfcbf1dbe040db7f7356b9f | [
"Apache-2.0"
] | null | null | null | api/tests/opentrons/hardware_control/test_instruments.py | Opentrons/protocol_framework | ebbd6b2fe984edd6ecfcbf1dbe040db7f7356b9f | [
"Apache-2.0"
] | null | null | null | api/tests/opentrons/hardware_control/test_instruments.py | Opentrons/protocol_framework | ebbd6b2fe984edd6ecfcbf1dbe040db7f7356b9f | [
"Apache-2.0"
] | null | null | null | import asyncio
import mock
import pytest
try:
import aionotify
except (OSError, ModuleNotFoundError):
aionotify = None # type: ignore
import typeguard
from opentrons import types
from opentrons.hardware_control import API
from opentrons.hardware_control.types import Axis, OT3Mount
from opentrons.hardware_c... | 34.284875 | 88 | 0.700403 | import asyncio
import mock
import pytest
try:
import aionotify
except (OSError, ModuleNotFoundError):
aionotify = None
import typeguard
from opentrons import types
from opentrons.hardware_control import API
from opentrons.hardware_control.types import Axis, OT3Mount
from opentrons.hardware_control.dev_typ... | true | true |
f7594532e8349ac95811076bacdf0b6e5fbbfa8f | 1,128 | py | Python | create_jwt.py | soerface/django_pyjwt_example | ab1459e3ad2e3e8fc080e4759b6146bcf41b0561 | [
"MIT"
] | null | null | null | create_jwt.py | soerface/django_pyjwt_example | ab1459e3ad2e3e8fc080e4759b6146bcf41b0561 | [
"MIT"
] | null | null | null | create_jwt.py | soerface/django_pyjwt_example | ab1459e3ad2e3e8fc080e4759b6146bcf41b0561 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import sys
from datetime import datetime, timedelta
import jwt
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.serialization import load_pem_private_key
# Obviously, in a production setting, you would not have checked in the private key or the passw... | 34.181818 | 117 | 0.748227 |
import sys
from datetime import datetime, timedelta
import jwt
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.serialization import load_pem_private_key
with open('private.pem') as f:
private_key_encrypted = f.read().encode()
private_key = load_pem_private_ke... | true | true |
f75946835957a8acf98ace050c01ca03382cc071 | 3,283 | py | Python | run_combinations.py | ManeeshaPerera/forecast-framework | 60a22af4a97aec10c8bbea7f3f833061283382cb | [
"BSD-3-Clause"
] | null | null | null | run_combinations.py | ManeeshaPerera/forecast-framework | 60a22af4a97aec10c8bbea7f3f833061283382cb | [
"BSD-3-Clause"
] | null | null | null | run_combinations.py | ManeeshaPerera/forecast-framework | 60a22af4a97aec10c8bbea7f3f833061283382cb | [
"BSD-3-Clause"
] | 2 | 2022-03-20T10:30:38.000Z | 2022-03-22T06:39:14.000Z | from combinations.equal_weight import EqualWeight
from combinations.pso_model import PSO
from combinations.recursive_method import RecursiveEnsemble
import constants as const
import pandas as pd
import numpy as np
def run_combinations(horizon, forecast, forecast_test, data_train, data_out_sample):
weights = {'wei... | 39.554217 | 120 | 0.672251 | from combinations.equal_weight import EqualWeight
from combinations.pso_model import PSO
from combinations.recursive_method import RecursiveEnsemble
import constants as const
import pandas as pd
import numpy as np
def run_combinations(horizon, forecast, forecast_test, data_train, data_out_sample):
weights = {'wei... | true | true |
f75946cb51298f058e6b9fd25c8f0b2bc040339f | 953 | py | Python | Old/baike_spider/html_outputer.py | exchris/Pythonlearn | 174f38a86cf1c85d6fc099005aab3568e7549cd0 | [
"MIT"
] | null | null | null | Old/baike_spider/html_outputer.py | exchris/Pythonlearn | 174f38a86cf1c85d6fc099005aab3568e7549cd0 | [
"MIT"
] | 1 | 2018-11-27T09:58:54.000Z | 2018-11-27T09:58:54.000Z | Old/baike_spider/html_outputer.py | exchris/pythonlearn | 174f38a86cf1c85d6fc099005aab3568e7549cd0 | [
"MIT"
] | null | null | null | # -*- coding:UTF-8 -*-
class HtmlOutputer(object):
def __init__(self):
self.datas = []
def collect_data(self, data):
if data is None:
return
self.datas.append(data)
def output_html(self):
fout = open('output.html', 'w')
fout... | 19.44898 | 71 | 0.428122 |
class HtmlOutputer(object):
def __init__(self):
self.datas = []
def collect_data(self, data):
if data is None:
return
self.datas.append(data)
def output_html(self):
fout = open('output.html', 'w')
fout.write("<html>")
... | true | true |
f7594719287d9c5b2831d490f40684313b2595a1 | 289 | py | Python | Leetcode/2001-3000/2211. Count Collisions on a Road/2211.py | Next-Gen-UI/Code-Dynamics | a9b9d5e3f27e870b3e030c75a1060d88292de01c | [
"MIT"
] | null | null | null | Leetcode/2001-3000/2211. Count Collisions on a Road/2211.py | Next-Gen-UI/Code-Dynamics | a9b9d5e3f27e870b3e030c75a1060d88292de01c | [
"MIT"
] | null | null | null | Leetcode/2001-3000/2211. Count Collisions on a Road/2211.py | Next-Gen-UI/Code-Dynamics | a9b9d5e3f27e870b3e030c75a1060d88292de01c | [
"MIT"
] | null | null | null | class Solution:
def countCollisions(self, directions: str) -> int:
l = 0
r = len(directions) - 1
while l < len(directions) and directions[l] == 'L':
l += 1
while r >= 0 and directions[r] == 'R':
r -= 1
return sum(c != 'S' for c in directions[l:r + 1])
| 22.230769 | 55 | 0.546713 | class Solution:
def countCollisions(self, directions: str) -> int:
l = 0
r = len(directions) - 1
while l < len(directions) and directions[l] == 'L':
l += 1
while r >= 0 and directions[r] == 'R':
r -= 1
return sum(c != 'S' for c in directions[l:r + 1])
| true | true |
f75947525c2c7deecb56c0a0feb945088ba42af1 | 1,237 | py | Python | backoffice/urls.py | rcarmo/android-signage-server | fcac8046e98d3fa171cde02eeb3778ad0acdc178 | [
"MIT"
] | 4 | 2016-10-31T03:55:24.000Z | 2021-07-11T11:00:55.000Z | backoffice/urls.py | rcarmo/android-signage-server | fcac8046e98d3fa171cde02eeb3778ad0acdc178 | [
"MIT"
] | null | null | null | backoffice/urls.py | rcarmo/android-signage-server | fcac8046e98d3fa171cde02eeb3778ad0acdc178 | [
"MIT"
] | 1 | 2018-04-02T12:47:29.000Z | 2018-04-02T12:47:29.000Z | """backoffice URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class... | 44.178571 | 233 | 0.683104 | from django.conf.urls import url
from django.contrib import admin
from django.views.generic import RedirectView
from signage import views
from os import environ
admin.site.site_header = environ.get('SITE_NAME', 'Signage Administration')
urlpatterns = [
url(r'^$', RedirectView.as_view(url='https://pixels.camp')),
... | true | true |
f75947573b278c58e3ea8f5eba91e8949a776602 | 1,610 | py | Python | art/defences/spatial_smoothing_unittest.py | Sunshine352/adversarial-robustness-toolbox | 070bf751aee40eb1b723fa5e24cde55d17978f62 | [
"MIT"
] | 1 | 2018-10-08T06:03:53.000Z | 2018-10-08T06:03:53.000Z | art/defences/spatial_smoothing_unittest.py | Sunshine352/adversarial-robustness-toolbox | 070bf751aee40eb1b723fa5e24cde55d17978f62 | [
"MIT"
] | null | null | null | art/defences/spatial_smoothing_unittest.py | Sunshine352/adversarial-robustness-toolbox | 070bf751aee40eb1b723fa5e24cde55d17978f62 | [
"MIT"
] | null | null | null | from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import unittest
import numpy as np
from art.defences.spatial_smoothing import SpatialSmoothing
logger = logging.getLogger('testLogger')
class TestLocalSpatialSmoothing(unittest.TestCase):
def test_ones(self):
... | 29.814815 | 82 | 0.570807 | from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import unittest
import numpy as np
from art.defences.spatial_smoothing import SpatialSmoothing
logger = logging.getLogger('testLogger')
class TestLocalSpatialSmoothing(unittest.TestCase):
def test_ones(self):
... | true | true |
f75947faf55f15a36baf745ce666d78c72fa9b25 | 4,277 | py | Python | test/functional/feature_includeconf.py | kryvel/bitcoin-abc | 6330d8ccc8b1b720c42c8c9239dadc8240ca5025 | [
"MIT"
] | null | null | null | test/functional/feature_includeconf.py | kryvel/bitcoin-abc | 6330d8ccc8b1b720c42c8c9239dadc8240ca5025 | [
"MIT"
] | null | null | null | test/functional/feature_includeconf.py | kryvel/bitcoin-abc | 6330d8ccc8b1b720c42c8c9239dadc8240ca5025 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Tests the includeconf argument
Verify that:
1. adding includeconf to the configuration file causes the inc... | 45.989247 | 180 | 0.671733 |
import os
from test_framework.test_framework import BitcoinTestFramework
class IncludeConfTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = False
self.num_nodes = 1
def setup_chain(self):
super().setup_chain()
with open(os.p... | true | true |
f759483641c878bdd62416d129be72f1380ae67b | 4,028 | py | Python | python/example/print_quadruped_3d.py | brokencuph/diff_pd | 2c30ecfa39762c5fc78dea9c7a226000e9fc5c15 | [
"MIT"
] | 4 | 2022-02-10T02:28:42.000Z | 2022-02-10T07:28:35.000Z | python/example/print_quadruped_3d.py | srl-ethz/diffPD_sim2real | e491668995a163b8ff7542d99f0b4e0c0f4ed2df | [
"MIT"
] | null | null | null | python/example/print_quadruped_3d.py | srl-ethz/diffPD_sim2real | e491668995a163b8ff7542d99f0b4e0c0f4ed2df | [
"MIT"
] | 2 | 2022-03-11T20:13:24.000Z | 2022-03-12T03:38:46.000Z | import sys
sys.path.append('../')
from pathlib import Path
import pickle
import matplotlib.pyplot as plt
from matplotlib.ticker import ScalarFormatter
from matplotlib.gridspec import GridSpec
import numpy as np
from py_diff_pd.common.common import print_info, print_error
def format_axes(fig):
for i, ax in enumer... | 42.851064 | 161 | 0.596822 | import sys
sys.path.append('../')
from pathlib import Path
import pickle
import matplotlib.pyplot as plt
from matplotlib.ticker import ScalarFormatter
from matplotlib.gridspec import GridSpec
import numpy as np
from py_diff_pd.common.common import print_info, print_error
def format_axes(fig):
for i, ax in enumer... | true | true |
f759484386424ba696fe4961ac9a21cc5be05e64 | 889 | py | Python | shelvery_lambda/lambda_handler.py | virajs/shelvery-aws-backups | d09f7b6a0694366f549cd130cd29e2fa59b84d5f | [
"MIT"
] | 1 | 2019-06-27T11:56:00.000Z | 2019-06-27T11:56:00.000Z | shelvery_lambda/lambda_handler.py | virajs/shelvery-aws-backups | d09f7b6a0694366f549cd130cd29e2fa59b84d5f | [
"MIT"
] | null | null | null | shelvery_lambda/lambda_handler.py | virajs/shelvery-aws-backups | d09f7b6a0694366f549cd130cd29e2fa59b84d5f | [
"MIT"
] | null | null | null | import logging
import json
from shelvery.factory import ShelveryFactory
def lambda_handler(event, context):
logger = logging.getLogger()
logger.setLevel(logging.INFO)
logger.info(f"Received event\n{json.dumps(event,indent=2)}")
if 'backup_type' not in event:
raise Exception("Expectin... | 26.939394 | 88 | 0.690664 | import logging
import json
from shelvery.factory import ShelveryFactory
def lambda_handler(event, context):
logger = logging.getLogger()
logger.setLevel(logging.INFO)
logger.info(f"Received event\n{json.dumps(event,indent=2)}")
if 'backup_type' not in event:
raise Exception("Expectin... | true | true |
f7594afedd3cb9c38215659d9561fec23d2294e9 | 1,859 | py | Python | UnitaryTest/test_tools.py | dayvr/udacity-practices-intro | 4189ed7377fb142f0b9d8152a1340c1c6889a5ba | [
"MIT"
] | 1 | 2018-08-19T15:43:31.000Z | 2018-08-19T15:43:31.000Z | UnitaryTest/test_tools.py | dayvr/udacity-practices-intro | 4189ed7377fb142f0b9d8152a1340c1c6889a5ba | [
"MIT"
] | null | null | null | UnitaryTest/test_tools.py | dayvr/udacity-practices-intro | 4189ed7377fb142f0b9d8152a1340c1c6889a5ba | [
"MIT"
] | null | null | null | # Test utils
class TestTools():
DIVIDER_LENGTH = 60
def __init__(self):
self.total_run_tests = 0
self.num_success = 0
self.test_msg = ''
self.test_result = ''
self.show_obtained = False
def __del__(self):
print('\n' + self.show_result_division())
... | 28.166667 | 94 | 0.56482 |
class TestTools():
DIVIDER_LENGTH = 60
def __init__(self):
self.total_run_tests = 0
self.num_success = 0
self.test_msg = ''
self.test_result = ''
self.show_obtained = False
def __del__(self):
print('\n' + self.show_result_division())
print(self... | true | true |
f7594d274b7843a4ef13363092b38d66f2750fa4 | 11,745 | py | Python | python_modules/libraries/dagster-celery-docker/dagster_celery_docker/executor.py | abkfenris/dagster | 7f35164535200cf904a4fdb18af207ccad09ad68 | [
"Apache-2.0"
] | null | null | null | python_modules/libraries/dagster-celery-docker/dagster_celery_docker/executor.py | abkfenris/dagster | 7f35164535200cf904a4fdb18af207ccad09ad68 | [
"Apache-2.0"
] | null | null | null | python_modules/libraries/dagster-celery-docker/dagster_celery_docker/executor.py | abkfenris/dagster | 7f35164535200cf904a4fdb18af207ccad09ad68 | [
"Apache-2.0"
] | null | null | null | import json
import os
import docker.client
from dagster_celery.config import DEFAULT_CONFIG, dict_wrapper
from dagster_celery.core_execution_loop import DELEGATE_MARKER, core_celery_execution_loop
from dagster_celery.defaults import broker_url, result_backend
from dagster_celery.executor import CELERY_CONFIG
from dag... | 37.887097 | 135 | 0.635334 | import json
import os
import docker.client
from dagster_celery.config import DEFAULT_CONFIG, dict_wrapper
from dagster_celery.core_execution_loop import DELEGATE_MARKER, core_celery_execution_loop
from dagster_celery.defaults import broker_url, result_backend
from dagster_celery.executor import CELERY_CONFIG
from dag... | true | true |
f759516b98146e1293d46617c3509c2599d8a9a1 | 1,545 | py | Python | Section03/Dictionary.py | fosterleejoe/Developing-NLP-Applications-Using-NLTK-in-Python | f2cac32c02d0632fb89f32446388ef15d9926bbc | [
"MIT"
] | 67 | 2017-11-23T18:48:47.000Z | 2022-03-29T08:03:25.000Z | Section03/Dictionary.py | fosterleejoe/Developing-NLP-Applications-Using-NLTK-in-Python | f2cac32c02d0632fb89f32446388ef15d9926bbc | [
"MIT"
] | null | null | null | Section03/Dictionary.py | fosterleejoe/Developing-NLP-Applications-Using-NLTK-in-Python | f2cac32c02d0632fb89f32446388ef15d9926bbc | [
"MIT"
] | 49 | 2017-12-06T16:10:14.000Z | 2021-11-25T09:02:49.000Z | import nltk
class LearningDictionary():
def __init__(self, sentence):
self.words = nltk.word_tokenize(sentence)
self.tagged = nltk.pos_tag(self.words)
self.buildDictionary()
self.buildReverseDictionary()
def buildDictionary(self):
self.dictionary = {}
for (word,... | 33.586957 | 82 | 0.634951 | import nltk
class LearningDictionary():
def __init__(self, sentence):
self.words = nltk.word_tokenize(sentence)
self.tagged = nltk.pos_tag(self.words)
self.buildDictionary()
self.buildReverseDictionary()
def buildDictionary(self):
self.dictionary = {}
for (word,... | true | true |
f75951ccfed46e2ae72df66a9e79b3712dc5e44f | 3,218 | py | Python | inconsistency_graph_construction.py | weihs/hashtag_co-occurrence_network | b6aaa664d4cd42fd7dfd2d2dc2350568e0c6b08e | [
"MIT"
] | null | null | null | inconsistency_graph_construction.py | weihs/hashtag_co-occurrence_network | b6aaa664d4cd42fd7dfd2d2dc2350568e0c6b08e | [
"MIT"
] | null | null | null | inconsistency_graph_construction.py | weihs/hashtag_co-occurrence_network | b6aaa664d4cd42fd7dfd2d2dc2350568e0c6b08e | [
"MIT"
] | null | null | null | import json
import copy
import yaml
import sys
import numpy as np
import networkx as nx
from scipy import linalg
def merge_cooccurrence_matrix(number_of_days, origin_directory,result_directory,origin_prefix,result_filename):
postfix='.npy'
for i in range(1,1+number_of_days):#build combine co_occurrence matrix... | 37.858824 | 120 | 0.717526 | import json
import copy
import yaml
import sys
import numpy as np
import networkx as nx
from scipy import linalg
def merge_cooccurrence_matrix(number_of_days, origin_directory,result_directory,origin_prefix,result_filename):
postfix='.npy'
for i in range(1,1+number_of_days):
filename=origin_directory+... | true | true |
f75952778e05e3621ea57acae68fee5769c5923e | 6,553 | py | Python | tests/test_client.py | aditim1359/mltrace | 626d50d91fef8f691759a5056eb6c3910f76f266 | [
"Apache-2.0"
] | null | null | null | tests/test_client.py | aditim1359/mltrace | 626d50d91fef8f691759a5056eb6c3910f76f266 | [
"Apache-2.0"
] | null | null | null | tests/test_client.py | aditim1359/mltrace | 626d50d91fef8f691759a5056eb6c3910f76f266 | [
"Apache-2.0"
] | null | null | null | import copy
import unittest
import warnings
from datetime import datetime
from mltrace import (
set_db_uri,
create_component,
log_component_run,
register,
get_history,
get_recent_run_ids,
load,
save,
)
from mltrace.entities import ComponentRun, IOPointer
class TestClient(unittest.Test... | 28.867841 | 72 | 0.567374 | import copy
import unittest
import warnings
from datetime import datetime
from mltrace import (
set_db_uri,
create_component,
log_component_run,
register,
get_history,
get_recent_run_ids,
load,
save,
)
from mltrace.entities import ComponentRun, IOPointer
class TestClient(unittest.Test... | true | true |
f7595301635f6bdfd3c135028b2e16059b993d53 | 21,451 | py | Python | label_studio/utils/models.py | KUASWoodyLIN/label-studio | 625b5881de59b0921954a66d88810b0898833c19 | [
"Apache-2.0"
] | 1 | 2020-06-14T02:48:09.000Z | 2020-06-14T02:48:09.000Z | label_studio/utils/models.py | KUASWoodyLIN/label-studio | 625b5881de59b0921954a66d88810b0898833c19 | [
"Apache-2.0"
] | 7 | 2021-03-01T21:13:19.000Z | 2022-03-12T00:31:54.000Z | label_studio/utils/models.py | KUASWoodyLIN/label-studio | 625b5881de59b0921954a66d88810b0898833c19 | [
"Apache-2.0"
] | null | null | null | import io
import os
import re
import attr
import urllib
import logging
import xmljson
import requests
import jsonschema
try:
import ujson as json
except:
import json
from lxml import etree
from datetime import datetime
from requests.adapters import HTTPAdapter
from .io import get_data_dir
from .exceptions impo... | 36.173693 | 121 | 0.609342 | import io
import os
import re
import attr
import urllib
import logging
import xmljson
import requests
import jsonschema
try:
import ujson as json
except:
import json
from lxml import etree
from datetime import datetime
from requests.adapters import HTTPAdapter
from .io import get_data_dir
from .exceptions impo... | true | true |
f759535981ec91122ae78419a705db183247e4d8 | 6,292 | py | Python | scripts_a2c/script5.py | lbaiao/sys-simulator-2 | 94f00d43309fe7b56dac5099bd4024695ba317b6 | [
"MIT"
] | 1 | 2020-06-14T13:50:28.000Z | 2020-06-14T13:50:28.000Z | scripts_a2c/script5.py | lbaiao/sys-simulator-2 | 94f00d43309fe7b56dac5099bd4024695ba317b6 | [
"MIT"
] | null | null | null | scripts_a2c/script5.py | lbaiao/sys-simulator-2 | 94f00d43309fe7b56dac5099bd4024695ba317b6 | [
"MIT"
] | null | null | null | # Similar to script 1 but with discrete-value actions.
# It uses CompleteEnvironmentA2C2
from sys_simulator import general as gen
from sys_simulator.q_learning.environments.completeEnvironmentA2C2 \
import CompleteEnvironmentA2C2
from sys_simulator.q_learning.rewards import dis_reward_tensor
from sys_simulator.par... | 41.124183 | 78 | 0.655118 |
from sys_simulator import general as gen
from sys_simulator.q_learning.environments.completeEnvironmentA2C2 \
import CompleteEnvironmentA2C2
from sys_simulator.q_learning.rewards import dis_reward_tensor
from sys_simulator.parameters.parameters import EnvironmentParameters
from sys_simulator.a2c.agent import Age... | true | true |
f759558c126418fdc345d35cf425ec0e6da3b8fa | 5,543 | py | Python | yt/frontends/athena/fields.py | tukss/yt | 8bf6fce609cad3d4b291ebd94667019ab2e18377 | [
"BSD-3-Clause-Clear"
] | null | null | null | yt/frontends/athena/fields.py | tukss/yt | 8bf6fce609cad3d4b291ebd94667019ab2e18377 | [
"BSD-3-Clause-Clear"
] | 8 | 2020-04-02T16:51:49.000Z | 2022-01-11T14:12:44.000Z | yt/frontends/athena/fields.py | tukss/yt | 8bf6fce609cad3d4b291ebd94667019ab2e18377 | [
"BSD-3-Clause-Clear"
] | 2 | 2020-08-12T15:46:11.000Z | 2021-02-09T13:09:17.000Z | from yt.fields.field_info_container import FieldInfoContainer
from yt.utilities.physical_constants import kboltz, mh
b_units = "code_magnetic"
pres_units = "code_pressure"
erg_units = "code_mass * (code_length/code_time)**2"
rho_units = "code_mass / code_length**3"
def velocity_field(comp):
def _velocity(field, ... | 35.532051 | 82 | 0.52228 | from yt.fields.field_info_container import FieldInfoContainer
from yt.utilities.physical_constants import kboltz, mh
b_units = "code_magnetic"
pres_units = "code_pressure"
erg_units = "code_mass * (code_length/code_time)**2"
rho_units = "code_mass / code_length**3"
def velocity_field(comp):
def _velocity(field, ... | true | true |
f75955ab086d9ea3258d1da4b477432200b2d3bf | 234 | py | Python | discord/activity/rawactivityassets.py | AA1999/Disthon | fcf4e550750938b87a1fb48ff3006bdeeecd73e3 | [
"MIT"
] | 14 | 2021-09-20T10:50:03.000Z | 2022-03-01T16:01:08.000Z | discord/activity/rawactivityassets.py | Rashaad1268/Disthon | 50c191fc2750bcb28280006e1f9bbd1fa65bac33 | [
"MIT"
] | 25 | 2021-12-12T15:52:19.000Z | 2022-03-31T19:45:46.000Z | discord/activity/rawactivityassets.py | Rashaad1268/Disthon | 50c191fc2750bcb28280006e1f9bbd1fa65bac33 | [
"MIT"
] | 12 | 2021-09-22T10:40:50.000Z | 2021-11-25T15:47:42.000Z | from __future__ import annotations
from typing import TypedDict
from ..types.snowflake import Snowflake
class RawActivityAssets(TypedDict):
largeimage: Snowflake
largetext: str
smallimage: Snowflake
smalltext: str
| 18 | 39 | 0.777778 | from __future__ import annotations
from typing import TypedDict
from ..types.snowflake import Snowflake
class RawActivityAssets(TypedDict):
largeimage: Snowflake
largetext: str
smallimage: Snowflake
smalltext: str
| true | true |
f75957357f77965d8d69ad919c3ada97f9f0981e | 18,847 | py | Python | src/transformers/configuration_utils.py | jinoobaek-qz/transformers-1 | e8db8b845a971b0cf63a0896b9deb5b316028a8b | [
"Apache-2.0"
] | 1 | 2020-06-09T22:41:09.000Z | 2020-06-09T22:41:09.000Z | src/transformers/configuration_utils.py | jinoobaek-qz/transformers-1 | e8db8b845a971b0cf63a0896b9deb5b316028a8b | [
"Apache-2.0"
] | null | null | null | src/transformers/configuration_utils.py | jinoobaek-qz/transformers-1 | e8db8b845a971b0cf63a0896b9deb5b316028a8b | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA 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 cop... | 46.193627 | 193 | 0.642861 |
import copy
import json
import logging
import os
from typing import Dict, Tuple
from .file_utils import CONFIG_NAME, cached_path, hf_bucket_url, is_remote_url
logger = logging.getLogger(__name__)
class PretrainedConfig(object):
model_type: str = ""
def __init__(self, **kwargs):
... | true | true |
f75957e4f6c11befb8a924de462f305ef98b03ee | 124 | py | Python | cases/pert.py | lacknc/Andes | 3664ff69406ac01381b675393d6ac96fcf080b25 | [
"Apache-2.0"
] | 1 | 2018-01-11T22:58:17.000Z | 2018-01-11T22:58:17.000Z | cases/pert.py | rwl/Andes | 6818dcc86bd7e1a5028b5be1deee3d6b4171c540 | [
"Apache-2.0"
] | null | null | null | cases/pert.py | rwl/Andes | 6818dcc86bd7e1a5028b5be1deee3d6b4171c540 | [
"Apache-2.0"
] | null | null | null | """Sample perturbation file. It trips the 9th generator at t=2"""
def pert(t, system):
if 2.0 <= t <=2.2:
pass | 20.666667 | 65 | 0.58871 |
def pert(t, system):
if 2.0 <= t <=2.2:
pass | true | true |
f75958ccd1c59ca0eaf6ebe2b575a84fc8f929c7 | 488 | py | Python | conduit/domain/user/schema.py | utilmeta/utilmeta-py-realworld-example-app- | cf6d9e83e72323a830b2fcdb5c5eae3ebd800103 | [
"MIT"
] | null | null | null | conduit/domain/user/schema.py | utilmeta/utilmeta-py-realworld-example-app- | cf6d9e83e72323a830b2fcdb5c5eae3ebd800103 | [
"MIT"
] | null | null | null | conduit/domain/user/schema.py | utilmeta/utilmeta-py-realworld-example-app- | cf6d9e83e72323a830b2fcdb5c5eae3ebd800103 | [
"MIT"
] | null | null | null | from utilmeta.utils import *
class UserBase(Schema):
username: str
bio: str
image: str
class UserLogin(Schema):
email: str
password: str
class UserRegister(UserLogin):
username: str
class UserSchema(UserBase):
email: str
password: str = Field(writeonly=True)
token: str = Fiel... | 18.074074 | 117 | 0.702869 | from utilmeta.utils import *
class UserBase(Schema):
username: str
bio: str
image: str
class UserLogin(Schema):
email: str
password: str
class UserRegister(UserLogin):
username: str
class UserSchema(UserBase):
email: str
password: str = Field(writeonly=True)
token: str = Fiel... | true | true |
f75959281204618a3c5d796af4716af4a3a9ca83 | 2,865 | py | Python | update/templates/update_mongodb.py | xudan16/dovetail-webportal | a3f41a3a2c2ef871b0e314ec14bbfff532f533f6 | [
"Apache-2.0"
] | 2 | 2018-09-05T15:00:25.000Z | 2019-02-25T14:11:47.000Z | update/templates/update_mongodb.py | xudan16/dovetail-webportal | a3f41a3a2c2ef871b0e314ec14bbfff532f533f6 | [
"Apache-2.0"
] | 5 | 2020-10-27T21:16:33.000Z | 2022-01-13T01:08:02.000Z | update/templates/update_mongodb.py | xudan16/dovetail-webportal | a3f41a3a2c2ef871b0e314ec14bbfff532f533f6 | [
"Apache-2.0"
] | 8 | 2018-07-27T03:09:34.000Z | 2019-11-07T06:57:17.000Z | ##############################################################################
# Copyright (c) 2016 ZTE Corporation
# feng.xiaowei@zte.com.cn
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, ... | 31.483516 | 78 | 0.626178 | true | true | |
f7595b8e5a3ea318eb3b8833520f9cf253529b19 | 2,011 | py | Python | test/vanilla/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_auto_rest_swagger_bat_array_service.py | tasherif-msft/autorest.python | 5b0121bcfa802aedaeda36990e8bcaa2b7e26b14 | [
"MIT"
] | null | null | null | test/vanilla/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_auto_rest_swagger_bat_array_service.py | tasherif-msft/autorest.python | 5b0121bcfa802aedaeda36990e8bcaa2b7e26b14 | [
"MIT"
] | null | null | null | test/vanilla/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_auto_rest_swagger_bat_array_service.py | tasherif-msft/autorest.python | 5b0121bcfa802aedaeda36990e8bcaa2b7e26b14 | [
"MIT"
] | null | null | null | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 37.240741 | 94 | 0.664346 |
from typing import Any, Optional
from azure.core import AsyncPipelineClient
from msrest import Deserializer, Serializer
from ._configuration import AutoRestSwaggerBATArrayServiceConfiguration
from .operations import ArrayOperations
from .. import models
class AutoRestSwaggerBATArrayService(object):
def... | true | true |
f7595c7be39e8e7a3cc64df4cfbe5fb8699fab3f | 300 | py | Python | setup.py | sipolac/trending | 8155bcea5758a1b1cd7aa0c585658e754fe4c034 | [
"Apache-2.0"
] | null | null | null | setup.py | sipolac/trending | 8155bcea5758a1b1cd7aa0c585658e754fe4c034 | [
"Apache-2.0"
] | null | null | null | setup.py | sipolac/trending | 8155bcea5758a1b1cd7aa0c585658e754fe4c034 | [
"Apache-2.0"
] | null | null | null | from setuptools import find_packages, setup
setup(
name='trending',
packages=find_packages(),
version='0.0.1',
description='Methods for determining trending-ness',
author='Chris Sipola',
license='Apache License 2.0',
install_requires=[],
include_package_data=True,
)
| 23.076923 | 56 | 0.696667 | from setuptools import find_packages, setup
setup(
name='trending',
packages=find_packages(),
version='0.0.1',
description='Methods for determining trending-ness',
author='Chris Sipola',
license='Apache License 2.0',
install_requires=[],
include_package_data=True,
)
| true | true |
f7595e00645d3938e634559c77d31e736515113c | 254 | py | Python | way/python/exercises/various/py_spec/logging/try_logging.py | only-romano/junkyard | b60a25b2643f429cdafee438d20f9966178d6f36 | [
"MIT"
] | null | null | null | way/python/exercises/various/py_spec/logging/try_logging.py | only-romano/junkyard | b60a25b2643f429cdafee438d20f9966178d6f36 | [
"MIT"
] | null | null | null | way/python/exercises/various/py_spec/logging/try_logging.py | only-romano/junkyard | b60a25b2643f429cdafee438d20f9966178d6f36 | [
"MIT"
] | null | null | null | # Logging hello world
import logging
logging.basicConfig(level=logging.INFO, filename='mylog.log')
logging.info('Starting program')
logging.info('Trying to divide 1 by 0')
print(1/0)
logging.info('The division succeeded')
logging.info('Ending program')
| 25.4 | 61 | 0.775591 |
import logging
logging.basicConfig(level=logging.INFO, filename='mylog.log')
logging.info('Starting program')
logging.info('Trying to divide 1 by 0')
print(1/0)
logging.info('The division succeeded')
logging.info('Ending program')
| true | true |
f7595e283208a3c72d22c1fb4ad67499563ddad1 | 481 | py | Python | orderbook_veinte/orderbook/serializers/user_serializer.py | morwen1/hyperion | f0d77a6cce6a366555e9f0ca0080f3da134862bf | [
"MIT"
] | null | null | null | orderbook_veinte/orderbook/serializers/user_serializer.py | morwen1/hyperion | f0d77a6cce6a366555e9f0ca0080f3da134862bf | [
"MIT"
] | null | null | null | orderbook_veinte/orderbook/serializers/user_serializer.py | morwen1/hyperion | f0d77a6cce6a366555e9f0ca0080f3da134862bf | [
"MIT"
] | null | null | null |
#RESTFRAMEWORK
from rest_framework import serializers
#MODELS
from orderbook_veinte.orderbook.models import Orders , OrderStatus
class OrdersStatusSerializer(serializers.ModelSerializer):
class Meta:
model = OrderStatus
fields = ('status' ,)
class UserOrderSerializer(serializers.ModelSerializer... | 28.294118 | 67 | 0.717256 |
from rest_framework import serializers
from orderbook_veinte.orderbook.models import Orders , OrderStatus
class OrdersStatusSerializer(serializers.ModelSerializer):
class Meta:
model = OrderStatus
fields = ('status' ,)
class UserOrderSerializer(serializers.ModelSerializer):
status = Order... | true | true |
f7595ee229ce8ee1171ddfe47615d9d1367e34c0 | 478 | py | Python | lib/models/v1/UserModel.py | cppxaxa/full_team_uno | dfd2418e736d04dd57a6a141a25fcd72392d7602 | [
"Apache-2.0"
] | null | null | null | lib/models/v1/UserModel.py | cppxaxa/full_team_uno | dfd2418e736d04dd57a6a141a25fcd72392d7602 | [
"Apache-2.0"
] | null | null | null | lib/models/v1/UserModel.py | cppxaxa/full_team_uno | dfd2418e736d04dd57a6a141a25fcd72392d7602 | [
"Apache-2.0"
] | null | null | null |
from pydantic import BaseModel
from typing import Optional
class UserModel(BaseModel):
username: Optional[str] = ""
passcode: Optional[str] = ""
def is_valid(self):
error = []
if len(self.username) == 0:
error.append("Username cannot be blank")
if len(self.passcode) =... | 23.9 | 52 | 0.573222 |
from pydantic import BaseModel
from typing import Optional
class UserModel(BaseModel):
username: Optional[str] = ""
passcode: Optional[str] = ""
def is_valid(self):
error = []
if len(self.username) == 0:
error.append("Username cannot be blank")
if len(self.passcode) =... | true | true |
f7595f52bcd7376ed4f59c22875b05f4f2d03d93 | 24,599 | py | Python | tests/unit/test_download.py | plocharz-9livesdata/pip | 75b504976343e6d7128cd8a5e8d8a40132012b80 | [
"MIT"
] | null | null | null | tests/unit/test_download.py | plocharz-9livesdata/pip | 75b504976343e6d7128cd8a5e8d8a40132012b80 | [
"MIT"
] | null | null | null | tests/unit/test_download.py | plocharz-9livesdata/pip | 75b504976343e6d7128cd8a5e8d8a40132012b80 | [
"MIT"
] | null | null | null | import functools
import hashlib
import os
import sys
from io import BytesIO
from shutil import copy, rmtree
from tempfile import mkdtemp
import pytest
from mock import Mock, patch
import pip
from pip._internal.download import (
CI_ENVIRONMENT_VARIABLES,
MultiDomainBasicAuth,
PipSession,
SafeFileCache,... | 32.667995 | 79 | 0.642546 | import functools
import hashlib
import os
import sys
from io import BytesIO
from shutil import copy, rmtree
from tempfile import mkdtemp
import pytest
from mock import Mock, patch
import pip
from pip._internal.download import (
CI_ENVIRONMENT_VARIABLES,
MultiDomainBasicAuth,
PipSession,
SafeFileCache,... | true | true |
f7595fd7c93aba216ac557f8ff3886f03736bd11 | 4,744 | py | Python | sisyphus/mdp/_dp.py | ndawlab/seqanx | de44aa1baeb10646d538c185f0428d53b00db4b5 | [
"MIT"
] | 14 | 2019-04-12T21:09:16.000Z | 2021-12-29T14:45:44.000Z | sisyphus/mdp/_dp.py | ndawlab/seqanx | de44aa1baeb10646d538c185f0428d53b00db4b5 | [
"MIT"
] | 1 | 2021-12-26T10:07:08.000Z | 2021-12-26T16:23:34.000Z | sisyphus/mdp/_dp.py | ndawlab/seqanx | de44aa1baeb10646d538c185f0428d53b00db4b5 | [
"MIT"
] | 1 | 2019-08-06T21:29:52.000Z | 2019-08-06T21:29:52.000Z | """Dynamic programming module"""
import numpy as np
from copy import deepcopy
from ._misc import check_params, softmax, pessimism
from warnings import warn
class ValueIteration(object):
"""Q-value iteration algorithm.
Parameters
----------
policy : max | min | softmax | pessimism (default = pessi... | 31.210526 | 104 | 0.517074 |
import numpy as np
from copy import deepcopy
from ._misc import check_params, softmax, pessimism
from warnings import warn
class ValueIteration(object):
def __init__(self, policy='pessimism', gamma=0.9, beta=10.0, w=1.0, tol=0.0001, max_iter=100):
policy
if policy == 'max': self._policy = np... | true | true |
f75960490c793ff9184817054080515739849018 | 136,840 | py | Python | airflow/www/views.py | haard/airflow | 5741ae177f3c2b14998596ef23bdbdf763c2ce06 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 1 | 2021-03-10T03:37:28.000Z | 2021-03-10T03:37:28.000Z | airflow/www/views.py | haard/airflow | 5741ae177f3c2b14998596ef23bdbdf763c2ce06 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 1 | 2021-02-21T15:12:02.000Z | 2021-02-21T15:12:02.000Z | airflow/www/views.py | yohei1126/airflow | b718495e4caecb753742c3eb22919411a715f24a | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | null | null | null | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 35.887752 | 110 | 0.602148 |
import copy
import itertools
import json
import logging
import math
import socket
import sys
import traceback
from collections import defaultdict
from datetime import datetime, timedelta
from json import JSONDecodeError
from operator import itemgetter
from typing import Dict, List, Optional, Tuple
fro... | true | true |
f7596055905d6fce15259812515796861be44ca7 | 849 | py | Python | court_scraper/platforms/oscn/pages/search.py | DiPierro/court-scraper | eb289e1559d317c04f1d92dacc96a49b9480e552 | [
"ISC"
] | null | null | null | court_scraper/platforms/oscn/pages/search.py | DiPierro/court-scraper | eb289e1559d317c04f1d92dacc96a49b9480e552 | [
"ISC"
] | null | null | null | court_scraper/platforms/oscn/pages/search.py | DiPierro/court-scraper | eb289e1559d317c04f1d92dacc96a49b9480e552 | [
"ISC"
] | null | null | null | import requests
from lxml import html
from fake_useragent import UserAgent
from io import StringIO, BytesIO
from court_scraper.base.last_date import LastDate
from court_scraper.base.requests_base_page import RequestsBasePage
from court_scraper.base.search_page_mixin import SearchPageMixIn
from .url import OklahomaURLs... | 35.375 | 116 | 0.678445 | import requests
from lxml import html
from fake_useragent import UserAgent
from io import StringIO, BytesIO
from court_scraper.base.last_date import LastDate
from court_scraper.base.requests_base_page import RequestsBasePage
from court_scraper.base.search_page_mixin import SearchPageMixIn
from .url import OklahomaURLs... | true | true |
f75960af512d213b94c2ed9d7f4324d0db902242 | 101,805 | py | Python | mindspore/python/mindspore/ops/operations/_grad_ops.py | TangYuan-Liu/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | [
"Apache-2.0"
] | null | null | null | mindspore/python/mindspore/ops/operations/_grad_ops.py | TangYuan-Liu/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | [
"Apache-2.0"
] | null | null | null | mindspore/python/mindspore/ops/operations/_grad_ops.py | TangYuan-Liu/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | [
"Apache-2.0"
] | null | null | null | # Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | 44.052358 | 120 | 0.65155 |
import math
from functools import partial
from mindspore._checkparam import _check_3d_int_or_tuple
from .. import signature as sig
from ..primitive import Primitive, PrimitiveWithInfer, prim_attr_register
from ..._checkparam import Validator as validator, Rel
from .._utils import get_concat_offset
from .... | true | true |
f759611c7eb664804fadacab5b6ecb74ed334565 | 1,350 | py | Python | indico_toolkit/ocr/standard_object.py | IndicoDataSolutions/Indico-Solutions-Toolkit | c9a38681c84e86a48bcde0867359ddd2f52ce236 | [
"MIT"
] | 6 | 2021-05-20T16:48:27.000Z | 2022-03-15T15:43:40.000Z | indico_toolkit/ocr/standard_object.py | IndicoDataSolutions/Indico-Solutions-Toolkit | c9a38681c84e86a48bcde0867359ddd2f52ce236 | [
"MIT"
] | 25 | 2021-06-25T13:37:21.000Z | 2022-01-03T15:54:26.000Z | indico_toolkit/ocr/standard_object.py | IndicoDataSolutions/Indico-Solutions-Toolkit | c9a38681c84e86a48bcde0867359ddd2f52ce236 | [
"MIT"
] | null | null | null | from typing import List
class StandardOcr:
"""
StandardOcr is a helper class for the raw "standard" preset config OCR result. Enables easy extraction
of common datapoints into usable objects.
"""
def __init__(self, standardocr: dict):
"""
standardocr dict: standard result object f... | 26.470588 | 106 | 0.605926 | from typing import List
class StandardOcr:
def __init__(self, standardocr: dict):
self.standardocr = standardocr
@property
def full_text(self) -> str:
return self.standardocr["text"]
@property
def page_texts(self) -> List[str]:
return [page["text"] for page in self.stand... | true | true |
f75962fcaa2f37b823907a038ee87d94ba2afada | 702 | py | Python | Tree/Easy/530. Minimum Absolute Difference in BST/solution.py | tintindas/leetcode-solutions | eb97254dafddffccbce048ef04aea1e934277282 | [
"MIT"
] | 1 | 2021-03-10T02:48:39.000Z | 2021-03-10T02:48:39.000Z | Tree/Easy/530. Minimum Absolute Difference in BST/solution.py | tintindas/leetcode-solutions | eb97254dafddffccbce048ef04aea1e934277282 | [
"MIT"
] | null | null | null | Tree/Easy/530. Minimum Absolute Difference in BST/solution.py | tintindas/leetcode-solutions | eb97254dafddffccbce048ef04aea1e934277282 | [
"MIT"
] | 1 | 2021-03-18T08:22:29.000Z | 2021-03-18T08:22:29.000Z | # Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def inorder(self, node: TreeNode) -> None:
if not node:
return
self.inorder(node.left)
... | 21.9375 | 58 | 0.555556 |
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def inorder(self, node: TreeNode) -> None:
if not node:
return
self.inorder(node.left)
if self.prev != None:
... | true | true |
f75963c5f26c93041f8c5a62a6f00bb269a279da | 4,405 | py | Python | src/pfb/importers/tsv.py | gaurav/pypfb | 443bf607f499946525edbd41afa1edb81848a0f5 | [
"Apache-2.0"
] | 7 | 2019-10-08T16:22:24.000Z | 2022-03-01T20:44:17.000Z | src/pfb/importers/tsv.py | gaurav/pypfb | 443bf607f499946525edbd41afa1edb81848a0f5 | [
"Apache-2.0"
] | 10 | 2019-07-05T16:49:26.000Z | 2020-12-21T21:24:35.000Z | src/pfb/importers/tsv.py | gaurav/pypfb | 443bf607f499946525edbd41afa1edb81848a0f5 | [
"Apache-2.0"
] | 5 | 2019-12-23T17:02:50.000Z | 2022-01-04T17:45:10.000Z | from __future__ import absolute_import
import glob
import os
import csv
import click
from ..base import avro_record
from ..cli import from_command
from ..reader import PFBReader
@from_command.command("tsv", short_help="Convert TSV files into a PFB file.")
@click.argument("path", default=".", type=click.Path(exists... | 29.965986 | 88 | 0.572304 | from __future__ import absolute_import
import glob
import os
import csv
import click
from ..base import avro_record
from ..cli import from_command
from ..reader import PFBReader
@from_command.command("tsv", short_help="Convert TSV files into a PFB file.")
@click.argument("path", default=".", type=click.Path(exists... | true | true |
f7596415fd236efd9f25efe6dedd5f0c7f4a3556 | 6,438 | py | Python | condor_analyze_job_log.py | JoshKarpel/condor-analyze-job-log | 3c3cb4be9651aee61b233daa614f93e84bad172e | [
"Apache-2.0"
] | null | null | null | condor_analyze_job_log.py | JoshKarpel/condor-analyze-job-log | 3c3cb4be9651aee61b233daa614f93e84bad172e | [
"Apache-2.0"
] | null | null | null | condor_analyze_job_log.py | JoshKarpel/condor-analyze-job-log | 3c3cb4be9651aee61b233daa614f93e84bad172e | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
import itertools
import math
from pathlib import Path
import sys
import collections
import datetime
import enum
import shutil
import htcondor
import click
def get_events(event_log_path):
yield from htcondor.JobEventLog(Path(event_log_path).as_posix()).events(0)
class JobStatus(enum.IntEn... | 29.263636 | 147 | 0.650047 |
import itertools
import math
from pathlib import Path
import sys
import collections
import datetime
import enum
import shutil
import htcondor
import click
def get_events(event_log_path):
yield from htcondor.JobEventLog(Path(event_log_path).as_posix()).events(0)
class JobStatus(enum.IntEnum):
UNKNOWN = 0
... | true | true |
f7596489e719ab0e73bd69cf4e5e632c3d236eec | 3,075 | py | Python | ucsmsdk/mometa/storage/StorageScsiLunRef.py | thinkitdata/ucsmsdk | da6599e1dbc1207a30eabe548a7e5791af5f476b | [
"Apache-2.0"
] | null | null | null | ucsmsdk/mometa/storage/StorageScsiLunRef.py | thinkitdata/ucsmsdk | da6599e1dbc1207a30eabe548a7e5791af5f476b | [
"Apache-2.0"
] | null | null | null | ucsmsdk/mometa/storage/StorageScsiLunRef.py | thinkitdata/ucsmsdk | da6599e1dbc1207a30eabe548a7e5791af5f476b | [
"Apache-2.0"
] | null | null | null | """This module contains the general information for StorageScsiLunRef ManagedObject."""
from ...ucsmo import ManagedObject
from ...ucscoremeta import MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class StorageScsiLunRefConsts:
ID_UNSPECIFIED = "unspecified"
class StorageScsiLunRef(ManagedObject):
... | 53.017241 | 248 | 0.638699 |
from ...ucsmo import ManagedObject
from ...ucscoremeta import MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class StorageScsiLunRefConsts:
ID_UNSPECIFIED = "unspecified"
class StorageScsiLunRef(ManagedObject):
consts = StorageScsiLunRefConsts()
naming_props = set([u'id'])
mo_meta = Mo... | true | true |
f7596570d2b4f33751eac22da3e3c2520d00492b | 690 | py | Python | praktiplot.py | phenomax/praktipy | 58d1f74e6d128b0d22bfa0fcaf754c9b8b9e8c23 | [
"MIT"
] | null | null | null | praktiplot.py | phenomax/praktipy | 58d1f74e6d128b0d22bfa0fcaf754c9b8b9e8c23 | [
"MIT"
] | null | null | null | praktiplot.py | phenomax/praktipy | 58d1f74e6d128b0d22bfa0fcaf754c9b8b9e8c23 | [
"MIT"
] | null | null | null | # Setting matplotlib layout to match tex settings
import matplotlib
matplotlib.use('pgf')
import matplotlib.pyplot as plt
from os.path import dirname, abspath
import locale
matplotlib.rcParams.update({
'font.family': 'serif',
'text.usetex': True,
'pgf.rcfonts': False,
'pgf.texsystem': 'lualatex',
... | 32.857143 | 110 | 0.708696 |
import matplotlib
matplotlib.use('pgf')
import matplotlib.pyplot as plt
from os.path import dirname, abspath
import locale
matplotlib.rcParams.update({
'font.family': 'serif',
'text.usetex': True,
'pgf.rcfonts': False,
'pgf.texsystem': 'lualatex',
'pgf.preamble': r'\input{'+dirname(abspath(__file_... | true | true |
f75965ade8d9f301559fb6239ab458b22daa2b2d | 1,022 | py | Python | h2o-py/tests/testdir_algos/glm/pyunit_mojo_reproducibility_info_glm.py | vishalbelsare/h2o-3 | 9322fb0f4c0e2358449e339a434f607d524c69fa | [
"Apache-2.0"
] | 6,098 | 2015-05-22T02:46:12.000Z | 2022-03-31T16:54:51.000Z | h2o-py/tests/testdir_algos/glm/pyunit_mojo_reproducibility_info_glm.py | vishalbelsare/h2o-3 | 9322fb0f4c0e2358449e339a434f607d524c69fa | [
"Apache-2.0"
] | 2,517 | 2015-05-23T02:10:54.000Z | 2022-03-30T17:03:39.000Z | h2o-py/tests/testdir_algos/glm/pyunit_mojo_reproducibility_info_glm.py | vishalbelsare/h2o-3 | 9322fb0f4c0e2358449e339a434f607d524c69fa | [
"Apache-2.0"
] | 2,199 | 2015-05-22T04:09:55.000Z | 2022-03-28T22:20:45.000Z | import sys
sys.path.insert(1, "../../../")
import h2o
from tests import pyunit_utils
import tempfile
def glm_mojo_reproducibility_info():
params = {'family':"fractionalbinomial", 'alpha':[0], 'lambda_':[0],
'standardize':False, "compute_p_values":True}
train = h2o.import_file(pyunit_utils.locate... | 39.307692 | 128 | 0.731898 | import sys
sys.path.insert(1, "../../../")
import h2o
from tests import pyunit_utils
import tempfile
def glm_mojo_reproducibility_info():
params = {'family':"fractionalbinomial", 'alpha':[0], 'lambda_':[0],
'standardize':False, "compute_p_values":True}
train = h2o.import_file(pyunit_utils.locate... | true | true |
f75965c57a95d13e112a54f79ffd97fb1f84d829 | 4,138 | py | Python | coursework_project_dec_2021/covid_data_handler.py | reubensgithub/covid-19-dashboard | f0d8de85a989597fe38ea771439a70fc9e0bd21f | [
"MIT"
] | null | null | null | coursework_project_dec_2021/covid_data_handler.py | reubensgithub/covid-19-dashboard | f0d8de85a989597fe38ea771439a70fc9e0bd21f | [
"MIT"
] | null | null | null | coursework_project_dec_2021/covid_data_handler.py | reubensgithub/covid-19-dashboard | f0d8de85a989597fe38ea771439a70fc9e0bd21f | [
"MIT"
] | null | null | null | """This module has various functions inside it that will allow
the processing and handling of covid data, whether from a
CSV file or returned from an API"""
import sched
import time
import logging
import pandas as pd
from typing import List
from uk_covid19 import Cov19API
logging.basicConfig(filename... | 39.788462 | 101 | 0.693088 | import sched
import time
import logging
import pandas as pd
from typing import List
from uk_covid19 import Cov19API
logging.basicConfig(filename='covid_log.log', level=logging.DEBUG,
format='%(levelname)s: %(asctime)s %(message)s')
data_list_exeter = []
data_list_england = []
def p... | true | true |
f759663b69cab4c301c6e32771db73c9020783c7 | 5,063 | py | Python | aiokubernetes/models/v1beta1_ingress_rule.py | tantioch/aiokubernetes | 2f332498598ece14d22f8e59ecb02665db6db68d | [
"Apache-2.0"
] | 24 | 2018-07-07T15:12:19.000Z | 2021-09-01T07:33:11.000Z | aiokubernetes/models/v1beta1_ingress_rule.py | revoteon/aiokubernetes | 730eae03e4779563740f07ad3ecef180b511ac18 | [
"Apache-2.0"
] | 5 | 2018-07-11T00:09:17.000Z | 2018-10-22T16:41:54.000Z | aiokubernetes/models/v1beta1_ingress_rule.py | revoteon/aiokubernetes | 730eae03e4779563740f07ad3ecef180b511ac18 | [
"Apache-2.0"
] | 3 | 2018-07-10T10:16:57.000Z | 2018-10-20T19:32:05.000Z | # coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v1.10.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
from aio... | 35.65493 | 676 | 0.620581 |
import pprint
import re
from aiokubernetes.models.v1beta1_http_ingress_rule_value import V1beta1HTTPIngressRuleValue
class V1beta1IngressRule(object):
swagger_types = {
'host': 'str',
'http': 'V1beta1HTTPIngressRuleValue'
}
attribute_map = {
'host': 'host',
'htt... | true | true |
f759665887c9f3ff070bed663bb3c71f8a611a07 | 20,641 | py | Python | pymc3/distributions/discrete.py | vpolisky/pymc3 | 87cdd712c86321121c2ed3150764f3d847f5083c | [
"Apache-2.0"
] | null | null | null | pymc3/distributions/discrete.py | vpolisky/pymc3 | 87cdd712c86321121c2ed3150764f3d847f5083c | [
"Apache-2.0"
] | null | null | null | pymc3/distributions/discrete.py | vpolisky/pymc3 | 87cdd712c86321121c2ed3150764f3d847f5083c | [
"Apache-2.0"
] | 1 | 2021-04-13T10:31:26.000Z | 2021-04-13T10:31:26.000Z | from functools import partial
import numpy as np
import theano
import theano.tensor as tt
from scipy import stats
from .dist_math import bound, factln, binomln, betaln, logpow
from .distribution import Discrete, draw_values, generate_samples, reshape_sampled
__all__ = ['Binomial', 'BetaBinomial', 'Bernoulli', 'Di... | 33.727124 | 174 | 0.519016 | from functools import partial
import numpy as np
import theano
import theano.tensor as tt
from scipy import stats
from .dist_math import bound, factln, binomln, betaln, logpow
from .distribution import Discrete, draw_values, generate_samples, reshape_sampled
__all__ = ['Binomial', 'BetaBinomial', 'Bernoulli', 'Di... | true | true |
f75966831befe213be0e6082f1fd78c2b908ae1b | 53,615 | py | Python | release/scripts/addons_contrib/np_station/np_point_copy.py | simileV/blenderStereo29 | 09b993449aaca671a9eb2a6a22327246936eb3db | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | 1 | 2020-07-20T15:41:58.000Z | 2020-07-20T15:41:58.000Z | release/scripts/addons_contrib/np_station/np_point_copy.py | ringsce/Rings3D | 8059d1e2460fc8d6f101eff8e695f68a99f6671d | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null | release/scripts/addons_contrib/np_station/np_point_copy.py | ringsce/Rings3D | 8059d1e2460fc8d6f101eff8e695f68a99f6671d | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distr... | 41.305855 | 1,168 | 0.606024 |
import bpy
import copy
import bmesh
import bgl
import blf
import mathutils
from bpy_extras import view3d_utils
from bpy.app.handlers import persistent
from mathutils import Vector, Matrix
from blf import ROTATION
from math import radians
from bpy.props import *
from .utils_geometry import *
from .utils_graphics imp... | true | true |
f75967b0b19dc869b0565f3b3261306a5e9c9f91 | 1,529 | py | Python | pxr/usd/usd/testenv/testUsdBug119633.py | DougRogers-DigitalFish/USD | d8a405a1344480f859f025c4f97085143efacb53 | [
"BSD-2-Clause"
] | 3,680 | 2016-07-26T18:28:11.000Z | 2022-03-31T09:55:05.000Z | pxr/usd/usd/testenv/testUsdBug119633.py | DougRogers-DigitalFish/USD | d8a405a1344480f859f025c4f97085143efacb53 | [
"BSD-2-Clause"
] | 1,759 | 2016-07-26T19:19:59.000Z | 2022-03-31T21:24:00.000Z | pxr/usd/usd/testenv/testUsdBug119633.py | DougRogers-DigitalFish/USD | d8a405a1344480f859f025c4f97085143efacb53 | [
"BSD-2-Clause"
] | 904 | 2016-07-26T18:33:40.000Z | 2022-03-31T09:55:16.000Z | #!/pxrpythonsubst
#
# Copyright 2017 Pixar
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
#
... | 34.75 | 74 | 0.732505 |
from __future__ import print_function
from pxr import Sdf, Tf, Usd
def TestBug119633():
layerFile = 'root.usda'
try:
stage = Usd.Stage.Open(layerFile)
assert stage, 'failed to create stage for %s' % layerFile
prim = stage.GetPrimAtPath('/SardineGroup_OceanA')
... | true | true |
f75967fc905f9fa4c61167038dcef74f9cde1f7e | 9,411 | py | Python | Preference2/src/main/java/voidblue/preference/demo/Preference/MergeAnsemble.py | voidblue/PreferenceWebPage | 7b36a6b0df09b84aa46fb63f9b191c84b46509d6 | [
"Apache-2.0"
] | null | null | null | Preference2/src/main/java/voidblue/preference/demo/Preference/MergeAnsemble.py | voidblue/PreferenceWebPage | 7b36a6b0df09b84aa46fb63f9b191c84b46509d6 | [
"Apache-2.0"
] | null | null | null | Preference2/src/main/java/voidblue/preference/demo/Preference/MergeAnsemble.py | voidblue/PreferenceWebPage | 7b36a6b0df09b84aa46fb63f9b191c84b46509d6 | [
"Apache-2.0"
] | null | null | null | import openpyxl
import preprocess
from DBGetter import DBGetter
from LoadData import LoadData
from Preference import Pref
place = {1:"한라산@@@자연-숲", 2:"오름@@@자연-숲", 3: "성산일출봉@@@자연-숲", 4 : "섬(우도/마라도 등)@@@자연명소",
5:"올레길@@@기타", 6: "폭포(정방폭포 등)@@@자연명소", 7: "동굴(만장굴 등)@@@자연명소", 8: "해수욕장@@@자연명소",
9:"비자림@@@자연-숲"... | 32.790941 | 120 | 0.532568 | import openpyxl
import preprocess
from DBGetter import DBGetter
from LoadData import LoadData
from Preference import Pref
place = {1:"한라산@@@자연-숲", 2:"오름@@@자연-숲", 3: "성산일출봉@@@자연-숲", 4 : "섬(우도/마라도 등)@@@자연명소",
5:"올레길@@@기타", 6: "폭포(정방폭포 등)@@@자연명소", 7: "동굴(만장굴 등)@@@자연명소", 8: "해수욕장@@@자연명소",
9:"비자림@@@자연-숲"... | true | true |
f759680100a459bb4b9ab1b2acf08b879d73b036 | 924 | py | Python | simple_demo.py | zwx8981/DBCNN-Pytorch | 16c3156054a30a3eabb45dffcf538f42452a14f3 | [
"MIT"
] | 150 | 2019-01-24T10:32:49.000Z | 2022-03-10T10:08:23.000Z | simple_demo.py | lllllllllllll-llll/DBCNN-PyTorch | fa29f0307aa4533c4025c688ba5301cfddf9812f | [
"MIT"
] | 29 | 2019-03-06T06:54:53.000Z | 2022-03-29T12:00:41.000Z | simple_demo.py | lllllllllllll-llll/DBCNN-PyTorch | fa29f0307aa4533c4025c688ba5301cfddf9812f | [
"MIT"
] | 31 | 2019-03-10T08:29:30.000Z | 2022-03-05T06:58:25.000Z | import torch
import torch.nn as nn
from torchvision import transforms
from DBCNN import DBCNN
from PIL import Image
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
test_transform = transforms.Compose([
transforms.ToTensor(),
transforms.Normalize(mean=(0.485, 0.456, 0.406),
... | 21.488372 | 73 | 0.690476 | import torch
import torch.nn as nn
from torchvision import transforms
from DBCNN import DBCNN
from PIL import Image
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
test_transform = transforms.Compose([
transforms.ToTensor(),
transforms.Normalize(mean=(0.485, 0.456, 0.406),
... | true | true |
f75968317e392c13ae034cbf31f9db18911c4778 | 1,035 | py | Python | tests/test_controls/test_valloxcontrol.py | jussike/kuappi | 985040dc813c023dc1577f31ca7f6744d42c91de | [
"MIT"
] | null | null | null | tests/test_controls/test_valloxcontrol.py | jussike/kuappi | 985040dc813c023dc1577f31ca7f6744d42c91de | [
"MIT"
] | null | null | null | tests/test_controls/test_valloxcontrol.py | jussike/kuappi | 985040dc813c023dc1577f31ca7f6744d42c91de | [
"MIT"
] | null | null | null | from unittest import TestCase
from unittest.mock import patch
with patch('serial.Serial'):
from controls.valloxcontrol import ValloxControl
from valloxserial import vallox_serial
class TestValloxControl(TestCase):
@patch('serial.Serial')
def setUp(self, _):
self.vc = ValloxControl()
@patch.o... | 29.571429 | 66 | 0.66087 | from unittest import TestCase
from unittest.mock import patch
with patch('serial.Serial'):
from controls.valloxcontrol import ValloxControl
from valloxserial import vallox_serial
class TestValloxControl(TestCase):
@patch('serial.Serial')
def setUp(self, _):
self.vc = ValloxControl()
@patch.o... | true | true |
f75968bd86296466d947e2ad0a811abf6895a0cc | 2,376 | py | Python | api/preprint_providers/serializers.py | hmoco/osf.io | a02869f9b5c198bafae7cea0c216674bbcba62f7 | [
"Apache-2.0"
] | 1 | 2015-10-02T18:35:53.000Z | 2015-10-02T18:35:53.000Z | api/preprint_providers/serializers.py | hmoco/osf.io | a02869f9b5c198bafae7cea0c216674bbcba62f7 | [
"Apache-2.0"
] | 4 | 2016-05-13T14:24:16.000Z | 2017-03-30T15:28:31.000Z | api/preprint_providers/serializers.py | hmoco/osf.io | a02869f9b5c198bafae7cea0c216674bbcba62f7 | [
"Apache-2.0"
] | null | null | null | from rest_framework import serializers as ser
from api.base.utils import absolute_reverse
from api.base.serializers import JSONAPISerializer, LinksField, RelationshipField
class PreprintProviderSerializer(JSONAPISerializer):
filterable_fields = frozenset([
'name',
'description',
'id'
... | 35.462687 | 82 | 0.708754 | from rest_framework import serializers as ser
from api.base.utils import absolute_reverse
from api.base.serializers import JSONAPISerializer, LinksField, RelationshipField
class PreprintProviderSerializer(JSONAPISerializer):
filterable_fields = frozenset([
'name',
'description',
'id'
... | true | true |
f759697e36c0f99e080de0acff82491eb0f1e209 | 978 | py | Python | models/loss/dice_loss.py | JennyVanessa/PANet-Paddle | 82e037faf4d52e374bd4f42c78396924c23c02f9 | [
"Apache-2.0"
] | 4 | 2021-05-13T15:24:53.000Z | 2022-03-04T06:05:20.000Z | models/loss/dice_loss.py | JosephBless/Paddle-PANet | 946e247af42ba68760d37cd9644b543fe5096288 | [
"Apache-2.0"
] | 1 | 2021-12-27T11:42:19.000Z | 2021-12-27T11:42:19.000Z | models/loss/dice_loss.py | JosephBless/Paddle-PANet | 946e247af42ba68760d37cd9644b543fe5096288 | [
"Apache-2.0"
] | null | null | null | import paddle
import paddle.nn as nn
class DiceLoss(nn.Layer):
def __init__(self, loss_weight=1.0):
super(DiceLoss, self).__init__()
self.loss_weight = loss_weight
def forward(self, input, target, mask, reduce=True):
batch_size = input.shape[0]
input = nn.functional.sigmoid(in... | 25.076923 | 57 | 0.572597 | import paddle
import paddle.nn as nn
class DiceLoss(nn.Layer):
def __init__(self, loss_weight=1.0):
super(DiceLoss, self).__init__()
self.loss_weight = loss_weight
def forward(self, input, target, mask, reduce=True):
batch_size = input.shape[0]
input = nn.functional.sigmoid(in... | true | true |
f75969874e1c906a940e5dceb288bf1301d124bf | 1,358 | py | Python | baseline.py | CVxTz/keras_model_aws_ec2 | 92a19f1c065ba7b19c0cd4e75b30f2935a7efacb | [
"MIT"
] | 1 | 2019-11-26T13:42:27.000Z | 2019-11-26T13:42:27.000Z | baseline.py | CVxTz/keras_model_aws_ec2 | 92a19f1c065ba7b19c0cd4e75b30f2935a7efacb | [
"MIT"
] | 8 | 2020-09-25T20:38:03.000Z | 2022-03-12T00:06:00.000Z | baseline.py | CVxTz/keras_model_aws_ec2 | 92a19f1c065ba7b19c0cd4e75b30f2935a7efacb | [
"MIT"
] | null | null | null | from glob import glob
import pandas as pd
import numpy as np # linear algebra
from tensorflow.keras.applications.imagenet_utils import preprocess_input
from tensorflow.keras.callbacks import ModelCheckpoint
from sklearn.model_selection import train_test_split
from models import get_model_classif_nasnet
from utils im... | 29.521739 | 100 | 0.75405 | from glob import glob
import pandas as pd
import numpy as np
from tensorflow.keras.applications.imagenet_utils import preprocess_input
from tensorflow.keras.callbacks import ModelCheckpoint
from sklearn.model_selection import train_test_split
from models import get_model_classif_nasnet
from utils import data_gen, c... | true | true |
f7596ada545c821b37069fbdb022f5df997cc80b | 9,104 | py | Python | tripleo_ansible/ansible_plugins/modules/tripleo_get_dpdk_nics_numa_info.py | openstack/tripleo-ansible | f6630e94326a494ed051b0ca1eca49625fa542d9 | [
"Apache-2.0"
] | 22 | 2018-08-29T12:33:15.000Z | 2022-03-30T00:17:25.000Z | tripleo_ansible/ansible_plugins/modules/tripleo_get_dpdk_nics_numa_info.py | openstack/tripleo-ansible | f6630e94326a494ed051b0ca1eca49625fa542d9 | [
"Apache-2.0"
] | 1 | 2020-02-07T20:54:34.000Z | 2020-02-07T20:54:34.000Z | tripleo_ansible/ansible_plugins/modules/tripleo_get_dpdk_nics_numa_info.py | openstack/tripleo-ansible | f6630e94326a494ed051b0ca1eca49625fa542d9 | [
"Apache-2.0"
] | 19 | 2019-07-16T04:42:00.000Z | 2022-03-30T00:17:29.000Z | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2020 Red Hat, 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/lice... | 32.398577 | 107 | 0.630931 |
__metaclass__ = type
from ansible.module_utils.basic import AnsibleModule
try:
from ansible.module_utils import tripleo_common_utils as tc
except ImportError:
from tripleo_ansible.ansible_plugins.module_utils import tripleo_common_utils as tc
from ansible_collections.openstack.cloud.plugins.mod... | true | true |
f7596b16f8764c2d2a0905bee2a446941293945e | 1,900 | py | Python | torch_points_kernels/chamfer_dist.py | hzxie/torch-points-kernels | a52ea03bdd62e890320c592282ebd89de659534f | [
"MIT"
] | 1 | 2021-01-09T14:04:29.000Z | 2021-01-09T14:04:29.000Z | torch_points_kernels/chamfer_dist.py | hzxie/torch-points-kernels | a52ea03bdd62e890320c592282ebd89de659534f | [
"MIT"
] | null | null | null | torch_points_kernels/chamfer_dist.py | hzxie/torch-points-kernels | a52ea03bdd62e890320c592282ebd89de659534f | [
"MIT"
] | null | null | null | import torch
if torch.cuda.is_available():
import torch_points_kernels.points_cuda as tpcuda
class ChamferFunction(torch.autograd.Function):
@staticmethod
def forward(ctx, xyz1, xyz2):
if not torch.cuda.is_available():
raise NotImplementedError(
"CPU version is not ava... | 31.666667 | 94 | 0.637895 | import torch
if torch.cuda.is_available():
import torch_points_kernels.points_cuda as tpcuda
class ChamferFunction(torch.autograd.Function):
@staticmethod
def forward(ctx, xyz1, xyz2):
if not torch.cuda.is_available():
raise NotImplementedError(
"CPU version is not ava... | true | true |
f7596cd8f91fd35f2d62df4c4f888750b37429b3 | 6,511 | py | Python | data/external/repositories/115375/hail-seizure-master/python/rfe_chain.py | Keesiu/meta-kaggle | 87de739aba2399fd31072ee81b391f9b7a63f540 | [
"MIT"
] | null | null | null | data/external/repositories/115375/hail-seizure-master/python/rfe_chain.py | Keesiu/meta-kaggle | 87de739aba2399fd31072ee81b391f9b7a63f540 | [
"MIT"
] | 1 | 2015-12-10T16:46:02.000Z | 2018-05-21T23:01:55.000Z | python/rfe_chain.py | Neuroglycerin/hail-seizure | 5f66bffd87849270457054b897201f11e8c7ab70 | [
"Apache-2.0"
] | 1 | 2018-04-11T15:20:02.000Z | 2018-04-11T15:20:02.000Z |
import json
import train
import random
import os
from generatebatchsettings import *
import numpy as np
import copy
import hashlib
import glob
import sys
import optparse
import utils
def main(run_dir="rfe_chain", start=None, start_auc=None,
verbose=None, logfile=None):
"""
Main function to run the ... | 33.389744 | 90 | 0.521272 |
import json
import train
import random
import os
from generatebatchsettings import *
import numpy as np
import copy
import hashlib
import glob
import sys
import optparse
import utils
def main(run_dir="rfe_chain", start=None, start_auc=None,
verbose=None, logfile=None):
if logfile is not None:
s... | true | true |
f7596d66f744d9f411fd4324c435b1e2f921b049 | 25,638 | py | Python | tests/unittests/test_operations_submit.py | pyoseo/oseoserver | 8c97ee5a7d698cc989e1c8cab8cfe0db78491307 | [
"Apache-2.0"
] | null | null | null | tests/unittests/test_operations_submit.py | pyoseo/oseoserver | 8c97ee5a7d698cc989e1c8cab8cfe0db78491307 | [
"Apache-2.0"
] | 10 | 2015-02-10T17:10:33.000Z | 2018-04-05T10:05:01.000Z | tests/unittests/test_operations_submit.py | pyoseo/oseoserver | 8c97ee5a7d698cc989e1c8cab8cfe0db78491307 | [
"Apache-2.0"
] | null | null | null | """Unit tests for oseoserver.operations.submit"""
from lxml import etree
import mock
import pytest
from pyxb import BIND
from pyxb.bundles.opengis import oseo_1_0 as oseo
from oseoserver import errors
from oseoserver.operations import submit
from oseoserver import models
from oseoserver.models import Order
from oseos... | 37.537335 | 79 | 0.667603 |
from lxml import etree
import mock
import pytest
from pyxb import BIND
from pyxb.bundles.opengis import oseo_1_0 as oseo
from oseoserver import errors
from oseoserver.operations import submit
from oseoserver import models
from oseoserver.models import Order
from oseoserver.models import CustomizableItem
from oseoserv... | true | true |
f7596def9308a50255f1e0880592426d621bf7d5 | 929 | py | Python | setup.py | lizeqing/requests_httpsproxy | 7edf20df7853003d24d66a5b45a307106187fc76 | [
"MIT"
] | null | null | null | setup.py | lizeqing/requests_httpsproxy | 7edf20df7853003d24d66a5b45a307106187fc76 | [
"MIT"
] | null | null | null | setup.py | lizeqing/requests_httpsproxy | 7edf20df7853003d24d66a5b45a307106187fc76 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='requests_httpsproxy',
version='1.0.6',
description='allow http/https requests through https proxy',
long_description=open('README.rst').read(),
classifiers=[
'Development Status :: 4 - Beta',
'License ::... | 28.151515 | 64 | 0.615716 |
from setuptools import setup, find_packages
setup(
name='requests_httpsproxy',
version='1.0.6',
description='allow http/https requests through https proxy',
long_description=open('README.rst').read(),
classifiers=[
'Development Status :: 4 - Beta',
'License :: OSI Approved :: MIT ... | true | true |
f7596ee23c68f7c668b47f5d744f194bd20a9976 | 2,205 | py | Python | backend/fitlive_31937/urls.py | crowdbotics-apps/fitlive-31937 | 8c614d6a1a7f176a2d98f5bb79b1156e83044d6d | [
"FTL",
"AML",
"RSA-MD"
] | null | null | null | backend/fitlive_31937/urls.py | crowdbotics-apps/fitlive-31937 | 8c614d6a1a7f176a2d98f5bb79b1156e83044d6d | [
"FTL",
"AML",
"RSA-MD"
] | null | null | null | backend/fitlive_31937/urls.py | crowdbotics-apps/fitlive-31937 | 8c614d6a1a7f176a2d98f5bb79b1156e83044d6d | [
"FTL",
"AML",
"RSA-MD"
] | null | null | null | """fitlive_31937 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')
Class... | 35 | 87 | 0.711565 |
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 |
f7596f00f2f965c994e2663ec34855f878595bc1 | 3,490 | py | Python | services/models.py | squirrelmaker/explorer | e7acc7012c341728c1b6894f6b0a077105f6feec | [
"Apache-2.0"
] | 917 | 2015-01-08T03:37:42.000Z | 2022-03-31T13:42:56.000Z | services/models.py | vechitech/explorer | 6eedc672738126d066c6f8d73a380d3af364eeb9 | [
"Apache-2.0"
] | 268 | 2015-01-08T07:40:12.000Z | 2022-01-13T11:12:20.000Z | services/models.py | vechitech/explorer | 6eedc672738126d066c6f8d73a380d3af364eeb9 | [
"Apache-2.0"
] | 662 | 2015-01-15T00:43:24.000Z | 2022-03-24T06:40:18.000Z | from django.db import models
from blockexplorer.raven import client
from jsonfield import JSONField
from utils import get_client_ip, uri_to_url, is_good_status_code, get_user_agent
import json
import requests
class APICall(models.Model):
"""
To keep track of all our external API calls and aid in debugging... | 37.934783 | 126 | 0.690831 | from django.db import models
from blockexplorer.raven import client
from jsonfield import JSONField
from utils import get_client_ip, uri_to_url, is_good_status_code, get_user_agent
import json
import requests
class APICall(models.Model):
API_NAME_CHOICES = ()
created_at = models.DateTimeField(auto_... | true | true |
f7596f75f431c85d100fed54c64e77e8ef120b68 | 34,044 | py | Python | tests/gcp/operators/test_cloud_storage_transfer_service.py | robobario/airflow | 702005fe35dc5b996a5c5b8d349ed36036472f00 | [
"Apache-2.0"
] | 1 | 2021-09-16T17:20:00.000Z | 2021-09-16T17:20:00.000Z | tests/gcp/operators/test_cloud_storage_transfer_service.py | robobario/airflow | 702005fe35dc5b996a5c5b8d349ed36036472f00 | [
"Apache-2.0"
] | 20 | 2017-04-18T19:47:46.000Z | 2020-01-13T04:19:24.000Z | tests/gcp/operators/test_cloud_storage_transfer_service.py | robobario/airflow | 702005fe35dc5b996a5c5b8d349ed36036472f00 | [
"Apache-2.0"
] | 2 | 2018-09-15T07:13:01.000Z | 2021-03-26T07:27:38.000Z | # -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | 45.574297 | 110 | 0.716778 |
import itertools
import unittest
from copy import deepcopy
from datetime import date, time
from typing import Dict
from botocore.credentials import Credentials
from freezegun import freeze_time
from parameterized import parameterized
from airflow import AirflowException
from airflow.gcp.hooks.cloud_... | true | true |
f7597050528d172aef0c4901b7ccca34175864f1 | 4,865 | py | Python | mys/pygments/pygments/formatters/terminal.py | eerimoq/sython | 90937bf44b798b9c1ae0d18e31e11e95967b46c6 | [
"MIT"
] | 83 | 2020-08-18T18:48:46.000Z | 2021-01-01T17:00:45.000Z | mys/pygments/pygments/formatters/terminal.py | eerimoq/sython | 90937bf44b798b9c1ae0d18e31e11e95967b46c6 | [
"MIT"
] | 31 | 2021-01-05T00:32:36.000Z | 2022-02-23T13:34:33.000Z | mys/pygments/pygments/formatters/terminal.py | eerimoq/sython | 90937bf44b798b9c1ae0d18e31e11e95967b46c6 | [
"MIT"
] | 7 | 2021-01-03T11:53:03.000Z | 2022-02-22T17:49:42.000Z | """
pygments.formatters.terminal
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Formatter for terminal output with ANSI sequences.
:copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import sys
from pygments.console import ansiformat
from pygments.formatt... | 35.510949 | 84 | 0.580267 |
import sys
from pygments.console import ansiformat
from pygments.formatter import Formatter
from pygments.token import Comment
from pygments.token import Error
from pygments.token import Generic
from pygments.token import Keyword
from pygments.token import Name
from pygments.token import Number
from pygments.token im... | true | true |
f75970d5f8a6a45e3797219e5bf4746e46623d84 | 48,692 | py | Python | text2speech/modules/__init__.py | HelloChatterbox/text2speech | 809cdc02730ef6433fa42c460ff9b2fd43d0d7fd | [
"Apache-2.0"
] | 2 | 2020-09-17T21:33:57.000Z | 2021-01-02T20:42:31.000Z | text2speech/modules/__init__.py | HelloChatterbox/text2speech | 809cdc02730ef6433fa42c460ff9b2fd43d0d7fd | [
"Apache-2.0"
] | 2 | 2021-01-11T18:50:11.000Z | 2021-06-08T20:19:14.000Z | text2speech/modules/__init__.py | HelloChatterbox/text2speech | 809cdc02730ef6433fa42c460ff9b2fd43d0d7fd | [
"Apache-2.0"
] | 5 | 2020-08-11T17:11:53.000Z | 2021-08-28T19:00:34.000Z | import subprocess
from os.path import isfile
import hashlib
import os
import random
import re
from tempfile import gettempdir
import os.path
from requests_futures.sessions import FuturesSession
from os.path import dirname, exists, isdir, join
from text2speech.util import get_cache_directory, remove_last_slash
from ovos... | 37.658159 | 462 | 0.59174 | import subprocess
from os.path import isfile
import hashlib
import os
import random
import re
from tempfile import gettempdir
import os.path
from requests_futures.sessions import FuturesSession
from os.path import dirname, exists, isdir, join
from text2speech.util import get_cache_directory, remove_last_slash
from ovos... | true | true |
f75971a39efd1bef3d8f504b1a8a0396d9bba5f3 | 673 | py | Python | test/storage_service_test.py | zaman-lab/brexitmeter-py | a1ea66d7d747276679f8f4acdb2c2963517a0f04 | [
"MIT"
] | 1 | 2019-10-03T19:47:31.000Z | 2019-10-03T19:47:31.000Z | test/storage_service_test.py | zaman-lab/trumpmeter-py | f4e28971d65224bd0dd93171aa9288f743714738 | [
"MIT"
] | 5 | 2019-10-22T16:08:10.000Z | 2019-11-22T23:00:13.000Z | test/storage_service_test.py | zaman-lab/brexitmeter-py | a1ea66d7d747276679f8f4acdb2c2963517a0f04 | [
"MIT"
] | 3 | 2019-10-15T05:08:10.000Z | 2019-11-05T01:04:45.000Z |
import os
import tensorflow as tf
from app.storage_service import weights_filepath, dictionaries_dirpath
def test_local_storage():
local_filepaths = [
weights_filepath("local"),
os.path.join(dictionaries_dirpath("local"), "dic.txt"),
os.path.join(dictionaries_dirpath("local"), "dic_s.txt"),
]
for file... | 28.041667 | 70 | 0.729569 |
import os
import tensorflow as tf
from app.storage_service import weights_filepath, dictionaries_dirpath
def test_local_storage():
local_filepaths = [
weights_filepath("local"),
os.path.join(dictionaries_dirpath("local"), "dic.txt"),
os.path.join(dictionaries_dirpath("local"), "dic_s.txt"),
]
for file... | true | true |
f75975fe74da00ddb8be75304cc087653377ccf4 | 589 | py | Python | tests/test_base.py | revsys/nodels | a5450da66002bc055732e0ac708c3598e99b0610 | [
"BSD-3-Clause"
] | null | null | null | tests/test_base.py | revsys/nodels | a5450da66002bc055732e0ac708c3598e99b0610 | [
"BSD-3-Clause"
] | 1 | 2019-05-31T20:58:23.000Z | 2019-05-31T20:58:23.000Z | tests/test_base.py | revsys/nodels | a5450da66002bc055732e0ac708c3598e99b0610 | [
"BSD-3-Clause"
] | 1 | 2020-11-24T10:11:10.000Z | 2020-11-24T10:11:10.000Z | import pytest
from nodels.base import BaseGather
def test_to_dict():
b = BaseGather()
assert b.to_dict() == {}
b2 = BaseGather(data={"foo": "bar"})
assert b2.to_dict() == {"foo": "bar"}
def test_json():
b = BaseGather()
assert b.json() == "{}"
b2 = BaseGather(data={"foo": "bar"})
... | 18.40625 | 44 | 0.594228 | import pytest
from nodels.base import BaseGather
def test_to_dict():
b = BaseGather()
assert b.to_dict() == {}
b2 = BaseGather(data={"foo": "bar"})
assert b2.to_dict() == {"foo": "bar"}
def test_json():
b = BaseGather()
assert b.json() == "{}"
b2 = BaseGather(data={"foo": "bar"})
... | true | true |
f75976453d081d779c98b2ca55ebd376fdd719c4 | 733 | py | Python | api/meme_generator/image_watermark.py | InFact-coop/create-refresh | 0ef01de93fa325c9146e3f407e902ef359cac488 | [
"MIT"
] | null | null | null | api/meme_generator/image_watermark.py | InFact-coop/create-refresh | 0ef01de93fa325c9146e3f407e902ef359cac488 | [
"MIT"
] | 84 | 2018-12-14T11:20:57.000Z | 2022-03-11T23:36:31.000Z | api/meme_generator/image_watermark.py | InFact-coop/create-refresh | 0ef01de93fa325c9146e3f407e902ef359cac488 | [
"MIT"
] | null | null | null | from PIL import Image
from pathlib import Path
def add_watermark(input_path, watermark_path, output_path):
"""Add EU-compliant meme watermark to a supplied image"""
try:
original_image = Image.open(input_path)
_w, h = original_image.size
size = int(round(h * 0.4))
watermark_ima... | 33.318182 | 74 | 0.653479 | from PIL import Image
from pathlib import Path
def add_watermark(input_path, watermark_path, output_path):
try:
original_image = Image.open(input_path)
_w, h = original_image.size
size = int(round(h * 0.4))
watermark_image = Image.open(watermark_path)
watermark_image.thumbn... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.