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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f7533271afbd908856dbbd9683b79b93b9592075 | 5,872 | py | Python | python/oneflow/nn/optimizer/sequential_lr.py | butterluo/oneflow | cf2ce575d80f89642b71bee2248e69b09213007d | [
"Apache-2.0"
] | null | null | null | python/oneflow/nn/optimizer/sequential_lr.py | butterluo/oneflow | cf2ce575d80f89642b71bee2248e69b09213007d | [
"Apache-2.0"
] | null | null | null | python/oneflow/nn/optimizer/sequential_lr.py | butterluo/oneflow | cf2ce575d80f89642b71bee2248e69b09213007d | [
"Apache-2.0"
] | null | null | null | """
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | 40.777778 | 107 | 0.635899 | import bisect
from typing import Sequence, Union
from .optimizer import Optimizer
from .lr_scheduler import LRScheduler, _scheduler_with_step
class SequentialLR(LRScheduler):
def __init__(
self,
optimizer: Optimizer,
schedulers: Sequence[LRScheduler],
milestones: Sequence[int],
... | true | true |
f753328b391f3451ec8d9516da6690a7fefbc52b | 6,889 | py | Python | tests/test_library.py | Tomme/python-plexapi | 49d631442633be9b6f1a17575ceefec4b8b5d6e8 | [
"BSD-3-Clause"
] | null | null | null | tests/test_library.py | Tomme/python-plexapi | 49d631442633be9b6f1a17575ceefec4b8b5d6e8 | [
"BSD-3-Clause"
] | null | null | null | tests/test_library.py | Tomme/python-plexapi | 49d631442633be9b6f1a17575ceefec4b8b5d6e8 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
import pytest
from plexapi.exceptions import NotFound
from . import conftest as utils
def test_library_Library_section(plex):
sections = plex.library.sections()
assert len(sections) >= 3
section_name = plex.library.section('TV Shows')
assert section_name.title == 'TV Shows'
... | 31.031532 | 110 | 0.748004 |
import pytest
from plexapi.exceptions import NotFound
from . import conftest as utils
def test_library_Library_section(plex):
sections = plex.library.sections()
assert len(sections) >= 3
section_name = plex.library.section('TV Shows')
assert section_name.title == 'TV Shows'
with pytest.raises(Not... | true | true |
f75333404b4fcaad012756624f8a4c982231a8cf | 2,077 | py | Python | train model/src/inference/UNetInferenceAgent.py | aaryapatel007/Hippocampal-Volume-Quantification-in-Alzheimer-Progression | 5c9eff98572c1d2647a742d285805d9e328ab14f | [
"MIT"
] | 7 | 2020-09-22T18:22:23.000Z | 2021-09-25T12:20:10.000Z | train model/src/inference/UNetInferenceAgent.py | aaryapatel007/Hippocampal-Volume-Quantification-in-Alzheimer-Progression | 5c9eff98572c1d2647a742d285805d9e328ab14f | [
"MIT"
] | null | null | null | train model/src/inference/UNetInferenceAgent.py | aaryapatel007/Hippocampal-Volume-Quantification-in-Alzheimer-Progression | 5c9eff98572c1d2647a742d285805d9e328ab14f | [
"MIT"
] | 4 | 2021-01-09T09:56:03.000Z | 2022-03-12T11:54:57.000Z | """
Contains class that runs inferencing
"""
import torch
import numpy as np
from networks.RecursiveUNet import UNet
from utils.utils import med_reshape
class UNetInferenceAgent:
"""
Stores model and parameters and some methods to handle inferencing
"""
def __init__(self, parameter_file_path='', mode... | 31 | 103 | 0.646606 | import torch
import numpy as np
from networks.RecursiveUNet import UNet
from utils.utils import med_reshape
class UNetInferenceAgent:
def __init__(self, parameter_file_path='', model=None, device="cpu", patch_size=64):
self.model = model
self.patch_size = patch_size
self.device = device
... | true | true |
f753341fad704cf609583de5d22f20adc778d97c | 10,245 | py | Python | models/base.py | cv-hci-project/PyTorch-VAE | e9b9d122eb52f76e096942b300a8db97a123be13 | [
"Apache-2.0"
] | 1 | 2021-10-10T17:07:29.000Z | 2021-10-10T17:07:29.000Z | models/base.py | pdeubel/PyTorch-VAE | e9b9d122eb52f76e096942b300a8db97a123be13 | [
"Apache-2.0"
] | null | null | null | models/base.py | pdeubel/PyTorch-VAE | e9b9d122eb52f76e096942b300a8db97a123be13 | [
"Apache-2.0"
] | 1 | 2021-09-06T22:01:14.000Z | 2021-09-06T22:01:14.000Z | from abc import abstractmethod
import matplotlib.pyplot as plt
import pytorch_lightning as pl
import torch
import torchvision.utils as vutils
from torch import optim
from torch.utils.data import DataLoader
from torchvision import transforms
from torchvision.datasets import CelebA
from datasets.concrete_cracks import ... | 40.98 | 114 | 0.517618 | from abc import abstractmethod
import matplotlib.pyplot as plt
import pytorch_lightning as pl
import torch
import torchvision.utils as vutils
from torch import optim
from torch.utils.data import DataLoader
from torchvision import transforms
from torchvision.datasets import CelebA
from datasets.concrete_cracks import ... | true | true |
f75335ca357bc10a1d8c06928ec8e8757a10616a | 2,029 | py | Python | tests/components/homekit_controller/test_air_quality.py | switschel/core | 0ecca246bdc3028c30bf8ccbf2b4c7f2a8b3f9aa | [
"Apache-2.0"
] | 1 | 2022-01-05T16:48:58.000Z | 2022-01-05T16:48:58.000Z | tests/components/homekit_controller/test_air_quality.py | switschel/core | 0ecca246bdc3028c30bf8ccbf2b4c7f2a8b3f9aa | [
"Apache-2.0"
] | 68 | 2020-07-23T07:13:53.000Z | 2022-03-31T06:01:48.000Z | tests/components/homekit_controller/test_air_quality.py | switschel/core | 0ecca246bdc3028c30bf8ccbf2b4c7f2a8b3f9aa | [
"Apache-2.0"
] | 1 | 2020-12-13T08:27:33.000Z | 2020-12-13T08:27:33.000Z | """Basic checks for HomeKit air quality sensor."""
from aiohomekit.model.characteristics import CharacteristicsTypes
from aiohomekit.model.services import ServicesTypes
from homeassistant.helpers import entity_registry as er
from tests.components.homekit_controller.common import setup_test_component
def create_air_... | 36.232143 | 80 | 0.774766 | from aiohomekit.model.characteristics import CharacteristicsTypes
from aiohomekit.model.services import ServicesTypes
from homeassistant.helpers import entity_registry as er
from tests.components.homekit_controller.common import setup_test_component
def create_air_quality_sensor_service(accessory):
service = ac... | true | true |
f753366f2c1a36457a50623b7e21a8e4a068486d | 1,121 | py | Python | puma/primitives/auto_reset_event.py | gift-surg/puma | 58beae3459a0c8d96adfe9af323e26868428df4d | [
"Apache-2.0"
] | null | null | null | puma/primitives/auto_reset_event.py | gift-surg/puma | 58beae3459a0c8d96adfe9af323e26868428df4d | [
"Apache-2.0"
] | 13 | 2020-05-04T14:14:58.000Z | 2020-07-29T16:37:03.000Z | puma/primitives/auto_reset_event.py | gift-surg/puma | 58beae3459a0c8d96adfe9af323e26868428df4d | [
"Apache-2.0"
] | null | null | null | import threading
from typing import NoReturn, Union, no_type_check
class AutoResetEvent(threading.Event):
"""Like threading.Event, except that wait() resets the event automatically."""
@no_type_check # I don't know why MyPy refuses to believe that threading.Event has properties self._cond and self._flag.
... | 48.73913 | 137 | 0.676182 | import threading
from typing import NoReturn, Union, no_type_check
class AutoResetEvent(threading.Event):
@no_type_check
def wait(self, timeout: Union[int, float, None] = None) -> bool:
# This is a copy of the implementation in threading.Event, but with the addition of the line that clears the flag... | true | true |
f75336862df1b267e83b88c61dd72e7599c141ca | 5,908 | py | Python | saleor/graphql/core/mutations.py | eskerda/saleor | b624d9f2ec6ae98a4c6ed50adf6735065d979aad | [
"BSD-3-Clause"
] | null | null | null | saleor/graphql/core/mutations.py | eskerda/saleor | b624d9f2ec6ae98a4c6ed50adf6735065d979aad | [
"BSD-3-Clause"
] | null | null | null | saleor/graphql/core/mutations.py | eskerda/saleor | b624d9f2ec6ae98a4c6ed50adf6735065d979aad | [
"BSD-3-Clause"
] | null | null | null | from collections import OrderedDict
import graphene
from django.core.exceptions import ImproperlyConfigured
from graphene.types.mutation import MutationOptions
from graphene_django.form_converter import convert_form_field
from graphene_django.registry import get_global_registry
from graphql_jwt.decorators import staff... | 30.770833 | 75 | 0.681618 | from collections import OrderedDict
import graphene
from django.core.exceptions import ImproperlyConfigured
from graphene.types.mutation import MutationOptions
from graphene_django.form_converter import convert_form_field
from graphene_django.registry import get_global_registry
from graphql_jwt.decorators import staff... | true | true |
f753372832e07d75ba3a8f59b35a2ec01a4c9498 | 1,631 | py | Python | SalishSea/tides/script_runs_RC4.py | SalishSeaCast/SS-run-sets | a330ef9963defa6dc322c3f2313f76824878a58b | [
"Apache-2.0"
] | 1 | 2020-04-21T16:47:27.000Z | 2020-04-21T16:47:27.000Z | tempSalishSea/tides/script_runs_RC4.py | SalishSeaCast/SS-run-sets | a330ef9963defa6dc322c3f2313f76824878a58b | [
"Apache-2.0"
] | null | null | null | tempSalishSea/tides/script_runs_RC4.py | SalishSeaCast/SS-run-sets | a330ef9963defa6dc322c3f2313f76824878a58b | [
"Apache-2.0"
] | null | null | null | """ Script to define and execute a series of Salish Sea NEMO model runs.
All use the same RC4, corr4 files but include different numbers of tidal
constituents
"""
from __future__ import absolute_import
import os
import salishsea_cmd.api
def main():
run_desc = base_run_description()
runs = ('RC4_wO1S2', ... | 28.12069 | 72 | 0.626609 | from __future__ import absolute_import
import os
import salishsea_cmd.api
def main():
run_desc = base_run_description()
runs = ('RC4_wO1S2', 'RC4_wO1S2P1N2', 'RC4_wO1S2P1N2Q1K2')
for run_id in runs:
do_run(run_id, run_desc)
def do_run(run_id, run_desc):
run_desc['run_id'] = run_id
... | true | true |
f75338a04a50d9d144a63469e526b9860b0ad7b7 | 823 | py | Python | ColorPair_test_data.py | clean-code-craft-tcq-1/modular-python-Anjana-MU | a5bf6fb4b4a9f785a8ec714efbdf314e810d6514 | [
"MIT"
] | null | null | null | ColorPair_test_data.py | clean-code-craft-tcq-1/modular-python-Anjana-MU | a5bf6fb4b4a9f785a8ec714efbdf314e810d6514 | [
"MIT"
] | null | null | null | ColorPair_test_data.py | clean-code-craft-tcq-1/modular-python-Anjana-MU | a5bf6fb4b4a9f785a8ec714efbdf314e810d6514 | [
"MIT"
] | 1 | 2021-02-19T12:02:56.000Z | 2021-02-19T12:02:56.000Z | from ColorPair_get_data import get_color_from_pair_number
from ColorPair_get_data import get_pair_number_from_color
def test_functionalities():
test_number_to_pair(4, 'White', 'Brown')
test_number_to_pair(5, 'White', 'Slate')
test_pair_to_number('Black', 'Orange', 12)
test_pair_to_number('Violet', 'Slate', 25)... | 41.15 | 72 | 0.789793 | from ColorPair_get_data import get_color_from_pair_number
from ColorPair_get_data import get_pair_number_from_color
def test_functionalities():
test_number_to_pair(4, 'White', 'Brown')
test_number_to_pair(5, 'White', 'Slate')
test_pair_to_number('Black', 'Orange', 12)
test_pair_to_number('Violet', 'Slate', 25)... | true | true |
f75339253437217941857da8b8bd459190355a8e | 3,251 | py | Python | sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/projects/aio/_configuration.py | xolve/azure-sdk-for-python | 9f5baa19c392f77f811d936ee43450e4ea524002 | [
"MIT"
] | null | null | null | sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/projects/aio/_configuration.py | xolve/azure-sdk-for-python | 9f5baa19c392f77f811d936ee43450e4ea524002 | [
"MIT"
] | null | null | null | sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/projects/aio/_configuration.py | xolve/azure-sdk-for-python | 9f5baa19c392f77f811d936ee43450e4ea524002 | [
"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 ... | 49.257576 | 149 | 0.693018 |
from typing import Any
from azure.core.configuration import Configuration
from azure.core.credentials import AzureKeyCredential
from azure.core.pipeline import policies
VERSION = "unknown"
class QuestionAnsweringProjectsClientConfiguration(Configuration):
def __init__(
self,
endpoint: st... | true | true |
f75339254745c2de1d3af367b4e8f41c0b34baf2 | 5,738 | py | Python | modin/pandas/datetimes.py | hwsamuel/modin | 8602fc0814337b257110239cd6830641eb0bf97a | [
"Apache-2.0"
] | 2 | 2020-06-29T13:15:04.000Z | 2020-08-10T22:31:08.000Z | modin/pandas/datetimes.py | hwsamuel/modin | 8602fc0814337b257110239cd6830641eb0bf97a | [
"Apache-2.0"
] | 26 | 2020-06-16T08:40:28.000Z | 2020-09-01T10:13:38.000Z | modin/pandas/datetimes.py | intel-go/modin | 4d0a3155b31104ac8083b223bd71ff3e541ecd92 | [
"Apache-2.0"
] | 2 | 2020-11-20T23:04:03.000Z | 2021-12-01T00:50:34.000Z | # Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may not u... | 40.695035 | 88 | 0.660857 |
import pandas
from .dataframe import DataFrame
from .series import Series
def to_datetime(
arg,
errors="raise",
dayfirst=False,
yearfirst=False,
utc=None,
format=None,
exact=True,
unit=None,
infer_datetime_format=False,
origin="unix",
cache=True,
):
if not... | true | true |
f75339605590641977a32c51ac1f198989f63cfa | 13,538 | py | Python | tests/conftest.py | mbolivar-nordic/west | e02ac52236be5ffdf46ca9b8b99b771542ac2ff3 | [
"Apache-2.0"
] | null | null | null | tests/conftest.py | mbolivar-nordic/west | e02ac52236be5ffdf46ca9b8b99b771542ac2ff3 | [
"Apache-2.0"
] | null | null | null | tests/conftest.py | mbolivar-nordic/west | e02ac52236be5ffdf46ca9b8b99b771542ac2ff3 | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2019, 2020 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: Apache-2.0
import os
from pathlib import Path, PurePath
import platform
import shlex
import shutil
import subprocess
import sys
import textwrap
from west import configuration as config
import pytest
GIT = shutil.which('git')
# If you c... | 35.720317 | 79 | 0.614271 |
import os
from pathlib import Path, PurePath
import platform
import shlex
import shutil
import subprocess
import sys
import textwrap
from west import configuration as config
import pytest
GIT = shutil.which('git')
MANIFEST_TEMPLATE = '''\
manifest:
defaults:
remote: test-local
remotes:
- name: test... | true | true |
f75339e856f45bc49dfefb13bc083497411c9b3f | 3,438 | py | Python | pyswagger/scan.py | gavrie/pyswagger | f5622d70519061c793e57d1b27659afbb8677105 | [
"MIT"
] | 199 | 2018-06-04T18:10:51.000Z | 2022-03-06T15:23:48.000Z | pyswagger/scan.py | gavrie/pyswagger | f5622d70519061c793e57d1b27659afbb8677105 | [
"MIT"
] | 125 | 2015-01-03T01:42:02.000Z | 2018-05-21T14:44:22.000Z | pyswagger/scan.py | gavrie/pyswagger | f5622d70519061c793e57d1b27659afbb8677105 | [
"MIT"
] | 61 | 2018-06-10T01:46:06.000Z | 2022-03-08T01:13:11.000Z | from __future__ import absolute_import
from .spec.base import BaseObj
import six
def default_tree_traversal(root, leaves):
""" default tree traversal """
objs = [('#', root)]
while len(objs) > 0:
path, obj = objs.pop()
# name of child are json-pointer encoded, we don't have
# to e... | 27.070866 | 101 | 0.518325 | from __future__ import absolute_import
from .spec.base import BaseObj
import six
def default_tree_traversal(root, leaves):
objs = [('#', root)]
while len(objs) > 0:
path, obj = objs.pop()
# to encode it again.
if obj.__class__ not in leaves:
objs.extend(map(lambda... | true | true |
f75339f3316fa08437848dfaf9564a85b79049bf | 240 | py | Python | UnityEngine/VerticalWrapMode/__init__.py | Grim-es/udon-pie-auto-completion | c2cd86554ed615cdbbb01e19fa40665eafdfaedc | [
"MIT"
] | null | null | null | UnityEngine/VerticalWrapMode/__init__.py | Grim-es/udon-pie-auto-completion | c2cd86554ed615cdbbb01e19fa40665eafdfaedc | [
"MIT"
] | null | null | null | UnityEngine/VerticalWrapMode/__init__.py | Grim-es/udon-pie-auto-completion | c2cd86554ed615cdbbb01e19fa40665eafdfaedc | [
"MIT"
] | null | null | null | from UdonPie import UnityEngine
from UdonPie.Undefined import *
class VerticalWrapMode:
def __new__(cls, arg1=None):
'''
:returns: VerticalWrapMode
:rtype: UnityEngine.VerticalWrapMode
'''
pass
| 20 | 44 | 0.645833 | from UdonPie import UnityEngine
from UdonPie.Undefined import *
class VerticalWrapMode:
def __new__(cls, arg1=None):
pass
| true | true |
f7533a18a1b348e933be1af446bfcb6a698ac718 | 34,794 | py | Python | adspygoogle/dfp/zsi/v201010/NetworkService_services_types.py | hockeyprincess/google-api-dfp-python | efa82a8d85cbdc90f030db9d168790c55bd8b12a | [
"Apache-2.0"
] | null | null | null | adspygoogle/dfp/zsi/v201010/NetworkService_services_types.py | hockeyprincess/google-api-dfp-python | efa82a8d85cbdc90f030db9d168790c55bd8b12a | [
"Apache-2.0"
] | null | null | null | adspygoogle/dfp/zsi/v201010/NetworkService_services_types.py | hockeyprincess/google-api-dfp-python | efa82a8d85cbdc90f030db9d168790c55bd8b12a | [
"Apache-2.0"
] | null | null | null | ##################################################
# NetworkService_services_types.py
# generated by ZSI.generate.wsdl2python
##################################################
import ZSI
import ZSI.TCcompound
from ZSI.schema import LocalElementDeclaration, ElementDeclaration, TypeDefinition, GTD, GED
############... | 57.701493 | 1,029 | 0.631086 | what=TClist, extend=True, attributes=attributes, **kw)
class InternalApiError_Def(TypeDefinition):
schema = "https://www.google.com/apis/ads/publisher/v201010"
type = (schema, "InternalApiError")
def __init__(self, pname, ofwhat=(), extend=False, restrict=False, attributes=None, **... | true | true |
f7533b002600f542beb015ba1ee5ab227ed34068 | 16,915 | py | Python | thumt/bin/trainer.py | souradip93/GCDT | 5991044307f59598ea224b64f1f3b915fa00ebcc | [
"BSD-3-Clause"
] | 72 | 2019-06-07T02:05:10.000Z | 2022-02-24T09:33:13.000Z | thumt/bin/trainer.py | souradip93/GCDT | 5991044307f59598ea224b64f1f3b915fa00ebcc | [
"BSD-3-Clause"
] | 5 | 2019-09-11T02:50:17.000Z | 2021-11-19T07:05:10.000Z | thumt/bin/trainer.py | souradip93/GCDT | 5991044307f59598ea224b64f1f3b915fa00ebcc | [
"BSD-3-Clause"
] | 17 | 2019-06-06T03:12:15.000Z | 2021-12-10T20:04:30.000Z | #!/usr/bin/env python
# coding=utf-8
# Copyright 2018 The THUMT Authors
import argparse
import os
import numpy as np
import tensorflow as tf
import thumt.data.dataset as dataset
import thumt.data.record as record
import thumt.data.vocab as vocabulary
import thumt.models as models
import thumt.utils.hooks as hooks
impo... | 35.836864 | 146 | 0.594798 |
import argparse
import os
import numpy as np
import tensorflow as tf
import thumt.data.dataset as dataset
import thumt.data.record as record
import thumt.data.vocab as vocabulary
import thumt.models as models
import thumt.utils.hooks as hooks
import thumt.utils.utils as utils
import thumt.utils.parallel as parallel... | true | true |
f7533b7f5ac799ef0852da523ded9922ad36707d | 5,454 | py | Python | tests/components/airnow/test_config_flow.py | tbarbette/core | 8e58c3aa7bc8d2c2b09b6bd329daa1c092d52d3c | [
"Apache-2.0"
] | 6 | 2017-08-02T19:26:39.000Z | 2020-03-14T22:47:41.000Z | tests/components/airnow/test_config_flow.py | tbarbette/core | 8e58c3aa7bc8d2c2b09b6bd329daa1c092d52d3c | [
"Apache-2.0"
] | 58 | 2020-08-03T07:33:02.000Z | 2022-03-31T06:02:05.000Z | tests/components/airnow/test_config_flow.py | tbarbette/core | 8e58c3aa7bc8d2c2b09b6bd329daa1c092d52d3c | [
"Apache-2.0"
] | 14 | 2018-08-19T16:28:26.000Z | 2021-09-02T18:26:53.000Z | """Test the AirNow config flow."""
from unittest.mock import patch
from pyairnow.errors import AirNowError, InvalidKeyError
from homeassistant import config_entries, data_entry_flow, setup
from homeassistant.components.airnow.const import DOMAIN
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGIT... | 29.165775 | 88 | 0.621012 | from unittest.mock import patch
from pyairnow.errors import AirNowError, InvalidKeyError
from homeassistant import config_entries, data_entry_flow, setup
from homeassistant.components.airnow.const import DOMAIN
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, CONF_RADIUS
from tests.common... | true | true |
f7533badfcb6513d7d7a25a2b685f310445cf622 | 1,868 | py | Python | agents/search/astar.py | jmribeiro/PLASTIC-Algorithms | c59ad567a906f320220a09caff64c4a6273151f8 | [
"Apache-2.0"
] | 5 | 2020-10-20T17:00:07.000Z | 2022-03-11T06:23:09.000Z | agents/search/astar.py | jmribeiro/PLASTIC-Algorithms | c59ad567a906f320220a09caff64c4a6273151f8 | [
"Apache-2.0"
] | 2 | 2020-12-05T05:56:57.000Z | 2021-06-05T08:11:35.000Z | agents/search/astar.py | jmribeiro/PLASTIC-Algorithms | c59ad567a906f320220a09caff64c4a6273151f8 | [
"Apache-2.0"
] | null | null | null | from heapq import *
from environment.utils import distance, neighbors, direction
class Node(object):
def __init__(self, position, parent, cost, heuristic):
self.position = position
self.parent = parent
self.cost = cost
self.heuristic = heuristic
def __lt__(self, other):
... | 26.309859 | 89 | 0.625268 | from heapq import *
from environment.utils import distance, neighbors, direction
class Node(object):
def __init__(self, position, parent, cost, heuristic):
self.position = position
self.parent = parent
self.cost = cost
self.heuristic = heuristic
def __lt__(self, other):
... | true | true |
f7533cd7dc0e57ad6f6f35503dcb73b9ed30550d | 3,797 | py | Python | tests/structures/tree/tree_test.py | TylerYep/workshop | 69b19afc81c1b84b7f60723077670fb789b55744 | [
"MIT"
] | 1 | 2021-06-14T01:20:09.000Z | 2021-06-14T01:20:09.000Z | tests/structures/tree/tree_test.py | TylerYep/workshop | 69b19afc81c1b84b7f60723077670fb789b55744 | [
"MIT"
] | null | null | null | tests/structures/tree/tree_test.py | TylerYep/workshop | 69b19afc81c1b84b7f60723077670fb789b55744 | [
"MIT"
] | null | null | null | from typing import TypeVar, cast
import pytest
from cs.structures import BinarySearchTree, RedBlackTree, Tree
from cs.util import Comparable
T = TypeVar("T", bound=Comparable)
parametrize_tree_types = pytest.mark.parametrize(
"tree_type", ("BinarySearchTree", "RedBlackTree")
)
TEN_ELEMS = (8, 3, 6, 1, 10, 14, 13... | 28.765152 | 84 | 0.59231 | from typing import TypeVar, cast
import pytest
from cs.structures import BinarySearchTree, RedBlackTree, Tree
from cs.util import Comparable
T = TypeVar("T", bound=Comparable)
parametrize_tree_types = pytest.mark.parametrize(
"tree_type", ("BinarySearchTree", "RedBlackTree")
)
TEN_ELEMS = (8, 3, 6, 1, 10, 14, 13... | true | true |
f7533d0aad1081a70ea9e135384c6de05bfeb4f6 | 2,841 | py | Python | data/external/repositories_2to3/132160/kaggle-ndsb-master/configurations/featmomentsinfo_doublescale_fs5_latemerge_2233.py | Keesiu/meta-kaggle | 87de739aba2399fd31072ee81b391f9b7a63f540 | [
"MIT"
] | null | null | null | data/external/repositories_2to3/132160/kaggle-ndsb-master/configurations/featmomentsinfo_doublescale_fs5_latemerge_2233.py | Keesiu/meta-kaggle | 87de739aba2399fd31072ee81b391f9b7a63f540 | [
"MIT"
] | null | null | null | data/external/repositories_2to3/132160/kaggle-ndsb-master/configurations/featmomentsinfo_doublescale_fs5_latemerge_2233.py | Keesiu/meta-kaggle | 87de739aba2399fd31072ee81b391f9b7a63f540 | [
"MIT"
] | 1 | 2019-12-04T08:23:33.000Z | 2019-12-04T08:23:33.000Z |
"""momentsinfo_convroll4_doublescale_fs5"""
import numpy as np
import theano
import theano.tensor as T
import lasagne as nn
import data
import load
import nn_plankton
import dihedral
import tmp_dnn
import tta
batch_size = 128
chunk_size = 32768
num_chunks_train = 240
momentum = 0.9
learnin... | 32.655172 | 187 | 0.728617 |
import numpy as np
import theano
import theano.tensor as T
import lasagne as nn
import data
import load
import nn_plankton
import dihedral
import tmp_dnn
import tta
batch_size = 128
chunk_size = 32768
num_chunks_train = 240
momentum = 0.9
learning_rate_schedule = {
0: 0.001,
100: ... | true | true |
f7533d452877f9b98ff9e411f19526008aefd991 | 624 | py | Python | Pescado.py | rllullt/angry-bears | 4cd739c461c74378b36cad328639acb256b22c29 | [
"MIT"
] | null | null | null | Pescado.py | rllullt/angry-bears | 4cd739c461c74378b36cad328639acb256b22c29 | [
"MIT"
] | null | null | null | Pescado.py | rllullt/angry-bears | 4cd739c461c74378b36cad328639acb256b22c29 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
'''
Clase Pescado
Genera un objeto pescado sacado de un archivo STL
Hereda la clase Alimento
'''
from Alimento import Alimento
# Clase Pescado
# Campos:
# nombreArchivo (contiene el nombre del archivo STL): str
# rugosidad (si es rugoso o brillante): str
class Pescado(Alimento):
# Constru... | 28.363636 | 91 | 0.665064 |
from Alimento import Alimento
class Pescado(Alimento):
def __init__(self, pos= [0.0, 0.0, 0.0], sz= None, rgb= [0.4706, 0.5216, 0.5451, 1.0]):
self.nombreArchivo= "concrete_fish.stl"
self.rugosidad= "b"
Alimento.__init__(self, self.rugosidad, self.nombreArchivo... | true | true |
f7533e2a5f6aa651838098aab72e1d9d62e2a48e | 1,031 | py | Python | sayings/models.py | migdall/quickblog | 3ced7e17f61239d9eab9ba8b381ff025da1dff66 | [
"MIT"
] | null | null | null | sayings/models.py | migdall/quickblog | 3ced7e17f61239d9eab9ba8b381ff025da1dff66 | [
"MIT"
] | null | null | null | sayings/models.py | migdall/quickblog | 3ced7e17f61239d9eab9ba8b381ff025da1dff66 | [
"MIT"
] | null | null | null | import uuid
from django.db import models
# Create your models here.
class Question(models.Model):
content = models.CharField(max_length=255)
class Answer(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
recording_url = models.URLField(max_length=255)
questi... | 31.242424 | 79 | 0.753637 | import uuid
from django.db import models
class Question(models.Model):
content = models.CharField(max_length=255)
class Answer(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
recording_url = models.URLField(max_length=255)
question = models.ForeignKey(Que... | true | true |
f7533ee6d6484bf3edaabc8b6e4a1f4998183395 | 5,193 | py | Python | tests/test_pandas_get_generator_operations.py | craft-ai/craft-ai-client-python | 3d8b3d9a49c0c70964deaeb9645130dd54f9a0b3 | [
"BSD-3-Clause"
] | 14 | 2016-08-26T07:06:57.000Z | 2020-09-22T07:41:21.000Z | tests/test_pandas_get_generator_operations.py | craft-ai/craft-ai-client-python | 3d8b3d9a49c0c70964deaeb9645130dd54f9a0b3 | [
"BSD-3-Clause"
] | 94 | 2016-08-02T14:07:59.000Z | 2021-10-06T11:50:52.000Z | tests/test_pandas_get_generator_operations.py | craft-ai/craft-ai-client-python | 3d8b3d9a49c0c70964deaeb9645130dd54f9a0b3 | [
"BSD-3-Clause"
] | 8 | 2017-02-07T12:05:57.000Z | 2021-10-14T09:45:30.000Z | import unittest
from craft_ai.pandas import CRAFTAI_PANDAS_ENABLED
if CRAFTAI_PANDAS_ENABLED:
import copy
import pandas as pd
import craft_ai.pandas
from .data import pandas_valid_data
from .utils import generate_entity_id
from . import settings
AGENT_ID_1_BASE = "test_1_df_pd"
AGEN... | 40.889764 | 86 | 0.729636 | import unittest
from craft_ai.pandas import CRAFTAI_PANDAS_ENABLED
if CRAFTAI_PANDAS_ENABLED:
import copy
import pandas as pd
import craft_ai.pandas
from .data import pandas_valid_data
from .utils import generate_entity_id
from . import settings
AGENT_ID_1_BASE = "test_1_df_pd"
AGEN... | true | true |
f7533fefaa34b43a6d80ed515d98c1eca0a26723 | 1,201 | py | Python | mapss/static/packages/arches/arches/app/search/components/provisional_filter.py | MPI-MAPSS/MAPSS | 3a5c0109758801717aaa8de1125ca5e98f83d3b4 | [
"CC0-1.0"
] | null | null | null | mapss/static/packages/arches/arches/app/search/components/provisional_filter.py | MPI-MAPSS/MAPSS | 3a5c0109758801717aaa8de1125ca5e98f83d3b4 | [
"CC0-1.0"
] | null | null | null | mapss/static/packages/arches/arches/app/search/components/provisional_filter.py | MPI-MAPSS/MAPSS | 3a5c0109758801717aaa8de1125ca5e98f83d3b4 | [
"CC0-1.0"
] | null | null | null | from arches.app.search.components.base import BaseSearchFilter
from arches.app.search.elasticsearch_dsl_builder import Bool, Terms
details = {
"searchcomponentid": "",
"name": "Provisional Filter",
"icon": "",
"modulename": "provisional_filter.py",
"classname": "ProvisionalFilter",
"type": "",
... | 36.393939 | 115 | 0.692756 | from arches.app.search.components.base import BaseSearchFilter
from arches.app.search.elasticsearch_dsl_builder import Bool, Terms
details = {
"searchcomponentid": "",
"name": "Provisional Filter",
"icon": "",
"modulename": "provisional_filter.py",
"classname": "ProvisionalFilter",
"type": "",
... | true | true |
f753403e2cea8e364d13b91eee268f9f3ff9ddec | 627 | py | Python | airline/manage.py | VToropov1337/django_airline | 295a0f97a65edb0c76a38a5aa903665bf0c01765 | [
"MIT"
] | 7 | 2021-05-15T16:32:00.000Z | 2022-03-31T12:11:35.000Z | airline/manage.py | VToropov1337/django_airline | 295a0f97a65edb0c76a38a5aa903665bf0c01765 | [
"MIT"
] | 1 | 2022-03-10T07:26:37.000Z | 2022-03-10T07:26:37.000Z | airline/manage.py | VToropov1337/django_airline | 295a0f97a65edb0c76a38a5aa903665bf0c01765 | [
"MIT"
] | 30 | 2021-01-25T18:20:38.000Z | 2022-03-23T02:59:41.000Z | #!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'airline.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise Import... | 28.5 | 73 | 0.682616 |
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'airline.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
... | true | true |
f75341101b5d384f9b33707486682d30d676eaa0 | 2,656 | py | Python | python/oneflow/test/modules/test_view.py | grybd/oneflow | 82237ad096a10527591660c09b61444c42917e69 | [
"Apache-2.0"
] | 3,285 | 2020-07-31T05:51:22.000Z | 2022-03-31T15:20:16.000Z | python/oneflow/test/modules/test_view.py | grybd/oneflow | 82237ad096a10527591660c09b61444c42917e69 | [
"Apache-2.0"
] | 2,417 | 2020-07-31T06:28:58.000Z | 2022-03-31T23:04:14.000Z | python/oneflow/test/modules/test_view.py | grybd/oneflow | 82237ad096a10527591660c09b61444c42917e69 | [
"Apache-2.0"
] | 520 | 2020-07-31T05:52:42.000Z | 2022-03-29T02:38:11.000Z | """
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | 29.511111 | 82 | 0.606928 |
import unittest
from collections import OrderedDict
import numpy as np
from test_util import GenArgList
import oneflow as flow
import oneflow.unittest
def _test_view(test_case, device):
x = np.array(
[[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]
).astype(np.float32)
input = fl... | true | true |
f75341f82cb3d29921a99f33a2a83bd7047d1845 | 3,258 | py | Python | Model.py | khaledmohammed/CULaneDetection | 9b756a7f77aa9c371a44165fbbf19307ae6558c2 | [
"MIT"
] | 2 | 2019-11-18T07:00:50.000Z | 2021-05-20T07:06:08.000Z | Model.py | khaledmohammed/CULaneDetection | 9b756a7f77aa9c371a44165fbbf19307ae6558c2 | [
"MIT"
] | null | null | null | Model.py | khaledmohammed/CULaneDetection | 9b756a7f77aa9c371a44165fbbf19307ae6558c2 | [
"MIT"
] | 2 | 2021-05-20T07:06:09.000Z | 2022-02-27T10:33:33.000Z |
from keras.models import Sequential
from keras.layers import Activation, Dropout, UpSampling2D, ZeroPadding2D
from keras.layers import Conv2DTranspose, Conv2D, MaxPooling2D
from keras.layers.normalization import BatchNormalization
from keras import regularizers
def CreateModel(input_shape):
pool_size = (2, 2)
... | 34.659574 | 114 | 0.647023 |
from keras.models import Sequential
from keras.layers import Activation, Dropout, UpSampling2D, ZeroPadding2D
from keras.layers import Conv2DTranspose, Conv2D, MaxPooling2D
from keras.layers.normalization import BatchNormalization
from keras import regularizers
def CreateModel(input_shape):
pool_size = (2, 2)
... | true | true |
f753448eae624c9f1d4258b84a7e61b0a9aef194 | 1,020 | py | Python | wagtailgridder/migrations/0002_auto_20180220_1101.py | wharton/wagtailgridder | cdbe0088d86e60d6cf4cd8cf7c65f0c5bc273b54 | [
"BSD-3-Clause"
] | 61 | 2017-02-08T15:24:44.000Z | 2022-03-23T08:09:36.000Z | wagtailgridder/migrations/0002_auto_20180220_1101.py | wharton/wagtailgridder | cdbe0088d86e60d6cf4cd8cf7c65f0c5bc273b54 | [
"BSD-3-Clause"
] | 11 | 2017-08-06T16:27:10.000Z | 2021-02-14T04:26:05.000Z | wagtailgridder/migrations/0002_auto_20180220_1101.py | wharton/wagtailgridder | cdbe0088d86e60d6cf4cd8cf7c65f0c5bc273b54 | [
"BSD-3-Clause"
] | 13 | 2017-03-24T19:44:33.000Z | 2021-02-12T02:17:44.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-02-20 16:01
from __future__ import unicode_literals
from django.db import migrations
import wagtail.core.fields
class Migration(migrations.Migration):
dependencies = [
("wagtailgridder", "0001_squashed_0012_auto_20170607_1317"),
]
op... | 29.142857 | 98 | 0.588235 |
from __future__ import unicode_literals
from django.db import migrations
import wagtail.core.fields
class Migration(migrations.Migration):
dependencies = [
("wagtailgridder", "0001_squashed_0012_auto_20170607_1317"),
]
operations = [
migrations.AlterField(
model_name="grid... | true | true |
f7534491c0d3a7d187c445afd5f3a0163137d29a | 1,280 | py | Python | py_smart_flies/smart_flies.py | AdamSpannbauer/misc_code_fun | 782b6aa1c6c3b5e881a4745564ca1faeca53d5fd | [
"MIT"
] | 5 | 2018-07-25T12:39:08.000Z | 2018-08-11T13:49:42.000Z | py_smart_flies/smart_flies.py | AdamSpannbauer/misc_code_fun | 782b6aa1c6c3b5e881a4745564ca1faeca53d5fd | [
"MIT"
] | null | null | null | py_smart_flies/smart_flies.py | AdamSpannbauer/misc_code_fun | 782b6aa1c6c3b5e881a4745564ca1faeca53d5fd | [
"MIT"
] | null | null | null | import argparse
from smart_fly_class import SmartFlies
ap = argparse.ArgumentParser()
ap.add_argument('-f', '--nFlies', type=int, default=200, help='Number of flies to create')
ap.add_argument('-o', '--nObstacles', type=int, default=4, help='Number of obstacles')
ap.add_argument('-g', '--nGenerations', type=int, defau... | 51.2 | 105 | 0.619531 | import argparse
from smart_fly_class import SmartFlies
ap = argparse.ArgumentParser()
ap.add_argument('-f', '--nFlies', type=int, default=200, help='Number of flies to create')
ap.add_argument('-o', '--nObstacles', type=int, default=4, help='Number of obstacles')
ap.add_argument('-g', '--nGenerations', type=int, defau... | true | true |
f7534543f2b90054b13a9718ce22d0bcd9ef3abd | 376 | py | Python | src/CsvReader.py | Erikalizth27/project2practice | 1baf4bf5e13b5b4b409b6a5d64c6aa236f09158d | [
"MIT"
] | null | null | null | src/CsvReader.py | Erikalizth27/project2practice | 1baf4bf5e13b5b4b409b6a5d64c6aa236f09158d | [
"MIT"
] | null | null | null | src/CsvReader.py | Erikalizth27/project2practice | 1baf4bf5e13b5b4b409b6a5d64c6aa236f09158d | [
"MIT"
] | null | null | null | import csv
def ClassFactory(class_name, dictionary):
return type(class_name, (object,), dictionary)
class CsvReader:
data = []
def __init__(self, filepath):
self.data.clear()
with open(filepath) as text_data:
csv_data = csv.DictReader(text_data, delimiter=',')
fo... | 23.5 | 63 | 0.619681 | import csv
def ClassFactory(class_name, dictionary):
return type(class_name, (object,), dictionary)
class CsvReader:
data = []
def __init__(self, filepath):
self.data.clear()
with open(filepath) as text_data:
csv_data = csv.DictReader(text_data, delimiter=',')
fo... | true | true |
f7534612b85e852053ca70bf7eae09d88b0cc773 | 10,418 | py | Python | SEES_CODE/hybrid_placement.py | papanisaicharan/Scalable-energy-efficient-scheme-on-mobile-nodes | 43f8d9c82b603c33803ee5d07f056eaeabdaf530 | [
"MIT"
] | 1 | 2019-04-07T03:36:10.000Z | 2019-04-07T03:36:10.000Z | SEES_CODE/hybrid_placement.py | papanisaicharan/Major-Project | 43f8d9c82b603c33803ee5d07f056eaeabdaf530 | [
"MIT"
] | null | null | null | SEES_CODE/hybrid_placement.py | papanisaicharan/Major-Project | 43f8d9c82b603c33803ee5d07f056eaeabdaf530 | [
"MIT"
] | 1 | 2020-02-08T05:21:37.000Z | 2020-02-08T05:21:37.000Z | """
This is a hybrid placement algorithm(offline mode)
"""
from sympy.solvers import solve
from sympy import Symbol
#this is testing plot
from matplotlib import pyplot as plt
from matplotlib.ticker import MultipleLocator
import numpy as np
import math
import random
import Node as nd
import EH_relay as ... | 31.098507 | 110 | 0.601555 |
from sympy.solvers import solve
from sympy import Symbol
from matplotlib import pyplot as plt
from matplotlib.ticker import MultipleLocator
import numpy as np
import math
import random
import Node as nd
import EH_relay as relay_nd
import LBS as L_B_S
import Zone as zone
import Network as nw
def getpoin... | true | true |
f753462e400f9fe8744a1815859819ad15ed0741 | 12,466 | py | Python | strategies/vyacheslav_signalbuy_VolScan.py | jthhk/Binance-volatility-trading-bot | d815716d2161c5d07cea0506049d73450bd5ef5b | [
"MIT"
] | 4 | 2021-11-10T11:47:39.000Z | 2022-02-03T07:07:37.000Z | strategies/vyacheslav_signalbuy_VolScan.py | jthhk/Binance-volatility-trading-bot | d815716d2161c5d07cea0506049d73450bd5ef5b | [
"MIT"
] | 1 | 2021-11-10T03:52:25.000Z | 2021-11-11T07:00:18.000Z | strategies/vyacheslav_signalbuy_VolScan.py | jthhk/Binance-volatility-trading-bot | d815716d2161c5d07cea0506049d73450bd5ef5b | [
"MIT"
] | 1 | 2022-01-14T13:03:56.000Z | 2022-01-14T13:03:56.000Z | # VolScan is a Binance Volatility Bot(BVT Bot)
# compatible module that generates crypto buying signals based upon negative price change & volatility.
# It does this in two different ways,
# the main one being by calculating the aggregate price change within a user defined period,
# the second way being by use of the C... | 46.514925 | 120 | 0.66902 |
import os
import numpy as np
from time import sleep
from datetime import datetime
from binance.client import Client
from helpers.parameters import parse_args, load_config
from helpers.handle_creds import (
load_correct_creds
)
args = parse_args()
DEFAULT_CONFIG_FILE = 'c... | true | true |
f7534670d85b577a161a1b22f813beb55a6cff0a | 506 | py | Python | src/fidalgo/azext_fidalgo/vendored_sdks/fidalgo/_version.py | tbyfield/azure-cli-extensions | e7e5f37fdcea3afb5c4aecb61fa72eac72c2128e | [
"MIT"
] | null | null | null | src/fidalgo/azext_fidalgo/vendored_sdks/fidalgo/_version.py | tbyfield/azure-cli-extensions | e7e5f37fdcea3afb5c4aecb61fa72eac72c2128e | [
"MIT"
] | null | null | null | src/fidalgo/azext_fidalgo/vendored_sdks/fidalgo/_version.py | tbyfield/azure-cli-extensions | e7e5f37fdcea3afb5c4aecb61fa72eac72c2128e | [
"MIT"
] | 1 | 2022-02-14T21:43:29.000Z | 2022-02-14T21:43:29.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.6 | 94 | 0.543478 |
VERSION = "2021-06-01-privatepreview"
| true | true |
f75348bae679f8b1170f53bcf2ccbdb72b438872 | 7,388 | py | Python | staffing/staffing/report/employee_timesheet/employee_timesheet.py | exvas/staffing | 98812d5bb326d5b01274c6edf9e10eff142410c2 | [
"MIT"
] | null | null | null | staffing/staffing/report/employee_timesheet/employee_timesheet.py | exvas/staffing | 98812d5bb326d5b01274c6edf9e10eff142410c2 | [
"MIT"
] | null | null | null | staffing/staffing/report/employee_timesheet/employee_timesheet.py | exvas/staffing | 98812d5bb326d5b01274c6edf9e10eff142410c2 | [
"MIT"
] | null | null | null | # Copyright (c) 2013, jan and contributors
# For license information, please see license.txt
import frappe
from frappe.utils import money_in_words
from calendar import monthrange
def get_columns(filters):
columns = [
# {"label": "SL#","fieldname": "sl_number", "fieldtype": "Data", "width": "50"},
... | 49.583893 | 171 | 0.599756 |
import frappe
from frappe.utils import money_in_words
from calendar import monthrange
def get_columns(filters):
columns = [
{"label": "Iqama No", "fieldname": "employee", "fieldtype": "Data", "width": "100"},
{"label": "Reference Details", "fieldname": "charge_type", "fieldtype": "Data"... | true | true |
f75349b5b63d5e2881b4b8bbe6a8ab98a9fbeb31 | 594 | py | Python | src/portals/customer/urls.py | IkramKhan-DevOps/cw-dj-eventmanagement | 29985447e1a62cdb7d961f7629ced6869210dc99 | [
"MIT"
] | 1 | 2021-12-27T10:49:52.000Z | 2021-12-27T10:49:52.000Z | src/portals/customer/urls.py | IkramKhan-DevOps/cw-dj-eventmanagement | 29985447e1a62cdb7d961f7629ced6869210dc99 | [
"MIT"
] | null | null | null | src/portals/customer/urls.py | IkramKhan-DevOps/cw-dj-eventmanagement | 29985447e1a62cdb7d961f7629ced6869210dc99 | [
"MIT"
] | null | null | null | from django.urls import path
from django.views.generic import TemplateView
from .views import (
EventsListView, EventDetailView, EventCreateView, EventDeleteView, DashboardView
)
app_name = "customer-portal"
urlpatterns = [
path('dashboard', DashboardView.as_view(), name='dashboard'),
path('event/', Event... | 34.941176 | 84 | 0.718855 | from django.urls import path
from django.views.generic import TemplateView
from .views import (
EventsListView, EventDetailView, EventCreateView, EventDeleteView, DashboardView
)
app_name = "customer-portal"
urlpatterns = [
path('dashboard', DashboardView.as_view(), name='dashboard'),
path('event/', Event... | true | true |
f75349c20b075bd84d6541b1ffe488faa4ec453f | 4,484 | py | Python | lib/surface/compute/project_info/set_default_service_account.py | google-cloud-sdk-unofficial/google-cloud-sdk | 2a48a04df14be46c8745050f98768e30474a1aac | [
"Apache-2.0"
] | 2 | 2019-11-10T09:17:07.000Z | 2019-12-18T13:44:08.000Z | lib/surface/compute/project_info/set_default_service_account.py | google-cloud-sdk-unofficial/google-cloud-sdk | 2a48a04df14be46c8745050f98768e30474a1aac | [
"Apache-2.0"
] | null | null | null | lib/surface/compute/project_info/set_default_service_account.py | google-cloud-sdk-unofficial/google-cloud-sdk | 2a48a04df14be46c8745050f98768e30474a1aac | [
"Apache-2.0"
] | 1 | 2020-07-25T01:40:19.000Z | 2020-07-25T01:40:19.000Z | # -*- coding: utf-8 -*- #
# Copyright 2016 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | 37.680672 | 80 | 0.730375 |
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.compute import base_classes
from googlecloudsdk.calliope import base
from googlecloudsdk.calliope import exceptions
from googlecloudsdk.core import properties
@base... | true | true |
f75349e713804b08e8aeac53186a96a8036ad114 | 662 | py | Python | src/data/475.py | NULLCT/LOMC | 79a16474a8f21310e0fb47e536d527dd5dc6d655 | [
"MIT"
] | null | null | null | src/data/475.py | NULLCT/LOMC | 79a16474a8f21310e0fb47e536d527dd5dc6d655 | [
"MIT"
] | null | null | null | src/data/475.py | NULLCT/LOMC | 79a16474a8f21310e0fb47e536d527dd5dc6d655 | [
"MIT"
] | null | null | null | n, q = map(int, input().split())
adj = [[] for _ in range(n)]
for _ in range(n - 1):
a, b = map(int, input().split())
adj[a - 1].append(b - 1)
adj[b - 1].append(a - 1)
c = [0] * q
d = [0] * q
for i in range(q):
c[i], d[i] = map(int, input().split())
c[i] -= 1
d[i] -= 1
from collections import d... | 19.470588 | 42 | 0.460725 | n, q = map(int, input().split())
adj = [[] for _ in range(n)]
for _ in range(n - 1):
a, b = map(int, input().split())
adj[a - 1].append(b - 1)
adj[b - 1].append(a - 1)
c = [0] * q
d = [0] * q
for i in range(q):
c[i], d[i] = map(int, input().split())
c[i] -= 1
d[i] -= 1
from collections import d... | true | true |
f7534a50fcac6d0f8c8844f6bcaa9af2f4d717ee | 2,219 | py | Python | models/randomforest.py | chrishwiggins/pepperon.ai | 8df7c41463939c6358c0a60b8189f378c2c1df72 | [
"MIT"
] | null | null | null | models/randomforest.py | chrishwiggins/pepperon.ai | 8df7c41463939c6358c0a60b8189f378c2c1df72 | [
"MIT"
] | null | null | null | models/randomforest.py | chrishwiggins/pepperon.ai | 8df7c41463939c6358c0a60b8189f378c2c1df72 | [
"MIT"
] | null | null | null | """
A Random forest model
"""
__author__ = "Jon Wiggins"
from decisiontree import *
import pandas as pd
import operator
class RandomForest:
"""
A Random forest model
"""
def __init__(self):
self.forest = []
self.target_label = None
def train(
self,
... | 29.586667 | 87 | 0.571429 | __author__ = "Jon Wiggins"
from decisiontree import *
import pandas as pd
import operator
class RandomForest:
def __init__(self):
self.forest = []
self.target_label = None
def train(
self,
examples,
target_label,
depth_budget=1,
tree... | true | true |
f7534c8cd70b6098ea7d5a92904007791df06586 | 1,707 | py | Python | tests/modules/seq2seq_encoders/gated_cnn_encoder_test.py | MSLars/allennlp | 2cdb8742c8c8c3c38ace4bdfadbdc750a1aa2475 | [
"Apache-2.0"
] | 11,433 | 2017-06-27T03:08:46.000Z | 2022-03-31T18:14:33.000Z | tests/modules/seq2seq_encoders/gated_cnn_encoder_test.py | MSLars/allennlp | 2cdb8742c8c8c3c38ace4bdfadbdc750a1aa2475 | [
"Apache-2.0"
] | 4,006 | 2017-06-26T21:45:43.000Z | 2022-03-31T02:11:10.000Z | tests/modules/seq2seq_encoders/gated_cnn_encoder_test.py | MSLars/allennlp | 2cdb8742c8c8c3c38ace4bdfadbdc750a1aa2475 | [
"Apache-2.0"
] | 2,560 | 2017-06-26T21:16:53.000Z | 2022-03-30T07:55:46.000Z | import torch
from allennlp.common.testing import AllenNlpTestCase
from allennlp.modules.seq2seq_encoders.gated_cnn_encoder import GatedCnnEncoder
class TestGatedCnnEncoder(AllenNlpTestCase):
def test_gated_cnn_encoder(self):
cnn_encoder = GatedCnnEncoder(
input_dim=32,
layers=[[[4... | 33.470588 | 89 | 0.565319 | import torch
from allennlp.common.testing import AllenNlpTestCase
from allennlp.modules.seq2seq_encoders.gated_cnn_encoder import GatedCnnEncoder
class TestGatedCnnEncoder(AllenNlpTestCase):
def test_gated_cnn_encoder(self):
cnn_encoder = GatedCnnEncoder(
input_dim=32,
layers=[[[4... | true | true |
f7535088ae1d4391c878358529b73d6509e87284 | 805 | py | Python | nmostesting/suites/IS0601Test.py | maxwalter79/nmos-testing | 15a4918adb65a9127fe60fdb4350b73931ece48b | [
"Apache-2.0"
] | 25 | 2018-12-20T16:38:44.000Z | 2021-12-21T08:13:52.000Z | nmostesting/suites/IS0601Test.py | maxwalter79/nmos-testing | 15a4918adb65a9127fe60fdb4350b73931ece48b | [
"Apache-2.0"
] | 409 | 2018-12-19T17:00:27.000Z | 2022-03-30T14:11:45.000Z | nmostesting/suites/IS0601Test.py | maxwalter79/nmos-testing | 15a4918adb65a9127fe60fdb4350b73931ece48b | [
"Apache-2.0"
] | 38 | 2018-12-21T08:50:24.000Z | 2022-02-16T09:10:13.000Z | # Copyright (C) 2018 British Broadcasting Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 33.541667 | 75 | 0.718012 |
from ..GenericTest import GenericTest
class IS0601Test(GenericTest):
def __init__(self, apis):
GenericTest.__init__(self, apis)
| true | true |
f75351773efa20b8f15389d8a1be1e9efb9e8143 | 3,156 | py | Python | chainer/functions/math/minmax.py | fukuta0614/Chainer | 337fe78e1c27924c1195b8b677a9b2cd3ea68828 | [
"MIT"
] | null | null | null | chainer/functions/math/minmax.py | fukuta0614/Chainer | 337fe78e1c27924c1195b8b677a9b2cd3ea68828 | [
"MIT"
] | 1 | 2016-11-09T06:32:32.000Z | 2016-11-09T10:20:04.000Z | chainer/functions/math/minmax.py | fukuta0614/Chainer | 337fe78e1c27924c1195b8b677a9b2cd3ea68828 | [
"MIT"
] | null | null | null | from chainer import cuda
from chainer import function
from chainer.utils import type_check
class SelectorBase(function.Function):
"""Select an array element from a given axis or set of axes."""
def __init__(self, axis=None, keepdims=False):
self.keepdims = keepdims
if axis is None:
... | 29.773585 | 79 | 0.563688 | from chainer import cuda
from chainer import function
from chainer.utils import type_check
class SelectorBase(function.Function):
def __init__(self, axis=None, keepdims=False):
self.keepdims = keepdims
if axis is None:
self.axis = None
elif isinstance(axis, int):
s... | true | true |
f7535199a30c24e865ccc4ae89dd6349346f1ccf | 149 | py | Python | employees_app/employees_app/template_examples/urls_templates.py | LBistrev/python-web-basic | e798d5eb22657a014d3dd0f98e4c3c585336c4fc | [
"MIT"
] | null | null | null | employees_app/employees_app/template_examples/urls_templates.py | LBistrev/python-web-basic | e798d5eb22657a014d3dd0f98e4c3c585336c4fc | [
"MIT"
] | null | null | null | employees_app/employees_app/template_examples/urls_templates.py | LBistrev/python-web-basic | e798d5eb22657a014d3dd0f98e4c3c585336c4fc | [
"MIT"
] | null | null | null | from django.urls import path
from employees_app.template_examples.views import index
urlpatterns = (
path('', index, name='templates index'),
) | 21.285714 | 55 | 0.751678 | from django.urls import path
from employees_app.template_examples.views import index
urlpatterns = (
path('', index, name='templates index'),
) | true | true |
f75351d06dab9a29c74aefca82d6598fd2cec556 | 353 | py | Python | backend/mongodb/initialize-db.py | ThodoriKapouranis/ECE464-Databases-Final-Quizlet | 1231b5a4a683c4dffd354d044dff02100edb9b97 | [
"MIT"
] | null | null | null | backend/mongodb/initialize-db.py | ThodoriKapouranis/ECE464-Databases-Final-Quizlet | 1231b5a4a683c4dffd354d044dff02100edb9b97 | [
"MIT"
] | null | null | null | backend/mongodb/initialize-db.py | ThodoriKapouranis/ECE464-Databases-Final-Quizlet | 1231b5a4a683c4dffd354d044dff02100edb9b97 | [
"MIT"
] | null | null | null | from enum import unique
from flask_pymongo import PyMongo
from pymongo import MongoClient
from settings import MONGO_URI
Client = MongoClient(MONGO_URI)
db = Client["Quizlet"]
users_db = db.users
auths_db = db.auths
decks_db = db.decks
cards_db = db.cards
users_db.create_index(("email"), unique=True)
users_db.create_... | 23.533333 | 48 | 0.790368 | from enum import unique
from flask_pymongo import PyMongo
from pymongo import MongoClient
from settings import MONGO_URI
Client = MongoClient(MONGO_URI)
db = Client["Quizlet"]
users_db = db.users
auths_db = db.auths
decks_db = db.decks
cards_db = db.cards
users_db.create_index(("email"), unique=True)
users_db.create_... | true | true |
f753536b15df71ca169bfe10d61189997161cdb0 | 83 | py | Python | jonze/__init__.py | zeionara/jonze | fe6abb7f81ae23ba1b05a9afef45a2d60a2ce900 | [
"MIT"
] | null | null | null | jonze/__init__.py | zeionara/jonze | fe6abb7f81ae23ba1b05a9afef45a2d60a2ce900 | [
"MIT"
] | null | null | null | jonze/__init__.py | zeionara/jonze | fe6abb7f81ae23ba1b05a9afef45a2d60a2ce900 | [
"MIT"
] | null | null | null | from . import __main__
name = "jonze"
train = __main__.train
test = __main__.test | 13.833333 | 22 | 0.73494 | from . import __main__
name = "jonze"
train = __main__.train
test = __main__.test | true | true |
f75353ba9c7c8463785cea6e7de65f4b806949bc | 2,127 | py | Python | anchore_manager/util/logging.py | Nordix/anchore-engine | f25baa5cbf9aa34d56e56b341a90f577d85e6146 | [
"Apache-2.0"
] | null | null | null | anchore_manager/util/logging.py | Nordix/anchore-engine | f25baa5cbf9aa34d56e56b341a90f577d85e6146 | [
"Apache-2.0"
] | 3 | 2021-07-15T19:58:01.000Z | 2021-09-16T09:39:46.000Z | anchore_manager/util/logging.py | Nordix/anchore-engine | f25baa5cbf9aa34d56e56b341a90f577d85e6146 | [
"Apache-2.0"
] | null | null | null | import json
import sys
from collections import OrderedDict
from anchore_engine.subsys import logger
from anchore_manager.util.proc import ExitCode
from anchore_manager.util.config import DEFAULT_CONFIG
import logging
# Sane default
_log_config = DEFAULT_CONFIG
def format_error_output(config, op, params, payload):
... | 24.170455 | 93 | 0.637047 | import json
import sys
from collections import OrderedDict
from anchore_engine.subsys import logger
from anchore_manager.util.proc import ExitCode
from anchore_manager.util.config import DEFAULT_CONFIG
import logging
_log_config = DEFAULT_CONFIG
def format_error_output(config, op, params, payload):
try:
... | true | true |
f753543130b19ca986ec0330c329be6cc1c73889 | 1,657 | py | Python | mlfromscratch/lda.py | Guangrui-best/ML_from_scratch | afbdfb7046544bd5639a2b73fa4fe711b4c86593 | [
"MIT"
] | 1 | 2021-01-29T02:16:40.000Z | 2021-01-29T02:16:40.000Z | mlfromscratch/lda.py | iliasprc/MLfromscratch | afbdfb7046544bd5639a2b73fa4fe711b4c86593 | [
"MIT"
] | null | null | null | mlfromscratch/lda.py | iliasprc/MLfromscratch | afbdfb7046544bd5639a2b73fa4fe711b4c86593 | [
"MIT"
] | 1 | 2021-08-03T21:17:01.000Z | 2021-08-03T21:17:01.000Z | import numpy as np
class LDA:
def __init__(self, n_components):
self.n_components = n_components
self.linear_discriminants = None
def fit(self, X, y):
n_features = X.shape[1]
class_labels = np.unique(y)
# Within class scatter matrix:
# SW = sum((X_c - mean_X_c... | 33.816327 | 83 | 0.568497 | import numpy as np
class LDA:
def __init__(self, n_components):
self.n_components = n_components
self.linear_discriminants = None
def fit(self, X, y):
n_features = X.shape[1]
class_labels = np.unique(y)
mean_overall = np.mean(X, a... | true | true |
f75356abe88cff2051d9c63cdb8d2416ff2e6c8d | 2,892 | py | Python | teardrops/teardrop_dialog.py | gymb2015/kicad6-nightly-teardrops-fix | 638fcac5636f4f48af5a2153269914c14f70985b | [
"BSD-3-Clause"
] | null | null | null | teardrops/teardrop_dialog.py | gymb2015/kicad6-nightly-teardrops-fix | 638fcac5636f4f48af5a2153269914c14f70985b | [
"BSD-3-Clause"
] | null | null | null | teardrops/teardrop_dialog.py | gymb2015/kicad6-nightly-teardrops-fix | 638fcac5636f4f48af5a2153269914c14f70985b | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# Teardrop for pcbnew using filled zones
# This is the plugin WX dialog
# (c) Niluje 2019 thewireddoesntexist.org
#
# Based on Teardrops for PCBNEW by svofski, 2014 http://sensi.org/~svo
# Cubic Bezier upgrade by mitxela, 2021 mitxela.com
# Fixed fpr KiCAD 6 nightly by Gymb2015 (MISC)
import wx
... | 39.081081 | 138 | 0.618603 |
import wx
import pcbnew
import os
import time
from .teardrop_gui import teardrop_gui
from .td import SetTeardrops, RmTeardrops, __version__
class TeardropDialog(teardrop_gui):
def __init__(self, board):
super(TeardropDialog, self).__init__(None)
self.board = board
self.SetTitle(... | true | true |
f75357021e0bc3d13785b48ec9ae7ac26802445e | 67,883 | py | Python | tests/test_layout.py | Flowdalic/herbstluftwm | a4705f3247eef3ba388daaae04191d805fcb8f91 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | tests/test_layout.py | Flowdalic/herbstluftwm | a4705f3247eef3ba388daaae04191d805fcb8f91 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | tests/test_layout.py | Flowdalic/herbstluftwm | a4705f3247eef3ba388daaae04191d805fcb8f91 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | import pytest
import re
import math
import textwrap
from decimal import Decimal
def normalize_layout_string(layout_string):
"""normalize a layout string such that it is characterwise identical
to the output of the 'dump' command
"""
layout_string = layout_string.replace('\n', ' ')
# drop multiple ... | 38.115104 | 116 | 0.633679 | import pytest
import re
import math
import textwrap
from decimal import Decimal
def normalize_layout_string(layout_string):
layout_string = layout_string.replace('\n', ' ')
layout_string = re.sub(r'[ ]+', ' ', layout_string)
layout_string = re.sub(r'[(] ', r'(', layout_string)
layout_st... | true | true |
f7535737d92a4aa2922fbd1356f95c56dcd17ba6 | 3,768 | py | Python | liked_songs_cleaner.py | sorny/spotify-legacy-liked-songs-cleaner | 321ab6316c9e9be3966852954f54c62097d57ac1 | [
"MIT"
] | 1 | 2020-12-02T19:19:36.000Z | 2020-12-02T19:19:36.000Z | liked_songs_cleaner.py | sorny/spotify-legacy-liked-songs-cleaner | 321ab6316c9e9be3966852954f54c62097d57ac1 | [
"MIT"
] | null | null | null | liked_songs_cleaner.py | sorny/spotify-legacy-liked-songs-cleaner | 321ab6316c9e9be3966852954f54c62097d57ac1 | [
"MIT"
] | null | null | null | import datetime
import math
from time import sleep
import spotipy
from spotipy.oauth2 import SpotifyOAuth
from tqdm import trange, tqdm
# params
# for client id and secret, create a new application over at https://developer.spotify.com/dashboard
# when running this script for the first time, your browser will be redi... | 38.44898 | 118 | 0.657909 | import datetime
import math
from time import sleep
import spotipy
from spotipy.oauth2 import SpotifyOAuth
from tqdm import trange, tqdm
CLIENT_ID = ""
CLIENT_SECRET = ""
REDIRECT_URI = "http://localhost:8888/callback"
DRYRUN = True
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(client_id=CLIENT_ID,
... | true | true |
f753574b12bf81830458483bf4108f8ae9a32ed8 | 459 | py | Python | Curso Python/desafios/venv/Scripts/easy_install-3.7-script.py | marcos-saba/Cursos | 1c063392867e9ed86d141dad8861a2a35488b1c6 | [
"MIT"
] | null | null | null | Curso Python/desafios/venv/Scripts/easy_install-3.7-script.py | marcos-saba/Cursos | 1c063392867e9ed86d141dad8861a2a35488b1c6 | [
"MIT"
] | null | null | null | Curso Python/desafios/venv/Scripts/easy_install-3.7-script.py | marcos-saba/Cursos | 1c063392867e9ed86d141dad8861a2a35488b1c6 | [
"MIT"
] | null | null | null | #!C:\Users\teste\PycharmProjects\desafios\venv\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'setuptools==40.8.0','console_scripts','easy_install-3.7'
__requires__ = 'setuptools==40.8.0'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.py... | 35.307692 | 87 | 0.694989 |
__requires__ = 'setuptools==40.8.0'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(
load_entry_point('setuptools==40.8.0', 'console_scripts', 'easy_install-3.7')()
)
| true | true |
f75357eefa624156960df1b563931bd041b63478 | 3,988 | py | Python | main.py | elcronos/adversarial_genattack | b86b07a938a6aef54a41891fc2de3feeaa8e03aa | [
"MIT"
] | 1 | 2020-03-26T16:30:21.000Z | 2020-03-26T16:30:21.000Z | main.py | elcronos/adversarial_genattack | b86b07a938a6aef54a41891fc2de3feeaa8e03aa | [
"MIT"
] | null | null | null | main.py | elcronos/adversarial_genattack | b86b07a938a6aef54a41891fc2de3feeaa8e03aa | [
"MIT"
] | null | null | null | """
Author: Moustafa Alzantot (malzantot@ucla.edu)
"""
import time
import os
import sys
import random
import numpy as np
import tensorflow as tf
from setup_inception import ImageNet, InceptionModel
import utils
from genattack_tf2 import GenAttack2
flags = tf.app.flags
flags.DEFINE_string('input_dir', '', 'Path f... | 41.113402 | 90 | 0.628134 | import time
import os
import sys
import random
import numpy as np
import tensorflow as tf
from setup_inception import ImageNet, InceptionModel
import utils
from genattack_tf2 import GenAttack2
flags = tf.app.flags
flags.DEFINE_string('input_dir', '', 'Path for input images.')
flags.DEFINE_string('output_dir', 'ou... | true | true |
f753580488527754a4697bba5b514f20b5f16b69 | 6,317 | py | Python | shapenet_train.py | sanowar-raihan/nerf-meta | dbb97431b613acb3dfdc7075344c6e1fd1b6cf51 | [
"MIT"
] | 60 | 2021-05-10T20:06:10.000Z | 2022-02-22T09:25:56.000Z | shapenet_train.py | sanowar-raihan/nerf-meta | dbb97431b613acb3dfdc7075344c6e1fd1b6cf51 | [
"MIT"
] | 3 | 2021-05-21T02:21:47.000Z | 2021-05-27T20:32:00.000Z | shapenet_train.py | sanowar-raihan/nerf-meta | dbb97431b613acb3dfdc7075344c6e1fd1b6cf51 | [
"MIT"
] | 8 | 2021-05-14T01:43:34.000Z | 2022-01-26T22:58:27.000Z | import argparse
import json
import copy
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader
from datasets.shapenet import build_shapenet
from models.nerf import build_nerf
from models.rendering import get_rays_shapenet, sample_points, volume_render
def inner_loop(model, optim, imgs, p... | 39.236025 | 101 | 0.636378 | import argparse
import json
import copy
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader
from datasets.shapenet import build_shapenet
from models.nerf import build_nerf
from models.rendering import get_rays_shapenet, sample_points, volume_render
def inner_loop(model, optim, imgs, p... | true | true |
f75358532f9ef72fc0c618c0ecf81b55e7b2f87a | 784 | py | Python | AsyncioLoop.py | lkeme/py-common-code | 46b645cf6479ee30691466501e9cfb0d6d3bdb8e | [
"MIT"
] | null | null | null | AsyncioLoop.py | lkeme/py-common-code | 46b645cf6479ee30691466501e9cfb0d6d3bdb8e | [
"MIT"
] | null | null | null | AsyncioLoop.py | lkeme/py-common-code | 46b645cf6479ee30691466501e9cfb0d6d3bdb8e | [
"MIT"
] | 2 | 2020-08-14T16:20:19.000Z | 2021-09-07T12:04:41.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
- author: Lkeme
- contact: Useri@live.cn
- file: AsyncioLoop
- time: 2019/9/18 12:54
- desc: 兼容不同系统的协程逻辑
"""
import asyncio
import platform
# 自动判断类型生成loop
def switch_sys_loop():
sys_type = platform.system()
if sys_type == "Windows":
loop = asyncio.Proa... | 17.043478 | 54 | 0.632653 |
import asyncio
import platform
def switch_sys_loop():
sys_type = platform.system()
if sys_type == "Windows":
loop = asyncio.ProactorEventLoop()
asyncio.set_event_loop(loop)
else:
loop = asyncio.get_event_loop()
return loop
async def main_loop(thread):
print(f"当前是第 {t... | true | true |
f75358a33e511ed5e7dc179771d486d3b4ebe4fe | 1,179 | py | Python | deficrawler/mappers.py | evanwimpey/defi-crawler-py | f3ce10bbcd9e822433708efd56e7ee5d371a42b0 | [
"Apache-2.0"
] | 45 | 2021-05-08T03:01:52.000Z | 2022-03-21T05:50:45.000Z | deficrawler/mappers.py | evanwimpey/defi-crawler-py | f3ce10bbcd9e822433708efd56e7ee5d371a42b0 | [
"Apache-2.0"
] | 22 | 2021-04-07T13:52:58.000Z | 2022-03-29T22:01:36.000Z | deficrawler/mappers.py | evanwimpey/defi-crawler-py | f3ce10bbcd9e822433708efd56e7ee5d371a42b0 | [
"Apache-2.0"
] | 15 | 2021-06-25T16:06:15.000Z | 2022-02-23T02:36:54.000Z | from deficrawler.transformer import Transformer
class Mappers:
"""
Class to map the data from the subgraph data to the commom model defined in the json file.
For each field applies the transformaton (if needed) and retuns the entity with all
the fields.
"""
@staticmethod
def map_data(resp... | 33.685714 | 103 | 0.570823 | from deficrawler.transformer import Transformer
class Mappers:
@staticmethod
def map_data(response_data, protocol, chain, version, attributes, transformations, query_elements):
list_elements = []
transformer = Transformer()
for ele in response_data:
element = {}
... | true | true |
f75358fc6aabeb256f1896a60b41ccf503b178b8 | 9,521 | py | Python | thatkitebot/cogs/laser.py | blablabliam/thatkitebot | 741e59993f05eb437b46d4839db517af7b8f0357 | [
"MIT"
] | null | null | null | thatkitebot/cogs/laser.py | blablabliam/thatkitebot | 741e59993f05eb437b46d4839db517af7b8f0357 | [
"MIT"
] | null | null | null | thatkitebot/cogs/laser.py | blablabliam/thatkitebot | 741e59993f05eb437b46d4839db517af7b8f0357 | [
"MIT"
] | null | null | null | # Copyright (c) 2019-2022 ThatRedKite and contributors
from typing import Optional
from discord.ext import commands
from wand.image import Image as WandImage
from wand.color import Color as WandColor
import discord
import si_prefix
from math import sin, atan
from io import BytesIO
from thatkitebot.backend import uti... | 45.555024 | 174 | 0.573469 |
from typing import Optional
from discord.ext import commands
from wand.image import Image as WandImage
from wand.color import Color as WandColor
import discord
import si_prefix
from math import sin, atan
from io import BytesIO
from thatkitebot.backend import util
from thatkitebot.cogs.electronics import parse_input,... | true | true |
f753595819be56b311bde4720b544498a5e852b2 | 36,237 | py | Python | tests/test_sessions.py | ktbarrett/nox | bf1c226de1c14c576537cf81f629571e5015784f | [
"Apache-2.0"
] | 41 | 2016-03-03T11:18:49.000Z | 2018-04-09T09:58:13.000Z | tests/test_sessions.py | ktbarrett/nox | bf1c226de1c14c576537cf81f629571e5015784f | [
"Apache-2.0"
] | 79 | 2016-03-03T17:02:53.000Z | 2018-04-23T16:25:51.000Z | tests/test_sessions.py | ktbarrett/nox | bf1c226de1c14c576537cf81f629571e5015784f | [
"Apache-2.0"
] | 14 | 2016-03-03T18:22:20.000Z | 2018-01-18T15:55:10.000Z | # Copyright 2016 Alethea Katherine Flowers
#
# 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... | 33.459834 | 87 | 0.618015 |
from __future__ import annotations
import argparse
import logging
import operator
import os
import sys
import tempfile
from pathlib import Path
from unittest import mock
import pytest
import nox.command
import nox.manifest
import nox.registry
import nox.sessions
import nox.virtualenv
from nox import _o... | true | true |
f7535960fb59acd3babb450da0f181a1cddbd657 | 1,604 | py | Python | plot/event1/comment_concat.py | cxxixi/Online-opinions-on-weibo | ae4586b8b42d166c9a2386319891a04d390585fb | [
"MIT"
] | null | null | null | plot/event1/comment_concat.py | cxxixi/Online-opinions-on-weibo | ae4586b8b42d166c9a2386319891a04d390585fb | [
"MIT"
] | null | null | null | plot/event1/comment_concat.py | cxxixi/Online-opinions-on-weibo | ae4586b8b42d166c9a2386319891a04d390585fb | [
"MIT"
] | null | null | null | import pandas as pd
csv1 = pd.read_csv('D:\my_documents\competition\government\Report\event1\\500-593.csv',header=None)
csv2 = pd.read_csv('D:\my_documents\competition\government\Report\event1\\comment594.csv',header=None)
csv3 = pd.read_csv('D:\my_documents\competition\government\Report\event1\\comment855.csv',header... | 47.176471 | 123 | 0.775561 | import pandas as pd
csv1 = pd.read_csv('D:\my_documents\competition\government\Report\event1\\500-593.csv',header=None)
csv2 = pd.read_csv('D:\my_documents\competition\government\Report\event1\\comment594.csv',header=None)
csv3 = pd.read_csv('D:\my_documents\competition\government\Report\event1\\comment855.csv',header... | true | true |
f753599e1170bf7481b82c8689e15eee96c841ce | 3,758 | py | Python | examples/custom_pdf_advanced.py | donalrinho/zfit | 9769ef7d56a6be9a5d438e47b80ea5a8f772bc24 | [
"BSD-3-Clause"
] | null | null | null | examples/custom_pdf_advanced.py | donalrinho/zfit | 9769ef7d56a6be9a5d438e47b80ea5a8f772bc24 | [
"BSD-3-Clause"
] | null | null | null | examples/custom_pdf_advanced.py | donalrinho/zfit | 9769ef7d56a6be9a5d438e47b80ea5a8f772bc24 | [
"BSD-3-Clause"
] | null | null | null | # Copyright (c) 2021 zfit
import tensorflow as tf
import zfit
from zfit import z
class CustomPDF2D(zfit.pdf.BasePDF):
"""My custom, 2 dimensional pdf. The axes are: Energy, Momentum.
"""
def __init__(self, param1, param2, param3, obs, name="CustomPDF", ):
# we can now do complicated stuff her... | 37.58 | 117 | 0.659659 |
import tensorflow as tf
import zfit
from zfit import z
class CustomPDF2D(zfit.pdf.BasePDF):
def __init__(self, param1, param2, param3, obs, name="CustomPDF", ):
params = {'super_param': param1,
'param2': param2, 'param3': param3}
super().__init__(obs, para... | true | true |
f7535a967482ed712ca57c6dbc99084b194282e3 | 1,303 | py | Python | aula10.py | lucasalcantarap/Exercicios-de-python | f8fb4ced327785e8835c1c588db13806ebdc501c | [
"MIT"
] | null | null | null | aula10.py | lucasalcantarap/Exercicios-de-python | f8fb4ced327785e8835c1c588db13806ebdc501c | [
"MIT"
] | null | null | null | aula10.py | lucasalcantarap/Exercicios-de-python | f8fb4ced327785e8835c1c588db13806ebdc501c | [
"MIT"
] | null | null | null | from datetime import date, time, datetime, timedelta
def trabalhando_com_datetime():
data_atual = datetime.now()
print(data_atual)
print(data_atual.strftime('%d/%m/%Y %H:%M:%S'))
print(data_atual.strftime('%c'))
print(data_atual.weekday())
tupla = ('Segunda','Terça','Quarta','Quinta','Sexta','S... | 34.289474 | 76 | 0.671527 | from datetime import date, time, datetime, timedelta
def trabalhando_com_datetime():
data_atual = datetime.now()
print(data_atual)
print(data_atual.strftime('%d/%m/%Y %H:%M:%S'))
print(data_atual.strftime('%c'))
print(data_atual.weekday())
tupla = ('Segunda','Terça','Quarta','Quinta','Sexta','S... | true | true |
f7535a9bab9b0b5dda4a0280f796dcbc2be6a6ce | 375 | py | Python | pyopenproject/business/services/principal_service_impl.py | webu/pyopenproject | 40b2cb9fe0fa3f89bc0fe2a3be323422d9ecf966 | [
"MIT"
] | 5 | 2021-02-25T15:54:28.000Z | 2021-04-22T15:43:36.000Z | pyopenproject/business/services/principal_service_impl.py | webu/pyopenproject | 40b2cb9fe0fa3f89bc0fe2a3be323422d9ecf966 | [
"MIT"
] | 7 | 2021-03-15T16:26:23.000Z | 2022-03-16T13:45:18.000Z | pyopenproject/business/services/principal_service_impl.py | webu/pyopenproject | 40b2cb9fe0fa3f89bc0fe2a3be323422d9ecf966 | [
"MIT"
] | 6 | 2021-06-18T18:59:11.000Z | 2022-03-27T04:58:52.000Z | from pyopenproject.business.principal_service import PrincipalService
from pyopenproject.business.services.command.principal.find_all import FindAll
class PrincipalServiceImpl(PrincipalService):
def __init__(self, connection):
super().__init__(connection)
def find_all(self, filters=None):
re... | 31.25 | 78 | 0.784 | from pyopenproject.business.principal_service import PrincipalService
from pyopenproject.business.services.command.principal.find_all import FindAll
class PrincipalServiceImpl(PrincipalService):
def __init__(self, connection):
super().__init__(connection)
def find_all(self, filters=None):
re... | true | true |
f7535b6fbed2015b43ec751e360fbd1be594f976 | 96 | py | Python | src/lol_scrapers/utils/dataclasses/icon.py | Melzak252/lol_scrapers | c083b766a970ad61bda68102a66d3a6303dda93d | [
"MIT"
] | null | null | null | src/lol_scrapers/utils/dataclasses/icon.py | Melzak252/lol_scrapers | c083b766a970ad61bda68102a66d3a6303dda93d | [
"MIT"
] | null | null | null | src/lol_scrapers/utils/dataclasses/icon.py | Melzak252/lol_scrapers | c083b766a970ad61bda68102a66d3a6303dda93d | [
"MIT"
] | null | null | null | from dataclasses import dataclass
@dataclass
class Icon:
name: str = ""
src: str = ""
| 12 | 33 | 0.635417 | from dataclasses import dataclass
@dataclass
class Icon:
name: str = ""
src: str = ""
| true | true |
f7535b924f88f1139f10a564c52c326017f206c4 | 1,599 | py | Python | signalGenerator.py | drinkdhmo/optimal_pid | 3996237878140be3b486f130a7bd0364a545e1b8 | [
"MIT"
] | 2 | 2019-02-11T22:28:20.000Z | 2019-02-15T19:15:25.000Z | signalGenerator.py | drinkdhmo/optimal_pid | 3996237878140be3b486f130a7bd0364a545e1b8 | [
"MIT"
] | null | null | null | signalGenerator.py | drinkdhmo/optimal_pid | 3996237878140be3b486f130a7bd0364a545e1b8 | [
"MIT"
] | null | null | null | import autograd.numpy as np
class signalGenerator:
'''
This class inherits the Signal class. It is used to organize
1 or more signals of different types: square_wave,
sawtooth_wave, triangle_wave, random_wave.
'''
def __init__(self, amplitude=1, frequency=1, y_offset=0):
'''... | 33.3125 | 93 | 0.597248 | import autograd.numpy as np
class signalGenerator:
def __init__(self, amplitude=1, frequency=1, y_offset=0):
self.amplitude = amplitude
self.frequency = frequency
self.y_offset = y_offset
def square(self, tt):
if tt % (1.0/self.frequency) <= 0.5/self.frequency:
out ... | true | true |
f7535bcdbea9202e8836ba01d4b983fddaabc683 | 331 | py | Python | lonely-lemmings/earlyinternet/gifapp/migrations/0011_remove_comment_parent_id.py | Vthechamp22/summer-code-jam-2021 | 0a8bf1f22f6c73300891fd779da36efd8e1304c1 | [
"MIT"
] | 40 | 2020-08-02T07:38:22.000Z | 2021-07-26T01:46:50.000Z | lonely-lemmings/earlyinternet/gifapp/migrations/0011_remove_comment_parent_id.py | Vthechamp22/summer-code-jam-2021 | 0a8bf1f22f6c73300891fd779da36efd8e1304c1 | [
"MIT"
] | 134 | 2020-07-31T12:15:45.000Z | 2020-12-13T04:42:19.000Z | lonely-lemmings/earlyinternet/gifapp/migrations/0011_remove_comment_parent_id.py | Vthechamp22/summer-code-jam-2021 | 0a8bf1f22f6c73300891fd779da36efd8e1304c1 | [
"MIT"
] | 101 | 2020-07-31T12:00:47.000Z | 2021-11-01T09:06:58.000Z | # Generated by Django 3.0.9 on 2020-08-09 15:38
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('gifapp', '0010_auto_20200809_0123'),
]
operations = [
migrations.RemoveField(
model_name='comment',
name='parent_id',
... | 18.388889 | 47 | 0.595166 |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('gifapp', '0010_auto_20200809_0123'),
]
operations = [
migrations.RemoveField(
model_name='comment',
name='parent_id',
),
]
| true | true |
f7535c3284adf1ad2c56bbbf7322c76f9e2aef2c | 4,156 | py | Python | Jupyter/UDO_Free/RP/test_start.py | jiaojiao1234/RISE | fd85aa6e475534a74faab5c4644c63dc0c01d236 | [
"Apache-2.0"
] | 1 | 2021-12-28T14:04:03.000Z | 2021-12-28T14:04:03.000Z | Jupyter/UDO_Free/RP/test_start.py | jiaojiao1234/RISE | fd85aa6e475534a74faab5c4644c63dc0c01d236 | [
"Apache-2.0"
] | null | null | null | Jupyter/UDO_Free/RP/test_start.py | jiaojiao1234/RISE | fd85aa6e475534a74faab5c4644c63dc0c01d236 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 8 22:09:47 2021
@author: Apple
"""
def start():
import numpy as np
import scipy.io as sio
import sklearn.ensemble
from sklearn import svm
from sklearn.model_selection import StratifiedKFold
from sklearn.metrics import confusion_matrix
from skl... | 41.56 | 126 | 0.652551 |
def start():
import numpy as np
import scipy.io as sio
import sklearn.ensemble
from sklearn import svm
from sklearn.model_selection import StratifiedKFold
from sklearn.metrics import confusion_matrix
from sklearn import preprocessing
import joblib
from sklearn import neighbors
f... | true | true |
f7535c55629a1e0351597dbb080d31e620fed70c | 75 | py | Python | BinaryHeapPriorityQueue/__init__.py | aayushuppal/PyUtils | 6bdfae91417fd6da76953db24efc97cc29e1152b | [
"MIT"
] | null | null | null | BinaryHeapPriorityQueue/__init__.py | aayushuppal/PyUtils | 6bdfae91417fd6da76953db24efc97cc29e1152b | [
"MIT"
] | null | null | null | BinaryHeapPriorityQueue/__init__.py | aayushuppal/PyUtils | 6bdfae91417fd6da76953db24efc97cc29e1152b | [
"MIT"
] | null | null | null | from BinaryHeapPriorityQueue.binary_heap_pq import BinaryHeapPriorityQueue
| 37.5 | 74 | 0.933333 | from BinaryHeapPriorityQueue.binary_heap_pq import BinaryHeapPriorityQueue
| true | true |
f7535c6f32b43eb8ff07c0d7fa26accc5adb3569 | 517 | py | Python | mlib/requests/orgs/info.py | tmunzer/Mist_library | 5d44325dc5b59483d9d6803f31fe1568762b04ca | [
"MIT"
] | 13 | 2020-04-21T21:11:56.000Z | 2021-07-15T21:42:41.000Z | mlib/requests/orgs/info.py | tmunzer/mist_library | 812828a6486f59850a12dda4f81dbfd76929ed6b | [
"MIT"
] | null | null | null | mlib/requests/orgs/info.py | tmunzer/mist_library | 812828a6486f59850a12dda4f81dbfd76929ed6b | [
"MIT"
] | 2 | 2020-06-18T20:07:51.000Z | 2020-08-13T16:43:32.000Z | def get(mist_session, org_id):
uri = "/api/v1/orgs/%s" % org_id
resp = mist_session.mist_get(uri, org_id=org_id)
return resp
def create(mist_session, org_id, org_settings):
uri = "/api/v1/orgs/%s" % org_id
body = org_settings
resp = mist_session.mist_post(uri, org_id=org_id, body=body)
retu... | 32.3125 | 64 | 0.686654 | def get(mist_session, org_id):
uri = "/api/v1/orgs/%s" % org_id
resp = mist_session.mist_get(uri, org_id=org_id)
return resp
def create(mist_session, org_id, org_settings):
uri = "/api/v1/orgs/%s" % org_id
body = org_settings
resp = mist_session.mist_post(uri, org_id=org_id, body=body)
retu... | true | true |
f7535ca6002cdf08b92ba0fa02054e8afbd5dafa | 1,307 | py | Python | plugin/popup.py | jfcherng/Sublime-OpenUriInBrowser | 7a1898e0e0a8d8ebb4085bbcbe578729dcf161c5 | [
"MIT"
] | 10 | 2020-09-17T12:57:21.000Z | 2022-03-24T14:43:59.000Z | plugin/popup.py | jfcherng/Sublime-OpenUriInBrowser | 7a1898e0e0a8d8ebb4085bbcbe578729dcf161c5 | [
"MIT"
] | 5 | 2020-06-14T13:25:08.000Z | 2022-02-23T06:59:58.000Z | plugin/popup.py | jfcherng/Sublime-OpenUriInBrowser | 7a1898e0e0a8d8ebb4085bbcbe578729dcf161c5 | [
"MIT"
] | 1 | 2021-03-30T14:44:43.000Z | 2021-03-30T14:44:43.000Z | from .functions import open_uri_with_browser
from .image_processing import get_colored_image_base64_by_region
from .settings import get_setting
from .shared import global_get
from .types import ImageDict
import sublime
POPUP_TEMPLATE = """
<body id="open-uri-popup">
<style>
img {{
width: {w}{si... | 29.044444 | 85 | 0.671767 | from .functions import open_uri_with_browser
from .image_processing import get_colored_image_base64_by_region
from .settings import get_setting
from .shared import global_get
from .types import ImageDict
import sublime
POPUP_TEMPLATE = """
<body id="open-uri-popup">
<style>
img {{
width: {w}{si... | true | true |
f7535cdf25003b24b1d8a24847210a5c68b3d15b | 14,737 | py | Python | pyvidesk/model.py | MuriloScarpaSitonio/pyvidesk | 0d2366db0899b0ab7425d09f306b4f6d4722f843 | [
"MIT"
] | 2 | 2020-10-17T22:49:30.000Z | 2021-08-05T23:09:27.000Z | pyvidesk/model.py | MuriloScarpaSitonio/pyvidesk | 0d2366db0899b0ab7425d09f306b4f6d4722f843 | [
"MIT"
] | 2 | 2020-11-23T18:09:14.000Z | 2020-11-24T16:37:25.000Z | pyvidesk/model.py | MuriloScarpaSitonio/pyvidesk | 0d2366db0899b0ab7425d09f306b4f6d4722f843 | [
"MIT"
] | 5 | 2020-10-14T17:08:59.000Z | 2022-03-04T12:55:14.000Z | """
Módulo que representa um ticket, uma pessoa ou um serviço.
Não deve ser usado diretamente, mas obtido no retorno de algum método
da classe Entity ou Query.
Exemplo de uso:
>>> from pyvidesk.tickets import Tickets
>>> tickets = Tickets(token="my_token")
>>> ticket = ticket.get_by_id(3)
>>> print(ticket)
... <Mod... | 33.266366 | 98 | 0.574744 |
from .exceptions import (
PyvideskCannotSetReadOnlyProperty,
PyvideskPropertyNotValidError,
PyvideskPropertyWithWrongType,
PyvideskSaveWithoutIdError,
)
from .properties import ComplexProperty
class Model:
__is_complex__ = False
def __init__(self, entity, name_=None, **properties):
... | true | true |
f7535d72a2c4aa902b295ede8e6d47c8f5acc5a6 | 957 | py | Python | Examples/LoadOptionsByDocumentType/Pdf/ConvertPdfAndRemoveEmbeddedFiles.py | groupdocs-conversion-cloud/groupdocs-conversion-cloud-python-samples- | 18e8eb850c3ef392a3ba310d08cc40299f9ffb3c | [
"MIT"
] | null | null | null | Examples/LoadOptionsByDocumentType/Pdf/ConvertPdfAndRemoveEmbeddedFiles.py | groupdocs-conversion-cloud/groupdocs-conversion-cloud-python-samples- | 18e8eb850c3ef392a3ba310d08cc40299f9ffb3c | [
"MIT"
] | null | null | null | Examples/LoadOptionsByDocumentType/Pdf/ConvertPdfAndRemoveEmbeddedFiles.py | groupdocs-conversion-cloud/groupdocs-conversion-cloud-python-samples- | 18e8eb850c3ef392a3ba310d08cc40299f9ffb3c | [
"MIT"
] | 1 | 2019-05-09T13:07:21.000Z | 2019-05-09T13:07:21.000Z | # Import modules
import groupdocs_conversion_cloud
from Common import Common
# This example demonstrates how to convert pdf document to word processing with advanced options
class ConvertPdfAndRemoveEmbeddedFiles:
@classmethod
def Run(cls):
# Create necessary API instances
apiInstance = group... | 35.444444 | 106 | 0.728318 |
import groupdocs_conversion_cloud
from Common import Common
class ConvertPdfAndRemoveEmbeddedFiles:
@classmethod
def Run(cls):
apiInstance = groupdocs_conversion_cloud.ConvertApi.from_config(Common.GetConfig())
settings = groupdocs_conversion_cloud.ConvertSettings... | true | true |
f7535e34b2522c959fa4e713cd91b6756b9e5e46 | 1,218 | py | Python | NUTS2.0/nuts/testhandling/GUI/ToggledFrame.py | EkoGuandor229/Network-Unit-Testing | cc486ec4e705db71ccc79a96427a134276776b20 | [
"Apache-2.0"
] | 1 | 2020-10-09T09:42:10.000Z | 2020-10-09T09:42:10.000Z | NUTS2.0/nuts/testhandling/GUI/ToggledFrame.py | EkoGuandor229/Network-Unit-Testing | cc486ec4e705db71ccc79a96427a134276776b20 | [
"Apache-2.0"
] | 14 | 2020-02-24T15:22:00.000Z | 2021-12-13T20:41:12.000Z | NUTS2.0/nuts/testhandling/GUI/ToggledFrame.py | EkoGuandor229/Network-Unit-Testing | cc486ec4e705db71ccc79a96427a134276776b20 | [
"Apache-2.0"
] | null | null | null | import tkinter as tk
from tkinter import ttk
class ToggledFrame(tk.Frame):
"""
The ToggledFrame Class creates a expandable box for the grouping of tests
since this is not possible in TK inter
"""
def __init__(self, parent, text="", *args, **options):
tk.Frame.__init__(self, parent, *args,... | 32.918919 | 102 | 0.600164 | import tkinter as tk
from tkinter import ttk
class ToggledFrame(tk.Frame):
def __init__(self, parent, text="", *args, **options):
tk.Frame.__init__(self, parent, *args, **options)
self.show = tk.IntVar()
self.show.set(0)
self.title_frame = ttk.Frame(self)
self.title_fram... | true | true |
f753610fd3f637b2d6a217ae01b69e6d95888a9f | 19,030 | py | Python | src/sage/rings/polynomial/polynomial_singular_interface.py | bopopescu/sage | 2d495be78e0bdc7a0a635454290b27bb4f5f70f0 | [
"BSL-1.0"
] | 3 | 2019-07-15T13:48:24.000Z | 2019-11-08T12:31:43.000Z | src/sage/rings/polynomial/polynomial_singular_interface.py | bopopescu/sage | 2d495be78e0bdc7a0a635454290b27bb4f5f70f0 | [
"BSL-1.0"
] | 2 | 2018-10-30T13:40:20.000Z | 2020-07-23T12:13:30.000Z | src/sage/rings/polynomial/polynomial_singular_interface.py | bopopescu/sage | 2d495be78e0bdc7a0a635454290b27bb4f5f70f0 | [
"BSL-1.0"
] | 1 | 2019-06-02T03:16:55.000Z | 2019-06-02T03:16:55.000Z | """
Polynomial Interfaces to Singular
AUTHORS:
- Martin Albrecht <malb@informatik.uni-bremen.de> (2006-04-21)
- Robert Bradshaw: Re-factor to avoid multiple inheritance vs. Cython (2007-09)
- Syed Ahmad Lavasani: Added function field to _singular_init_ (2011-12-16)
Added non-prime finite fields to _singular_in... | 38.995902 | 184 | 0.570415 | nField(base_ring) and (base_ring.base_ring() is ZZ or base_ring.base_ring().is_prime_field() or is_FiniteField(base_ring.base_ring())):
if base_ring.ngens()==1:
gens = str(base_ring.gen())
else:
gens = str(base_ring.gens())
if not (not base_ring.base_ring... | true | true |
f753619465c1a2574cd3bf7679340d1d1f5ead93 | 1,187 | py | Python | core/middleware.py | uktrade/directory-api | 45a9024a7ecc2842895201cbb51420ba9e57a168 | [
"MIT"
] | 2 | 2017-06-02T09:09:08.000Z | 2021-01-18T10:26:53.000Z | core/middleware.py | uktrade/directory-api | 45a9024a7ecc2842895201cbb51420ba9e57a168 | [
"MIT"
] | 629 | 2016-10-10T09:35:52.000Z | 2022-03-25T15:04:04.000Z | core/middleware.py | uktrade/directory-api | 45a9024a7ecc2842895201cbb51420ba9e57a168 | [
"MIT"
] | 5 | 2017-06-22T10:02:22.000Z | 2022-03-14T17:55:21.000Z | import sigauth.middleware
from django.conf import settings
from django.http import HttpResponse
from django.utils.deprecation import MiddlewareMixin
class SignatureCheckMiddleware(sigauth.middleware.SignatureCheckMiddlewareBase):
secret = settings.SIGNATURE_SECRET
def should_check(self, request):
if ... | 40.931034 | 107 | 0.725358 | import sigauth.middleware
from django.conf import settings
from django.http import HttpResponse
from django.utils.deprecation import MiddlewareMixin
class SignatureCheckMiddleware(sigauth.middleware.SignatureCheckMiddlewareBase):
secret = settings.SIGNATURE_SECRET
def should_check(self, request):
if ... | true | true |
f75362c7260646fc7ff3562f2867ded66f977f6c | 267 | py | Python | chained_comparison.py | KenMwaura1/python-hacks | 13b22d92178fb0e6cae0b1eeca3a9e4aea3e420b | [
"Apache-2.0"
] | 2 | 2020-08-13T00:00:52.000Z | 2020-08-13T01:05:27.000Z | chained_comparison.py | KenMwaura1/python-hacks | 13b22d92178fb0e6cae0b1eeca3a9e4aea3e420b | [
"Apache-2.0"
] | null | null | null | chained_comparison.py | KenMwaura1/python-hacks | 13b22d92178fb0e6cae0b1eeca3a9e4aea3e420b | [
"Apache-2.0"
] | 1 | 2021-05-02T12:43:06.000Z | 2021-05-02T12:43:06.000Z | # Chained comparison between 3 variables
x = 4
# returns a bool(true or false) depending on what the condition evaluates to
print(1 < x < 11) # True
print(7 < x < 14) # False
print(8 < x * 8 < 64) # True
print(9 > x <= 6) # True
print(4 == x > 2) # True
| 29.666667 | 77 | 0.606742 |
x = 4
print(1 < x < 11)
print(7 < x < 14)
print(8 < x * 8 < 64)
print(9 > x <= 6)
print(4 == x > 2)
| true | true |
f75363459044901c1d7a40c5e7aa3edcbe5b250a | 585 | py | Python | landings/migrations/0001_initial.py | enoren5/Django-caesar | 26a1367d7933cd3fd763e9b4a2c85a6a1fc40e9c | [
"MIT"
] | null | null | null | landings/migrations/0001_initial.py | enoren5/Django-caesar | 26a1367d7933cd3fd763e9b4a2c85a6a1fc40e9c | [
"MIT"
] | null | null | null | landings/migrations/0001_initial.py | enoren5/Django-caesar | 26a1367d7933cd3fd763e9b4a2c85a6a1fc40e9c | [
"MIT"
] | null | null | null | # Generated by Django 3.1.5 on 2021-01-28 12:14
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Post',
fields=[
('id', models.AutoField(aut... | 24.375 | 114 | 0.553846 |
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Post',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=Fal... | true | true |
f753639d9191974b142ea033aac643cb2aeba54c | 5,234 | py | Python | CheckMachine.py | jb1anc0/automating-aws-migration-with-cloudendure-scripts | b3b793a9026aa5a22371dff0c5a938ce3039e13e | [
"MIT-0"
] | null | null | null | CheckMachine.py | jb1anc0/automating-aws-migration-with-cloudendure-scripts | b3b793a9026aa5a22371dff0c5a938ce3039e13e | [
"MIT-0"
] | null | null | null | CheckMachine.py | jb1anc0/automating-aws-migration-with-cloudendure-scripts | b3b793a9026aa5a22371dff0c5a938ce3039e13e | [
"MIT-0"
] | null | null | null | # Copyright 2008-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to... | 52.868687 | 118 | 0.559037 |
from __future__ import print_function
import sys
import requests
import json
import yaml
import os
import datetime
def status(cloud_endure, project_id, launchtype, dryrun):
config = cloud_endure.config
HOST = cloud_endure.host
endpoint = cloud_endure.endpoint
headers = cloud_endure.head... | true | true |
f7536416d2a639c851a4c580b09cbd6bf75ecf2c | 837 | py | Python | src/olympia/devhub/permissions.py | covariant/addons-server | 41e6ee9e426facb19a1e1ca8d40277cb6f94a7da | [
"BSD-3-Clause"
] | 843 | 2016-02-09T13:00:37.000Z | 2022-03-20T19:17:06.000Z | src/olympia/devhub/permissions.py | covariant/addons-server | 41e6ee9e426facb19a1e1ca8d40277cb6f94a7da | [
"BSD-3-Clause"
] | 10,187 | 2016-02-05T23:51:05.000Z | 2022-03-31T15:24:44.000Z | src/olympia/devhub/permissions.py | covariant/addons-server | 41e6ee9e426facb19a1e1ca8d40277cb6f94a7da | [
"BSD-3-Clause"
] | 551 | 2016-02-08T20:32:16.000Z | 2022-03-15T16:49:24.000Z | from rest_framework.permissions import BasePermission
from olympia.addons.utils import RestrictionChecker
class IsSubmissionAllowedFor(BasePermission):
"""
Like is_submission_allowed_for_request, but in Permission form for use in
the API. If the client is disallowed, a message property specifiying the
... | 34.875 | 77 | 0.724014 | from rest_framework.permissions import BasePermission
from olympia.addons.utils import RestrictionChecker
class IsSubmissionAllowedFor(BasePermission):
def has_permission(self, request, view):
checker = RestrictionChecker(request=request)
if not checker.is_submission_allowed():
self.... | true | true |
f753645e8a4281453a74dfac5eb98935c2eac341 | 1,768 | py | Python | mcrouter/test/test_service_info.py | kiaplayer/mcrouter | c54233f1cd57dc9f541bdbff7ff485775ff289fc | [
"MIT"
] | 2,205 | 2015-01-03T02:56:53.000Z | 2022-03-31T09:24:08.000Z | mcrouter/test/test_service_info.py | kiaplayer/mcrouter | c54233f1cd57dc9f541bdbff7ff485775ff289fc | [
"MIT"
] | 327 | 2015-01-07T00:59:57.000Z | 2022-03-31T16:03:58.000Z | mcrouter/test/test_service_info.py | kiaplayer/mcrouter | c54233f1cd57dc9f541bdbff7ff485775ff289fc | [
"MIT"
] | 479 | 2015-01-07T02:06:42.000Z | 2022-03-24T11:44:31.000Z | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from mcrouter.test.MCProcess import Memcached
from mcrouter.test.McrouterTestCase import McrouterTestCase
class TestS... | 36.833333 | 74 | 0.657805 |
from mcrouter.test.MCProcess import Memcached
from mcrouter.test.McrouterTestCase import McrouterTestCase
class TestServiceInfo(McrouterTestCase):
config = './mcrouter/test/test_service_info.json'
def setUp(self):
self.mc1 = self.add_server(Memcached())
self.mc2 = self.add_server(Memcac... | true | true |
f7536565085203b75500dd2da901ba148e4e85bf | 1,368 | py | Python | bsm/cmd/pkg_edit.py | bsmsoft/bsm | e45ec5442de39e5f948023cd5b4c6181073cf9a2 | [
"MIT"
] | 3 | 2019-06-12T17:19:12.000Z | 2022-01-07T02:10:06.000Z | bsm/cmd/pkg_edit.py | bsmsoft/bsm | e45ec5442de39e5f948023cd5b4c6181073cf9a2 | [
"MIT"
] | null | null | null | bsm/cmd/pkg_edit.py | bsmsoft/bsm | e45ec5442de39e5f948023cd5b4c6181073cf9a2 | [
"MIT"
] | null | null | null | import os
import subprocess
from bsm.util import which
from bsm.cmd import CmdResult
from bsm.cmd import CmdError
from bsm.cmd.pkg_base import PkgBase
from bsm.logger import get_logger
_logger = get_logger()
DEFAULT_EDITOR = ['vim', 'vi']
def _detect_editor(editors):
for editor in editors:
if which(edi... | 27.918367 | 131 | 0.660819 | import os
import subprocess
from bsm.util import which
from bsm.cmd import CmdResult
from bsm.cmd import CmdError
from bsm.cmd.pkg_base import PkgBase
from bsm.logger import get_logger
_logger = get_logger()
DEFAULT_EDITOR = ['vim', 'vi']
def _detect_editor(editors):
for editor in editors:
if which(edi... | true | true |
f75366664dbe635847af22322afd8ac229029a80 | 1,993 | py | Python | ipyannotator/navi_widget.py | AlexJoz/ipyannotator | 99f7b0633f96ab5b97b536ab4f7a767834b51055 | [
"Apache-2.0"
] | null | null | null | ipyannotator/navi_widget.py | AlexJoz/ipyannotator | 99f7b0633f96ab5b97b536ab4f7a767834b51055 | [
"Apache-2.0"
] | 7 | 2020-12-31T16:10:40.000Z | 2022-03-02T17:07:37.000Z | ipyannotator/navi_widget.py | AlexJoz/ipyannotator | 99f7b0633f96ab5b97b536ab4f7a767834b51055 | [
"Apache-2.0"
] | null | null | null | # AUTOGENERATED! DO NOT EDIT! File to edit: nbs/02_navi_widget.ipynb (unless otherwise specified).
__all__ = ['NaviGUI', 'NaviLogic', 'Navi']
# Cell
from ipywidgets import (AppLayout, Button, IntSlider,
HBox, Output,
Layout, Label)
from traitlets import Int, observe, li... | 31.634921 | 109 | 0.61716 |
__all__ = ['NaviGUI', 'NaviLogic', 'Navi']
from ipywidgets import (AppLayout, Button, IntSlider,
HBox, Output,
Layout, Label)
from traitlets import Int, observe, link, HasTraits
class NaviGUI(HBox):
max_im_number = Int(0)
def __init__(self):
self._... | true | true |
f75367481d585e1a2493076a7e7c394220fcc790 | 1,998 | py | Python | google-cloud-sdk/lib/googlecloudsdk/third_party/apis/cloudiot/v1beta1/resources.py | bopopescu/searchparty | afdc2805cb1b77bd5ac9fdd1a76217f4841f0ea6 | [
"Apache-2.0"
] | null | null | null | google-cloud-sdk/lib/googlecloudsdk/third_party/apis/cloudiot/v1beta1/resources.py | bopopescu/searchparty | afdc2805cb1b77bd5ac9fdd1a76217f4841f0ea6 | [
"Apache-2.0"
] | null | null | null | google-cloud-sdk/lib/googlecloudsdk/third_party/apis/cloudiot/v1beta1/resources.py | bopopescu/searchparty | afdc2805cb1b77bd5ac9fdd1a76217f4841f0ea6 | [
"Apache-2.0"
] | 3 | 2017-07-27T18:44:13.000Z | 2020-07-25T17:48:53.000Z | # Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | 31.21875 | 74 | 0.671672 |
import enum
BASE_URL = 'https://cloudiot.googleapis.com/v1beta1/'
class Collections(enum.Enum):
PROJECTS_LOCATIONS = (
'projects.locations',
'projects/{projectsId}/locations/{locationsId}',
{},
['projectsId', 'locationsId']
)
PROJECTS_LOCATIONS_REGISTRIES = (
'proj... | true | true |
f753674fa10806cf6a8ed9112222d99a4065f459 | 40,809 | py | Python | sympy/physics/vector/frame.py | czgdp1807/sympy | e9ff10450f6a777e9812f89d9fe7473397706924 | [
"BSD-3-Clause"
] | null | null | null | sympy/physics/vector/frame.py | czgdp1807/sympy | e9ff10450f6a777e9812f89d9fe7473397706924 | [
"BSD-3-Clause"
] | null | null | null | sympy/physics/vector/frame.py | czgdp1807/sympy | e9ff10450f6a777e9812f89d9fe7473397706924 | [
"BSD-3-Clause"
] | 1 | 2020-02-06T17:54:20.000Z | 2020-02-06T17:54:20.000Z | from sympy.core.backend import (diff, expand, sin, cos, sympify,
eye, symbols, ImmutableMatrix as Matrix, MatrixBase)
from sympy import (trigsimp, solve, Symbol, Dummy)
from sympy.core.compatibility import range
from sympy.physics.vector.vector import Vector, _check_vector
from sympy.utilities.misc i... | 38.535411 | 115 | 0.535054 | from sympy.core.backend import (diff, expand, sin, cos, sympify,
eye, symbols, ImmutableMatrix as Matrix, MatrixBase)
from sympy import (trigsimp, solve, Symbol, Dummy)
from sympy.core.compatibility import range
from sympy.physics.vector.vector import Vector, _check_vector
from sympy.utilities.misc i... | true | true |
f75368d18665286ecb7bebc484ae140c79c61ffb | 2,029 | py | Python | services/county_service.py | joelpsteadman/bankruptcy | 1a6c9ed2202f6839e334b946787ed2e32d653647 | [
"MIT"
] | 1 | 2020-06-15T19:37:14.000Z | 2020-06-15T19:37:14.000Z | services/county_service.py | joelpsteadman/bankruptcy | 1a6c9ed2202f6839e334b946787ed2e32d653647 | [
"MIT"
] | null | null | null | services/county_service.py | joelpsteadman/bankruptcy | 1a6c9ed2202f6839e334b946787ed2e32d653647 | [
"MIT"
] | null | null | null | import csv
from models.County import *
def get_county_data(filepath, year):
dictionary_of_counties = dict()
with open(filepath) as csvfile:
file_reader = csv.reader(csvfile)
row = []
while not row: # skip blank rows at the beginning
row = next(file_reader)
try:
... | 39.019231 | 93 | 0.421883 | import csv
from models.County import *
def get_county_data(filepath, year):
dictionary_of_counties = dict()
with open(filepath) as csvfile:
file_reader = csv.reader(csvfile)
row = []
while not row:
row = next(file_reader)
try:
while True:
... | true | true |
f75368d83677981be9838ff28e05b0c1e2c18401 | 2,973 | py | Python | sample_project/main.py | amirfru/eparams | 382eefda15a5720f45435b31d07fa04406058c3e | [
"Unlicense"
] | 4 | 2021-12-29T20:57:48.000Z | 2022-01-06T15:44:34.000Z | sample_project/main.py | amirfru/eparams | 382eefda15a5720f45435b31d07fa04406058c3e | [
"Unlicense"
] | null | null | null | sample_project/main.py | amirfru/eparams | 382eefda15a5720f45435b31d07fa04406058c3e | [
"Unlicense"
] | 1 | 2021-12-29T20:53:00.000Z | 2021-12-29T20:53:00.000Z | import argparse
from datetime import datetime
import git
import eparams
import eparams.constraints as cc
from eparams import eloader
_repo = git.Repo(__file__, search_parent_directories=True)
@eparams.params(frozen=True) # frozen means this cannot be changed easily
class Version:
time = datetime.now()
git... | 35.392857 | 118 | 0.659603 | import argparse
from datetime import datetime
import git
import eparams
import eparams.constraints as cc
from eparams import eloader
_repo = git.Repo(__file__, search_parent_directories=True)
@eparams.params(frozen=True)
class Version:
time = datetime.now()
git_hash = _repo.head.commit.hexsha
git_bra... | true | true |
f75368ee0276afd04dc9f8797bb94d82e402f5fc | 5,107 | py | Python | rock_c3.py | DREAMS-lab/mask_rcnn_pytorch | 1fcc8489758aa4673c29a32a2413f7f86742414f | [
"Apache-2.0"
] | 3 | 2020-06-09T07:01:19.000Z | 2021-09-01T12:20:25.000Z | rock_c3.py | DREAMS-lab/mask_rcnn_pytorch | 1fcc8489758aa4673c29a32a2413f7f86742414f | [
"Apache-2.0"
] | 1 | 2020-12-29T03:21:06.000Z | 2020-12-29T03:21:06.000Z | rock_c3.py | DREAMS-lab/mask_rcnn_pytorch | 1fcc8489758aa4673c29a32a2413f7f86742414f | [
"Apache-2.0"
] | null | null | null | """
rock.py
Zhiang Chen, Feb 2020
data class for mask rcnn
"""
import os
import numpy as np
import torch
from PIL import Image
import pickle
import matplotlib.pyplot as plt
"""
./datasets/
Rock/
data/
0_8.npy
0_9.npy
1_4.npy
...
"""
class Dataset(object):
... | 31.91875 | 87 | 0.54768 |
import os
import numpy as np
import torch
from PIL import Image
import pickle
import matplotlib.pyplot as plt
class Dataset(object):
def __init__(self, data_path, transforms=None, input_channel=6, include_name=True):
self.data_path = data_path
self.transforms = transforms
self.data_files ... | true | true |
f75369582837b000711508efcde4a79ae6b1963d | 12,244 | py | Python | tests/components/test_influxdb.py | mbs-technologie/home-assistant | 71fc446425cbb1c0d4670c261ce8ea3bfd83a73d | [
"MIT"
] | 13 | 2017-02-01T13:25:34.000Z | 2022-01-26T01:30:39.000Z | tests/components/test_influxdb.py | 1Forward1Back/home-assistant | ce24ef0c20dea0fd671d6f2c2a8b1456b4b66ba6 | [
"MIT"
] | 9 | 2017-07-26T18:05:32.000Z | 2021-12-05T14:16:34.000Z | tests/components/test_influxdb.py | 1Forward1Back/home-assistant | ce24ef0c20dea0fd671d6f2c2a8b1456b4b66ba6 | [
"MIT"
] | 21 | 2017-07-26T17:09:40.000Z | 2022-03-27T22:37:22.000Z | """The tests for the InfluxDB component."""
import unittest
from unittest import mock
import influxdb as influx_client
from homeassistant.bootstrap import setup_component
import homeassistant.components.influxdb as influxdb
from homeassistant.const import EVENT_STATE_CHANGED, STATE_OFF, STATE_ON
from tests.common im... | 35.387283 | 79 | 0.501225 | import unittest
from unittest import mock
import influxdb as influx_client
from homeassistant.bootstrap import setup_component
import homeassistant.components.influxdb as influxdb
from homeassistant.const import EVENT_STATE_CHANGED, STATE_OFF, STATE_ON
from tests.common import get_test_home_assistant
@mock.patch('... | true | true |
f75369e561862014f62842c95958fdc550336441 | 8,843 | py | Python | site/mezzanine_old/core/views.py | aldenjenkins/ThiccGaming | 4790d2568b019438d1569d0fe4e9f9aba008b737 | [
"BSD-3-Clause"
] | null | null | null | site/mezzanine_old/core/views.py | aldenjenkins/ThiccGaming | 4790d2568b019438d1569d0fe4e9f9aba008b737 | [
"BSD-3-Clause"
] | 9 | 2020-03-24T16:20:31.000Z | 2022-03-11T23:32:38.000Z | site/mezzanine_old/core/views.py | aldenjenkins/ThiccGaming | 4790d2568b019438d1569d0fe4e9f9aba008b737 | [
"BSD-3-Clause"
] | null | null | null | from __future__ import absolute_import, unicode_literals
from future.builtins import int, open, str
import os
import mimetypes
from json import dumps
from django.template.response import TemplateResponse
try:
from urllib.parse import urljoin, urlparse
except ImportError:
from urlparse import urljoin, urlpar... | 37.629787 | 79 | 0.674771 | from __future__ import absolute_import, unicode_literals
from future.builtins import int, open, str
import os
import mimetypes
from json import dumps
from django.template.response import TemplateResponse
try:
from urllib.parse import urljoin, urlparse
except ImportError:
from urlparse import urljoin, urlpar... | true | true |
f7536a3ae4412031b54f06d5066d0d789ddbcd7f | 1,636 | py | Python | Widen/LC841_keys_and_rooms.py | crazywiden/Leetcode_daily_submit | 15637e260ab547022ac0c828dd196337bd8d50a3 | [
"MIT"
] | null | null | null | Widen/LC841_keys_and_rooms.py | crazywiden/Leetcode_daily_submit | 15637e260ab547022ac0c828dd196337bd8d50a3 | [
"MIT"
] | null | null | null | Widen/LC841_keys_and_rooms.py | crazywiden/Leetcode_daily_submit | 15637e260ab547022ac0c828dd196337bd8d50a3 | [
"MIT"
] | null | null | null | """
LC 841 -- keys and rooms
There are N rooms and you start in room 0. Each room has a distinct number in 0, 1, 2, ..., N-1, and each room may have some keys to access the next room.
Formally, each room i has a list of keys rooms[i], and each key rooms[i][j] is an integer in [0, 1, ..., N-1] where N = rooms.length.... | 35.565217 | 186 | 0.647922 |
class Solution:
def canVisitAllRooms(self, rooms: List[List[int]]) -> bool:
key_set = rooms[0]
visited_room = {0}
while len(key_set) != 0 and len(visited_room)!=len(rooms):
new_key = key_set.pop()
if new_key in visited_room:
continue
ke... | true | true |
f7536afe6d1a55cee3a1c092d2c7992e55e0b572 | 2,928 | py | Python | tests/providers/oracle/transfers/test_oracle_to_oracle.py | gtossou/airflow | 0314a3a218f864f78ec260cc66134e7acae34bc5 | [
"Apache-2.0"
] | 2 | 2020-10-23T18:55:03.000Z | 2021-07-13T04:45:49.000Z | tests/providers/oracle/transfers/test_oracle_to_oracle.py | gtossou/airflow | 0314a3a218f864f78ec260cc66134e7acae34bc5 | [
"Apache-2.0"
] | 10 | 2021-09-08T21:27:07.000Z | 2022-03-30T17:54:45.000Z | tests/providers/oracle/transfers/test_oracle_to_oracle.py | gtossou/airflow | 0314a3a218f864f78ec260cc66134e7acae34bc5 | [
"Apache-2.0"
] | 2 | 2020-10-23T18:55:05.000Z | 2022-02-16T21:53:10.000Z | #
# 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... | 40.109589 | 104 | 0.706284 |
import unittest
from unittest import mock
from unittest.mock import MagicMock
from airflow.providers.oracle.transfers.oracle_to_oracle import OracleToOracleOperator
class TestOracleToOracleTransfer(unittest.TestCase):
@staticmethod
def test_execute():
oracle_destination_conn_id = '... | true | true |
f7536b652b43516a10e1094d2d078b0a3d840c86 | 31,366 | py | Python | tests/unit/deploy/test_appgraph.py | Chen188/chalice | 293350669e4b870cd1d156f9afc0c2eefd6c24b0 | [
"Apache-2.0"
] | 6,240 | 2017-07-31T22:56:40.000Z | 2022-03-31T17:29:45.000Z | tests/unit/deploy/test_appgraph.py | Chen188/chalice | 293350669e4b870cd1d156f9afc0c2eefd6c24b0 | [
"Apache-2.0"
] | 1,337 | 2017-07-31T22:27:10.000Z | 2022-03-31T16:04:49.000Z | tests/unit/deploy/test_appgraph.py | Chen188/chalice | 293350669e4b870cd1d156f9afc0c2eefd6c24b0 | [
"Apache-2.0"
] | 845 | 2017-08-01T10:28:07.000Z | 2022-03-26T08:26:44.000Z | import pytest
from chalice.app import Chalice
from chalice.config import Config
from chalice.constants import LAMBDA_TRUST_POLICY
from chalice.deploy import models
from chalice.deploy.appgraph import ApplicationGraphBuilder, ChaliceBuildError
from chalice.deploy.deployer import BuildStage, PolicyGenerator
from chalice... | 45.001435 | 79 | 0.620289 | import pytest
from chalice.app import Chalice
from chalice.config import Config
from chalice.constants import LAMBDA_TRUST_POLICY
from chalice.deploy import models
from chalice.deploy.appgraph import ApplicationGraphBuilder, ChaliceBuildError
from chalice.deploy.deployer import BuildStage, PolicyGenerator
from chalice... | true | true |
f7536bb2d3832d7738bbd18df5bf1e3c6a515670 | 636 | py | Python | proxies/proxy_pool.py | azraeljack/Image-Scrapper | e8ec70063a65a78832eb0118da1799d8767569c8 | [
"MIT"
] | null | null | null | proxies/proxy_pool.py | azraeljack/Image-Scrapper | e8ec70063a65a78832eb0118da1799d8767569c8 | [
"MIT"
] | null | null | null | proxies/proxy_pool.py | azraeljack/Image-Scrapper | e8ec70063a65a78832eb0118da1799d8767569c8 | [
"MIT"
] | null | null | null | from logging_module import Logger
from random import randint
class ProxyPool(object):
def __init__(self, *proxies):
self.logger = Logger.get_logger()
self.proxies = []
for proxy in proxies:
self.add_proxy(proxy)
def add_proxy(self, proxy):
if proxy.is_alive():
... | 25.44 | 76 | 0.627358 | from logging_module import Logger
from random import randint
class ProxyPool(object):
def __init__(self, *proxies):
self.logger = Logger.get_logger()
self.proxies = []
for proxy in proxies:
self.add_proxy(proxy)
def add_proxy(self, proxy):
if proxy.is_alive():
... | true | true |
f7536d2195a919b200662bb77d8397b3aee95a6c | 12,700 | py | Python | configs/example/se.py | charitha22/gem5 | d7e2fb6744edbd26ce678058463fcd2a00a23b51 | [
"BSD-3-Clause"
] | null | null | null | configs/example/se.py | charitha22/gem5 | d7e2fb6744edbd26ce678058463fcd2a00a23b51 | [
"BSD-3-Clause"
] | null | null | null | configs/example/se.py | charitha22/gem5 | d7e2fb6744edbd26ce678058463fcd2a00a23b51 | [
"BSD-3-Clause"
] | null | null | null | # Copyright (c) 2012-2013 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functiona... | 35.277778 | 79 | 0.671732 |
from __future__ import print_function
from __future__ import absolute_import
import optparse
import sys
import os
import m5
from m5.defines import buildEnv
from m5.objects import *
from m5.util import addToPath, fatal, warn
addToPath('../')
from ruby import Ruby
from com... | true | true |
f7536e1a1d8e286591b858b7b3197fafa8dcb391 | 1,568 | py | Python | datafactory/fields/pickout.py | righ/datafactory | 8299df4e29472381ccfe91535fdecf8e97a46d32 | [
"Apache-2.0"
] | 2 | 2015-07-09T08:49:32.000Z | 2015-09-04T13:43:40.000Z | datafactory/fields/pickout.py | righ/datafactory | 8299df4e29472381ccfe91535fdecf8e97a46d32 | [
"Apache-2.0"
] | 1 | 2020-06-06T13:12:39.000Z | 2020-06-06T13:12:39.000Z | datafactory/fields/pickout.py | righ/datafactory | 8299df4e29472381ccfe91535fdecf8e97a46d32 | [
"Apache-2.0"
] | 1 | 2020-11-06T08:11:51.000Z | 2020-11-06T08:11:51.000Z | # coding: utf-8
from random import randint
from .base import BaseField
from ..api import display, special
class PickoutField(BaseField):
"""select an element randomly from the limited-choices."""
def __init__(self, choices, missing=None, callback=None):
"""PickoutField constructor
:param li... | 32 | 93 | 0.61926 |
from random import randint
from .base import BaseField
from ..api import display, special
class PickoutField(BaseField):
def __init__(self, choices, missing=None, callback=None):
if isinstance(choices, dict):
self._choices = []
for value, num in choices.items():
... | true | true |
f75370170b04c80ceb8e86078d26d8c894d12cd4 | 16,409 | py | Python | tests/test_schemas.py | Raja27/rfw | 18b4131ff4a67ae900c1b38672f2fbee72dacc31 | [
"BSD-2-Clause"
] | 1 | 2017-03-28T15:31:28.000Z | 2017-03-28T15:31:28.000Z | tests/test_schemas.py | Raja27/rfw | 18b4131ff4a67ae900c1b38672f2fbee72dacc31 | [
"BSD-2-Clause"
] | 1 | 2021-02-24T04:38:23.000Z | 2021-02-24T04:38:23.000Z | tests/test_schemas.py | Raja27/rfw | 18b4131ff4a67ae900c1b38672f2fbee72dacc31 | [
"BSD-2-Clause"
] | 4 | 2018-09-25T04:05:54.000Z | 2021-02-05T05:03:26.000Z | import unittest
from django.conf.urls import include, url
from django.core.exceptions import PermissionDenied
from django.http import Http404
from django.test import TestCase, override_settings
from rest_framework import filters, pagination, permissions, serializers
from rest_framework.compat import coreapi, coresche... | 39.539759 | 192 | 0.520934 | import unittest
from django.conf.urls import include, url
from django.core.exceptions import PermissionDenied
from django.http import Http404
from django.test import TestCase, override_settings
from rest_framework import filters, pagination, permissions, serializers
from rest_framework.compat import coreapi, coresche... | true | true |
f753710d92e12733d0414d7e85c2dc4e9f72e2ca | 5,514 | py | Python | contrib/seeds/makeseeds.py | AirWireOfficial/wire-core | e47155b31c4a67a493f4457dc1dfb7871b315e3b | [
"MIT"
] | 7 | 2018-10-04T10:46:23.000Z | 2019-09-14T08:04:12.000Z | contrib/seeds/makeseeds.py | AirWire-Platform/Wire | a39dc9e6d0424f0ced8d80af3ec17257b216b97c | [
"MIT"
] | 8 | 2018-10-05T17:00:31.000Z | 2019-02-03T12:01:06.000Z | contrib/seeds/makeseeds.py | AirWire-Platform/Wire | a39dc9e6d0424f0ced8d80af3ec17257b216b97c | [
"MIT"
] | 6 | 2018-10-04T02:11:07.000Z | 2019-05-26T19:15:47.000Z | #!/usr/bin/env python3
# Copyright (c) 2013-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Generate seeds.txt from Pieter's DNS seeder
#
NSEEDS=512
MAX_SEEDS_PER_ASN=2
MIN_BLOCKS = 615801
#... | 32.05814 | 186 | 0.566921 |
#
NSEEDS=512
MAX_SEEDS_PER_ASN=2
MIN_BLOCKS = 615801
# These are hosts that have been observed to be behaving strangely (e.g.
# aggressively connecting to every node).
SUSPICIOUS_HOSTS = {
""
}
import re
import sys
import dns.resolver
import collections
PATTERN_IPV4 = re.compile(r"^((\d{1,3})\.(\d{1,3})... | true | true |
f753717d3923cbbe689d18db8d9e178d6206043b | 23,228 | py | Python | keras/engine/sequential.py | shantanusharma/keras | 662f6c5bb82b54d90ec8e863ac7a44c3b8c1b938 | [
"Apache-2.0"
] | 3 | 2021-03-15T05:32:36.000Z | 2021-12-14T07:29:53.000Z | keras/engine/sequential.py | bluemap19/keras | 662f6c5bb82b54d90ec8e863ac7a44c3b8c1b938 | [
"Apache-2.0"
] | 1 | 2021-03-01T13:50:34.000Z | 2021-03-01T13:50:34.000Z | keras/engine/sequential.py | bluemap19/keras | 662f6c5bb82b54d90ec8e863ac7a44c3b8c1b938 | [
"Apache-2.0"
] | null | null | null | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 40.466899 | 99 | 0.666136 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow.compat.v2 as tf
import copy
import warnings
from keras import layers as layer_module
from keras.engine import base_layer
from keras.engine import functional
from keras.engine i... | true | true |
f75371c0f7408e9378de0bbf152b020459d51355 | 13,228 | py | Python | utils.py | mehdijj/ppd | 9e7626a47886d9d2016873d722f97a930e96540d | [
"MIT"
] | null | null | null | utils.py | mehdijj/ppd | 9e7626a47886d9d2016873d722f97a930e96540d | [
"MIT"
] | null | null | null | utils.py | mehdijj/ppd | 9e7626a47886d9d2016873d722f97a930e96540d | [
"MIT"
] | null | null | null | import numpy as np
import Augmentor
import os
def _permute_index(l, seed):
"""
Creates a permutation of np.array([0, ..., l-1]) and its inverse
:param l: length of the array to permute
:param seed: permutation seed
:return: (s, s_inverse) where s is permutation of np.array([0, ..., l-1])... | 43.656766 | 138 | 0.668506 | import numpy as np
import Augmentor
import os
def _permute_index(l, seed):
st0 = np.random.get_state()
s = np.arange(l)
np.random.seed(seed)
np.random.shuffle(s)
s_inverse = np.argsort(s)
np.random.set_state(st0)
return s, s_inverse
def permute(data, seed):
nb_images,... | true | true |
f75372aba442429950912c56bd695772cba25c53 | 1,758 | py | Python | tests/test_plot.py | HERA-Team/vis_cpu | 32de2318efd6690e4a8c6c64aad5eae6f429b10a | [
"MIT"
] | null | null | null | tests/test_plot.py | HERA-Team/vis_cpu | 32de2318efd6690e4a8c6c64aad5eae6f429b10a | [
"MIT"
] | 39 | 2021-05-12T23:22:02.000Z | 2022-03-18T16:54:48.000Z | tests/test_plot.py | HERA-Team/vis_cpu | 32de2318efd6690e4a8c6c64aad5eae6f429b10a | [
"MIT"
] | 2 | 2021-06-01T09:31:10.000Z | 2021-07-29T16:57:59.000Z | """Compare vis_cpu with pyuvsim visibilities."""
import numpy as np
from pyuvsim.analyticbeam import AnalyticBeam
from vis_cpu import conversions, plot
nsource = 10
def test_source_az_za_beam():
"""Test function that calculates the Az and ZA positions of sources."""
# Observation latitude and LST
hera_l... | 27.904762 | 75 | 0.65529 | import numpy as np
from pyuvsim.analyticbeam import AnalyticBeam
from vis_cpu import conversions, plot
nsource = 10
def test_source_az_za_beam():
hera_lat = -30.7215
lst = 0.78
ra = np.random.uniform(low=0.0, high=360.0, size=nsource - 1)
dec = -30.72 + np.random.random(nsource - 1) * 10.... | true | true |
f75372b7fb749647de3395a45c79fcf1de61fe86 | 25,537 | py | Python | bilby/gw/source.py | LBJ-Wade/bilby | b1e02f1dfae03d4939cae9c95eff300c22919689 | [
"MIT"
] | 31 | 2019-02-28T00:48:23.000Z | 2022-03-29T09:41:28.000Z | bilby/gw/source.py | LBJ-Wade/bilby | b1e02f1dfae03d4939cae9c95eff300c22919689 | [
"MIT"
] | 8 | 2018-12-27T09:15:03.000Z | 2022-03-28T19:02:10.000Z | bilby/gw/source.py | LBJ-Wade/bilby | b1e02f1dfae03d4939cae9c95eff300c22919689 | [
"MIT"
] | 32 | 2018-11-30T00:58:53.000Z | 2022-03-29T09:41:30.000Z | import numpy as np
from ..core import utils
from ..core.utils import logger
from .conversion import bilby_to_lalsimulation_spins
from .utils import (lalsim_GetApproximantFromString,
lalsim_SimInspiralFD,
lalsim_SimInspiralChooseFDWaveform,
lalsim_SimInspiralW... | 40.27918 | 98 | 0.676469 | import numpy as np
from ..core import utils
from ..core.utils import logger
from .conversion import bilby_to_lalsimulation_spins
from .utils import (lalsim_GetApproximantFromString,
lalsim_SimInspiralFD,
lalsim_SimInspiralChooseFDWaveform,
lalsim_SimInspiralW... | true | true |
f7537665e792c1503279c4a7f8925a55ab9e0231 | 6,449 | py | Python | test/functional/feature_maxuploadtarget.py | Perbug/perbug | 4fa48d19be465006cdcaf9e6c09d394309aa2bf9 | [
"MIT"
] | 1 | 2022-03-05T14:50:58.000Z | 2022-03-05T14:50:58.000Z | test/functional/feature_maxuploadtarget.py | Perbug/perbug | 4fa48d19be465006cdcaf9e6c09d394309aa2bf9 | [
"MIT"
] | 2 | 2021-12-18T03:02:54.000Z | 2022-01-17T17:55:36.000Z | test/functional/feature_maxuploadtarget.py | DclrCoin/dclrcoin | 1ca3bd1f787fdead6ae84b7cda2bab6c6cb62b1d | [
"MIT"
] | 2 | 2021-12-25T12:39:07.000Z | 2022-02-14T03:03:36.000Z | #!/usr/bin/env python3
# Copyright (c) 2015-2019 The Bitcoin Core Developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test behavior of -maxuploadtarget.
* Verify that getdata requests for old blocks (>1week) are dropped
... | 40.055901 | 107 | 0.681501 |
from collections import defaultdict
import time
from test_framework.messages import CInv, msg_getdata
from test_framework.mininode import P2PInterface
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal, mine_large_block
class TestP2PConn(P2PInterface):
... | true | true |
f753790b58bb7374a65a5edf61ff861f9f57622b | 511 | py | Python | test/DSDataFrame_test.py | axefx/lambdata-axel | 81d70ea80ec33b3f1c16c3c8344a004474e2a4a8 | [
"MIT"
] | null | null | null | test/DSDataFrame_test.py | axefx/lambdata-axel | 81d70ea80ec33b3f1c16c3c8344a004474e2a4a8 | [
"MIT"
] | null | null | null | test/DSDataFrame_test.py | axefx/lambdata-axel | 81d70ea80ec33b3f1c16c3c8344a004474e2a4a8 | [
"MIT"
] | 1 | 2020-04-07T23:06:48.000Z | 2020-04-07T23:06:48.000Z | import unittest
from lambdata_axel.ds_tools import DSDataFrame
data = {'numbers': [0, 1, 2, 3, 4, 5, 6, 7],
"alphabet": ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']}
class TestDSDataFrame(unittest.TestCase):
def setUp(self):
self.df = DSDataFrame(data)
def test_check_nulls(self):
column... | 24.333333 | 68 | 0.606654 | import unittest
from lambdata_axel.ds_tools import DSDataFrame
data = {'numbers': [0, 1, 2, 3, 4, 5, 6, 7],
"alphabet": ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']}
class TestDSDataFrame(unittest.TestCase):
def setUp(self):
self.df = DSDataFrame(data)
def test_check_nulls(self):
column... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.