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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f73a40724a9514df3f4699c831628b04f799fd18 | 442 | py | Python | Códigos fichados e comentados/Matemática/Aritmetica Complexa.py | kioolz/Python-scripts | cb8ad758811e2eed8673392077a55e8922ac7b9f | [
"MIT"
] | null | null | null | Códigos fichados e comentados/Matemática/Aritmetica Complexa.py | kioolz/Python-scripts | cb8ad758811e2eed8673392077a55e8922ac7b9f | [
"MIT"
] | null | null | null | Códigos fichados e comentados/Matemática/Aritmetica Complexa.py | kioolz/Python-scripts | cb8ad758811e2eed8673392077a55e8922ac7b9f | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Mon Jul 29 23:34:18 2019
@author: Caio
"""
# Exemplo de Aritmética complexa
u = 2.5 + 3j #Criando um numero complexo
v = 2
w = u + v # Operação soma
print(w)
a = -2
b = 0.5
s = a + b*1j
s = complex(a,b)
s
s* w #Complex * Complex
s/w #Complex/Complex
#Partes ... | 9.404255 | 42 | 0.628959 |
u = 2.5 + 3j
v = 2
w = u + v
print(w)
a = -2
b = 0.5
s = a + b*1j
s = complex(a,b)
s
s* w
s/w
s.real
s.imag
s.conjugate()
| true | true |
f73a4232b7c41b5804c217321acbc5b6975e869d | 9,950 | py | Python | flask/config.py | himanshumangla/flaskExperiment | e4c4557ab097e918ddd3b8f0b16524e65ae9bd63 | [
"BSD-3-Clause"
] | null | null | null | flask/config.py | himanshumangla/flaskExperiment | e4c4557ab097e918ddd3b8f0b16524e65ae9bd63 | [
"BSD-3-Clause"
] | null | null | null | flask/config.py | himanshumangla/flaskExperiment | e4c4557ab097e918ddd3b8f0b16524e65ae9bd63 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""
flask.config
~~~~~~~~~~~~
Implements the configuration related objects.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import os
import types
import errno
from werkzeug.utils import import_string
from ._compat import string_ty... | 37.406015 | 79 | 0.60804 |
import os
import types
import errno
from werkzeug.utils import import_string
from ._compat import string_types, iteritems
from . import json
class ConfigAttribute(object):
def __init__(self, name, get_converter=None):
self.__name__ = name
self.get_converter = get_converter
def __get__(sel... | true | true |
f73a43ece7c313f71c221112e83575d177340f75 | 4,722 | py | Python | hendjibi/tools/config.py | Konrad-Ziarko/hendjibi | c1d93e85a94b348408110cdf319f64cc0f815997 | [
"MIT"
] | null | null | null | hendjibi/tools/config.py | Konrad-Ziarko/hendjibi | c1d93e85a94b348408110cdf319f64cc0f815997 | [
"MIT"
] | null | null | null | hendjibi/tools/config.py | Konrad-Ziarko/hendjibi | c1d93e85a94b348408110cdf319f64cc0f815997 | [
"MIT"
] | null | null | null | import configparser
import os
from enum import Enum
from hendjibi import PROJECT_NAME_SHORT
from hendjibi.tools.app_logger import get_logger
from hendjibi.tools.translator import translate as _
from hendjibi.model.entry import ProgressStatus, EntryType
logger = get_logger(__name__)
SLIDER_MIN = 50
SLIDER_MAX = 250
... | 41.787611 | 101 | 0.622618 | import configparser
import os
from enum import Enum
from hendjibi import PROJECT_NAME_SHORT
from hendjibi.tools.app_logger import get_logger
from hendjibi.tools.translator import translate as _
from hendjibi.model.entry import ProgressStatus, EntryType
logger = get_logger(__name__)
SLIDER_MIN = 50
SLIDER_MAX = 250
... | true | true |
f73a4464c69e410cdfb4817d0e80d18032a75bc6 | 3,415 | py | Python | QUANTAXIS/QAUtil/QATransform.py | Sinovel/QUANTAXIS | 97f1ea2140f58c92ff5c84b851886d9eda1f9ac3 | [
"MIT"
] | 3 | 2020-10-20T07:48:52.000Z | 2022-02-11T05:47:34.000Z | QUANTAXIS/QAUtil/QATransform.py | Sinovel/QUANTAXIS | 97f1ea2140f58c92ff5c84b851886d9eda1f9ac3 | [
"MIT"
] | null | null | null | QUANTAXIS/QAUtil/QATransform.py | Sinovel/QUANTAXIS | 97f1ea2140f58c92ff5c84b851886d9eda1f9ac3 | [
"MIT"
] | 2 | 2021-03-05T13:54:28.000Z | 2021-03-06T11:53:43.000Z | # coding:utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2019 yutiansut/QUANTAXIS
#
# 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 th... | 20.572289 | 80 | 0.623426 |
import csv
import json
import numpy as np
import pandas as pd
def QA_util_to_json_from_pandas(data):
if 'datetime' in data.columns:
data.datetime = data.datetime.apply(str)
if 'date' in data.columns:
data.date = data.date.apply(str)
return json.loads(data.to_json(... | true | true |
f73a45ab73a94d9a47f984a159a20b05d0f93746 | 5,100 | py | Python | model_zoo/research/cv/FaceAttribute/src/FaceAttribute/resnet18_softmax.py | GuoSuiming/mindspore | 48afc4cfa53d970c0b20eedfb46e039db2a133d5 | [
"Apache-2.0"
] | 55 | 2020-12-17T10:26:06.000Z | 2022-03-28T07:18:26.000Z | model_zoo/research/cv/FaceAttribute/src/FaceAttribute/resnet18_softmax.py | forwhat461/mindspore | 59a277756eb4faad9ac9afcc7fd526e8277d4994 | [
"Apache-2.0"
] | null | null | null | model_zoo/research/cv/FaceAttribute/src/FaceAttribute/resnet18_softmax.py | forwhat461/mindspore | 59a277756eb4faad9ac9afcc7fd526e8277d4994 | [
"Apache-2.0"
] | 14 | 2021-01-29T02:39:47.000Z | 2022-03-23T05:00:26.000Z | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 34.931507 | 93 | 0.612157 |
import mindspore.nn as nn
from mindspore.ops.operations import TensorAdd
from mindspore.ops import operations as P
from mindspore.nn import Cell
from src.FaceAttribute.custom_net import Cut, bn_with_initialize, conv1x1, conv3x3
from src.FaceAttribute.head_factory_softmax import get_attri_head
__... | true | true |
f73a45c01270d0583189d4419eccaf24e8981d3e | 5,780 | py | Python | electrum_mona/gui/qt/contact_list.py | wakiyamap/electrum-mona | d00830c96785c77025432669158ad903146a2298 | [
"MIT"
] | 61 | 2017-08-06T08:51:49.000Z | 2021-12-28T06:25:36.000Z | electrum_mona/gui/qt/contact_list.py | wakiyamap/electrum-mona | d00830c96785c77025432669158ad903146a2298 | [
"MIT"
] | 15 | 2017-09-12T07:15:01.000Z | 2021-12-28T06:25:15.000Z | electrum_mona/gui/qt/contact_list.py | wakiyamap/electrum-mona | d00830c96785c77025432669158ad903146a2298 | [
"MIT"
] | 27 | 2017-08-18T19:40:30.000Z | 2021-03-01T11:16:02.000Z | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2015 Thomas Voegtlin
#
# 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... | 45.15625 | 132 | 0.675952 |
from enum import IntEnum
from PyQt5.QtGui import QStandardItemModel, QStandardItem
from PyQt5.QtCore import Qt, QPersistentModelIndex, QModelIndex
from PyQt5.QtWidgets import (QAbstractItemView, QMenu)
from electrum_mona.i18n import _
from electrum_mona.bitcoin import is_address
from electrum... | true | true |
f73a45c0a0ff7e3c290777d566a59c61a6e3b43b | 14,952 | py | Python | pycon/migrations/0007_auto__add_pyconlightningtalkproposal__add_field_pyconposterproposal_ad.py | pyconjp/pyconjp-website | c14b1412b70ad04d6c6e837cb0feaec17fd5cd36 | [
"BSD-3-Clause"
] | 6 | 2016-04-03T18:22:45.000Z | 2018-03-15T11:20:39.000Z | pycon/migrations/0007_auto__add_pyconlightningtalkproposal__add_field_pyconposterproposal_ad.py | alex/pycon | d1437a9f2ac1ec4f4fd5ad41ef3a7fe06958b52b | [
"BSD-3-Clause"
] | 60 | 2016-04-14T12:16:06.000Z | 2017-08-15T06:15:50.000Z | pycon/migrations/0007_auto__add_pyconlightningtalkproposal__add_field_pyconposterproposal_ad.py | alex/pycon | d1437a9f2ac1ec4f4fd5ad41ef3a7fe06958b52b | [
"BSD-3-Clause"
] | 7 | 2016-04-23T02:29:35.000Z | 2017-10-05T07:37:46.000Z | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'PyConLightningTalkProposal'
db.create_table(u'pycon_pyconlightningtalkproposal', (
... | 78.694737 | 218 | 0.583133 |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
db.create_table(u'pycon_pyconlightningtalkproposal', (
(u'proposalbase_ptr', self.gf('django.db.models.fields.related.... | true | true |
f73a45fa33e9ce4ebec9a8041fcf77e8acaa94f8 | 4,384 | py | Python | archives/presenters/predictionsFilter4.py | block1o1/CryptoPredicted | 7f660cdc456fb8252b3125028f31fd6f5a3ceea5 | [
"MIT"
] | 4 | 2021-10-14T21:22:25.000Z | 2022-03-12T19:58:48.000Z | archives/presenters/predictionsFilter4.py | inevolin/CryptoPredicted | 7f660cdc456fb8252b3125028f31fd6f5a3ceea5 | [
"MIT"
] | null | null | null | archives/presenters/predictionsFilter4.py | inevolin/CryptoPredicted | 7f660cdc456fb8252b3125028f31fd6f5a3ceea5 | [
"MIT"
] | 1 | 2022-03-15T22:52:53.000Z | 2022-03-15T22:52:53.000Z | import datetime
import pprint
import pymongo
import sys
import json
import time
import copy
from pymongo import MongoClient
import sys
sys.path.insert(0, '/home/nevolin/public_html/cryptoproto/')
from mysettings import dtNow
import DAL
client = DAL.openConnection()
db=client.crypto
if not len(sys.argv) >= 2:
pri... | 27.061728 | 166 | 0.630931 | import datetime
import pprint
import pymongo
import sys
import json
import time
import copy
from pymongo import MongoClient
import sys
sys.path.insert(0, '/home/nevolin/public_html/cryptoproto/')
from mysettings import dtNow
import DAL
client = DAL.openConnection()
db=client.crypto
if not len(sys.argv) >= 2:
pri... | true | true |
f73a467c69b65d80e67f7a5ccdacff9292dabd04 | 426 | py | Python | setup.py | avoceteditors/weekdate | 643447bf8a75614e9a7aadfd026f59bddeb99d69 | [
"BSD-3-Clause"
] | null | null | null | setup.py | avoceteditors/weekdate | 643447bf8a75614e9a7aadfd026f59bddeb99d69 | [
"BSD-3-Clause"
] | null | null | null | setup.py | avoceteditors/weekdate | 643447bf8a75614e9a7aadfd026f59bddeb99d69 | [
"BSD-3-Clause"
] | null | null | null | from distutils.core import setup
setup( name = 'weekdate',
version = '0.1',
author = 'Kenneth P. J. Dyer',
author_email = 'kenneth@avoceteditors.com',
url = 'https://github.com/kennethpjdyer/weekdate',
description = 'Basic utility... | 35.5 | 96 | 0.549296 | from distutils.core import setup
setup( name = 'weekdate',
version = '0.1',
author = 'Kenneth P. J. Dyer',
author_email = 'kenneth@avoceteditors.com',
url = 'https://github.com/kennethpjdyer/weekdate',
description = 'Basic utility... | true | true |
f73a46f0bb61a050d182f205270c4397ae389c77 | 4,186 | py | Python | confz/confz_source.py | AndrewW85/ConfZ | 69a83af4905d7f182cef68f14574394de084ccca | [
"MIT"
] | null | null | null | confz/confz_source.py | AndrewW85/ConfZ | 69a83af4905d7f182cef68f14574394de084ccca | [
"MIT"
] | null | null | null | confz/confz_source.py | AndrewW85/ConfZ | 69a83af4905d7f182cef68f14574394de084ccca | [
"MIT"
] | null | null | null | from dataclasses import dataclass
from enum import Enum
from pathlib import Path
from typing import Optional, Union, List, Dict, Any
@dataclass
class ConfZSource:
"""Source configuration for :class:`~confz.ConfZ` models."""
ConfZSources = Union[ConfZSource, List[ConfZSource]]
class FileFormat(Enum):
"""En... | 50.433735 | 119 | 0.721691 | from dataclasses import dataclass
from enum import Enum
from pathlib import Path
from typing import Optional, Union, List, Dict, Any
@dataclass
class ConfZSource:
ConfZSources = Union[ConfZSource, List[ConfZSource]]
class FileFormat(Enum):
JSON = 'json'
YAML = 'yaml'
@dataclass
class ConfZFileSour... | true | true |
f73a4706e53853acb6cd5a38b62f25982c9c3567 | 511 | py | Python | demo.py | adamslab-ub/SCoPP | b88a2b04537d5828190973d73f525fa902723375 | [
"MIT"
] | 5 | 2021-05-26T04:56:16.000Z | 2022-03-26T19:59:46.000Z | demo.py | adamslab-ub/SCoPP | b88a2b04537d5828190973d73f525fa902723375 | [
"MIT"
] | 2 | 2021-10-30T14:53:05.000Z | 2021-11-07T02:51:10.000Z | demo.py | adamslab-ub/SCoPP | b88a2b04537d5828190973d73f525fa902723375 | [
"MIT"
] | 3 | 2021-08-15T03:31:57.000Z | 2022-02-01T21:16:57.000Z | """
This code contains examples of how to call and use the SCoPP-Monitoring module.
"""
# Import the necessary modules:
import monitoring_algorithms
import environments as envs
# Initialize environment class
environment = envs.Debugger()
# Initialize monitoring algorithm instance
way_point_allocator = moni... | 34.066667 | 93 | 0.790607 |
import monitoring_algorithms
import environments as envs
environment = envs.Debugger()
way_point_allocator = monitoring_algorithms.QLB(environment, number_of_robots=5,plot="full")
paths = way_point_allocator.run(info="verbose") | true | true |
f73a490a3587b20639a7f51e5d07bd2315e75b7d | 250 | py | Python | signalwire/relay/calling/results/record_result.py | ramarketing/signalwire-python | c0663bdd0454faaa39f42af7c936cea1d43e1842 | [
"MIT"
] | 23 | 2018-12-19T14:48:18.000Z | 2022-01-11T03:58:36.000Z | signalwire/relay/calling/results/record_result.py | ramarketing/signalwire-python | c0663bdd0454faaa39f42af7c936cea1d43e1842 | [
"MIT"
] | 13 | 2018-10-17T12:57:54.000Z | 2021-09-01T21:46:01.000Z | signalwire/relay/calling/results/record_result.py | ramarketing/signalwire-python | c0663bdd0454faaa39f42af7c936cea1d43e1842 | [
"MIT"
] | 12 | 2020-01-21T14:29:43.000Z | 2022-01-11T07:48:06.000Z | from . import BaseResult
class RecordResult(BaseResult):
@property
def url(self):
return self.component.url
@property
def duration(self):
return self.component.duration
@property
def size(self):
return self.component.size
| 15.625 | 34 | 0.716 | from . import BaseResult
class RecordResult(BaseResult):
@property
def url(self):
return self.component.url
@property
def duration(self):
return self.component.duration
@property
def size(self):
return self.component.size
| true | true |
f73a49870c7e051c3891727f8965f4cc1fd87a90 | 9,869 | py | Python | src/oci/identity/models/mfa_totp_device_summary.py | LaudateCorpus1/oci-python-sdk | b0d3ce629d5113df4d8b83b7a6502b2c5bfa3015 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | src/oci/identity/models/mfa_totp_device_summary.py | LaudateCorpus1/oci-python-sdk | b0d3ce629d5113df4d8b83b7a6502b2c5bfa3015 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | src/oci/identity/models/mfa_totp_device_summary.py | LaudateCorpus1/oci-python-sdk | b0d3ce629d5113df4d8b83b7a6502b2c5bfa3015 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | # coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 32.357377 | 245 | 0.644746 |
from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel
from oci.decorators import init_model_state_from_kwargs
@init_model_state_from_kwargs
class MfaTotpDeviceSummary(object):
LIFECYCLE_STATE_CREATING = "CREATING"
LIFECYCLE_STATE_ACTIVE = "AC... | true | true |
f73a4a4a72981c957855835fb762832d53a10783 | 6,404 | py | Python | parallel_accel/Analysis/benchmarks/gralt/gralt_benchmarks.py | google/parallel_accel | b58fda1c3a22f2aaa9a97337d602cd72c49ee8be | [
"Apache-2.0"
] | 1 | 2021-12-19T21:17:02.000Z | 2021-12-19T21:17:02.000Z | parallel_accel/Analysis/benchmarks/gralt/gralt_benchmarks.py | google/parallel_accel | b58fda1c3a22f2aaa9a97337d602cd72c49ee8be | [
"Apache-2.0"
] | null | null | null | parallel_accel/Analysis/benchmarks/gralt/gralt_benchmarks.py | google/parallel_accel | b58fda1c3a22f2aaa9a97337d602cd72c49ee8be | [
"Apache-2.0"
] | null | null | null | # Copyright 2021 The ParallelAccel 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 appl... | 39.288344 | 91 | 0.723142 |
import json
import os
import time
import benchmarks.acyclic_graphs.benchmark_acyclic_graphs as acyclic_graphs
from benchmarks.acyclic_graphs import pbaxisum
import benchmarks.gralt.settings as settings
import linear_algebra
import tensorflow as tf
import grapal_tool as gralt
sample_subgraph = gralt.su... | true | true |
f73a4bde185e7342b8435e35a8462ea6fc6b22c8 | 62 | py | Python | debug_toolbar/__init__.py | none-da/zeshare | 6c13cd3bd9d82d89f53d4a8b287fe2c30f1d3779 | [
"BSD-3-Clause"
] | 10 | 2015-01-10T15:34:25.000Z | 2021-07-30T11:14:22.000Z | vkontakte_wall/__init__.py | gorelikspb/django-vkontakte-wall | 09b921034d909d7162ee48e8a3eb1c29c0747f40 | [
"BSD-3-Clause"
] | 2 | 2015-06-11T15:28:52.000Z | 2015-08-04T11:53:13.000Z | vkontakte_wall/__init__.py | gorelikspb/django-vkontakte-wall | 09b921034d909d7162ee48e8a3eb1c29c0747f40 | [
"BSD-3-Clause"
] | 7 | 2015-01-29T15:51:38.000Z | 2020-09-01T03:14:47.000Z | VERSION = (0, 8, 1)
__version__ = '.'.join(map(str, VERSION))
| 20.666667 | 41 | 0.612903 | VERSION = (0, 8, 1)
__version__ = '.'.join(map(str, VERSION))
| true | true |
f73a4d22041854c5326afaffc36927b22884b07a | 5,370 | py | Python | workers/test/test_exportactionlogsworker.py | kwestpharedhat/quay | a0df895005bcd3e53847046f69f6a7add87c88fd | [
"Apache-2.0"
] | null | null | null | workers/test/test_exportactionlogsworker.py | kwestpharedhat/quay | a0df895005bcd3e53847046f69f6a7add87c88fd | [
"Apache-2.0"
] | null | null | null | workers/test/test_exportactionlogsworker.py | kwestpharedhat/quay | a0df895005bcd3e53847046f69f6a7add87c88fd | [
"Apache-2.0"
] | null | null | null | import json
import os
import pytest
from datetime import datetime, timedelta
import boto3
from httmock import urlmatch, HTTMock
from moto import mock_s3
from app import storage as test_storage
from data import model, database
from data.logs_model import logs_model
from storage import S3Storage, StorageContext, Dist... | 30.338983 | 97 | 0.58324 | import json
import os
import pytest
from datetime import datetime, timedelta
import boto3
from httmock import urlmatch, HTTMock
from moto import mock_s3
from app import storage as test_storage
from data import model, database
from data.logs_model import logs_model
from storage import S3Storage, StorageContext, Dist... | true | true |
f73a4e39146352545db7ac5058c6f78e7da2e30f | 5,014 | py | Python | mpf/core/bcp/bcp.py | Wolfmarsh/mpf | ad71f381ce8a0e65f28958e51cf8a8b38a6154fb | [
"MIT"
] | null | null | null | mpf/core/bcp/bcp.py | Wolfmarsh/mpf | ad71f381ce8a0e65f28958e51cf8a8b38a6154fb | [
"MIT"
] | null | null | null | mpf/core/bcp/bcp.py | Wolfmarsh/mpf | ad71f381ce8a0e65f28958e51cf8a8b38a6154fb | [
"MIT"
] | null | null | null | """BCP module."""
import asyncio
from functools import partial
from typing import List
from mpf.core.events import QueuedEvent
from mpf.core.mpf_controller import MpfController
from mpf.core.bcp.bcp_server import BcpServer
from mpf.core.utility_functions import Util
from mpf.core.bcp.bcp_interface import BcpInterfac... | 41.438017 | 116 | 0.62844 | import asyncio
from functools import partial
from typing import List
from mpf.core.events import QueuedEvent
from mpf.core.mpf_controller import MpfController
from mpf.core.bcp.bcp_server import BcpServer
from mpf.core.utility_functions import Util
from mpf.core.bcp.bcp_interface import BcpInterface
from mpf.core.bc... | true | true |
f73a4f097c8fc92de9032bf09d5e135ebc9ae997 | 2,673 | py | Python | test_elasticsearch/test_helpers.py | dliappis/elasticsearch-py | 85573db2759922aed7fb655cfdd7cb95d3071a34 | [
"Apache-2.0"
] | 1 | 2019-01-18T02:36:01.000Z | 2019-01-18T02:36:01.000Z | test_elasticsearch/test_helpers.py | dliappis/elasticsearch-py | 85573db2759922aed7fb655cfdd7cb95d3071a34 | [
"Apache-2.0"
] | null | null | null | test_elasticsearch/test_helpers.py | dliappis/elasticsearch-py | 85573db2759922aed7fb655cfdd7cb95d3071a34 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
import mock
import time
import threading
from elasticsearch import helpers, Elasticsearch
from elasticsearch.serializer import JSONSerializer
from .test_cases import TestCase
lock_side_effect = threading.Lock()
def mock_process_bulk_chunk(*args, **kwargs):
"""
Threadsafe way of mocki... | 38.73913 | 110 | 0.710438 |
import mock
import time
import threading
from elasticsearch import helpers, Elasticsearch
from elasticsearch.serializer import JSONSerializer
from .test_cases import TestCase
lock_side_effect = threading.Lock()
def mock_process_bulk_chunk(*args, **kwargs):
with lock_side_effect:
mock_process_bulk_chun... | true | true |
f73a4f2f282124807128247d2a677a39cec76d4b | 5,715 | py | Python | maze.py | Sai-Prabhav/maze | 9fd0dc8d269a7718730cea51cfbe263dd616bcfc | [
"MIT"
] | 1 | 2021-09-04T13:13:13.000Z | 2021-09-04T13:13:13.000Z | maze.py | Sai-Prabhav/maze | 9fd0dc8d269a7718730cea51cfbe263dd616bcfc | [
"MIT"
] | null | null | null | maze.py | Sai-Prabhav/maze | 9fd0dc8d269a7718730cea51cfbe263dd616bcfc | [
"MIT"
] | null | null | null | import json
import os
import pygame
from find_path import solve_maze
pygame.init()
def maze_gen():
"""takes in put from the user and returns a map
Returns:
dict: the json file containing all the maps
"""
res = {}
for i in range(1): # for each of the mazes (9)
prin... | 32.844828 | 145 | 0.545582 | import json
import os
import pygame
from find_path import solve_maze
pygame.init()
def maze_gen():
res = {}
for i in range(1):
print("this is maze ", i+1)
Green_1 = []
Green_2 = []
Green_1.append([int((inp := input(
"The Position of the first circle... | true | true |
f73a4f5695e2ff4902a5156c58fe443c790c15b1 | 13,552 | py | Python | pfr_api/parse/parse.py | aadamson/pfr-api | b5cab2763db71e57e231507e03747fc0922cdba3 | [
"MIT"
] | 1 | 2021-10-12T01:39:04.000Z | 2021-10-12T01:39:04.000Z | pfr_api/parse/parse.py | aadamson/pfr-api | b5cab2763db71e57e231507e03747fc0922cdba3 | [
"MIT"
] | null | null | null | pfr_api/parse/parse.py | aadamson/pfr-api | b5cab2763db71e57e231507e03747fc0922cdba3 | [
"MIT"
] | null | null | null | from typing import Any, Dict, List, Optional, Tuple
from bs4 import BeautifulSoup
from pfr_api.parse.parser import RowParser, IdentityParser, \
StrToIntParser, NullableStrToIntParser, \
NullableStrToFloatParser, StrPercentageToFloatParser, \
NullableStrPercentageToFloatParser
PARSERS = {
'year_id': ... | 48.056738 | 93 | 0.739669 | from typing import Any, Dict, List, Optional, Tuple
from bs4 import BeautifulSoup
from pfr_api.parse.parser import RowParser, IdentityParser, \
StrToIntParser, NullableStrToIntParser, \
NullableStrToFloatParser, StrPercentageToFloatParser, \
NullableStrPercentageToFloatParser
PARSERS = {
'year_id': ... | true | true |
f73a4f903101f0a6a4f1a49bb0551b130217b200 | 17,148 | py | Python | src/sentry/interfaces/security.py | pierredup/sentry | 0145e4b3bc0e775bf3482fe65f5e1a689d0dbb80 | [
"BSD-3-Clause"
] | null | null | null | src/sentry/interfaces/security.py | pierredup/sentry | 0145e4b3bc0e775bf3482fe65f5e1a689d0dbb80 | [
"BSD-3-Clause"
] | null | null | null | src/sentry/interfaces/security.py | pierredup/sentry | 0145e4b3bc0e775bf3482fe65f5e1a689d0dbb80 | [
"BSD-3-Clause"
] | null | null | null | from __future__ import absolute_import
import jsonschema
import six
__all__ = ("Csp", "Hpkp", "ExpectCT", "ExpectStaple")
from six.moves.urllib.parse import urlsplit, urlunsplit
from sentry.interfaces.base import Interface, InterfaceValidationError
from sentry.interfaces.schemas import validate_and_default_interfac... | 32.662857 | 100 | 0.602053 | from __future__ import absolute_import
import jsonschema
import six
__all__ = ("Csp", "Hpkp", "ExpectCT", "ExpectStaple")
from six.moves.urllib.parse import urlsplit, urlunsplit
from sentry.interfaces.base import Interface, InterfaceValidationError
from sentry.interfaces.schemas import validate_and_default_interfac... | true | true |
f73a50c0e344fcd69f9c995c194228b477953779 | 8,189 | py | Python | bank/accounts.py | samroon2/bank_project | e272bdd96b07b17de69cecb3b42ddb01c95dfe0b | [
"Apache-2.0"
] | null | null | null | bank/accounts.py | samroon2/bank_project | e272bdd96b07b17de69cecb3b42ddb01c95dfe0b | [
"Apache-2.0"
] | null | null | null | bank/accounts.py | samroon2/bank_project | e272bdd96b07b17de69cecb3b42ddb01c95dfe0b | [
"Apache-2.0"
] | null | null | null | """
bank.accounts
~~~~~~~~~~~~~
This module contains code for managing accounts.
"""
from .cards import Card
from .exceptions import InsufficientBalance, AccountError, ExceedsLimit
import time, datetime
class Account:
"""
Base class for accounts, handles balances & transactions.
:param account_id: Unique... | 30.901887 | 84 | 0.605446 |
from .cards import Card
from .exceptions import InsufficientBalance, AccountError, ExceedsLimit
import time, datetime
class Account:
def __init__(
self,
account_id: int,
account_type: str,
holder_accounts,
accountholder_id: str,
opening_balance=0,
open_dat... | true | true |
f73a53505340aba6e1987ab6d467523d88ef5c8d | 2,391 | py | Python | src/alert.py | computer-geek64/swamphacks | 16231e8123c7660ddc987cfda357629227bc2154 | [
"MIT"
] | null | null | null | src/alert.py | computer-geek64/swamphacks | 16231e8123c7660ddc987cfda357629227bc2154 | [
"MIT"
] | 10 | 2020-02-02T05:36:40.000Z | 2022-02-26T23:08:19.000Z | src/alert.py | computer-geek64/swamphacks | 16231e8123c7660ddc987cfda357629227bc2154 | [
"MIT"
] | 1 | 2020-02-21T18:05:10.000Z | 2020-02-21T18:05:10.000Z | #!/usr/bin/python3
# alert.py
import math
from data import mongo
from data import gdacs
from data import wildfires
import geopy.distance
import pymongo
from time import sleep
from datetime import datetime
from config import MONGODB_USER, MONGODB_PASS
def monitor_danger(time_threshold=5 * 60, distance_thresholds={"hu... | 46.882353 | 373 | 0.663321 |
import math
from data import mongo
from data import gdacs
from data import wildfires
import geopy.distance
import pymongo
from time import sleep
from datetime import datetime
from config import MONGODB_USER, MONGODB_PASS
def monitor_danger(time_threshold=5 * 60, distance_thresholds={"hurricanes": 200, "floods": 50... | true | true |
f73a53927386a45603bbf811a4d1b3aa32955053 | 1,566 | py | Python | mercurial/pure/diffhelpers.py | EnjoyLifeFund/py36pkgs | 0ac677fbbfa7b6d8c527fe2c759ba05117b07fd2 | [
"MIT",
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null | mercurial/pure/diffhelpers.py | EnjoyLifeFund/py36pkgs | 0ac677fbbfa7b6d8c527fe2c759ba05117b07fd2 | [
"MIT",
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null | mercurial/pure/diffhelpers.py | EnjoyLifeFund/py36pkgs | 0ac677fbbfa7b6d8c527fe2c759ba05117b07fd2 | [
"MIT",
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null | # diffhelpers.py - pure Python implementation of diffhelpers.c
#
# Copyright 2009 Matt Mackall <mpm@selenic.com> and others
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
def addlines(fp, hunk, lena, lenb, a, b):
while True... | 24.857143 | 73 | 0.469987 |
def addlines(fp, hunk, lena, lenb, a, b):
while True:
todoa = lena - len(a)
todob = lenb - len(b)
num = max(todoa, todob)
if num == 0:
break
for i in range(num):
s = fp.readline()
c = s[0]
if s == "\\ No newline at end ... | true | true |
f73a53dac0bae336a1463e8eae67a7c4cf0dc991 | 7,386 | py | Python | data.py | ChuanTianML/mxnet_word_lm | 231b67370712a5dccae9433858dd66800005a00f | [
"Apache-2.0"
] | null | null | null | data.py | ChuanTianML/mxnet_word_lm | 231b67370712a5dccae9433858dd66800005a00f | [
"Apache-2.0"
] | null | null | null | data.py | ChuanTianML/mxnet_word_lm | 231b67370712a5dccae9433858dd66800005a00f | [
"Apache-2.0"
] | null | null | null | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 42.205714 | 133 | 0.50176 |
import os, gzip
import sys
import mxnet as mx
import numpy as np
class Dictionary(object):
def __init__(self):
self.word2idx = {}
self.idx2word = []
self.word_count = []
def add_word(self, word):
if word not in self.word2idx:
self... | true | true |
f73a5551e2e7c9bbd2eda5dc1fc55becf9d3d8a3 | 667 | py | Python | BachelorETL/manage.py | Athanar/BachelorProject | b2867aab55dab0c793fb5eb993850f13bb9e64fa | [
"MIT"
] | null | null | null | BachelorETL/manage.py | Athanar/BachelorProject | b2867aab55dab0c793fb5eb993850f13bb9e64fa | [
"MIT"
] | null | null | null | BachelorETL/manage.py | Athanar/BachelorProject | b2867aab55dab0c793fb5eb993850f13bb9e64fa | [
"MIT"
] | null | null | null | #!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'BachelorETL.settings')
try:
from django.core.management import execute_from_command_line
except ... | 29 | 75 | 0.68066 |
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'BachelorETL.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
... | true | true |
f73a56658d1c5ce2862f7709bb31e17539fb146c | 128 | py | Python | wafw00f/plugins/teros.py | wizard531/wafw00f | dce0d0616db0f970013432c520b51aeef62d387f | [
"BSD-3-Clause"
] | 10 | 2015-08-31T10:38:24.000Z | 2021-09-30T06:39:13.000Z | wafw00f/plugins/teros.py | wizard531/wafw00f | dce0d0616db0f970013432c520b51aeef62d387f | [
"BSD-3-Clause"
] | null | null | null | wafw00f/plugins/teros.py | wizard531/wafw00f | dce0d0616db0f970013432c520b51aeef62d387f | [
"BSD-3-Clause"
] | 17 | 2015-07-24T20:40:23.000Z | 2021-01-08T19:41:18.000Z | #!/usr/bin/env python
NAME = 'Teros WAF'
def is_waf(self):
# credit goes to W3AF
return self.matchcookie('^st8id=')
| 12.8 | 38 | 0.640625 |
NAME = 'Teros WAF'
def is_waf(self):
return self.matchcookie('^st8id=')
| true | true |
f73a568794799ff26877debad0fe49e7d4400851 | 17,339 | py | Python | frontend/view_model.py | Kuturkokov/retro-ipod-spotify-client | 267792b86d6be7573e40910b3152c465d0c97979 | [
"Apache-2.0"
] | null | null | null | frontend/view_model.py | Kuturkokov/retro-ipod-spotify-client | 267792b86d6be7573e40910b3152c465d0c97979 | [
"Apache-2.0"
] | null | null | null | frontend/view_model.py | Kuturkokov/retro-ipod-spotify-client | 267792b86d6be7573e40910b3152c465d0c97979 | [
"Apache-2.0"
] | null | null | null | import spotify_manager
import re as re
from functools import lru_cache
MENU_PAGE_SIZE = 6
# Screen render types
MENU_RENDER_TYPE = 0
NOW_PLAYING_RENDER = 1
SEARCH_RENDER = 2
# Menu line item types
LINE_NORMAL = 0
LINE_HIGHLIGHT = 1
LINE_TITLE = 2
spotify_manager.refresh_devices()
class LineItem():
def __init_... | 32.592105 | 135 | 0.64352 | import spotify_manager
import re as re
from functools import lru_cache
MENU_PAGE_SIZE = 6
MENU_RENDER_TYPE = 0
NOW_PLAYING_RENDER = 1
SEARCH_RENDER = 2
LINE_NORMAL = 0
LINE_HIGHLIGHT = 1
LINE_TITLE = 2
spotify_manager.refresh_devices()
class LineItem():
def __init__(self, title = "", line_type = LINE_NORMAL... | true | true |
f73a56bb8c3fa24fbce3f3d3df74194631bb27bd | 1,025 | py | Python | manage.py | kevotovar/kuras-backend | 22746977cb54018a7cf3a35a6bbe0fe04d21c2aa | [
"MIT"
] | null | null | null | manage.py | kevotovar/kuras-backend | 22746977cb54018a7cf3a35a6bbe0fe04d21c2aa | [
"MIT"
] | null | null | null | manage.py | kevotovar/kuras-backend | 22746977cb54018a7cf3a35a6bbe0fe04d21c2aa | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure tha... | 33.064516 | 77 | 0.654634 |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
try:
from django.core.management import execute_from_command_line
except ImportError:
try:
import django
except ImportE... | true | true |
f73a57a9315e6ad405d7faab8e9ae449849bbaa4 | 2,783 | py | Python | core/entry/entry.py | MaiAbboud/SwinTrack | 10b5636674f470a0df7d8c58df8b7e54f57ee324 | [
"MIT"
] | 1 | 2022-02-16T11:29:26.000Z | 2022-02-16T11:29:26.000Z | core/entry/entry.py | MaiAbboud/SwinTrack | 10b5636674f470a0df7d8c58df8b7e54f57ee324 | [
"MIT"
] | null | null | null | core/entry/entry.py | MaiAbboud/SwinTrack | 10b5636674f470a0df7d8c58df8b7e54f57ee324 | [
"MIT"
] | null | null | null | from miscellanies.torch.distributed import is_main_process
from contextlib import nullcontext
import torch.distributed
from miscellanies.torch.distributed import is_dist_available_and_initialized, get_world_size
import socket
import pprint
import os
from miscellanies.yaml_ops import load_yaml
from .sweep_utils import p... | 38.652778 | 123 | 0.720086 | from miscellanies.torch.distributed import is_main_process
from contextlib import nullcontext
import torch.distributed
from miscellanies.torch.distributed import is_dist_available_and_initialized, get_world_size
import socket
import pprint
import os
from miscellanies.yaml_ops import load_yaml
from .sweep_utils import p... | true | true |
f73a587b2f08b3c6f9d26edc537bbeda0b6f2156 | 4,034 | py | Python | utils.py | JosephRynkiewicz/CIFAR100 | 26e44e15346e31cae0522eb02099dd15e47f3a0f | [
"MIT"
] | 2 | 2021-05-20T10:26:45.000Z | 2021-11-02T13:59:14.000Z | utils.py | JosephRynkiewicz/CIFAR10 | 2eeef95480fdc8454296cbe2f90011aef660c6a8 | [
"MIT"
] | null | null | null | utils.py | JosephRynkiewicz/CIFAR10 | 2eeef95480fdc8454296cbe2f90011aef660c6a8 | [
"MIT"
] | 1 | 2020-10-12T14:39:15.000Z | 2020-10-12T14:39:15.000Z | '''Some helper functions for PyTorch, including:
- get_mean_and_std: calculate the mean and std value of dataset.
- msr_init: net parameter initialization.
- progress_bar: progress bar mimic xlua.progress.
'''
import os
import sys
import time
import math
import torch
import torch.nn as nn
import torch.nn.in... | 27.073826 | 97 | 0.584531 | import os
import sys
import time
import math
import torch
import torch.nn as nn
import torch.nn.init as init
def get_mean_and_std(dataset):
dataloader = torch.utils.data.DataLoader(dataset, batch_size=1, shuffle=False, num_workers=2)
mean = torch.zeros(3)
std = torch.zeros(3)
print('==> Computing mean... | true | true |
f73a592611389f9da17baf034519e5d46934b979 | 166 | py | Python | postproc/ml_tools/pod.py | J-Massey/postproc | 4552b0ad79072f5d217cf62632c08617ea3d2d82 | [
"MIT"
] | null | null | null | postproc/ml_tools/pod.py | J-Massey/postproc | 4552b0ad79072f5d217cf62632c08617ea3d2d82 | [
"MIT"
] | null | null | null | postproc/ml_tools/pod.py | J-Massey/postproc | 4552b0ad79072f5d217cf62632c08617ea3d2d82 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
@author: Jonathan Massey
@description: Compute the PCA of a flow field
@contact: jmom1n15@soton.ac.uk
"""
from torch import pca_lowrank
| 16.6 | 45 | 0.698795 |
from torch import pca_lowrank
| true | true |
f73a5ac8c2568549eccf9a0d3512b7f99bce3dc8 | 1,471 | py | Python | filter_plugins/passwd.py | liweitianux/ansible-dfly-vps | 46c40aa13c9b5e4174ea6a0ff2b6ebe6afbe1e0c | [
"MIT"
] | 7 | 2018-03-16T03:24:58.000Z | 2022-01-12T02:40:36.000Z | filter_plugins/passwd.py | liweitianux/ansible-dfly-vps | 46c40aa13c9b5e4174ea6a0ff2b6ebe6afbe1e0c | [
"MIT"
] | null | null | null | filter_plugins/passwd.py | liweitianux/ansible-dfly-vps | 46c40aa13c9b5e4174ea6a0ff2b6ebe6afbe1e0c | [
"MIT"
] | null | null | null | # Copyright (c) 2018 Aaron LI <aly@aaronly.me>
# MIT License
"""
Custom Ansible template filters to crypt/hash passwords.
"""
import os
import base64
import crypt
import hashlib
def cryptpass(p):
"""
Crypt the given plaintext password with salted SHA512 scheme,
which is supported by Linux/BSDs.
"""
... | 23.725806 | 65 | 0.636302 |
import os
import base64
import crypt
import hashlib
def cryptpass(p):
hashtype = "$6$"
saltlen = 16
salt = os.urandom(saltlen)
salt = base64.b64encode(salt)[:saltlen].decode("utf-8")
return crypt.crypt(p, hashtype+salt)
def dovecot_makepass(p):
scheme = "SHA512-CRYPT"
cp = cryptpass(... | true | true |
f73a5b13697bc3dd4b6ea921813fea8fb784758a | 2,070 | py | Python | magpie/ui/management/__init__.py | Ouranosinc/Magpie | 24c4ec2d3f98eb71fba7b199281882dbc62b6693 | [
"Apache-2.0"
] | null | null | null | magpie/ui/management/__init__.py | Ouranosinc/Magpie | 24c4ec2d3f98eb71fba7b199281882dbc62b6693 | [
"Apache-2.0"
] | 366 | 2017-10-04T14:58:52.000Z | 2022-03-16T21:44:07.000Z | magpie/ui/management/__init__.py | Ouranosinc/Magpie | 24c4ec2d3f98eb71fba7b199281882dbc62b6693 | [
"Apache-2.0"
] | 3 | 2018-09-05T13:46:04.000Z | 2021-02-05T14:52:15.000Z | from pyramid.settings import asbool
from magpie.constants import get_constant
from magpie.utils import get_logger
LOGGER = get_logger(__name__)
def includeme(config):
from magpie.ui.management.views import ManagementViews
LOGGER.info("Adding UI management...")
config.add_route(ManagementViews.view_group... | 48.139535 | 110 | 0.658937 | from pyramid.settings import asbool
from magpie.constants import get_constant
from magpie.utils import get_logger
LOGGER = get_logger(__name__)
def includeme(config):
from magpie.ui.management.views import ManagementViews
LOGGER.info("Adding UI management...")
config.add_route(ManagementViews.view_group... | true | true |
f73a5b4c0823bf2f427d205d1596d0ebdcaea6a8 | 155 | py | Python | report/urls.py | Aimsucks/blue_donut | 4c769e8a9923a120ff5c8b28221b79aca370121d | [
"MIT"
] | 5 | 2020-01-16T20:04:26.000Z | 2020-03-11T23:33:49.000Z | report/urls.py | Aimsucks/blue-donut | 4c769e8a9923a120ff5c8b28221b79aca370121d | [
"MIT"
] | 2 | 2019-12-19T21:07:27.000Z | 2020-02-02T13:51:04.000Z | report/urls.py | Aimsucks/blue_donut | 4c769e8a9923a120ff5c8b28221b79aca370121d | [
"MIT"
] | 9 | 2020-04-12T16:24:53.000Z | 2020-10-30T02:04:57.000Z | from django.urls import path
import report.views
app_name = 'report'
urlpatterns = [
path('', report.views.ReportView.as_view(), name='report'),
]
| 14.090909 | 63 | 0.696774 | from django.urls import path
import report.views
app_name = 'report'
urlpatterns = [
path('', report.views.ReportView.as_view(), name='report'),
]
| true | true |
f73a5c47fa6697de6313de0e177e490c0e35f948 | 4,334 | py | Python | tests/integration/test_MatchApi.py | physicsninja/Riot-Watcher | 2cd51c2cade112d018dd515f282e248940429ea0 | [
"MIT"
] | null | null | null | tests/integration/test_MatchApi.py | physicsninja/Riot-Watcher | 2cd51c2cade112d018dd515f282e248940429ea0 | [
"MIT"
] | null | null | null | tests/integration/test_MatchApi.py | physicsninja/Riot-Watcher | 2cd51c2cade112d018dd515f282e248940429ea0 | [
"MIT"
] | null | null | null |
import sys
import pytest
if sys.version_info > (3, 0):
import unittest.mock as mock
else:
import mock
class MatchApiContext(object):
def __init__(self, mock_context):
self._mock_context = mock_context
self._expected_response = {'has_value': 'yes', }
mock_response = mock.MagicMo... | 32.586466 | 129 | 0.608214 |
import sys
import pytest
if sys.version_info > (3, 0):
import unittest.mock as mock
else:
import mock
class MatchApiContext(object):
def __init__(self, mock_context):
self._mock_context = mock_context
self._expected_response = {'has_value': 'yes', }
mock_response = mock.MagicMo... | true | true |
f73a5ca147bbcf803a45dddf79634a838fd02abf | 1,084 | py | Python | daily_exercise/680. Valid Palindrome II_medium.py | JunzhongLin/leetcode_practice | 47b2f5cc3c87de004ae21a94024e751b40b8f559 | [
"MIT"
] | null | null | null | daily_exercise/680. Valid Palindrome II_medium.py | JunzhongLin/leetcode_practice | 47b2f5cc3c87de004ae21a94024e751b40b8f559 | [
"MIT"
] | null | null | null | daily_exercise/680. Valid Palindrome II_medium.py | JunzhongLin/leetcode_practice | 47b2f5cc3c87de004ae21a94024e751b40b8f559 | [
"MIT"
] | null | null | null | class Solution:
def validPalindrome(self, s: str) -> bool:
deleted = 0
left, right = 0, len(s) - 1
while left < right:
if s[left] == s[right]:
left += 1
right -= 1
else:
deleted += 1
if deleted >= 2:
... | 28.526316 | 46 | 0.306273 | class Solution:
def validPalindrome(self, s: str) -> bool:
deleted = 0
left, right = 0, len(s) - 1
while left < right:
if s[left] == s[right]:
left += 1
right -= 1
else:
deleted += 1
if deleted >= 2:
... | true | true |
f73a5d3bf783e3bddeecfc74bc1f4d2ba34e5858 | 8,789 | py | Python | qa/rpc-tests/bip9-softforks.py | mirzaei-ce/core-koobit | 7d24e9c554fec6f3631691f456e9873bc4536fbd | [
"MIT"
] | null | null | null | qa/rpc-tests/bip9-softforks.py | mirzaei-ce/core-koobit | 7d24e9c554fec6f3631691f456e9873bc4536fbd | [
"MIT"
] | null | null | null | qa/rpc-tests/bip9-softforks.py | mirzaei-ce/core-koobit | 7d24e9c554fec6f3631691f456e9873bc4536fbd | [
"MIT"
] | null | null | null | #!/usr/bin/env python2
# Copyright (c) 2015 The Bitcoin Core developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util import *
from... | 39.95 | 110 | 0.664126 |
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util import *
from test_framework.mininode import CTransaction, NetworkThread
from test_framework.blocktools import create_coinbase, create_block
from test_framework.comptool import TestInstance, TestManager
from test_framework.... | true | true |
f73a5dd14d74340a9e453ad6b782940bfd727359 | 4,299 | py | Python | src/model/loss.py | dmitry-vorobiev/kaggle-deepfake-detection-challenge | d8b545e1944342ba25209f1f62d9ca70314ab73a | [
"Apache-2.0"
] | null | null | null | src/model/loss.py | dmitry-vorobiev/kaggle-deepfake-detection-challenge | d8b545e1944342ba25209f1f62d9ca70314ab73a | [
"Apache-2.0"
] | null | null | null | src/model/loss.py | dmitry-vorobiev/kaggle-deepfake-detection-challenge | d8b545e1944342ba25209f1f62d9ca70314ab73a | [
"Apache-2.0"
] | null | null | null | import torch
import torch.nn.functional as F
from torch import FloatTensor, LongTensor, Tensor
from typing import Dict, Tuple
from . import ModelOut
from .ops import act, ones, zeros, reshape_as
from torch import nn
Batch = Tuple[FloatTensor, LongTensor]
def activation_loss(x: Tensor, y: LongTensor) -> Tensor:
... | 29.854167 | 109 | 0.612235 | import torch
import torch.nn.functional as F
from torch import FloatTensor, LongTensor, Tensor
from typing import Dict, Tuple
from . import ModelOut
from .ops import act, ones, zeros, reshape_as
from torch import nn
Batch = Tuple[FloatTensor, LongTensor]
def activation_loss(x: Tensor, y: LongTensor) -> Tensor:
... | true | true |
f73a5ded717718aafa2af0d5807b1df9f14493ab | 487 | py | Python | rdmo/tasks/migrations/0003_meta.py | Raspeanut/rdmo | 9f785010a499c372a2f8368ccf76d2ea4150adcb | [
"Apache-2.0"
] | 77 | 2016-08-09T11:40:20.000Z | 2022-03-06T11:03:26.000Z | rdmo/tasks/migrations/0003_meta.py | Raspeanut/rdmo | 9f785010a499c372a2f8368ccf76d2ea4150adcb | [
"Apache-2.0"
] | 377 | 2016-07-01T13:59:36.000Z | 2022-03-30T13:53:19.000Z | rdmo/tasks/migrations/0003_meta.py | Raspeanut/rdmo | 9f785010a499c372a2f8368ccf76d2ea4150adcb | [
"Apache-2.0"
] | 47 | 2016-06-23T11:32:19.000Z | 2022-03-01T11:34:37.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-07-26 15:01
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tasks', '0002_many_to_many_for_conditions'),
]
operations = [
migrations.Alter... | 23.190476 | 80 | 0.634497 |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tasks', '0002_many_to_many_for_conditions'),
]
operations = [
migrations.AlterField(
model_name='task',
name='conditions',... | true | true |
f73a5e1ac1c2a827569dfec324b74ae376952bd3 | 2,573 | py | Python | setup.py | marvin-manga/wtforms-alchemy | b80a2839f95cab7a60319c6237fd1b52025b76cc | [
"BSD-3-Clause"
] | null | null | null | setup.py | marvin-manga/wtforms-alchemy | b80a2839f95cab7a60319c6237fd1b52025b76cc | [
"BSD-3-Clause"
] | null | null | null | setup.py | marvin-manga/wtforms-alchemy | b80a2839f95cab7a60319c6237fd1b52025b76cc | [
"BSD-3-Clause"
] | null | null | null | """
WTForms-Alchemy
---------------
Generates WTForms forms from SQLAlchemy models.
"""
from setuptools import setup
import os
import re
import sys
HERE = os.path.dirname(os.path.abspath(__file__))
PY3 = sys.version_info[0] == 3
def get_version():
filename = os.path.join(HERE, 'wtforms_alchemy', '__init__.py'... | 27.666667 | 70 | 0.586475 |
from setuptools import setup
import os
import re
import sys
HERE = os.path.dirname(os.path.abspath(__file__))
PY3 = sys.version_info[0] == 3
def get_version():
filename = os.path.join(HERE, 'wtforms_alchemy', '__init__.py')
with open(filename) as f:
contents = f.read()
pattern = r"^__version__ ... | true | true |
f73a5e66d774d6e8d3e14d76de95382d308e58bb | 3,464 | py | Python | common.py | colspan/hokkaido-opendata-extractor | e08eae8de02a0b421829556b6b82a893021674de | [
"MIT"
] | null | null | null | common.py | colspan/hokkaido-opendata-extractor | e08eae8de02a0b421829556b6b82a893021674de | [
"MIT"
] | null | null | null | common.py | colspan/hokkaido-opendata-extractor | e08eae8de02a0b421829556b6b82a893021674de | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import luigi
import requests
class downloader(luigi.Task):
filepath = luigi.Parameter()
url = luigi.Parameter()
def output(self):
return luigi.LocalTarget(self.filepath, format=luigi.format.Nop)
def run(self):
r = requests.get(self.url)
with self.outp... | 29.355932 | 88 | 0.577656 |
import luigi
import requests
class downloader(luigi.Task):
filepath = luigi.Parameter()
url = luigi.Parameter()
def output(self):
return luigi.LocalTarget(self.filepath, format=luigi.format.Nop)
def run(self):
r = requests.get(self.url)
with self.output().open("wb") as f:
... | true | true |
f73a5e6f9a94f4764b7e43763cbb76786aa2260c | 921 | py | Python | basic_test.py | lzhyu/GridWorld | 43669fb1dd01df1a94bc8671d4ee6a466f6f49d0 | [
"MIT"
] | null | null | null | basic_test.py | lzhyu/GridWorld | 43669fb1dd01df1a94bc8671d4ee6a466f6f49d0 | [
"MIT"
] | null | null | null | basic_test.py | lzhyu/GridWorld | 43669fb1dd01df1a94bc8671d4ee6a466f6f49d0 | [
"MIT"
] | 2 | 2021-03-21T06:05:04.000Z | 2021-09-22T06:51:55.000Z | # to run basic test for all envs
import inspect
from gridworld.utils.wrapper.wrappers import ImageInputWarpper
from gridworld.utils.test_util import *
import gridworld
import os
import importlib
from gridworld.envs.fourrooms import FourroomsBase
path = os.path.dirname(__file__)
envs_path = os.path.join(path, 'gridwor... | 31.758621 | 91 | 0.67101 |
import inspect
from gridworld.utils.wrapper.wrappers import ImageInputWarpper
from gridworld.utils.test_util import *
import gridworld
import os
import importlib
from gridworld.envs.fourrooms import FourroomsBase
path = os.path.dirname(__file__)
envs_path = os.path.join(path, 'gridworld', 'envs')
envfiles = [ f for... | true | true |
f73a5f9b6f94a686b2f7b30de9d2ab26fb9aeb2a | 3,908 | py | Python | server/core/formgen/FormData.py | legionem/pdfgen | 0bd2b82e7834a78b6cb6066cfe6be98fc0dcba6e | [
"MIT"
] | 1 | 2020-08-23T22:14:27.000Z | 2020-08-23T22:14:27.000Z | server/core/formgen/FormData.py | legionem/pdfgen | 0bd2b82e7834a78b6cb6066cfe6be98fc0dcba6e | [
"MIT"
] | 1 | 2018-10-03T15:01:04.000Z | 2018-10-03T15:01:04.000Z | server/core/formgen/FormData.py | legionem/pdfgen | 0bd2b82e7834a78b6cb6066cfe6be98fc0dcba6e | [
"MIT"
] | null | null | null | # -*- coding: utf8 -*-
__author__ = 'Aleksandrov Oleg, 4231'
from PDFGenDAOPostgres import PDFGenDAOPostgres
from PDFGenDAOMySQL import PDFGenDAOMySQL
import settings
class FormData:
__dao = None
__qs = []
__small_qr = []
__version = "0.1"
__id_user = "null"
__id_owner = "null"
__id_premis... | 32.297521 | 106 | 0.574463 |
__author__ = 'Aleksandrov Oleg, 4231'
from PDFGenDAOPostgres import PDFGenDAOPostgres
from PDFGenDAOMySQL import PDFGenDAOMySQL
import settings
class FormData:
__dao = None
__qs = []
__small_qr = []
__version = "0.1"
__id_user = "null"
__id_owner = "null"
__id_premise = "null"
__id_me... | true | true |
f73a5fb7698d2bbec96be49335d57d0c3df1411b | 5,877 | py | Python | tensorflow/python/compat/compat.py | srisharaan/tensorflow | c787e6cdbbf57434599a42bbdc5e4d4df98ed045 | [
"Apache-2.0"
] | null | null | null | tensorflow/python/compat/compat.py | srisharaan/tensorflow | c787e6cdbbf57434599a42bbdc5e4d4df98ed045 | [
"Apache-2.0"
] | null | null | null | tensorflow/python/compat/compat.py | srisharaan/tensorflow | c787e6cdbbf57434599a42bbdc5e4d4df98ed045 | [
"Apache-2.0"
] | 1 | 2020-08-28T07:24:37.000Z | 2020-08-28T07:24:37.000Z | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 35.191617 | 82 | 0.74766 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import datetime
import os
from tensorflow.python.util import tf_contextlib
from tensorflow.python.util.tf_export import tf_export
_FORWARD_COMPATIBILITY_HORIZON = datetime.date(2020, 1, 28)
... | true | true |
f73a60e6875aa5553a206b1da9c9f3f341b43114 | 1,304 | py | Python | utils.py | tkipf/gym-gridworld | 807c88373023dc4240e8688e2744ea3dccd560bc | [
"MIT"
] | 13 | 2019-06-12T15:16:44.000Z | 2021-05-23T07:04:34.000Z | utils.py | tkipf/gym-gridworld | 807c88373023dc4240e8688e2744ea3dccd560bc | [
"MIT"
] | null | null | null | utils.py | tkipf/gym-gridworld | 807c88373023dc4240e8688e2744ea3dccd560bc | [
"MIT"
] | 1 | 2019-11-07T05:34:26.000Z | 2019-11-07T05:34:26.000Z | """Utility functions."""
import h5py
import numpy as np
from torch.utils import data
def save_dict_h5py(data, fname):
"""Save dictionary containing numpy arrays to h5py file."""
with h5py.File(fname, 'w') as hf:
for key in data.keys():
hf.create_dataset(key, data=data[key])
def load_di... | 26.08 | 78 | 0.621166 |
import h5py
import numpy as np
from torch.utils import data
def save_dict_h5py(data, fname):
with h5py.File(fname, 'w') as hf:
for key in data.keys():
hf.create_dataset(key, data=data[key])
def load_dict_h5py(fname):
data = dict()
with h5py.File(fname, 'r') as hf:
for key i... | true | true |
f73a615a9787da2bebfe0da449462b75ff706ff1 | 22,548 | py | Python | saleor/graphql/shipping/mutations/shippings.py | victor-abz/saleor | f8e2b49703d995d4304d5a690dbe9c83631419d0 | [
"CC-BY-4.0"
] | 1 | 2022-03-25T00:21:11.000Z | 2022-03-25T00:21:11.000Z | saleor/graphql/shipping/mutations/shippings.py | victor-abz/saleor | f8e2b49703d995d4304d5a690dbe9c83631419d0 | [
"CC-BY-4.0"
] | 8 | 2022-03-21T04:41:54.000Z | 2022-03-28T04:51:59.000Z | saleor/graphql/shipping/mutations/shippings.py | victor-abz/saleor | f8e2b49703d995d4304d5a690dbe9c83631419d0 | [
"CC-BY-4.0"
] | 1 | 2021-12-28T18:02:49.000Z | 2021-12-28T18:02:49.000Z | from collections import defaultdict
import graphene
from django.core.exceptions import ValidationError
from django.db.utils import IntegrityError
from ....core.permissions import ShippingPermissions
from ....core.tracing import traced_atomic_transaction
from ....product import models as product_models
from ....shippi... | 35.904459 | 88 | 0.646177 | from collections import defaultdict
import graphene
from django.core.exceptions import ValidationError
from django.db.utils import IntegrityError
from ....core.permissions import ShippingPermissions
from ....core.tracing import traced_atomic_transaction
from ....product import models as product_models
from ....shippi... | true | true |
f73a61a0ad6e9b3ccd18054a82008f2e8e8c1a0c | 2,401 | py | Python | ktrain/tests/test_chinese_text.py | sanidhya-singh/ktrain | f91f703e3ecd189c035a532590e6c6ec26a733a3 | [
"MIT"
] | null | null | null | ktrain/tests/test_chinese_text.py | sanidhya-singh/ktrain | f91f703e3ecd189c035a532590e6c6ec26a733a3 | [
"MIT"
] | null | null | null | ktrain/tests/test_chinese_text.py | sanidhya-singh/ktrain | f91f703e3ecd189c035a532590e6c6ec26a733a3 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
"""
Tests of ktrain text classification flows
"""
import sys
import os
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID";
os.environ["CUDA_VISIBLE_DEVICES"]="0"
sys.path.insert(0,'../..')
import IPython
from unittest import TestCase, main, skip
import numpy as np
import ktrain
from ktrain import text ... | 34.3 | 88 | 0.638484 |
import sys
import os
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID";
os.environ["CUDA_VISIBLE_DEVICES"]="0"
sys.path.insert(0,'../..')
import IPython
from unittest import TestCase, main, skip
import numpy as np
import ktrain
from ktrain import text as txt
TEST_DOC = '还好,床很大而且很干净,前台很友好,很满意,下次还来。'
class TestTextClassific... | true | true |
f73a6273326d909f787929426158b94030c8a19b | 21,479 | py | Python | test/integration/ggrc/converters/test_export_csv.py | ks-manish/ggrc-core | f9499236e0c6d2e29ff9d2acf403fdecd9c8a173 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | test/integration/ggrc/converters/test_export_csv.py | ks-manish/ggrc-core | f9499236e0c6d2e29ff9d2acf403fdecd9c8a173 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | test/integration/ggrc/converters/test_export_csv.py | ks-manish/ggrc-core | f9499236e0c6d2e29ff9d2acf403fdecd9c8a173 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | # Copyright (C) 2019 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
from os.path import abspath, dirname, join
import collections
import ddt
from flask.json import dumps
from ggrc.converters import get_importables
from ggrc.models import inflector, all_models
from ggrc.mode... | 31.128986 | 78 | 0.492528 |
from os.path import abspath, dirname, join
import collections
import ddt
from flask.json import dumps
from ggrc.converters import get_importables
from ggrc.models import inflector, all_models
from ggrc.models.mixins import ScopeObject
from ggrc.models.reflection import AttributeInfo
from integration.ggrc import Tes... | true | true |
f73a62d4245f9cbc2e9632560d6ca5d3bcc4a269 | 1,406 | py | Python | Accidents/3_import_excel_tables.py | jp7492code/multiple-linear-regression | 7ec6b47554d238f6c5c52adde71d75893c83a6c1 | [
"BSD-3-Clause"
] | null | null | null | Accidents/3_import_excel_tables.py | jp7492code/multiple-linear-regression | 7ec6b47554d238f6c5c52adde71d75893c83a6c1 | [
"BSD-3-Clause"
] | null | null | null | Accidents/3_import_excel_tables.py | jp7492code/multiple-linear-regression | 7ec6b47554d238f6c5c52adde71d75893c83a6c1 | [
"BSD-3-Clause"
] | null | null | null | #!/bin/env python2.7
# import the two lookup tables from the excel file
# This requires xlrd.
# 1) open terminal
# 2) pip install xlrd
# if you get "ImportError", pip install -U pip setuptools then repeat
import sqlite3 # provides python with a library for sqlite
import xlrd
SQLITE_FILE = "UKRoadData.sqlite"
# opens... | 32.697674 | 80 | 0.711238 |
import sqlite3
import xlrd
SQLITE_FILE = "UKRoadData.sqlite"
conn = sqlite3.connect(SQLITE_FILE)
myCursor = conn.cursor()
roadDataXLS = xlrd.open_workbook(filename="Road-Accident-Safety-Data-Guide.xls")
(?,?) ",theValues)
es)
conn.commit()
| true | true |
f73a630bfb87882f22bb4192e434aec839270e40 | 99,504 | py | Python | airflow/www/views.py | SueSu-Wish/incubator-airflow | 5813c0c8e1e9832d403e5a8f5783d0cb77f2748c | [
"Apache-2.0"
] | null | null | null | airflow/www/views.py | SueSu-Wish/incubator-airflow | 5813c0c8e1e9832d403e5a8f5783d0cb77f2748c | [
"Apache-2.0"
] | null | null | null | airflow/www/views.py | SueSu-Wish/incubator-airflow | 5813c0c8e1e9832d403e5a8f5783d0cb77f2748c | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
#
# 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
... | 34.925939 | 163 | 0.569083 |
from past.builtins import basestring, unicode
import ast
import datetime as dt
import logging
import os
import pkg_resources
import socket
from functools import wraps
from datetime import timedelta
import copy
import math
import json
import pendulum
import codecs
from collections import defaultdict
im... | true | true |
f73a633b34d6d4eebbc2b7cb354a5d2ab296d1bb | 89 | py | Python | tritam_cpn_api/models/__init__.py | kenysmile/test_facebook | 844a3ddd53abd319c0115de86909118a37106c67 | [
"Apache-2.0"
] | null | null | null | tritam_cpn_api/models/__init__.py | kenysmile/test_facebook | 844a3ddd53abd319c0115de86909118a37106c67 | [
"Apache-2.0"
] | null | null | null | tritam_cpn_api/models/__init__.py | kenysmile/test_facebook | 844a3ddd53abd319c0115de86909118a37106c67 | [
"Apache-2.0"
] | null | null | null | from . import tritam_tracking
from . import tritam_api_constant
from . import tritam_sms
| 22.25 | 33 | 0.831461 | from . import tritam_tracking
from . import tritam_api_constant
from . import tritam_sms
| true | true |
f73a634f829aa670125b96cd9f28e533ba2f79e3 | 837 | py | Python | glue/core/data_exporters/qt/dialog.py | HPLegion/glue | 1843787ccb4de852dfe103ff58473da13faccf5f | [
"BSD-3-Clause"
] | 550 | 2015-01-08T13:51:06.000Z | 2022-03-31T11:54:47.000Z | glue/core/data_exporters/qt/dialog.py | HPLegion/glue | 1843787ccb4de852dfe103ff58473da13faccf5f | [
"BSD-3-Clause"
] | 1,362 | 2015-01-03T19:15:52.000Z | 2022-03-30T13:23:11.000Z | glue/core/data_exporters/qt/dialog.py | HPLegion/glue | 1843787ccb4de852dfe103ff58473da13faccf5f | [
"BSD-3-Clause"
] | 142 | 2015-01-08T13:08:00.000Z | 2022-03-18T13:25:57.000Z | from qtpy import compat
from glue import config
def export_data(data, components=None, exporter=None):
if exporter is None:
exporters = {}
for e in config.data_exporter:
if e.extension == '':
fltr = "{0} (*)".format(e.label)
else:
fltr = "{0... | 27.9 | 95 | 0.55675 | from qtpy import compat
from glue import config
def export_data(data, components=None, exporter=None):
if exporter is None:
exporters = {}
for e in config.data_exporter:
if e.extension == '':
fltr = "{0} (*)".format(e.label)
else:
fltr = "{0... | true | true |
f73a63c74bf1a400e6cb44786318ab12453cd272 | 308 | py | Python | src/emutils/tf/math.py | emanuele-albini/emutils | d5e3939da8a14b629879f06d87d4bd371e7117ab | [
"MIT"
] | null | null | null | src/emutils/tf/math.py | emanuele-albini/emutils | d5e3939da8a14b629879f06d87d4bd371e7117ab | [
"MIT"
] | null | null | null | src/emutils/tf/math.py | emanuele-albini/emutils | d5e3939da8a14b629879f06d87d4bd371e7117ab | [
"MIT"
] | null | null | null | import tensorflow as tf
def cov(x):
mean_x = tf.reduce_mean(x, axis=0, keepdims=True)
mx = tf.matmul(tf.transpose(mean_x), mean_x)
vx = tf.matmul(tf.transpose(x), x) / tf.cast(tf.shape(x)[0], tf.float64)
cov_xx = vx - mx
return cov_xx
def inv_cov(x):
return tf.linalg.inv(cov(x))
| 22 | 76 | 0.642857 | import tensorflow as tf
def cov(x):
mean_x = tf.reduce_mean(x, axis=0, keepdims=True)
mx = tf.matmul(tf.transpose(mean_x), mean_x)
vx = tf.matmul(tf.transpose(x), x) / tf.cast(tf.shape(x)[0], tf.float64)
cov_xx = vx - mx
return cov_xx
def inv_cov(x):
return tf.linalg.inv(cov(x))
| true | true |
f73a6563f02f126cf396faeb2beb4912e04b4c90 | 209 | py | Python | binproto2/exceptions.py | ghost58400/marlin-binary-protocol | fb93603866ecfce84e887c159bbbb9f9d2f01f17 | [
"MIT"
] | 3 | 2020-06-25T15:23:52.000Z | 2020-12-27T22:00:10.000Z | binproto2/exceptions.py | ghost58400/marlin-binary-protocol | fb93603866ecfce84e887c159bbbb9f9d2f01f17 | [
"MIT"
] | 2 | 2020-07-28T16:50:01.000Z | 2021-03-08T11:27:45.000Z | binproto2/exceptions.py | ghost58400/marlin-binary-protocol | fb93603866ecfce84e887c159bbbb9f9d2f01f17 | [
"MIT"
] | 4 | 2020-07-28T16:25:28.000Z | 2021-02-06T12:46:51.000Z | class ReadTimeout(Exception):
pass
class FatalError(Exception):
pass
class SynchronizationError(Exception):
pass
class PayloadOverflow(Exception):
pass
class ConnectionLost(Exception):
pass | 20.9 | 38 | 0.76555 | class ReadTimeout(Exception):
pass
class FatalError(Exception):
pass
class SynchronizationError(Exception):
pass
class PayloadOverflow(Exception):
pass
class ConnectionLost(Exception):
pass | true | true |
f73a66c7150d81f9d5215661887583cbee26d5a1 | 51,419 | py | Python | polymath/srdfg/base.py | lite-david/polymath | cf1addc75e203fa606ebc6d32bc552fb3975ea99 | [
"Apache-2.0"
] | null | null | null | polymath/srdfg/base.py | lite-david/polymath | cf1addc75e203fa606ebc6d32bc552fb3975ea99 | [
"Apache-2.0"
] | null | null | null | polymath/srdfg/base.py | lite-david/polymath | cf1addc75e203fa606ebc6d32bc552fb3975ea99 | [
"Apache-2.0"
] | null | null | null |
from polymath import UNSET_SHAPE, DEFAULT_SHAPES
import builtins
import operator
from collections import OrderedDict, Mapping, Sequence, deque
import functools
from numbers import Integral, Rational, Real
import contextlib
import traceback
import uuid
import numpy as np
import importlib
from .graph import Graph
from .... | 35.608726 | 158 | 0.607071 |
from polymath import UNSET_SHAPE, DEFAULT_SHAPES
import builtins
import operator
from collections import OrderedDict, Mapping, Sequence, deque
import functools
from numbers import Integral, Rational, Real
import contextlib
import traceback
import uuid
import numpy as np
import importlib
from .graph import Graph
from .... | true | true |
f73a68514b36d07bee3dc64335fe6985e7003dca | 654 | py | Python | f_monthpython/manage.py | koffi09/Parissssportif | 0ca2a57c27f15ffb389dbd350f0bb746751f2639 | [
"Apache-2.0"
] | null | null | null | f_monthpython/manage.py | koffi09/Parissssportif | 0ca2a57c27f15ffb389dbd350f0bb746751f2639 | [
"Apache-2.0"
] | null | null | null | f_monthpython/manage.py | koffi09/Parissssportif | 0ca2a57c27f15ffb389dbd350f0bb746751f2639 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'f_monthpython.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
... | 29.727273 | 78 | 0.663609 |
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'f_monthpython.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's insta... | true | true |
f73a6af3a877014f4954b7e193a6f76018104845 | 5,406 | py | Python | dbsp_drp/quicklook.py | finagle29/DBSP_DRP | d2f869f85e1425507dbc84e4e76fa44a6784f9d1 | [
"BSD-3-Clause"
] | 1 | 2021-05-17T23:28:25.000Z | 2021-05-17T23:28:25.000Z | dbsp_drp/quicklook.py | finagle29/DBSP_DRP | d2f869f85e1425507dbc84e4e76fa44a6784f9d1 | [
"BSD-3-Clause"
] | 23 | 2020-12-14T17:25:13.000Z | 2022-02-23T09:30:10.000Z | dbsp_drp/quicklook.py | finagle29/DBSP_DRP | d2f869f85e1425507dbc84e4e76fa44a6784f9d1 | [
"BSD-3-Clause"
] | null | null | null | import argparse
import os
import time
from typing import List, Optional
import glob
from multiprocessing import Process
import numpy as np
from astropy.io import fits
from pkg_resources import resource_filename
from pypeit.pypeitsetup import PypeItSetup
from pypeit.core import framematch
from pypeit import pypeit
fr... | 35.103896 | 110 | 0.621532 | import argparse
import os
import time
from typing import List, Optional
import glob
from multiprocessing import Process
import numpy as np
from astropy.io import fits
from pkg_resources import resource_filename
from pypeit.pypeitsetup import PypeItSetup
from pypeit.core import framematch
from pypeit import pypeit
fr... | true | true |
f73a6b1b0e4076f175322cf2155371734efb6c83 | 10,310 | py | Python | pybind/slxos/v16r_1_00b/interface/ethernet/ipv6/ipv6_config/address/link_local_config/__init__.py | shivharis/pybind | 4e1c6d54b9fd722ccec25546ba2413d79ce337e6 | [
"Apache-2.0"
] | null | null | null | pybind/slxos/v16r_1_00b/interface/ethernet/ipv6/ipv6_config/address/link_local_config/__init__.py | shivharis/pybind | 4e1c6d54b9fd722ccec25546ba2413d79ce337e6 | [
"Apache-2.0"
] | null | null | null | pybind/slxos/v16r_1_00b/interface/ethernet/ipv6/ipv6_config/address/link_local_config/__init__.py | shivharis/pybind | 4e1c6d54b9fd722ccec25546ba2413d79ce337e6 | [
"Apache-2.0"
] | 1 | 2021-11-05T22:15:42.000Z | 2021-11-05T22:15:42.000Z |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from d... | 65.253165 | 730 | 0.705141 |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from d... | true | true |
f73a6c138d64413a8b39866ab2b3401201615657 | 477 | py | Python | recipes/migrations/0004_recipe_difficulty.py | sergeant-savage/my-recipe-app | cb1b5c05928689aed2c1637d8b4cf1ab08daf4b6 | [
"MIT"
] | 1 | 2021-08-11T11:43:06.000Z | 2021-08-11T11:43:06.000Z | recipes/migrations/0004_recipe_difficulty.py | sergeant-savage/my-recipe-app | cb1b5c05928689aed2c1637d8b4cf1ab08daf4b6 | [
"MIT"
] | 8 | 2021-08-11T00:55:32.000Z | 2021-08-15T20:48:59.000Z | recipes/migrations/0004_recipe_difficulty.py | sergeant-savage/my-recipe-app | cb1b5c05928689aed2c1637d8b4cf1ab08daf4b6 | [
"MIT"
] | null | null | null | # Generated by Django 3.2.4 on 2021-07-01 01:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recipes', '0003_alter_recipe_description'),
]
operations = [
migrations.AddField(
model_name='recipe',
name='difficu... | 25.105263 | 133 | 0.595388 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recipes', '0003_alter_recipe_description'),
]
operations = [
migrations.AddField(
model_name='recipe',
name='difficulty',
field=models.CharField(choice... | true | true |
f73a6f7edb17988bfb903fbaeda2bd39ccfc91ab | 6,877 | py | Python | tasks/dogstatsd.py | confluentinc/datadog-agent | ea7982569bdf0c62c8adf00e2c5b855cc266f71c | [
"Apache-2.0"
] | 1 | 2021-02-18T21:23:52.000Z | 2021-02-18T21:23:52.000Z | tasks/dogstatsd.py | confluentinc/datadog-agent | ea7982569bdf0c62c8adf00e2c5b855cc266f71c | [
"Apache-2.0"
] | null | null | null | tasks/dogstatsd.py | confluentinc/datadog-agent | ea7982569bdf0c62c8adf00e2c5b855cc266f71c | [
"Apache-2.0"
] | null | null | null | """
Dogstatsd tasks
"""
from __future__ import print_function, absolute_import
import os
import shutil
from distutils.dir_util import copy_tree
import invoke
from invoke import task
from invoke.exceptions import Exit
from .build_tags import get_build_tags, get_default_build_tags
from .utils import get_build_flags, b... | 28.184426 | 100 | 0.644031 | from __future__ import print_function, absolute_import
import os
import shutil
from distutils.dir_util import copy_tree
import invoke
from invoke import task
from invoke.exceptions import Exit
from .build_tags import get_build_tags, get_default_build_tags
from .utils import get_build_flags, bin_name, get_root
from .... | true | true |
f73a6fd4dc154de2079875bbe0e3d6b7badbe1c9 | 53,759 | py | Python | sdk/python/pulumi_aws_native/events/_inputs.py | pulumi/pulumi-aws-native | 1ae4a4d9c2256b2a79ca536f8d8497b28d10e4c3 | [
"Apache-2.0"
] | 29 | 2021-09-30T19:32:07.000Z | 2022-03-22T21:06:08.000Z | sdk/python/pulumi_aws_native/events/_inputs.py | pulumi/pulumi-aws-native | 1ae4a4d9c2256b2a79ca536f8d8497b28d10e4c3 | [
"Apache-2.0"
] | 232 | 2021-09-30T19:26:26.000Z | 2022-03-31T23:22:06.000Z | sdk/python/pulumi_aws_native/events/_inputs.py | pulumi/pulumi-aws-native | 1ae4a4d9c2256b2a79ca536f8d8497b28d10e4c3 | [
"Apache-2.0"
] | 4 | 2021-11-10T19:42:01.000Z | 2022-02-05T10:15:49.000Z | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from... | 37.43663 | 139 | 0.681449 |
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from ._enums import *
__all__ = [
'ConnectionApiKeyAuthParametersArgs',
'ConnectionAuthParametersArgs',
'ConnectionBasicAuthParametersArgs',
'Connection... | true | true |
f73a702be5b625fdf39c3c96f7eaf1abd7603d8f | 20,723 | py | Python | rhapsody/lib/RhapsodyPixels.py | anarchiae/rhapsody5 | bd4c4f008d9d3df17ef400ce8895d3da913f6b39 | [
"MIT"
] | null | null | null | rhapsody/lib/RhapsodyPixels.py | anarchiae/rhapsody5 | bd4c4f008d9d3df17ef400ce8895d3da913f6b39 | [
"MIT"
] | null | null | null | rhapsody/lib/RhapsodyPixels.py | anarchiae/rhapsody5 | bd4c4f008d9d3df17ef400ce8895d3da913f6b39 | [
"MIT"
] | null | null | null | import time
import random
import RPi.GPIO as GPIO
import Adafruit_WS2801
import Adafruit_GPIO.SPI as SPI
class RhapsodyPixels:
numpixels = 0
myPixels = None
pixel_groups = None
def __init__(self, numpixels):
self.numpixels = numpixels
self.pixel_groups = dict()
self.myPixels ... | 39.775432 | 116 | 0.520822 | import time
import random
import RPi.GPIO as GPIO
import Adafruit_WS2801
import Adafruit_GPIO.SPI as SPI
class RhapsodyPixels:
numpixels = 0
myPixels = None
pixel_groups = None
def __init__(self, numpixels):
self.numpixels = numpixels
self.pixel_groups = dict()
self.myPixels ... | true | true |
f73a7075c60d39285ebd033cd6dd058aa7b72cc3 | 434 | py | Python | 1-DiveIntoPython/week5/lecturesdemos/AsychnchronousProgramming/asyncio4.py | mamoudmatook/PythonSpecializaionInRussian | 3340780b2f8a876a0f59e22036147fd98909d545 | [
"MIT"
] | null | null | null | 1-DiveIntoPython/week5/lecturesdemos/AsychnchronousProgramming/asyncio4.py | mamoudmatook/PythonSpecializaionInRussian | 3340780b2f8a876a0f59e22036147fd98909d545 | [
"MIT"
] | null | null | null | 1-DiveIntoPython/week5/lecturesdemos/AsychnchronousProgramming/asyncio4.py | mamoudmatook/PythonSpecializaionInRussian | 3340780b2f8a876a0f59e22036147fd98909d545 | [
"MIT"
] | null | null | null | import asyncio
async def sleep_task(num):
for i in range(5):
print(f'process task: {num} iter: {i}')
await asyncio.sleep(1)
return num
loop = asyncio.get_event_loop()
task_list = [loop.create_task(sleep_task(i)) for i in range(2)]
loop.run_until_complete(asyncio.wait(task_list))
loop.run_until... | 33.384615 | 71 | 0.735023 | import asyncio
async def sleep_task(num):
for i in range(5):
print(f'process task: {num} iter: {i}')
await asyncio.sleep(1)
return num
loop = asyncio.get_event_loop()
task_list = [loop.create_task(sleep_task(i)) for i in range(2)]
loop.run_until_complete(asyncio.wait(task_list))
loop.run_until... | true | true |
f73a717b8ef83204b9688dc413b4540f99317b3e | 730 | py | Python | Mundo-3/desafio-091.py | LeonardoARGR/Desafios-Python-Curso-em-Video | 3fb1b0615fce88f968b5ba6e4bac43fcb0e72d98 | [
"MIT"
] | 2 | 2020-04-18T21:56:35.000Z | 2020-04-23T00:00:08.000Z | Mundo-3/desafio-091.py | LeonardoARGR/Desafios-Python-Curso-em-Video | 3fb1b0615fce88f968b5ba6e4bac43fcb0e72d98 | [
"MIT"
] | null | null | null | Mundo-3/desafio-091.py | LeonardoARGR/Desafios-Python-Curso-em-Video | 3fb1b0615fce88f968b5ba6e4bac43fcb0e72d98 | [
"MIT"
] | null | null | null | # Importando funções.
from random import randint
from time import sleep
from operator import itemgetter
# Declarando os dicionários.
jogadores = dict()
colocacao = list()
# Colocando os jogadores e seus valores no dicionário, e mostrando eles na tela.
for r in range(1, 5):
jogadores[f'jogador{r}'] = randint(1, 6)... | 29.2 | 80 | 0.69589 |
from random import randint
from time import sleep
from operator import itemgetter
jogadores = dict()
colocacao = list()
for r in range(1, 5):
jogadores[f'jogador{r}'] = randint(1, 6)
print(f'O jogador{r} tirou {jogadores[f"jogador{r}"]} no dado.')
sleep(0.5)
print('=' * 25)
print(f'{"Ranking dos Joga... | true | true |
f73a718b1681f71998772b1d8bd361ba44fd6a7d | 1,835 | py | Python | mtp_api/apps/prison/utils.py | ministryofjustice/mtp-api | b1c34c29e4aa9f48598cb060abe1368ae7686e0b | [
"MIT"
] | 5 | 2016-01-05T12:21:35.000Z | 2020-10-28T17:06:02.000Z | mtp_api/apps/prison/utils.py | ministryofjustice/mtp-api | b1c34c29e4aa9f48598cb060abe1368ae7686e0b | [
"MIT"
] | 209 | 2015-06-12T09:39:41.000Z | 2022-03-21T16:01:19.000Z | mtp_api/apps/prison/utils.py | ministryofjustice/mtp-api | b1c34c29e4aa9f48598cb060abe1368ae7686e0b | [
"MIT"
] | 1 | 2021-04-11T06:19:23.000Z | 2021-04-11T06:19:23.000Z | import logging
from typing import Optional
import requests
from mtp_common import nomis
from prison.models import Prison, PrisonerLocation
logger = logging.getLogger('mtp')
def fetch_prisoner_location_from_nomis(prisoner_location: PrisonerLocation) -> Optional[PrisonerLocation]:
new_location = None
try:
... | 38.229167 | 118 | 0.667575 | import logging
from typing import Optional
import requests
from mtp_common import nomis
from prison.models import Prison, PrisonerLocation
logger = logging.getLogger('mtp')
def fetch_prisoner_location_from_nomis(prisoner_location: PrisonerLocation) -> Optional[PrisonerLocation]:
new_location = None
try:
... | true | true |
f73a72404a4472fc57a4f25d62a2062da253395f | 630 | py | Python | app/grandchallenge/evaluation/migrations/0009_auto_20210723_0911.py | nlessmann/grand-challenge.org | 36abf6ccb40e2fc3fd3ff00e81deabd76f7e1ef8 | [
"Apache-2.0"
] | 101 | 2018-04-11T14:48:04.000Z | 2022-03-28T00:29:48.000Z | app/grandchallenge/evaluation/migrations/0009_auto_20210723_0911.py | nlessmann/grand-challenge.org | 36abf6ccb40e2fc3fd3ff00e81deabd76f7e1ef8 | [
"Apache-2.0"
] | 1,733 | 2018-03-21T11:56:16.000Z | 2022-03-31T14:58:30.000Z | app/grandchallenge/evaluation/migrations/0009_auto_20210723_0911.py | nlessmann/grand-challenge.org | 36abf6ccb40e2fc3fd3ff00e81deabd76f7e1ef8 | [
"Apache-2.0"
] | 42 | 2018-06-08T05:49:07.000Z | 2022-03-29T08:43:01.000Z | # Generated by Django 3.1.11 on 2021-07-23 09:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("evaluation", "0008_evaluation_input_prefixes"),
]
operations = [
migrations.RemoveField(model_name="submission", name="creators_ip",),
... | 28.636364 | 77 | 0.64127 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("evaluation", "0008_evaluation_input_prefixes"),
]
operations = [
migrations.RemoveField(model_name="submission", name="creators_ip",),
migrations.RemoveField(
model_nam... | true | true |
f73a7323151468c16dd2139217f839b9d42f3a79 | 624 | py | Python | peekingduck/pipeline/nodes/heuristic/utils/__init__.py | leeping-ng/PeekingDuck | 16784b4c35f30c463fcc0c7caccdda6141797a6b | [
"Apache-2.0"
] | null | null | null | peekingduck/pipeline/nodes/heuristic/utils/__init__.py | leeping-ng/PeekingDuck | 16784b4c35f30c463fcc0c7caccdda6141797a6b | [
"Apache-2.0"
] | null | null | null | peekingduck/pipeline/nodes/heuristic/utils/__init__.py | leeping-ng/PeekingDuck | 16784b4c35f30c463fcc0c7caccdda6141797a6b | [
"Apache-2.0"
] | null | null | null | # Copyright 2021 AI Singapore
#
# 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 writing... | 34.666667 | 74 | 0.759615 | true | true | |
f73a74d09d20b64f141e8b191e4eb76a7ddc11e3 | 791 | py | Python | ondewo/qa/core/services_container.py | foldvaridominic/ondewo-nlu-client-python | a4e766252fc2fdd2372860755082480b4234609a | [
"Apache-2.0"
] | null | null | null | ondewo/qa/core/services_container.py | foldvaridominic/ondewo-nlu-client-python | a4e766252fc2fdd2372860755082480b4234609a | [
"Apache-2.0"
] | 5 | 2021-11-23T09:43:28.000Z | 2021-12-17T15:09:06.000Z | ondewo/qa/core/services_container.py | foldvaridominic/ondewo-nlu-client-python | a4e766252fc2fdd2372860755082480b4234609a | [
"Apache-2.0"
] | 1 | 2022-02-22T08:54:57.000Z | 2022-02-22T08:54:57.000Z | # Copyright 2021 ONDEWO GmbH
#
# 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, ... | 31.64 | 74 | 0.782554 |
from dataclasses import dataclass
from ondewo.qa.services.qa import QA
from ondewo.utils.base_service_container import BaseServicesContainer
@dataclass
class ServicesContainer(BaseServicesContainer):
qa: QA
| true | true |
f73a766cb9d5eec77567047d3db3f49699b74b1b | 13,030 | py | Python | cryptoapis/model/list_confirmed_transactions_by_address_r_data.py | Crypto-APIs/Crypto_APIs_2.0_SDK_Python | c59ebd914850622b2c6500c4c30af31fb9cecf0e | [
"MIT"
] | 5 | 2021-05-17T04:45:03.000Z | 2022-03-23T12:51:46.000Z | cryptoapis/model/list_confirmed_transactions_by_address_r_data.py | Crypto-APIs/Crypto_APIs_2.0_SDK_Python | c59ebd914850622b2c6500c4c30af31fb9cecf0e | [
"MIT"
] | null | null | null | cryptoapis/model/list_confirmed_transactions_by_address_r_data.py | Crypto-APIs/Crypto_APIs_2.0_SDK_Python | c59ebd914850622b2c6500c4c30af31fb9cecf0e | [
"MIT"
] | 2 | 2021-06-02T07:32:26.000Z | 2022-02-12T02:36:23.000Z | """
CryptoAPIs
Crypto APIs 2.0 is a complex and innovative infrastructure layer that radically simplifies the development of any Blockchain and Crypto related applications. Organized around REST, Crypto APIs 2.0 can assist both novice Bitcoin/Ethereum enthusiasts and crypto experts with the development of thei... | 45.400697 | 484 | 0.589793 |
import re
import sys
from cryptoapis.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_composed_info,
OpenA... | true | true |
f73a781985dc979e642260615b0f59b3ed2aac0c | 8,949 | py | Python | rl/envs/mujoco/ant.py | luanagbmartins/cavia | 91f093af9d6f463ee651db533f6c2acc637c7e9f | [
"MIT"
] | 122 | 2019-05-24T01:47:19.000Z | 2022-03-30T13:16:17.000Z | rl/envs/mujoco/ant.py | luanagbmartins/cavia | 91f093af9d6f463ee651db533f6c2acc637c7e9f | [
"MIT"
] | 5 | 2019-06-12T15:55:38.000Z | 2021-07-02T01:22:47.000Z | rl/envs/mujoco/ant.py | luanagbmartins/cavia | 91f093af9d6f463ee651db533f6c2acc637c7e9f | [
"MIT"
] | 36 | 2019-06-19T11:36:58.000Z | 2022-03-30T13:16:18.000Z | import numpy as np
from gym.envs.mujoco import AntEnv as AntEnv_
class AntEnv(AntEnv_):
@property
def action_scaling(self):
if (not hasattr(self, 'action_space')) or (self.action_space is None):
return 1.0
if self._action_scaling is None:
lb, ub = self.action_... | 42.212264 | 124 | 0.624986 | import numpy as np
from gym.envs.mujoco import AntEnv as AntEnv_
class AntEnv(AntEnv_):
@property
def action_scaling(self):
if (not hasattr(self, 'action_space')) or (self.action_space is None):
return 1.0
if self._action_scaling is None:
lb, ub = self.action_... | true | true |
f73a785727b404231c6b1d1649819a2e9efcadf2 | 1,045 | py | Python | python/cudf/cudf/tests/test_decimal.py | BenikaHall/cudf | d3f5add210293a4832dafb85f04cbb73149b9d54 | [
"Apache-2.0"
] | null | null | null | python/cudf/cudf/tests/test_decimal.py | BenikaHall/cudf | d3f5add210293a4832dafb85f04cbb73149b9d54 | [
"Apache-2.0"
] | 1 | 2021-02-23T18:05:36.000Z | 2021-02-23T18:05:36.000Z | python/cudf/cudf/tests/test_decimal.py | BenikaHall/cudf | d3f5add210293a4832dafb85f04cbb73149b9d54 | [
"Apache-2.0"
] | 1 | 2020-11-10T03:19:16.000Z | 2020-11-10T03:19:16.000Z | # Copyright (c) 2021, NVIDIA CORPORATION.
from decimal import Decimal
import pyarrow as pa
import pytest
from cudf.core.column import DecimalColumn
@pytest.mark.parametrize(
"data",
[
[Decimal("1.1"), Decimal("2.2"), Decimal("3.3"), Decimal("4.4")],
[Decimal("-1.1"), Decimal("2.2"), Decimal... | 23.75 | 74 | 0.583732 |
from decimal import Decimal
import pyarrow as pa
import pytest
from cudf.core.column import DecimalColumn
@pytest.mark.parametrize(
"data",
[
[Decimal("1.1"), Decimal("2.2"), Decimal("3.3"), Decimal("4.4")],
[Decimal("-1.1"), Decimal("2.2"), Decimal("3.3"), Decimal("4.4")],
[1],
... | true | true |
f73a78765c11722356d6568c01bb9cec01563be3 | 3,916 | py | Python | displayminion/Action.py | cedarsuite/displayclient | 2ea5786d956edcfe34deda9694f9e6b353446bc8 | [
"MIT"
] | null | null | null | displayminion/Action.py | cedarsuite/displayclient | 2ea5786d956edcfe34deda9694f9e6b353446bc8 | [
"MIT"
] | null | null | null | displayminion/Action.py | cedarsuite/displayclient | 2ea5786d956edcfe34deda9694f9e6b353446bc8 | [
"MIT"
] | null | null | null | fade_old_max_wait = 1 # Wait no more than this many seconds to fade out old action
import kivy
kivy.require('1.9.0')
from kivy.animation import Animation
from kivy.clock import Clock
class Action:
def __init__(self, action, old_action, client):
self.action = action
self.old_action = old_action
... | 29.443609 | 96 | 0.550817 | fade_old_max_wait = 1
import kivy
kivy.require('1.9.0')
from kivy.animation import Animation
from kivy.clock import Clock
class Action:
def __init__(self, action, old_action, client):
self.action = action
self.old_action = old_action
self.client = client
self.meteor = self.clien... | true | true |
f73a78a965ea8458029ca99d12740408aa1b376a | 2,016 | py | Python | 4.conditionals/challenge2_rouillonh.py | rouillonh/ChallengePython | 7e7d9b69f60394fd1f00a6a4aa32f97de95b1b92 | [
"MIT"
] | null | null | null | 4.conditionals/challenge2_rouillonh.py | rouillonh/ChallengePython | 7e7d9b69f60394fd1f00a6a4aa32f97de95b1b92 | [
"MIT"
] | null | null | null | 4.conditionals/challenge2_rouillonh.py | rouillonh/ChallengePython | 7e7d9b69f60394fd1f00a6a4aa32f97de95b1b92 | [
"MIT"
] | null | null | null | #Importamos la librería random para el flip de la moneda
import random
print("\tWelcome to the Coin Toss App")
#Pedimos la cantidad de veces que se va tirar la moneda
flip = int(input("How many times would you like me to flip the coin: "))
r = input("Would you like to see the result of each flip (y/n): ").lower()
#Crea... | 48 | 159 | 0.600694 |
import random
print("\tWelcome to the Coin Toss App")
flip = int(input("How many times would you like me to flip the coin: "))
r = input("Would you like to see the result of each flip (y/n): ").lower()
x = []
head = 0
tail = 0
print("\nFlipping!\n")
if r.startswith('n'):
for i in range(flip):
tiro = ran... | true | true |
f73a7912985d51f91ff457ce2256f6b6cfa396d9 | 775 | py | Python | Classification/Work 2/NaiveBayes/naivebayes_crossvalidation.py | leniel/DataMining | f249f636ede67a29de986b8f34c9cbe75b680f47 | [
"MIT"
] | null | null | null | Classification/Work 2/NaiveBayes/naivebayes_crossvalidation.py | leniel/DataMining | f249f636ede67a29de986b8f34c9cbe75b680f47 | [
"MIT"
] | null | null | null | Classification/Work 2/NaiveBayes/naivebayes_crossvalidation.py | leniel/DataMining | f249f636ede67a29de986b8f34c9cbe75b680f47 | [
"MIT"
] | null | null | null | '''
Created on Sat Nov 05 2016
Copyright (c) 2016 Leniel Macaferi's Consulting
'''
import os
import pandas as pd
from sklearn.naive_bayes import GaussianNB
from sklearn.model_selection import cross_val_score
path = os.path.realpath('..')
# Loading the data used to train
trainingSet = pd.read_csv(os.path.join(p... | 26.724138 | 108 | 0.731613 |
import os
import pandas as pd
from sklearn.naive_bayes import GaussianNB
from sklearn.model_selection import cross_val_score
path = os.path.realpath('..')
trainingSet = pd.read_csv(os.path.join(path, '../Data/classification-training.csv'), sep=',', header = None)
classes = trainingSet[trainingSet.columns[22]]
fea... | true | true |
f73a791557d22427892d85d38038b66fb93156e5 | 1,376 | py | Python | python/word-pattern/test_word_pattern.py | gurupratap-matharu/Exercism | a083c8d4bbc10d777524d917329a34e560201c9c | [
"MIT"
] | null | null | null | python/word-pattern/test_word_pattern.py | gurupratap-matharu/Exercism | a083c8d4bbc10d777524d917329a34e560201c9c | [
"MIT"
] | null | null | null | python/word-pattern/test_word_pattern.py | gurupratap-matharu/Exercism | a083c8d4bbc10d777524d917329a34e560201c9c | [
"MIT"
] | null | null | null | """
Testing script to check edge cases for word_pattern.py
"""
import unittest
from word_pattern import Solution
class WordPatternTests(unittest.TestCase):
"""
Test suite to check edge cases for word patterns.
"""
def test_small_valid_word_pattern(self):
self.assertTrue(Solution().word_patt... | 29.276596 | 93 | 0.647529 |
import unittest
from word_pattern import Solution
class WordPatternTests(unittest.TestCase):
def test_small_valid_word_pattern(self):
self.assertTrue(Solution().word_pattern("abb", "dog cat cat"))
def test_medium_valid_word_pattern(self):
self.assertTrue(
Solution().word_patter... | true | true |
f73a799ba3ebcc86d0f399b51583b392f194be6c | 9,441 | py | Python | docs_rst/conf-docset.py | anjlip/pymatgen | 62ecae1c7382a41861e3a5d9b9c8dd1207472409 | [
"MIT"
] | 2 | 2017-10-02T03:11:47.000Z | 2018-12-02T12:56:12.000Z | docs_rst/conf-docset.py | darnoceloc/pymatgen | 5cc42912a12a265a603df7e34c856561f76edc1f | [
"MIT"
] | 3 | 2017-07-18T01:13:41.000Z | 2019-04-29T18:17:30.000Z | docs_rst/conf-docset.py | darnoceloc/pymatgen | 5cc42912a12a265a603df7e34c856561f76edc1f | [
"MIT"
] | 2 | 2020-04-30T14:19:12.000Z | 2021-07-30T08:24:48.000Z | # -*- coding: utf-8 -*-
#
# pymatgen documentation build configuration file, created by
# sphinx-quickstart on Tue Nov 15 00:13:52 2011.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# Al... | 31.787879 | 121 | 0.716132 |
import sys
import os
sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.dirname('..'))
sys.path.insert(0, os.path.dirname('../pymatgen'))
sys.path.insert(0, os.path.dirname('../..'))
from pymatgen import __version__, __author__
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.n... | true | true |
f73a79c1205e1ae17b0e4c7f5e1b7c1ba58c9c4b | 12,000 | py | Python | train.py | hieuhoang/parSentExtract | 9e7aa4c0f0f93934d7f6986d655195bf5bd8e03d | [
"MIT"
] | 1 | 2018-12-14T18:49:54.000Z | 2018-12-14T18:49:54.000Z | train.py | hieuhoang/parSentExtract | 9e7aa4c0f0f93934d7f6986d655195bf5bd8e03d | [
"MIT"
] | null | null | null | train.py | hieuhoang/parSentExtract | 9e7aa4c0f0f93934d7f6986d655195bf5bd8e03d | [
"MIT"
] | null | null | null | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
from six.moves import xrange
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "1"
import numpy as np
import tensorflow as tf
import utils
from model import Config, BiRNN
tf.flags.DEFINE_string("... | 43.3213 | 113 | 0.593 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
from six.moves import xrange
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "1"
import numpy as np
import tensorflow as tf
import utils
from model import Config, BiRNN
tf.flags.DEFINE_string("... | true | true |
f73a7a4383cb16b6d9ea8d238293baed3c9cfc96 | 13,559 | py | Python | app/backend/src/couchers/tasks.py | foormea/couchers | 4015769e5cdfbb9b9e10460fd979cccc5f203b88 | [
"MIT"
] | 226 | 2020-12-01T23:46:57.000Z | 2022-03-30T20:48:48.000Z | app/backend/src/couchers/tasks.py | foormea/couchers | 4015769e5cdfbb9b9e10460fd979cccc5f203b88 | [
"MIT"
] | 1,713 | 2020-10-06T14:20:02.000Z | 2022-03-31T17:22:49.000Z | app/backend/src/couchers/tasks.py | foormea/couchers | 4015769e5cdfbb9b9e10460fd979cccc5f203b88 | [
"MIT"
] | 80 | 2020-11-19T00:12:55.000Z | 2022-03-27T19:21:26.000Z | import logging
from datetime import timedelta
from sqlalchemy.sql import func, select
from couchers import email, urls
from couchers.config import config
from couchers.constants import EMAIL_TOKEN_VALIDITY
from couchers.crypto import urlsafe_secure_token
from couchers.db import session_scope
from couchers.models impo... | 36.157333 | 141 | 0.685965 | import logging
from datetime import timedelta
from sqlalchemy.sql import func, select
from couchers import email, urls
from couchers.config import config
from couchers.constants import EMAIL_TOKEN_VALIDITY
from couchers.crypto import urlsafe_secure_token
from couchers.db import session_scope
from couchers.models impo... | true | true |
f73a7aae1e6bdd5f3485cb8a370873294816ad6c | 1,642 | py | Python | ivi/tektronix/tektronixMDO3054.py | sacherjj/python-ivi | 6dd1ba93d65dc30a652a3a1b34c66921d94315e8 | [
"MIT"
] | 161 | 2015-01-23T17:43:01.000Z | 2022-03-29T14:42:42.000Z | ivi/tektronix/tektronixMDO3054.py | sacherjj/python-ivi | 6dd1ba93d65dc30a652a3a1b34c66921d94315e8 | [
"MIT"
] | 45 | 2015-01-15T13:35:04.000Z | 2021-06-03T01:58:55.000Z | ivi/tektronix/tektronixMDO3054.py | sacherjj/python-ivi | 6dd1ba93d65dc30a652a3a1b34c66921d94315e8 | [
"MIT"
] | 87 | 2015-01-31T10:55:23.000Z | 2022-03-17T08:18:47.000Z | """
Python Interchangeable Virtual Instrument Library
Copyright (c) 2016-2017 Alex Forencich
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... | 35.695652 | 77 | 0.760049 |
from .tektronixMDO3000 import *
class tektronixMDO3054(tektronixMDO3000):
def __init__(self, *args, **kwargs):
self.__dict__.setdefault('_instrument_id', 'MDO3054')
super(tektronixMDO3054, self).__init__(*args, **kwargs)
self._analog_channel_count = 4
self._digital_channel_count... | true | true |
f73a7c3128e5dd708a34c79443e2be9357338263 | 452 | py | Python | test/solution_tests/SUM/test_sum.py | DPNT-Sourcecode/CHK-ncxx01 | ff46ea745f069fed7bd366609ea1e0481e854d3c | [
"Apache-2.0"
] | null | null | null | test/solution_tests/SUM/test_sum.py | DPNT-Sourcecode/CHK-ncxx01 | ff46ea745f069fed7bd366609ea1e0481e854d3c | [
"Apache-2.0"
] | null | null | null | test/solution_tests/SUM/test_sum.py | DPNT-Sourcecode/CHK-ncxx01 | ff46ea745f069fed7bd366609ea1e0481e854d3c | [
"Apache-2.0"
] | null | null | null | from solutions.SUM import sum_solution
class TestSum():
"""Class to test sum_solution"""
def test_sum(self):
"""Happy path test"""
assert sum_solution.compute(1, 2) == 3
def test_check_bounds(self):
"""Raise value error if integer passed in is out of limit"""
try:
... | 26.588235 | 68 | 0.603982 | from solutions.SUM import sum_solution
class TestSum():
def test_sum(self):
assert sum_solution.compute(1, 2) == 3
def test_check_bounds(self):
try:
sol = sum_solution.compute(-1, 2)
except ValueError as e:
assert str(e) == "Passed in value out of bounds"
| true | true |
f73a7c4ef45e40c07dffff95faa42a3018198639 | 3,740 | py | Python | WitQuake/settings.py | abhishek2x/WitQuake-Namecheap | 834e5003b9d231277e8cc521427f4dec58e992b5 | [
"MIT"
] | null | null | null | WitQuake/settings.py | abhishek2x/WitQuake-Namecheap | 834e5003b9d231277e8cc521427f4dec58e992b5 | [
"MIT"
] | 4 | 2021-09-29T06:57:37.000Z | 2022-03-12T00:42:17.000Z | WitQuake/settings.py | abhishek2x/WitQuake-Namecheap | 834e5003b9d231277e8cc521427f4dec58e992b5 | [
"MIT"
] | null | null | null | import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '9u1))8ol#(lg^cyoxbw4-+50uue^a+p%vdsfv%$^#$^&gbg6346sddfbg^$%dsn+_t#9y)yjl4!%r)bv'
... | 24.129032 | 164 | 0.686096 | import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = '9u1))8ol#(lg^cyoxbw4-+50uue^a+p%vdsfv%$^#$^&gbg6346sddfbg^$%dsn+_t#9y)yjl4!%r)bv'
DEBUG = False
# DEBUG = os.environ.get('DJANGO_DEBUG', '') != 'False'
ALLOWED_HOSTS = ['*']
# Application definition
INSTALLED_APP... | true | true |
f73a7cc6cbb80ec1524b07c7dbdaef10592ec22e | 3,145 | py | Python | modules/share_module/regular_tasks.py | xuhuiliang-maybe/ace_office | 07fae18676a193206802e8fb9aa32a805b1da24c | [
"Apache-2.0"
] | 1 | 2018-11-27T08:08:07.000Z | 2018-11-27T08:08:07.000Z | modules/share_module/regular_tasks.py | xuhuiliang-maybe/ace_office | 07fae18676a193206802e8fb9aa32a805b1da24c | [
"Apache-2.0"
] | null | null | null | modules/share_module/regular_tasks.py | xuhuiliang-maybe/ace_office | 07fae18676a193206802e8fb9aa32a805b1da24c | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
import datetime
import os
import traceback
os.environ['DJANGO_SETTINGS_MODULE'] = 'ace_office.settings'
from config.conf_core import *
from django.utils import timezone
from apscheduler.schedulers.background import BackgroundScheduler
from modules.system.models import SystemConfig, DataBackup
from modul... | 32.42268 | 117 | 0.725914 |
import datetime
import os
import traceback
os.environ['DJANGO_SETTINGS_MODULE'] = 'ace_office.settings'
from config.conf_core import *
from django.utils import timezone
from apscheduler.schedulers.background import BackgroundScheduler
from modules.system.models import SystemConfig, DataBackup
from modules.share_modul... | false | true |
f73a7d07aba5c6eda2e5833be150bdea23004471 | 3,088 | py | Python | tbot/modules/commands.py | sonjek/python-telegram-bot-warframe | 7c4b2d003aa9963f271cbace1993e79e23009c26 | [
"BSD-3-Clause"
] | 1 | 2020-12-21T23:30:38.000Z | 2020-12-21T23:30:38.000Z | tbot/modules/commands.py | sonjek/warframe_notification_tbot | 7c4b2d003aa9963f271cbace1993e79e23009c26 | [
"BSD-3-Clause"
] | null | null | null | tbot/modules/commands.py | sonjek/warframe_notification_tbot | 7c4b2d003aa9963f271cbace1993e79e23009c26 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import sys
import traceback
from telegram import ParseMode
from . import menus, keyboards
from ..sources import wf, twitch
from ..utils import utils
from ..utils.logging import logger
from ..utils.loadconfig import config
warframe = wf.Warframe()
tw = twitch.Twitch()
... | 33.934066 | 106 | 0.751943 |
import sys
import traceback
from telegram import ParseMode
from . import menus, keyboards
from ..sources import wf, twitch
from ..utils import utils
from ..utils.logging import logger
from ..utils.loadconfig import config
warframe = wf.Warframe()
tw = twitch.Twitch()
def error(update, context):
trace = ''.j... | true | true |
f73a7d27bd71d7ada6b22b9db79fbda63c0f88f8 | 5,927 | py | Python | flexbe_core/test/test_exceptions.py | Jmz919/flexbe_behavior_engine | bdb85de41fafbfea6e4eb74c271b9cee18be4d8b | [
"BSD-3-Clause"
] | 1 | 2022-03-11T04:56:31.000Z | 2022-03-11T04:56:31.000Z | flexbe_core/test/test_exceptions.py | FlexBE/flexbe_behavior_engine | 735a3b68dfbe817db9383e53fef63afd6868219d | [
"BSD-3-Clause"
] | null | null | null | flexbe_core/test/test_exceptions.py | FlexBE/flexbe_behavior_engine | 735a3b68dfbe817db9383e53fef63afd6868219d | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
import unittest
import rclpy
from rclpy.executors import MultiThreadedExecutor, SingleThreadedExecutor
from flexbe_core import EventState, OperatableStateMachine
from flexbe_core.core.exceptions import StateError, StateMachineError, UserDataError
class TestExceptions(unittest.TestCase):
def... | 37.27673 | 101 | 0.647714 |
import unittest
import rclpy
from rclpy.executors import MultiThreadedExecutor, SingleThreadedExecutor
from flexbe_core import EventState, OperatableStateMachine
from flexbe_core.core.exceptions import StateError, StateMachineError, UserDataError
class TestExceptions(unittest.TestCase):
def setUp(self):
... | true | true |
f73a7e4d7fc599a21ee8f1bbe9feb88d9f963c33 | 1,261 | py | Python | 2016/tutorial_final/130/reinfocement.py | zeromtmu/practicaldatascience.github.io | 62950a3a3e7833552b0f2269cc3ee5c34a1d6d7b | [
"MIT"
] | 1 | 2021-07-06T17:36:24.000Z | 2021-07-06T17:36:24.000Z | 2016/tutorial_final/130/reinfocement.py | zeromtmu/practicaldatascience.github.io | 62950a3a3e7833552b0f2269cc3ee5c34a1d6d7b | [
"MIT"
] | null | null | null | 2016/tutorial_final/130/reinfocement.py | zeromtmu/practicaldatascience.github.io | 62950a3a3e7833552b0f2269cc3ee5c34a1d6d7b | [
"MIT"
] | 1 | 2021-07-06T17:36:34.000Z | 2021-07-06T17:36:34.000Z | %pylab inline
from scipy import *
import sys, time
from pybrain.rl.environments.mazes import Maze, MDPMazeTask
from pybrain.rl.learners.valuebased import ActionValueTable
from pybrain.rl.agents import LearningAgent
from pybrain.rl.learners import Q, SARSA
from pybrain.rl.experiments import Experiment
from pybrain.rl.... | 26.829787 | 69 | 0.578113 | %pylab inline
from scipy import *
import sys, time
from pybrain.rl.environments.mazes import Maze, MDPMazeTask
from pybrain.rl.learners.valuebased import ActionValueTable
from pybrain.rl.agents import LearningAgent
from pybrain.rl.learners import Q, SARSA
from pybrain.rl.experiments import Experiment
from pybrain.rl.... | false | true |
f73a7f4a34b14a8e898d8d1043a4003cb09b0b68 | 15,981 | py | Python | venv/Lib/site-packages/pandas/tests/arrays/categorical/test_operators.py | arnoyu-hub/COMP0016miemie | 59af664dcf190eab4f93cefb8471908717415fea | [
"MIT"
] | null | null | null | venv/Lib/site-packages/pandas/tests/arrays/categorical/test_operators.py | arnoyu-hub/COMP0016miemie | 59af664dcf190eab4f93cefb8471908717415fea | [
"MIT"
] | null | null | null | venv/Lib/site-packages/pandas/tests/arrays/categorical/test_operators.py | arnoyu-hub/COMP0016miemie | 59af664dcf190eab4f93cefb8471908717415fea | [
"MIT"
] | null | null | null | import operator
import warnings
import numpy as np
import pytest
import pandas as pd
from pandas import (
Categorical,
DataFrame,
Series,
date_range,
)
import pandas._testing as tm
from pandas.tests.arrays.categorical.common import TestCategorical
class TestCategoricalOpsWithFactor(... | 39.655087 | 89 | 0.586321 | import operator
import warnings
import numpy as np
import pytest
import pandas as pd
from pandas import (
Categorical,
DataFrame,
Series,
date_range,
)
import pandas._testing as tm
from pandas.tests.arrays.categorical.common import TestCategorical
class TestCategoricalOpsWithFactor(... | true | true |
f73a8113777d6c7e57eeb813963b99ce41b53ebc | 1,822 | py | Python | code/utils/general.py | jamesrosstwo/idr-dif | e900af5f440b943a7a46134a5afe7a81dd888a05 | [
"MIT"
] | null | null | null | code/utils/general.py | jamesrosstwo/idr-dif | e900af5f440b943a7a46134a5afe7a81dd888a05 | [
"MIT"
] | null | null | null | code/utils/general.py | jamesrosstwo/idr-dif | e900af5f440b943a7a46134a5afe7a81dd888a05 | [
"MIT"
] | null | null | null | import os
from glob import glob
from pathlib import Path
import torch
_root_dir = os.path.dirname(os.path.abspath(__file__))
ROOT_PATH = Path(_root_dir).parent.parent
def mkdir_ifnotexists(directory):
if not os.path.exists(directory):
os.mkdir(directory)
def get_class(kls):
parts = kls.split('.')
... | 31.964912 | 113 | 0.604281 | import os
from glob import glob
from pathlib import Path
import torch
_root_dir = os.path.dirname(os.path.abspath(__file__))
ROOT_PATH = Path(_root_dir).parent.parent
def mkdir_ifnotexists(directory):
if not os.path.exists(directory):
os.mkdir(directory)
def get_class(kls):
parts = kls.split('.')
... | true | true |
f73a81dd873068d4e99238758e3b64799c2c540c | 3,828 | py | Python | recipes/pranav-csv2/all/conanfile.py | dyndrite/conan-center-index | 106b5c2f532d5129e7ca1997e29e4e105bb3018c | [
"MIT"
] | 1 | 2021-11-11T03:07:13.000Z | 2021-11-11T03:07:13.000Z | recipes/pranav-csv2/all/conanfile.py | dyndrite/conan-center-index | 106b5c2f532d5129e7ca1997e29e4e105bb3018c | [
"MIT"
] | null | null | null | recipes/pranav-csv2/all/conanfile.py | dyndrite/conan-center-index | 106b5c2f532d5129e7ca1997e29e4e105bb3018c | [
"MIT"
] | null | null | null | import os
import functools
import textwrap
from conans.errors import ConanInvalidConfiguration
from conans import ConanFile, CMake, tools
required_conan_version = ">=1.33.0"
class PranavCSV2Conan(ConanFile):
name = "pranav-csv2"
license = "MIT"
description = "Various header libraries mostly future std li... | 37.90099 | 125 | 0.653605 | import os
import functools
import textwrap
from conans.errors import ConanInvalidConfiguration
from conans import ConanFile, CMake, tools
required_conan_version = ">=1.33.0"
class PranavCSV2Conan(ConanFile):
name = "pranav-csv2"
license = "MIT"
description = "Various header libraries mostly future std li... | true | true |
f73a825bdfab72caa0a7eaccf050084272c9d858 | 2,976 | py | Python | Day2/day2.py | lukasHD/adventofcode2019 | 409a2008de43ee70258e02de5a9aad27aa18c67a | [
"MIT"
] | null | null | null | Day2/day2.py | lukasHD/adventofcode2019 | 409a2008de43ee70258e02de5a9aad27aa18c67a | [
"MIT"
] | null | null | null | Day2/day2.py | lukasHD/adventofcode2019 | 409a2008de43ee70258e02de5a9aad27aa18c67a | [
"MIT"
] | null | null | null | # https://adventofcode.com/2019/day/2
#
# --- Day 2: 1202 Program Alarm ---
#
#
#
def readOpCode(op):
if op == 1:
print("add")
return
elif op == 2:
print("mul")
elif op == 99:
print("break")
intInput = [1,9,10,3,2,3,11,0,99,30,40,50]
def loadintCode(fname='input'):
... | 32.347826 | 184 | 0.525874 |
def readOpCode(op):
if op == 1:
print("add")
return
elif op == 2:
print("mul")
elif op == 99:
print("break")
intInput = [1,9,10,3,2,3,11,0,99,30,40,50]
def loadintCode(fname='input'):
with open(fname, 'r') as f:
l = list(f.read().split(','))
p = ... | true | true |
f73a8270beebae29f2fda3eb7c30679fa893c102 | 2,612 | py | Python | built-in/ACL_TensorFlow/Official/recommendation/DCN_for_ACL/scripts/eval.py | Ascend/modelzoo | f018cfed33dbb1cc2110b9ea2e233333f71cc509 | [
"Apache-2.0"
] | 12 | 2020-12-13T08:34:24.000Z | 2022-03-20T15:17:17.000Z | built-in/ACL_TensorFlow/Official/recommendation/DCN_for_ACL/scripts/eval.py | Ascend/modelzoo | f018cfed33dbb1cc2110b9ea2e233333f71cc509 | [
"Apache-2.0"
] | 1 | 2022-01-20T03:11:05.000Z | 2022-01-20T06:53:39.000Z | built-in/ACL_TensorFlow/Official/recommendation/DCN_for_ACL/scripts/eval.py | Ascend/modelzoo | f018cfed33dbb1cc2110b9ea2e233333f71cc509 | [
"Apache-2.0"
] | 2 | 2021-07-10T12:40:46.000Z | 2021-12-17T07:55:15.000Z | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 31.853659 | 92 | 0.692573 |
import os
from sklearn.metrics import average_precision_score, roc_auc_score
import numpy as np
import sys
def aucPerformance(mse, labels):
roc_auc = roc_auc_score(labels, mse)
ap = average_precision_score(labels, mse)
print("AUC-ROC: %.4f, AUC-PR: %.4f" % (roc_auc, ap))
re... | true | true |
f73a8417d338205aefaaed6325e19e807ee13d7e | 196 | py | Python | cashfree_sdk/payouts/validations/__upi_validation.py | cashfree/cashfree-sdk-python | f59f706a9ef6bc5d34c5933045b526dc9b0eea57 | [
"MIT"
] | 1 | 2020-06-24T20:53:57.000Z | 2020-06-24T20:53:57.000Z | cashfree_sdk/payouts/validations/__upi_validation.py | cashfree/cashfree-sdk-python | f59f706a9ef6bc5d34c5933045b526dc9b0eea57 | [
"MIT"
] | 8 | 2020-01-09T11:22:18.000Z | 2021-05-23T09:39:03.000Z | cashfree_sdk/payouts/validations/__upi_validation.py | cashfree/cashfree-sdk-python | f59f706a9ef6bc5d34c5933045b526dc9b0eea57 | [
"MIT"
] | 3 | 2020-05-11T04:47:06.000Z | 2022-03-31T00:56:10.000Z |
class UPIValidation:
end_point = "/payout/v1/validation/upiDetails"
req_type = "GET"
def __init__(self, **kwargs):
self.name = kwargs["name"]
self.vpa = kwargs["vpa"] | 24.5 | 50 | 0.617347 |
class UPIValidation:
end_point = "/payout/v1/validation/upiDetails"
req_type = "GET"
def __init__(self, **kwargs):
self.name = kwargs["name"]
self.vpa = kwargs["vpa"] | true | true |
f73a842c4e9e3317787dcc216be5d79bc14512a9 | 3,028 | py | Python | daemon/core/gui/appconfig.py | geraldolsribeiro/core | d07635f23c349bab6b61bd3629d2721344423dd1 | [
"BSD-2-Clause"
] | null | null | null | daemon/core/gui/appconfig.py | geraldolsribeiro/core | d07635f23c349bab6b61bd3629d2721344423dd1 | [
"BSD-2-Clause"
] | null | null | null | daemon/core/gui/appconfig.py | geraldolsribeiro/core | d07635f23c349bab6b61bd3629d2721344423dd1 | [
"BSD-2-Clause"
] | null | null | null | import os
import shutil
from pathlib import Path
import yaml
# gui home paths
from core.gui import themes
HOME_PATH = Path.home().joinpath(".coretk")
BACKGROUNDS_PATH = HOME_PATH.joinpath("backgrounds")
CUSTOM_EMANE_PATH = HOME_PATH.joinpath("custom_emane")
CUSTOM_SERVICE_PATH = HOME_PATH.joinpath("custom_services")... | 27.279279 | 80 | 0.628798 | import os
import shutil
from pathlib import Path
import yaml
from core.gui import themes
HOME_PATH = Path.home().joinpath(".coretk")
BACKGROUNDS_PATH = HOME_PATH.joinpath("backgrounds")
CUSTOM_EMANE_PATH = HOME_PATH.joinpath("custom_emane")
CUSTOM_SERVICE_PATH = HOME_PATH.joinpath("custom_services")
ICONS_PATH = HO... | true | true |
f73a8497644d3673fe8705d01605ef1349f13878 | 17,140 | py | Python | shanhe/iaas/constants.py | shanhe-nsccjn/shanhe-sdk-python | efead12f08d93a7ebb986d137da9fbfc7a43ad02 | [
"Apache-2.0"
] | null | null | null | shanhe/iaas/constants.py | shanhe-nsccjn/shanhe-sdk-python | efead12f08d93a7ebb986d137da9fbfc7a43ad02 | [
"Apache-2.0"
] | null | null | null | shanhe/iaas/constants.py | shanhe-nsccjn/shanhe-sdk-python | efead12f08d93a7ebb986d137da9fbfc7a43ad02 | [
"Apache-2.0"
] | null | null | null | # =========================================================================
# Copyright 2021-present ShanHe, Inc.
# -------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this work except in compliance with the Licens... | 41.004785 | 92 | 0.857818 |
ACTION_DESCRIBE_ACCESS_KEYS = "DescribeAccessKeys"
ACTION_DESCRIBE_SUB_USERS = "DescribeSubUsers"
ACTION_CREATE_SUB_USER = "CreateSubUser"
ACTION_MODIFY_SUB_USER_ATTRIBUTES = "ModifySubUserAttributes"
ACTION_DELETE_SUB_USERS = "DeleteSubUsers"
ACTION_RESTORE_SUB_USERS = "RestoreSubUsers"
ACTION_D... | true | true |
f73a86a2a0fca14124a88912fef6a4e530de6041 | 1,414 | py | Python | 0000 hihoOnce/172 Matrix Sum/main.py | SLAPaper/hihoCoder | 3f64d678c5dd46db36345736eb56880fb2d2c5fe | [
"MIT"
] | null | null | null | 0000 hihoOnce/172 Matrix Sum/main.py | SLAPaper/hihoCoder | 3f64d678c5dd46db36345736eb56880fb2d2c5fe | [
"MIT"
] | null | null | null | 0000 hihoOnce/172 Matrix Sum/main.py | SLAPaper/hihoCoder | 3f64d678c5dd46db36345736eb56880fb2d2c5fe | [
"MIT"
] | null | null | null | from __future__ import print_function
from ctypes import c_int
BASE = int(1e9 + 7)
class TreeMatrix:
def __init__(self, N):
self.mat = (c_int * ((N + 1) * (N + 1)))()
self.N = N
@staticmethod
def lowbit(x):
return x & (-x)
def add(self, x, y, val):
x, y = x + 1, y +... | 24.37931 | 73 | 0.429986 | from __future__ import print_function
from ctypes import c_int
BASE = int(1e9 + 7)
class TreeMatrix:
def __init__(self, N):
self.mat = (c_int * ((N + 1) * (N + 1)))()
self.N = N
@staticmethod
def lowbit(x):
return x & (-x)
def add(self, x, y, val):
x, y = x + 1, y +... | true | true |
f73a874ef26473f1fa68985645a9b4496e174d0c | 12,017 | py | Python | ansys/dpf/core/examples/downloads.py | pyansys/pydpf-core | 27f1042a316e4f6a523bcd893c2365825464d731 | [
"MIT"
] | 18 | 2021-10-16T10:38:29.000Z | 2022-03-29T11:26:42.000Z | ansys/dpf/core/examples/downloads.py | lynch1972/pydpf-core | 3d560f479c2904866851dc9f2b0f9c490c97d365 | [
"MIT"
] | 79 | 2021-10-11T23:18:54.000Z | 2022-03-29T14:53:14.000Z | ansys/dpf/core/examples/downloads.py | lynch1972/pydpf-core | 3d560f479c2904866851dc9f2b0f9c490c97d365 | [
"MIT"
] | 5 | 2021-11-29T18:35:37.000Z | 2022-03-16T16:49:21.000Z | """Download example datasets from https://github.com/pyansys/example-data"""
import shutil
import os
import urllib.request
EXAMPLE_REPO = "https://github.com/pyansys/example-data/raw/master/result_files/"
def delete_downloads():
"""Delete all downloaded examples to free space or update the files"""
from ansy... | 29.453431 | 121 | 0.669884 | import shutil
import os
import urllib.request
EXAMPLE_REPO = "https://github.com/pyansys/example-data/raw/master/result_files/"
def delete_downloads():
from ansys.dpf.core import LOCAL_DOWNLOADED_EXAMPLES_PATH
shutil.rmtree(LOCAL_DOWNLOADED_EXAMPLES_PATH)
os.makedirs(LOCAL_DOWNLOADED_EXAMPLES_PATH)
def... | true | true |
f73a879390416a38e44e29ae743c5ffca668ef1c | 3,865 | py | Python | sasegan/datasets/test_dataset.py | usimarit/selfattention-segan | 563a86e825f1e4067ec1fd3bed36e89e11434388 | [
"Apache-2.0"
] | 6 | 2020-12-07T14:58:36.000Z | 2022-01-07T19:58:28.000Z | sasegan/datasets/test_dataset.py | usimarit/TiramisuSE | 563a86e825f1e4067ec1fd3bed36e89e11434388 | [
"Apache-2.0"
] | 2 | 2020-12-04T09:09:13.000Z | 2021-09-26T23:46:43.000Z | sasegan/datasets/test_dataset.py | usimarit/TiramisuSE | 563a86e825f1e4067ec1fd3bed36e89e11434388 | [
"Apache-2.0"
] | 5 | 2021-01-10T14:02:13.000Z | 2021-11-15T08:36:37.000Z | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... | 42.01087 | 112 | 0.676067 |
import tensorflow as tf
from tensorflow_asr.featurizers.speech_featurizers import read_raw_audio
from .train_dataset import SeganAugTrainDataset, SeganTrainDataset
from ..featurizers.speech_featurizer import SpeechFeaturizer
class SeganAugTestDataset(SeganAugTrainDataset):
def __init__(self,
... | true | true |
f73a8813e7dd3069c8586a565e9a2e225044ebca | 430 | py | Python | {{cookiecutter.project_slug}}/apps/cms/management/commands/initcontent.py | ukwahlula/django-server-boilerplate | 6bd4b83511ea7e3370349957cf0b6dbff4003ab1 | [
"BSD-3-Clause"
] | 2 | 2020-10-30T09:47:07.000Z | 2020-10-30T09:48:11.000Z | {{cookiecutter.project_slug}}/apps/cms/management/commands/initcontent.py | ukwahlula/django-server-boilerplate | 6bd4b83511ea7e3370349957cf0b6dbff4003ab1 | [
"BSD-3-Clause"
] | null | null | null | {{cookiecutter.project_slug}}/apps/cms/management/commands/initcontent.py | ukwahlula/django-server-boilerplate | 6bd4b83511ea7e3370349957cf0b6dbff4003ab1 | [
"BSD-3-Clause"
] | null | null | null | from django.core.management.base import BaseCommand
from apps.cms.models import Content
from apps.cms.presets import CONTENT_PRESETS
class Command(BaseCommand):
help = "Initialize cms data from hardcoded presets"
def handle(self, *args, **kwargs):
for content_type, value in CONTENT_PRESETS.items():
... | 33.076923 | 109 | 0.755814 | from django.core.management.base import BaseCommand
from apps.cms.models import Content
from apps.cms.presets import CONTENT_PRESETS
class Command(BaseCommand):
help = "Initialize cms data from hardcoded presets"
def handle(self, *args, **kwargs):
for content_type, value in CONTENT_PRESETS.items():
... | true | true |
f73a888a66e0c135699426bce9cda49f9d94b9ac | 1,940 | py | Python | usr/share/pyshared/ajenti/plugins/smartctl/widget.py | lupyuen/RaspberryPiImage | 664e8a74b4628d710feab5582ef59b344b9ffddd | [
"Apache-2.0"
] | 7 | 2016-03-07T02:07:21.000Z | 2022-01-21T02:22:41.000Z | usr/share/pyshared/ajenti/plugins/smartctl/widget.py | lupyuen/RaspberryPiImage | 664e8a74b4628d710feab5582ef59b344b9ffddd | [
"Apache-2.0"
] | null | null | null | usr/share/pyshared/ajenti/plugins/smartctl/widget.py | lupyuen/RaspberryPiImage | 664e8a74b4628d710feab5582ef59b344b9ffddd | [
"Apache-2.0"
] | 8 | 2016-06-14T06:01:11.000Z | 2020-04-22T09:21:44.000Z | import subprocess
import re
import os
from ajenti.api import plugin
from ajenti.api.sensors import Sensor
from ajenti.plugins.dashboard.api import ConfigurableWidget
@plugin
class SMARTSensor (Sensor):
id = 'smart'
timeout = 5
def get_variants(self):
r = []
for s in os.listdir('/dev'):
... | 23.950617 | 64 | 0.510309 | import subprocess
import re
import os
from ajenti.api import plugin
from ajenti.api.sensors import Sensor
from ajenti.plugins.dashboard.api import ConfigurableWidget
@plugin
class SMARTSensor (Sensor):
id = 'smart'
timeout = 5
def get_variants(self):
r = []
for s in os.listdir('/dev'):
... | true | true |
f73a8893e53a67203d15a50f22759c8c791fbcb2 | 1,647 | py | Python | tests/system/action/poll/test_delete.py | OpenSlides/openslides-backend | 57f58a4ca0e5ca113ff104efa9db3e2c66e3aeab | [
"MIT"
] | 5 | 2020-01-20T13:57:15.000Z | 2021-03-27T14:14:44.000Z | tests/system/action/poll/test_delete.py | OpenSlides/openslides-backend | 57f58a4ca0e5ca113ff104efa9db3e2c66e3aeab | [
"MIT"
] | 859 | 2020-01-11T22:58:37.000Z | 2022-03-30T14:54:06.000Z | tests/system/action/poll/test_delete.py | OpenSlides/openslides-backend | 57f58a4ca0e5ca113ff104efa9db3e2c66e3aeab | [
"MIT"
] | 16 | 2020-01-04T20:28:57.000Z | 2022-02-10T12:06:54.000Z | from openslides_backend.permissions.permissions import Permissions
from tests.system.action.base import BaseActionTestCase
class PollDeleteTest(BaseActionTestCase):
def test_delete_correct(self) -> None:
self.set_models({"poll/111": {"meeting_id": 1}, "meeting/1": {}})
response = self.request("pol... | 35.804348 | 73 | 0.573163 | from openslides_backend.permissions.permissions import Permissions
from tests.system.action.base import BaseActionTestCase
class PollDeleteTest(BaseActionTestCase):
def test_delete_correct(self) -> None:
self.set_models({"poll/111": {"meeting_id": 1}, "meeting/1": {}})
response = self.request("pol... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.