hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 958k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c471283593726a928d0d7ec9a44612cdf93d9bf | 12,006 | py | Python | saleor/graphql/payment/mutations.py | frediian/test-saleor | 6bc7d153bbedb2b6cfe9b125325c785a08ac32bd | [
"CC-BY-4.0"
] | null | null | null | saleor/graphql/payment/mutations.py | frediian/test-saleor | 6bc7d153bbedb2b6cfe9b125325c785a08ac32bd | [
"CC-BY-4.0"
] | 22 | 2021-08-02T04:47:57.000Z | 2022-03-28T04:41:58.000Z | saleor/graphql/payment/mutations.py | frediian/test-saleor | 6bc7d153bbedb2b6cfe9b125325c785a08ac32bd | [
"CC-BY-4.0"
] | null | null | null | import graphene
from django.core.exceptions import ValidationError
from ...channel.models import Channel
from ...checkout.calculations import calculate_checkout_total_with_gift_cards
from ...checkout.checkout_cleaner import clean_billing_address, clean_checkout_shipping
from ...checkout.fetch import fetch_checkout_inf... | 36.381818 | 88 | 0.623938 | import graphene
from django.core.exceptions import ValidationError
from ...channel.models import Channel
from ...checkout.calculations import calculate_checkout_total_with_gift_cards
from ...checkout.checkout_cleaner import clean_billing_address, clean_checkout_shipping
from ...checkout.fetch import fetch_checkout_inf... | true | true |
1c4712b10065ae738ea39947160be15df662fbae | 4,778 | py | Python | cinder/api/contrib/extended_snapshot_attributes.py | cloudbau/cinder | 3179f2f42ae940a08b910e326a809556689864d8 | [
"Apache-2.0"
] | null | null | null | cinder/api/contrib/extended_snapshot_attributes.py | cloudbau/cinder | 3179f2f42ae940a08b910e326a809556689864d8 | [
"Apache-2.0"
] | null | null | null | cinder/api/contrib/extended_snapshot_attributes.py | cloudbau/cinder | 3179f2f42ae940a08b910e326a809556689864d8 | [
"Apache-2.0"
] | null | null | null | # Copyright 2012 OpenStack Foundation
#
# 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 a... | 38.224 | 78 | 0.670783 |
from webob import exc
from cinder.api import extensions
from cinder.api.openstack import wsgi
from cinder.api import xmlutil
from cinder import exception
from cinder.openstack.common import log as logging
from cinder import volume
LOG = logging.getLogger(__name__)
authorize = extensions.soft_extensio... | true | true |
1c47132929ce011d4b8ad6a8bcdf763d68fc9700 | 7,415 | py | Python | yapftests/split_penalty_test.py | hugovk/yapf | 831fb3d38d19f2bd1518426af68f22f21f5400b0 | [
"Apache-2.0"
] | null | null | null | yapftests/split_penalty_test.py | hugovk/yapf | 831fb3d38d19f2bd1518426af68f22f21f5400b0 | [
"Apache-2.0"
] | null | null | null | yapftests/split_penalty_test.py | hugovk/yapf | 831fb3d38d19f2bd1518426af68f22f21f5400b0 | [
"Apache-2.0"
] | null | null | null | # 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 a... | 27.771536 | 79 | 0.578692 |
import sys
import textwrap
import unittest
from lib2to3 import pytree
from yapf.pytree import pytree_utils
from yapf.pytree import pytree_visitor
from yapf.yapflib import split_penalty
from yapf.yapflib import style
from yapftests import yapf_test_helper
UNBREAKABLE = split_penalty.UNBREAKABLE
VERY_ST... | true | true |
1c47143c0de39dc172c34feae1dc157a3f004a9e | 1,024 | py | Python | demo_python/socket/server2.py | coderlongren/Scrapy | c0678fcf55c16b5f74e08158761b79da910172e4 | [
"MIT"
] | 5 | 2017-12-03T11:35:56.000Z | 2018-03-22T06:49:03.000Z | demo_python/socket/server2.py | coderlongren/Scrapy | c0678fcf55c16b5f74e08158761b79da910172e4 | [
"MIT"
] | null | null | null | demo_python/socket/server2.py | coderlongren/Scrapy | c0678fcf55c16b5f74e08158761b79da910172e4 | [
"MIT"
] | null | null | null | #coding:utf-8
from SocketServer import TCPServer, BaseRequestHandler
import traceback
class MyBaseRequestHandlerr(BaseRequestHandler):
"""
#从BaseRequestHandler继承,并重写handle方法
"""
def handle(self):
#循环监听(读取)来自客户端的数据
while True:
#当客户端主动断开连接时,self.recv(1024)会抛出... | 26.25641 | 76 | 0.545898 |
from SocketServer import TCPServer, BaseRequestHandler
import traceback
class MyBaseRequestHandlerr(BaseRequestHandler):
"""
#从BaseRequestHandler继承,并重写handle方法
"""
def handle(self):
while True:
try:
data = sel... | false | true |
1c4714491879cc91b48a7f0c09b4c8ab6d87e93d | 3,659 | py | Python | evaluate.py | Prettyfinger/Twostream_reID | 8e340e0c03bd248b04ff1b48398ca99b6aeaa508 | [
"MIT"
] | 6 | 2019-05-17T03:40:59.000Z | 2021-04-09T11:01:54.000Z | evaluate.py | Prettyfinger/Twostream_reID | 8e340e0c03bd248b04ff1b48398ca99b6aeaa508 | [
"MIT"
] | null | null | null | evaluate.py | Prettyfinger/Twostream_reID | 8e340e0c03bd248b04ff1b48398ca99b6aeaa508 | [
"MIT"
] | 2 | 2019-09-12T06:19:05.000Z | 2020-06-12T11:34:12.000Z | import scipy.io
import torch
import numpy as np
#import time
import os
#######################################################################
# Evaluate
def evaluate(qf,ql,qc,gf,gl,gc):
query = qf
score = np.dot(gf,query)
# predict index
index = np.argsort(score) #from small to large
index = inde... | 33.87963 | 120 | 0.636239 | import scipy.io
import torch
import numpy as np
import os
| true | true |
1c4714b6c1ba2640b2df051cf15a452b139f7891 | 1,251 | py | Python | extra/unused/kml_wesn_filter.py | whyjz/CARST | 875c915e835b0e09a7eccb58833719bbfc85b635 | [
"MIT"
] | 10 | 2018-01-02T18:03:07.000Z | 2022-01-25T05:36:21.000Z | extra/unused/kml_wesn_filter.py | whyjz/CARST | 875c915e835b0e09a7eccb58833719bbfc85b635 | [
"MIT"
] | 1 | 2020-04-14T16:57:15.000Z | 2020-05-15T16:10:17.000Z | extra/unused/kml_wesn_filter.py | whyjz/CARST | 875c915e835b0e09a7eccb58833719bbfc85b635 | [
"MIT"
] | 4 | 2016-08-12T15:06:48.000Z | 2019-11-27T05:33:50.000Z | #!/usr/bin/python
import re;
import sys;
name=sys.argv[1];
w=sys.argv[2];
e=sys.argv[3];
s=sys.argv[4];
n=sys.argv[5];
coords_str="";
kml="";
temp="";
coords="";
outside=False;
infile=open(name,"r");
while 1:
line=infile.readline();
if not line:
break;
if line.find("<Placemark") < 0:
kml=kml+line;
else:
... | 18.397059 | 94 | 0.581135 |
import re;
import sys;
name=sys.argv[1];
w=sys.argv[2];
e=sys.argv[3];
s=sys.argv[4];
n=sys.argv[5];
coords_str="";
kml="";
temp="";
coords="";
outside=False;
infile=open(name,"r");
while 1:
line=infile.readline();
if not line:
break;
if line.find("<Placemark") < 0:
kml=kml+line;
else:
temp=temp+line;
... | true | true |
1c471503d318cedfa20271abbfe08577cd1b9640 | 15,148 | py | Python | onnx2caffe/_operators.py | troyliu0105/onnx2caffe | d369e774ed216f1c9cbc2f3610c8c1b9c3364f97 | [
"MIT"
] | null | null | null | onnx2caffe/_operators.py | troyliu0105/onnx2caffe | d369e774ed216f1c9cbc2f3610c8c1b9c3364f97 | [
"MIT"
] | null | null | null | onnx2caffe/_operators.py | troyliu0105/onnx2caffe | d369e774ed216f1c9cbc2f3610c8c1b9c3364f97 | [
"MIT"
] | null | null | null | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import math
from caffe import params as P
from MyCaffe import Function as myf
def _compare(a, b, encoding="utf8"): # type: (Text, Text, Text) -> bool
if isinstan... | 35.392523 | 120 | 0.616319 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import math
from caffe import params as P
from MyCaffe import Function as myf
def _compare(a, b, encoding="utf8"):
if isinstance(a, bytes):
a = a.decode... | true | true |
1c471581b148d8da944b7d385ff56958dcd3c839 | 80 | py | Python | satori.core/satori/core/sec/__init__.py | Cloud11665/satori-git | ea1855a920c98b480423bf247bce6e5626985c4a | [
"MIT"
] | 4 | 2021-01-05T01:35:36.000Z | 2021-12-13T00:05:14.000Z | satori.core/satori/core/sec/__init__.py | Cloud11665/satori-git | ea1855a920c98b480423bf247bce6e5626985c4a | [
"MIT"
] | 2 | 2020-06-06T01:12:07.000Z | 2020-06-06T01:16:01.000Z | satori.core/satori/core/sec/__init__.py | Cloud11665/satori-git | ea1855a920c98b480423bf247bce6e5626985c4a | [
"MIT"
] | 2 | 2021-01-05T01:33:30.000Z | 2021-03-06T13:48:21.000Z | # vim:ts=4:sts=4:sw=4:expandtab
"""
Security and authorization procedures.
"""
| 13.333333 | 38 | 0.7 | true | true | |
1c47178b6382cec7eefc639b882b988952869b5a | 717 | py | Python | setup.py | andrey-avdeev/telemetry | 0c70b410079616634ff1895b360d8d9b8a65f046 | [
"Apache-2.0"
] | 13 | 2019-12-01T08:05:25.000Z | 2020-05-19T10:43:49.000Z | setup.py | andrey-avdeev/telemetry | 0c70b410079616634ff1895b360d8d9b8a65f046 | [
"Apache-2.0"
] | 6 | 2019-12-02T07:43:49.000Z | 2019-12-02T07:52:15.000Z | setup.py | andrey-avdeev/telemetry | 0c70b410079616634ff1895b360d8d9b8a65f046 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
import io
from setuptools import setup
with io.open("README.md", "r", encoding="utf-8") as f:
readme = f.read()
setup(
name="telemetry",
version="0.0.1",
description="Profiling in production",
long_description=readme,
long_description_content_type="text/markdown",
... | 27.576923 | 84 | 0.666667 |
import io
from setuptools import setup
with io.open("README.md", "r", encoding="utf-8") as f:
readme = f.read()
setup(
name="telemetry",
version="0.0.1",
description="Profiling in production",
long_description=readme,
long_description_content_type="text/markdown",
author="Andrey Avdeev",... | true | true |
1c4717eb7bcd8e66085457e0e315a1117fae6d1b | 487 | py | Python | students/K33421/practical_works/Dzhapua_Esnat/django_project_dzhapua/project_first_app/migrations/0005_auto_20210112_1735.py | esnogram/ITMO_ICT_WebDevelopment_2020-2021 | 22a3d776463d50431a5745facaf7b4d55dd73b55 | [
"MIT"
] | null | null | null | students/K33421/practical_works/Dzhapua_Esnat/django_project_dzhapua/project_first_app/migrations/0005_auto_20210112_1735.py | esnogram/ITMO_ICT_WebDevelopment_2020-2021 | 22a3d776463d50431a5745facaf7b4d55dd73b55 | [
"MIT"
] | null | null | null | students/K33421/practical_works/Dzhapua_Esnat/django_project_dzhapua/project_first_app/migrations/0005_auto_20210112_1735.py | esnogram/ITMO_ICT_WebDevelopment_2020-2021 | 22a3d776463d50431a5745facaf7b4d55dd73b55 | [
"MIT"
] | null | null | null | # Generated by Django 3.1.2 on 2021-01-12 14:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('project_first_app', '0004_auto_20210112_1725'),
]
operations = [
migrations.AlterField(
model_name='license',
name='... | 25.631579 | 142 | 0.583162 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('project_first_app', '0004_auto_20210112_1725'),
]
operations = [
migrations.AlterField(
model_name='license',
name='type',
field=models.CharField(choic... | true | true |
1c47192561935cacdc804480f0ef012db41123f8 | 645 | py | Python | Graphy/tests/utils/test_files.py | andrepbento/OpenTracingProcessor | 9e4b01cb59cecbfa04af8d5d93e3b7deb76d9ee6 | [
"MIT"
] | 4 | 2021-03-06T13:50:58.000Z | 2022-03-28T15:17:07.000Z | Graphy/tests/utils/test_files.py | andrepbento/OpenTracingProcessor | 9e4b01cb59cecbfa04af8d5d93e3b7deb76d9ee6 | [
"MIT"
] | null | null | null | Graphy/tests/utils/test_files.py | andrepbento/OpenTracingProcessor | 9e4b01cb59cecbfa04af8d5d93e3b7deb76d9ee6 | [
"MIT"
] | null | null | null | """
Author: André Bento
Date last modified: 26-02-2019
"""
import os
from unittest import TestCase
from graphy.utils import files as my_files
class TestFiles(TestCase):
def setUp(self) -> None:
super().setUp()
self.__file_path = os.path.realpath(__file__)
def test_get_absolute_path(... | 25.8 | 66 | 0.671318 | import os
from unittest import TestCase
from graphy.utils import files as my_files
class TestFiles(TestCase):
def setUp(self) -> None:
super().setUp()
self.__file_path = os.path.realpath(__file__)
def test_get_absolute_path(self) -> None:
with self.assertRaises(FileNotFoundError):
... | true | true |
1c471a5a4d3049b0f68e2c3cdd6645cca95fe30f | 14,320 | py | Python | transitions/extensions/nesting.py | timokoola/timoechobot | c6e18aa29b538b73dcef1898f1d45bb3bf6d0d55 | [
"Apache-2.0"
] | null | null | null | transitions/extensions/nesting.py | timokoola/timoechobot | c6e18aa29b538b73dcef1898f1d45bb3bf6d0d55 | [
"Apache-2.0"
] | null | null | null | transitions/extensions/nesting.py | timokoola/timoechobot | c6e18aa29b538b73dcef1898f1d45bb3bf6d0d55 | [
"Apache-2.0"
] | null | null | null | from ..core import Machine, Transition, State, Event, listify, MachineError, EventData
from six import string_types
import copy
from functools import partial
import logging
logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
class FunctionWrapper(object):
def __init__(self, func, path)... | 44.890282 | 122 | 0.5625 | from ..core import Machine, Transition, State, Event, listify, MachineError, EventData
from six import string_types
import copy
from functools import partial
import logging
logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
class FunctionWrapper(object):
def __init__(self, func, path)... | true | true |
1c471b8e54efc4a698c7d8da207470a25a2d8196 | 2,348 | py | Python | bin/document_schemas.py | lbianchi-lbl/watertap | 8e727255240464b95c8b81eaead6ed3bd3e61a18 | [
"BSD-3-Clause-LBNL"
] | null | null | null | bin/document_schemas.py | lbianchi-lbl/watertap | 8e727255240464b95c8b81eaead6ed3bd3e61a18 | [
"BSD-3-Clause-LBNL"
] | 1 | 2021-09-24T00:33:49.000Z | 2021-09-24T00:33:49.000Z | bin/document_schemas.py | lbianchi-lbl/proteuslib | 8e727255240464b95c8b81eaead6ed3bd3e61a18 | [
"BSD-3-Clause-LBNL"
] | null | null | null | ###############################################################################
# ProteusLib Copyright (c) 2021, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory, Oak Ridge National
# Laboratory, National Renewable Energy Laboratory, and National Energy
# Technology Laborator... | 36.6875 | 81 | 0.602215 | false | true | |
1c471d10ce8e04eeb505e3f4ed1e1419f490f38a | 3,731 | py | Python | homeassistant/components/simplisafe/binary_sensor.py | basicpail/core | 5cc54618c5af3f75c08314bf2375cc7ac40d2b7e | [
"Apache-2.0"
] | 5 | 2019-02-24T11:46:18.000Z | 2019-05-28T17:37:21.000Z | homeassistant/components/simplisafe/binary_sensor.py | basicpail/core | 5cc54618c5af3f75c08314bf2375cc7ac40d2b7e | [
"Apache-2.0"
] | 77 | 2020-07-16T16:43:09.000Z | 2022-03-31T06:14:37.000Z | homeassistant/components/simplisafe/binary_sensor.py | Vaarlion/core | f3de8b9f28de01abf72c0f5bb0b457eb1841f201 | [
"Apache-2.0"
] | 11 | 2020-12-16T13:48:14.000Z | 2022-02-01T00:28:05.000Z | """Support for SimpliSafe binary sensors."""
from __future__ import annotations
from simplipy.entity import Entity as SimplipyEntity, EntityTypes
from simplipy.system.v2 import SystemV2
from simplipy.system.v3 import SystemV3
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_BATTERY,
DEVICE_CL... | 31.618644 | 84 | 0.693916 | from __future__ import annotations
from simplipy.entity import Entity as SimplipyEntity, EntityTypes
from simplipy.system.v2 import SystemV2
from simplipy.system.v3 import SystemV3
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_DOOR,
DEVICE_CLASS_GAS,
DEVICE_CL... | true | true |
1c471d26f4e0f5fcaf6255a003f2d7ce2936056e | 19,223 | py | Python | spectrochempy/core/analysis/simplisma.py | spectrochempy/spectrochempy | 829b290f465e630078785e303dbab197cd78b815 | [
"Apache-2.0",
"CECILL-B",
"BSD-3-Clause"
] | 44 | 2020-05-14T01:56:40.000Z | 2022-03-23T11:16:30.000Z | spectrochempy/core/analysis/simplisma.py | spectrochempy/spectrochempy | 829b290f465e630078785e303dbab197cd78b815 | [
"Apache-2.0",
"CECILL-B",
"BSD-3-Clause"
] | 210 | 2020-05-22T17:33:22.000Z | 2022-03-20T16:50:30.000Z | spectrochempy/core/analysis/simplisma.py | spectrochempy/spectrochempy | 829b290f465e630078785e303dbab197cd78b815 | [
"Apache-2.0",
"CECILL-B",
"BSD-3-Clause"
] | 9 | 2020-05-16T15:36:02.000Z | 2022-03-23T11:16:56.000Z | # -*- coding: utf-8 -*-
#
# =============================================================================
# Copyright (©) 2015-2022 LCS
# Laboratoire Catalyse et Spectrochimie, Caen, France.
# CeCILL-B FREE SOFTWARE LICENSE AGREEMENT
# See full LICENSE agreement in the root directory
# ================================... | 36.967308 | 114 | 0.427509 |
__all__ = ["SIMPLISMA"]
__dataset_methods__ = []
import numpy as np
import warnings
from traitlets import HasTraits, Instance, Unicode
from spectrochempy.core.dataset.nddataset import NDDataset
from spectrochempy.core.dataset.npy import dot
from spectrochempy.core import info_, set_loglevel, INFO
... | true | true |
1c471da88d59c2507feef993fda3aee7a9be0942 | 743 | py | Python | oscar/utils/argparse.py | IntelLabs/OSCAR | 25d1dea35727379117e11b7238b5a0d1ed19acad | [
"BSD-3-Clause"
] | 13 | 2021-02-12T18:41:53.000Z | 2022-01-14T07:17:15.000Z | oscar/utils/argparse.py | IntelLabs/OSCAR | 25d1dea35727379117e11b7238b5a0d1ed19acad | [
"BSD-3-Clause"
] | null | null | null | oscar/utils/argparse.py | IntelLabs/OSCAR | 25d1dea35727379117e11b7238b5a0d1ed19acad | [
"BSD-3-Clause"
] | 2 | 2021-03-05T18:27:23.000Z | 2021-03-05T23:16:09.000Z | #
# Copyright (C) 2020 Georgia Institute of Technology. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
from argparse import ArgumentParser, Action, Namespace
from typing import List
class NegateAction(Action):
# adapted from https://stackoverflow.com/a/34736291
def __call__(
self,
... | 24.766667 | 85 | 0.643338 |
from argparse import ArgumentParser, Action, Namespace
from typing import List
class NegateAction(Action):
def __call__(
self,
parser: ArgumentParser,
namespace: Namespace,
values: List[str],
option: str,
):
setattr(namespace, self.dest, option[2:4] ... | true | true |
1c471eec2870d4cfe9b1cd1a30eaad7b3ab34d2a | 14,023 | py | Python | experiment.py | pawni/sgld_online_approximation | 1edae8a669fdeef4e5501bcb07d6b809fc4cccd9 | [
"MIT"
] | 7 | 2017-04-25T08:49:22.000Z | 2018-05-14T08:42:34.000Z | experiment.py | pawni/sgld_online_approximation | 1edae8a669fdeef4e5501bcb07d6b809fc4cccd9 | [
"MIT"
] | null | null | null | experiment.py | pawni/sgld_online_approximation | 1edae8a669fdeef4e5501bcb07d6b809fc4cccd9 | [
"MIT"
] | 5 | 2017-05-27T07:00:07.000Z | 2020-03-09T04:04:58.000Z | import tensorflow as tf
import numpy as np
import os
from tensorflow.examples.tutorials.mnist import input_data
import edward as ed
from edward.models import Normal, Categorical, Multinomial, Empirical, PointMass
from tensorflow.python.training import moving_averages
# setup function to handle session configuration an... | 52.718045 | 121 | 0.617343 | import tensorflow as tf
import numpy as np
import os
from tensorflow.examples.tutorials.mnist import input_data
import edward as ed
from edward.models import Normal, Categorical, Multinomial, Empirical, PointMass
from tensorflow.python.training import moving_averages
def setup():
tf.reset_default_graph()
os.e... | true | true |
1c472050daedf1a77010a344d73d87639472c613 | 7,577 | py | Python | src/opnsense/scripts/netflow/lib/flowparser.py | ppmathis/opnsense-core | ffd506037a66804755cc3a7b3536a0a9450c10aa | [
"BSD-2-Clause"
] | null | null | null | src/opnsense/scripts/netflow/lib/flowparser.py | ppmathis/opnsense-core | ffd506037a66804755cc3a7b3536a0a9450c10aa | [
"BSD-2-Clause"
] | null | null | null | src/opnsense/scripts/netflow/lib/flowparser.py | ppmathis/opnsense-core | ffd506037a66804755cc3a7b3536a0a9450c10aa | [
"BSD-2-Clause"
] | null | null | null | """
Copyright (c) 2019 Ad Schellevis <ad@opnsense.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
... | 41.631868 | 116 | 0.551538 | import struct
from socket import inet_ntop, AF_INET, AF_INET6, ntohl
class FlowParser:
field_definition_order = [
'tag',
'recv_time',
'proto_flags_tos',
'agent_addr4',
'agent_addr6',
'src_addr4',
'src_addr6',
'dst_addr4',
'dst_addr6',
... | true | true |
1c472076ed04a3d5c186ecdaba2d82b57688477b | 55,537 | py | Python | methylcheck/qc_plot.py | LifeEGX/methQC | 2b4f960e7e5c7baca9dc778ca05ee332e2f27653 | [
"MIT"
] | 2 | 2019-10-13T21:42:14.000Z | 2019-10-16T19:08:49.000Z | methylcheck/qc_plot.py | LifeEGX/methQC | 2b4f960e7e5c7baca9dc778ca05ee332e2f27653 | [
"MIT"
] | 9 | 2019-07-15T18:56:51.000Z | 2019-07-23T17:25:53.000Z | methylcheck/qc_plot.py | LifeEGX/methQC | 2b4f960e7e5c7baca9dc778ca05ee332e2f27653 | [
"MIT"
] | 1 | 2020-01-09T14:26:02.000Z | 2020-01-09T14:26:02.000Z | import warnings
from pathlib import Path
import logging
import pandas as pd
import numpy as np
import seaborn as sb
import matplotlib.pyplot as plt
#app
import methylcheck
from .progress_bar import *
LOGGER = logging.getLogger(__name__)
__all__ = ['run_qc', 'plot_beta_by_type', 'qc_signal_intensity', 'plot_M_vs_U', ... | 55.426148 | 209 | 0.648775 | import warnings
from pathlib import Path
import logging
import pandas as pd
import numpy as np
import seaborn as sb
import matplotlib.pyplot as plt
import methylcheck
from .progress_bar import *
LOGGER = logging.getLogger(__name__)
__all__ = ['run_qc', 'plot_beta_by_type', 'qc_signal_intensity', 'plot_M_vs_U', 'plo... | true | true |
1c4722894dd64b399061cba6ce7c56519333d6f2 | 3,378 | py | Python | simscale_sdk/models/symmetry_vbc.py | slainesimscale/simscale-python-sdk | db483eeabe558e55d020f5f829a3bf13c9c287a7 | [
"MIT"
] | 8 | 2021-01-22T13:41:03.000Z | 2022-01-03T09:00:10.000Z | simscale_sdk/models/symmetry_vbc.py | slainesimscale/simscale-python-sdk | db483eeabe558e55d020f5f829a3bf13c9c287a7 | [
"MIT"
] | null | null | null | simscale_sdk/models/symmetry_vbc.py | slainesimscale/simscale-python-sdk | db483eeabe558e55d020f5f829a3bf13c9c287a7 | [
"MIT"
] | 3 | 2021-03-18T15:52:52.000Z | 2022-01-03T08:59:30.000Z | # coding: utf-8
"""
SimScale API
The version of the OpenAPI document: 0.0.0
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from simscale_sdk.configuration import Configuration
class SymmetryVBC(object):
"""NOTE: This class is auto generated by O... | 27.688525 | 95 | 0.5672 |
import pprint
import re
import six
from simscale_sdk.configuration import Configuration
class SymmetryVBC(object):
openapi_types = {
'type': 'str'
}
attribute_map = {
'type': 'type'
}
def __init__(self, type='SYMMETRY', local_vars_configuration=None):
if local_... | true | true |
1c47230e511165113e34bda546e7409a06011882 | 382 | py | Python | mtp_api/apps/disbursement/migrations/0012_index_prisoner_number.py | ministryofjustice/mtp-api | b1c34c29e4aa9f48598cb060abe1368ae7686e0b | [
"MIT"
] | 5 | 2016-01-05T12:21:35.000Z | 2020-10-28T17:06:02.000Z | mtp_api/apps/disbursement/migrations/0012_index_prisoner_number.py | ministryofjustice/mtp-api | b1c34c29e4aa9f48598cb060abe1368ae7686e0b | [
"MIT"
] | 209 | 2015-06-12T09:39:41.000Z | 2022-03-21T16:01:19.000Z | mtp_api/apps/disbursement/migrations/0012_index_prisoner_number.py | ministryofjustice/mtp-api | b1c34c29e4aa9f48598cb060abe1368ae7686e0b | [
"MIT"
] | 1 | 2021-04-11T06:19:23.000Z | 2021-04-11T06:19:23.000Z | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('disbursement', '0011_disbursement_natural_ordering'),
]
operations = [
migrations.AlterField(
model_name='disbursement',
name='prisoner_number',
field=mode... | 25.466667 | 66 | 0.63089 | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('disbursement', '0011_disbursement_natural_ordering'),
]
operations = [
migrations.AlterField(
model_name='disbursement',
name='prisoner_number',
field=mode... | true | true |
1c4723608719c6c2a1db977050fea496f0778717 | 348 | py | Python | xradar/__init__.py | mgrover1/pyart-xarray-sandbox | 89e5cc8079a0f7d1ed62be882710e907009d2523 | [
"Apache-2.0"
] | 1 | 2022-03-30T07:54:21.000Z | 2022-03-30T07:54:21.000Z | xradar/__init__.py | mgrover1/pyart-xarray-sandbox | 89e5cc8079a0f7d1ed62be882710e907009d2523 | [
"Apache-2.0"
] | null | null | null | xradar/__init__.py | mgrover1/pyart-xarray-sandbox | 89e5cc8079a0f7d1ed62be882710e907009d2523 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
# flake8: noqa
""" Top-level module. """
from pkg_resources import DistributionNotFound, get_distribution
from .main import create_dataset_from_sweep, convert_to_xradar
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound: # pragma: no cover
__version__ = '... | 31.636364 | 64 | 0.775862 |
from pkg_resources import DistributionNotFound, get_distribution
from .main import create_dataset_from_sweep, convert_to_xradar
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
__version__ = 'unknown' | true | true |
1c4723879bb3f58b9c0ed9d4c2431b19c7c7ae96 | 5,977 | py | Python | src/main/python/smv/smvschema.py | ninjapapa/SMV2 | 42cf9f176c3ec0bed61f66fbf859c18d97027dd6 | [
"Apache-2.0"
] | null | null | null | src/main/python/smv/smvschema.py | ninjapapa/SMV2 | 42cf9f176c3ec0bed61f66fbf859c18d97027dd6 | [
"Apache-2.0"
] | 34 | 2022-02-26T04:27:34.000Z | 2022-03-29T23:05:47.000Z | src/main/python/smv/smvschema.py | ninjapapa/SMV2 | 42cf9f176c3ec0bed61f66fbf859c18d97027dd6 | [
"Apache-2.0"
] | null | null | null | #
# This file is licensed under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distr... | 36.224242 | 134 | 0.552953 |
import re
import json
import pyspark.sql.types as T
from smv.error import SmvRuntimeError
from smv.utils import is_string
from smv.csv_attributes import CsvAttributes
class SmvSchema(object):
def __init__(self, _schema):
if is_string(_schema):
(s, a) = self._fullStrToSchema(_schem... | true | true |
1c47246c602d65778a1c94df5d2b5e2fea0f4544 | 2,314 | py | Python | tests/test_return_values.py | Plan9-Archive/limbo-qt-bridge | 8c1cc4ee3a4d10c3a129a9ea103ef318c533e4fe | [
"MIT"
] | null | null | null | tests/test_return_values.py | Plan9-Archive/limbo-qt-bridge | 8c1cc4ee3a4d10c3a129a9ea103ef318c533e4fe | [
"MIT"
] | null | null | null | tests/test_return_values.py | Plan9-Archive/limbo-qt-bridge | 8c1cc4ee3a4d10c3a129a9ea103ef318c533e4fe | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import sys, time
def send(message):
sys.stdout.write("%i %s" % (len(message), message))
sys.stdout.flush()
def enc(value, type_):
s = str(value)
return "%s%i %s" % (type_, len(s), s)
def create(id_, name, class_):
send("%s %s %s %s\n" % (enc("create", "s"), enc(id_, "i"), ... | 24.104167 | 97 | 0.491357 |
import sys, time
def send(message):
sys.stdout.write("%i %s" % (len(message), message))
sys.stdout.flush()
def enc(value, type_):
s = str(value)
return "%s%i %s" % (type_, len(s), s)
def create(id_, name, class_):
send("%s %s %s %s\n" % (enc("create", "s"), enc(id_, "i"), enc(name, "s"), enc(cl... | true | true |
1c47251f1d885a2899627ad8fe90b650f45dcd7a | 420 | py | Python | ex058.py | dsjocimar/python | 5716f46a9fa7f64aa78a39df9c262c5392571340 | [
"MIT"
] | null | null | null | ex058.py | dsjocimar/python | 5716f46a9fa7f64aa78a39df9c262c5392571340 | [
"MIT"
] | null | null | null | ex058.py | dsjocimar/python | 5716f46a9fa7f64aa78a39df9c262c5392571340 | [
"MIT"
] | null | null | null | # Exercício 058
from random import randint
tentativas = 0
computador = randint(0, 10)
jogador = int(input('TENTE ADIVINHAR QUAL NÚMERO EU ESTOU PENSANDO, DE 0 A 10...'))
print('PROCESSANDO...')
while jogador != computador:
jogador = int(input('VOCÊ ERROU! TENTE NOVAMENTE!:\n'))
tentativas += 1
if tentativas ==... | 30 | 83 | 0.707143 |
from random import randint
tentativas = 0
computador = randint(0, 10)
jogador = int(input('TENTE ADIVINHAR QUAL NÚMERO EU ESTOU PENSANDO, DE 0 A 10...'))
print('PROCESSANDO...')
while jogador != computador:
jogador = int(input('VOCÊ ERROU! TENTE NOVAMENTE!:\n'))
tentativas += 1
if tentativas == 0:
tentati... | true | true |
1c4727047e4e277527b4df35a4017b33843a4678 | 613 | py | Python | runpandas/_testing.py | pnposch/runpandas | 25388c18b52dfcc168e81922b8ba20ca93adad20 | [
"MIT"
] | 11 | 2020-12-04T20:43:23.000Z | 2022-03-16T19:19:12.000Z | runpandas/_testing.py | pnposch/runpandas | 25388c18b52dfcc168e81922b8ba20ca93adad20 | [
"MIT"
] | 45 | 2020-06-23T02:50:31.000Z | 2022-02-15T16:56:00.000Z | runpandas/_testing.py | pnposch/runpandas | 25388c18b52dfcc168e81922b8ba20ca93adad20 | [
"MIT"
] | 4 | 2021-11-11T15:23:04.000Z | 2022-02-02T13:02:12.000Z | """
Utilities for testing purposes.
"""
import wrapt
def skip_on_exception(exp):
"""
Skip a test if a specific Exception is raised. This is because
the Exception is raised for reasons beyond our control (e.g.
flakey 3rd-party API).
a signature-preserving decorator
Parameters
----------
... | 21.137931 | 66 | 0.62969 |
import wrapt
def skip_on_exception(exp):
from pytest import skip
@wrapt.decorator
def wrapper(wrapped, instance, args, kwargs):
try:
return wrapped(*args, **kwargs)
except exp as e:
skip(str(e))
return wrapper
| true | true |
1c472708a7a3874db4d2144abf7360285dc39c2d | 1,385 | py | Python | Lib/xml/dom/html/HTMLHtmlElement.py | M-Spencer-94/configNOW | 56828587253202089e77cfdfcf5329f2a7f09b3f | [
"PSF-2.0",
"Apache-2.0",
"MIT"
] | 3 | 2019-07-09T20:02:48.000Z | 2021-11-21T20:00:37.000Z | Lib/xml/dom/html/HTMLHtmlElement.py | M-Spencer-94/configNOW | 56828587253202089e77cfdfcf5329f2a7f09b3f | [
"PSF-2.0",
"Apache-2.0",
"MIT"
] | null | null | null | Lib/xml/dom/html/HTMLHtmlElement.py | M-Spencer-94/configNOW | 56828587253202089e77cfdfcf5329f2a7f09b3f | [
"PSF-2.0",
"Apache-2.0",
"MIT"
] | null | null | null | ########################################################################
#
# File Name: HTMLHtmlElement
#
# Documentation: http://docs.4suite.com/4DOM/HTMLHtmlElement.html
#
### This file is automatically generated by GenerateHtml.py.
### DO NOT EDIT!
"""
WWW: http://4suite.com/4DOM e-mail: ... | 28.265306 | 77 | 0.65343 | true | true | |
1c472740677dec56b7aeda2e3690aaa75e2d07c1 | 35,268 | py | Python | sdk/python/feast/registry.py | danilopeixoto/feast | 57d134355364654a2275b477b3b82b149f0779ca | [
"Apache-2.0"
] | null | null | null | sdk/python/feast/registry.py | danilopeixoto/feast | 57d134355364654a2275b477b3b82b149f0779ca | [
"Apache-2.0"
] | null | null | null | sdk/python/feast/registry.py | danilopeixoto/feast | 57d134355364654a2275b477b3b82b149f0779ca | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 The Feast Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | 38.671053 | 118 | 0.651043 |
import json
import logging
from collections import defaultdict
from datetime import datetime, timedelta
from enum import Enum
from pathlib import Path
from threading import Lock
from typing import Any, Dict, List, Optional, Set
from urllib.parse import urlparse
from google.protobuf.internal.containers imp... | true | true |
1c47274e5d7cddc1fe325007a2b3162d454f0df8 | 11,308 | py | Python | edgeconnecttest/models.py | co-develop-drv/FGVC | 60d91f85ee48d757dd070e66984ea57d7e60f668 | [
"MIT"
] | 1,463 | 2020-09-13T22:55:35.000Z | 2022-03-30T20:34:32.000Z | edgeconnect/models.py | scqilin/FGVC | 9820d3c1a33ba402009ecb1d25e897cbcddc74d5 | [
"MIT"
] | 62 | 2020-09-24T02:57:06.000Z | 2022-03-01T01:48:39.000Z | edgeconnect/models.py | scqilin/FGVC | 9820d3c1a33ba402009ecb1d25e897cbcddc74d5 | [
"MIT"
] | 232 | 2020-09-21T02:13:54.000Z | 2022-03-16T22:11:28.000Z | import os
import torch
import torch.nn as nn
import torch.optim as optim
from .networks import InpaintGenerator, EdgeGenerator, Discriminator
from .loss import AdversarialLoss, PerceptualLoss, StyleLoss, TotalVariationalLoss
class BaseModel(nn.Module):
def __init__(self, name, config):
super(BaseModel, se... | 35.671924 | 116 | 0.595242 | import os
import torch
import torch.nn as nn
import torch.optim as optim
from .networks import InpaintGenerator, EdgeGenerator, Discriminator
from .loss import AdversarialLoss, PerceptualLoss, StyleLoss, TotalVariationalLoss
class BaseModel(nn.Module):
def __init__(self, name, config):
super(BaseModel, se... | true | true |
1c472771d828e97cb35a1c49f80939e70dcd8102 | 6,888 | py | Python | samples/openapi3/client/petstore/python/petstore_api/model/number_with_validations.py | gasugesu/openapi-generator | e1c43f135639b9f300350f788fec98bbc375c932 | [
"Apache-2.0"
] | 3 | 2021-05-19T03:12:48.000Z | 2022-01-28T19:15:42.000Z | samples/openapi3/client/petstore/python/petstore_api/model/number_with_validations.py | gasugesu/openapi-generator | e1c43f135639b9f300350f788fec98bbc375c932 | [
"Apache-2.0"
] | 3 | 2021-05-11T23:55:26.000Z | 2022-02-27T11:17:21.000Z | samples/openapi3/client/petstore/python/petstore_api/model/number_with_validations.py | gasugesu/openapi-generator | e1c43f135639b9f300350f788fec98bbc375c932 | [
"Apache-2.0"
] | 1 | 2020-10-05T11:13:04.000Z | 2020-10-05T11:13:04.000Z | """
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
import re # noq... | 37.232432 | 174 | 0.571138 |
import re
import sys
import nulltype
from petstore_api.model_utils import (
ApiTypeError,
ModelComposed,
ModelNormal,
ModelSimple,
cached_property,
change_keys_js_to_python,
convert_js_args_to_python_args,
date,
datetime,
file_type,
none_type,
validate_get_com... | true | true |
1c4727c1218907e3faea73ec7e26cd2e8292e3d2 | 1,709 | py | Python | libs/elfutils/elfutils.py | KDE/craft-blueprints-kde | 14932d4b95ce0070ab8ae5669411c62ffa304c9b | [
"BSD-2-Clause"
] | 14 | 2017-09-04T09:01:03.000Z | 2022-01-04T20:09:00.000Z | libs/elfutils/elfutils.py | KDE/craft-blueprints-kde | 14932d4b95ce0070ab8ae5669411c62ffa304c9b | [
"BSD-2-Clause"
] | 14 | 2017-12-15T08:11:22.000Z | 2020-12-29T19:11:13.000Z | libs/elfutils/elfutils.py | KDE/craft-blueprints-kde | 14932d4b95ce0070ab8ae5669411c62ffa304c9b | [
"BSD-2-Clause"
] | 19 | 2017-09-05T19:16:21.000Z | 2020-10-18T12:46:06.000Z | # -*- coding: utf-8 -*-
import info
from Package.AutoToolsPackageBase import AutoToolsPackageBase
from Package.CMakePackageBase import *
class subinfo(info.infoclass):
def setTargets(self):
for ver in ['0.181', '0.185']:
self.targets[ver] = 'https://sourceware.org/elfutils/ftp/%s/elfutils-%s.t... | 51.787879 | 240 | 0.725571 |
import info
from Package.AutoToolsPackageBase import AutoToolsPackageBase
from Package.CMakePackageBase import *
class subinfo(info.infoclass):
def setTargets(self):
for ver in ['0.181', '0.185']:
self.targets[ver] = 'https://sourceware.org/elfutils/ftp/%s/elfutils-%s.tar.bz2' % (ver, ver)
... | true | true |
1c472884e3e30c55677ee3830a3d39ebae658645 | 14,991 | py | Python | beartype_test/a00_unit/a90_decor/code/pep/test_pepscope.py | posita/beartype | e56399686e1f2ffd5128a4030b19314504e32450 | [
"MIT"
] | null | null | null | beartype_test/a00_unit/a90_decor/code/pep/test_pepscope.py | posita/beartype | e56399686e1f2ffd5128a4030b19314504e32450 | [
"MIT"
] | null | null | null | beartype_test/a00_unit/a90_decor/code/pep/test_pepscope.py | posita/beartype | e56399686e1f2ffd5128a4030b19314504e32450 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# --------------------( LICENSE )--------------------
# Copyright (c) 2014-2021 Beartype authors.
# See "LICENSE" for further details.
'''
**Beartype decorator PEP-compliant code wrapper scope utility unit tests.**
This submodule unit tests the public API of the privat... | 42.954155 | 83 | 0.686745 |
def test_add_func_scope_type_pass() -> None:
from beartype.roar._roarexc import _BeartypeDecorBeartypistryException
from beartype._cave._cavefast import NoneType, RegexCompiledType
from beartype._decor._code._pep._pepscope import add_func_scope_type
from beartype._util.utilobject impo... | true | true |
1c47294261aa77c72a9bf2fb138f12409b92d6be | 440,048 | py | Python | ns-allinone-3.22/ns-3.22/src/dsdv/bindings/modulegen__gcc_LP64.py | gustavo978/helpful | 59e3fd062cff4451c9bf8268df78a24f93ff67b7 | [
"Unlicense"
] | null | null | null | ns-allinone-3.22/ns-3.22/src/dsdv/bindings/modulegen__gcc_LP64.py | gustavo978/helpful | 59e3fd062cff4451c9bf8268df78a24f93ff67b7 | [
"Unlicense"
] | null | null | null | ns-allinone-3.22/ns-3.22/src/dsdv/bindings/modulegen__gcc_LP64.py | gustavo978/helpful | 59e3fd062cff4451c9bf8268df78a24f93ff67b7 | [
"Unlicense"
] | 2 | 2018-06-06T14:10:23.000Z | 2020-04-07T17:20:55.000Z | from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | 63.645936 | 934 | 0.618019 | from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | true | true |
1c4729d25dbb86b38c2d886e908b0f130e069aaf | 325 | py | Python | prev_exams_and_ans/2018ccc/q3_are_we_there_yet/are_we_there_yet.py | Yueleng/ccc_cco_material | e064a76a8bdc07cbfdba3ec8f6849cc1b90317e0 | [
"MIT"
] | null | null | null | prev_exams_and_ans/2018ccc/q3_are_we_there_yet/are_we_there_yet.py | Yueleng/ccc_cco_material | e064a76a8bdc07cbfdba3ec8f6849cc1b90317e0 | [
"MIT"
] | null | null | null | prev_exams_and_ans/2018ccc/q3_are_we_there_yet/are_we_there_yet.py | Yueleng/ccc_cco_material | e064a76a8bdc07cbfdba3ec8f6849cc1b90317e0 | [
"MIT"
] | null | null | null | import sys
input = sys.stdin.readline
distance = [int(s) for s in input().split()]
for i in range(0, len(distance) + 1):
for j in range(0, len(distance) + 1):
# note that sum([]) = 0 which satifies our expectation.
print(sum(distance[i:j]) if i < j else sum(distance[j:i]), " ", end='')
print()... | 29.545455 | 79 | 0.590769 | import sys
input = sys.stdin.readline
distance = [int(s) for s in input().split()]
for i in range(0, len(distance) + 1):
for j in range(0, len(distance) + 1):
print(sum(distance[i:j]) if i < j else sum(distance[j:i]), " ", end='')
print()
| true | true |
1c4729da299e51dced35f7771e1d6476c0413115 | 2,072 | py | Python | src/opnsense/scripts/systemhealth/fetchData.py | Kipjr/core | 37a1b761d7ee8b0f02fc1daa02dc913e96e04737 | [
"BSD-2-Clause"
] | 2,109 | 2015-01-02T15:42:12.000Z | 2022-03-31T20:16:10.000Z | src/opnsense/scripts/systemhealth/fetchData.py | Kipjr/core | 37a1b761d7ee8b0f02fc1daa02dc913e96e04737 | [
"BSD-2-Clause"
] | 5,452 | 2015-01-03T10:30:09.000Z | 2022-03-31T19:58:33.000Z | src/opnsense/scripts/systemhealth/fetchData.py | Kipjr/core | 37a1b761d7ee8b0f02fc1daa02dc913e96e04737 | [
"BSD-2-Clause"
] | 834 | 2015-01-04T05:29:59.000Z | 2022-03-30T00:45:49.000Z | #!/usr/local/bin/python3
"""
Copyright (c) 2015-2019 Ad Schellevis <ad@opnsense.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain th... | 41.44 | 95 | 0.693533 |
import sys
import glob
import tempfile
import subprocess
import os.path
rrd_reports_dir = '/var/db/rrd'
if len(sys.argv) > 1:
filename = sys.argv[1]
if filename.split('.')[-1] != 'rrd':
filename += '.rrd'
for rrdFilename in glob.glob('%s/*.rrd' % rrd_reports_dir):
if os.path.ba... | true | true |
1c4729ed525f7921854f955b75cff5d38378f20c | 747 | py | Python | 1_languages/python/src/misc/spiral.py | praisetompane/3_programming | dd3e2e89a36a613d895fdbdd9c03845cb648fddf | [
"MIT"
] | null | null | null | 1_languages/python/src/misc/spiral.py | praisetompane/3_programming | dd3e2e89a36a613d895fdbdd9c03845cb648fddf | [
"MIT"
] | null | null | null | 1_languages/python/src/misc/spiral.py | praisetompane/3_programming | dd3e2e89a36a613d895fdbdd9c03845cb648fddf | [
"MIT"
] | null | null | null | import turtle
#note: the horizontal and vertical distance between the sides is constant
#hence (distance + 2)
def spiral(turtle, counter, sides, distance, angle):
if counter == sides: return
else:
turtle.forward(distance)
turtle.right(angle)
spiral(turtle, counter + 1, sides, distance... | 22.636364 | 74 | 0.626506 | import turtle
def spiral(turtle, counter, sides, distance, angle):
if counter == sides: return
else:
turtle.forward(distance)
turtle.right(angle)
spiral(turtle, counter + 1, sides, distance + 2 , angle)
def main():
wn = turtle.Screen()
tess = turtle.Turtle()
tess.color(... | true | true |
1c472a0eb3fa196b00b8c513884f73e6218c1cd3 | 545 | py | Python | var/spack/repos/builtin/packages/py-pydot2/package.py | jeanbez/spack | f4e51ce8f366c85bf5aa0eafe078677b42dae1ba | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | var/spack/repos/builtin/packages/py-pydot2/package.py | jeanbez/spack | f4e51ce8f366c85bf5aa0eafe078677b42dae1ba | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 8 | 2021-11-09T20:28:40.000Z | 2022-03-15T03:26:33.000Z | var/spack/repos/builtin/packages/py-pydot2/package.py | jeanbez/spack | f4e51ce8f366c85bf5aa0eafe078677b42dae1ba | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 2 | 2019-02-08T20:37:20.000Z | 2019-03-31T15:19:26.000Z | # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class PyPydot2(PythonPackage):
"""Python interface to Graphviz's Dot"""
pypi = "pyd... | 30.277778 | 96 | 0.73578 |
from spack.package import *
class PyPydot2(PythonPackage):
pypi = "pydot2/pydot2-1.0.33.tar.gz"
version('1.0.33', sha256='02c0e681a1c437077e2bb2522fb81fa322e53ba7002cfda8b894db0392a1bc9b')
depends_on('py-setuptools', type='build')
depends_on('py-pyparsing', type=('build', 'run'))
| true | true |
1c472b7b277dd66b68dcd06802f358e5dac36e8a | 166 | py | Python | randconv/image/test/testpalindrome.py | jm-begon/randconv | cb7438f5876c18192e8caaf3cafd88e839c26048 | [
"BSD-3-Clause"
] | 1 | 2016-08-01T08:09:28.000Z | 2016-08-01T08:09:28.000Z | randconv/image/test/testpalindrome.py | jm-begon/randconv | cb7438f5876c18192e8caaf3cafd88e839c26048 | [
"BSD-3-Clause"
] | null | null | null | randconv/image/test/testpalindrome.py | jm-begon/randconv | cb7438f5876c18192e8caaf3cafd88e839c26048 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""
test
"""
__author__ = "Begon Jean-Michel <jm.begon@gmail.com>"
__copyright__ = "3-clause BSD License"
__version__ = 'dev'
import nose
| 12.769231 | 53 | 0.650602 |
__author__ = "Begon Jean-Michel <jm.begon@gmail.com>"
__copyright__ = "3-clause BSD License"
__version__ = 'dev'
import nose
| true | true |
1c472b91e69c4fdfd62585e15e4bdb9819785323 | 5,705 | py | Python | tests/support/cptestcase.py | Noah-Huppert/salt | 998c382f5f2c3b4cbf7d96aa6913ada6993909b3 | [
"Apache-2.0"
] | 19 | 2016-01-29T14:37:52.000Z | 2022-03-30T18:08:01.000Z | tests/support/cptestcase.py | Noah-Huppert/salt | 998c382f5f2c3b4cbf7d96aa6913ada6993909b3 | [
"Apache-2.0"
] | 223 | 2016-03-02T16:39:41.000Z | 2022-03-03T12:26:35.000Z | tests/support/cptestcase.py | Noah-Huppert/salt | 998c382f5f2c3b4cbf7d96aa6913ada6993909b3 | [
"Apache-2.0"
] | 64 | 2016-02-04T19:45:26.000Z | 2021-12-15T02:02:31.000Z | # -*- coding: utf-8 -*-
# Copyright (c) 2011-2012, Sylvain Hellegouarch
# All rights reserved.
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright noti... | 39.895105 | 132 | 0.684663 |
from __future__ import absolute_import, print_function, unicode_literals
import cherrypy
import salt.utils.stringutils
from salt.ext import six
from salt.ext.six import BytesIO
from tests.support.case import TestCase
cherrypy.config.update({"environment": "test_suite"})
# if... | true | true |
1c472bcd2028610b858c56c919d0ed52ec7eb5d7 | 4,370 | py | Python | Element3/read_and_run.py | AuckeBos/MLiPPaA | 4b6c563f93e1eb7fc90f66a9a6ada16c07664d71 | [
"MIT"
] | 1 | 2021-06-03T13:23:39.000Z | 2021-06-03T13:23:39.000Z | Element3/read_and_run.py | AuckeBos/MLiPPaA | 4b6c563f93e1eb7fc90f66a9a6ada16c07664d71 | [
"MIT"
] | null | null | null | Element3/read_and_run.py | AuckeBos/MLiPPaA | 4b6c563f93e1eb7fc90f66a9a6ada16c07664d71 | [
"MIT"
] | null | null | null | import argparse
import csv
import numpy as np
import pandas as pd
from tensorflow.keras.models import load_model
import Element2.Evaluator
from Element2.BaseClassification import BaseClassifier
# As computed by the training data distribution (RebalanceTrainVal=False)
multi_train_prior = np.array([.5, .125, .125, .12... | 50.813953 | 195 | 0.701373 | import argparse
import csv
import numpy as np
import pandas as pd
from tensorflow.keras.models import load_model
import Element2.Evaluator
from Element2.BaseClassification import BaseClassifier
multi_train_prior = np.array([.5, .125, .125, .125, .125])
binary_train_prior = np.array([.5, .5])
multi_test_prior = np.... | true | true |
1c472de12a097cc05b9c30c9abaaff2a7aa12279 | 376 | py | Python | product/urls.py | benilyxdd/shop-web-django | 93a9549faad2703118eb2b34be3053408e7297fa | [
"MIT"
] | null | null | null | product/urls.py | benilyxdd/shop-web-django | 93a9549faad2703118eb2b34be3053408e7297fa | [
"MIT"
] | null | null | null | product/urls.py | benilyxdd/shop-web-django | 93a9549faad2703118eb2b34be3053408e7297fa | [
"MIT"
] | null | null | null | from django.urls import path
from .views import api_products, modify_products_gui, create_product, change_product, delete_product
urlpatterns = [
path('api/', api_products),
path('create/', create_product.as_view()),
path('modify/<int:id>', change_product.as_view()),
path('delete/<int:id>', delete_prod... | 34.181818 | 100 | 0.720745 | from django.urls import path
from .views import api_products, modify_products_gui, create_product, change_product, delete_product
urlpatterns = [
path('api/', api_products),
path('create/', create_product.as_view()),
path('modify/<int:id>', change_product.as_view()),
path('delete/<int:id>', delete_prod... | true | true |
1c472e6ac9ef7ae408c43df4b67c727e1444cf81 | 2,158 | py | Python | swap_user/otp/sites.py | artinnok/django-swap-user | f2c02b9fc5829651a6dab9c6d053dfe2425e2266 | [
"MIT"
] | null | null | null | swap_user/otp/sites.py | artinnok/django-swap-user | f2c02b9fc5829651a6dab9c6d053dfe2425e2266 | [
"MIT"
] | null | null | null | swap_user/otp/sites.py | artinnok/django-swap-user | f2c02b9fc5829651a6dab9c6d053dfe2425e2266 | [
"MIT"
] | null | null | null | from typing import Optional
from django.contrib import admin
from django.http import HttpRequest
from django.urls import path
from django.utils.decorators import method_decorator
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import csrf_protect
from django.views.decorators.deb... | 29.561644 | 84 | 0.663114 | from typing import Optional
from django.contrib import admin
from django.http import HttpRequest
from django.urls import path
from django.utils.decorators import method_decorator
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import csrf_protect
from django.views.decorators.deb... | true | true |
1c472f3dda2439d6bf85f18ef27843b91bd17e74 | 3,914 | py | Python | manager/master/msgCell.py | Tootooroo/VerManager | 65a37ed4f864c8d6adeade52582315aeff901fbe | [
"MIT"
] | 2 | 2020-03-20T20:04:54.000Z | 2021-03-18T12:03:54.000Z | manager/master/msgCell.py | Tootooroo/VerManager | 65a37ed4f864c8d6adeade52582315aeff901fbe | [
"MIT"
] | null | null | null | manager/master/msgCell.py | Tootooroo/VerManager | 65a37ed4f864c8d6adeade52582315aeff901fbe | [
"MIT"
] | null | null | null | # MIT License
#
# Copyright (c) 2020 Gcom
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish... | 31.312 | 83 | 0.653807 |
import abc
import asyncio
import typing as T
from client.messages import Message
from manager.master.exceptions import UNABLE_SEND_MSG_TO_PROXY, \
MSG_WRAPPER_CFG_NOT_EXISTS
import manager.master.proxy_configs as ProxyCfg
class MsgWrapper:
ON = 'ON'
OFF = 'OFF'
def __init__(sel... | true | true |
1c473066912309ccccaf9739adb7a434c66c2b09 | 5,228 | py | Python | tests/unittests/test_rpc_messages.py | gohar94/azure-functions-python-worker | 4322e53ddbcc1eea40c1b061b42653336d9003f6 | [
"MIT"
] | null | null | null | tests/unittests/test_rpc_messages.py | gohar94/azure-functions-python-worker | 4322e53ddbcc1eea40c1b061b42653336d9003f6 | [
"MIT"
] | null | null | null | tests/unittests/test_rpc_messages.py | gohar94/azure-functions-python-worker | 4322e53ddbcc1eea40c1b061b42653336d9003f6 | [
"MIT"
] | null | null | null | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import os
import subprocess
import sys
import tempfile
import typing
import unittest
from azure_functions_worker import protos
from azure_functions_worker import testutils
class TestGRPC(testutils.AsyncTestCase):
pre_te... | 39.014925 | 79 | 0.624713 |
import os
import subprocess
import sys
import tempfile
import typing
import unittest
from azure_functions_worker import protos
from azure_functions_worker import testutils
class TestGRPC(testutils.AsyncTestCase):
pre_test_env = os.environ.copy()
pre_test_cwd = os.getcwd()
def _reset_environ(self):
... | true | true |
1c47307f5960a397db57f17a221cc66eb469d0a0 | 9,974 | py | Python | tests/test_commands.py | LevitatingBusinessMan/mopidy-mpd | a8c4debc139020fbb17066b66a746644a915296c | [
"Apache-2.0"
] | 68 | 2019-12-24T22:09:05.000Z | 2022-03-06T03:56:39.000Z | tests/test_commands.py | LevitatingBusinessMan/mopidy-mpd | a8c4debc139020fbb17066b66a746644a915296c | [
"Apache-2.0"
] | 53 | 2019-12-20T23:11:11.000Z | 2022-01-30T11:20:41.000Z | tests/test_commands.py | LevitatingBusinessMan/mopidy-mpd | a8c4debc139020fbb17066b66a746644a915296c | [
"Apache-2.0"
] | 21 | 2019-12-20T23:06:20.000Z | 2022-01-20T05:43:35.000Z | import unittest
from mopidy_mpd import exceptions, protocol
class TestConverts(unittest.TestCase):
def test_integer(self):
assert 123 == protocol.INT("123")
assert (-123) == protocol.INT("-123")
assert 123 == protocol.INT("+123")
self.assertRaises(ValueError, protocol.INT, "3.14")... | 36.534799 | 78 | 0.641267 | import unittest
from mopidy_mpd import exceptions, protocol
class TestConverts(unittest.TestCase):
def test_integer(self):
assert 123 == protocol.INT("123")
assert (-123) == protocol.INT("-123")
assert 123 == protocol.INT("+123")
self.assertRaises(ValueError, protocol.INT, "3.14")... | true | true |
1c4730ff99573a9d528ea79ff21a35220231baae | 1,563 | py | Python | tests/test_healpix_binning.py | erykoff/skyproj | f00af06df032c6956e9ce191b55b173eb5415b3a | [
"BSD-3-Clause"
] | 6 | 2022-02-22T15:44:35.000Z | 2022-03-31T17:14:18.000Z | tests/test_healpix_binning.py | erykoff/skyproj | f00af06df032c6956e9ce191b55b173eb5415b3a | [
"BSD-3-Clause"
] | 15 | 2022-01-11T22:06:16.000Z | 2022-03-07T21:49:48.000Z | tests/test_healpix_binning.py | LSSTDESC/skyproj | c1e3365e958b2bd99e72e4e053da6b0ddaceb2b2 | [
"BSD-3-Clause"
] | null | null | null | import os
import numpy as np
import healpy as hp
import matplotlib
matplotlib.use("Agg")
from matplotlib.testing.compare import compare_images, ImageComparisonFailure # noqa: E402
import matplotlib.pyplot as plt # noqa: E402
import skyproj # noqa: E402
ROOT = os.path.abspath(os.path.dirname(__file__))
def te... | 28.944444 | 91 | 0.684581 | import os
import numpy as np
import healpy as hp
import matplotlib
matplotlib.use("Agg")
from matplotlib.testing.compare import compare_images, ImageComparisonFailure
import matplotlib.pyplot as plt
import skyproj
ROOT = os.path.abspath(os.path.dirname(__file__))
def test_healpix_binning(tmp_path):
pl... | true | true |
1c47316fc571cbecdc8de42cb48fe3b2c354deab | 278 | py | Python | cap2/pangea/constants.py | nanusefue/CAP2-1 | 670b343ac7629fe0e64e86263ae420b01952f427 | [
"MIT"
] | 9 | 2020-07-10T15:45:12.000Z | 2022-01-19T10:44:13.000Z | cap2/pangea/constants.py | nanusefue/CAP2-1 | 670b343ac7629fe0e64e86263ae420b01952f427 | [
"MIT"
] | 14 | 2020-06-15T16:04:54.000Z | 2022-03-12T01:05:47.000Z | cap2/pangea/constants.py | nanusefue/CAP2-1 | 670b343ac7629fe0e64e86263ae420b01952f427 | [
"MIT"
] | 5 | 2021-01-05T01:26:48.000Z | 2022-01-23T11:20:49.000Z |
CAP_WORK_ORDER_PROTO_NAME = 'cap'
WORK_ORDER_PROTOS = {
'metasub_cap_qc': ('fast', '435ffcd4-a582-47d8-97b6-bf4f3a42aec5'), # TODO no harcoded UUIDs
'pre': ('pre', '62a7b78f-cb95-42d6-b956-68b45abe47f5'),
'reads': ('reads', 'f6949311-f60b-44b9-8fe4-22df2060a379'),
} | 34.75 | 94 | 0.697842 |
CAP_WORK_ORDER_PROTO_NAME = 'cap'
WORK_ORDER_PROTOS = {
'metasub_cap_qc': ('fast', '435ffcd4-a582-47d8-97b6-bf4f3a42aec5'),
'pre': ('pre', '62a7b78f-cb95-42d6-b956-68b45abe47f5'),
'reads': ('reads', 'f6949311-f60b-44b9-8fe4-22df2060a379'),
} | true | true |
1c4731b7d21eb89aaf132cf4faedc6cb3e060ee6 | 11,999 | py | Python | ament_cpplint/ament_cpplint/main.py | mjbogusz/ament_lint | 1f5c6bba4c5180aa8d2b593c6f3aa8ee1309d36a | [
"Apache-2.0"
] | 23 | 2015-07-08T05:42:24.000Z | 2022-03-14T02:13:01.000Z | ament_cpplint/ament_cpplint/main.py | mjbogusz/ament_lint | 1f5c6bba4c5180aa8d2b593c6f3aa8ee1309d36a | [
"Apache-2.0"
] | 292 | 2015-03-06T20:11:45.000Z | 2022-03-31T22:30:41.000Z | ament_cpplint/ament_cpplint/main.py | mjbogusz/ament_lint | 1f5c6bba4c5180aa8d2b593c6f3aa8ee1309d36a | [
"Apache-2.0"
] | 71 | 2016-05-24T01:24:54.000Z | 2022-03-23T07:42:41.000Z | #!/usr/bin/env python3
# Copyright 2014-2015 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... | 34.479885 | 84 | 0.5958 |
import argparse
import glob
import os
import re
import sys
import time
from xml.sax.saxutils import escape
from xml.sax.saxutils import quoteattr
from ament_cpplint import cpplint
from ament_cpplint.cpplint import _cpplint_state
from ament_cpplint.cpplint import ParseArguments
from ament_cpplint.cpplin... | true | true |
1c4731f7bfa323ac3060b8de0e3d2a54c42b64d4 | 91 | py | Python | docs/tests/E0101.py | mrfyda/codacy-pylint-python3 | e360f6c0407edebe274835d3a881d67e96adf8ba | [
"Apache-2.0"
] | 17 | 2016-01-26T13:30:04.000Z | 2022-03-06T21:11:42.000Z | docs/tests/E0101.py | mrfyda/codacy-pylint-python3 | e360f6c0407edebe274835d3a881d67e96adf8ba | [
"Apache-2.0"
] | 50 | 2019-08-14T16:14:45.000Z | 2022-03-31T11:00:50.000Z | docs/tests/E0101.py | mrfyda/codacy-pylint-python3 | e360f6c0407edebe274835d3a881d67e96adf8ba | [
"Apache-2.0"
] | 15 | 2015-11-18T12:18:50.000Z | 2021-01-17T22:21:41.000Z | ##Patterns: E0101
class Test():
##Err: E0101
def __init__(self):
return 1 | 13 | 23 | 0.571429 |
init__(self):
return 1 | true | true |
1c47321c926529faca5535e6541d02617674a33d | 4,340 | py | Python | lg_media/scripts/browser_launcher.py | FuriousJulius/lg_ros_nodes | 15a84c5022ab2f5b038d11a5589cd4a34010b1d6 | [
"Apache-2.0"
] | 16 | 2015-10-10T11:55:37.000Z | 2022-02-24T22:47:48.000Z | lg_media/scripts/browser_launcher.py | FuriousJulius/lg_ros_nodes | 15a84c5022ab2f5b038d11a5589cd4a34010b1d6 | [
"Apache-2.0"
] | 292 | 2015-09-29T21:59:53.000Z | 2022-03-31T15:59:31.000Z | lg_media/scripts/browser_launcher.py | constantegonzalez/lg_ros_nodes | 1c7b08c42e90205922602c86805285508d1b7971 | [
"Apache-2.0"
] | 5 | 2017-05-03T06:22:43.000Z | 2021-08-19T16:54:14.000Z | #!/usr/bin/env python3
import rospy
from lg_msg_defs.msg import AdhocBrowsers, AdhocBrowser
from lg_common import AdhocBrowserPool
from lg_msg_defs.msg import AdhocMedias
from lg_common.helpers import add_url_params, make_soft_relaunch_callback
from urllib.request import url2pathname
from lg_common.helpers import run_... | 40.560748 | 96 | 0.647696 |
import rospy
from lg_msg_defs.msg import AdhocBrowsers, AdhocBrowser
from lg_common import AdhocBrowserPool
from lg_msg_defs.msg import AdhocMedias
from lg_common.helpers import add_url_params, make_soft_relaunch_callback
from urllib.request import url2pathname
from lg_common.helpers import run_with_influx_exception_... | true | true |
1c4732f965a4bbbf1360a297ce9591045ac03ef5 | 3,902 | py | Python | chesstab/gui/cqlrow.py | RogerMarsh/chesstab | 01d375dc6bf025b621612a84513e55c4640a78ad | [
"BSD-3-Clause"
] | null | null | null | chesstab/gui/cqlrow.py | RogerMarsh/chesstab | 01d375dc6bf025b621612a84513e55c4640a78ad | [
"BSD-3-Clause"
] | null | null | null | chesstab/gui/cqlrow.py | RogerMarsh/chesstab | 01d375dc6bf025b621612a84513e55c4640a78ad | [
"BSD-3-Clause"
] | null | null | null | # cqlrow.py
# Copyright 2016 Roger Marsh
# Licence: See LICENCE (BSD licence)
"""Create widgets to display Chess Query Language (ChessQL) statement records.
"""
import tkinter
from solentware_grid.gui.datarow import (
GRID_COLUMNCONFIGURE,
GRID_CONFIGURE,
WIDGET_CONFIGURE,
WIDGET,
ROW,
)
from .d... | 28.275362 | 78 | 0.6143 |
import tkinter
from solentware_grid.gui.datarow import (
GRID_COLUMNCONFIGURE,
GRID_CONFIGURE,
WIDGET_CONFIGURE,
WIDGET,
ROW,
)
from .datarow import DataRow
from ..core.chessrecord import ChessDBrecordPartial
from .cqldbedit import CQLDbEdit
from .cqldbdelete import CQLDbDelete
from .cqldbsho... | true | true |
1c4733f6e497d4ac869d53a3d5bd699077b4b8f3 | 1,267 | py | Python | wav2rec/_utils/printing.py | TariqAHassan/wav2rec | 8d3f33291f246d80a4935cf7aa2cc75f110d9c15 | [
"MIT"
] | 10 | 2021-11-12T03:58:05.000Z | 2022-02-19T08:13:30.000Z | wav2rec/_utils/printing.py | TariqAHassan/wav2rec | 8d3f33291f246d80a4935cf7aa2cc75f110d9c15 | [
"MIT"
] | null | null | null | wav2rec/_utils/printing.py | TariqAHassan/wav2rec | 8d3f33291f246d80a4935cf7aa2cc75f110d9c15 | [
"MIT"
] | 1 | 2021-11-12T03:58:05.000Z | 2021-11-12T03:58:05.000Z | """
Printing Utils
References:
* https://github.com/TariqAHassan/alsek/blob/master/tests/_utils/test_printing.py
"""
from datetime import datetime
from typing import Any, Dict, Optional
def _format_value(value: Any) -> Any:
if isinstance(value, (str, datetime)):
return f"'{value}'"
... | 28.795455 | 89 | 0.631413 | from datetime import datetime
from typing import Any, Dict, Optional
def _format_value(value: Any) -> Any:
if isinstance(value, (str, datetime)):
return f"'{value}'"
else:
return value
def _format_params(params: Dict[str, Any], join_on: str) -> str:
return join_on.join((f"{k}={_format_va... | true | true |
1c4734480bf8310ef21253d0538b10a554dce1b8 | 1,105 | py | Python | phabricator/komand_phabricator/actions/status/schema.py | xhennessy-r7/insightconnect-plugins | 59268051313d67735b5dd3a30222eccb92aca8e9 | [
"MIT"
] | null | null | null | phabricator/komand_phabricator/actions/status/schema.py | xhennessy-r7/insightconnect-plugins | 59268051313d67735b5dd3a30222eccb92aca8e9 | [
"MIT"
] | null | null | null | phabricator/komand_phabricator/actions/status/schema.py | xhennessy-r7/insightconnect-plugins | 59268051313d67735b5dd3a30222eccb92aca8e9 | [
"MIT"
] | null | null | null | # GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Input:
ID = "id"
STATUS = "status"
class Output:
MESSAGE = "message"
class StatusInput(komand.Input):
schema = json.loads("""
{
"type": "object",
"title": "Variables",
"properties": {
"id": {
"type":... | 17.539683 | 73 | 0.538462 |
import komand
import json
class Input:
ID = "id"
STATUS = "status"
class Output:
MESSAGE = "message"
class StatusInput(komand.Input):
schema = json.loads("""
{
"type": "object",
"title": "Variables",
"properties": {
"id": {
"type": "string",
"title": "ID",
"... | true | true |
1c47366623f38c145fc92b7022d4d60a8eea6ccf | 248 | py | Python | dslrpp/analysis/__init__.py | s-jevtic/DSLR-photometry-pipeline | d239b48ab13c3c95ff8da363ea90ac6dbde1efe5 | [
"MIT"
] | null | null | null | dslrpp/analysis/__init__.py | s-jevtic/DSLR-photometry-pipeline | d239b48ab13c3c95ff8da363ea90ac6dbde1efe5 | [
"MIT"
] | null | null | null | dslrpp/analysis/__init__.py | s-jevtic/DSLR-photometry-pipeline | d239b48ab13c3c95ff8da363ea90ac6dbde1efe5 | [
"MIT"
] | null | null | null | """
"""
from .photometry import SNR, instrumental_flux, lightcurve, save_lcData
from .period import periodogram, est_period
__all__ = [
"SNR", "instrumental_flux", "lightcurve", "save_lcData",
"periodogram", "est_period",
]
| 27.555556 | 71 | 0.673387 | from .photometry import SNR, instrumental_flux, lightcurve, save_lcData
from .period import periodogram, est_period
__all__ = [
"SNR", "instrumental_flux", "lightcurve", "save_lcData",
"periodogram", "est_period",
]
| true | true |
1c473726b38cc42504f78969a255f497d6a4c91b | 7,808 | py | Python | ropper/loaders/loader.py | cbayet/Ropper | 66adeb0a1d4322ced69643c3be2552c057d116d2 | [
"BSD-3-Clause"
] | 1,502 | 2015-01-07T09:11:08.000Z | 2022-03-29T10:08:26.000Z | ropper/loaders/loader.py | cbayet/Ropper | 66adeb0a1d4322ced69643c3be2552c057d116d2 | [
"BSD-3-Clause"
] | 126 | 2015-03-10T15:32:26.000Z | 2022-03-03T08:30:10.000Z | ropper/loaders/loader.py | cbayet/Ropper | 66adeb0a1d4322ced69643c3be2552c057d116d2 | [
"BSD-3-Clause"
] | 214 | 2015-03-10T00:17:16.000Z | 2022-03-19T07:04:08.000Z | # coding=utf-8
# Copyright 2018 Sascha Schirra
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following di... | 28.49635 | 105 | 0.632813 |
from ropper.common.abstract import *
from ctypes import *
from ropper.common.enum import Enum
from struct import pack_into
from ropper.common.error import *
from ropper.arch import *
from hashlib import sha256
import re
class Type(Enum):
_enum_ = 'ELF PE MACH_O RAW NONE'
class DataCont... | true | true |
1c4737df2efb759c6d135e0d72ca30a3e78a147a | 4,871 | py | Python | _unittests/ut_notebook/test_dynamic_cs.py | sdpython/csharpyml | f814af89c5b988924a7f31fe71ec6eb515292070 | [
"MIT"
] | 4 | 2018-06-07T06:34:32.000Z | 2020-02-12T17:39:58.000Z | _unittests/ut_notebook/test_dynamic_cs.py | sdpython/csharpyml | f814af89c5b988924a7f31fe71ec6eb515292070 | [
"MIT"
] | 13 | 2018-05-21T23:06:58.000Z | 2018-12-30T17:57:11.000Z | _unittests/ut_notebook/test_dynamic_cs.py | sdpython/csharpyml | f814af89c5b988924a7f31fe71ec6eb515292070 | [
"MIT"
] | null | null | null | """
@brief test log(time=2s)
"""
import sys
import os
import unittest
from sklearn import datasets
import pandas
from pyquickhelper.pycode import ExtTestCase, get_temp_folder
try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.... | 30.829114 | 112 | 0.485116 | import sys
import os
import unittest
from sklearn import datasets
import pandas
from pyquickhelper.pycode import ExtTestCase, get_temp_folder
try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
... | true | true |
1c47385da5e1df91f69b6c3c9a480257a81f7483 | 705 | py | Python | repos/system_upgrade/el7toel8/actors/opensshprotocolcheck/actor.py | sm00th/leapp-repository | 1c171ec3a5f9260a3c6f84a9b15cad78a875ac61 | [
"Apache-2.0"
] | 21 | 2018-11-20T15:58:39.000Z | 2022-03-15T19:57:24.000Z | repos/system_upgrade/el7toel8/actors/opensshprotocolcheck/actor.py | sm00th/leapp-repository | 1c171ec3a5f9260a3c6f84a9b15cad78a875ac61 | [
"Apache-2.0"
] | 732 | 2018-11-21T18:33:26.000Z | 2022-03-31T16:16:24.000Z | repos/system_upgrade/el7toel8/actors/opensshprotocolcheck/actor.py | sm00th/leapp-repository | 1c171ec3a5f9260a3c6f84a9b15cad78a875ac61 | [
"Apache-2.0"
] | 85 | 2018-11-20T17:55:00.000Z | 2022-03-29T09:40:31.000Z | from leapp.actors import Actor
from leapp.libraries.actor import opensshprotocolcheck
from leapp.models import Report, OpenSshConfig
from leapp.tags import ChecksPhaseTag, IPUWorkflowTag
class OpenSshProtocolCheck(Actor):
"""
Protocol configuration option was removed.
Check the value of Protocol in OpenS... | 30.652174 | 72 | 0.741844 | from leapp.actors import Actor
from leapp.libraries.actor import opensshprotocolcheck
from leapp.models import Report, OpenSshConfig
from leapp.tags import ChecksPhaseTag, IPUWorkflowTag
class OpenSshProtocolCheck(Actor):
name = 'open_ssh_protocol'
consumes = (OpenSshConfig, )
produces = (Report, )
t... | true | true |
1c473885e4c622750632dab97a746f613fabe1e6 | 4,575 | py | Python | CIM16/IEC61970/Informative/InfGMLSupport/GmlSymbol.py | MaximeBaudette/PyCIM | d68ee5ccfc1d32d44c5cd09fb173142fb5ff4f14 | [
"MIT"
] | null | null | null | CIM16/IEC61970/Informative/InfGMLSupport/GmlSymbol.py | MaximeBaudette/PyCIM | d68ee5ccfc1d32d44c5cd09fb173142fb5ff4f14 | [
"MIT"
] | null | null | null | CIM16/IEC61970/Informative/InfGMLSupport/GmlSymbol.py | MaximeBaudette/PyCIM | d68ee5ccfc1d32d44c5cd09fb173142fb5ff4f14 | [
"MIT"
] | 1 | 2021-04-02T18:04:49.000Z | 2021-04-02T18:04:49.000Z | # Copyright (C) 2010-2011 Richard Lincoln
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish... | 44.417476 | 353 | 0.695738 |
from CIM16.IEC61970.Core.IdentifiedObject import IdentifiedObject
class GmlSymbol(IdentifiedObject):
def __init__(self, version='', level='', type='', GmlFeatureStyles=None, GmlBaseSymbol=None, *args, **kw_args):
self.version = version
self.level = level
... | true | true |
1c4739397755e22e44590763ca56a2172d9a5609 | 1,896 | py | Python | jina/executors/crafters/__init__.py | robertjrodger/jina | 3bf8c1578f4f1a39b1c154705a535c52e1490141 | [
"Apache-2.0"
] | null | null | null | jina/executors/crafters/__init__.py | robertjrodger/jina | 3bf8c1578f4f1a39b1c154705a535c52e1490141 | [
"Apache-2.0"
] | 2 | 2021-02-15T01:40:38.000Z | 2021-02-15T02:00:21.000Z | jina/executors/crafters/__init__.py | robertjrodger/jina | 3bf8c1578f4f1a39b1c154705a535c52e1490141 | [
"Apache-2.0"
] | null | null | null | __copyright__ = "Copyright (c) 2020 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"
import inspect
from typing import Dict
from .. import BaseExecutor
from ...helper import typename
class BaseCrafter(BaseExecutor):
"""
A :class:`BaseCrafter` transforms the content of `Document`.
It can... | 37.92 | 123 | 0.6577 | __copyright__ = "Copyright (c) 2020 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"
import inspect
from typing import Dict
from .. import BaseExecutor
from ...helper import typename
class BaseCrafter(BaseExecutor):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)... | true | true |
1c473c05bff8aec499bf1749a85df208a69118a7 | 11,036 | py | Python | detect_board.py | yashpatel5400/ARia | 1f9ad25f943f5b8859a80470715be8698863b2f8 | [
"MIT"
] | null | null | null | detect_board.py | yashpatel5400/ARia | 1f9ad25f943f5b8859a80470715be8698863b2f8 | [
"MIT"
] | null | null | null | detect_board.py | yashpatel5400/ARia | 1f9ad25f943f5b8859a80470715be8698863b2f8 | [
"MIT"
] | null | null | null | import numpy as np
import cv2
def rectify(h):
if h.shape[0] * h.shape[1] != 8:
return None
h = h.reshape((4,2))
hnew = np.zeros((4,2))
add = h.sum(1)
hnew[0] = h[np.argmin(add)]
hnew[2] = h[np.argmax(add)]
diff = np.diff(h,axis=1)
hnew[1] = h[np.argmin(diff)]
hnew[3] = h[... | 41.961977 | 233 | 0.631026 | import numpy as np
import cv2
def rectify(h):
if h.shape[0] * h.shape[1] != 8:
return None
h = h.reshape((4,2))
hnew = np.zeros((4,2))
add = h.sum(1)
hnew[0] = h[np.argmin(add)]
hnew[2] = h[np.argmax(add)]
diff = np.diff(h,axis=1)
hnew[1] = h[np.argmin(diff)]
hnew[3] = h[... | true | true |
1c473c12193e06e2a39525eaa752bdd46ae838b4 | 4,930 | py | Python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/aio/operations_async/_express_route_service_providers_operations_async.py | LianwMS/azure-sdk-for-python | 612d7bca9de86ee1bd1fa59291d7bf897ba9213f | [
"MIT"
] | 2 | 2019-05-17T21:24:53.000Z | 2020-02-12T11:13:42.000Z | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/aio/operations_async/_express_route_service_providers_operations_async.py | LianwMS/azure-sdk-for-python | 612d7bca9de86ee1bd1fa59291d7bf897ba9213f | [
"MIT"
] | 15 | 2019-07-12T18:18:04.000Z | 2019-07-25T20:55:51.000Z | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/aio/operations_async/_express_route_service_providers_operations_async.py | LianwMS/azure-sdk-for-python | 612d7bca9de86ee1bd1fa59291d7bf897ba9213f | [
"MIT"
] | 2 | 2020-05-21T22:51:22.000Z | 2020-05-26T20:53:01.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 ... | 46.509434 | 135 | 0.669777 |
from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar
import warnings
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineRespo... | true | true |
1c473d201736fc5a4253bb86984a126ba886d2b1 | 463 | py | Python | services/core-api/tests/parties/party_appt/resources/test_mine_party_appt_type_resource.py | bcgov/mds | 6c427a66a5edb4196222607291adef8fd6677038 | [
"Apache-2.0"
] | 25 | 2018-07-09T19:04:37.000Z | 2022-03-15T17:27:10.000Z | services/core-api/tests/parties/party_appt/resources/test_mine_party_appt_type_resource.py | areyeslo/mds | e8c38e593e09b78e2a57009c0d003d6c4bfa32e6 | [
"Apache-2.0"
] | 983 | 2018-04-25T20:08:07.000Z | 2022-03-31T21:45:20.000Z | services/core-api/tests/parties/party_appt/resources/test_mine_party_appt_type_resource.py | areyeslo/mds | e8c38e593e09b78e2a57009c0d003d6c4bfa32e6 | [
"Apache-2.0"
] | 58 | 2018-05-15T22:35:50.000Z | 2021-11-29T19:40:52.000Z | import json
from app.api.parties.party_appt.models.mine_party_appt_type import MinePartyAppointmentType
# GET
def test_get_mine_party_appt_type(test_client, db_session, auth_headers):
get_resp = test_client.get(
'/parties/mines/relationship-types', headers=auth_headers['full_auth_header'])
get_data =... | 35.615385 | 91 | 0.779698 | import json
from app.api.parties.party_appt.models.mine_party_appt_type import MinePartyAppointmentType
def test_get_mine_party_appt_type(test_client, db_session, auth_headers):
get_resp = test_client.get(
'/parties/mines/relationship-types', headers=auth_headers['full_auth_header'])
get_data = json... | true | true |
1c473d39b2de3a119d3f5e5e4c9bb77889b782d6 | 923 | py | Python | setup.py | nolimitcarter/stock-mirror | 8bbc483af01f2d05d6f929d861a023e250500c8e | [
"RSA-MD"
] | 1 | 2021-02-27T18:59:42.000Z | 2021-02-27T18:59:42.000Z | setup.py | nolimitcarter/stock-mirror | 8bbc483af01f2d05d6f929d861a023e250500c8e | [
"RSA-MD"
] | null | null | null | setup.py | nolimitcarter/stock-mirror | 8bbc483af01f2d05d6f929d861a023e250500c8e | [
"RSA-MD"
] | 1 | 2021-02-21T04:21:40.000Z | 2021-02-21T04:21:40.000Z | #!/usr/bin/python
import os
import sys
from setuptools import setup, find_packages
# Must be ran as root or as sudo
if os.getuid() != 0:
print('ERROR: Need to run as root')
sys.exit(1)
# Install the requirements if the system does not have it installed
print('INFO: Checking and installing requirements')
os.s... | 27.969697 | 80 | 0.712893 |
import os
import sys
from setuptools import setup, find_packages
if os.getuid() != 0:
print('ERROR: Need to run as root')
sys.exit(1)
print('INFO: Checking and installing requirements')
os.system('! dpkg -S python-imaging-tk && apt-get -y install python-imaging-tk')
print('INFO: Generating the requireme... | true | true |
1c473d5db17232127b3c528ae791a934a3665187 | 6,500 | py | Python | scripts/export_seqqa.py | philiptzou/hiv-variation | 7ba3ffb1510b5d2b72387a0dead94d81095a1cbc | [
"MIT"
] | null | null | null | scripts/export_seqqa.py | philiptzou/hiv-variation | 7ba3ffb1510b5d2b72387a0dead94d81095a1cbc | [
"MIT"
] | 2 | 2020-02-19T21:49:11.000Z | 2021-04-27T16:48:30.000Z | scripts/export_seqqa.py | hivdb/hiv-variation | 7ba3ffb1510b5d2b72387a0dead94d81095a1cbc | [
"MIT"
] | null | null | null | #! /usr/bin/env python
import csv
import json
from collections import defaultdict
import click
from hivdbql import app
db = app.db
models = app.models
Isolate = models.Isolate
Host = models.Host
Species = models.Species
ClinicalIsolate = models.ClinicalIsolate
Subtype = models.Subtype
Sequence = models.Sequence
Refe... | 31.553398 | 78 | 0.580308 |
import csv
import json
from collections import defaultdict
import click
from hivdbql import app
db = app.db
models = app.models
Isolate = models.Isolate
Host = models.Host
Species = models.Species
ClinicalIsolate = models.ClinicalIsolate
Subtype = models.Subtype
Sequence = models.Sequence
Reference = models.Referen... | true | true |
1c473df0f9c48b185376676de8e91c7a3df4ab2e | 7,762 | py | Python | raspberry_eye/pan_tilt/pan_tilt.py | GalBrandwine/Raspberry_Eye | dbfe2fd4f9a695dc9017007e88fa8a2a13dfbcaa | [
"Apache-2.0"
] | 1 | 2021-07-01T20:57:32.000Z | 2021-07-01T20:57:32.000Z | pan_tilt_tracking/pan_tilt/pan_tilt.py | GalBrandwine/Gimbal_Pi | e2fa465f17474c31c2cbe4be1959924224472e7e | [
"MIT"
] | null | null | null | pan_tilt_tracking/pan_tilt/pan_tilt.py | GalBrandwine/Gimbal_Pi | e2fa465f17474c31c2cbe4be1959924224472e7e | [
"MIT"
] | 3 | 2018-11-22T14:45:08.000Z | 2018-11-26T12:16:02.000Z | #!/usr/bin/env python
"""
================================================
ABElectronics Servo Pi pwm controller | PWM servo controller demo
run with: python demo_servomove.py
================================================
This demo shows how to set the limits of movement on a servo
and then move between those positi... | 32.751055 | 93 | 0.546251 |
import time
try:
from driver.ServoPi import Servo
except ImportError:
print("Failed to import ServoPi from python system path")
print("Importing from parent folder instead")
try:
import sys
sys.path.append("..")
from ServoPi import Servo
except ImportError:
raise ... | true | true |
1c473df1c5ab7f1a3f2a1362c0a5f273fa3b6093 | 1,252 | py | Python | pwd_python/int_search.py | miccaldas/pwd_python | 434a9453e554e1a0195fc78e43b0a2f9b0f7822f | [
"MIT"
] | null | null | null | pwd_python/int_search.py | miccaldas/pwd_python | 434a9453e554e1a0195fc78e43b0a2f9b0f7822f | [
"MIT"
] | null | null | null | pwd_python/int_search.py | miccaldas/pwd_python | 434a9453e554e1a0195fc78e43b0a2f9b0f7822f | [
"MIT"
] | null | null | null | from mysql.connector import connect, Error
from colr import color
import fire
def search_int():
try:
busca = input(color(" What is the id? ", fore="#fe7243"))
conn = connect(host="localhost", user="mic", password="xxxx", database="pwd")
cur = conn.cursor()
query = " SELECT pwdid, s... | 39.125 | 102 | 0.557508 | from mysql.connector import connect, Error
from colr import color
import fire
def search_int():
try:
busca = input(color(" What is the id? ", fore="#fe7243"))
conn = connect(host="localhost", user="mic", password="xxxx", database="pwd")
cur = conn.cursor()
query = " SELECT pwdid, s... | true | true |
1c473f9ba97beb6712e1c41d567868d7db8681e0 | 7,444 | py | Python | sp_experiment/tests/test_utils.py | sappelhoff/sp_psychopy | 79cae80eb920b35fb27a52acfde0eda38b9124b1 | [
"BSD-3-Clause"
] | 1 | 2022-03-11T14:05:31.000Z | 2022-03-11T14:05:31.000Z | sp_experiment/tests/test_utils.py | sappelhoff/sp_psychopy | 79cae80eb920b35fb27a52acfde0eda38b9124b1 | [
"BSD-3-Clause"
] | 8 | 2019-02-12T07:47:47.000Z | 2021-01-25T14:05:05.000Z | sp_experiment/tests/test_utils.py | sappelhoff/sp_psychopy | 79cae80eb920b35fb27a52acfde0eda38b9124b1 | [
"BSD-3-Clause"
] | 2 | 2019-02-19T17:10:43.000Z | 2022-03-11T14:05:32.000Z | """Testing the utility functions."""
import time
import os
import os.path as op
from tempfile import gettempdir
from shutil import rmtree, copyfile
from collections import OrderedDict
import pytest
import numpy as np
import pandas as pd
import sp_experiment
from sp_experiment.define_settings import (EXPECTED_FPS,
... | 34.623256 | 103 | 0.637157 | import time
import os
import os.path as op
from tempfile import gettempdir
from shutil import rmtree, copyfile
from collections import OrderedDict
import pytest
import numpy as np
import pandas as pd
import sp_experiment
from sp_experiment.define_settings import (EXPECTED_FPS,
... | true | true |
1c473f9c6965b22315dbb289eff8247c71bdc790 | 15,497 | py | Python | ldm/data/imagenet.py | samedii/latent-diffusion | f13bf9bf463d95b5a16aeadd2b02abde31f769f8 | [
"MIT"
] | 563 | 2021-12-21T02:26:38.000Z | 2022-03-31T05:54:51.000Z | ldm/data/imagenet.py | samedii/latent-diffusion | f13bf9bf463d95b5a16aeadd2b02abde31f769f8 | [
"MIT"
] | 23 | 2021-12-22T10:00:00.000Z | 2022-03-24T20:43:49.000Z | ldm/data/imagenet.py | samedii/latent-diffusion | f13bf9bf463d95b5a16aeadd2b02abde31f769f8 | [
"MIT"
] | 51 | 2021-12-21T02:27:04.000Z | 2022-03-23T12:30:31.000Z | import os, yaml, pickle, shutil, tarfile, glob
import cv2
import albumentations
import PIL
import numpy as np
import torchvision.transforms.functional as TF
from omegaconf import OmegaConf
from functools import partial
from PIL import Image
from tqdm import tqdm
from torch.utils.data import Dataset, Subset
import tami... | 39.232911 | 115 | 0.600245 | import os, yaml, pickle, shutil, tarfile, glob
import cv2
import albumentations
import PIL
import numpy as np
import torchvision.transforms.functional as TF
from omegaconf import OmegaConf
from functools import partial
from PIL import Image
from tqdm import tqdm
from torch.utils.data import Dataset, Subset
import tami... | true | true |
1c47411f4cf5b0336d56840ed649c1d4c06df542 | 3,892 | py | Python | Inference/src/exit_placement/modules/waspVideo.py | ZSL98/ETBA | 618317698adb9e372fb11dc0c3a01f856e0759b0 | [
"MIT"
] | 1 | 2021-12-01T15:22:44.000Z | 2021-12-01T15:22:44.000Z | Inference/src/run_engine/modules/waspVideo.py | ZSL98/ETBA | 618317698adb9e372fb11dc0c3a01f856e0759b0 | [
"MIT"
] | null | null | null | Inference/src/run_engine/modules/waspVideo.py | ZSL98/ETBA | 618317698adb9e372fb11dc0c3a01f856e0759b0 | [
"MIT"
] | null | null | null | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class _AtrousModule(nn.Module):
def __init__(self, inplanes, planes, kernel_size, padding, dilation, BatchNorm):
super(_AtrousModule, self).__init__()
self.atrous_conv = nn.Conv2d(inplanes, planes, kernel_size=kernel_siz... | 35.706422 | 113 | 0.548304 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class _AtrousModule(nn.Module):
def __init__(self, inplanes, planes, kernel_size, padding, dilation, BatchNorm):
super(_AtrousModule, self).__init__()
self.atrous_conv = nn.Conv2d(inplanes, planes, kernel_size=kernel_siz... | true | true |
1c4741d36aea8c54d0b8b5af19f5e4e2cb552b0c | 2,840 | py | Python | perfkitbenchmarker/linux_packages/mysql80.py | dongbinghua/PerfKitBenchmarker | d3424af4b4d60b4a5c19009b8aee29ceab7132d4 | [
"Apache-2.0"
] | null | null | null | perfkitbenchmarker/linux_packages/mysql80.py | dongbinghua/PerfKitBenchmarker | d3424af4b4d60b4a5c19009b8aee29ceab7132d4 | [
"Apache-2.0"
] | null | null | null | perfkitbenchmarker/linux_packages/mysql80.py | dongbinghua/PerfKitBenchmarker | d3424af4b4d60b4a5c19009b8aee29ceab7132d4 | [
"Apache-2.0"
] | 1 | 2022-02-20T14:46:56.000Z | 2022-02-20T14:46:56.000Z | # Copyright 2020 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 33.809524 | 80 | 0.689085 |
import re
MYSQL_PSWD = 'perfkitbenchmarker'
PACKAGE_NAME = 'mysql'
def YumInstall(vm):
raise NotImplementedError
def AptInstall(vm):
vm.RemoteCommand('wget -c '
'https://repo.mysql.com//mysql-apt-config_0.8.17-1_all.deb')
vm.RemoteCommand('echo mysql-apt-config mysql-apt-co... | true | true |
1c47428ab6ac6df0584b28628f8c4a0146a8c436 | 750 | py | Python | setup.py | lmkoch/logistic-normal | b270811b42adc7037e342c8b039a759460322de3 | [
"MIT"
] | 2 | 2017-10-13T01:03:51.000Z | 2019-05-24T09:46:55.000Z | setup.py | lmkoch/logistic-normal | b270811b42adc7037e342c8b039a759460322de3 | [
"MIT"
] | null | null | null | setup.py | lmkoch/logistic-normal | b270811b42adc7037e342c8b039a759460322de3 | [
"MIT"
] | null | null | null | __author__ = 'lkoch'
from setuptools import setup, find_packages
setup(
# Application name:
name='logisticnormal',
description='Logistic-normal distribution: provides probability density function and parameter estimation',
# Version number (initial):
version="0.1.0",
# Application author d... | 21.428571 | 111 | 0.652 | __author__ = 'lkoch'
from setuptools import setup, find_packages
setup(
name='logisticnormal',
description='Logistic-normal distribution: provides probability density function and parameter estimation',
version="0.1.0",
author='Lisa Koch',
author_email='l.koch@imperial.ac.uk',
... | true | true |
1c47429858f6c243073d4748b736054174321ec4 | 3,595 | py | Python | uhd_restpy/testplatform/sessions/ixnetwork/topology/dhcp6relaytlvprofile_26571057903c7fcd2a20eb10f55be22f.py | Vibaswan/ixnetwork_restpy | 239fedc7050890746cbabd71ea1e91c68d9e5cad | [
"MIT"
] | null | null | null | uhd_restpy/testplatform/sessions/ixnetwork/topology/dhcp6relaytlvprofile_26571057903c7fcd2a20eb10f55be22f.py | Vibaswan/ixnetwork_restpy | 239fedc7050890746cbabd71ea1e91c68d9e5cad | [
"MIT"
] | null | null | null | uhd_restpy/testplatform/sessions/ixnetwork/topology/dhcp6relaytlvprofile_26571057903c7fcd2a20eb10f55be22f.py | Vibaswan/ixnetwork_restpy | 239fedc7050890746cbabd71ea1e91c68d9e5cad | [
"MIT"
] | null | null | null | # MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify,... | 36.683673 | 169 | 0.685953 |
from uhd_restpy.base import Base
from uhd_restpy.files import Files
class Dhcp6RelayTlvProfile(Base):
__slots__ = ()
_SDM_NAME = 'dhcp6RelayTlvProfile'
_SDM_ATT_MAP = {
'Count': 'count',
'DescriptiveName': 'descriptiveName',
'Name': 'name',
}
def __in... | true | true |
1c4742f3efbcd1dd18c5b65e1aabdd9036acc3cf | 8,057 | py | Python | ni_usb_6501.py | hunteddeerweb/NI_USB-6501 | c828ea2e0b2016be909f5083808651ea85c9abe1 | [
"WTFPL"
] | 7 | 2015-02-13T04:52:33.000Z | 2020-01-08T14:42:40.000Z | ni_usb_6501.py | hunteddeerweb/NI_USB-6501 | c828ea2e0b2016be909f5083808651ea85c9abe1 | [
"WTFPL"
] | null | null | null | ni_usb_6501.py | hunteddeerweb/NI_USB-6501 | c828ea2e0b2016be909f5083808651ea85c9abe1 | [
"WTFPL"
] | 4 | 2015-02-13T04:52:37.000Z | 2019-12-18T15:50:11.000Z | #!/usr/bin/python
## coding=utf-8
"""
The ni_usb_6501 is a digital IO module for USB from National Instruments.
Unfortunately their Linux driver is excessively large (>60MB), difficult to install
and doesn't offer off-the-shelf support for python.
This python driver is based on Marc Schutz's pioneer work on c driver
(... | 32.619433 | 116 | 0.601961 |
b_6501 is a digital IO module for USB from National Instruments.
Unfortunately their Linux driver is excessively large (>60MB), difficult to install
and doesn't offer off-the-shelf support for python.
This python driver is based on Marc Schutz's pioneer work on c driver
(https://github.com/schuetzm/ni-usb-6501)
INST... | false | true |
1c4743783996b7abc30c57bd8fb42268e001125c | 437 | py | Python | commerce/auctions/migrations/0007_comment_commenttitle.py | degerahmet/Auctions-Django-Project | d87ac8b730b9d7ab3d4892494be6ca5fd4fe11cb | [
"Apache-2.0"
] | null | null | null | commerce/auctions/migrations/0007_comment_commenttitle.py | degerahmet/Auctions-Django-Project | d87ac8b730b9d7ab3d4892494be6ca5fd4fe11cb | [
"Apache-2.0"
] | null | null | null | commerce/auctions/migrations/0007_comment_commenttitle.py | degerahmet/Auctions-Django-Project | d87ac8b730b9d7ab3d4892494be6ca5fd4fe11cb | [
"Apache-2.0"
] | null | null | null | # Generated by Django 3.1 on 2020-08-21 15:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('auctions', '0006_auto_20200821_1746'),
]
operations = [
migrations.AddField(
model_name='comment',
name='commentTitle'... | 21.85 | 61 | 0.606407 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('auctions', '0006_auto_20200821_1746'),
]
operations = [
migrations.AddField(
model_name='comment',
name='commentTitle',
field=models.CharField(default=... | true | true |
1c47458e561dbae5189c7cf50343fbf91ad93c07 | 132 | py | Python | web/views/auth/__init__.py | arrow2625/atxserver2 | 39280d0a2ec7d84c32005da919941935fd0632db | [
"MIT"
] | null | null | null | web/views/auth/__init__.py | arrow2625/atxserver2 | 39280d0a2ec7d84c32005da919941935fd0632db | [
"MIT"
] | null | null | null | web/views/auth/__init__.py | arrow2625/atxserver2 | 39280d0a2ec7d84c32005da919941935fd0632db | [
"MIT"
] | null | null | null | # coding: utf-8
#
from .openid import OpenIdMixin, AuthError
from .github import GithubOAuth2Mixin
from .google import GoogleMixin
| 18.857143 | 42 | 0.80303 |
from .openid import OpenIdMixin, AuthError
from .github import GithubOAuth2Mixin
from .google import GoogleMixin
| true | true |
1c4747390ffa6d1824d43557a023d590eb857e75 | 22,080 | py | Python | qiskit/ignis/verification/randomized_benchmarking/circuits.py | hodgestar/qiskit-ignis | 0e511df442e864cd0e06efcdd1db7b03c011168b | [
"Apache-2.0"
] | null | null | null | qiskit/ignis/verification/randomized_benchmarking/circuits.py | hodgestar/qiskit-ignis | 0e511df442e864cd0e06efcdd1db7b03c011168b | [
"Apache-2.0"
] | null | null | null | qiskit/ignis/verification/randomized_benchmarking/circuits.py | hodgestar/qiskit-ignis | 0e511df442e864cd0e06efcdd1db7b03c011168b | [
"Apache-2.0"
] | 1 | 2021-04-01T17:28:33.000Z | 2021-04-01T17:28:33.000Z | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modif... | 42.217973 | 79 | 0.550634 |
import copy
import numpy as np
import qiskit
from .Clifford import Clifford
from .clifford_utils import CliffordUtils as clutils
from .dihedral import CNOTDihedral
from .dihedral_utils import DihedralUtils as dutils
def handle_length_multiplier(length_multiplier, len_pattern,
... | true | true |
1c4748aa711a339da4d0853a24e1a562118a999c | 1,347 | py | Python | bokchoy/utils/log.py | ulule/bokchoy | 58afaf325ce275edf5c4a955379afb1cc5eb5de3 | [
"MIT"
] | null | null | null | bokchoy/utils/log.py | ulule/bokchoy | 58afaf325ce275edf5c4a955379afb1cc5eb5de3 | [
"MIT"
] | null | null | null | bokchoy/utils/log.py | ulule/bokchoy | 58afaf325ce275edf5c4a955379afb1cc5eb5de3 | [
"MIT"
] | null | null | null | import six
import logging
class NullHandler(logging.Handler):
def emit(self, record):
pass
def logger_isa(l, p, max=1000):
this, seen = l, set()
for _ in range(max):
if this == p:
return True
else:
if this in seen:
raise RuntimeError(
... | 22.081967 | 70 | 0.603563 | import six
import logging
class NullHandler(logging.Handler):
def emit(self, record):
pass
def logger_isa(l, p, max=1000):
this, seen = l, set()
for _ in range(max):
if this == p:
return True
else:
if this in seen:
raise RuntimeError(
... | true | true |
1c474bb0722209c98d256697379ddc9a21064447 | 14,683 | py | Python | salt/cloud/clouds/vultrpy.py | yuriks/salt | d2a5bd8adddb98ec1718d79384aa13b4f37e8028 | [
"Apache-2.0",
"MIT"
] | 1 | 2020-03-31T22:51:16.000Z | 2020-03-31T22:51:16.000Z | salt/cloud/clouds/vultrpy.py | yuriks/salt | d2a5bd8adddb98ec1718d79384aa13b4f37e8028 | [
"Apache-2.0",
"MIT"
] | null | null | null | salt/cloud/clouds/vultrpy.py | yuriks/salt | d2a5bd8adddb98ec1718d79384aa13b4f37e8028 | [
"Apache-2.0",
"MIT"
] | 1 | 2021-09-30T07:00:01.000Z | 2021-09-30T07:00:01.000Z | # -*- coding: utf-8 -*-
'''
Vultr Cloud Module using python-vultr bindings
==============================================
.. versionadded:: 2016.3.0
The Vultr cloud module is used to control access to the Vultr VPS system.
Use of this module only requires the ``api_key`` parameter.
Set up the cloud configuration at... | 28.236538 | 105 | 0.60914 |
from __future__ import absolute_import, print_function, unicode_literals
import pprint
import logging
import time
import salt.config as config
from salt.ext import six
from salt.ext.six.moves.urllib.parse import urlencode as _urlencode
from salt.exceptions import (
SaltCloudConfigError,
SaltCloudSystemEx... | true | true |
1c474bcbae3af33fdc44d18a2aa1c4f0fe87dcdd | 7,974 | py | Python | scripts/process_perspective.py | dbckz/crossing-the-line | c5debb20e263e03eab9188ce7229753034939964 | [
"MIT"
] | 1 | 2022-02-14T17:11:30.000Z | 2022-02-14T17:11:30.000Z | scripts/process_perspective.py | dbckz/crossing-the-line | c5debb20e263e03eab9188ce7229753034939964 | [
"MIT"
] | null | null | null | scripts/process_perspective.py | dbckz/crossing-the-line | c5debb20e263e03eab9188ce7229753034939964 | [
"MIT"
] | null | null | null | """
Script to evaluate tweets against the Perspective API
How it's used:
* Loads "tweets.csv" files according to 'root_path' and 'day_paths' vars
* Sends one tweet at a time to the API
* Sleeps for 1 second between requests due to API rate-limit
* Appends results to perspective_processed_tweets.csv after every 50 twee... | 34.37069 | 128 | 0.568096 | import os
import time
import numpy as np
import pandas as pd
from googleapiclient import discovery
def get_perspective_client(api_key):
return discovery.build(
"commentanalyzer",
"v1alpha1",
developerKey=api_key,
discoveryServiceUrl="https://commentanalyzer.googleapis.com/$discove... | true | true |
1c474c7f2acba2c62fabc8f02e4bf556a023e101 | 1,066 | py | Python | jesse/indicators/pfe.py | leaiannotti/jesse | 564c54845774891ff3b5a8d3c02cc7cea890ac54 | [
"MIT"
] | 5 | 2021-05-21T07:39:16.000Z | 2021-11-17T11:08:41.000Z | jesse/indicators/pfe.py | leaiannotti/jesse | 564c54845774891ff3b5a8d3c02cc7cea890ac54 | [
"MIT"
] | null | null | null | jesse/indicators/pfe.py | leaiannotti/jesse | 564c54845774891ff3b5a8d3c02cc7cea890ac54 | [
"MIT"
] | 2 | 2021-05-21T10:14:53.000Z | 2021-05-27T04:39:51.000Z | from typing import Union
import numpy as np
import talib
from jesse.helpers import get_candle_source, slice_candles, same_length
def pfe(candles: np.ndarray, period: int = 10, smoothing: int = 5, source_type: str = "close", sequential: bool = False) -> Union[
float, np.ndarray]:
"""
Polarized Fractal Ef... | 31.352941 | 130 | 0.67167 | from typing import Union
import numpy as np
import talib
from jesse.helpers import get_candle_source, slice_candles, same_length
def pfe(candles: np.ndarray, period: int = 10, smoothing: int = 5, source_type: str = "close", sequential: bool = False) -> Union[
float, np.ndarray]:
candles = slice_candles(cand... | true | true |
1c474d6b5e003a2cec79900ccf7c78c070a40e62 | 24,545 | py | Python | lib/model_eval/model_eval_ncnet_adap.py | JiwonCocoder/-Joint-Learning-of-Feature-Extraction-and-Cost-Aggregation-for-Semantic-Matching | b79e0e20fd5a1a9ddc0ffa9d7a92e0ebd21018b9 | [
"MIT"
] | 1 | 2021-07-22T05:18:10.000Z | 2021-07-22T05:18:10.000Z | lib/model_eval/model_eval_ncnet_adap.py | JiwonCocoder/-Joint-Learning-of-Feature-Extraction-and-Cost-Aggregation-for-Semantic-Matching | b79e0e20fd5a1a9ddc0ffa9d7a92e0ebd21018b9 | [
"MIT"
] | null | null | null | lib/model_eval/model_eval_ncnet_adap.py | JiwonCocoder/-Joint-Learning-of-Feature-Extraction-and-Cost-Aggregation-for-Semantic-Matching | b79e0e20fd5a1a9ddc0ffa9d7a92e0ebd21018b9 | [
"MIT"
] | null | null | null | from __future__ import print_function, division
from collections import OrderedDict
import torch
import torch.nn as nn
from torch.autograd import Variable
import torchvision.models as models
import numpy as np
import numpy.matlib
import pickle
from lib.torch_util import Softmax1D
from lib.conv4d import Conv4d
from lib... | 48.992016 | 154 | 0.5989 | from __future__ import print_function, division
from collections import OrderedDict
import torch
import torch.nn as nn
from torch.autograd import Variable
import torchvision.models as models
import numpy as np
import numpy.matlib
import pickle
from lib.torch_util import Softmax1D
from lib.conv4d import Conv4d
from lib... | true | true |
1c474eb2a7180c4b80cf9601418dd0b801e92818 | 1,880 | py | Python | pyleecan/Methods/Slot/HoleM53/check.py | Kelos-Zhu/pyleecan | 368f8379688e31a6c26d2c1cd426f21dfbceff2a | [
"Apache-2.0"
] | 2 | 2019-06-08T15:04:39.000Z | 2020-09-07T13:32:22.000Z | pyleecan/Methods/Slot/HoleM53/check.py | lyhehehe/pyleecan | 421e9a843bf30d796415c77dc934546adffd1cd7 | [
"Apache-2.0"
] | null | null | null | pyleecan/Methods/Slot/HoleM53/check.py | lyhehehe/pyleecan | 421e9a843bf30d796415c77dc934546adffd1cd7 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from numpy import pi
from ....Methods.Slot.Slot.check import SlotCheckError
def check(self):
"""Check that the HoleM53 object is correct
Parameters
----------
self : HoleM53
A HoleM53 object
Returns
-------
None
Raises
-------
S53_Rbo0CheckE... | 20 | 58 | 0.600532 |
from numpy import pi
from ....Methods.Slot.Slot.check import SlotCheckError
def check(self):
if self.W1 is None:
raise S53_NoneError("You must set W1 !")
elif self.W2 is None:
raise S53_NoneError("You must set W2 !")
elif self.W3 is None:
raise S53_NoneError("You must set ... | true | true |
1c47503a63b297ae151dad61e17a23efab7bef67 | 664 | py | Python | bot/bot/base.py | TSPS-Team/Project | b1d83cb7957420b8348939f0a1d36f506095519c | [
"MIT"
] | null | null | null | bot/bot/base.py | TSPS-Team/Project | b1d83cb7957420b8348939f0a1d36f506095519c | [
"MIT"
] | null | null | null | bot/bot/base.py | TSPS-Team/Project | b1d83cb7957420b8348939f0a1d36f506095519c | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
from __future__ import annotations
from server import Interface
from telegram.bot import Bot
class State:
player: Player
app_info: 'AppInfo'
bot: Bot
def __init__(self, player, app_info) -> None:
self.player = player
self.bot = app_info.bot
self.app_inf... | 18.971429 | 51 | 0.621988 |
from __future__ import annotations
from server import Interface
from telegram.bot import Bot
class State:
player: Player
app_info: 'AppInfo'
bot: Bot
def __init__(self, player, app_info) -> None:
self.player = player
self.bot = app_info.bot
self.app_info = app_info
def ... | true | true |
1c47504f9eb14b016fc1dc1c1fcbb3dea481e1a2 | 856 | py | Python | aiofcm/client.py | cyberbudy/aiofcm | 30e66b872aa2e1fc43ef4884fb84ba23b91879c5 | [
"Apache-2.0"
] | 30 | 2017-05-11T08:21:45.000Z | 2021-11-20T13:52:13.000Z | aiofcm/client.py | cyberbudy/aiofcm | 30e66b872aa2e1fc43ef4884fb84ba23b91879c5 | [
"Apache-2.0"
] | 12 | 2017-05-22T16:42:03.000Z | 2021-08-09T11:11:47.000Z | aiofcm/client.py | cyberbudy/aiofcm | 30e66b872aa2e1fc43ef4884fb84ba23b91879c5 | [
"Apache-2.0"
] | 16 | 2017-05-22T11:30:55.000Z | 2021-11-11T09:48:04.000Z | import asyncio
from typing import Optional, NoReturn
from aiofcm.connection import FCMConnectionPool
from aiofcm.common import Message, MessageResponse
from aiofcm.logging import logger
class FCM:
def __init__(self, sender_id, api_key, max_connections=10, loop=None):
# type: (int, str, int, Optional[asyn... | 37.217391 | 80 | 0.679907 | import asyncio
from typing import Optional, NoReturn
from aiofcm.connection import FCMConnectionPool
from aiofcm.common import Message, MessageResponse
from aiofcm.logging import logger
class FCM:
def __init__(self, sender_id, api_key, max_connections=10, loop=None):
self.pool = FCMConnectionPoo... | true | true |
1c4751b7582b662927b44f9a171203401afd2ce3 | 36,054 | py | Python | src/unity/python/turicreate/toolkits/drawing_classifier/drawing_classifier.py | LeeCenY/turicreate | fb2f3bf313e831ceb42a2e10aacda6e472ea8d93 | [
"BSD-3-Clause"
] | null | null | null | src/unity/python/turicreate/toolkits/drawing_classifier/drawing_classifier.py | LeeCenY/turicreate | fb2f3bf313e831ceb42a2e10aacda6e472ea8d93 | [
"BSD-3-Clause"
] | null | null | null | src/unity/python/turicreate/toolkits/drawing_classifier/drawing_classifier.py | LeeCenY/turicreate | fb2f3bf313e831ceb42a2e10aacda6e472ea8d93 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright © 2019 Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can
# be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
import turicreate as _tc
import numpy as _np
import time as _time
from turicreate.t... | 41.632794 | 123 | 0.608837 |
import turicreate as _tc
import numpy as _np
import time as _time
from turicreate.toolkits._model import CustomModel as _CustomModel
from turicreate.toolkits._model import PythonProxy as _PythonProxy
from turicreate.toolkits import evaluation as _evaluation
import turicreate.toolkits._internal_utils as _tkutl
fro... | true | true |
1c47529775227539b203847b8de750e8bd66423a | 407 | py | Python | cont/contapp/models.py | Chuox/Contador_Palabras | 2be98392351536416baa38c90fc62950138d84f1 | [
"MIT"
] | null | null | null | cont/contapp/models.py | Chuox/Contador_Palabras | 2be98392351536416baa38c90fc62950138d84f1 | [
"MIT"
] | null | null | null | cont/contapp/models.py | Chuox/Contador_Palabras | 2be98392351536416baa38c90fc62950138d84f1 | [
"MIT"
] | null | null | null | from django.db import models
from django.urls import reverse
# Create your models here.
class Palabras(models.Model):
url = models.CharField(max_length=99999,default="https://es.wikipedia.org/")
texto = models.CharField(max_length=9999999,default="")
def __str__(self):
return self.url
def... | 31.307692 | 80 | 0.702703 | from django.db import models
from django.urls import reverse
class Palabras(models.Model):
url = models.CharField(max_length=99999,default="https://es.wikipedia.org/")
texto = models.CharField(max_length=9999999,default="")
def __str__(self):
return self.url
def get_absolute_url(self):
... | true | true |
1c4752b75cce49cce05e2ea439f39e239799fab9 | 2,740 | py | Python | mvmv/mvmv.py | movermeyer/mvmv | 23c1c4202b6fb0ef08d6c07975107dcec87d7208 | [
"MIT"
] | 1 | 2019-01-26T16:35:31.000Z | 2019-01-26T16:35:31.000Z | mvmv/mvmv.py | movermeyer/mvmv | 23c1c4202b6fb0ef08d6c07975107dcec87d7208 | [
"MIT"
] | 5 | 2015-01-22T23:24:05.000Z | 2015-01-25T04:49:03.000Z | mvmv/mvmv.py | movermeyer/mvmv | 23c1c4202b6fb0ef08d6c07975107dcec87d7208 | [
"MIT"
] | 3 | 2015-02-25T17:51:41.000Z | 2018-03-04T20:29:59.000Z | import codecs
import mimetypes
import os
import re
import sqlite3
from fuzzywuzzy import fuzz
# common words in movies that we don't want to search the database for
common_words = [
"The",
"Them",
"A",
"An",
"In",
]
# blacklist of common garbage ... | 26.346154 | 80 | 0.55365 | import codecs
import mimetypes
import os
import re
import sqlite3
from fuzzywuzzy import fuzz
common_words = [
"The",
"Them",
"A",
"An",
"In",
]
# blacklist of common garbage that fills up movie names
blacklist = [
"BluRay",
... | true | true |
1c4752ee09bf70092f224bcea3d2adc5f3dcac59 | 708 | py | Python | Switches.py | ProgrammingNerdGit/GBLS | 6fcc3acc4b2797ef7c97f6d88c42cef66f8e7b50 | [
"MIT"
] | 1 | 2020-11-04T18:50:54.000Z | 2020-11-04T18:50:54.000Z | Switches.py | ProgrammingNerdGit/GBLS | 6fcc3acc4b2797ef7c97f6d88c42cef66f8e7b50 | [
"MIT"
] | null | null | null | Switches.py | ProgrammingNerdGit/GBLS | 6fcc3acc4b2797ef7c97f6d88c42cef66f8e7b50 | [
"MIT"
] | null | null | null | class switch:
def __init__(self):
self.cases = []
self.triggered = False
def anyCase(self,func,*args):
if(len(args) <= 1): args += tuple([False])
for i in args:
if(args[i] and not self.triggered):
self.triggered = True
func()
def ex... | 29.5 | 50 | 0.492938 | class switch:
def __init__(self):
self.cases = []
self.triggered = False
def anyCase(self,func,*args):
if(len(args) <= 1): args += tuple([False])
for i in args:
if(args[i] and not self.triggered):
self.triggered = True
func()
def ex... | true | true |
1c4753ab0132900bf58f1a4ebd6b8e9c3f876049 | 924 | bzl | Python | tools/repositories.bzl | guibou/rules_haskell | ea0e70ace2432a490d4ab4c4e54617612466e584 | [
"Apache-2.0"
] | 222 | 2017-11-06T09:01:12.000Z | 2022-03-28T08:24:22.000Z | tools/repositories.bzl | guibou/rules_haskell | ea0e70ace2432a490d4ab4c4e54617612466e584 | [
"Apache-2.0"
] | 1,168 | 2017-11-19T07:43:13.000Z | 2022-03-31T12:40:39.000Z | tools/repositories.bzl | guibou/rules_haskell | ea0e70ace2432a490d4ab4c4e54617612466e584 | [
"Apache-2.0"
] | 94 | 2017-11-17T22:46:37.000Z | 2022-03-15T00:16:56.000Z | """Workspace rules (tools/repositories)"""
load("@rules_haskell//haskell:cabal.bzl", "stack_snapshot")
def rules_haskell_worker_dependencies(**stack_kwargs):
"""Provide all repositories that are necessary for `rules_haskell`'s tools to
function.
"""
excludes = native.existing_rules().keys()
if "r... | 29.806452 | 81 | 0.504329 |
load("@rules_haskell//haskell:cabal.bzl", "stack_snapshot")
def rules_haskell_worker_dependencies(**stack_kwargs):
excludes = native.existing_rules().keys()
if "rules_haskell_worker_dependencies" not in excludes:
stack_snapshot(
name = "rules_haskell_worker_dependencies",
pack... | true | true |
1c4753ba6758fb3028d113543431f667163dd0f4 | 3,120 | py | Python | newproject_1/newproject_1/settings.py | Chinmoy-Prasad-Dutta/scrapy_scraper | 09f6abfc3bcf10ee28f486d83b450c89a07e066e | [
"MIT"
] | null | null | null | newproject_1/newproject_1/settings.py | Chinmoy-Prasad-Dutta/scrapy_scraper | 09f6abfc3bcf10ee28f486d83b450c89a07e066e | [
"MIT"
] | null | null | null | newproject_1/newproject_1/settings.py | Chinmoy-Prasad-Dutta/scrapy_scraper | 09f6abfc3bcf10ee28f486d83b450c89a07e066e | [
"MIT"
] | null | null | null | # Scrapy settings for newproject_1 project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# https://docs.scrapy.org/en/latest/topics/settings.html
# https://docs.scrapy.org/en/latest/topics/downloader-middl... | 35.05618 | 103 | 0.780769 |
BOT_NAME = 'newproject_1'
SPIDER_MODULES = ['newproject_1.spiders']
NEWSPIDER_MODULE = 'newproject_1.spiders'
ROBOTSTXT_OBEY = True
| true | true |
1c4753eff116b910c9c93958d56825d7720f1568 | 1,444 | py | Python | samples/generated_samples/dialogflow_v2_generated_versions_get_version_async.py | rkdfc93/python-dialogflow | a59cff0298ef18674c0b4133ef0a6ab82e288920 | [
"Apache-2.0"
] | 171 | 2018-09-19T21:16:18.000Z | 2020-12-07T17:41:10.000Z | samples/generated_samples/dialogflow_v2_generated_versions_get_version_async.py | rkdfc93/python-dialogflow | a59cff0298ef18674c0b4133ef0a6ab82e288920 | [
"Apache-2.0"
] | 150 | 2018-09-25T14:04:28.000Z | 2020-12-09T21:45:43.000Z | samples/generated_samples/dialogflow_v2_generated_versions_get_version_async.py | rkdfc93/python-dialogflow | a59cff0298ef18674c0b4133ef0a6ab82e288920 | [
"Apache-2.0"
] | 75 | 2018-09-22T14:12:18.000Z | 2020-12-08T07:12:12.000Z | # -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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... | 31.391304 | 85 | 0.756925 |
from google.cloud import dialogflow_v2
async def sample_get_version():
client = dialogflow_v2.VersionsAsyncClient()
request = dialogflow_v2.GetVersionRequest(
name="name_value",
)
response = await client.get_version(request=request)
print(re... | true | true |
1c4755892a095d9eed7918634a6edef5688ce027 | 1,624 | py | Python | sdks/python/http_client/v1/test/test_v1_list_searches_response.py | TariqAHassan/polyaxon | 6fc7f6a6ec49ef02d525887b6d18a893203e5b29 | [
"Apache-2.0"
] | null | null | null | sdks/python/http_client/v1/test/test_v1_list_searches_response.py | TariqAHassan/polyaxon | 6fc7f6a6ec49ef02d525887b6d18a893203e5b29 | [
"Apache-2.0"
] | null | null | null | sdks/python/http_client/v1/test/test_v1_list_searches_response.py | TariqAHassan/polyaxon | 6fc7f6a6ec49ef02d525887b6d18a893203e5b29 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python
#
# Copyright 2019 Polyaxon, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 28.491228 | 119 | 0.738916 |
from __future__ import absolute_import
import unittest
import polyaxon_sdk
from polyaxon_sdk.models.v1_list_searches_response import V1ListSearchesResponse
from polyaxon_sdk.rest import ApiException
class TestV1ListSearchesResponse(unittest.TestCase):
def setUp(self):
pass
de... | true | true |
1c475637e60225ae646c1b529f1fa216fb2c6c1a | 10,082 | py | Python | doc/source/conf.py | genomicsengland/gel-coverage | 61a671a53ac52a0b62c8aea983ced65fd0bed6cc | [
"Apache-2.0"
] | 2 | 2019-07-15T08:13:22.000Z | 2020-09-30T18:47:59.000Z | doc/source/conf.py | genomicsengland/gel-coverage | 61a671a53ac52a0b62c8aea983ced65fd0bed6cc | [
"Apache-2.0"
] | null | null | null | doc/source/conf.py | genomicsengland/gel-coverage | 61a671a53ac52a0b62c8aea983ced65fd0bed6cc | [
"Apache-2.0"
] | null | null | null | import sphinx_rtd_theme
# -*- coding: utf-8 -*-
#
# GelCoverage documentation build configuration file, created by
# sphinx-quickstart on Tue Dec 13 14:37:07 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this... | 29.223188 | 93 | 0.706903 | import sphinx_rtd_theme
extensions = []
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'GelCoverage'
copyright = u'2016, Pablo Riesgo, Pedro Furio, Matthew Parker, Antonio Rueda, Alona Sosinsky'
author = u'Pablo Riesgo, Pedro Furio, M... | true | true |
1c475707181d966447b38a87fe651934c279aaa0 | 1,151 | py | Python | aiida/tools/importexport/__init__.py | aiace9/aiida-core | 09ac91654648adb684a58d5d2d7b1c11a503dae8 | [
"MIT",
"BSD-3-Clause"
] | 1 | 2020-10-01T17:11:58.000Z | 2020-10-01T17:11:58.000Z | aiida/tools/importexport/__init__.py | blokhin/aiida-core | 29331b558b45ba74acf1ca633a2d8bfabc1bdd05 | [
"MIT",
"BSD-3-Clause"
] | 2 | 2019-03-06T11:23:42.000Z | 2020-03-09T09:34:07.000Z | aiida/tools/importexport/__init__.py | blokhin/aiida-core | 29331b558b45ba74acf1ca633a2d8bfabc1bdd05 | [
"MIT",
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | 47.958333 | 99 | 0.564726 | true | true | |
1c47573535fc8458d412b298db9ec2766ec449c9 | 645 | py | Python | modules/sample/src/sample/CSV/pf.py | AsmaBRZ/rcrs-server | d67a84a17b73dd95c5553bed68b8c4c08cd5651a | [
"BSD-3-Clause"
] | null | null | null | modules/sample/src/sample/CSV/pf.py | AsmaBRZ/rcrs-server | d67a84a17b73dd95c5553bed68b8c4c08cd5651a | [
"BSD-3-Clause"
] | null | null | null | modules/sample/src/sample/CSV/pf.py | AsmaBRZ/rcrs-server | d67a84a17b73dd95c5553bed68b8c4c08cd5651a | [
"BSD-3-Clause"
] | null | null | null | import matplotlib.pyplot as plt
import numpy as np
import os
time=np.arange(1,301)
array=np.zeros(250)
a=[]
fichiers=os.listdir("d")
for f in fichiers:
print(f)
i=0
with open("d/"+f, "r") as ins:
for line in ins:
if i<300:
print(line)
l=line.split(" ")
... | 18.970588 | 43 | 0.516279 | import matplotlib.pyplot as plt
import numpy as np
import os
time=np.arange(1,301)
array=np.zeros(250)
a=[]
fichiers=os.listdir("d")
for f in fichiers:
print(f)
i=0
with open("d/"+f, "r") as ins:
for line in ins:
if i<300:
print(line)
l=line.split(" ")
... | true | true |
1c47577594847e925fd3f69b3081b42da3d8500b | 49,232 | py | Python | tests/test_data_tokenizers.py | sxjscience/gluon-nlp | e6c39a80f4155cdb9c5fe8145287ddd322b4952b | [
"Apache-2.0"
] | 1 | 2020-03-20T08:01:34.000Z | 2020-03-20T08:01:34.000Z | tests/test_data_tokenizers.py | sxjscience/gluon-nlp | e6c39a80f4155cdb9c5fe8145287ddd322b4952b | [
"Apache-2.0"
] | null | null | null | tests/test_data_tokenizers.py | sxjscience/gluon-nlp | e6c39a80f4155cdb9c5fe8145287ddd322b4952b | [
"Apache-2.0"
] | null | null | null | import pytest
import random
import collections
import pickle
from uuid import uuid4
import os
import unicodedata
import tempfile
from pkg_resources import parse_version
import gluonnlp
from gluonnlp.data.tokenizers import WhitespaceTokenizer, MosesTokenizer, JiebaTokenizer,\
SpacyTokenizer, SubwordNMTTokenizer, YTT... | 62.318987 | 133 | 0.50518 | import pytest
import random
import collections
import pickle
from uuid import uuid4
import os
import unicodedata
import tempfile
from pkg_resources import parse_version
import gluonnlp
from gluonnlp.data.tokenizers import WhitespaceTokenizer, MosesTokenizer, JiebaTokenizer,\
SpacyTokenizer, SubwordNMTTokenizer, YTT... | true | true |
1c475796efa58d436a4aeaa031170fd8364ddc7a | 256 | py | Python | 09/01/01/5.py | pylangstudy/201707 | c1cc72667f1e0b6e8eef4ee85067d7fa4ca500b6 | [
"CC0-1.0"
] | null | null | null | 09/01/01/5.py | pylangstudy/201707 | c1cc72667f1e0b6e8eef4ee85067d7fa4ca500b6 | [
"CC0-1.0"
] | 46 | 2017-06-30T22:19:07.000Z | 2017-07-31T22:51:31.000Z | 10/01/01/5.py | pylangstudy/201707 | c1cc72667f1e0b6e8eef4ee85067d7fa4ca500b6 | [
"CC0-1.0"
] | null | null | null | class Base1:
def __init__(self): print('Base1.__init__');
class Base2:
def __init__(self): print('Base2.__init__');
class Super(Base1, Base2):
def __init__(self): print('Super.__init__'); Base1.__init__(self); Base2.__init__(self)
c = Super()
| 28.444444 | 91 | 0.699219 | class Base1:
def __init__(self): print('Base1.__init__');
class Base2:
def __init__(self): print('Base2.__init__');
class Super(Base1, Base2):
def __init__(self): print('Super.__init__'); Base1.__init__(self); Base2.__init__(self)
c = Super()
| true | true |
1c4757eb287bb3f279ee1609d1ef569abd806f07 | 156 | py | Python | tests/models.py | rtidatascience/django-postgres-power | cf3f714ab9d8919187dc478f1d0679945017ae17 | [
"BSD-3-Clause"
] | 16 | 2015-12-10T06:37:49.000Z | 2021-07-16T00:02:41.000Z | tests/models.py | rtidatascience/django-postgres-power | cf3f714ab9d8919187dc478f1d0679945017ae17 | [
"BSD-3-Clause"
] | 4 | 2016-08-23T13:31:33.000Z | 2019-04-08T15:47:38.000Z | tests/models.py | rtidatascience/django-postgres-power | cf3f714ab9d8919187dc478f1d0679945017ae17 | [
"BSD-3-Clause"
] | 7 | 2016-08-23T12:57:55.000Z | 2020-11-14T21:08:53.000Z | from django.db import models
class Checkin(models.Model):
logged_at = models.DateTimeField()
class Number(models.Model):
n = models.IntegerField() | 22.285714 | 38 | 0.74359 | from django.db import models
class Checkin(models.Model):
logged_at = models.DateTimeField()
class Number(models.Model):
n = models.IntegerField() | true | true |
1c475960ea7c505c741557bae2f651bd3511c226 | 2,710 | py | Python | cimcb_lite/utils/table_check.py | RuibingS/cimcb | 382f7d8fff30d3d276f18ac8c7dc686e0e643fa9 | [
"MIT"
] | 3 | 2019-05-19T10:36:50.000Z | 2020-10-12T08:13:04.000Z | cimcb_lite/utils/table_check.py | RuibingS/cimcb | 382f7d8fff30d3d276f18ac8c7dc686e0e643fa9 | [
"MIT"
] | 1 | 2019-03-24T11:04:39.000Z | 2019-03-26T03:54:51.000Z | cimcb_lite/utils/table_check.py | RuibingS/cimcb | 382f7d8fff30d3d276f18ac8c7dc686e0e643fa9 | [
"MIT"
] | 3 | 2019-05-19T10:37:03.000Z | 2020-10-12T08:13:05.000Z | import numpy as np
def table_check(DataTable, PeakTable, print_statement=True):
"""Error checking for DataTable and PeakTable (used in load_dataXL).
Parameters
----------
DataTable: DataFrame
Data sheet with the required columns.
PeakTable: DataFrame
Peak sheet with the required ... | 41.692308 | 154 | 0.700738 | import numpy as np
def table_check(DataTable, PeakTable, print_statement=True):
data_columns = DataTable.columns.values
if "Idx" not in data_columns:
raise ValueError("Data Table does not contain the required 'Idx' column")
if DataTable.Idx.isnull().values.any() == True:
raise Value... | true | true |
1c475968ebbd39e752c755cb7b4598bf947a6220 | 556 | py | Python | src/log.py | ENDERZOMBI102/endc-lang | 554c540111adae52c3ec23c75474d2121d339df4 | [
"MIT"
] | null | null | null | src/log.py | ENDERZOMBI102/endc-lang | 554c540111adae52c3ec23c75474d2121d339df4 | [
"MIT"
] | null | null | null | src/log.py | ENDERZOMBI102/endc-lang | 554c540111adae52c3ec23c75474d2121d339df4 | [
"MIT"
] | null | null | null | import sys
from typing import TextIO
from cli import args
def _log(level: int, msg: str, file: TextIO) -> None:
if args.verboseLevel <= level:
print(msg, file=file)
def debug(msg: str, file: TextIO = sys.stdout) -> None:
if args.debug:
_log( 0, f'[DEBUG] {msg}', file )
def info(msg: str, file: TextIO = sys... | 20.592593 | 55 | 0.627698 | import sys
from typing import TextIO
from cli import args
def _log(level: int, msg: str, file: TextIO) -> None:
if args.verboseLevel <= level:
print(msg, file=file)
def debug(msg: str, file: TextIO = sys.stdout) -> None:
if args.debug:
_log( 0, f'[DEBUG] {msg}', file )
def info(msg: str, file: TextIO = sys... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.