hexsha stringlengths 40 40 | size int64 4 996k | ext stringclasses 8
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 4 996k | avg_line_length float64 1.33 58.2k | max_line_length int64 2 323k | alphanum_fraction float64 0 0.97 | content_no_comment stringlengths 0 946k | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f722a056832cd666350d8f658c55c7138da5a34c | 272 | py | Python | fiasco/io/tests/test_datalayer.py | fluxtransport/fiasco | 9d70d8bdb03197be1ddfd433e1392e214a1468e8 | [
"BSD-3-Clause"
] | 14 | 2017-08-19T17:58:09.000Z | 2022-03-22T17:46:34.000Z | fiasco/io/tests/test_datalayer.py | fluxtransport/fiasco | 9d70d8bdb03197be1ddfd433e1392e214a1468e8 | [
"BSD-3-Clause"
] | 161 | 2017-09-01T16:16:37.000Z | 2022-03-20T18:51:48.000Z | fiasco/io/tests/test_datalayer.py | fluxtransport/fiasco | 9d70d8bdb03197be1ddfd433e1392e214a1468e8 | [
"BSD-3-Clause"
] | 10 | 2017-09-01T16:15:12.000Z | 2022-03-22T17:46:42.000Z | """
Tests for the HDF5 datalayer
"""
import pytest
from fiasco.io import DataIndexer
from fiasco.util.exceptions import MissingDatabaseError
def test_missingdatabase():
with pytest.raises(MissingDatabaseError):
DataIndexer.create_indexer('foo/bar.h5', '/')
| 20.923077 | 55 | 0.761029 | import pytest
from fiasco.io import DataIndexer
from fiasco.util.exceptions import MissingDatabaseError
def test_missingdatabase():
with pytest.raises(MissingDatabaseError):
DataIndexer.create_indexer('foo/bar.h5', '/')
| true | true |
f722a122fe64136b0f5328d8f244de8bf959f947 | 7,267 | py | Python | lib/modules/composites_simulator.py | yuzhd/Text2Scene | a357b7d869f559f7d09a5ac6002757ec705b2a76 | [
"MIT",
"Unlicense"
] | 109 | 2019-06-14T01:00:29.000Z | 2022-01-23T16:03:17.000Z | lib/modules/composites_simulator.py | yuzhd/Text2Scene | a357b7d869f559f7d09a5ac6002757ec705b2a76 | [
"MIT",
"Unlicense"
] | 10 | 2019-10-16T15:40:40.000Z | 2021-08-16T00:53:57.000Z | lib/modules/composites_simulator.py | yuzhd/Text2Scene | a357b7d869f559f7d09a5ac6002757ec705b2a76 | [
"MIT",
"Unlicense"
] | 24 | 2019-06-26T05:21:59.000Z | 2021-11-01T00:33:21.000Z | #!/usr/bin/env python
import numpy as np
from copy import deepcopy
import matplotlib.pyplot as plt
from nntable import AllCategoriesTables
from composites_utils import *
class simulator(object):
def __init__(self, db, batch_size=None, nn_table=None):
self.db = db
self.cfg = db.cfg
self.b... | 43.255952 | 128 | 0.564194 |
import numpy as np
from copy import deepcopy
import matplotlib.pyplot as plt
from nntable import AllCategoriesTables
from composites_utils import *
class simulator(object):
def __init__(self, db, batch_size=None, nn_table=None):
self.db = db
self.cfg = db.cfg
self.batch_size = batch_siz... | true | true |
f722a1e34c5f98d0bb0b83434b0a51c8ec1d9d91 | 11,356 | py | Python | gtsfm/utils/viz.py | PratyushaMaiti/gtsfm | 0d03dca0b6fb9293c9a3fb619a2141903168269a | [
"Apache-2.0"
] | null | null | null | gtsfm/utils/viz.py | PratyushaMaiti/gtsfm | 0d03dca0b6fb9293c9a3fb619a2141903168269a | [
"Apache-2.0"
] | null | null | null | gtsfm/utils/viz.py | PratyushaMaiti/gtsfm | 0d03dca0b6fb9293c9a3fb619a2141903168269a | [
"Apache-2.0"
] | null | null | null | """Functions to visualize outputs at different stages of GTSFM.
Authors: Ayush Baid
"""
import os
from typing import List, Optional, Tuple
import cv2 as cv
import matplotlib.pyplot as plt
import numpy as np
from gtsam import Pose3
from matplotlib.axes._axes import Axes
import gtsfm.utils.geometry_comparisons as comp... | 35.4875 | 115 | 0.672244 | import os
from typing import List, Optional, Tuple
import cv2 as cv
import matplotlib.pyplot as plt
import numpy as np
from gtsam import Pose3
from matplotlib.axes._axes import Axes
import gtsfm.utils.geometry_comparisons as comp_utils
import gtsfm.utils.images as image_utils
import gtsfm.utils.io as io_utils
from gt... | true | true |
f722a36ec11a8705c0cce95ff0216ab9e221ca46 | 4,676 | py | Python | .Config/FslFontHelper/FormatPluginFontBasicKerningUtil.py | alejandrolozano2/OpenGL_DemoFramework | 5fd85f05c98cc3d0c0a68bac438035df8cabaee7 | [
"MIT",
"BSD-3-Clause"
] | 3 | 2019-01-19T20:21:24.000Z | 2021-08-10T02:11:32.000Z | .Config/FslFontHelper/FormatPluginFontBasicKerningUtil.py | alejandrolozano2/OpenGL_DemoFramework | 5fd85f05c98cc3d0c0a68bac438035df8cabaee7 | [
"MIT",
"BSD-3-Clause"
] | null | null | null | .Config/FslFontHelper/FormatPluginFontBasicKerningUtil.py | alejandrolozano2/OpenGL_DemoFramework | 5fd85f05c98cc3d0c0a68bac438035df8cabaee7 | [
"MIT",
"BSD-3-Clause"
] | 1 | 2021-08-10T02:11:33.000Z | 2021-08-10T02:11:33.000Z | #!/usr/bin/env python3
#****************************************************************************************************************************************************
#* BSD 3-Clause License
#*
#* Copyright (c) 2015, Mana Battery
#* All rights reserved.
#*
#* Redistribution and use in source and binary forms, wit... | 42.126126 | 149 | 0.634303 |
def AddHeader(list, version):
AddUInt32(list, 0x00415442)
AddUInt32(list, version)
def AddByteToList(list, value):
if( value < 0 or value > 255 ):
raise Exception("Invalid value")
list.append(value & 0xFF)
def SetByteInList(list, index, value):
if( value ... | true | true |
f722a588e3102203b44de3453078b22826ce6fb2 | 3,002 | py | Python | dataset.py | aidiary/freesound-audio-tagging | 71093fdc838214f4ec2dc5b29b00e7de72ad36d0 | [
"MIT"
] | 1 | 2019-01-04T16:14:16.000Z | 2019-01-04T16:14:16.000Z | dataset.py | aidiary/freesound-audio-tagging | 71093fdc838214f4ec2dc5b29b00e7de72ad36d0 | [
"MIT"
] | null | null | null | dataset.py | aidiary/freesound-audio-tagging | 71093fdc838214f4ec2dc5b29b00e7de72ad36d0 | [
"MIT"
] | 3 | 2018-07-11T03:41:57.000Z | 2020-04-21T09:49:36.000Z | import os
import librosa
import numpy as np
import torch.utils.data
def random_crop(y, max_length=176400):
"""音声波形を固定長にそろえる
max_lengthより長かったらランダムに切り取る
max_lengthより短かったらランダムにパディングする
"""
if len(y) > max_length:
max_offset = len(y) - max_length
offset = np.random.randint(max_offset)
... | 30.632653 | 121 | 0.562292 | import os
import librosa
import numpy as np
import torch.utils.data
def random_crop(y, max_length=176400):
if len(y) > max_length:
max_offset = len(y) - max_length
offset = np.random.randint(max_offset)
y = y[offset:max_length + offset]
else:
if max_length > len(y):
... | true | true |
f722a6f28981d75409c2f21d5d019c10ec2481cf | 5,630 | py | Python | flask_aiohttp/__init__.py | Hardtack/Flask-aiohttp | 50cfc8c1f71bae9e10a4a475b06b5f6bd124e33b | [
"MIT"
] | 142 | 2015-04-05T06:28:11.000Z | 2021-05-05T14:40:04.000Z | flask_aiohttp/__init__.py | Hardtack/Flask-aiohttp | 50cfc8c1f71bae9e10a4a475b06b5f6bd124e33b | [
"MIT"
] | 9 | 2015-06-01T18:45:35.000Z | 2018-08-29T16:39:01.000Z | flask_aiohttp/__init__.py | chgeonu/Flask-aiohttp | 50cfc8c1f71bae9e10a4a475b06b5f6bd124e33b | [
"MIT"
] | 20 | 2015-04-09T15:09:10.000Z | 2021-11-04T12:24:59.000Z | """:mod:`flask_aiohttp` --- Asynchronous Flask with aiohttp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Provides Flask extension for asynchronous I/O.
With this extension, we can use `asyncio.coroutine` as Flask's view function.
So, we can add
asyncio-redis <https://github.com/jonathanslenders/asynci... | 29.631579 | 78 | 0.601243 | """:mod:`flask_aiohttp` --- Asynchronous Flask with aiohttp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Provides Flask extension for asynchronous I/O.
With this extension, we can use `asyncio.coroutine` as Flask's view function.
So, we can add
asyncio-redis <https://github.com/jonathanslenders/asynci... | false | true |
f722a782ae9258889684d63a291930f09d41f5ed | 29,165 | py | Python | src/redfish/ris/ris.py | killionadmin/ILOscripts | 951f53df9bf58bc7b186a501e2d123645f0e55a3 | [
"Apache-2.0"
] | null | null | null | src/redfish/ris/ris.py | killionadmin/ILOscripts | 951f53df9bf58bc7b186a501e2d123645f0e55a3 | [
"Apache-2.0"
] | null | null | null | src/redfish/ris/ris.py | killionadmin/ILOscripts | 951f53df9bf58bc7b186a501e2d123645f0e55a3 | [
"Apache-2.0"
] | null | null | null | ###
# Copyright 2016 Hewlett Packard Enterprise, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | 36.365337 | 82 | 0.506189 |
import re
import sys
import logging
import threading
import urlparse2
from Queue import Queue
from collections import (OrderedDict)
import jsonpath_rw
import jsonpointer
from jsonpointer import set_pointer
import redfish.rest.v1
from redfish.ris.sharedtypes import Dictable
LOGGER = ... | true | true |
f722a82c58bac35d0593073d6622630648eef805 | 2,950 | py | Python | openbb_terminal/portfolio/reportlab_helpers.py | tehcoderer/GamestonkTerminal | 54a1b6f545a0016c576e9e00eef5c003d229dacf | [
"MIT"
] | 255 | 2022-03-29T16:43:51.000Z | 2022-03-31T23:57:08.000Z | openbb_terminal/portfolio/reportlab_helpers.py | tehcoderer/GamestonkTerminal | 54a1b6f545a0016c576e9e00eef5c003d229dacf | [
"MIT"
] | 14 | 2022-03-29T14:20:33.000Z | 2022-03-31T23:39:20.000Z | openbb_terminal/portfolio/reportlab_helpers.py | tehcoderer/GamestonkTerminal | 54a1b6f545a0016c576e9e00eef5c003d229dacf | [
"MIT"
] | 24 | 2022-03-29T15:28:56.000Z | 2022-03-31T23:54:15.000Z | """Reportlab Helpers"""
__docformat__ = "numpy"
from datetime import datetime
from typing import List
from reportlab.lib import colors
from reportlab.pdfgen import canvas
from reportlab.lib.styles import ParagraphStyle, getSampleStyleSheet
from reportlab.platypus import Paragraph, Table, TableStyle
def base_format(... | 27.314815 | 84 | 0.610169 | __docformat__ = "numpy"
from datetime import datetime
from typing import List
from reportlab.lib import colors
from reportlab.pdfgen import canvas
from reportlab.lib.styles import ParagraphStyle, getSampleStyleSheet
from reportlab.platypus import Paragraph, Table, TableStyle
def base_format(report: canvas.Canvas, h... | true | true |
f722a879937c014080a753f5ec6fbc90db70abc0 | 12,619 | py | Python | libcloud/common/base.py | cloudkick/libcloud | 9c8605e1518c6b5e2511f0780e1946089a7256dd | [
"Apache-2.0"
] | 4 | 2015-11-04T10:32:52.000Z | 2020-04-06T03:39:01.000Z | libcloud/common/base.py | cloudkick/libcloud | 9c8605e1518c6b5e2511f0780e1946089a7256dd | [
"Apache-2.0"
] | null | null | null | libcloud/common/base.py | cloudkick/libcloud | 9c8605e1518c6b5e2511f0780e1946089a7256dd | [
"Apache-2.0"
] | 6 | 2015-01-05T23:33:17.000Z | 2020-04-06T03:39:34.000Z | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | 29.973872 | 81 | 0.571044 |
import httplib
import urllib
import time
import hashlib
import StringIO
import ssl
import os
import socket
import struct
from pipes import quote as pquote
import libcloud
from libcloud.httplib_ssl import LibcloudHTTPSConnection
from httplib import HTTPConnection as LibcloudHTTPConnection
class RawRes... | false | true |
f722a90d046be88487290038647fbe8c9ea42441 | 10,411 | py | Python | tests/contrib/test_fixers.py | regragui-cobra/werkzeug | 710b25614d089157c8baa7b46518d38e33861b5f | [
"BSD-3-Clause"
] | null | null | null | tests/contrib/test_fixers.py | regragui-cobra/werkzeug | 710b25614d089157c8baa7b46518d38e33861b5f | [
"BSD-3-Clause"
] | null | null | null | tests/contrib/test_fixers.py | regragui-cobra/werkzeug | 710b25614d089157c8baa7b46518d38e33861b5f | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""
tests.fixers
~~~~~~~~~~~~
Server / Browser fixers.
:copyright: (c) 2014 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import pytest
from werkzeug.contrib import fixers
from werkzeug.datastructures import ResponseCacheControl
from werkzeug.http imp... | 39.585551 | 91 | 0.57324 |
import pytest
from werkzeug.contrib import fixers
from werkzeug.datastructures import ResponseCacheControl
from werkzeug.http import parse_cache_control_header
from werkzeug.routing import Map, Rule
from werkzeug.test import Client, create_environ
from werkzeug.utils import redirect
from werkzeug.wrappers import Requ... | true | true |
f722a95789db98a5095805a06f7ae3f2d1775ae4 | 2,249 | py | Python | Packs/CommonScripts/Scripts/ExtractDomainAndFQDNFromUrlAndEmail/ExtractDomainAndFQDNFromUrlAndEmail_test.py | ddi-danielsantander/content | 67e2edc404f50c332d928dbdbce00a447bb5532f | [
"MIT"
] | 1 | 2020-04-19T11:05:42.000Z | 2020-04-19T11:05:42.000Z | Packs/CommonScripts/Scripts/ExtractDomainAndFQDNFromUrlAndEmail/ExtractDomainAndFQDNFromUrlAndEmail_test.py | ddi-danielsantander/content | 67e2edc404f50c332d928dbdbce00a447bb5532f | [
"MIT"
] | null | null | null | Packs/CommonScripts/Scripts/ExtractDomainAndFQDNFromUrlAndEmail/ExtractDomainAndFQDNFromUrlAndEmail_test.py | ddi-danielsantander/content | 67e2edc404f50c332d928dbdbce00a447bb5532f | [
"MIT"
] | 1 | 2020-05-27T15:26:48.000Z | 2020-05-27T15:26:48.000Z | # -*- coding: utf-8 -*-
from ExtractDomainAndFQDNFromUrlAndEmail import extract_fqdn_or_domain
import pytest
@pytest.mark.parametrize('input,fqdn,domain', [ # noqa: E501 disable-secrets-detection
('http://this.is.test.com', 'this.is.test.com', 'test.com'),
('https://ca... | 86.5 | 394 | 0.66474 |
from ExtractDomainAndFQDNFromUrlAndEmail import extract_fqdn_or_domain
import pytest
@pytest.mark.parametrize('input,fqdn,domain', [
('http://this.is.test.com', 'this.is.test.com', 'test.com'),
('https://caseapi.phishlabs.com', 'caseapi.phishlabs.com', 'phishlabs.com... | true | true |
f722a9e3cdb88d56bf510523dd7e8e4563fa59e4 | 2,705 | py | Python | study-drills/sdex19.py | dark-teal-coder/book-learn-python-the-hard-way | e63abddde8c29dcb1c24d8a98116a78b05be67eb | [
"MIT"
] | null | null | null | study-drills/sdex19.py | dark-teal-coder/book-learn-python-the-hard-way | e63abddde8c29dcb1c24d8a98116a78b05be67eb | [
"MIT"
] | null | null | null | study-drills/sdex19.py | dark-teal-coder/book-learn-python-the-hard-way | e63abddde8c29dcb1c24d8a98116a78b05be67eb | [
"MIT"
] | null | null | null | # Study Drills 19
# 1. Go back through the script and type a comment above each line explaining in English what it does.
# 2. Start at the bottom and read each line backward, saying all the important characters.
# 3. Write at least one more function of your own design, and run it 10 different ways.
# Define a functio... | 35.12987 | 102 | 0.728281 |
def cheese_and_crackers(cheese_count, boxes_of_crackers):
print(f"You have {cheese_count} cheeses!")
print(f"You have {boxes_of_crackers} boxes of crackers!")
print("Man that's enough for a party!")
# Print a string.
print("Get a blanket.\n")
# Different ways to give the fun... | true | true |
f722aa562864d281669358c4022ca282d5b67d7b | 691 | py | Python | emadiff.py | prashlkam/money-spinner | 65b97c2c91f947300a228674620bc508a0bf7cda | [
"Apache-2.0"
] | 1 | 2022-03-26T13:32:28.000Z | 2022-03-26T13:32:28.000Z | emadiff.py | prashlkam/money-spinner | 65b97c2c91f947300a228674620bc508a0bf7cda | [
"Apache-2.0"
] | null | null | null | emadiff.py | prashlkam/money-spinner | 65b97c2c91f947300a228674620bc508a0bf7cda | [
"Apache-2.0"
] | 1 | 2022-03-26T21:51:34.000Z | 2022-03-26T21:51:34.000Z | import math
class emadiff:
def twe_hund_ema_diff(twema, hundema):
return abs(twema - hundema)
def wrapper_Least_ema_diff(stocks, twemas, hundemas):
Stocks_short_list = []
threshold = 0.25
stock_list_size = len(stocks)
if stock_list_size == len(twemas) and stock_list_siz... | 36.368421 | 91 | 0.620839 | import math
class emadiff:
def twe_hund_ema_diff(twema, hundema):
return abs(twema - hundema)
def wrapper_Least_ema_diff(stocks, twemas, hundemas):
Stocks_short_list = []
threshold = 0.25
stock_list_size = len(stocks)
if stock_list_size == len(twemas) and stock_list_siz... | true | true |
f722acf1289eda2268f41fb2f472157f675e873a | 7,784 | py | Python | python/cohorte/composer/node/criteria/reliability/crashing.py | isandlaTech/cohorte-runtime | 686556cdde20beba77ae202de9969be46feed5e2 | [
"Apache-2.0"
] | 6 | 2015-04-28T16:51:08.000Z | 2017-07-12T11:29:00.000Z | python/cohorte/composer/node/criteria/reliability/crashing.py | isandlaTech/cohorte-runtime | 686556cdde20beba77ae202de9969be46feed5e2 | [
"Apache-2.0"
] | 29 | 2015-02-24T11:11:26.000Z | 2017-08-25T08:30:18.000Z | qualifier/deploy/cohorte-home/repo/cohorte/composer/node/criteria/reliability/crashing.py | isandlaTech/cohorte-devtools | 9ba9021369188d2f0ad5c845ef242fd5a7097b57 | [
"Apache-2.0"
] | 1 | 2015-08-24T13:23:43.000Z | 2015-08-24T13:23:43.000Z | #!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Votes according to components stability (crashes vs time)
:author: Thomas Calmant
:license: Apache Software License 2.0
:version: 3.0.0
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the "License");
you may not use ... | 31.51417 | 80 | 0.568602 |
import logging
import operator
import time
from pelix.ipopo.decorators import ComponentFactory, Provides, Instantiate, \
Invalidate, Validate
import cohorte.composer
import cohorte.version
__version__=cohorte.version.__version__
_logger = logging.getLogger(__name__)
@ComponentFactory()
@Provides(... | true | true |
f722ad1d65fd5ca1d2053ced68e3a0488392960f | 23,354 | py | Python | frappe/tests/test_db.py | itsdave-de/frappe | b193194484e0de7a2909899457f13579e4026c56 | [
"MIT"
] | null | null | null | frappe/tests/test_db.py | itsdave-de/frappe | b193194484e0de7a2909899457f13579e4026c56 | [
"MIT"
] | null | null | null | frappe/tests/test_db.py | itsdave-de/frappe | b193194484e0de7a2909899457f13579e4026c56 | [
"MIT"
] | null | null | null | # Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import datetime
import inspect
import unittest
from random import choice
from unittest.mock import patch
import frappe
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
from frappe.database i... | 29.941026 | 126 | 0.689646 |
import datetime
import inspect
import unittest
from random import choice
from unittest.mock import patch
import frappe
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
from frappe.database import savepoint
from frappe.database.database import Database
from frappe.query_builder import ... | true | true |
f722adb301574075281fd134e69896190119db40 | 2,232 | py | Python | samples/refresh_tasks.py | rrobertsrgare/server-client-python | 3f4db45584fb352e9f21c870027a2302cb824909 | [
"CC0-1.0",
"MIT"
] | 1 | 2021-02-17T18:39:09.000Z | 2021-02-17T18:39:09.000Z | samples/refresh_tasks.py | jorwoods/server-client-python | fefd6f18d8a6617829c6323879d2c3ed77a4cda6 | [
"CC0-1.0",
"MIT"
] | 1 | 2021-02-24T00:26:46.000Z | 2021-02-24T00:26:46.000Z | samples/refresh_tasks.py | jorwoods/server-client-python | fefd6f18d8a6617829c6323879d2c3ed77a4cda6 | [
"CC0-1.0",
"MIT"
] | 1 | 2021-02-17T18:39:10.000Z | 2021-02-17T18:39:10.000Z | ####
# This script demonstrates how to use the Tableau Server Client
# to query extract refresh tasks and run them as needed.
#
# To run the script, you must have installed Python 3.5 or later.
####
import argparse
import getpass
import logging
import tableauserverclient as TSC
def handle_run(server, args):
tas... | 29.76 | 102 | 0.692652 | t argparse
import getpass
import logging
import tableauserverclient as TSC
def handle_run(server, args):
task = server.tasks.get_by_id(args.id)
print(server.tasks.run(task))
def handle_list(server, _):
tasks, pagination = server.tasks.get()
for task in tasks:
print("{}".format(task))
def ... | true | true |
f722af34017e91c4b0048d9a3ded31d6e006fbea | 4,146 | py | Python | numba/knn/GPU/base_knn.py | Hardcode84/dpbench | e6bc1fc6493cb80a1b5a2ffcca4cc1348dd3ad99 | [
"BSD-2-Clause"
] | null | null | null | numba/knn/GPU/base_knn.py | Hardcode84/dpbench | e6bc1fc6493cb80a1b5a2ffcca4cc1348dd3ad99 | [
"BSD-2-Clause"
] | null | null | null | numba/knn/GPU/base_knn.py | Hardcode84/dpbench | e6bc1fc6493cb80a1b5a2ffcca4cc1348dd3ad99 | [
"BSD-2-Clause"
] | null | null | null | # *****************************************************************************
# Copyright (c) 2020, Intel Corporation All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of sou... | 36.052174 | 87 | 0.601785 |
import argparse
import sys
import numpy as np
DATA_DIM = 16
try:
import itimer as it
now = it.itime
get_mops = it.itime_mops_now
except:
from timeit import default_timer
now = default_timer
get_mops = lambda t0, t1, n: (n / (t1 - t0),t1-t0)
| true | true |
f722af587574ebe501b894988e417a8183396162 | 2,561 | py | Python | src/cutty/templates/adapters/cookiecutter/config.py | cjolowicz/cutty | 3a183fb06f5f521eaf1909514cb8c3d9e5b9c193 | [
"MIT"
] | 1 | 2021-11-15T20:27:59.000Z | 2021-11-15T20:27:59.000Z | src/cutty/templates/adapters/cookiecutter/config.py | cjolowicz/cutty | 3a183fb06f5f521eaf1909514cb8c3d9e5b9c193 | [
"MIT"
] | 171 | 2020-07-24T07:30:20.000Z | 2022-03-31T14:05:45.000Z | src/cutty/templates/adapters/cookiecutter/config.py | cjolowicz/cutty | 3a183fb06f5f521eaf1909514cb8c3d9e5b9c193 | [
"MIT"
] | null | null | null | """Cookiecutter loader."""
import json
from collections.abc import Iterator
from typing import Any
from cutty.filesystems.domain.path import Path
from cutty.templates.domain.config import Config
from cutty.templates.domain.variables import Variable
def loadvalue(value: Any) -> Any:
"""Stringize scalars."""
i... | 29.102273 | 85 | 0.634908 | import json
from collections.abc import Iterator
from typing import Any
from cutty.filesystems.domain.path import Path
from cutty.templates.domain.config import Config
from cutty.templates.domain.variables import Variable
def loadvalue(value: Any) -> Any:
if isinstance(value, (bool, int, float)):
return ... | true | true |
f722b02b0ef579f244024488c3e668d8720b0fef | 726 | py | Python | chat_dump.py | healingbrew/HeroesEmojiSlicer | 3c2cab9db8a0afea6b3bf3eb60c2a0e45d840355 | [
"MIT"
] | 1 | 2020-09-18T20:48:10.000Z | 2020-09-18T20:48:10.000Z | chat_dump.py | healingbrew/HeroesEmojiSlicer | 3c2cab9db8a0afea6b3bf3eb60c2a0e45d840355 | [
"MIT"
] | null | null | null | chat_dump.py | healingbrew/HeroesEmojiSlicer | 3c2cab9db8a0afea6b3bf3eb60c2a0e45d840355 | [
"MIT"
] | null | null | null | import heroprotocol, sys, os, os.path, pprint
from heroprotocol.mpyq import mpyq
sys.path.append(os.path.join(os.getcwd(), "heroprotocol"))
from heroprotocol import protocol29406
archive = mpyq.MPQArchive(sys.argv[-1])
contents = archive.header['user_data_header']['content']
header = protocol29406.decode_replay_head... | 33 | 98 | 0.750689 | import heroprotocol, sys, os, os.path, pprint
from heroprotocol.mpyq import mpyq
sys.path.append(os.path.join(os.getcwd(), "heroprotocol"))
from heroprotocol import protocol29406
archive = mpyq.MPQArchive(sys.argv[-1])
contents = archive.header['user_data_header']['content']
header = protocol29406.decode_replay_head... | true | true |
f722b139debca8b53a4596ee33968474cbe0e8ce | 2,296 | py | Python | tketris/__init__.py | andydevs/tketris | 054914a9ad815b009b6792067bd689e36095e8de | [
"MIT"
] | 1 | 2020-09-13T21:29:12.000Z | 2020-09-13T21:29:12.000Z | tketris/__init__.py | andydevs/tketris | 054914a9ad815b009b6792067bd689e36095e8de | [
"MIT"
] | null | null | null | tketris/__init__.py | andydevs/tketris | 054914a9ad815b009b6792067bd689e36095e8de | [
"MIT"
] | null | null | null | """
Tketris
Tetris using tkinter
Author: Anshul Kharbanda
Created: 10 - 11 - 2018
"""
from .game import GameLogic
from .view.board import Board
from .view.side_menu import SideMenu
from tkinter import *
class Tketris(Frame, GameLogic):
"""
The main application frame. Includes the GameLogic mixin
"""
... | 25.230769 | 68 | 0.591028 | from .game import GameLogic
from .view.board import Board
from .view.side_menu import SideMenu
from tkinter import *
class Tketris(Frame, GameLogic):
DEBUG = False
def __init__(self, master=None, debug=False):
super(Tketris, self).__init__(master)
self.DEBUG = debug
self.init_ui()
... | true | true |
f722b202bfa2ecdcd28d900f7e723d89f993c74b | 2,840 | py | Python | lambda/comprehend-realtime-text-classification-lambda.py | aws-samples/amazon-comprehend-active-learning-framework | edf01c415a1d0cd52a779c3be4bdabb6c3f3fa00 | [
"MIT-0"
] | 1 | 2021-12-18T00:13:57.000Z | 2021-12-18T00:13:57.000Z | lambda/comprehend-realtime-text-classification-lambda.py | aws-samples/amazon-comprehend-active-learning-framework | edf01c415a1d0cd52a779c3be4bdabb6c3f3fa00 | [
"MIT-0"
] | 1 | 2021-11-22T12:24:01.000Z | 2021-11-22T12:24:01.000Z | lambda/comprehend-realtime-text-classification-lambda.py | aws-samples/amazon-comprehend-active-learning-framework | edf01c415a1d0cd52a779c3be4bdabb6c3f3fa00 | [
"MIT-0"
] | 5 | 2021-01-28T18:55:39.000Z | 2021-09-08T05:56:40.000Z | # Copyright Amazon.com, Inc. and its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT
# Licensed under the MIT License. See the LICENSE accompanying this file
# for the specific language governing permissions and limitations under
# the License.
import json
import boto3
from urllib.parse impo... | 36.883117 | 315 | 0.684507 |
import json
import boto3
from urllib.parse import unquote_plus
import urllib
import time
import os
client = boto3.client(service_name='comprehend', region_name=os.environ['AWS_REGION'], use_ssl=True)
kinesis = boto3.client('firehose', region_name=os.environ['AWS_REGION'])
ssm = boto3.client('ssm', region_nam... | true | true |
f722b2ad5211380a3cd9cba27dee50ff13d03247 | 863 | py | Python | world_creator/data_structures.py | lilSpeedwagon/zaWRka-project | e40c6520183c802e9c61faabeaa079bced4e8b00 | [
"MIT"
] | 1 | 2019-12-11T17:18:42.000Z | 2019-12-11T17:18:42.000Z | world_creator/data_structures.py | lilSpeedwagon/zaWRka-project | e40c6520183c802e9c61faabeaa079bced4e8b00 | [
"MIT"
] | null | null | null | world_creator/data_structures.py | lilSpeedwagon/zaWRka-project | e40c6520183c802e9c61faabeaa079bced4e8b00 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
from copy import deepcopy
class Vector2D:
def __init__(self, x, y):
self.x = x
self.y = y
def __truediv__(self, other):
answer = deepcopy(self)
answer.x = self.x / other
answer.y = self.y / other
return answer
def __sub__(... | 22.128205 | 54 | 0.551564 |
from copy import deepcopy
class Vector2D:
def __init__(self, x, y):
self.x = x
self.y = y
def __truediv__(self, other):
answer = deepcopy(self)
answer.x = self.x / other
answer.y = self.y / other
return answer
def __sub__(self, other):
... | true | true |
f722b3e29e34689cf05526ca96e5fb3e45c1cb35 | 318 | py | Python | gym_jiminy/gym_jiminy/__init__.py | matthieuvigne/jiminy | f893b2254a9e695a4154b941b599536756ea3d8b | [
"MIT"
] | null | null | null | gym_jiminy/gym_jiminy/__init__.py | matthieuvigne/jiminy | f893b2254a9e695a4154b941b599536756ea3d8b | [
"MIT"
] | null | null | null | gym_jiminy/gym_jiminy/__init__.py | matthieuvigne/jiminy | f893b2254a9e695a4154b941b599536756ea3d8b | [
"MIT"
] | null | null | null | from gym.envs.registration import register
register(
id='jiminy-cartpole-v0',
entry_point='gym_jiminy.envs:JiminyCartPoleEnv',
reward_threshold=10000.0,
)
register(
id='jiminy-acrobot-v0',
entry_point='gym_jiminy.envs:JiminyAcrobotEnv',
max_episode_steps=12000,
reward_threshold=-3000.0
) | 22.714286 | 52 | 0.742138 | from gym.envs.registration import register
register(
id='jiminy-cartpole-v0',
entry_point='gym_jiminy.envs:JiminyCartPoleEnv',
reward_threshold=10000.0,
)
register(
id='jiminy-acrobot-v0',
entry_point='gym_jiminy.envs:JiminyAcrobotEnv',
max_episode_steps=12000,
reward_threshold=-3000.0
) | true | true |
f722b4a8133853ddcde5fa36ed0487ffd06f2773 | 37,136 | py | Python | container/google/cloud/container_v1beta1/proto/cluster_service_pb2_grpc.py | DaveCheez/google-cloud-python | fc03d4d41f13e9d13db7206438163b3a471fdabd | [
"Apache-2.0"
] | 2 | 2021-11-26T07:08:43.000Z | 2022-03-07T20:20:04.000Z | container/google/cloud/container_v1beta1/proto/cluster_service_pb2_grpc.py | DaveCheez/google-cloud-python | fc03d4d41f13e9d13db7206438163b3a471fdabd | [
"Apache-2.0"
] | 40 | 2019-07-16T10:04:48.000Z | 2020-01-20T09:04:59.000Z | container/google/cloud/container_v1beta1/proto/cluster_service_pb2_grpc.py | DaveCheez/google-cloud-python | fc03d4d41f13e9d13db7206438163b3a471fdabd | [
"Apache-2.0"
] | 2 | 2019-07-18T00:05:31.000Z | 2019-11-27T14:17:22.000Z | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.cloud.container_v1beta1.proto import (
cluster_service_pb2 as google_dot_cloud_dot_container__v1beta1_dot_proto_dot_cluster__service__pb2,
)
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
cl... | 61.585406 | 156 | 0.775986 |
import grpc
from google.cloud.container_v1beta1.proto import (
cluster_service_pb2 as google_dot_cloud_dot_container__v1beta1_dot_proto_dot_cluster__service__pb2,
)
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
class ClusterManagerStub(object):
def __init__(self, channel):
... | true | true |
f722b5a2cf06650e9185d063de48a9d6666ad3ed | 7,042 | py | Python | graph-kernels2/calculate_kernels.py | OminiaVincit/scale-variant-topo | 6945bc42aacd0d71a6fb472c87e09da223821e1e | [
"MIT"
] | 8 | 2018-11-09T21:59:59.000Z | 2020-07-22T19:02:10.000Z | graph-kernels2/calculate_kernels.py | OminiaVincit/scale-variant-topo | 6945bc42aacd0d71a6fb472c87e09da223821e1e | [
"MIT"
] | null | null | null | graph-kernels2/calculate_kernels.py | OminiaVincit/scale-variant-topo | 6945bc42aacd0d71a6fb472c87e09da223821e1e | [
"MIT"
] | null | null | null | import numpy as np
import os
import time
from sklearn import svm
from sklearn.model_selection import GridSearchCV
from sklearn.model_selection import cross_val_predict
from sklearn.pipeline import make_pipeline
from sklearn.metrics import accuracy_score
from grakel import datasets
from grakel import GraphKernel
from... | 37.657754 | 157 | 0.592161 | import numpy as np
import os
import time
from sklearn import svm
from sklearn.model_selection import GridSearchCV
from sklearn.model_selection import cross_val_predict
from sklearn.pipeline import make_pipeline
from sklearn.metrics import accuracy_score
from grakel import datasets
from grakel import GraphKernel
from... | true | true |
f722b5d5ad1cb0a99fd0a2b120d5a42a953925ac | 374 | py | Python | sql_extender/__init__.py | MiConnell/sql-extender | 32a5f839c3b7d5fa7abdf7b02c7aa5702cf31a69 | [
"MIT"
] | null | null | null | sql_extender/__init__.py | MiConnell/sql-extender | 32a5f839c3b7d5fa7abdf7b02c7aa5702cf31a69 | [
"MIT"
] | null | null | null | sql_extender/__init__.py | MiConnell/sql-extender | 32a5f839c3b7d5fa7abdf7b02c7aa5702cf31a69 | [
"MIT"
] | null | null | null | # type: ignore[attr-defined]
"""Python package to extend sql functionality"""
try:
from importlib.metadata import PackageNotFoundError, version
except ImportError: # pragma: no cover
from importlib_metadata import PackageNotFoundError, version
try:
__version__ = version(__name__)
except PackageNotFoundE... | 26.714286 | 64 | 0.764706 |
try:
from importlib.metadata import PackageNotFoundError, version
except ImportError:
from importlib_metadata import PackageNotFoundError, version
try:
__version__ = version(__name__)
except PackageNotFoundError:
__version__ = "unknown"
| true | true |
f722b63dddf18e587faafd9a5459737bf43c110f | 540 | py | Python | python/ray/serve/examples/echo.py | acmore/ray | 9f0f54266064e203b0bdcc9d3fa947cb4518ebc0 | [
"Apache-2.0"
] | 1 | 2020-08-20T16:22:38.000Z | 2020-08-20T16:22:38.000Z | python/ray/serve/examples/echo.py | acmore/ray | 9f0f54266064e203b0bdcc9d3fa947cb4518ebc0 | [
"Apache-2.0"
] | 1 | 2020-06-23T07:54:44.000Z | 2020-06-23T08:04:47.000Z | python/ray/serve/examples/echo.py | acmore/ray | 9f0f54266064e203b0bdcc9d3fa947cb4518ebc0 | [
"Apache-2.0"
] | null | null | null | """
Example service that prints out http context.
"""
import time
import requests
from ray import serve
from ray.serve.utils import pformat_color_json
def echo(flask_request):
return "hello " + flask_request.args.get("name", "serve!")
serve.init()
serve.create_backend("echo:v1", echo)
serve.create_endpoint(... | 19.285714 | 70 | 0.701852 |
import time
import requests
from ray import serve
from ray.serve.utils import pformat_color_json
def echo(flask_request):
return "hello " + flask_request.args.get("name", "serve!")
serve.init()
serve.create_backend("echo:v1", echo)
serve.create_endpoint("my_endpoint", backend="echo:v1", route="/echo")
whil... | true | true |
f722b64048e9d3433b07297d01920a9d40b3caad | 2,066 | py | Python | backend/app/db/models/sales.py | Laende/anleggsmaskin-salgsprisprekisjon | d1e448d9ee081ba055c3ac05c1b1883294f19c99 | [
"MIT"
] | null | null | null | backend/app/db/models/sales.py | Laende/anleggsmaskin-salgsprisprekisjon | d1e448d9ee081ba055c3ac05c1b1883294f19c99 | [
"MIT"
] | null | null | null | backend/app/db/models/sales.py | Laende/anleggsmaskin-salgsprisprekisjon | d1e448d9ee081ba055c3ac05c1b1883294f19c99 | [
"MIT"
] | null | null | null | from datetime import datetime
from sqlalchemy import Column, Date, DateTime, Float, Integer, String
from sqlalchemy.sql.sqltypes import Boolean
from app.db.base_class import Base
class Sales(Base):
id = Column(Integer, primary_key=True)
saleprice = Column(Integer, nullable=True)
model_id = Column(Intege... | 38.981132 | 78 | 0.742498 | from datetime import datetime
from sqlalchemy import Column, Date, DateTime, Float, Integer, String
from sqlalchemy.sql.sqltypes import Boolean
from app.db.base_class import Base
class Sales(Base):
id = Column(Integer, primary_key=True)
saleprice = Column(Integer, nullable=True)
model_id = Column(Intege... | true | true |
f722b6fb9a5e79b3ad00ffa5fce2548d02a0141f | 3,564 | py | Python | code/Algorithms/Algorithms.py | BogyMitutoyoCTL/Snake-AI-2021.1 | dfbc556e74628e670db3fc4891b50203c466ae16 | [
"MIT"
] | null | null | null | code/Algorithms/Algorithms.py | BogyMitutoyoCTL/Snake-AI-2021.1 | dfbc556e74628e670db3fc4891b50203c466ae16 | [
"MIT"
] | null | null | null | code/Algorithms/Algorithms.py | BogyMitutoyoCTL/Snake-AI-2021.1 | dfbc556e74628e670db3fc4891b50203c466ae16 | [
"MIT"
] | null | null | null | from GameData import GameData
from RewardSystem import RewardSystem
from TrainingData import TrainingData
from Visualization import Visualization
from Field import Field
from typing import Optional
class Algorithm:
def __init__(self):
self.model = None
self.reward_system: Optional[RewardSystem] = ... | 37.125 | 119 | 0.658249 | from GameData import GameData
from RewardSystem import RewardSystem
from TrainingData import TrainingData
from Visualization import Visualization
from Field import Field
from typing import Optional
class Algorithm:
def __init__(self):
self.model = None
self.reward_system: Optional[RewardSystem] = ... | true | true |
f722b721e7eab69ffbf8ddc2e18bb83c2eacb719 | 797 | py | Python | tests/test_utils.py | marteinn/wagtail-meta-preview | c07a1bace9b9f18dc4c4ef5429eb9b94fdc4eb0b | [
"MIT"
] | 22 | 2020-08-02T07:37:48.000Z | 2022-03-23T08:10:42.000Z | tests/test_utils.py | marteinn/wagtail-meta-preview | c07a1bace9b9f18dc4c4ef5429eb9b94fdc4eb0b | [
"MIT"
] | 2 | 2020-08-02T19:27:12.000Z | 2020-08-16T10:02:59.000Z | tests/test_utils.py | marteinn/wagtail-meta-preview | c07a1bace9b9f18dc4c4ef5429eb9b94fdc4eb0b | [
"MIT"
] | 2 | 2020-08-02T18:55:44.000Z | 2020-08-03T12:01:54.000Z | from io import BytesIO
import PIL.Image
from django.test import TestCase
from django.core.files.images import ImageFile
from wagtail.tests.utils import WagtailTestUtils
from wagtail.images.models import Image
from wagtail_meta_preview.utils import get_focal
# Taken from wagtail.images.test.utils
def get_test_image_... | 28.464286 | 79 | 0.705144 | from io import BytesIO
import PIL.Image
from django.test import TestCase
from django.core.files.images import ImageFile
from wagtail.tests.utils import WagtailTestUtils
from wagtail.images.models import Image
from wagtail_meta_preview.utils import get_focal
def get_test_image_file(filename="test.png", colour="whit... | true | true |
f722b7c07bc7436fa8077d981c5440bed42bce81 | 2,307 | py | Python | _unittests/ut_onnxrt/test_rt_valid_model_gaussian_mixture.py | sdpython/mlprodic | 9367dacc91d35ec670c8a8a76708300a75bbc993 | [
"MIT"
] | 32 | 2018-03-04T23:33:30.000Z | 2022-03-10T19:15:06.000Z | _unittests/ut_onnxrt/test_rt_valid_model_gaussian_mixture.py | sdpython/mlprodic | 9367dacc91d35ec670c8a8a76708300a75bbc993 | [
"MIT"
] | 184 | 2017-11-30T14:10:35.000Z | 2022-02-21T08:29:31.000Z | _unittests/ut_onnxrt/test_rt_valid_model_gaussian_mixture.py | sdpython/mlprodic | 9367dacc91d35ec670c8a8a76708300a75bbc993 | [
"MIT"
] | 9 | 2019-07-24T13:18:00.000Z | 2022-03-07T04:08:07.000Z | """
@brief test log(time=16s)
"""
import unittest
from logging import getLogger
from pandas import DataFrame
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import ExtTestCase
from pyquickhelper.pandashelper import df2rst
from sklearn.exceptions import ConvergenceWarning
try:
from sklearn.ut... | 36.619048 | 89 | 0.673602 | import unittest
from logging import getLogger
from pandas import DataFrame
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import ExtTestCase
from pyquickhelper.pandashelper import df2rst
from sklearn.exceptions import ConvergenceWarning
try:
from sklearn.utils._testing import ignore_warnings
exc... | true | true |
f722b84767f8fa5c57fce1563a9d9b91a26ec9ed | 270 | py | Python | Python/String Validators.py | shivendra90/HackerRank_Solutions | 0e6f9b907c5f8ca93b2945787cb1fe7ed172bed6 | [
"MIT"
] | null | null | null | Python/String Validators.py | shivendra90/HackerRank_Solutions | 0e6f9b907c5f8ca93b2945787cb1fe7ed172bed6 | [
"MIT"
] | null | null | null | Python/String Validators.py | shivendra90/HackerRank_Solutions | 0e6f9b907c5f8ca93b2945787cb1fe7ed172bed6 | [
"MIT"
] | null | null | null | if __name__ == '__main__':
string = str(input())
methods = [".isalnum()", ".isalpha()", ".isdigit()",
".islower()", ".isupper()"]
for i, method in enumerate(methods):
print(eval("any(alpha{0} for alpha in string)".format(method)))
| 27 | 71 | 0.548148 | if __name__ == '__main__':
string = str(input())
methods = [".isalnum()", ".isalpha()", ".isdigit()",
".islower()", ".isupper()"]
for i, method in enumerate(methods):
print(eval("any(alpha{0} for alpha in string)".format(method)))
| true | true |
f722bab0afcdaf0269ac288c12cb80d2a596631f | 82 | py | Python | books/PRML/PRML-master-Python/prml/linear/classifier.py | iamfaith/DeepLearning | 80ce429d0e9e448cf84e7d51129ef4e0077048a2 | [
"Apache-2.0"
] | 7,581 | 2018-04-26T04:29:30.000Z | 2022-03-31T15:35:39.000Z | books/PRML/PRML-master-Python/prml/linear/classifier.py | lizhenchen2019/DeepLearning | 467c73e2d0435f0a05255e5b5e00454260d01f27 | [
"Apache-2.0"
] | 8 | 2019-05-22T02:27:35.000Z | 2022-03-03T03:53:05.000Z | books/PRML/PRML-master-Python/prml/linear/classifier.py | lizhenchen2019/DeepLearning | 467c73e2d0435f0a05255e5b5e00454260d01f27 | [
"Apache-2.0"
] | 2,340 | 2018-04-26T04:28:11.000Z | 2022-03-31T02:28:25.000Z | class Classifier(object):
"""
Base class for classifiers
"""
pass
| 13.666667 | 30 | 0.585366 | class Classifier(object):
pass
| true | true |
f722bc57a9f5970f9cf73611c7fa64c8e152b05e | 3,454 | py | Python | datalabeling/create_instruction.py | m-abba/python-docs-samples | b00f00d734b89edae8ae6876d6261e19dc82cd34 | [
"Apache-2.0"
] | 1 | 2020-03-05T18:24:45.000Z | 2020-03-05T18:24:45.000Z | datalabeling/create_instruction.py | m-abba/python-docs-samples | b00f00d734b89edae8ae6876d6261e19dc82cd34 | [
"Apache-2.0"
] | 1 | 2022-01-14T23:28:27.000Z | 2022-01-14T23:28:27.000Z | datalabeling/create_instruction.py | m-abba/python-docs-samples | b00f00d734b89edae8ae6876d6261e19dc82cd34 | [
"Apache-2.0"
] | 2 | 2020-06-07T07:03:00.000Z | 2021-04-10T18:22:25.000Z | #!/usr/bin/env python
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 33.533981 | 79 | 0.713955 |
import argparse
import os
from google.api_core.client_options import ClientOptions
def create_instruction(project_id, data_type, instruction_gcs_uri):
from google.cloud import datalabeling_v1beta1 as datalabeling
client = datalabeling.DataLabelingServiceClient()
if 'DATALAB... | true | true |
f722bcfd8c23f4dcfdc59a006cd1fccacb2edff4 | 1,310 | py | Python | tests/test_test_utils.py | tomasaschan/scantree | d6e432cb4d71b32341ee0668c90499e957c2bb89 | [
"MIT"
] | 8 | 2020-06-03T08:23:03.000Z | 2022-02-23T21:08:55.000Z | tests/test_test_utils.py | tomasaschan/scantree | d6e432cb4d71b32341ee0668c90499e957c2bb89 | [
"MIT"
] | 10 | 2019-03-13T01:07:06.000Z | 2022-01-09T06:58:24.000Z | tests/test_test_utils.py | tomasaschan/scantree | d6e432cb4d71b32341ee0668c90499e957c2bb89 | [
"MIT"
] | 3 | 2020-07-18T04:39:49.000Z | 2021-11-10T12:46:02.000Z | from __future__ import print_function, division
import pytest
import attr
from scantree.test_utils import assert_dir_entry_equal
from scantree import DirEntryReplacement
class MockStat(object):
def __init__(self, st_ino=None):
self.st_ino = st_ino
class TestAssertDirEntryEqual(object):
def get_... | 25.192308 | 67 | 0.60229 | from __future__ import print_function, division
import pytest
import attr
from scantree.test_utils import assert_dir_entry_equal
from scantree import DirEntryReplacement
class MockStat(object):
def __init__(self, st_ino=None):
self.st_ino = st_ino
class TestAssertDirEntryEqual(object):
def get_... | true | true |
f722bd3b55caa4b1c165ca71f3cbabe696b4b303 | 13,630 | py | Python | bindings/python/cntk/train/trainer.py | KeyanAndrewLi/CNTK | 4b9f8739c72068d70279f91b4b59923b2ae1fc3a | [
"RSA-MD"
] | null | null | null | bindings/python/cntk/train/trainer.py | KeyanAndrewLi/CNTK | 4b9f8739c72068d70279f91b4b59923b2ae1fc3a | [
"RSA-MD"
] | null | null | null | bindings/python/cntk/train/trainer.py | KeyanAndrewLi/CNTK | 4b9f8739c72068d70279f91b4b59923b2ae1fc3a | [
"RSA-MD"
] | null | null | null |
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
from .. import cntk_py
from ..device import use_default_device
from cntk.internal i... | 42.461059 | 135 | 0.644241 |
from .. import cntk_py
from ..device import use_default_device
from cntk.internal import sanitize_var_map, sanitize_function, typemap, \
_value_as_sequence_or_array
from cntk.internal.utils import _py_dict_to_cntk_dict
from ..io import MinibatchData
__doc__ = '''\
A trainer encapsulate... | true | true |
f722bd62f7f88b7d727e32c81e84c320ebafaa0b | 755 | py | Python | unicef_schools_attribute_cleaning/models/EducationLevel.py | developmentseed/unicef-schools-attribute-cleaning | eb3dd8a02f26e3455ee04ac2788e79c205ae97e5 | [
"MIT"
] | null | null | null | unicef_schools_attribute_cleaning/models/EducationLevel.py | developmentseed/unicef-schools-attribute-cleaning | eb3dd8a02f26e3455ee04ac2788e79c205ae97e5 | [
"MIT"
] | 3 | 2020-10-08T15:28:38.000Z | 2020-10-15T14:37:00.000Z | unicef_schools_attribute_cleaning/models/EducationLevel.py | developmentseed/unicef-schools-attribute-cleaning | eb3dd8a02f26e3455ee04ac2788e79c205ae97e5 | [
"MIT"
] | null | null | null | """
Enumerated type for education level.
"""
from .FuzzyMatchingEnum import FuzzyMatchingEnum
class EducationLevel(FuzzyMatchingEnum):
"""
EducationLevel enumerated type with fuzzy matching.
"""
pre_primary = "Pre-Primary"
pre_básica = "Pre-Primary"
primary = "Primary"
básica = "Primary"
... | 23.59375 | 55 | 0.658278 | from .FuzzyMatchingEnum import FuzzyMatchingEnum
class EducationLevel(FuzzyMatchingEnum):
pre_primary = "Pre-Primary"
pre_básica = "Pre-Primary"
primary = "Primary"
básica = "Primary"
middle = "Middle"
media = "Middle"
secondary = "Secondary"
_9_ybe = "Pre-Primary"
_12_ybe = "Pre-... | true | true |
f722be26b41a4cd19397bdae99ece132a731f927 | 1,136 | py | Python | mindhome_alpha/erpnext/patches/v11_0/add_default_email_template_for_leave.py | Mindhome/field_service | 3aea428815147903eb9af1d0c1b4b9fc7faed057 | [
"MIT"
] | 1 | 2021-04-29T14:55:29.000Z | 2021-04-29T14:55:29.000Z | mindhome_alpha/erpnext/patches/v11_0/add_default_email_template_for_leave.py | Mindhome/field_service | 3aea428815147903eb9af1d0c1b4b9fc7faed057 | [
"MIT"
] | null | null | null | mindhome_alpha/erpnext/patches/v11_0/add_default_email_template_for_leave.py | Mindhome/field_service | 3aea428815147903eb9af1d0c1b4b9fc7faed057 | [
"MIT"
] | 1 | 2021-04-29T14:39:01.000Z | 2021-04-29T14:39:01.000Z | from __future__ import unicode_literals
import frappe, os
from frappe import _
def execute():
frappe.reload_doc("email", "doctype", "email_template")
if not frappe.db.exists("Email Template", _('Leave Approval Notification')):
base_path = frappe.get_app_path("erpnext", "hr", "doctype")
response = frappe.read_fi... | 36.645161 | 113 | 0.729754 | from __future__ import unicode_literals
import frappe, os
from frappe import _
def execute():
frappe.reload_doc("email", "doctype", "email_template")
if not frappe.db.exists("Email Template", _('Leave Approval Notification')):
base_path = frappe.get_app_path("erpnext", "hr", "doctype")
response = frappe.read_fi... | true | true |
f722be643b31ce8c40ee6ceee4e09c86f2a2faba | 386 | py | Python | Dataset/Leetcode/train/69/621.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/train/69/621.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/train/69/621.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | class Solution:
def XXX(self, x: int) -> int:
if x == 1:
return 1
left = 0
right = x
while right - left > 1:
mid = (left + right) // 2
a = mid ** 2
if a == x:
return mid
if a > x:
right = mid
... | 21.444444 | 37 | 0.339378 | class Solution:
def XXX(self, x: int) -> int:
if x == 1:
return 1
left = 0
right = x
while right - left > 1:
mid = (left + right) // 2
a = mid ** 2
if a == x:
return mid
if a > x:
right = mid
... | true | true |
f722bec17844490f751c3d9dc7d43b531ddd3f98 | 2,608 | py | Python | resnet/official/utils/misc/distribution_utils_test.py | biolins/frivolous_dnns | 23d9a057ac517770cdfe9d8ac71543c328fcf76d | [
"MIT"
] | null | null | null | resnet/official/utils/misc/distribution_utils_test.py | biolins/frivolous_dnns | 23d9a057ac517770cdfe9d8ac71543c328fcf76d | [
"MIT"
] | null | null | null | resnet/official/utils/misc/distribution_utils_test.py | biolins/frivolous_dnns | 23d9a057ac517770cdfe9d8ac71543c328fcf76d | [
"MIT"
] | 2 | 2021-05-31T23:08:13.000Z | 2021-12-28T19:11:08.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... | 38.925373 | 80 | 0.715874 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from official.utils.misc import distribution_utils
class GetDistributionStrategyTest(tf.test.TestCase):
def test_one_device_strategy_cpu(self):
ds = dist... | true | true |
f722bf6a876701e79bdf77fe164cedf55ae66037 | 3,622 | py | Python | simpletransformers/conv_ai/conv_ai_utils.py | manueltonneau/simpletransformers | 7374b786857008e023604789e89c1690ad8bde97 | [
"Apache-2.0"
] | 1 | 2021-04-04T12:21:11.000Z | 2021-04-04T12:21:11.000Z | simpletransformers/conv_ai/conv_ai_utils.py | manueltonneau/simpletransformers | 7374b786857008e023604789e89c1690ad8bde97 | [
"Apache-2.0"
] | null | null | null | simpletransformers/conv_ai/conv_ai_utils.py | manueltonneau/simpletransformers | 7374b786857008e023604789e89c1690ad8bde97 | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2019-present, HuggingFace Inc.
# All rights reserved. This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import json
import logging
import os
import socket
import tarfile
import tempfile
from datetime import datetime
from multi... | 33.537037 | 115 | 0.6709 |
import json
import logging
import os
import socket
import tarfile
import tempfile
from datetime import datetime
from multiprocessing import Pool
import torch
from tqdm.auto import tqdm
from transformers import cached_path
PERSONACHAT_URL = "https://s3.amazonaws.com/datasets.huggingface.co/personachat/personachat_s... | true | true |
f722c0d72f83743569ce6bd8e0b43ff07382e0b5 | 2,315 | py | Python | zwave_js_server/model/firmware.py | firstof9/zwave-js-server-python | 728d1e44277b8c69fac06eba1f8362c281762bf7 | [
"Apache-2.0"
] | 53 | 2021-01-09T18:47:34.000Z | 2022-03-16T21:54:41.000Z | zwave_js_server/model/firmware.py | firstof9/zwave-js-server-python | 728d1e44277b8c69fac06eba1f8362c281762bf7 | [
"Apache-2.0"
] | 130 | 2021-01-06T21:34:46.000Z | 2022-03-29T18:44:14.000Z | zwave_js_server/model/firmware.py | firstof9/zwave-js-server-python | 728d1e44277b8c69fac06eba1f8362c281762bf7 | [
"Apache-2.0"
] | 17 | 2021-01-07T21:55:29.000Z | 2022-03-29T08:08:50.000Z | """Provide a model for Z-Wave firmware."""
from enum import IntEnum
from typing import TYPE_CHECKING, Optional, TypedDict
if TYPE_CHECKING:
from .node import Node
class FirmwareUpdateStatus(IntEnum):
"""Enum with all Firmware update status values.
https://zwave-js.github.io/node-zwave-js/#/api/node?id=s... | 28.9375 | 86 | 0.690713 | from enum import IntEnum
from typing import TYPE_CHECKING, Optional, TypedDict
if TYPE_CHECKING:
from .node import Node
class FirmwareUpdateStatus(IntEnum):
ERROR_TIMEOUT = -1
ERROR_CHECKSUM = 0
ERROR_TRANSMISSION_FAILED = 1
ERROR_INVALID_MANUFACTURER_ID = 2
ERROR_INVALID_FIRMWARE_ID = 3
... | true | true |
f722c138b3d31728a6e3144034675629954da58f | 917 | py | Python | template/main/migrations/0001_add_profile.py | vidalmatheus/f-square | 0a79fd6181e702b05821cd01b7f1cfc87ffa8699 | [
"MIT"
] | 2 | 2021-11-30T14:59:05.000Z | 2022-01-17T02:14:46.000Z | template/main/migrations/0001_add_profile.py | vidalmatheus/f-square | 0a79fd6181e702b05821cd01b7f1cfc87ffa8699 | [
"MIT"
] | null | null | null | template/main/migrations/0001_add_profile.py | vidalmatheus/f-square | 0a79fd6181e702b05821cd01b7f1cfc87ffa8699 | [
"MIT"
] | null | null | null | # Generated by Django 3.2.8 on 2021-11-02 18:01
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... | 32.75 | 121 | 0.63795 |
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
... | true | true |
f722c28f10583fe5c63ddf1e423f2b3a0843dff0 | 3,549 | py | Python | bindings/python/ensmallen/datasets/string/streptomycescatenulae.py | AnacletoLAB/ensmallen | b2c1b18fb1e5801712852bcc239f239e03076f09 | [
"MIT"
] | 5 | 2021-09-10T18:31:58.000Z | 2022-03-24T04:28:04.000Z | bindings/python/ensmallen/datasets/string/streptomycescatenulae.py | AnacletoLAB/ensmallen_graph | b2c1b18fb1e5801712852bcc239f239e03076f09 | [
"MIT"
] | 18 | 2021-01-07T16:47:39.000Z | 2021-08-12T21:51:32.000Z | bindings/python/ensmallen/datasets/string/streptomycescatenulae.py | AnacletoLAB/ensmallen | b2c1b18fb1e5801712852bcc239f239e03076f09 | [
"MIT"
] | 3 | 2021-01-14T02:20:59.000Z | 2021-08-04T19:09:52.000Z | """
This file offers the methods to automatically retrieve the graph Streptomyces catenulae.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein--protein... | 32.861111 | 223 | 0.677656 | from typing import Dict
from ..automatic_graph_retrieval import AutomaticallyRetrievedGraph
from ...ensmallen import Graph
def StreptomycesCatenulae(
directed: bool = False,
preprocess: bool = True,
load_nodes: bool = True,
verbose: int = 2,
cache: bool = True,
cache_path: str = "graphs/str... | true | true |
f722c46bb06665aae4a50164c96b98d2168500c2 | 54,813 | py | Python | radiomics/imageoperations.py | laurentletg/pyradiomics | b30a7fe086417999481bc6792dced4bf3dc3de32 | [
"BSD-3-Clause"
] | 1 | 2019-10-07T12:48:20.000Z | 2019-10-07T12:48:20.000Z | radiomics/imageoperations.py | laurentletg/pyradiomics | b30a7fe086417999481bc6792dced4bf3dc3de32 | [
"BSD-3-Clause"
] | null | null | null | radiomics/imageoperations.py | laurentletg/pyradiomics | b30a7fe086417999481bc6792dced4bf3dc3de32 | [
"BSD-3-Clause"
] | null | null | null | from __future__ import print_function
import logging
import numpy
import pywt
import SimpleITK as sitk
import six
from six.moves import range
logger = logging.getLogger(__name__)
def getMask(mask, **kwargs):
"""
Function to get the correct mask. Includes enforcing a correct pixel data type (UInt32).
Also su... | 45.225248 | 130 | 0.719227 | from __future__ import print_function
import logging
import numpy
import pywt
import SimpleITK as sitk
import six
from six.moves import range
logger = logging.getLogger(__name__)
def getMask(mask, **kwargs):
global logger
label = kwargs.get('label', 1)
label_channel = kwargs.get('label_channel', 0)
if 'vec... | true | true |
f722c4835b23199b17733664f837a80e2c32f7bf | 1,114 | py | Python | debug/test_tf_funcs.py | ccj5351/hmr_rgbd | d1dcf81d72c11e1f502f2c494cd86425f384d9cc | [
"MIT"
] | null | null | null | debug/test_tf_funcs.py | ccj5351/hmr_rgbd | d1dcf81d72c11e1f502f2c494cd86425f384d9cc | [
"MIT"
] | 1 | 2020-12-09T07:29:00.000Z | 2020-12-09T07:29:00.000Z | debug/test_tf_funcs.py | ccj5351/hmr_rgbd | d1dcf81d72c11e1f502f2c494cd86425f384d9cc | [
"MIT"
] | null | null | null | # !/usr/bin/env python3
# -*-coding:utf-8-*-
# @file: test_tf_funcs.py
# @brief:
# @author: Changjiang Cai, ccai1@stevens.edu, caicj5351@gmail.com
# @version: 0.0.1
# @creation date: 13-08-2019
# @last modified: Tue 13 Aug 2019 05:38:05 PM EDT
import tensorflow as tf
import numpy as np
if __name__ == "__main__":
... | 26.52381 | 76 | 0.509874 |
import tensorflow as tf
import numpy as np
if __name__ == "__main__":
data = np.reshape(np.arange(12), [2, 3, 2])
x = tf.constant(data)
idx_1 = [[[0, 0, 0], [0, 1, 1]], [[1, 0, 1], [1, 1, 0]]]
result1 = tf.gather_nd(x, idx_1)
idx_2 = [[0... | true | true |
f722c5c7dd5c858532cb80dbbf2c250515d98113 | 3,353 | py | Python | tests/storages_tests/rdb_tests/test_with_server.py | agarwalrounak/optuna | b5fd0439dc33c94c06251974b8cb023a3f9bccc7 | [
"MIT"
] | 4,950 | 2019-11-15T07:35:51.000Z | 2022-03-31T10:32:42.000Z | tests/storages_tests/rdb_tests/test_with_server.py | SCUTJcfeng/optuna | 9331374a2460da067a6922e4ea09dd4706f3d950 | [
"MIT"
] | 2,490 | 2019-11-15T07:06:20.000Z | 2022-03-31T23:52:45.000Z | tests/storages_tests/rdb_tests/test_with_server.py | SCUTJcfeng/optuna | 9331374a2460da067a6922e4ea09dd4706f3d950 | [
"MIT"
] | 621 | 2019-11-15T11:26:57.000Z | 2022-03-28T11:46:34.000Z | from multiprocessing import Pool
import os
from typing import Sequence
from typing import Tuple
import numpy as np
import pytest
import optuna
_STUDY_NAME = "_test_multiprocess"
def f(x: float, y: float) -> float:
return (x - 3) ** 2 + y
def objective(trial: optuna.Trial) -> float:
x = trial.suggest_flo... | 28.415254 | 87 | 0.664778 | from multiprocessing import Pool
import os
from typing import Sequence
from typing import Tuple
import numpy as np
import pytest
import optuna
_STUDY_NAME = "_test_multiprocess"
def f(x: float, y: float) -> float:
return (x - 3) ** 2 + y
def objective(trial: optuna.Trial) -> float:
x = trial.suggest_flo... | true | true |
f722c5d12335461948e2e30b324c028ee6d1ca43 | 611 | py | Python | dynamic_programming/longest common subsequence.py | nilansharora/Python-algorithms | ef38fab1cfa956e00118f44625ba305baa7e1066 | [
"MIT"
] | 1 | 2020-06-23T10:31:01.000Z | 2020-06-23T10:31:01.000Z | dynamic_programming/longest common subsequence.py | nilansharora/Python-algorithms | ef38fab1cfa956e00118f44625ba305baa7e1066 | [
"MIT"
] | null | null | null | dynamic_programming/longest common subsequence.py | nilansharora/Python-algorithms | ef38fab1cfa956e00118f44625ba305baa7e1066 | [
"MIT"
] | 1 | 2019-10-09T11:02:07.000Z | 2019-10-09T11:02:07.000Z | """
LCS Problem Statement: Given two sequences, find the length of longest subsequence present in both of them.
A subsequence is a sequence that appears in the same relative order, but not necessarily continious.
Example:"abc", "abg" are subsequences of "abcdefgh".
"""
def LCS(s1, s2):
m = len(s1)
n = len(s2)
... | 32.157895 | 107 | 0.567921 | def LCS(s1, s2):
m = len(s1)
n = len(s2)
arr = [[0 for i in range(n+1)]for j in range(m+1)]
for i in range(1,m+1):
for j in range(1,n+1):
if s1[i-1] == s2[j-1]:
arr[i][j] = arr[i-1][j-1]+1
else:
arr[i][j] = max(arr[i-1][j], arr[i][j-1])
... | true | true |
f722c6927aad955f35834589666b1bc5a3185125 | 1,726 | py | Python | modules/text/language_model/lda_webpage/vose_alias.py | chunzhang-hub/PaddleHub | c5cfd021f77fd59340fb26e223e09a592e6a345f | [
"Apache-2.0"
] | 8,360 | 2019-01-18T10:46:45.000Z | 2022-03-31T14:50:02.000Z | modules/text/language_model/lda_webpage/vose_alias.py | dwuping/PaddleHub | 9a3b23295947e22149cc85c17cb4cf23c03f9e06 | [
"Apache-2.0"
] | 1,158 | 2019-04-11T09:22:43.000Z | 2022-03-31T12:12:09.000Z | modules/text/language_model/lda_webpage/vose_alias.py | dwuping/PaddleHub | 9a3b23295947e22149cc85c17cb4cf23c03f9e06 | [
"Apache-2.0"
] | 1,677 | 2019-04-09T15:07:40.000Z | 2022-03-31T06:41:10.000Z | import os
import numpy as np
from paddlehub.common.logger import logger
from lda_webpage.util import rand, rand_k
class VoseAlias(object):
"""Vose's Alias Method.
"""
def __init__(self):
self.__alias = None
self.__prob = None # np.array
def initialize(self, distribution):
... | 26.151515 | 75 | 0.509849 | import os
import numpy as np
from paddlehub.common.logger import logger
from lda_webpage.util import rand, rand_k
class VoseAlias(object):
def __init__(self):
self.__alias = None
self.__prob = None
def initialize(self, distribution):
size = distribution.shape[0]
self.__al... | true | true |
f722c89a9cfdd582a9b7ec9d7a05f47e101e904d | 1,958 | py | Python | mods/Lorenz95/core.py | franktoffel/dapper | 373a27273ea109f349e5edcdcef0cfe0b83b925e | [
"MIT"
] | 3 | 2021-07-31T10:13:11.000Z | 2022-01-14T16:52:04.000Z | mods/Lorenz95/core.py | franktoffel/dapper | 373a27273ea109f349e5edcdcef0cfe0b83b925e | [
"MIT"
] | null | null | null | mods/Lorenz95/core.py | franktoffel/dapper | 373a27273ea109f349e5edcdcef0cfe0b83b925e | [
"MIT"
] | null | null | null | # "Lorenz-95" (or 96) model. For a deeper introduction, see
# "DAPPER/tutorials/T4 - Dynamical systems, chaos, Lorenz.ipynb"
#
# Note: implementation is ndim-agnostic.
import numpy as np
from tools.math import rk4, integrate_TLM, is1d
Force = 8.0
# Note: the model is unstable (blows up) if there are large peaks
# (a... | 27.194444 | 78 | 0.567416 |
import numpy as np
from tools.math import rk4, integrate_TLM, is1d
Force = 8.0
prevent_blow_up = False
Tplot = 10
x0 = lambda M: 2.3*np.ones(M)
def dxdt(x):
a = x.ndim-1
s = lambda x,n: np.roll(x,-n,axis=a)
return (s(x,1)-s(x,-2))*s(x,-1) - x + Force
def step(x0, t, dt):
if prevent_blow_up:
... | true | true |
f722c9033b578367acf4c87292ac6d21909101b8 | 868 | py | Python | analytics.py | Abhi-Balijepalli/PONDR-dev-api | 9ffe7a031b56241ccbda9281de722adcf9a610ea | [
"Apache-2.0"
] | null | null | null | analytics.py | Abhi-Balijepalli/PONDR-dev-api | 9ffe7a031b56241ccbda9281de722adcf9a610ea | [
"Apache-2.0"
] | null | null | null | analytics.py | Abhi-Balijepalli/PONDR-dev-api | 9ffe7a031b56241ccbda9281de722adcf9a610ea | [
"Apache-2.0"
] | null | null | null | from import_reqs import *
from app import app
@app.route('/enterprise/product=<id>', methods=['GET'])
def get_advanced_analytics(id):
"""
get_advanced_analytics(id): this will be for company dashboard, they will see the advanced analytics of a product.
"""
try:
id_token = request.headers['... | 39.454545 | 123 | 0.616359 | from import_reqs import *
from app import app
@app.route('/enterprise/product=<id>', methods=['GET'])
def get_advanced_analytics(id):
try:
id_token = request.headers['Authorization']
claims = auth.verify_id_token(id_token)
uid = claims['uid']
if claims['Enterprise'] is True:
... | true | true |
f722c92a261204b68b931457cc24a81d1adf368d | 393 | py | Python | Ahriknow/wsgi.py | ahriknow/ahriknow | 817b5670c964e01ffe19ed182ce0a7b42e17ce09 | [
"MIT"
] | null | null | null | Ahriknow/wsgi.py | ahriknow/ahriknow | 817b5670c964e01ffe19ed182ce0a7b42e17ce09 | [
"MIT"
] | 3 | 2021-03-19T01:28:43.000Z | 2021-04-08T19:57:19.000Z | Ahriknow/wsgi.py | ahriknow/ahriknow | 817b5670c964e01ffe19ed182ce0a7b42e17ce09 | [
"MIT"
] | null | null | null | """
WSGI config for Ahriknow project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETT... | 23.117647 | 78 | 0.78626 |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Ahriknow.settings')
application = get_wsgi_application()
| true | true |
f722c92c1d8cbce8eebe04231bf78e6a2f03d486 | 4,682 | py | Python | venv/Lib/site-packages/pandas/tests/frame/methods/test_at_time.py | arnoyu-hub/COMP0016miemie | 59af664dcf190eab4f93cefb8471908717415fea | [
"MIT"
] | null | null | null | venv/Lib/site-packages/pandas/tests/frame/methods/test_at_time.py | arnoyu-hub/COMP0016miemie | 59af664dcf190eab4f93cefb8471908717415fea | [
"MIT"
] | null | null | null | venv/Lib/site-packages/pandas/tests/frame/methods/test_at_time.py | arnoyu-hub/COMP0016miemie | 59af664dcf190eab4f93cefb8471908717415fea | [
"MIT"
] | null | null | null | from datetime import time
import numpy as np
import pytest
import pytz
from pandas._libs.tslibs import timezones
from pandas import (
DataFrame,
date_range,
)
import pandas._testing as tm
class TestAtTime:
@pytest.mark.parametrize("tzstr", ["US/Eastern", "dateutil/US/Eastern"])
def... | 36.294574 | 82 | 0.582443 | from datetime import time
import numpy as np
import pytest
import pytz
from pandas._libs.tslibs import timezones
from pandas import (
DataFrame,
date_range,
)
import pandas._testing as tm
class TestAtTime:
@pytest.mark.parametrize("tzstr", ["US/Eastern", "dateutil/US/Eastern"])
def... | true | true |
f722c98a8d9ab0cee71e36dd63e9ca989995573b | 1,951 | py | Python | casperlabs_client/decorators.py | CasperLabs/client-py | 12955d2b88bc439f94a1cc33a063fda0c20ef8ab | [
"Apache-2.0"
] | 2 | 2021-05-12T06:43:45.000Z | 2021-10-02T11:45:41.000Z | casperlabs_client/decorators.py | CasperLabs/client-py | 12955d2b88bc439f94a1cc33a063fda0c20ef8ab | [
"Apache-2.0"
] | 24 | 2020-06-30T14:55:20.000Z | 2021-01-05T18:18:29.000Z | casperlabs_client/decorators.py | CasperLabs/client-py | 12955d2b88bc439f94a1cc33a063fda0c20ef8ab | [
"Apache-2.0"
] | 1 | 2020-06-22T15:32:38.000Z | 2020-06-22T15:32:38.000Z | # -*- coding: utf-8 -*-
import functools
import logging
import sys
import time
import grpc
from grpc._channel import _Rendezvous
NUMBER_OF_RETRIES = 5
# Initial delay in seconds before an attempt to retry
INITIAL_DELAY = 0.3
def retry_wrapper(function, *args):
delay = INITIAL_DELAY
for i in range(NUMBER_OF_... | 27.097222 | 95 | 0.633521 |
import functools
import logging
import sys
import time
import grpc
from grpc._channel import _Rendezvous
NUMBER_OF_RETRIES = 5
INITIAL_DELAY = 0.3
def retry_wrapper(function, *args):
delay = INITIAL_DELAY
for i in range(NUMBER_OF_RETRIES):
try:
return function(*args)
except _Re... | true | true |
f722ca4fb202ed3d7a1aa9eea95479918d1dc441 | 31,292 | py | Python | test/test_extractor.py | thombashi/DataProperty | ed894483882ef81bd7796c2de4a966b548167c65 | [
"MIT"
] | 18 | 2016-02-20T04:16:07.000Z | 2022-01-05T20:24:51.000Z | test/test_extractor.py | thombashi/DataProperty | ed894483882ef81bd7796c2de4a966b548167c65 | [
"MIT"
] | 13 | 2016-03-20T12:11:50.000Z | 2020-01-01T06:43:49.000Z | test/test_extractor.py | thombashi/DataProperty | ed894483882ef81bd7796c2de4a966b548167c65 | [
"MIT"
] | 5 | 2016-05-24T21:09:27.000Z | 2019-12-02T21:00:00.000Z | """
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
import datetime
from decimal import Decimal
import pytest
from typepy import DateTime, RealNumber, String, Typecode
from dataproperty import (
Align,
DataPropertyExtractor,
Format,
LineBreakHandling,
MatrixFormatting,
Pre... | 37.565426 | 99 | 0.601975 |
import datetime
from decimal import Decimal
import pytest
from typepy import DateTime, RealNumber, String, Typecode
from dataproperty import (
Align,
DataPropertyExtractor,
Format,
LineBreakHandling,
MatrixFormatting,
Preprocessor,
)
from .common import get_strict_level_map
DATATIME_DATA =... | true | true |
f722cad3bd9d74b9d520ccea28c51f10673e99e8 | 669 | py | Python | answers/x_9_9.py | ofl/kuku | 76eefc0d3d859051473ee0d5f48b5d42d17d05a6 | [
"MIT"
] | null | null | null | answers/x_9_9.py | ofl/kuku | 76eefc0d3d859051473ee0d5f48b5d42d17d05a6 | [
"MIT"
] | 4 | 2021-09-23T03:19:52.000Z | 2021-11-13T10:38:21.000Z | answers/x_9_9.py | ofl/kuku | 76eefc0d3d859051473ee0d5f48b5d42d17d05a6 | [
"MIT"
] | null | null | null | # x_9_9
#
# 「prefecture.csv」を利用して都道府県番号を答える機能をチャットボットに追加してください
import csv
chatbot = {
'おはよう': 'おはようございます',
'おやすみ': 'おやすみなさい',
'今日は何日ですか': '2021年11月14日です',
'今日の天気は': '雨です',
'何か歌って': 'もーもたろさんももたろさん',
}
message = input('何か話しかけてください:')
if message == '都道府県番号を教えて':
prefecture = input('何県の都道府県番号ですか... | 20.272727 | 70 | 0.61136 |
import csv
chatbot = {
'おはよう': 'おはようございます',
'おやすみ': 'おやすみなさい',
'今日は何日ですか': '2021年11月14日です',
'今日の天気は': '雨です',
'何か歌って': 'もーもたろさんももたろさん',
}
message = input('何か話しかけてください:')
if message == '都道府県番号を教えて':
prefecture = input('何県の都道府県番号ですか?:')
file = open('./files/prefecture.csv', encoding="ut... | true | true |
f722cbb15de2d0bb821479a2b795997c45034f00 | 2,219 | py | Python | openGaussBase/testcase/SYSTEM_CATALOGS&SYSTEM_VIEWS/SYSTEM_TABLE/Opengauss_Function_System_Table_Case0033.py | opengauss-mirror/Yat | aef107a8304b94e5d99b4f1f36eb46755eb8919e | [
"MulanPSL-1.0"
] | null | null | null | openGaussBase/testcase/SYSTEM_CATALOGS&SYSTEM_VIEWS/SYSTEM_TABLE/Opengauss_Function_System_Table_Case0033.py | opengauss-mirror/Yat | aef107a8304b94e5d99b4f1f36eb46755eb8919e | [
"MulanPSL-1.0"
] | null | null | null | openGaussBase/testcase/SYSTEM_CATALOGS&SYSTEM_VIEWS/SYSTEM_TABLE/Opengauss_Function_System_Table_Case0033.py | opengauss-mirror/Yat | aef107a8304b94e5d99b4f1f36eb46755eb8919e | [
"MulanPSL-1.0"
] | null | null | null | """
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W... | 34.671875 | 119 | 0.626408 |
import sys
import unittest
from yat.test import Node
from yat.test import macro
sys.path.append(sys.path[0] + "/../")
from testcase.utils.Logger import Logger
from testcase.utils.Common import Common
from testcase.utils.CommonSH import CommonSH
logger = Logger()
class IndexFileDamaged(unittest.TestCase):
def s... | true | true |
f722cd6c856266fba9fb04305214e342cf9e2048 | 2,211 | py | Python | decay/decays/sample/half_sudden.py | pyl1b/decay | 7200516455fc03351ad658af66b5cc39b2b2d50a | [
"MIT"
] | null | null | null | decay/decays/sample/half_sudden.py | pyl1b/decay | 7200516455fc03351ad658af66b5cc39b2b2d50a | [
"MIT"
] | null | null | null | decay/decays/sample/half_sudden.py | pyl1b/decay | 7200516455fc03351ad658af66b5cc39b2b2d50a | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Contains the definition of the SuddenDecay class.
"""
from __future__ import unicode_literals
from __future__ import print_function
import logging
import numpy as np
from . import SampleBasedDecay
logger = logging.getLogger('decay.half_sudden')
class HalfSuddenDecay(SampleBasedDecay):
... | 24.842697 | 65 | 0.591588 |
from __future__ import unicode_literals
from __future__ import print_function
import logging
import numpy as np
from . import SampleBasedDecay
logger = logging.getLogger('decay.half_sudden')
class HalfSuddenDecay(SampleBasedDecay):
def __init__(self, *args, **kwargs):
super(HalfSuddenDecay, self).__in... | true | true |
f722cd78a8cac2e41c27ebc3b010dead3c261d46 | 398 | py | Python | test.py | glauberrleite/system-identifier | 982e04b7df84211d5797d259e9cb431d83b00529 | [
"MIT"
] | null | null | null | test.py | glauberrleite/system-identifier | 982e04b7df84211d5797d259e9cb431d83b00529 | [
"MIT"
] | null | null | null | test.py | glauberrleite/system-identifier | 982e04b7df84211d5797d259e9cb431d83b00529 | [
"MIT"
] | null | null | null | from Util import Util
import numpy
import matplotlib.pyplot as pyplot
inputArray = numpy.ones(100)
theta = [ 2.705, -2.448, 0.7408, 0.0523, -0.0855, 0.035 ]
orderOutput = 3
orderInput = 3
sampleRate = 0.1
y = Util.computeOutput(inputArray, theta, orderOutput, orderInput)
t = numpy.arange(0, len(y)*sampleRate, sample... | 22.111111 | 66 | 0.713568 | from Util import Util
import numpy
import matplotlib.pyplot as pyplot
inputArray = numpy.ones(100)
theta = [ 2.705, -2.448, 0.7408, 0.0523, -0.0855, 0.035 ]
orderOutput = 3
orderInput = 3
sampleRate = 0.1
y = Util.computeOutput(inputArray, theta, orderOutput, orderInput)
t = numpy.arange(0, len(y)*sampleRate, sample... | true | true |
f722ceebadc01cde384986f37c3b059f0718a6e8 | 12,353 | py | Python | osgar/drivers/cortexpilot.py | m3d/osgar_archive_2020 | 556b534e59f8aa9b6c8055e2785c8ae75a1a0a0e | [
"MIT"
] | null | null | null | osgar/drivers/cortexpilot.py | m3d/osgar_archive_2020 | 556b534e59f8aa9b6c8055e2785c8ae75a1a0a0e | [
"MIT"
] | null | null | null | osgar/drivers/cortexpilot.py | m3d/osgar_archive_2020 | 556b534e59f8aa9b6c8055e2785c8ae75a1a0a0e | [
"MIT"
] | 1 | 2022-01-02T04:06:01.000Z | 2022-01-02T04:06:01.000Z | """
Driver for robot Robik from cortexpilot.com
"""
import ctypes
import struct
import math
from datetime import timedelta
from osgar.node import Node
from osgar.bus import BusShutdownException
from osgar.lib import quaternion
# CPR = 9958 (ticks per revolution)
# wheel diameter D = 395 mm
# 1 Rev = 1241 mm
ENC_S... | 42.450172 | 138 | 0.548612 |
import ctypes
import struct
import math
from datetime import timedelta
from osgar.node import Node
from osgar.bus import BusShutdownException
from osgar.lib import quaternion
ENC_SCALE = 1.241/9958
WHEEL_DISTANCE = 0.88
RAMP_STEP = 0.1
def sint32_diff(a, b):
return ctypes.c_int32(a - b).value
class C... | true | true |
f722cf13a8e1c7f120022a0b0b8571ad1ca0538a | 2,274 | py | Python | Python/py_bites/bite_26.py | J0shu4B0y/Practice | ea6af3773520f12afcf72f25952a80614d0c13ef | [
"MIT"
] | 1 | 2021-07-18T08:40:05.000Z | 2021-07-18T08:40:05.000Z | Python/py_bites/bite_26.py | J0shu4B0y/Practice | ea6af3773520f12afcf72f25952a80614d0c13ef | [
"MIT"
] | 3 | 2020-02-21T13:43:44.000Z | 2020-02-21T13:54:57.000Z | Python/py_bites/bite_26.py | J0shu4B0y/Practice-Python | ea6af3773520f12afcf72f25952a80614d0c13ef | [
"MIT"
] | 2 | 2019-07-19T10:09:08.000Z | 2020-09-20T08:07:36.000Z | # A dictionary comprehension is like a list comprehension, but it constructs
# a dict instead of a list. They are convenient to quickly operate on each
# (key, value) pair of a dict. And often in one line of code, maybe two after
# checking PEP8 😉
#
# We think they are elegant, that's why we want you to know about the... | 33.441176 | 79 | 0.643799 |
#
# In this Bite you are given a dict and a set. Write a dictionary comprehension
# that filters out the items in the set and returns the resulting dict, so if
# your dict is {1: 'bob', 2: 'julian', 3: 'tim'} and your set is {2, 3}, the
# resulting dict would be {1: 'bob'}.
#
# Check out the tests for more detail... | true | true |
f722cf2f9b737830daa3176c5c1a1ee9bdfcc8ce | 654 | py | Python | UVa/Competitive_Programming_Exercises/06-String_Processing/01-Ad_Hoc_String_Processing_Problems-Part_1/01-Cipher_Encode_Encrypt_Decode_Decrypt-Easier/11220.py | TISparta/competitive-programming-solutions | 31987d4e67bb874bf15653565c6418b5605a20a8 | [
"MIT"
] | 1 | 2018-01-30T13:21:30.000Z | 2018-01-30T13:21:30.000Z | UVa/Competitive_Programming_Exercises/06-String_Processing/01-Ad_Hoc_String_Processing_Problems-Part_1/01-Cipher_Encode_Encrypt_Decode_Decrypt-Easier/11220.py | TISparta/competitive-programming-solutions | 31987d4e67bb874bf15653565c6418b5605a20a8 | [
"MIT"
] | null | null | null | UVa/Competitive_Programming_Exercises/06-String_Processing/01-Ad_Hoc_String_Processing_Problems-Part_1/01-Cipher_Encode_Encrypt_Decode_Decrypt-Easier/11220.py | TISparta/competitive-programming-solutions | 31987d4e67bb874bf15653565c6418b5605a20a8 | [
"MIT"
] | 1 | 2018-08-29T13:26:50.000Z | 2018-08-29T13:26:50.000Z | def solution():
first = True
for tc in range(1, 1 + int( input() ) ):
if not first:
print('')
else:
input()
first = False
print('Case #%d:' %(tc))
while True:
try:
v = list( input().strip().split() )
if l... | 24.222222 | 51 | 0.33945 | def solution():
first = True
for tc in range(1, 1 + int( input() ) ):
if not first:
print('')
else:
input()
first = False
print('Case #%d:' %(tc))
while True:
try:
v = list( input().strip().split() )
if l... | true | true |
f722d228b7d6bc6a016ef16a30d17f3671381777 | 24,105 | py | Python | CyberTron5000/utils/lists.py | niztg/CyberTron5000 | 6b93305ef26e022063bffa8620b53076ba5948f7 | [
"MIT"
] | 20 | 2020-06-20T20:26:33.000Z | 2021-01-12T20:47:52.000Z | CyberTron5000/utils/lists.py | niztg/CyberTron5000 | 6b93305ef26e022063bffa8620b53076ba5948f7 | [
"MIT"
] | 1,005 | 2020-07-09T18:27:17.000Z | 2020-07-30T20:41:33.000Z | CyberTron5000/utils/lists.py | niztg/CyberTron5000 | 6b93305ef26e022063bffa8620b53076ba5948f7 | [
"MIT"
] | 7 | 2020-07-09T18:23:24.000Z | 2020-11-21T20:47:03.000Z | """
For JSON lists.
"""
# I need to use yaml for all of this
# excuse me
from string import ascii_uppercase
import discord
STAT_NAMES = {
"speed": "SPEED",
"attack": "ATTACK",
"sp_atk": "SPECIAL ATTACK",
"sp_def": "SPECIAL DEFENSE",
"defense": "DEFENSE",
"hp": "HP",
"total": "TOTAL"
}
... | 46.624758 | 287 | 0.642024 |
from string import ascii_uppercase
import discord
STAT_NAMES = {
"speed": "SPEED",
"attack": "ATTACK",
"sp_atk": "SPECIAL ATTACK",
"sp_def": "SPECIAL DEFENSE",
"defense": "DEFENSE",
"hp": "HP",
"total": "TOTAL"
}
ALPHABET_NUMBER = {letter: number for (letter, number) in zip(ascii_uppe... | true | true |
f722d23bab0f457ad593aee01f86710874f7cd98 | 2,318 | py | Python | python/oxford_asl/hadamard_decode.py | ibme-qubic/oxford_asl | 1b7e9e8f3e8e82b3eb9fa98b232ef93ea4e2348d | [
"Apache-2.0"
] | 6 | 2017-06-27T18:59:59.000Z | 2019-12-30T08:27:47.000Z | python/oxford_asl/hadamard_decode.py | ibme-qubic/oxford_asl | 1b7e9e8f3e8e82b3eb9fa98b232ef93ea4e2348d | [
"Apache-2.0"
] | 14 | 2017-08-22T12:09:11.000Z | 2020-12-16T22:32:07.000Z | python/oxford_asl/hadamard_decode.py | ibme-qubic/oxford_asl | 1b7e9e8f3e8e82b3eb9fa98b232ef93ea4e2348d | [
"Apache-2.0"
] | 6 | 2018-05-03T14:44:54.000Z | 2020-08-26T10:31:22.000Z | #!/usr/bin/env python
"""
Does naive decoding of Hadamard time-encoded data
Assumes that the Hadamard blocks are in adjacent volumes in the data
and simply decodes each block, outputting the same order
"""
import sys
import argparse
from fsl.data.image import Image
import numpy as np
import scipy.linalg
class Argum... | 36.21875 | 136 | 0.680328 |
import sys
import argparse
from fsl.data.image import Image
import numpy as np
import scipy.linalg
class ArgumentParser(argparse.ArgumentParser):
def __init__(self, **kwargs):
argparse.ArgumentParser.__init__(self, prog="oxford_asl_hadamard_decode", add_help=False, **kwargs)
self.add_argument("-... | true | true |
f722d435b7065b9e0bf3ff9e8d71f8097d38b5b2 | 299 | py | Python | examples_old/case17_jinja2/jinja2_vlans.py | josephwhite13/netmiko | c08c5ebb3484383f034e22b9576f88be07525f72 | [
"MIT"
] | 2,833 | 2015-01-04T20:04:10.000Z | 2022-03-31T13:03:17.000Z | examples_old/case17_jinja2/jinja2_vlans.py | josephwhite13/netmiko | c08c5ebb3484383f034e22b9576f88be07525f72 | [
"MIT"
] | 2,137 | 2015-01-28T17:33:41.000Z | 2022-03-31T18:41:21.000Z | examples_old/case17_jinja2/jinja2_vlans.py | georgesnow/netmiko | 185f51ca5c24ea2977d6ca31db1ae263aa72cc12 | [
"MIT"
] | 1,367 | 2015-01-04T20:04:10.000Z | 2022-03-31T19:13:28.000Z | #!/usr/bin/env python
from __future__ import print_function, unicode_literals
import jinja2
template_vars = {"vlan_id": 400, "vlan_name": "red400"}
vlan_template = """
vlan {{ vlan_id }}
name {{ vlan_name }}
"""
template = jinja2.Template(vlan_template)
print(template.render(template_vars))
| 19.933333 | 55 | 0.732441 |
from __future__ import print_function, unicode_literals
import jinja2
template_vars = {"vlan_id": 400, "vlan_name": "red400"}
vlan_template = """
vlan {{ vlan_id }}
name {{ vlan_name }}
"""
template = jinja2.Template(vlan_template)
print(template.render(template_vars))
| true | true |
f722d560e21b8fe61a176e40ec865d31c15c9b16 | 1,771 | py | Python | mars/tensor/arithmetic/fix.py | wjsi/mars | a69fb19edfe748d4393b90ff2c4941a76c084596 | [
"Apache-2.0"
] | 1 | 2022-02-02T03:03:48.000Z | 2022-02-02T03:03:48.000Z | mars/tensor/arithmetic/fix.py | wjsi/mars | a69fb19edfe748d4393b90ff2c4941a76c084596 | [
"Apache-2.0"
] | null | null | null | mars/tensor/arithmetic/fix.py | wjsi/mars | a69fb19edfe748d4393b90ff2c4941a76c084596 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 1999-2021 Alibaba Group Holding 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-... | 25.3 | 74 | 0.659514 |
import numpy as np
from ... import opcodes as OperandDef
from ..utils import infer_dtype
from .core import TensorUnaryOp
from .utils import arithmetic_operand
@arithmetic_operand(sparse_mode="unary")
class TensorFix(TensorUnaryOp):
_op_type_ = OperandDef.FIX
_func_name = "fix"
@infer_dtype(... | true | true |
f722d5dae4dfff62be13ac94c398cfdaef8e71f7 | 1,158 | py | Python | Chapter02/1194029 Nur Ikhsani Suwandy Futri 3a D4 TI studi_kasus/Event.py | nurikhsanisf/Python-Pararel_SISTER | b8d424cc12775c101222cdd332a497066a56dbbb | [
"MIT"
] | null | null | null | Chapter02/1194029 Nur Ikhsani Suwandy Futri 3a D4 TI studi_kasus/Event.py | nurikhsanisf/Python-Pararel_SISTER | b8d424cc12775c101222cdd332a497066a56dbbb | [
"MIT"
] | null | null | null | Chapter02/1194029 Nur Ikhsani Suwandy Futri 3a D4 TI studi_kasus/Event.py | nurikhsanisf/Python-Pararel_SISTER | b8d424cc12775c101222cdd332a497066a56dbbb | [
"MIT"
] | null | null | null | import logging
import threading
import time
import random
LOG_FORMAT = '%(asctime)s %(threadName)-17s %(levelname)-8s %(message)s'
logging.basicConfig(level=logging.INFO, format=LOG_FORMAT)
items = []
event = threading.Event()
class Pasien(threading.Thread):
def __init__(self, *args, **kwargs):
super().... | 24.125 | 76 | 0.560449 | import logging
import threading
import time
import random
LOG_FORMAT = '%(asctime)s %(threadName)-17s %(levelname)-8s %(message)s'
logging.basicConfig(level=logging.INFO, format=LOG_FORMAT)
items = []
event = threading.Event()
class Pasien(threading.Thread):
def __init__(self, *args, **kwargs):
super().... | true | true |
f722d62715166543e56dacac4436571f8c2ee94a | 49 | py | Python | smartlight_datastore/config.py | ande7590/rpi-smart-lights | 599cefb1f3aa63d85b33ab3f8a379faba4eb178c | [
"MIT"
] | null | null | null | smartlight_datastore/config.py | ande7590/rpi-smart-lights | 599cefb1f3aa63d85b33ab3f8a379faba4eb178c | [
"MIT"
] | null | null | null | smartlight_datastore/config.py | ande7590/rpi-smart-lights | 599cefb1f3aa63d85b33ab3f8a379faba4eb178c | [
"MIT"
] | null | null | null | DB_CONN_STR = 'sqlite:///event_repository.sqlite' | 49 | 49 | 0.795918 | DB_CONN_STR = 'sqlite:///event_repository.sqlite' | true | true |
f722d630618d00bd8ba8c171b7e64d05ff0083f7 | 1,884 | py | Python | testproject/shop/models.py | excitedleigh/lorikeet | fe99cf4557736891f2a0e951f0f748074d5e02d4 | [
"MIT"
] | 6 | 2020-02-15T19:22:30.000Z | 2020-12-27T10:58:58.000Z | testproject/shop/models.py | excitedleigh/lorikeet | fe99cf4557736891f2a0e951f0f748074d5e02d4 | [
"MIT"
] | 79 | 2019-12-29T22:13:51.000Z | 2022-03-30T23:12:37.000Z | testproject/shop/models.py | excitedleigh/lorikeet | fe99cf4557736891f2a0e951f0f748074d5e02d4 | [
"MIT"
] | 2 | 2019-12-29T22:06:19.000Z | 2020-08-27T20:30:47.000Z | from decimal import ROUND_DOWN, Decimal
from django.db import models
from lorikeet.exceptions import PaymentError
from lorikeet.models import (
Adjustment,
DeliveryAddress,
LineItem,
Payment,
PaymentMethod,
)
AUSTRALIAN_STATES = (
("NSW", "New South Wales"),
("VIC", "Victoria"),
("QLD"... | 28.119403 | 69 | 0.704352 | from decimal import ROUND_DOWN, Decimal
from django.db import models
from lorikeet.exceptions import PaymentError
from lorikeet.models import (
Adjustment,
DeliveryAddress,
LineItem,
Payment,
PaymentMethod,
)
AUSTRALIAN_STATES = (
("NSW", "New South Wales"),
("VIC", "Victoria"),
("QLD"... | true | true |
f722d6896401e6d535ed8442e5cd591255e59e26 | 1,640 | py | Python | Semester 6/MA 374 (Financial Engg. Lab)/Lab 1/180123062_ABSatyaprakash_q1 1.py | Imperial-lord/IITG | df4233905d2954511d5b16666f0d44cc38b9df90 | [
"MIT"
] | 4 | 2021-03-02T03:58:55.000Z | 2022-03-28T13:38:05.000Z | Semester 6/MA 374 (Financial Engg. Lab)/Lab 1/180123062_ABSatyaprakash_q1 1.py | Imperial-lord/IITG | df4233905d2954511d5b16666f0d44cc38b9df90 | [
"MIT"
] | null | null | null | Semester 6/MA 374 (Financial Engg. Lab)/Lab 1/180123062_ABSatyaprakash_q1 1.py | Imperial-lord/IITG | df4233905d2954511d5b16666f0d44cc38b9df90 | [
"MIT"
] | 4 | 2021-02-04T17:44:23.000Z | 2022-03-28T13:38:09.000Z | # Q.1 Run your program for M = 1, 5, 10, 20, 50, 100, 200, 400
# to get the initial option prices and tabulate them
# Pandas : pip install pandas
# Matplotlib: pip install matplotlib
# Numpy: pip install numpy
# Ipython: pip install ipython
import math
import pandas as pd
from IPython.display import display
# F... | 26.451613 | 102 | 0.60061 |
import math
import pandas as pd
from IPython.display import display
def getOptionPrice(M, u, d, p):
callList = [0]*(M+1)
putList = [0]*(M+1)
for i in range(M+1):
callList[i] = max(S0*(u**i)*(d**(M-i)) - K, 0)
putList[i] = max(0, K - S0*(u**i)*(d**(M-i)))
for i in... | true | true |
f722d729adacfea090edf12cc79bafd409f50426 | 204 | py | Python | google_auth/users/tests/test_models.py | data-leon/django-allauth-google-demo | e41de0128217d06853082bbccc23a46529bc4824 | [
"MIT"
] | 1 | 2021-11-18T18:43:05.000Z | 2021-11-18T18:43:05.000Z | google_auth/users/tests/test_models.py | data-leon/django-allauth-google-demo | e41de0128217d06853082bbccc23a46529bc4824 | [
"MIT"
] | null | null | null | google_auth/users/tests/test_models.py | data-leon/django-allauth-google-demo | e41de0128217d06853082bbccc23a46529bc4824 | [
"MIT"
] | null | null | null | import pytest
from google_auth.users.models import User
pytestmark = pytest.mark.django_db
def test_user_get_absolute_url(user: User):
assert user.get_absolute_url() == f"/users/{user.username}/"
| 20.4 | 64 | 0.77451 | import pytest
from google_auth.users.models import User
pytestmark = pytest.mark.django_db
def test_user_get_absolute_url(user: User):
assert user.get_absolute_url() == f"/users/{user.username}/"
| true | true |
f722d732521d717904d23e60794bd5ed17668867 | 3,488 | py | Python | projects/anosql/test/python/conftest.py | arrdem/source | df9aae1253ed415ade3a2b59e8a0996ff659543d | [
"MIT"
] | 4 | 2021-08-17T15:47:38.000Z | 2021-10-06T01:59:32.000Z | projects/anosql/test/python/conftest.py | arrdem/source | df9aae1253ed415ade3a2b59e8a0996ff659543d | [
"MIT"
] | 8 | 2021-08-14T17:47:08.000Z | 2021-09-20T20:22:47.000Z | projects/anosql/test/python/conftest.py | arrdem/source | df9aae1253ed415ade3a2b59e8a0996ff659543d | [
"MIT"
] | 1 | 2021-10-09T21:24:35.000Z | 2021-10-09T21:24:35.000Z | import csv
import os
import sqlite3
import pytest
BLOGDB_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "blogdb")
USERS_DATA_PATH = os.path.join(BLOGDB_PATH, "data", "users_data.csv")
BLOGS_DATA_PATH = os.path.join(BLOGDB_PATH, "data", "blogs_data.csv")
def populate_sqlite3_db(db_path):
conn =... | 28.357724 | 87 | 0.497133 | import csv
import os
import sqlite3
import pytest
BLOGDB_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "blogdb")
USERS_DATA_PATH = os.path.join(BLOGDB_PATH, "data", "users_data.csv")
BLOGS_DATA_PATH = os.path.join(BLOGDB_PATH, "data", "blogs_data.csv")
def populate_sqlite3_db(db_path):
conn =... | true | true |
f722d79501f5788bfa9c7c0add43c4a9b6f1df3d | 9,472 | py | Python | wam/logger.py | MikeDT/bdm-whack-a-mole | 33b52008b2fae231b604c0af959df57e25dee61f | [
"MIT"
] | null | null | null | wam/logger.py | MikeDT/bdm-whack-a-mole | 33b52008b2fae231b604c0af959df57e25dee61f | [
"MIT"
] | null | null | null | wam/logger.py | MikeDT/bdm-whack-a-mole | 33b52008b2fae231b604c0af959df57e25dee61f | [
"MIT"
] | 1 | 2021-09-26T14:12:20.000Z | 2021-09-26T14:12:20.000Z | # -*- coding: utf-8 -*-
"""
logger module
============
This module contains the WamLogger class for the pygame Whack a Mole game
Attributes:
na
Todo:
* sort docstrings (e.g. class)
Related projects:
Adapted from initial toy project https://github.com/sonlexqt/whack-a-mole
which is under MIT license
... | 27.941003 | 92 | 0.50834 |
import logging
from time import time
import pygame
import csv
class WamLogger:
def __init__(self, usr_timestamp=False,
log_file_root='../bdm-whack-a-mole/logs/'):
if usr_timestamp is False:
self.usr_timestamp = str(time())
else:
self.usr_timestamp = usr_t... | true | true |
f722d8e0a9abffec1f363842baede8d6a727f7b7 | 608 | py | Python | src/example-codes/kick-bot-example-01.py | xChivalrouSx/discord-kick-bot | 5f72cd810fdd6b31fe3cffec99bfd992394804ac | [
"MIT"
] | 2 | 2022-01-20T14:47:57.000Z | 2022-01-22T11:24:47.000Z | src/example-codes/kick-bot-example-01.py | xChivalrouSx/discord-kick-bot | 5f72cd810fdd6b31fe3cffec99bfd992394804ac | [
"MIT"
] | null | null | null | src/example-codes/kick-bot-example-01.py | xChivalrouSx/discord-kick-bot | 5f72cd810fdd6b31fe3cffec99bfd992394804ac | [
"MIT"
] | 1 | 2022-01-20T14:48:02.000Z | 2022-01-20T14:48:02.000Z | import os
import random
from discord.ext import commands
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
bot = commands.Bot(command_prefix='.')
@bot.command(name='99', help='Responds with a random quote from Brooklyn 99')
async def nine_nine(ctx):
brooklyn_99_quotes = [
'... | 22.518519 | 77 | 0.651316 | import os
import random
from discord.ext import commands
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
bot = commands.Bot(command_prefix='.')
@bot.command(name='99', help='Responds with a random quote from Brooklyn 99')
async def nine_nine(ctx):
brooklyn_99_quotes = [
'... | true | true |
f722d8fc8584b5895e0f0fb0d406828a771457b0 | 42,655 | py | Python | quark/ipam.py | insequent/quark | 0ce9e49c6cbef4e6a910066a0617c6f997626928 | [
"Apache-2.0"
] | null | null | null | quark/ipam.py | insequent/quark | 0ce9e49c6cbef4e6a910066a0617c6f997626928 | [
"Apache-2.0"
] | null | null | null | quark/ipam.py | insequent/quark | 0ce9e49c6cbef4e6a910066a0617c6f997626928 | [
"Apache-2.0"
] | null | null | null | # Copyright 2013 Openstack Foundation
# 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 requ... | 42.740481 | 79 | 0.530559 |
import functools
import itertools
import random
import time
import uuid
import netaddr
from neutron.common import exceptions
from neutron.common import rpc as n_rpc
from oslo.config import cfg
from oslo.db import exception as db_exception
from oslo.utils import timeutils
from oslo_concurrency import lo... | true | true |
f722d9f8f126934689d84b4892161ba981c1213a | 631 | py | Python | cunyfirstapi/helper.py | ericshermancs/CunyFirstAPI | e6dc30cb01d575fe2fa67db611f84bede1b2c976 | [
"MIT"
] | 10 | 2019-01-14T12:07:55.000Z | 2019-12-03T13:39:01.000Z | cunyfirstapi/helper.py | ericshermancs/CunyFirstAPI | e6dc30cb01d575fe2fa67db611f84bede1b2c976 | [
"MIT"
] | 35 | 2019-01-13T21:48:39.000Z | 2019-04-22T22:32:13.000Z | cunyfirstapi/helper.py | ericshermancs/CunyFirstAPI | e6dc30cb01d575fe2fa67db611f84bede1b2c976 | [
"MIT"
] | 8 | 2019-01-13T20:08:50.000Z | 2021-02-25T03:50:03.000Z | ###***********************************###
'''
CUNYFirstAPI
File: helper.py
Core Maintainers: Ehud Adler, Akiva Sherman,
Yehuda Moskovits
Copyright: Copyright 2019, Ehud Adler
License: MIT
'''
###***********************************###
import datetime
def get_semester():
now = datetime.datetime.now()
today = (n... | 25.24 | 44 | 0.51664 | Spring Term'
elif (6, 15) <= today < (9, 15):
return f'{now.year} Summer Term'
else:
if now.month == 1:
return f'{now.year-1} Fall Term'
else:
return f'{now.year} Fall Term' | true | true |
f722da438f0cbb249d70631a10fd188b0e013e1d | 12,846 | py | Python | tests/test_multi_put.py | BBooijLiewes/django-binder | b5bf0aad14657fd57d575f9a0ef21468533f64a7 | [
"MIT"
] | null | null | null | tests/test_multi_put.py | BBooijLiewes/django-binder | b5bf0aad14657fd57d575f9a0ef21468533f64a7 | [
"MIT"
] | null | null | null | tests/test_multi_put.py | BBooijLiewes/django-binder | b5bf0aad14657fd57d575f9a0ef21468533f64a7 | [
"MIT"
] | null | null | null | import json
from django.test import TestCase, Client
from django.contrib.auth.models import User
from binder.json import jsonloads
from .testapp.models import Animal, Zoo, ZooEmployee, ContactPerson
from .compare import assert_json, MAYBE, ANY
class MultiPutTest(TestCase):
def setUp(self):
super().setUp()
u ... | 26.651452 | 131 | 0.64666 | import json
from django.test import TestCase, Client
from django.contrib.auth.models import User
from binder.json import jsonloads
from .testapp.models import Animal, Zoo, ZooEmployee, ContactPerson
from .compare import assert_json, MAYBE, ANY
class MultiPutTest(TestCase):
def setUp(self):
super().setUp()
u ... | true | true |
f722db006999ad8a5629b23732e08caa3e6e44b7 | 4,499 | py | Python | Stain_seperation/stain_Norm_Vahadane.py | Pathology-Consistent-Stain-Transfer/Unpaired-Stain-Transfer-using-Pathology-Consistent-Constrained-Generative-Adversarial-Networks | b57c56b314e65a0f31d9e44f57174108599c8b14 | [
"MIT"
] | 2 | 2021-11-10T12:28:37.000Z | 2021-11-15T10:12:31.000Z | Stain_seperation/stain_Norm_Vahadane.py | Pathology-Consistent-Stain-Transfer/Unpaired-Stain-Transfer-using-Pathology-Consistent-Constrained-Generative-Adversarial-Networks | b57c56b314e65a0f31d9e44f57174108599c8b14 | [
"MIT"
] | null | null | null | Stain_seperation/stain_Norm_Vahadane.py | Pathology-Consistent-Stain-Transfer/Unpaired-Stain-Transfer-using-Pathology-Consistent-Constrained-Generative-Adversarial-Networks | b57c56b314e65a0f31d9e44f57174108599c8b14 | [
"MIT"
] | 2 | 2021-11-10T12:28:42.000Z | 2021-11-10T12:38:45.000Z | """
Stain normalization inspired by method of:
A. Vahadane et al., ‘Structure-Preserving Color Normalization and Sparse Stain Separation for Histological Images’, IEEE Transactions on Medical Imaging, vol. 35, no. 8, pp. 1962–1971, Aug. 2016.
Uses the spams package:
http://spams-devel.gforge.inria.fr/index.html
Use... | 39.121739 | 195 | 0.61058 |
import spams
import numpy as np
import Stain_seperation.stain_utils as ut
def get_stain_matrix(I, threshold=0.8, lamda=0.1):
mask = ut.notwhite_mask(I, thresh=threshold).reshape((-1,))
OD = ut.RGB_to_OD(I).reshape((-1, 3))
OD = OD[mask]
dictionary = spams.trainDL(OD.T, K=2, lambda1=lamda, mode=2, mo... | true | true |
f722db16de4f68a88069a8853bd00208bf0c7609 | 8,257 | py | Python | example_zoo/tensorflow/models/mnist/official/mnist/mnist.py | Meghanath-Data/ml-on-gcp | bfd96dce610e26236c4448ba0d4eb430ca2817ff | [
"Apache-2.0"
] | 465 | 2017-08-28T13:21:25.000Z | 2022-03-31T03:35:30.000Z | example_zoo/tensorflow/models/mnist/official/mnist/mnist.py | Meghanath-Data/ml-on-gcp | bfd96dce610e26236c4448ba0d4eb430ca2817ff | [
"Apache-2.0"
] | 74 | 2017-09-08T23:05:01.000Z | 2022-03-12T00:54:37.000Z | example_zoo/tensorflow/models/mnist/official/mnist/mnist.py | Meghanath-Data/ml-on-gcp | bfd96dce610e26236c4448ba0d4eb430ca2817ff | [
"Apache-2.0"
] | 187 | 2017-08-28T13:21:28.000Z | 2022-02-22T01:47:28.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 appl... | 34.693277 | 116 | 0.696258 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl import app as absl_app
from absl import flags
flags.DEFINE_string(name="job-dir", default="/tmp", help="AI Platform Training passes this to the training script.")
import tensorflow as tf... | true | true |
f722db1ad969e16207fbc173be16db45732e51aa | 383 | py | Python | problems/0033/p33.py | xztor/EulerProject | 091e345336d0766505c88737adef82cc5ab4ac93 | [
"MIT"
] | null | null | null | problems/0033/p33.py | xztor/EulerProject | 091e345336d0766505c88737adef82cc5ab4ac93 | [
"MIT"
] | null | null | null | problems/0033/p33.py | xztor/EulerProject | 091e345336d0766505c88737adef82cc5ab4ac93 | [
"MIT"
] | null | null | null | import sys
sys.path.insert(0, '../common/')
import utils
def same():
for n in range(10,100):
for d in range(n+1, 100):
nd = str(n)
dd = str(d)
if nd[0] == dd[1] and int(nd[1]) * d == n * int(dd[0]):
yield n,d
if nd[1] == dd[0] and int(nd[0]) * d == n * int(dd[1]):
yield n,d
(n,d)=reduce(lambda... | 23.9375 | 58 | 0.519582 | import sys
sys.path.insert(0, '../common/')
import utils
def same():
for n in range(10,100):
for d in range(n+1, 100):
nd = str(n)
dd = str(d)
if nd[0] == dd[1] and int(nd[1]) * d == n * int(dd[0]):
yield n,d
if nd[1] == dd[0] and int(nd[0]) * d == n * int(dd[1]):
yield n,d
(n,d)=reduce(lambda... | false | true |
f722dca5b75dfc9a9c2c40ddd526b7c412549462 | 2,597 | py | Python | tmp.py | zdadadaz/jcc_dfdc | 672b61771e22b369c7950c89299b0a7a2f7586ad | [
"Apache-2.0"
] | 1 | 2021-01-31T04:39:11.000Z | 2021-01-31T04:39:11.000Z | tmp.py | zdadadaz/jcc_dfdc | 672b61771e22b369c7950c89299b0a7a2f7586ad | [
"Apache-2.0"
] | null | null | null | tmp.py | zdadadaz/jcc_dfdc | 672b61771e22b369c7950c89299b0a7a2f7586ad | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 12 19:28:12 2020
@author: zdadadaz
"""
import json
import pandas as pd
import numpy as np
import matplotlib.pylab as plt
# dir_json = './../fb_whole/metadata_21.json'
# train_list =[]
# with open(dir_json) as json_file:
# data = json.load(json... | 35.094595 | 87 | 0.638044 |
import json
import pandas as pd
import numpy as np
import matplotlib.pylab as plt
base = pd.read_csv('submission_base.csv')
mtcn = pd.read_csv('submission_mtcn.csv')
whole = pd.read_csv('metadata_small.csv')
sLength = len(base['label'])
base['wrong'] = pd.Series(np.random.randn(sLength), index=base.in... | true | true |
f722dca9b0422776482ea7f888de525b779028d1 | 19,420 | py | Python | data_analysis/calculate_field_data.py | antonvs88/crowddynamics-research | 61260aa26a6d5bc213252bf96eaa472a551918e3 | [
"MIT"
] | null | null | null | data_analysis/calculate_field_data.py | antonvs88/crowddynamics-research | 61260aa26a6d5bc213252bf96eaa472a551918e3 | [
"MIT"
] | null | null | null | data_analysis/calculate_field_data.py | antonvs88/crowddynamics-research | 61260aa26a6d5bc213252bf96eaa472a551918e3 | [
"MIT"
] | 1 | 2019-08-27T16:34:50.000Z | 2019-08-27T16:34:50.000Z | from scipy.spatial import Voronoi, voronoi_plot_2d
import h5py
import numpy as np
import matplotlib.pyplot as plt
import os
import sys
from shapely.geometry import Polygon, MultiLineString, Point
from shapely.ops import polygonize
from descartes import PolygonPatch
from voronoi_finite_polygons_2d import voronoi_finite... | 63.881579 | 126 | 0.612564 | from scipy.spatial import Voronoi, voronoi_plot_2d
import h5py
import numpy as np
import matplotlib.pyplot as plt
import os
import sys
from shapely.geometry import Polygon, MultiLineString, Point
from shapely.ops import polygonize
from descartes import PolygonPatch
from voronoi_finite_polygons_2d import voronoi_finite... | true | true |
f722dd0436ffb7377a886d3f98bee18ab155b9c8 | 1,933 | py | Python | beluga/numeric/compilation/component_compilation.py | doublefloyd/beluga | 740bda376634945ef51bf1cf946fcbe002e9bc7f | [
"MIT"
] | 20 | 2017-10-02T13:09:58.000Z | 2022-03-28T20:50:35.000Z | beluga/numeric/compilation/component_compilation.py | doublefloyd/beluga | 740bda376634945ef51bf1cf946fcbe002e9bc7f | [
"MIT"
] | 187 | 2018-02-04T20:35:03.000Z | 2021-01-27T15:04:18.000Z | beluga/numeric/compilation/component_compilation.py | doublefloyd/beluga | 740bda376634945ef51bf1cf946fcbe002e9bc7f | [
"MIT"
] | 12 | 2018-01-19T04:00:09.000Z | 2022-03-28T16:44:17.000Z | import numpy as np
from scipy.integrate import simps
from beluga.numeric.compilation import jit_lambdify, jit_compile_func
from beluga.symbolic.data_classes.components_structures import CostStruct
def compile_control(control_options, args, ham_func, lambdify_func=jit_lambdify):
num_options = len(control_options... | 32.216667 | 108 | 0.628557 | import numpy as np
from scipy.integrate import simps
from beluga.numeric.compilation import jit_lambdify, jit_compile_func
from beluga.symbolic.data_classes.components_structures import CostStruct
def compile_control(control_options, args, ham_func, lambdify_func=jit_lambdify):
num_options = len(control_options... | true | true |
f722dd71125e52999eda3863c5f0bc63d59fab14 | 7,541 | py | Python | allennlp/data/iterators/bucket_iterator.py | sandeep82945/allennlp | d5c64b530b821c59079b72f12e82cb9ce86facf9 | [
"Apache-2.0"
] | null | null | null | allennlp/data/iterators/bucket_iterator.py | sandeep82945/allennlp | d5c64b530b821c59079b72f12e82cb9ce86facf9 | [
"Apache-2.0"
] | null | null | null | allennlp/data/iterators/bucket_iterator.py | sandeep82945/allennlp | d5c64b530b821c59079b72f12e82cb9ce86facf9 | [
"Apache-2.0"
] | null | null | null | import logging
import random
from collections import deque
from typing import List, Tuple, Iterable, cast, Dict, Deque
from overrides import overrides
from allennlp.common.checks import ConfigurationError
from allennlp.common.util import lazy_groups_of, add_noise_to_dict_values
from allennlp.data.dataset import Batch... | 52.006897 | 114 | 0.670203 | import logging
import random
from collections import deque
from typing import List, Tuple, Iterable, cast, Dict, Deque
from overrides import overrides
from allennlp.common.checks import ConfigurationError
from allennlp.common.util import lazy_groups_of, add_noise_to_dict_values
from allennlp.data.dataset import Batch... | true | true |
f722ddc0e88f53d99b4c5a095c72b24f73c7f856 | 1,854 | py | Python | provisioner/sources/test.py | srlehn/opennms-provisioner | aec001a24ed71ff54a9ff6d05c178c84d4d2c71d | [
"MIT"
] | 1 | 2019-04-23T11:57:11.000Z | 2019-04-23T11:57:11.000Z | provisioner/sources/test.py | srlehn/opennms-provisioner | aec001a24ed71ff54a9ff6d05c178c84d4d2c71d | [
"MIT"
] | 1 | 2019-04-23T14:01:39.000Z | 2019-04-23T14:01:39.000Z | provisioner/sources/test.py | srlehn/opennms-provisioner | aec001a24ed71ff54a9ff6d05c178c84d4d2c71d | [
"MIT"
] | 2 | 2018-11-17T16:10:59.000Z | 2019-04-23T11:57:49.000Z | """
opennms-provisioner test source module
This module is the provides test sources for opennms-provisioner.
:license: MIT, see LICENSE for more details
:copyright: (c) 2018 by Michael Batz, see AUTHORS for more details
"""
import provisioner.source
import provisioner.opennms
class DummySource(provisioner.source.Sou... | 29.903226 | 66 | 0.633225 | import provisioner.source
import provisioner.opennms
class DummySource(provisioner.source.Source):
def __init__(self, name, parameters):
provisioner.source.Source.__init__(self, name, parameters)
def get_nodes(self):
nodelist = []
cat1 = self.get_parameter("cat1", N... | true | true |
f722de16a1236eef65e4b072cfd145721bdf797a | 15,252 | py | Python | AI/node.py | mayfieldmobster/DECI | c2c9165aeec7344048dd9479049dc490033881d5 | [
"MIT"
] | 1 | 2021-12-19T01:09:12.000Z | 2021-12-19T01:09:12.000Z | AI/node.py | mayfieldmobster/DECI | c2c9165aeec7344048dd9479049dc490033881d5 | [
"MIT"
] | null | null | null | AI/node.py | mayfieldmobster/DECI | c2c9165aeec7344048dd9479049dc490033881d5 | [
"MIT"
] | null | null | null | """
node
"""
import socket
import random
import pickle
import time
import ast
import concurrent.futures
from ecdsa import SigningKey, VerifyingKey, SECP112r2
#recieve from nodes
def receive(local_ip):
"""
message is split into array the first value the type of message the second value is the message
"""
... | 32.109474 | 113 | 0.54819 |
import socket
import random
import pickle
import time
import ast
import concurrent.futures
from ecdsa import SigningKey, VerifyingKey, SECP112r2
def receive(local_ip):
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server.bind((loca... | true | true |
f722df9dfce13247463d0feb247befdc7e936950 | 688 | py | Python | constants/classes.py | zsxoff/neural-orthodontic-cephalometry | 0b683343bdfb36491aa880def5ff4c9de78030d9 | [
"MIT"
] | 4 | 2020-05-24T18:18:05.000Z | 2021-02-19T01:35:14.000Z | constants/classes.py | zsxoff/neural-orthodontic-cephalometry | 0b683343bdfb36491aa880def5ff4c9de78030d9 | [
"MIT"
] | 3 | 2021-01-02T18:32:52.000Z | 2021-09-25T13:25:11.000Z | constants/classes.py | zsxoff/neural-orthodontic-cephalometry | 0b683343bdfb36491aa880def5ff4c9de78030d9 | [
"MIT"
] | 1 | 2021-09-18T01:15:29.000Z | 2021-09-18T01:15:29.000Z | """List of classes in lexical and NPZ order."""
# ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
# ! PLEASE DO NOT MODIFY THIS LIST OF CLASSES !
# ! LIST MODIFICATION CAUSES GREAT F**K UP !
# ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
CLASSES = [
"A", # 0
"Ar", # 1
"B", # 2
"Ba", # 3
"C",... | 18.594595 | 47 | 0.305233 |
CLASSES = [
"A",
"Ar",
"B",
"Ba",
"C",
"DT pog",
"EN pn",
"Gn",
"Go",
"LL",
"Me",
"N",
"Or",
"Po",
"Pog",
"Pt",
"S",
"SNA",
"SNP pm",
"Se",
"Sn",
"UL",
"aii",
"ais",
... | true | true |
f722e16e7e62695ee78cb9df7316e785fa093630 | 6,285 | py | Python | remote/lib/instruments.py | dominoe/emumem | a1babfd93e533e20eb4561e2cc749cbb40d5d999 | [
"MIT"
] | null | null | null | remote/lib/instruments.py | dominoe/emumem | a1babfd93e533e20eb4561e2cc749cbb40d5d999 | [
"MIT"
] | null | null | null | remote/lib/instruments.py | dominoe/emumem | a1babfd93e533e20eb4561e2cc749cbb40d5d999 | [
"MIT"
] | null | null | null | ######################################################
### ULTIMA MODIFICACIÓN: 2019-06-27
######################################################
import visa, paramiko, numpy
from time import sleep
######################################################
class RASPBERRY_PI2_SSH:
hostname = None
p... | 33.078947 | 121 | 0.571519 | | false | true |
f722e281c5085cd6d3f518b1eadcf92e9e58e061 | 733 | py | Python | profiles_api/permissions.py | oscarperezt1991/profiles-rest-api | 3b222e1e3c3c404ad84386c4f2111edfc4a49247 | [
"MIT"
] | null | null | null | profiles_api/permissions.py | oscarperezt1991/profiles-rest-api | 3b222e1e3c3c404ad84386c4f2111edfc4a49247 | [
"MIT"
] | null | null | null | profiles_api/permissions.py | oscarperezt1991/profiles-rest-api | 3b222e1e3c3c404ad84386c4f2111edfc4a49247 | [
"MIT"
] | null | null | null | from rest_framework import permissions
class UpdateOwnProfile(permissions.BasePermission):
"""Allow user to edit their own profile"""
def has_object_permission(self, request, view, obj):
"""Check user is trying to edit their own profile"""
if request.method in permissions.SAFE_METHODS:
... | 31.869565 | 60 | 0.691678 | from rest_framework import permissions
class UpdateOwnProfile(permissions.BasePermission):
def has_object_permission(self, request, view, obj):
if request.method in permissions.SAFE_METHODS:
return True
return obj.id == request.user.id
class UpdateOwnStatus(permissions.BasePermissio... | true | true |
f722e3518ac0822ccb1a513b5b56bb885f11d5f4 | 90,504 | py | Python | bin/Python27/Lib/site-packages/scipy/linalg/tests/test_decomp.py | lefevre-fraser/openmeta-mms | 08f3115e76498df1f8d70641d71f5c52cab4ce5f | [
"MIT"
] | null | null | null | bin/Python27/Lib/site-packages/scipy/linalg/tests/test_decomp.py | lefevre-fraser/openmeta-mms | 08f3115e76498df1f8d70641d71f5c52cab4ce5f | [
"MIT"
] | null | null | null | bin/Python27/Lib/site-packages/scipy/linalg/tests/test_decomp.py | lefevre-fraser/openmeta-mms | 08f3115e76498df1f8d70641d71f5c52cab4ce5f | [
"MIT"
] | 1 | 2020-08-08T12:44:48.000Z | 2020-08-08T12:44:48.000Z | """ Test functions for linalg.decomp module
"""
from __future__ import division, print_function, absolute_import
__usage__ = """
Build linalg:
python setup_linalg.py build
Run tests if scipy is installed:
python -c 'import scipy;scipy.linalg.test()'
Run tests if linalg is not installed:
python tests/... | 37.899497 | 115 | 0.520132 | from __future__ import division, print_function, absolute_import
__usage__ = """
Build linalg:
python setup_linalg.py build
Run tests if scipy is installed:
python -c 'import scipy;scipy.linalg.test()'
Run tests if linalg is not installed:
python tests/test_decomp.py
"""
import numpy as np
from nump... | true | true |
f722e64671d91a1f0426d6380585220c6acfa0e5 | 326 | py | Python | tests/forms.py | tooreht/django-jsonsuit | 5b47c1f3ce55f0b60b6e3ae2568cc098feb1564f | [
"MIT"
] | 5 | 2017-06-02T16:26:16.000Z | 2018-12-28T14:55:59.000Z | tests/forms.py | tooreht/django-jsonsuit | 5b47c1f3ce55f0b60b6e3ae2568cc098feb1564f | [
"MIT"
] | 6 | 2017-07-08T18:19:54.000Z | 2022-03-23T06:15:05.000Z | tests/forms.py | tooreht/django-jsonsuit | 5b47c1f3ce55f0b60b6e3ae2568cc098feb1564f | [
"MIT"
] | 5 | 2017-12-19T17:31:08.000Z | 2021-04-19T11:14:16.000Z | # -*- coding: utf-8
from __future__ import unicode_literals, absolute_import
from django import forms
from jsonsuit.widgets import JSONSuit, ReadonlyJSONSuit
class TestForm(forms.Form):
stats = forms.CharField(widget=JSONSuit)
class ReadonlyTestForm(forms.Form):
stats = forms.CharField(widget=ReadonlyJSON... | 21.733333 | 56 | 0.788344 |
from __future__ import unicode_literals, absolute_import
from django import forms
from jsonsuit.widgets import JSONSuit, ReadonlyJSONSuit
class TestForm(forms.Form):
stats = forms.CharField(widget=JSONSuit)
class ReadonlyTestForm(forms.Form):
stats = forms.CharField(widget=ReadonlyJSONSuit)
| true | true |
f722e6787c4846eb96a6e33a04187732b2fa50a3 | 6,441 | py | Python | examples/python/native/inception.py | sdalton1/FlexFlow | a08386df098aaa23195ba15af2d0e1c88ecc399c | [
"Apache-2.0"
] | null | null | null | examples/python/native/inception.py | sdalton1/FlexFlow | a08386df098aaa23195ba15af2d0e1c88ecc399c | [
"Apache-2.0"
] | null | null | null | examples/python/native/inception.py | sdalton1/FlexFlow | a08386df098aaa23195ba15af2d0e1c88ecc399c | [
"Apache-2.0"
] | null | null | null | from flexflow.core import *
from flexflow.keras.datasets import cifar10
from accuracy import ModelAccuracy
from PIL import Image
def InceptionA(ffmodel, input, pool_features):
t1 = ffmodel.conv2d(input, 64, 1, 1, 1, 1, 0, 0)
t2 = ffmodel.conv2d(input, 48, 1, 1, 1, 1, 0, 0)
t2 = ffmodel.conv2d(t2, 64, 5, 5, 1, 1... | 37.447674 | 167 | 0.661854 | from flexflow.core import *
from flexflow.keras.datasets import cifar10
from accuracy import ModelAccuracy
from PIL import Image
def InceptionA(ffmodel, input, pool_features):
t1 = ffmodel.conv2d(input, 64, 1, 1, 1, 1, 0, 0)
t2 = ffmodel.conv2d(input, 48, 1, 1, 1, 1, 0, 0)
t2 = ffmodel.conv2d(t2, 64, 5, 5, 1, 1... | true | true |
f722e68100c41dd81d229f2886754f6a2f83dd54 | 353 | py | Python | src/utils.py | VVCepheiA/Prototypical-Networks-for-Few-shot-Learning-PyTorch | fe58b789f3511bfab6ae9ea0dd4b521aca777b52 | [
"MIT"
] | null | null | null | src/utils.py | VVCepheiA/Prototypical-Networks-for-Few-shot-Learning-PyTorch | fe58b789f3511bfab6ae9ea0dd4b521aca777b52 | [
"MIT"
] | null | null | null | src/utils.py | VVCepheiA/Prototypical-Networks-for-Few-shot-Learning-PyTorch | fe58b789f3511bfab6ae9ea0dd4b521aca777b52 | [
"MIT"
] | null | null | null | """
Utility for model
"""
import pathlib
import os
import json
def save_list_to_file(path, thelist):
with open(path, 'w') as f:
for item in thelist:
f.write("%s\n" % item)
def mkdir_p(full_dir):
"""Simulate mkdir -p"""
if not os.path.exists(full_dir):
pathlib.Path(full_dir).mk... | 19.611111 | 65 | 0.637394 | import pathlib
import os
import json
def save_list_to_file(path, thelist):
with open(path, 'w') as f:
for item in thelist:
f.write("%s\n" % item)
def mkdir_p(full_dir):
if not os.path.exists(full_dir):
pathlib.Path(full_dir).mkdir(parents=True, exist_ok=True)
| true | true |
f722e7a2cae5cb0bbfe35a1951adbcd802f8d3ca | 1,640 | py | Python | samples/generated_samples/dialogflow_v2_generated_conversation_datasets_delete_conversation_dataset_sync.py | rkdfc93/python-dialogflow | a59cff0298ef18674c0b4133ef0a6ab82e288920 | [
"Apache-2.0"
] | 171 | 2018-09-19T21:16:18.000Z | 2020-12-07T17:41:10.000Z | samples/generated_samples/dialogflow_v2_generated_conversation_datasets_delete_conversation_dataset_sync.py | rkdfc93/python-dialogflow | a59cff0298ef18674c0b4133ef0a6ab82e288920 | [
"Apache-2.0"
] | 150 | 2018-09-25T14:04:28.000Z | 2020-12-09T21:45:43.000Z | samples/generated_samples/dialogflow_v2_generated_conversation_datasets_delete_conversation_dataset_sync.py | rkdfc93/python-dialogflow | a59cff0298ef18674c0b4133ef0a6ab82e288920 | [
"Apache-2.0"
] | 75 | 2018-09-22T14:12:18.000Z | 2020-12-08T07:12:12.000Z | # -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 32.8 | 85 | 0.769512 |
from google.cloud import dialogflow_v2
def sample_delete_conversation_dataset():
client = dialogflow_v2.ConversationDatasetsClient()
request = dialogflow_v2.DeleteConversationDatasetRequest(
name="name_value",
)
operation = client.delete_conversation_... | true | true |
f722e8300d29dab1dd6dbd5d3e148f7b855d9ce0 | 12,339 | py | Python | wisdem/drivetrainse/rna.py | ptrbortolotti/WISDEM | 2b7e44716d022e2f62140073dd078c5deeb8bf0a | [
"Apache-2.0"
] | 1 | 2020-06-02T14:58:28.000Z | 2020-06-02T14:58:28.000Z | wisdem/drivetrainse/rna.py | ptrbortolotti/WISDEM | 2b7e44716d022e2f62140073dd078c5deeb8bf0a | [
"Apache-2.0"
] | null | null | null | wisdem/drivetrainse/rna.py | ptrbortolotti/WISDEM | 2b7e44716d022e2f62140073dd078c5deeb8bf0a | [
"Apache-2.0"
] | null | null | null | from __future__ import print_function
import numpy as np
from openmdao.api import ExplicitComponent, Group, IndepVarComp
from wisdem.commonse.utilities import hstack, vstack
from wisdem.commonse.csystem import DirectionVector
from wisdem.commonse import gravity
# This is an extremely simple RNA mass calculator that s... | 41.40604 | 153 | 0.57922 | from __future__ import print_function
import numpy as np
from openmdao.api import ExplicitComponent, Group, IndepVarComp
from wisdem.commonse.utilities import hstack, vstack
from wisdem.commonse.csystem import DirectionVector
from wisdem.commonse import gravity
class RNAMass(ExplicitComponent):
def setup(self)... | true | true |
f722e882215e54f911ad2db42fa10900a5abcc26 | 334 | py | Python | setup.py | zanardo/clog | 390e56dd8bab472532d5ff77d1dfb0acfdb72518 | [
"BSD-2-Clause"
] | null | null | null | setup.py | zanardo/clog | 390e56dd8bab472532d5ff77d1dfb0acfdb72518 | [
"BSD-2-Clause"
] | null | null | null | setup.py | zanardo/clog | 390e56dd8bab472532d5ff77d1dfb0acfdb72518 | [
"BSD-2-Clause"
] | null | null | null | from setuptools import setup
from clogd import __VERSION__
setup(
name='clog',
version=__VERSION__,
packages=['clogd'],
package_data={
'': ['static/*.*', 'views/*.*'],
},
install_requires=[
'zpgdb==0.4.2',
'Bottle==0.12.13',
'waitress==1.1.0',
'PyYAML==3.... | 18.555556 | 40 | 0.517964 | from setuptools import setup
from clogd import __VERSION__
setup(
name='clog',
version=__VERSION__,
packages=['clogd'],
package_data={
'': ['static/*.*', 'views/*.*'],
},
install_requires=[
'zpgdb==0.4.2',
'Bottle==0.12.13',
'waitress==1.1.0',
'PyYAML==3.... | true | true |
f722e9cc17f1f3bc8a478de8d0aeecf08798d105 | 572 | py | Python | sdk/python/pulumi_azure_native/notificationhubs/v20140901/__init__.py | polivbr/pulumi-azure-native | 09571f3bf6bdc4f3621aabefd1ba6c0d4ecfb0e7 | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/notificationhubs/v20140901/__init__.py | polivbr/pulumi-azure-native | 09571f3bf6bdc4f3621aabefd1ba6c0d4ecfb0e7 | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/notificationhubs/v20140901/__init__.py | polivbr/pulumi-azure-native | 09571f3bf6bdc4f3621aabefd1ba6c0d4ecfb0e7 | [
"Apache-2.0"
] | null | null | null | # 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! ***
from ... import _utilities
import typing
# Export this package's modules as members:
from ._enums import *
from .get_namespace import *
from .get_notif... | 31.777778 | 80 | 0.769231 |
from ... import _utilities
import typing
# Export this package's modules as members:
from ._enums import *
from .get_namespace import *
from .get_notification_hub import *
from .get_notification_hub_pns_credentials import *
from .list_namespace_keys import *
from .list_notification_hub_keys import *
from .namespace... | true | true |
f722ea35e9284460af48ce2dd1bc2535916a6cb0 | 3,704 | py | Python | kws_streaming/layers/stream_test.py | baajur/google-research | fd74519da7a0976b9b372f1ad8e091d1b3ee2212 | [
"Apache-2.0"
] | 3 | 2020-08-17T01:50:27.000Z | 2020-10-29T01:51:16.000Z | kws_streaming/layers/stream_test.py | JustinDurham/google-research | 9049acf9246c1b75170f0c6757e62a8f619a9db6 | [
"Apache-2.0"
] | 25 | 2020-07-25T08:53:09.000Z | 2022-03-12T00:43:02.000Z | kws_streaming/layers/stream_test.py | JustinDurham/google-research | 9049acf9246c1b75170f0c6757e62a8f619a9db6 | [
"Apache-2.0"
] | 2 | 2020-08-29T08:58:30.000Z | 2021-08-29T09:59:34.000Z | # coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | 33.981651 | 78 | 0.702214 |
import numpy as np
from kws_streaming.layers import stream
from kws_streaming.layers.compat import tf
from kws_streaming.layers.compat import tf1
from kws_streaming.layers.modes import Modes
from kws_streaming.models import utils
tf1.disable_eager_execution()
class Sum(tf.keras.layers.Layer):
def ... | true | true |
f722eb594e8e73ff236ef7f232c800cd1fe2c0bd | 2,865 | py | Python | www/page.py | linhyee/py-blog | c6ed92ebe93d6ec7cb7eff1e2690e97e5074b310 | [
"Apache-2.0"
] | null | null | null | www/page.py | linhyee/py-blog | c6ed92ebe93d6ec7cb7eff1e2690e97e5074b310 | [
"Apache-2.0"
] | null | null | null | www/page.py | linhyee/py-blog | c6ed92ebe93d6ec7cb7eff1e2690e97e5074b310 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""
JSON API definition.
"""
import math
from urllib import parse
class Page(object):
'''
Page object for display pages.
'''
def __init__(self, item_count, page_index=1,page_size=10):
'''
Init Pagination by item count, page_index and page_size
>>> p1 =... | 29.84375 | 117 | 0.543106 |
import math
from urllib import parse
class Page(object):
def __init__(self, item_count, page_index=1,page_size=10):
self.item_count = item_count
self.page_size = page_size
self.page_count = item_count // page_size + (1 if item_count % page_size > 0 else 0)
if (item_count == 0) o... | true | true |
f722eb5f39b52b59d529aed21853ccfff82baebb | 4,845 | py | Python | skbio/stats/distance/tests/test_anosim.py | michaelsilverstein/scikit-bio | 876efcf688a8f15e89bb70fa835a2f2a84b534c1 | [
"BSD-3-Clause"
] | 1 | 2020-03-26T00:23:16.000Z | 2020-03-26T00:23:16.000Z | skbio/stats/distance/tests/test_anosim.py | michaelsilverstein/scikit-bio | 876efcf688a8f15e89bb70fa835a2f2a84b534c1 | [
"BSD-3-Clause"
] | 1 | 2020-05-03T15:13:07.000Z | 2020-05-04T03:01:59.000Z | skbio/stats/distance/tests/test_anosim.py | michaelsilverstein/scikit-bio | 876efcf688a8f15e89bb70fa835a2f2a84b534c1 | [
"BSD-3-Clause"
] | 3 | 2020-02-22T12:31:59.000Z | 2020-09-20T19:21:44.000Z | # ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | 40.375 | 78 | 0.519711 |
import io
from functools import partial
from unittest import TestCase, main
import numpy as np
import pandas as pd
from pandas.util.testing import assert_series_equal
from skbio import DistanceMatrix
from skbio.stats.distance import anosim
class TestANOSIM(TestCase):
def setUp(self):
... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.