hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 958k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f70fe0e23d6d155fab7d9f814639526e81115ac3 | 7,086 | py | Python | modelio.py | Sentimentron/Dracula | 878f81c1c56a8ac12cf02d8f15bd93c544e29611 | [
"BSD-3-Clause"
] | 100 | 2016-04-25T17:48:50.000Z | 2021-02-11T04:11:54.000Z | modelio.py | Sentimentron/Dracula | 878f81c1c56a8ac12cf02d8f15bd93c544e29611 | [
"BSD-3-Clause"
] | 1 | 2017-02-25T21:26:40.000Z | 2017-02-27T18:04:51.000Z | modelio.py | Sentimentron/Dracula | 878f81c1c56a8ac12cf02d8f15bd93c544e29611 | [
"BSD-3-Clause"
] | 25 | 2016-07-27T23:11:44.000Z | 2020-01-21T01:55:36.000Z | """
Contains I/O functions
"""
import numpy
import theano
import logging
import sys
import tempfile
from collections import defaultdict
def build_character_dictionary(path, chars = {}):
with open(path, 'r') as fin:
lineno = 0
for line in fin:
lineno += 1
line = line.str... | 30.025424 | 105 | 0.507903 | """
Contains I/O functions
"""
import numpy
import theano
import logging
import sys
import tempfile
from collections import defaultdict
def build_character_dictionary(path, chars = {}):
with open(path, 'r') as fin:
lineno = 0
for line in fin:
lineno += 1
line = line.str... | false | true |
f70fe15e691eebb7b57139f7a24cfd21bcde7dd8 | 516 | py | Python | tests/r/test_biomass.py | hajime9652/observations | 2c8b1ac31025938cb17762e540f2f592e302d5de | [
"Apache-2.0"
] | 199 | 2017-07-24T01:34:27.000Z | 2022-01-29T00:50:55.000Z | tests/r/test_biomass.py | hajime9652/observations | 2c8b1ac31025938cb17762e540f2f592e302d5de | [
"Apache-2.0"
] | 46 | 2017-09-05T19:27:20.000Z | 2019-01-07T09:47:26.000Z | tests/r/test_biomass.py | hajime9652/observations | 2c8b1ac31025938cb17762e540f2f592e302d5de | [
"Apache-2.0"
] | 45 | 2017-07-26T00:10:44.000Z | 2022-03-16T20:44:59.000Z | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.biomass import biomass
def test_biomass():
"""Test module biomass.py by downloading
biomass.csv and testing shape of
extracted data has 15... | 21.5 | 44 | 0.753876 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.biomass import biomass
def test_biomass():
test_path = tempfile.mkdtemp()
x_train, metadata = biomass(test_path)
try:
assert x_train.sha... | true | true |
f70fe1b1005484c82991bd4f9673404e1958f315 | 1,236 | py | Python | examples/satellite-monitor-example.py | VLiu7/mobileinsight-core | a007f18230e09a5102d8035a929c284de0007938 | [
"Apache-2.0"
] | null | null | null | examples/satellite-monitor-example.py | VLiu7/mobileinsight-core | a007f18230e09a5102d8035a929c284de0007938 | [
"Apache-2.0"
] | null | null | null | examples/satellite-monitor-example.py | VLiu7/mobileinsight-core | a007f18230e09a5102d8035a929c284de0007938 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python
# Filename: monitor-example.py
import os
import sys
# Import MobileInsight modules
from mobile_insight.monitor import OnlineMonitor
from mobile_insight.analyzer import MsgLogger
if __name__ == "__main__":
if len(sys.argv) < 3:
print("Error: please specify physical port name and baudrate... | 32.526316 | 77 | 0.703074 | import os
import sys
from mobile_insight.monitor import OnlineMonitor
from mobile_insight.analyzer import MsgLogger
if __name__ == "__main__":
if len(sys.argv) < 3:
print("Error: please specify physical port name and baudrate.")
print((__file__, "SERIAL_PORT_NAME BAUNRATE"))
sys.exit(1)
... | true | true |
f70fe2034157cdb53e2d92c4774b7dc656a4f901 | 1,572 | bzl | Python | bazel/repos.bzl | 4rdparty/bazel-rules-libcurl | 6cc892f41b93d6f11eb15da981f7ef113baa9242 | [
"Apache-2.0"
] | null | null | null | bazel/repos.bzl | 4rdparty/bazel-rules-libcurl | 6cc892f41b93d6f11eb15da981f7ef113baa9242 | [
"Apache-2.0"
] | null | null | null | bazel/repos.bzl | 4rdparty/bazel-rules-libcurl | 6cc892f41b93d6f11eb15da981f7ef113baa9242 | [
"Apache-2.0"
] | null | null | null | """Adds repostories/archives."""
########################################################################
# DO NOT EDIT THIS FILE unless you are inside the
# https://github.com/3rdparty/bazel-rules-curl repository. If you
# encounter it anywhere else it is because it has been copied there in
# order to simplify adding... | 49.125 | 108 | 0.641221 |
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def repos(external = True, repo_mapping = {}):
if "rules_foreign_cc" not in native.existing_rules():
http_archive(
name = "rules_foreign_cc",
url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.5.1.ta... | true | true |
f70fe2f85bb409f227eb7abc62201aa095f369f2 | 863 | py | Python | setup.py | rlji/pinsage-pytorch | 2f275ca916ce21d0d2c0e022eec664cfd09d06cf | [
"Apache-2.0"
] | null | null | null | setup.py | rlji/pinsage-pytorch | 2f275ca916ce21d0d2c0e022eec664cfd09d06cf | [
"Apache-2.0"
] | null | null | null | setup.py | rlji/pinsage-pytorch | 2f275ca916ce21d0d2c0e022eec664cfd09d06cf | [
"Apache-2.0"
] | null | null | null | from __future__ import absolute_import, unicode_literals
from setuptools import setup, find_packages
VERSION = '0.1.0'
NAME = 'pinsage-pytorch'
DESCRIPTION = 'This is a PinSage pytorch library.'
URL = 'https://github.com/rlji/pinsage-pytorch'
EMAIL = 'me@example.com'
AUTHOR = 'rlji'
# What python versions are suppor... | 21.04878 | 60 | 0.701043 | from __future__ import absolute_import, unicode_literals
from setuptools import setup, find_packages
VERSION = '0.1.0'
NAME = 'pinsage-pytorch'
DESCRIPTION = 'This is a PinSage pytorch library.'
URL = 'https://github.com/rlji/pinsage-pytorch'
EMAIL = 'me@example.com'
AUTHOR = 'rlji'
REQUIRES_PYTHON = ">=3.6"
REQUIR... | true | true |
f70fe33ba97c88acc056615ad526b5b4f292cf98 | 9,924 | py | Python | packit/utils/repo.py | wickdChromosome/packit | ee31b8bbab579679f928a05db8125897bf2cad62 | [
"MIT"
] | null | null | null | packit/utils/repo.py | wickdChromosome/packit | ee31b8bbab579679f928a05db8125897bf2cad62 | [
"MIT"
] | null | null | null | packit/utils/repo.py | wickdChromosome/packit | ee31b8bbab579679f928a05db8125897bf2cad62 | [
"MIT"
] | null | null | null | # Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT
import logging
import re
import subprocess
import tempfile
from pathlib import Path
from typing import Tuple, Optional, Union, List
import git
import yaml
from ogr.parsing import RepoUrl, parse_git_repo
from packit.exceptions import Packi... | 31.305994 | 100 | 0.637948 |
import logging
import re
import subprocess
import tempfile
from pathlib import Path
from typing import Tuple, Optional, Union, List
import git
import yaml
from ogr.parsing import RepoUrl, parse_git_repo
from packit.exceptions import PackitException
logger = logging.getLogger(__name__)
class RepositoryCache:
... | true | true |
f70fe4521b71231fe23de14972ca86fefa3f06d0 | 709 | py | Python | returning.py | EnescanAkyuz/Python_Beginner | 84c32d39ec0727f39655bd88c57ccdeba1929532 | [
"MIT"
] | 4 | 2022-03-16T20:49:07.000Z | 2022-03-17T14:55:39.000Z | returning.py | EnescanAkyuz/Python_Beginner | 84c32d39ec0727f39655bd88c57ccdeba1929532 | [
"MIT"
] | null | null | null | returning.py | EnescanAkyuz/Python_Beginner | 84c32d39ec0727f39655bd88c57ccdeba1929532 | [
"MIT"
] | null | null | null | # def yetki_sorgula(page):
# def inner(role):
# if role == "admin" :
# print("{0} rolü {1} sayfasına ulaşabilir." .format(page, role))
# else:
# print("{0} rolü {1} sayfasına ulaşamaz." .format(page, role))
# return inner
# user1 = yetki_sorgula('arayüz')
# print(user1("... | 22.15625 | 77 | 0.533145 |
def islem(islem_adi):
def toplam(*args):
toplam = 0
for i in args:
toplam+=i
return toplam
def carpma(*args):
carpim = 1
for i in args:
carpim*=i
return carpim
if islem_adi == "toplam":
return toplam
else:
retur... | true | true |
f70fe4678dd09d611f534904898182e688634ba5 | 302 | py | Python | utils/all_utils.py | codersatyam/Perceptron | 8df4975405020c40aaec0179757f185d9ebbdff8 | [
"MIT"
] | null | null | null | utils/all_utils.py | codersatyam/Perceptron | 8df4975405020c40aaec0179757f185d9ebbdff8 | [
"MIT"
] | null | null | null | utils/all_utils.py | codersatyam/Perceptron | 8df4975405020c40aaec0179757f185d9ebbdff8 | [
"MIT"
] | null | null | null | import numpy as np
import pandas as pd
import os
import joblib
def preparedata(df):
x=df.drop("y",axis=1)
y=df["y"]
return x,y
def save_model(model,filename):
model_dir="model"
os.makedirs(model_dir,exist_ok=True)
filepath=os.path.join(model_dir,filename)
joblib.dump(model,filepath) | 20.133333 | 43 | 0.731788 | import numpy as np
import pandas as pd
import os
import joblib
def preparedata(df):
x=df.drop("y",axis=1)
y=df["y"]
return x,y
def save_model(model,filename):
model_dir="model"
os.makedirs(model_dir,exist_ok=True)
filepath=os.path.join(model_dir,filename)
joblib.dump(model,filepath) | true | true |
f70fe4c61d30fb5146ad4f79eb060ce3710ed779 | 1,178 | py | Python | examples/flask_app.py | cristianMeli/ubatch | fb3c6dccf0a9e25e25f5956e2e91ed70e9ea01ee | [
"Apache-2.0"
] | null | null | null | examples/flask_app.py | cristianMeli/ubatch | fb3c6dccf0a9e25e25f5956e2e91ed70e9ea01ee | [
"Apache-2.0"
] | null | null | null | examples/flask_app.py | cristianMeli/ubatch | fb3c6dccf0a9e25e25f5956e2e91ed70e9ea01ee | [
"Apache-2.0"
] | null | null | null | import random
import numpy as np
from typing import Dict, List
from flask import Flask
from flask_restx import Resource, Api
# from numpy import genfromtxt
from ubatch import ubatch_decorator
# from keras.models import load_model
from sklearn.datasets import fetch_20newsgroups
from sklearn.model_selection import t... | 23.098039 | 63 | 0.724109 | import random
import numpy as np
from typing import Dict, List
from flask import Flask
from flask_restx import Resource, Api
from ubatch import ubatch_decorator
from sklearn.datasets import fetch_20newsgroups
from sklearn.model_selection import train_test_split
from joblib import load
ngd = fetch_20newsgroups(s... | true | true |
f70fe5076940addc4ee562f410471d9471696de1 | 178 | py | Python | api/geocode/geocode_clear_cache.py | michael-pryor/GeoTweetSearch | cb6d0a7732a0584022f3720e3f696fb709dd45b5 | [
"Apache-2.0"
] | 1 | 2016-04-08T08:40:34.000Z | 2016-04-08T08:40:34.000Z | api/geocode/geocode_clear_cache.py | watfordxp/GeoTweetSearch | cb6d0a7732a0584022f3720e3f696fb709dd45b5 | [
"Apache-2.0"
] | null | null | null | api/geocode/geocode_clear_cache.py | watfordxp/GeoTweetSearch | cb6d0a7732a0584022f3720e3f696fb709dd45b5 | [
"Apache-2.0"
] | 2 | 2015-08-28T17:08:26.000Z | 2016-12-30T21:59:46.000Z | from api.caching.caching_shared import getDatabase
__author__ = 'Michael Pryor'
if __name__ == '__main__':
db = getDatabase()
db.place.remove()
db.geocode.remove() | 19.777778 | 50 | 0.707865 | from api.caching.caching_shared import getDatabase
__author__ = 'Michael Pryor'
if __name__ == '__main__':
db = getDatabase()
db.place.remove()
db.geocode.remove() | true | true |
f70fe77c34822d34426ad7b00c5ac679b16a18e2 | 2,689 | py | Python | tests/initialisations/test_bradleyfayyad1998.py | simonharris/pykmeans | 256e0c6c7284182aae9c10783cf50778af120514 | [
"MIT"
] | 1 | 2021-12-30T01:25:03.000Z | 2021-12-30T01:25:03.000Z | tests/initialisations/test_bradleyfayyad1998.py | simonharris/pycluster | 4d47eb12a2bbaf1b05d7ccfd0cfc9ccf78ddf86d | [
"MIT"
] | 3 | 2020-11-12T12:36:00.000Z | 2021-06-18T12:46:59.000Z | tests/initialisations/test_bradleyfayyad1998.py | simonharris/pycluster | 4d47eb12a2bbaf1b05d7ccfd0cfc9ccf78ddf86d | [
"MIT"
] | 1 | 2021-12-30T01:32:32.000Z | 2021-12-30T01:32:32.000Z | """
Test for Bradley & Fayyad 1998 initialisation algorithm
"""
import unittest
import numpy as np
from datasets import testloader
from initialisations import bradley as bfinit
import kmeans
# pylint: disable=R0201,W0212
class BfTestSuite(unittest.TestCase):
"""Test suite for B&F"""
def test_code_runs(se... | 29.877778 | 77 | 0.550019 |
import unittest
import numpy as np
from datasets import testloader
from initialisations import bradley as bfinit
import kmeans
class BfTestSuite(unittest.TestCase):
def test_code_runs(self):
dataset = testloader.load_iris()
centroids = bfinit.generate(dataset.data, 3)
self.assertEqua... | true | true |
f70fe7c61417fc91a75e5addb50e54ff45c99f58 | 10,424 | py | Python | ultracart/models/item_revguard.py | UltraCart/rest_api_v2_sdk_python | d734ea13fabc7a57872ff68bac06861edb8fd882 | [
"Apache-2.0"
] | 1 | 2018-03-15T16:56:23.000Z | 2018-03-15T16:56:23.000Z | ultracart/models/item_revguard.py | UltraCart/rest_api_v2_sdk_python | d734ea13fabc7a57872ff68bac06861edb8fd882 | [
"Apache-2.0"
] | null | null | null | ultracart/models/item_revguard.py | UltraCart/rest_api_v2_sdk_python | d734ea13fabc7a57872ff68bac06861edb8fd882 | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
"""
UltraCart Rest API V2
UltraCart REST API Version 2 # noqa: E501
OpenAPI spec version: 2.0.0
Contact: support@ultracart.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class ItemRevguard(object):
... | 36.447552 | 284 | 0.684574 |
import pprint
import re
import six
class ItemRevguard(object):
swagger_types = {
'revguard_canceled_csr_prompt_group': 'int',
'revguard_canceled_ivr_prompt_group': 'int',
'revguard_canceled_web_prompt_group': 'int',
'revguard_client_brand': 'int',
'revguard_csr_prompt... | true | true |
f70fe7e6b28f7caeabf6ae69e9564f3ee8605915 | 4,249 | py | Python | cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_shellutil_filesystem_oper.py | tkamata-test/ydk-py | b637e7853a8edbbd31fbc05afa3aa4110b31c5f9 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_shellutil_filesystem_oper.py | tkamata-test/ydk-py | b637e7853a8edbbd31fbc05afa3aa4110b31c5f9 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_shellutil_filesystem_oper.py | tkamata-test/ydk-py | b637e7853a8edbbd31fbc05afa3aa4110b31c5f9 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI... | 42.069307 | 183 | 0.534243 |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI... | true | true |
f70fe802d4a25dbb1db4f6162b56cf2586d5e4a1 | 22,011 | py | Python | codalab/worker/bundle_manager.py | ethancaballero/codalab-cli | b9dbe569ef12e22242bf3ad8c1961443f1b736f4 | [
"Apache-2.0"
] | null | null | null | codalab/worker/bundle_manager.py | ethancaballero/codalab-cli | b9dbe569ef12e22242bf3ad8c1961443f1b736f4 | [
"Apache-2.0"
] | null | null | null | codalab/worker/bundle_manager.py | ethancaballero/codalab-cli | b9dbe569ef12e22242bf3ad8c1961443f1b736f4 | [
"Apache-2.0"
] | null | null | null | import datetime
import logging
import os
import random
import re
import sys
import threading
import time
import traceback
from codalab.objects.permission import check_bundles_have_read_permission
from codalab.common import PermissionError
from codalab.lib import bundle_util, formatting, path_util
from codalabworker.fi... | 41.846008 | 140 | 0.621008 | import datetime
import logging
import os
import random
import re
import sys
import threading
import time
import traceback
from codalab.objects.permission import check_bundles_have_read_permission
from codalab.common import PermissionError
from codalab.lib import bundle_util, formatting, path_util
from codalabworker.fi... | true | true |
f70fe8cd388780589f821fdeb68e298ecd437657 | 2,365 | py | Python | azure-servicemanagement-legacy/setup.py | HydAu/AzureSDKForPython | 5cbe34e9e0b8ea1faacc9f205633ccc0b885c0f3 | [
"Apache-2.0"
] | null | null | null | azure-servicemanagement-legacy/setup.py | HydAu/AzureSDKForPython | 5cbe34e9e0b8ea1faacc9f205633ccc0b885c0f3 | [
"Apache-2.0"
] | null | null | null | azure-servicemanagement-legacy/setup.py | HydAu/AzureSDKForPython | 5cbe34e9e0b8ea1faacc9f205633ccc0b885c0f3 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. 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... | 34.275362 | 86 | 0.614799 |
from setuptools import setup
try:
import azure
try:
ver = azure.__version__
raise Exception(
'This package is incompatible with azure=={}. '.format(ver) +
'Uninstall it with "pip uninstall azure".'
)
except AttributeError:
pass
except ImportError:
... | true | true |
f70fe8e5aa412881ec6f288fac376593ff84e297 | 74 | py | Python | tests/unit/test_version.py | HoverHell/python-gron | 21977c36b5fafde6be351b5488673e97a7cb4aeb | [
"MIT"
] | 10 | 2018-06-23T11:32:14.000Z | 2021-12-15T09:45:53.000Z | tests/unit/test_version.py | HoverHell/python-gron | 21977c36b5fafde6be351b5488673e97a7cb4aeb | [
"MIT"
] | null | null | null | tests/unit/test_version.py | HoverHell/python-gron | 21977c36b5fafde6be351b5488673e97a7cb4aeb | [
"MIT"
] | 1 | 2021-04-06T10:56:37.000Z | 2021-04-06T10:56:37.000Z | import gron
def test_version():
assert hasattr(gron, '__VERSION__')
| 12.333333 | 39 | 0.716216 | import gron
def test_version():
assert hasattr(gron, '__VERSION__')
| true | true |
f70fe9543b5a7ed3a240ddb45d836fbfea8bd6f1 | 2,147 | py | Python | podaac/tests/oceancolor_test.py | wongvh07/SPAC4C | d8186bd4dab25472f3a45a7b0464aa95553c92f9 | [
"Apache-2.0"
] | null | null | null | podaac/tests/oceancolor_test.py | wongvh07/SPAC4C | d8186bd4dab25472f3a45a7b0464aa95553c92f9 | [
"Apache-2.0"
] | null | null | null | podaac/tests/oceancolor_test.py | wongvh07/SPAC4C | d8186bd4dab25472f3a45a7b0464aa95553c92f9 | [
"Apache-2.0"
] | null | null | null | # Copyright 2016-2019 California Institute of Technology.
#
# 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... | 37.666667 | 101 | 0.681416 |
from ..oceancolor import OceanColor
import os
from nose.tools import assert_raises
import unittest
class TestOceanColor(unittest.TestCase):
@classmethod
def setUp(self):
self.oceancolor = OceanColor()
def test_file_search(self):
data = self.oceancolor.file_search(sensor='octs', sdat... | true | true |
f70fe95b85d78d30cacb9a1b024c50b672432093 | 591 | py | Python | PokeType/compiler/data_types.py | Daggy1234/PokeType | a79c8115ca9bb13e24c4fd4db4931b3094a96549 | [
"MIT"
] | 2 | 2021-11-06T14:09:40.000Z | 2021-11-14T21:24:56.000Z | PokeType/compiler/data_types.py | Daggy1234/PokeType | a79c8115ca9bb13e24c4fd4db4931b3094a96549 | [
"MIT"
] | null | null | null | PokeType/compiler/data_types.py | Daggy1234/PokeType | a79c8115ca9bb13e24c4fd4db4931b3094a96549 | [
"MIT"
] | null | null | null | from rply import ParserGenerator
from poketype.ast import Number, Boolean, NegNumber
class DataTypes():
def __init__(self, pg: ParserGenerator) -> None:
@pg.production('expression : NUMBER')
def expression_number(p):
return Number(int(p[0].getstr()))
@pg.production('expression : BOOLEAN')
def expressio... | 24.625 | 51 | 0.681895 | from rply import ParserGenerator
from poketype.ast import Number, Boolean, NegNumber
class DataTypes():
def __init__(self, pg: ParserGenerator) -> None:
@pg.production('expression : NUMBER')
def expression_number(p):
return Number(int(p[0].getstr()))
@pg.production('expression : BOOLEAN')
def expressio... | true | true |
f70fe9c7b4c2d2219e6b95fb49dd28ca0b904f97 | 339 | py | Python | Python/python-tutorials/python-challenge/integrity.py | zhongyangynag/code-study | 5410929554107a384a09d899c6fa3d16ed383d2b | [
"MIT"
] | null | null | null | Python/python-tutorials/python-challenge/integrity.py | zhongyangynag/code-study | 5410929554107a384a09d899c6fa3d16ed383d2b | [
"MIT"
] | null | null | null | Python/python-tutorials/python-challenge/integrity.py | zhongyangynag/code-study | 5410929554107a384a09d899c6fa3d16ed383d2b | [
"MIT"
] | null | null | null | #!/usr/bin/env python
un='BZh91AY&SYA\xaf\x82\r\x00\x00\x01\x01\x80\x02\xc0\x02\x00 \x00!\x9ah3M\x07<]\xc9\x14\xe1BA\x06\xbe\x084'
pw='BZh91AY&SY\x94$|\x0e\x00\x00\x00\x81\x00\x03$ \x00!\x9ah3M\x13<]\xc9\x14\xe1BBP\x91\xf08'
import bz2
print bz2.BZ2Decompressor().decompress(un)
# huge
print bz2.BZ2Decompressor().decom... | 28.25 | 108 | 0.728614 |
un='BZh91AY&SYA\xaf\x82\r\x00\x00\x01\x01\x80\x02\xc0\x02\x00 \x00!\x9ah3M\x07<]\xc9\x14\xe1BA\x06\xbe\x084'
pw='BZh91AY&SY\x94$|\x0e\x00\x00\x00\x81\x00\x03$ \x00!\x9ah3M\x13<]\xc9\x14\xe1BBP\x91\xf08'
import bz2
print bz2.BZ2Decompressor().decompress(un)
print bz2.BZ2Decompressor().decompress(pw)
| false | true |
f70fea670ad876700ffca4a80a4ba82548c929e5 | 1,300 | py | Python | cinder/brick/initiator/executor.py | hopem/cinder | 7df656ff0be9fef34a4e19f7b83a0cae554db1e7 | [
"Apache-2.0"
] | null | null | null | cinder/brick/initiator/executor.py | hopem/cinder | 7df656ff0be9fef34a4e19f7b83a0cae554db1e7 | [
"Apache-2.0"
] | null | null | null | cinder/brick/initiator/executor.py | hopem/cinder | 7df656ff0be9fef34a4e19f7b83a0cae554db1e7 | [
"Apache-2.0"
] | null | null | null | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# (c) Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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.apa... | 35.135135 | 78 | 0.718462 |
from cinder.openstack.common import processutils as putils
class Executor(object):
def __init__(self, execute=putils.execute, root_helper="sudo",
*args, **kwargs):
self.set_execute(execute)
self.set_root_helper(root_helper)
def set_execute(self, execute):
self._exe... | true | true |
f70feab366fbb1f7eb3273b9e7e6a5b34188a5d9 | 8,461 | py | Python | doc/oldcode/swhlab/core/memtest.py | swharden/SWHLab | a86c3c65323cec809a4bd4f81919644927094bf5 | [
"MIT"
] | 15 | 2017-03-09T03:08:32.000Z | 2021-11-16T11:31:55.000Z | doc/oldcode/swhlab/core/memtest.py | swharden/SWHLab | a86c3c65323cec809a4bd4f81919644927094bf5 | [
"MIT"
] | 2 | 2016-12-06T16:27:54.000Z | 2017-11-04T23:48:49.000Z | doc/oldcode/swhlab/core/memtest.py | swharden/SWHLab | a86c3c65323cec809a4bd4f81919644927094bf5 | [
"MIT"
] | 9 | 2016-10-19T13:32:10.000Z | 2020-04-01T21:53:40.000Z | """
Membrane test routines for voltage clamp experiments.
creates abf.MTs[sweep]={} #with keys like Ih, Ra, Rm, etc
Example usage:
abf=swhlab.ABF('../abfs/group/16701010.abf')
swhlab.memtest.memtest(abf) #performs memtest on all sweeps
swhlab.memtest.checkSweep(abf) #lets you eyeball check how it did
p... | 38.811927 | 94 | 0.630304 |
import os
import sys
import pylab
import numpy as np
import time
import swhlab
import swhlab.core.common as cm
exampleABF=swhlab.ABF()
def memtestSweepVC(abf=exampleABF):
if abf.protoSeqY[1]>abf.protoSeqY[0] or len(abf.protoSeqY)<3:
return "protocol doesn't step down and back up"
TA,TB=int(abf.protoS... | true | true |
f70feac9370b5f157bc2c9998745353b5bf8bb67 | 17,023 | py | Python | lenstronomy/LensModel/MultiPlane/multi_plane_base.py | JelleAalbers/lenstronomy | 6db785667ff099fa8338e972b66253b2901b2827 | [
"MIT"
] | null | null | null | lenstronomy/LensModel/MultiPlane/multi_plane_base.py | JelleAalbers/lenstronomy | 6db785667ff099fa8338e972b66253b2901b2827 | [
"MIT"
] | null | null | null | lenstronomy/LensModel/MultiPlane/multi_plane_base.py | JelleAalbers/lenstronomy | 6db785667ff099fa8338e972b66253b2901b2827 | [
"MIT"
] | null | null | null | import numpy as np
from lenstronomy.Cosmo.background import Background
from lenstronomy.LensModel.profile_list_base import ProfileListBase
import lenstronomy.Util.constants as const
__all__ = ['MultiPlaneBase']
class MultiPlaneBase(ProfileListBase):
"""
Multi-plane lensing class
The lens model deflecti... | 46.638356 | 135 | 0.641661 | import numpy as np
from lenstronomy.Cosmo.background import Background
from lenstronomy.LensModel.profile_list_base import ProfileListBase
import lenstronomy.Util.constants as const
__all__ = ['MultiPlaneBase']
class MultiPlaneBase(ProfileListBase):
def __init__(self, lens_model_list, lens_redshift_list, z_sou... | true | true |
f70fec6a4bb9f9aa6a836ce5a5311f9889db362b | 3,307 | py | Python | Friendly/LaTeX/figures/cosinecomparison.py | benvcutilli/CountingPlusFriendly | 1947e2a765e20c87e080da22b4ecc4da1f272b02 | [
"MIT"
] | null | null | null | Friendly/LaTeX/figures/cosinecomparison.py | benvcutilli/CountingPlusFriendly | 1947e2a765e20c87e080da22b4ecc4da1f272b02 | [
"MIT"
] | null | null | null | Friendly/LaTeX/figures/cosinecomparison.py | benvcutilli/CountingPlusFriendly | 1947e2a765e20c87e080da22b4ecc4da1f272b02 | [
"MIT"
] | null | null | null | # The Plotly^^^plotly^^^ package
import plotly
# Importing ^^^numpy^^^
import numpy
def sigmoid(x):
return (1 + numpy.exp(-x)) ** -1
samplesPerDimension = 500
# Using numpy.linspace to create x and y values is from somewhere on ^^^plotly^^^'s website, most
# likely. It is a convenient way to do this, ... | 40.329268 | 100 | 0.498639 | import plotly
import numpy
def sigmoid(x):
return (1 + numpy.exp(-x)) ** -1
samplesPerDimension = 500
# likely. It is a convenient way to do this, so that's why.
evaluationRange = numpy.linspace([-5, -5], [5, 5], samplesPerDimension, axis=1)
# actually broadcast, but it mimics broadcasting with the ... | true | true |
f70fec80d037fd24ce2c291102597e64ad2034bd | 2,186 | py | Python | python/maya/site-packages/pymel-1.0.5/extras/completion/py/maya/app/general/adjustBackgroundImageWin.py | CountZer0/PipelineConstructionSet | 0aa73a8a63c72989b2d1c677efd78dad4388d335 | [
"BSD-3-Clause"
] | 21 | 2015-04-27T05:01:36.000Z | 2021-11-22T13:45:14.000Z | python/maya/site-packages/pymel-1.0.5/extras/completion/py/maya/app/general/adjustBackgroundImageWin.py | 0xb1dd1e/PipelineConstructionSet | 621349da1b6d1437e95d0c9e48ee9f36d59f19fd | [
"BSD-3-Clause"
] | null | null | null | python/maya/site-packages/pymel-1.0.5/extras/completion/py/maya/app/general/adjustBackgroundImageWin.py | 0xb1dd1e/PipelineConstructionSet | 621349da1b6d1437e95d0c9e48ee9f36d59f19fd | [
"BSD-3-Clause"
] | 7 | 2015-04-11T11:37:19.000Z | 2020-05-22T09:49:04.000Z | import maya.mel as mel
import maya
import maya.cmds as cmds
import sys
class TselectionWin(object):
"""
Base class for a dialog which works on the user's selection
"""
def __del__(self):
pass
def __init__(self, title, selectionFilter='<function <lambda>>', objects=[... | 16.073529 | 81 | 0.524245 | import maya.mel as mel
import maya
import maya.cmds as cmds
import sys
class TselectionWin(object):
def __del__(self):
pass
def __init__(self, title, selectionFilter='<function <lambda>>', objects=[]):
pass
def activate(self, window):
pas... | true | true |
f70feca6b4336b31b7b0568bb1b1409e4206f656 | 1,454 | py | Python | modules/runtime/runtime.py | Lizhu-Chen/bark | fad029f658e462eb1772c28c2c0971faf5176dc1 | [
"MIT"
] | null | null | null | modules/runtime/runtime.py | Lizhu-Chen/bark | fad029f658e462eb1772c28c2c0971faf5176dc1 | [
"MIT"
] | null | null | null | modules/runtime/runtime.py | Lizhu-Chen/bark | fad029f658e462eb1772c28c2c0971faf5176dc1 | [
"MIT"
] | 1 | 2020-08-12T17:09:05.000Z | 2020-08-12T17:09:05.000Z | # Copyright (c) 2020 Julian Bernhard, Klemens Esterle, Patrick Hart and
# Tobias Kessler
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
from bark.world.opendrive import *
from bark.world import *
from bark.geometry import *
from bark.runtime impor... | 27.433962 | 71 | 0.683631 |
from bark.world.opendrive import *
from bark.world import *
from bark.geometry import *
from bark.runtime import PyRuntime
class Runtime(PyRuntime):
def __init__(self,
step_time,
viewer,
scenario_generator=None,
render=False):
self._step_time = step_t... | true | true |
f70fecd8c30479e0a7ac5310738add8af3fd85d6 | 14,799 | py | Python | salt/payload.py | Noah-Huppert/salt | 998c382f5f2c3b4cbf7d96aa6913ada6993909b3 | [
"Apache-2.0"
] | 19 | 2016-01-29T14:37:52.000Z | 2022-03-30T18:08:01.000Z | salt/payload.py | Noah-Huppert/salt | 998c382f5f2c3b4cbf7d96aa6913ada6993909b3 | [
"Apache-2.0"
] | 223 | 2016-03-02T16:39:41.000Z | 2022-03-03T12:26:35.000Z | salt/payload.py | Noah-Huppert/salt | 998c382f5f2c3b4cbf7d96aa6913ada6993909b3 | [
"Apache-2.0"
] | 64 | 2016-02-04T19:45:26.000Z | 2021-12-15T02:02:31.000Z | # -*- coding: utf-8 -*-
"""
Many aspects of the salt payload need to be managed, from the return of
encrypted keys to general payload dynamics and packaging, these happen
in here
"""
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import gc
# import sys ... | 38.043702 | 100 | 0.547064 |
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import gc
import logging
import salt.log
import salt.transport.frame
import salt.utils.immutabletypes as immutabletypes
import salt.utils.msgpack
import salt.utils.stringutils
from salt.exceptions import SaltDeserializationErro... | true | true |
f70fed361316e184c2d287967078dd0420d8ce66 | 6,658 | py | Python | enquiry/migrations/0007_auto__add_field_enquiry_is_published.py | bitlabstudio/django-enquiry | 2e82b68ea0631ae824d88282daf38b8d28d8f0ee | [
"MIT"
] | null | null | null | enquiry/migrations/0007_auto__add_field_enquiry_is_published.py | bitlabstudio/django-enquiry | 2e82b68ea0631ae824d88282daf38b8d28d8f0ee | [
"MIT"
] | 2 | 2020-02-11T22:02:26.000Z | 2020-06-05T16:58:26.000Z | enquiry/migrations/0007_auto__add_field_enquiry_is_published.py | bitlabstudio/django-enquiry | 2e82b68ea0631ae824d88282daf38b8d28d8f0ee | [
"MIT"
] | null | null | null | # flake8: noqa
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Enquiry.is_published'
db.add_column('enquiry_enquiry', 'is_published',
... | 65.920792 | 182 | 0.560829 | import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
db.add_column('enquiry_enquiry', 'is_published',
self.gf('django.db.models.fields.BooleanField')(default=False... | true | true |
f70fed5e21d5b67955d3f6a157574fc6d76f5cfd | 3,434 | py | Python | examples/sac.py | RushikeshJoshi4/rlkit | 85db399565a45d8151f95c855f608ea9d827a0d0 | [
"MIT"
] | null | null | null | examples/sac.py | RushikeshJoshi4/rlkit | 85db399565a45d8151f95c855f608ea9d827a0d0 | [
"MIT"
] | null | null | null | examples/sac.py | RushikeshJoshi4/rlkit | 85db399565a45d8151f95c855f608ea9d827a0d0 | [
"MIT"
] | null | null | null | from gym.envs.mujoco import HalfCheetahEnv
import rlkit.torch.pytorch_util as ptu
from rlkit.data_management.env_replay_buffer import EnvReplayBuffer
from rlkit.envs.wrappers import NormalizedBoxEnv
from rlkit.launchers.launcher_util import setup_logger
from rlkit.samplers.data_collector import MdpPathCollector
from r... | 29.350427 | 74 | 0.657833 | from gym.envs.mujoco import HalfCheetahEnv
import rlkit.torch.pytorch_util as ptu
from rlkit.data_management.env_replay_buffer import EnvReplayBuffer
from rlkit.envs.wrappers import NormalizedBoxEnv
from rlkit.launchers.launcher_util import setup_logger
from rlkit.samplers.data_collector import MdpPathCollector
from r... | true | true |
f70fed9caefe330512d53a8d653194961fe8edf4 | 412 | py | Python | data_structure/recursion/example/example2.py | russellgao/algorithm | ad5e724d20a8492b8eba03fc0f24e4ff5964b3ea | [
"Apache-2.0"
] | 3 | 2020-05-18T00:47:18.000Z | 2020-06-08T01:57:13.000Z | data_structure/recursion/example/example2.py | russellgao/algorithm | ad5e724d20a8492b8eba03fc0f24e4ff5964b3ea | [
"Apache-2.0"
] | null | null | null | data_structure/recursion/example/example2.py | russellgao/algorithm | ad5e724d20a8492b8eba03fc0f24e4ff5964b3ea | [
"Apache-2.0"
] | null | null | null |
def reverseLists(list1) :
"""
原地用递归的方法反转list
:param list1:
:return:
"""
def helper(list1,left,right) :
if left < right :
list1[left] , list1[right] = list1[right] , list1[left]
helper(list1,left + 1 , right -1)
helper(list1,0,len(list1) - 1)
if __name__ == "... | 22.888889 | 67 | 0.524272 |
def reverseLists(list1) :
def helper(list1,left,right) :
if left < right :
list1[left] , list1[right] = list1[right] , list1[left]
helper(list1,left + 1 , right -1)
helper(list1,0,len(list1) - 1)
if __name__ == "__main__" :
list1 = ["a", "b", "c" , "d" , "d","e"]
revers... | true | true |
f70fee4c9a0ab1f2c9ea59edc727df7573e770f1 | 2,531 | py | Python | jina/clients/base/websocket.py | Satya2234/jina | bc4fa6ed8b2bdbc4885bf4a8f4b44722f0fc2deb | [
"Apache-2.0"
] | 15,179 | 2020-04-28T10:23:56.000Z | 2022-03-31T14:35:25.000Z | jina/clients/base/websocket.py | manavshah123/jina | f18b04eb82d18a3c554e2892bbae4b95fc0cb13e | [
"Apache-2.0"
] | 3,912 | 2020-04-28T13:01:29.000Z | 2022-03-31T14:36:46.000Z | jina/clients/base/websocket.py | manavshah123/jina | f18b04eb82d18a3c554e2892bbae4b95fc0cb13e | [
"Apache-2.0"
] | 1,955 | 2020-04-28T10:50:49.000Z | 2022-03-31T12:28:34.000Z | """A module for the websockets-based Client for Jina."""
from typing import Callable, Optional
from contextlib import nullcontext, AsyncExitStack
from ..helper import callback_exec
from .helper import WebsocketClientlet
from ...importer import ImportExtensions
from ..base import BaseClient, InputType
from ...logging.p... | 35.647887 | 81 | 0.568945 | from typing import Callable, Optional
from contextlib import nullcontext, AsyncExitStack
from ..helper import callback_exec
from .helper import WebsocketClientlet
from ...importer import ImportExtensions
from ..base import BaseClient, InputType
from ...logging.profile import ProgressBar
from ...peapods.stream.client i... | true | true |
f70fee9cb2b1dd8ce5770618cf71782ee9238674 | 367 | py | Python | 2_dictionaries/3_storing_dict_in_binary_file.py | nicholasjamesbaker/asd-class | c524971f800d649f4e18cc1e555c348029f6af1b | [
"MIT"
] | 2 | 2022-01-17T13:13:23.000Z | 2022-03-02T18:25:24.000Z | 2_dictionaries/3_storing_dict_in_binary_file.py | nicholasjamesbaker/asd-class | c524971f800d649f4e18cc1e555c348029f6af1b | [
"MIT"
] | null | null | null | 2_dictionaries/3_storing_dict_in_binary_file.py | nicholasjamesbaker/asd-class | c524971f800d649f4e18cc1e555c348029f6af1b | [
"MIT"
] | 3 | 2022-01-12T17:58:44.000Z | 2022-01-16T15:17:58.000Z | import pickle
pranjal = {
'first_name': 'Pranjal',
'last_name': 'Patra',
'age': 35,
'NetWorth': 420.69,
'Vaccinated': True
}
with open("pranjal.bin", 'wb') as pranjal_file:
pickle.dump(pranjal, pranjal_file)
with open('pranjal.bin', 'rb') as pranjal_file:
pranjal_from_bin_file = pickle.lo... | 20.388889 | 53 | 0.675749 | import pickle
pranjal = {
'first_name': 'Pranjal',
'last_name': 'Patra',
'age': 35,
'NetWorth': 420.69,
'Vaccinated': True
}
with open("pranjal.bin", 'wb') as pranjal_file:
pickle.dump(pranjal, pranjal_file)
with open('pranjal.bin', 'rb') as pranjal_file:
pranjal_from_bin_file = pickle.lo... | true | true |
f70feefa39ebf9ab6d2dcc47e911d388f5415e72 | 855 | py | Python | mysite/urls.py | kmayank39/kmayank | 6ba102d239443949a2aa2e6f05fa8a977d92bc1e | [
"Apache-2.0"
] | null | null | null | mysite/urls.py | kmayank39/kmayank | 6ba102d239443949a2aa2e6f05fa8a977d92bc1e | [
"Apache-2.0"
] | null | null | null | mysite/urls.py | kmayank39/kmayank | 6ba102d239443949a2aa2e6f05fa8a977d92bc1e | [
"Apache-2.0"
] | null | null | null | """mysite URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Clas... | 35.625 | 78 | 0.691228 | from django.contrib import admin
from django.urls import path
from django.conf.urls import include
urlpatterns = [
path('admin/', admin.site.urls),
path('kumarmayank', include('home.urls')),
]
| true | true |
f70fef6228bd5c8669c5f12614b1af75010ac45f | 1,255 | py | Python | model/ops.py | 530824679/YOLOv2 | eff9ddbab58da970e7fb449cd1974fb810fd6023 | [
"MIT"
] | null | null | null | model/ops.py | 530824679/YOLOv2 | eff9ddbab58da970e7fb449cd1974fb810fd6023 | [
"MIT"
] | null | null | null | model/ops.py | 530824679/YOLOv2 | eff9ddbab58da970e7fb449cd1974fb810fd6023 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# --------------------------------------
# @Time : 2020/11/01
# @Author : Oscar Chen
# @Email : 530824679@qq.com
# @File : ops.py
# Description :base operators.
# --------------------------------------
import tensorflow as tf
def leaky_relu(x):
return tf.nn.leaky_relu(x, alpha=0.1... | 35.857143 | 161 | 0.647012 |
import tensorflow as tf
def leaky_relu(x):
return tf.nn.leaky_relu(x, alpha=0.1, name='leaky_relu')
def conv2d(inputs, filters_num, filters_size, pad_size=0, stride=1, batch_normalize=True, activation=leaky_relu, use_bias=False, is_train=True, name='conv2d'):
if pad_size > 0:
inputs = tf.pad(inputs, ... | true | true |
f70ff03cf96fe013976425cf2112c255fa1ca390 | 15,840 | py | Python | src/sentry/plugins/bases/issue2.py | AlexWayfer/sentry | ef935cda2b2e960bd602fda590540882d1b0712d | [
"BSD-3-Clause"
] | null | null | null | src/sentry/plugins/bases/issue2.py | AlexWayfer/sentry | ef935cda2b2e960bd602fda590540882d1b0712d | [
"BSD-3-Clause"
] | null | null | null | src/sentry/plugins/bases/issue2.py | AlexWayfer/sentry | ef935cda2b2e960bd602fda590540882d1b0712d | [
"BSD-3-Clause"
] | null | null | null | from __future__ import absolute_import
import six
from rest_framework.response import Response
from social_auth.models import UserSocialAuth
from django.conf import settings
from django.conf.urls import url
from django.core.urlresolvers import reverse
from django.utils.html import format_html
from sentry.api.serial... | 35.357143 | 115 | 0.594192 | from __future__ import absolute_import
import six
from rest_framework.response import Response
from social_auth.models import UserSocialAuth
from django.conf import settings
from django.conf.urls import url
from django.core.urlresolvers import reverse
from django.utils.html import format_html
from sentry.api.serial... | true | true |
f70ff08456cae98acf4a012e994d88495cb533a7 | 2,886 | py | Python | nova/api/openstack/compute/schemas/volumes.py | ebalduf/nova-backports | 6bf97ec73467de522d34ab7a17ca0e0874baa7f9 | [
"Apache-2.0"
] | 5 | 2016-04-28T16:20:38.000Z | 2021-04-25T11:19:03.000Z | nova/api/openstack/compute/schemas/volumes.py | ebalduf/nova-backports | 6bf97ec73467de522d34ab7a17ca0e0874baa7f9 | [
"Apache-2.0"
] | 11 | 2017-06-19T01:28:55.000Z | 2017-06-23T02:01:47.000Z | nova/api/openstack/compute/schemas/volumes.py | ebalduf/nova-backports | 6bf97ec73467de522d34ab7a17ca0e0874baa7f9 | [
"Apache-2.0"
] | 5 | 2020-04-08T20:24:45.000Z | 2020-10-05T19:02:13.000Z | # Copyright 2014 IBM Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | 32.066667 | 78 | 0.517672 |
import copy
from nova.api.validation import parameter_types
create = {
'type': 'object',
'properties': {
'volume': {
'type': 'object',
'properties': {
'volume_type': {'type': 'string'},
'metadata': {'type': 'object'},
'snapshot_i... | true | true |
f70ff0a6e57c3271138f94f558d78ab6c1ab11ea | 37,879 | py | Python | safe_control_gym/controllers/mpc/gp_mpc_hexa.py | thaipduong/safe-control-gym | 69f8f627d232d50813a7fff6113dd6d5caccf930 | [
"MIT"
] | null | null | null | safe_control_gym/controllers/mpc/gp_mpc_hexa.py | thaipduong/safe-control-gym | 69f8f627d232d50813a7fff6113dd6d5caccf930 | [
"MIT"
] | null | null | null | safe_control_gym/controllers/mpc/gp_mpc_hexa.py | thaipduong/safe-control-gym | 69f8f627d232d50813a7fff6113dd6d5caccf930 | [
"MIT"
] | null | null | null | """Model Predictive Control with a Gaussian Process model.
Based on:
* L. Hewing, J. Kabzan and M. N. Zeilinger, "Cautious Model Predictive Control Using Gaussian Process Regression,"
in IEEE Transactions on Control Systems Technology, vol. 28, no. 6, pp. 2736-2743, Nov. 2020, doi: 10.1109/TCST.2019.2949757.
... | 50.237401 | 229 | 0.590248 | import scipy
import numpy as np
import casadi as cs
import time
import torch
import gpytorch
from copy import deepcopy
from skopt.sampler import Lhs
from functools import partial
from sklearn.model_selection import train_test_split
from safe_control_gym.controllers.mpc.linear_mpc import LinearMPC, MPC
from safe_contr... | true | true |
f70ff12f7fd786d101d3916da05e94855ad2e161 | 3,381 | py | Python | test/Base/FrontEndTest.py | PLOS/rhino | e9a0b595421664aabd21f0f8117cf04f4456db95 | [
"MIT"
] | 5 | 2017-03-04T13:35:27.000Z | 2018-10-30T20:46:03.000Z | test/Base/FrontEndTest.py | PLOS/rhino | e9a0b595421664aabd21f0f8117cf04f4456db95 | [
"MIT"
] | 65 | 2017-03-14T20:36:38.000Z | 2021-06-01T21:57:50.000Z | test/Base/FrontEndTest.py | PLOS/rhino | e9a0b595421664aabd21f0f8117cf04f4456db95 | [
"MIT"
] | 1 | 2017-02-10T00:29:21.000Z | 2017-02-10T00:29:21.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Public Library of Science
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitat... | 35.589474 | 100 | 0.697723 |
import unittest
import random
from teamcity import is_running_under_teamcity
from teamcity.unittestpy import TeamcityTestRunner
from .WebDriverFactory import WebDriverFactory
__author__ = 'jkrzemien@plos.org'
class FrontEndTest(unittest.TestCase):
_multiprocess_can_split_ = True
# Will contain ... | true | true |
f70ff1e700306a5c895e23510f6547d0391e8b9a | 1,253 | py | Python | configs/selfsup/_base_/datasets/imagenet_rotation-pred.py | mitming/mmselfsup | 5b5cb474776291cfcb9a1140afd11b696e11fcab | [
"Apache-2.0"
] | 355 | 2021-12-16T04:32:49.000Z | 2022-03-31T22:15:23.000Z | configs/selfsup/_base_/datasets/imagenet_rotation-pred.py | mitming/mmselfsup | 5b5cb474776291cfcb9a1140afd11b696e11fcab | [
"Apache-2.0"
] | 89 | 2021-12-16T05:15:42.000Z | 2022-03-31T10:57:39.000Z | configs/selfsup/_base_/datasets/imagenet_rotation-pred.py | mitming/mmselfsup | 5b5cb474776291cfcb9a1140afd11b696e11fcab | [
"Apache-2.0"
] | 74 | 2021-12-16T04:40:02.000Z | 2022-03-31T08:40:32.000Z | # dataset settings
data_source = 'ImageNet'
dataset_type = 'RotationPredDataset'
img_norm_cfg = dict(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
train_pipeline = [
dict(type='RandomResizedCrop', size=224),
dict(type='RandomHorizontalFlip'),
]
test_pipeline = [
dict(type='Resize', size=256),
d... | 27.23913 | 74 | 0.614525 | data_source = 'ImageNet'
dataset_type = 'RotationPredDataset'
img_norm_cfg = dict(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
train_pipeline = [
dict(type='RandomResizedCrop', size=224),
dict(type='RandomHorizontalFlip'),
]
test_pipeline = [
dict(type='Resize', size=256),
dict(type='CenterCro... | true | true |
f70ff2005d248bf2316ed76965ea609b3718b1e9 | 1,643 | py | Python | annotate_txt.py | MuhammedAshraf2020/yolo_using_pytorch | c6de8fd6c725db13792239bc7e4b4d4a71d3cd50 | [
"MIT"
] | 1 | 2021-08-03T13:33:35.000Z | 2021-08-03T13:33:35.000Z | annotate_txt.py | MuhammedAshraf2020/yolo_using_pytorch | c6de8fd6c725db13792239bc7e4b4d4a71d3cd50 | [
"MIT"
] | null | null | null | annotate_txt.py | MuhammedAshraf2020/yolo_using_pytorch | c6de8fd6c725db13792239bc7e4b4d4a71d3cd50 | [
"MIT"
] | null | null | null |
import argparse
from xml.etree import ElementTree as ET
import os
from pickle import dump
from tqdm import tqdm
parser = argparse.ArgumentParser()
parser.add_argument("dir")
parser.add_argument("save")
args = parser.parse_args()
path = os.path.join(args.dir)
classes_nums = {"cat" : 0 , "dog" : 1}
keys = list(classe... | 29.872727 | 95 | 0.584297 |
import argparse
from xml.etree import ElementTree as ET
import os
from pickle import dump
from tqdm import tqdm
parser = argparse.ArgumentParser()
parser.add_argument("dir")
parser.add_argument("save")
args = parser.parse_args()
path = os.path.join(args.dir)
classes_nums = {"cat" : 0 , "dog" : 1}
keys = list(classe... | true | true |
f70ff2c39f33dd888d631eafd160e6a0bc3e455e | 29,175 | py | Python | Plotters/Results/Plots_Paper_One.py | PouyaREZ/Wastewater_Energy_Optimization | ead604b715337dc8c76871910d38965d1b8b1856 | [
"MIT"
] | 2 | 2021-02-18T19:36:18.000Z | 2021-05-20T03:32:20.000Z | Plotters/Results/Plots_Paper_One.py | PouyaREZ/Wastewater_Energy_Optimization | ead604b715337dc8c76871910d38965d1b8b1856 | [
"MIT"
] | null | null | null | Plotters/Results/Plots_Paper_One.py | PouyaREZ/Wastewater_Energy_Optimization | ead604b715337dc8c76871910d38965d1b8b1856 | [
"MIT"
] | 1 | 2022-01-21T18:39:45.000Z | 2022-01-21T18:39:45.000Z | # -*- coding: utf-8 -*-
"""
Created on Fri Feb 4 2020
@Author: PouyaRZ
____________________________________________________
Plots to produce:
1. LCC of equipment for each scenario for all the individuals
2, SCC of equipment for each scenario for all the individuals
3. SCC vs LCC scatter plot.
4. SCC vs chiller typ... | 34.982014 | 162 | 0.637943 |
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
def DF_Filter(filename):
file = np.loadtxt(filename, dtype='float')
inputDF = pd.DataFrame(file)
error_tol = 1.15
print('+++++ processing %s +++++\n'%(filename))
print('Count duplicates:')
cond... | true | true |
f70ff38ed88161f522ef82bebd021101b440decd | 35,221 | py | Python | lib/galaxy/tool_shed/util/repository_util.py | reid-wagner/galaxy | 52175e60d52ae64a5c8e428fa277538c8cbddd7f | [
"CC-BY-3.0"
] | null | null | null | lib/galaxy/tool_shed/util/repository_util.py | reid-wagner/galaxy | 52175e60d52ae64a5c8e428fa277538c8cbddd7f | [
"CC-BY-3.0"
] | null | null | null | lib/galaxy/tool_shed/util/repository_util.py | reid-wagner/galaxy | 52175e60d52ae64a5c8e428fa277538c8cbddd7f | [
"CC-BY-3.0"
] | null | null | null | import logging
import os
import re
import shutil
from urllib.error import HTTPError
from markupsafe import escape
from sqlalchemy import (
and_,
false,
or_,
)
from sqlalchemy.orm import joinedload
from galaxy import util
from galaxy import web
from galaxy.tool_shed.util import basic_util
from galaxy.util.... | 54.186154 | 171 | 0.691406 | import logging
import os
import re
import shutil
from urllib.error import HTTPError
from markupsafe import escape
from sqlalchemy import (
and_,
false,
or_,
)
from sqlalchemy.orm import joinedload
from galaxy import util
from galaxy import web
from galaxy.tool_shed.util import basic_util
from galaxy.util.... | true | true |
f70ff3f6f11cf8baea1e696d4186195c3535c42f | 2,126 | py | Python | src/sequence_generator.py | Felihong/wikidata-sequence-analysis | 1d86ad9812c90864eb2c9ab72e5e61474d439f1e | [
"MIT"
] | null | null | null | src/sequence_generator.py | Felihong/wikidata-sequence-analysis | 1d86ad9812c90864eb2c9ab72e5e61474d439f1e | [
"MIT"
] | 1 | 2019-11-04T12:45:02.000Z | 2019-11-04T12:45:02.000Z | src/sequence_generator.py | Felihong/wikidata-sequence-analysis | 1d86ad9812c90864eb2c9ab72e5e61474d439f1e | [
"MIT"
] | null | null | null | import pandas as pd
from itertools import groupby
from operator import itemgetter
class SequenceGenerator:
def __init__(self, csvfile, jsThreshold):
self.datafile = csvfile
self.jsThreshold = jsThreshold
"""
Convert the input csv file into dataframe
"""
def _csv2df(self):
... | 40.884615 | 155 | 0.625118 | import pandas as pd
from itertools import groupby
from operator import itemgetter
class SequenceGenerator:
def __init__(self, csvfile, jsThreshold):
self.datafile = csvfile
self.jsThreshold = jsThreshold
def _csv2df(self):
return pd.read_csv(self.datafile, dtype={'item_id':int, 'user_... | true | true |
f70ff59c20d1954f8016e360c1dc77483ec2a266 | 586 | py | Python | actions/read_kv.py | RyanCopley/stackstorm-vault | 0b7f611bc34423a4a853daa99ec6c754d2169cd2 | [
"Apache-2.0"
] | null | null | null | actions/read_kv.py | RyanCopley/stackstorm-vault | 0b7f611bc34423a4a853daa99ec6c754d2169cd2 | [
"Apache-2.0"
] | null | null | null | actions/read_kv.py | RyanCopley/stackstorm-vault | 0b7f611bc34423a4a853daa99ec6c754d2169cd2 | [
"Apache-2.0"
] | null | null | null | from lib import action
class VaultReadAction(action.VaultBaseAction):
def run(self, path, kv_version, mount_point, version):
value = None
if kv_version == 1:
value = self.vault.kv.v1.read_secret(path=path, mount_point=mount_point)
elif kv_version == 2:
value = self... | 32.555556 | 92 | 0.578498 | from lib import action
class VaultReadAction(action.VaultBaseAction):
def run(self, path, kv_version, mount_point, version):
value = None
if kv_version == 1:
value = self.vault.kv.v1.read_secret(path=path, mount_point=mount_point)
elif kv_version == 2:
value = self... | true | true |
f70ff5a1f8ceb3f00386cd39ca25c564aab1d602 | 2,730 | py | Python | SERVER/control.py | azzhu/deeps | dda178497be3d62067a2f2a7a0a5aa1d793a89bc | [
"MIT"
] | 1 | 2022-03-04T10:18:05.000Z | 2022-03-04T10:18:05.000Z | SERVER/control.py | azzhu/deeps | dda178497be3d62067a2f2a7a0a5aa1d793a89bc | [
"MIT"
] | null | null | null | SERVER/control.py | azzhu/deeps | dda178497be3d62067a2f2a7a0a5aa1d793a89bc | [
"MIT"
] | null | null | null | #!/home/zhuqingjie/env/py3_tf_low/bin/python
'''
@Time : 07.26 0026 下午 01:19
@Author : zhuqingjie
@User : zhu
@FileName: control.py
@Software: PyCharm
'''
'''
总的控制逻辑
1,control只向外部暴露一个端口,外部向control发请求,control根据mode来去调用其他server模块
2,同时还解决了外部不能直接访问ai节点的问题。主服务跑在ai节点,control服务跑在登陆节点,这样外部就能访问了
'''
import json, os, r... | 25.754717 | 105 | 0.567399 |
import json, os, requests, sys, time
from flask import Flask, request
ai01_ip = '10.11.1.81'
ai02_ip = '10.11.1.82'
ai03_ip = '10.11.1.83'
ai04_ip = '10.11.1.84'
ai05_ip = '10.11.1.85'
IP = ai05_ip
app = Flask(__name__)
print_ = lambda x: print(f"--> [{time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))... | true | true |
f70ff636a28fe34d71cffa801e0ffe548d58bc39 | 26,074 | py | Python | src/openfermion/resource_estimates/molecule/pyscf_utils.py | cvmxn1/OpenFermion | cf53c063d0f124a02ff8776bb7f8afb110d4bde6 | [
"Apache-2.0"
] | null | null | null | src/openfermion/resource_estimates/molecule/pyscf_utils.py | cvmxn1/OpenFermion | cf53c063d0f124a02ff8776bb7f8afb110d4bde6 | [
"Apache-2.0"
] | null | null | null | src/openfermion/resource_estimates/molecule/pyscf_utils.py | cvmxn1/OpenFermion | cf53c063d0f124a02ff8776bb7f8afb110d4bde6 | [
"Apache-2.0"
] | null | null | null | #coverage:ignore
""" Drivers for various PySCF electronic structure routines """
from typing import Tuple, Optional
import sys
import h5py
import numpy as np
from pyscf import gto, scf, ao2mo, mcscf, lo, tools, cc
from pyscf.mcscf import avas
def stability(pyscf_mf):
"""
Test wave function stability and re-op... | 40.677067 | 80 | 0.586523 | from typing import Tuple, Optional
import sys
import h5py
import numpy as np
from pyscf import gto, scf, ao2mo, mcscf, lo, tools, cc
from pyscf.mcscf import avas
def stability(pyscf_mf):
new_orbitals = pyscf_mf.stability()[0]
new_1rdm = pyscf_mf.make_rdm1(new_orbitals, pyscf_mf.mo_occ)
pyscf_mf = pyscf_mf... | true | true |
f70ff6e04f63c81719810ece2a44b944ddc360a2 | 68,978 | py | Python | torch/testing/_internal/common_utils.py | wenhaopeter/read_pytorch_code | 491f989cd918cf08874dd4f671fb7f0142a0bc4f | [
"Intel",
"X11"
] | null | null | null | torch/testing/_internal/common_utils.py | wenhaopeter/read_pytorch_code | 491f989cd918cf08874dd4f671fb7f0142a0bc4f | [
"Intel",
"X11"
] | null | null | null | torch/testing/_internal/common_utils.py | wenhaopeter/read_pytorch_code | 491f989cd918cf08874dd4f671fb7f0142a0bc4f | [
"Intel",
"X11"
] | null | null | null | r"""Importing this file must **not** initialize CUDA context. test_distributed
relies on this assumption to properly run. This means that when this is imported
no CUDA calls shall be made, including torch.cuda.device_count(), etc.
torch.testing._internal.common_cuda.py can freely initialize CUDA context when imported.... | 40.056911 | 124 | 0.625243 |
import sys
import os
import platform
import re
import gc
import types
from functools import partial
import inspect
import io
import argparse
import unittest
import warnings
import random
import contextlib
import socket
import subprocess
import time
from collections import OrderedDict
from contextlib import contextmana... | true | true |
f70ff7b5f910ec0e2e5f617995f5bf4ccc679ff6 | 1,220 | py | Python | deep-rl/lib/python2.7/site-packages/OpenGL/GLES2/EXT/robustness.py | ShujaKhalid/deep-rl | 99c6ba6c3095d1bfdab81bd01395ced96bddd611 | [
"MIT"
] | 3 | 2019-04-01T11:03:04.000Z | 2019-12-31T02:17:15.000Z | deep-rl/lib/python2.7/site-packages/OpenGL/GLES2/EXT/robustness.py | ShujaKhalid/deep-rl | 99c6ba6c3095d1bfdab81bd01395ced96bddd611 | [
"MIT"
] | 1 | 2021-02-08T20:34:54.000Z | 2021-02-08T20:34:54.000Z | deep-rl/lib/python2.7/site-packages/OpenGL/GLES2/EXT/robustness.py | ShujaKhalid/deep-rl | 99c6ba6c3095d1bfdab81bd01395ced96bddd611 | [
"MIT"
] | 1 | 2018-06-07T22:31:11.000Z | 2018-06-07T22:31:11.000Z | '''OpenGL extension EXT.robustness
This module customises the behaviour of the
OpenGL.raw.GLES2.EXT.robustness to provide a more
Python-friendly API
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/EXT/robustness.txt
'''
from OpenGL import platform, constant, arrays
... | 35.882353 | 73 | 0.811475 | from OpenGL import platform, constant, arrays
from OpenGL import extensions, wrapper
import ctypes
from OpenGL.raw.GLES2 import _types, _glgets
from OpenGL.raw.GLES2.EXT.robustness import *
from OpenGL.raw.GLES2.EXT.robustness import _EXTENSION_NAME
def glInitRobustnessEXT():
from OpenGL import extensions
retu... | true | true |
f70ff8b39f836eb8b184cb1a2cede38cdd93a78e | 6,628 | py | Python | tests/orm/nodes/data/test_base.py | azadoks/aiida-core | b806b7fef8fc79090deccfe2019b77cb922e0581 | [
"MIT",
"BSD-3-Clause"
] | 180 | 2019-07-12T07:45:26.000Z | 2022-03-22T13:16:57.000Z | tests/orm/nodes/data/test_base.py | azadoks/aiida-core | b806b7fef8fc79090deccfe2019b77cb922e0581 | [
"MIT",
"BSD-3-Clause"
] | 2,325 | 2019-07-04T13:41:44.000Z | 2022-03-31T12:17:10.000Z | tests/orm/nodes/data/test_base.py | azadoks/aiida-core | b806b7fef8fc79090deccfe2019b77cb922e0581 | [
"MIT",
"BSD-3-Clause"
] | 88 | 2019-07-06T01:42:39.000Z | 2022-03-18T14:20:09.000Z | # -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | 28.817391 | 116 | 0.628093 |
import operator
import pytest
from aiida.orm import Bool, Float, Int, NumericType, Str, load_node
@pytest.mark.usefixtures('clear_database_before_test')
@pytest.mark.parametrize(
'node_type, default, value', [
(Bool, False, True),
(Int, 0, 5),
(Float, 0.0, 5.5),
(Str, '', 'a'),
... | true | true |
f70ff8c17dab8983b21b6b77a9aa402599833f23 | 2,391 | py | Python | lib/python3.8/site-packages/ansible_collections/community/general/tests/integration/targets/inventory_kubevirt/inventory_diff.py | cjsteel/python3-venv-ansible-2.10.5 | c95395c4cae844dc66fddde9b4343966f4b2ecd5 | [
"Apache-1.1"
] | 5 | 2020-12-16T21:42:09.000Z | 2022-03-28T16:04:32.000Z | .ansible/collections/ansible_collections/community/general/tests/integration/targets/inventory_kubevirt/inventory_diff.py | chronicc/proving-ground | 3e392122a05fb8383a3700954baebb0df330e9e3 | [
"MIT"
] | null | null | null | .ansible/collections/ansible_collections/community/general/tests/integration/targets/inventory_kubevirt/inventory_diff.py | chronicc/proving-ground | 3e392122a05fb8383a3700954baebb0df330e9e3 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import sys
def check_hosts(contrib, plugin):
contrib_hosts = sorted(contrib['_meta']['hostvars'].keys())
plugin_hosts = sorted(plugin['_meta']['hostvars'].keys())
assert contrib_host... | 33.676056 | 125 | 0.649101 |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import sys
def check_hosts(contrib, plugin):
contrib_hosts = sorted(contrib['_meta']['hostvars'].keys())
plugin_hosts = sorted(plugin['_meta']['hostvars'].keys())
assert contrib_hosts == plugin_hosts
... | true | true |
f70ff9f7bc88d87ca48ff19099b4239c3f5439c9 | 3,679 | py | Python | lib/modules/powershell/credentials/mimikatz/extract_tickets.py | RedBulletTooling/Empire | 3f4146bf8221ad3d2dcbe8ef4a61dabd66b86e0d | [
"BSD-3-Clause"
] | 3 | 2019-11-30T06:12:45.000Z | 2021-06-10T05:35:33.000Z | lib/modules/powershell/credentials/mimikatz/extract_tickets.py | RedBulletTooling/Empire | 3f4146bf8221ad3d2dcbe8ef4a61dabd66b86e0d | [
"BSD-3-Clause"
] | 20 | 2020-03-11T03:58:21.000Z | 2020-03-12T03:59:38.000Z | lib/modules/powershell/credentials/mimikatz/extract_tickets.py | RedBulletTooling/Empire | 3f4146bf8221ad3d2dcbe8ef4a61dabd66b86e0d | [
"BSD-3-Clause"
] | null | null | null | from __future__ import print_function
from builtins import str
from builtins import object
from lib.common import helpers
import threading
class Module(object):
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Invoke-Mimikatz extract kerberos tickets.',
'Author': [... | 34.707547 | 127 | 0.594183 | from __future__ import print_function
from builtins import str
from builtins import object
from lib.common import helpers
import threading
class Module(object):
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Invoke-Mimikatz extract kerberos tickets.',
'Author': [... | true | true |
f70ffa952087ecc203a557dd249439198e434117 | 31 | py | Python | esphome/components/version/__init__.py | OttoWinter/esphomeyaml | 6a85259e4d6d1b0a0f819688b8e555efcb99ecb0 | [
"MIT"
] | 249 | 2018-04-07T12:04:11.000Z | 2019-01-25T01:11:34.000Z | esphome/components/adc/__init__.py | OttoWinter/esphomeyaml | 6a85259e4d6d1b0a0f819688b8e555efcb99ecb0 | [
"MIT"
] | 243 | 2018-04-11T16:37:11.000Z | 2019-01-25T16:50:37.000Z | esphome/components/md5/__init__.py | OttoWinter/esphomeyaml | 6a85259e4d6d1b0a0f819688b8e555efcb99ecb0 | [
"MIT"
] | 40 | 2018-04-10T05:50:14.000Z | 2019-01-25T15:20:36.000Z | CODEOWNERS = ["@esphome/core"]
| 15.5 | 30 | 0.677419 | CODEOWNERS = ["@esphome/core"]
| true | true |
f70ffabd453e927be4c62b2141e841fbecc3791a | 580 | py | Python | setup.py | sejr/onu_micromouse_python | 0d5aa26f235687b131dbc3536d4d4d437b199f61 | [
"MIT"
] | null | null | null | setup.py | sejr/onu_micromouse_python | 0d5aa26f235687b131dbc3536d4d4d437b199f61 | [
"MIT"
] | 3 | 2015-04-18T21:09:18.000Z | 2015-04-18T21:11:17.000Z | setup.py | sejr/onu_micromouse_python | 0d5aa26f235687b131dbc3536d4d4d437b199f61 | [
"MIT"
] | null | null | null | from micromouse import mouse, maze
def begin():
"""
:return: None. This function begins micromouse operation.
"""
some_maze = maze.Maze(16)
some_mouse = mouse.Mouse(0, 0, some_maze)
print "Mouse initialized at (%d, %d)" % (some_mouse.x, some_mouse.y)
while some_mouse.maze.map[some_mouse.... | 26.363636 | 80 | 0.644828 | from micromouse import mouse, maze
def begin():
"""
:return: None. This function begins micromouse operation.
"""
some_maze = maze.Maze(16)
some_mouse = mouse.Mouse(0, 0, some_maze)
print "Mouse initialized at (%d, %d)" % (some_mouse.x, some_mouse.y)
while some_mouse.maze.map[some_mouse.... | false | true |
f70ffac8915dec77e469e6bc0f0f06e1bcd32725 | 1,831 | py | Python | s2e_env/utils/repos.py | benquike/s2e-env | 3a71fee8f80b3318ad6b971c0bb42b5f60b27d8b | [
"BSD-3-Clause"
] | 55 | 2019-12-20T03:25:14.000Z | 2022-01-16T07:19:47.000Z | s2e_env/utils/repos.py | weizhou-chaojixx/s2e-env | ba72dac30a6db65f87fea13f275003791fcf4052 | [
"BSD-3-Clause"
] | 2 | 2020-11-02T08:01:00.000Z | 2022-03-27T02:59:18.000Z | s2e_env/utils/repos.py | weizhou-chaojixx/s2e-env | ba72dac30a6db65f87fea13f275003791fcf4052 | [
"BSD-3-Clause"
] | 11 | 2020-08-06T03:59:45.000Z | 2022-02-25T02:31:59.000Z | """
Copyright (c) 2017 Cyberhaven
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sub... | 35.211538 | 78 | 0.761879 |
import logging
import os
import sys
from sh import git, ErrorReturnCode
from s2e_env import CONSTANTS
from s2e_env.command import CommandError
logger = logging.getLogger(__name__)
def git_clone(git_repo_url, git_repo_dir):
try:
logger.info('Fetching from %s to %s', git_repo_url, git_repo_dir)
... | true | true |
f70ffae33736b36285853cfb6a7d24af8048216a | 9,322 | py | Python | hardware/matcher.py | jacek-jablonski/hardware | 4447a07609b54ff1a0eea0f07c75030e5752afe2 | [
"Apache-2.0"
] | null | null | null | hardware/matcher.py | jacek-jablonski/hardware | 4447a07609b54ff1a0eea0f07c75030e5752afe2 | [
"Apache-2.0"
] | null | null | null | hardware/matcher.py | jacek-jablonski/hardware | 4447a07609b54ff1a0eea0f07c75030e5752afe2 | [
"Apache-2.0"
] | 1 | 2019-10-05T13:19:25.000Z | 2019-10-05T13:19:25.000Z | #
# Copyright (C) 2013-2015 eNovance SAS <licensing@enovance.com>
#
# Author: Frederic Lepied <frederic.lepied@enovance.com>
#
# 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://ww... | 31.281879 | 78 | 0.548487 |
import ipaddress
import logging
import re
import sys
LOG = logging.getLogger('hardware.matcher')
def _adder(array, index, value):
array[index] = value
def _appender(array, index, value):
try:
array[index].append(value)
except KeyError:
array[index] = [value, ]
def _range(elt, minva... | true | true |
f70ffb5207b57f675a7239f3cd40636f10b65be5 | 15,741 | py | Python | openpeerpower/components/mobile_app/webhook.py | OpenPeerPower/openpeerpower | 940a04a88e8f78e2d010dc912ad6905ae363503c | [
"Apache-2.0"
] | null | null | null | openpeerpower/components/mobile_app/webhook.py | OpenPeerPower/openpeerpower | 940a04a88e8f78e2d010dc912ad6905ae363503c | [
"Apache-2.0"
] | null | null | null | openpeerpower/components/mobile_app/webhook.py | OpenPeerPower/openpeerpower | 940a04a88e8f78e2d010dc912ad6905ae363503c | [
"Apache-2.0"
] | 1 | 2019-04-24T14:10:08.000Z | 2019-04-24T14:10:08.000Z | """Webhook handlers for mobile_app."""
from functools import wraps
import logging
import secrets
from aiohttp.web import HTTPBadRequest, Request, Response, json_response
from nacl.secret import SecretBox
import voluptuous as vol
from openpeerpower.components.binary_sensor import (
DEVICE_CLASSES as BINARY_SENSOR_... | 32.12449 | 88 | 0.688711 | from functools import wraps
import logging
import secrets
from aiohttp.web import HTTPBadRequest, Request, Response, json_response
from nacl.secret import SecretBox
import voluptuous as vol
from openpeerpower.components.binary_sensor import (
DEVICE_CLASSES as BINARY_SENSOR_CLASSES,
)
from openpeerpower.component... | true | true |
f70ffb5653d4966b0c8c0eb7aea68ce4980e6d72 | 7,639 | py | Python | lc101/school_app/models.py | Khoi938/AWS-SchoolApp | 64612718f2cf5e4fc0cd9622fcf51b9224776192 | [
"MIT"
] | null | null | null | lc101/school_app/models.py | Khoi938/AWS-SchoolApp | 64612718f2cf5e4fc0cd9622fcf51b9224776192 | [
"MIT"
] | 3 | 2020-06-05T18:33:38.000Z | 2021-06-10T20:22:00.000Z | lc101/school_app/models.py | Khoi938/AWS-SchoolApp | 64612718f2cf5e4fc0cd9622fcf51b9224776192 | [
"MIT"
] | null | null | null | from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
#------- Profile, Student, Teacher Model -------
## TODO Refactor CharField To Text Field Modify HTMl maxlength. WRONG USAGE!!! ALLL WRONG
class Profile(models.M... | 51.268456 | 138 | 0.728629 | from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
class Profile(models.Model):
user = models.OneToOneField(User, null=True, on_delete = models.SET_NULL)
street_address = models.CharField(max_len... | true | true |
f70ffb6cc9871e9b47e543f54c1311f5835fc889 | 476 | py | Python | plotly/validators/scattergeo/marker/colorbar/_y.py | faezs/plotly.py | 6009b5b9c746e5d2a2849ad255a4eb234b551ed7 | [
"MIT"
] | 2 | 2020-03-24T11:41:14.000Z | 2021-01-14T07:59:43.000Z | plotly/validators/scattergeo/marker/colorbar/_y.py | faezs/plotly.py | 6009b5b9c746e5d2a2849ad255a4eb234b551ed7 | [
"MIT"
] | null | null | null | plotly/validators/scattergeo/marker/colorbar/_y.py | faezs/plotly.py | 6009b5b9c746e5d2a2849ad255a4eb234b551ed7 | [
"MIT"
] | 4 | 2019-06-03T14:49:12.000Z | 2022-01-06T01:05:12.000Z | import _plotly_utils.basevalidators
class YValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self,
plotly_name='y',
parent_name='scattergeo.marker.colorbar',
**kwargs
):
super(YValidator, self).__init__(
plotly_name=plotly_name,
... | 22.666667 | 63 | 0.556723 | import _plotly_utils.basevalidators
class YValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self,
plotly_name='y',
parent_name='scattergeo.marker.colorbar',
**kwargs
):
super(YValidator, self).__init__(
plotly_name=plotly_name,
... | true | true |
f70ffe0144570d2feb047727bd5ac320d34c945a | 901 | py | Python | CNN/im_to_mat.py | MJC598/RJI_Quality_Analysis | ce294d0be6aa0c781e77ecc679defe32067627b3 | [
"MIT"
] | null | null | null | CNN/im_to_mat.py | MJC598/RJI_Quality_Analysis | ce294d0be6aa0c781e77ecc679defe32067627b3 | [
"MIT"
] | null | null | null | CNN/im_to_mat.py | MJC598/RJI_Quality_Analysis | ce294d0be6aa0c781e77ecc679defe32067627b3 | [
"MIT"
] | null | null | null | import sys
import tensorflow as tf
import numpy as np
import pydicom
from PIL import Image
import weights
#takes the root folder path and returns a list of pictures
def collect_pictures(path):
pic_list = []
full_path_list = []
for dirName, subdirList, fileList in os.walk(path):
# print('test')
for... | 25.742857 | 70 | 0.679245 | import sys
import tensorflow as tf
import numpy as np
import pydicom
from PIL import Image
import weights
def collect_pictures(path):
pic_list = []
full_path_list = []
for dirName, subdirList, fileList in os.walk(path):
for filename in file_list:
if ".png" in filename.lower() or ".jpg" in ... | false | true |
f70ffe3f4ef711992da1362f8030fc7607809690 | 791 | py | Python | ibis/backends/pandas/execution/__init__.py | rtpsw/ibis | d7318fdf87121cd8fadbcf0369a2b217aab3053a | [
"Apache-2.0"
] | 1 | 2022-03-22T10:39:37.000Z | 2022-03-22T10:39:37.000Z | ibis/backends/pandas/execution/__init__.py | marlenezw/ibis | 14b9baf3e1021e8698e7f0ae3c0ae5747543431c | [
"Apache-2.0"
] | null | null | null | ibis/backends/pandas/execution/__init__.py | marlenezw/ibis | 14b9baf3e1021e8698e7f0ae3c0ae5747543431c | [
"Apache-2.0"
] | null | null | null | from ibis.backends.pandas.execution.arrays import * # noqa: F401,F403
from ibis.backends.pandas.execution.decimal import * # noqa: F401,F403
from ibis.backends.pandas.execution.generic import * # noqa: F401,F403
from ibis.backends.pandas.execution.join import * # noqa: F401,F403
from ibis.backends.pandas.execution.... | 65.916667 | 75 | 0.777497 | from ibis.backends.pandas.execution.arrays import * from ibis.backends.pandas.execution.decimal import * from ibis.backends.pandas.execution.generic import * from ibis.backends.pandas.execution.join import * from ibis.backends.pandas.execution.maps import * from ibis.backends.pandas.execution.selection import * f... | true | true |
f70ffe665af27588bbe9a0130f4ef97d24df0153 | 961 | py | Python | enex2notion/cli_wkhtmltopdf.py | starplanet/enex2notion | 3bd97112e8234b477a3d53c5461ce7a3ac55f7aa | [
"MIT"
] | 49 | 2021-12-12T04:13:24.000Z | 2022-03-31T12:58:57.000Z | enex2notion/cli_wkhtmltopdf.py | starplanet/enex2notion | 3bd97112e8234b477a3d53c5461ce7a3ac55f7aa | [
"MIT"
] | 11 | 2021-12-03T10:49:54.000Z | 2022-03-29T20:00:30.000Z | enex2notion/cli_wkhtmltopdf.py | starplanet/enex2notion | 3bd97112e8234b477a3d53c5461ce7a3ac55f7aa | [
"MIT"
] | 3 | 2022-02-04T13:25:21.000Z | 2022-03-07T17:54:36.000Z | import logging
import os
import platform
import shutil
import sys
from pathlib import Path
logger = logging.getLogger(__name__)
def ensure_wkhtmltopdf(): # pragma: no cover
if shutil.which("wkhtmltopdf") is None:
if platform.system() == "Windows":
wkhtmltopdf_path = _find_wkhtmltopdf_path()
... | 30.03125 | 87 | 0.667014 | import logging
import os
import platform
import shutil
import sys
from pathlib import Path
logger = logging.getLogger(__name__)
def ensure_wkhtmltopdf(): if shutil.which("wkhtmltopdf") is None:
if platform.system() == "Windows":
wkhtmltopdf_path = _find_wkhtmltopdf_path()
if wkht... | true | true |
f70ffe907544adc81b183974aedfca98b72ac20d | 2,936 | py | Python | forumdemo/article/views.py | lamdba0602/forumdemo | 82c6223d6b6d7fb3bac049e342d3048a5117a2b7 | [
"Apache-2.0"
] | null | null | null | forumdemo/article/views.py | lamdba0602/forumdemo | 82c6223d6b6d7fb3bac049e342d3048a5117a2b7 | [
"Apache-2.0"
] | null | null | null | forumdemo/article/views.py | lamdba0602/forumdemo | 82c6223d6b6d7fb3bac049e342d3048a5117a2b7 | [
"Apache-2.0"
] | null | null | null | from django.shortcuts import redirect
from django.shortcuts import render
from django.core.paginator import Paginator
from django.contrib.auth.decorators import login_required
from article.forms import ArticleForm
from article.models import Article
from block.models import Block
from comment.models import Comment
de... | 39.146667 | 97 | 0.628065 | from django.shortcuts import redirect
from django.shortcuts import render
from django.core.paginator import Paginator
from django.contrib.auth.decorators import login_required
from article.forms import ArticleForm
from article.models import Article
from block.models import Block
from comment.models import Comment
de... | true | true |
f70ffef3c196a246295ef81a2cfd74f59b7eae71 | 7,088 | py | Python | ros/src/twist_controller/dbw_node.py | russell13192/CarND-Capstone | 1c182de5fb71f021f33518fe54e5ba27748a424d | [
"MIT"
] | 1 | 2019-08-19T20:36:45.000Z | 2019-08-19T20:36:45.000Z | ros/src/twist_controller/dbw_node.py | russell13192/CarND-Capstone | 1c182de5fb71f021f33518fe54e5ba27748a424d | [
"MIT"
] | null | null | null | ros/src/twist_controller/dbw_node.py | russell13192/CarND-Capstone | 1c182de5fb71f021f33518fe54e5ba27748a424d | [
"MIT"
] | 3 | 2019-08-19T20:40:33.000Z | 2019-09-22T18:56:50.000Z | #!/usr/bin/env python
# import cte_calculator
from geometry_msgs.msg import PoseStamped
import rospy
from std_msgs.msg import Bool
from styx_msgs.msg import Lane
from dbw_mkz_msgs.msg import ThrottleCmd, SteeringCmd, BrakeCmd, SteeringReport
from geometry_msgs.msg import TwistStamped
import math
from twist_controller i... | 55.375 | 109 | 0.616253 | from geometry_msgs.msg import PoseStamped
import rospy
from std_msgs.msg import Bool
from styx_msgs.msg import Lane
from dbw_mkz_msgs.msg import ThrottleCmd, SteeringCmd, BrakeCmd, SteeringReport
from geometry_msgs.msg import TwistStamped
import math
from twist_controller import Controller
class DBWNode(object):
de... | true | true |
f70fff870565855a3fc51fd9d30f07cd0448c020 | 36,690 | py | Python | opencolorio_config_aces/config/reference/generate/config.py | rdaniels29/OpenColorIO-Config-ACES | ed0d77ad47fd50ad6e71813980d589b2b44cf272 | [
"BSD-3-Clause"
] | null | null | null | opencolorio_config_aces/config/reference/generate/config.py | rdaniels29/OpenColorIO-Config-ACES | ed0d77ad47fd50ad6e71813980d589b2b44cf272 | [
"BSD-3-Clause"
] | null | null | null | opencolorio_config_aces/config/reference/generate/config.py | rdaniels29/OpenColorIO-Config-ACES | ed0d77ad47fd50ad6e71813980d589b2b44cf272 | [
"BSD-3-Clause"
] | null | null | null | # SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
"""
*aces-dev* Reference Config Generator
=====================================
Defines various objects related to the generation of the *aces-dev* reference
*OpenColorIO* config:
- :func:`opencolorio_config_aces.generate_c... | 31.766234 | 79 | 0.634096 |
import csv
import logging
import re
from collections import defaultdict
from datetime import datetime
from enum import Flag, auto
from pathlib import Path
from opencolorio_config_aces.config.generation import (
ConfigData, colorspace_factory, generate_config, look_factory,
view_transform_factory)
from opencol... | true | true |
f710006f30293d1e950a819440eba24d7dbe294e | 1,359 | py | Python | src/kv_classes/lang.py | Mulugruntz/deep_3d_photo | e296343757b5715145d49f283732821ef7915472 | [
"MIT"
] | 7 | 2020-07-22T07:35:15.000Z | 2021-12-29T13:46:31.000Z | src/kv_classes/lang.py | Mulugruntz/deep_3d_photo | e296343757b5715145d49f283732821ef7915472 | [
"MIT"
] | 2 | 2021-04-01T10:39:14.000Z | 2021-12-29T14:06:04.000Z | src/kv_classes/lang.py | Mulugruntz/deep_3d_photo | e296343757b5715145d49f283732821ef7915472 | [
"MIT"
] | null | null | null | from kivy.lang import Observable
import gettext
from constants import LOCALE_DIR
class Lang(Observable):
observers = []
lang = None
def __init__(self, defaultlang, transalte=None):
super(Lang, self).__init__()
self.ugettext = None
self.lang = defaultlang
self._translate =... | 31.604651 | 82 | 0.617366 | from kivy.lang import Observable
import gettext
from constants import LOCALE_DIR
class Lang(Observable):
observers = []
lang = None
def __init__(self, defaultlang, transalte=None):
super(Lang, self).__init__()
self.ugettext = None
self.lang = defaultlang
self._translate =... | true | true |
f71000745b36bbd45dec00f686164985b4d92e33 | 977 | py | Python | tests/test_mailer.py | E3SM-Project/acme_processflow | 84110cab08f7897d1489a6dc925258580a5d2bff | [
"MIT"
] | 3 | 2019-02-06T23:46:36.000Z | 2022-02-28T01:39:26.000Z | tests/test_mailer.py | E3SM-Project/acme_processflow | 84110cab08f7897d1489a6dc925258580a5d2bff | [
"MIT"
] | 62 | 2017-09-15T00:14:53.000Z | 2018-03-23T22:07:12.000Z | tests/test_mailer.py | E3SM-Project/acme_processflow | 84110cab08f7897d1489a6dc925258580a5d2bff | [
"MIT"
] | 4 | 2018-07-26T16:07:07.000Z | 2021-06-02T12:01:48.000Z | import inspect
import os
import sys
import unittest
from processflow.lib.mailer import Mailer
from processflow.lib.util import print_line
class TestMailer(unittest.TestCase):
def test_send_mail_valid(self):
print '\n'
print_line(
'---- Starting Test: {} ----'.format(inspect.stack()[... | 24.425 | 85 | 0.550665 | import inspect
import os
import sys
import unittest
from processflow.lib.mailer import Mailer
from processflow.lib.util import print_line
class TestMailer(unittest.TestCase):
def test_send_mail_valid(self):
print '\n'
print_line(
'---- Starting Test: {} ----'.format(inspect.stack()[... | false | true |
f710013e8fda200cf47f10c609828756146e2766 | 7,377 | py | Python | sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/_container_registry_management_client.py | rsdoherty/azure-sdk-for-python | 6bba5326677468e6660845a703686327178bb7b1 | [
"MIT"
] | 2,728 | 2015-01-09T10:19:32.000Z | 2022-03-31T14:50:33.000Z | sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/_container_registry_management_client.py | rsdoherty/azure-sdk-for-python | 6bba5326677468e6660845a703686327178bb7b1 | [
"MIT"
] | 17,773 | 2015-01-05T15:57:17.000Z | 2022-03-31T23:50:25.000Z | sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2020_11_01_preview/aio/_container_registry_management_client.py | rsdoherty/azure-sdk-for-python | 6bba5326677468e6660845a703686327178bb7b1 | [
"MIT"
] | 1,916 | 2015-01-19T05:05:41.000Z | 2022-03-31T19:36:44.000Z | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 55.466165 | 143 | 0.755456 |
from typing import Any, Optional, TYPE_CHECKING
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
from msrest import Deserializer, Serializer
if TYPE_CHECKING:
from azure.core.credentials_async import AsyncTokenCredential
from ._confi... | true | true |
f71001c69e6b9033c61079b91a451817bc6a6ed7 | 3,311 | py | Python | Geometry/MTDCommonData/test/testMTDinDD4hep.py | SWuchterl/cmssw | 769b4a7ef81796579af7d626da6039dfa0347b8e | [
"Apache-2.0"
] | 6 | 2017-09-08T14:12:56.000Z | 2022-03-09T23:57:01.000Z | Geometry/MTDCommonData/test/testMTDinDD4hep.py | SWuchterl/cmssw | 769b4a7ef81796579af7d626da6039dfa0347b8e | [
"Apache-2.0"
] | 545 | 2017-09-19T17:10:19.000Z | 2022-03-07T16:55:27.000Z | Geometry/MTDCommonData/test/testMTDinDD4hep.py | SWuchterl/cmssw | 769b4a7ef81796579af7d626da6039dfa0347b8e | [
"Apache-2.0"
] | 14 | 2017-10-04T09:47:21.000Z | 2019-10-23T18:04:45.000Z | import FWCore.ParameterSet.Config as cms
process = cms.Process("CompareGeometryTest")
process.source = cms.Source("EmptySource")
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(1)
)
process.MessageLogger = cms.Service(
"MessageLogger",
statistics = cms.untracked.vstring('c... | 38.952941 | 140 | 0.534884 | import FWCore.ParameterSet.Config as cms
process = cms.Process("CompareGeometryTest")
process.source = cms.Source("EmptySource")
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(1)
)
process.MessageLogger = cms.Service(
"MessageLogger",
statistics = cms.untracked.vstring('c... | true | true |
f71002071aa31f475e86d1779639faaa7bdb84e1 | 2,371 | py | Python | tests/digraph/test_depth.py | georgios-ts/retworkx | 8efe47c8ffaa2bdf1730ad50ada389bf9ca15229 | [
"Apache-2.0"
] | null | null | null | tests/digraph/test_depth.py | georgios-ts/retworkx | 8efe47c8ffaa2bdf1730ad50ada389bf9ca15229 | [
"Apache-2.0"
] | null | null | null | tests/digraph/test_depth.py | georgios-ts/retworkx | 8efe47c8ffaa2bdf1730ad50ada389bf9ca15229 | [
"Apache-2.0"
] | null | null | null | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under th... | 32.930556 | 75 | 0.6124 |
import unittest
import retworkx
class TestLongestPath(unittest.TestCase):
def test_linear(self):
dag = retworkx.PyDAG()
node_a = dag.add_node("a")
node_b = dag.add_child(node_a, "b", {})
node_c = dag.add_child(node_b, "c", {})
dag.add_child(node_b, "d", {})
node_e... | true | true |
f710059dee719252061de77a44f95f80a232bbe1 | 482 | py | Python | mmcap/utils/logger.py | hnp0411/mmcaptioning | 47bcdee3734cdaaa96a34e927cdec5cc43cab538 | [
"Apache-2.0"
] | null | null | null | mmcap/utils/logger.py | hnp0411/mmcaptioning | 47bcdee3734cdaaa96a34e927cdec5cc43cab538 | [
"Apache-2.0"
] | null | null | null | mmcap/utils/logger.py | hnp0411/mmcaptioning | 47bcdee3734cdaaa96a34e927cdec5cc43cab538 | [
"Apache-2.0"
] | null | null | null | import logging
from mmcv.utils import get_logger
def get_root_logger(log_file=None, log_level=logging.INFO):
"""Get root logger.
Args:
log_file (str, optional): File path of log. Defaults to None.
log_level (int, optional): The level of logger.
Defaults to logging.INFO.
Retu... | 22.952381 | 77 | 0.670124 | import logging
from mmcv.utils import get_logger
def get_root_logger(log_file=None, log_level=logging.INFO):
logger = get_logger(name='mmcap', log_file=log_file, log_level=log_level)
return logger
| true | true |
f71006b40f042b75b7b313be0ca71bb1ccf5d8ae | 191 | py | Python | automated/__init__.py | gabrielfern/automated-leda-tasks | b50bb14d118d64ad7361b5eb8bee9cf248bc57cf | [
"MIT"
] | 9 | 2017-07-26T19:10:12.000Z | 2018-04-25T02:27:09.000Z | automated/__init__.py | gabrielfern/automated-leda-tasks | b50bb14d118d64ad7361b5eb8bee9cf248bc57cf | [
"MIT"
] | 3 | 2017-08-02T23:32:28.000Z | 2018-10-13T00:08:54.000Z | automated/__init__.py | hericlesme/automated-leda-tasks | f0759d310636d281789f05bac7c9c624b75ab0e5 | [
"MIT"
] | 1 | 2018-05-24T23:55:31.000Z | 2018-05-24T23:55:31.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Gabriel Fernandes <gabrielfernndss@gmail.com>
# Héricles Emanuel <hericles.me@gmail.com>
if __name__ == '__main__':
print('easter_egg!')
| 21.222222 | 47 | 0.680628 |
if __name__ == '__main__':
print('easter_egg!')
| true | true |
f710076e41e510dc6c2d749b607b512d2e7db9c3 | 1,706 | py | Python | passgen/models.py | diyajaiswal11/HackCorona | dc6f7803a77b7ce6325f8d61f5f4fe54076ea461 | [
"MIT"
] | 7 | 2020-04-06T13:00:14.000Z | 2021-08-07T04:26:53.000Z | passgen/models.py | diyajaiswal11/HackCorona | dc6f7803a77b7ce6325f8d61f5f4fe54076ea461 | [
"MIT"
] | 10 | 2020-04-07T07:07:44.000Z | 2022-03-12T00:22:47.000Z | passgen/models.py | diyajaiswal11/HackCorona | dc6f7803a77b7ce6325f8d61f5f4fe54076ea461 | [
"MIT"
] | 2 | 2020-04-03T08:36:34.000Z | 2021-07-27T19:22:15.000Z | from django.db import models
from django.utils import timezone
category_choices = (
("Essential Services Pass", "Essential Services Pass"),
("Emergency Services Pass", "Emergency Services Pass"),
)
subcategory_choices = (
("ATM/Banking", "ATM/Banking"),
("Delivery Worker", "Delivery Worker"),
... | 41.609756 | 78 | 0.736225 | from django.db import models
from django.utils import timezone
category_choices = (
("Essential Services Pass", "Essential Services Pass"),
("Emergency Services Pass", "Emergency Services Pass"),
)
subcategory_choices = (
("ATM/Banking", "ATM/Banking"),
("Delivery Worker", "Delivery Worker"),
... | true | true |
f71008c40263271753ec152fe0f9a5a57343a4fd | 6,627 | py | Python | docs/conf.py | scipp/scippnexus | 978b3b671355f55f94eb9d79f2ffe5cf793605ba | [
"BSD-3-Clause"
] | null | null | null | docs/conf.py | scipp/scippnexus | 978b3b671355f55f94eb9d79f2ffe5cf793605ba | [
"BSD-3-Clause"
] | null | null | null | docs/conf.py | scipp/scippnexus | 978b3b671355f55f94eb9d79f2ffe5cf793605ba | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
import doctest
from datetime import date
import scippnexus
html_show_sourcelink = True
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.mathjax',
'sphinx.ext.napoleon',
'sphinx_autodoc_typehi... | 31.407583 | 83 | 0.673306 |
import doctest
from datetime import date
import scippnexus
html_show_sourcelink = True
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.mathjax',
'sphinx.ext.napoleon',
'sphinx_autodoc_typehints',
'sphinx_copybu... | true | true |
f71008d441773617443f83aa63ba8084f8da41c4 | 603 | py | Python | src/images/migrations/0002_image_thumbnail.py | thesus/bokstaever | e0a5e2614dd222ccd56a8945aba4fd28de85dd31 | [
"MIT"
] | null | null | null | src/images/migrations/0002_image_thumbnail.py | thesus/bokstaever | e0a5e2614dd222ccd56a8945aba4fd28de85dd31 | [
"MIT"
] | 7 | 2019-11-18T16:11:01.000Z | 2019-11-18T16:11:04.000Z | src/images/migrations/0002_image_thumbnail.py | thesus/bokstaever | e0a5e2614dd222ccd56a8945aba4fd28de85dd31 | [
"MIT"
] | null | null | null | # Generated by Django 2.2 on 2019-04-18 13:14
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("images", "0001_initial"),
]
operations = [
migrations.AddField(
model_name="image",
n... | 23.192308 | 60 | 0.543947 |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("images", "0001_initial"),
]
operations = [
migrations.AddField(
model_name="image",
name="thumbnail",
field=models.Fore... | true | true |
f71008f90aef3143c7a5345ef4a051933e27a90b | 895 | py | Python | app/tests/test_pitch.py | ChegeDaniella/Pitches | 40b6bea69fe8774ca39e6199e9e80f32429503fd | [
"MIT"
] | null | null | null | app/tests/test_pitch.py | ChegeDaniella/Pitches | 40b6bea69fe8774ca39e6199e9e80f32429503fd | [
"MIT"
] | null | null | null | app/tests/test_pitch.py | ChegeDaniella/Pitches | 40b6bea69fe8774ca39e6199e9e80f32429503fd | [
"MIT"
] | null | null | null | import unittest
from app.main.models import Pitches
from app import db
class PitchesModelTest(unittest.TestCase):
def setUp(self):
self.new_pitch=Pitches(pitch='new',comment='I love darkness', category='sports',user_id = 123)
def tearDown(self):
Pitches.query.delete()
def test __init__(s... | 27.96875 | 102 | 0.653631 | import unittest
from app.main.models import Pitches
from app import db
class PitchesModelTest(unittest.TestCase):
def setUp(self):
self.new_pitch=Pitches(pitch='new',comment='I love darkness', category='sports',user_id = 123)
def tearDown(self):
Pitches.query.delete()
def test __init__(s... | false | true |
f7100a0d535f79b24ae402b1d9ef106e9e8e0f59 | 319 | py | Python | 000989letpy/letpy_064_str_len_20200511.py | SafonovMikhail/python_000577 | 739f764e80f1ca354386f00b8e9db1df8c96531d | [
"Apache-2.0"
] | null | null | null | 000989letpy/letpy_064_str_len_20200511.py | SafonovMikhail/python_000577 | 739f764e80f1ca354386f00b8e9db1df8c96531d | [
"Apache-2.0"
] | null | null | null | 000989letpy/letpy_064_str_len_20200511.py | SafonovMikhail/python_000577 | 739f764e80f1ca354386f00b8e9db1df8c96531d | [
"Apache-2.0"
] | null | null | null | string = input()
string_length = len(string)
print(string_length)
string = input()
if len(string) < 5:
print("Ошибка! Введите больше пяти символов!")
string = input()
if not string:
print("Ошибка! Введите хоть что-нибудь!")
string = input()
if len(string) == 0:
print("Ошибка! Введите хоть что-нибудь!")
| 19.9375 | 50 | 0.680251 | string = input()
string_length = len(string)
print(string_length)
string = input()
if len(string) < 5:
print("Ошибка! Введите больше пяти символов!")
string = input()
if not string:
print("Ошибка! Введите хоть что-нибудь!")
string = input()
if len(string) == 0:
print("Ошибка! Введите хоть что-нибудь!")
| true | true |
f7100c11398d00d664ae324a7f7382af849d2c99 | 30,853 | py | Python | nltk/parse/dependencygraph.py | Geolem/nltk | 39b84d97bc857fce4fef185c69b94546b8474551 | [
"Apache-2.0"
] | null | null | null | nltk/parse/dependencygraph.py | Geolem/nltk | 39b84d97bc857fce4fef185c69b94546b8474551 | [
"Apache-2.0"
] | null | null | null | nltk/parse/dependencygraph.py | Geolem/nltk | 39b84d97bc857fce4fef185c69b94546b8474551 | [
"Apache-2.0"
] | null | null | null | # Natural Language Toolkit: Dependency Grammars
#
# Copyright (C) 2001-2021 NLTK Project
# Author: Jason Narad <jason.narad@gmail.com>
# Steven Bird <stevenbird1@gmail.com> (modifications)
#
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
#
"""
Tools for reading and writing dependency tree... | 39.555128 | 118 | 0.454769 |
from collections import defaultdict
from itertools import chain
from pprint import pformat
import subprocess
import warnings
from nltk.tree import Tree
class DependencyGraph:
def __init__(
self,
tree_str=None,
cell_extractor=None,
zero_based=False,
cell_separator=None,... | true | true |
f7100dfc5d3a59776b012e0dd0e3c6e254fd289d | 2,169 | py | Python | code/torch/models/hypersearch/args.py | siduojiang/BERTVision | 9d0d4856300973488ead67e2d06e243bf07447ad | [
"MIT"
] | 5 | 2020-08-06T10:12:08.000Z | 2022-03-17T10:38:40.000Z | code/torch/models/hypersearch/args.py | siduojiang/BERTVision | 9d0d4856300973488ead67e2d06e243bf07447ad | [
"MIT"
] | 9 | 2020-06-23T16:57:52.000Z | 2021-01-17T01:52:45.000Z | code/torch/models/hypersearch/args.py | cbenge509/BERTVision | 01519bea0882fa72e86a1b62f2d0d52d22c26dfc | [
"MIT"
] | null | null | null | import os, sys
sys.path.append("C:\\BERTVision\\code\\torch")
import torch
import models.args
def get_args():
# retreive the general models.args and attach them here
parser = models.args.get_args()
# set search specific args
parser.add_argument('--model',
type=str,
... | 37.396552 | 97 | 0.467958 | import os, sys
sys.path.append("C:\\BERTVision\\code\\torch")
import torch
import models.args
def get_args():
parser = models.args.get_args()
parser.add_argument('--model',
type=str,
default='MSR',
required=True)
parser.add_ar... | true | true |
f7100e3b7ddd22d724d09587620dfdaa4a14ca49 | 5,408 | py | Python | horizon/horizon/dashboards/nova/floating_ips/forms.py | katzj/horizon | 195b70bcf161987d2568e7c9dbebdfffd22004f8 | [
"Apache-2.0"
] | 3 | 2015-05-18T13:49:43.000Z | 2015-05-18T14:38:12.000Z | horizon/horizon/dashboards/nova/floating_ips/forms.py | usc-isi/horizon-old | eb896725004283ab53047735dcd308fd934acdd7 | [
"Apache-2.0"
] | null | null | null | horizon/horizon/dashboards/nova/floating_ips/forms.py | usc-isi/horizon-old | eb896725004283ab53047735dcd308fd934acdd7 | [
"Apache-2.0"
] | null | null | null | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2011 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | 43.612903 | 78 | 0.615015 |
import logging
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django import shortcuts
from django.utils.translation import ugettext as _
from novaclient import exceptions as novaclient_exceptions
from horizon import api
from horizon import forms
LOG = logging.ge... | false | true |
f7100f39a080309ca2cb603931b8da369057f812 | 717 | py | Python | BOOK/MAIN/05-file-handling/chapter-5-examples/15-display-records.py | kabirsrivastava3/python-practice | f56a4a0764031d3723b0ba4cd1418a1a83b1e4f5 | [
"MIT"
] | null | null | null | BOOK/MAIN/05-file-handling/chapter-5-examples/15-display-records.py | kabirsrivastava3/python-practice | f56a4a0764031d3723b0ba4cd1418a1a83b1e4f5 | [
"MIT"
] | null | null | null | BOOK/MAIN/05-file-handling/chapter-5-examples/15-display-records.py | kabirsrivastava3/python-practice | f56a4a0764031d3723b0ba4cd1418a1a83b1e4f5 | [
"MIT"
] | null | null | null | #display records of students of roll no. 22 and 23.
import pickle
stu = {} #declare empty dictionary object; it will hold record
found = False
finObj = open('Stu.dat',"rb") #open binary file in read mode
searchKeys = [22,23]
#read from the file
try:
print("File Stu.dat store these records")
while True: #it wi... | 29.875 | 88 | 0.665272 |
import pickle
stu = {} found = False
finObj = open('Stu.dat',"rb") searchKeys = [22,23]
try:
print("File Stu.dat store these records")
while True: stu = pickle.load(finObj) if stu['Rollno'] in searchKeys:
print(stu) found = True
except EOFError:
if found == False:
... | true | true |
f7100ff56bd69c1d3a211ca0a9af3fcd0dae54de | 1,835 | py | Python | client/hipchat/HipChatMonitor.py | xEoDx/eodbot | 933d9c1c9c836a5a6091a26bfd4d7eb98f932595 | [
"Apache-2.0"
] | null | null | null | client/hipchat/HipChatMonitor.py | xEoDx/eodbot | 933d9c1c9c836a5a6091a26bfd4d7eb98f932595 | [
"Apache-2.0"
] | 5 | 2020-03-04T21:39:32.000Z | 2021-12-09T19:43:28.000Z | client/hipchat/HipChatMonitor.py | xEoDx/eodbot | 933d9c1c9c836a5a6091a26bfd4d7eb98f932595 | [
"Apache-2.0"
] | null | null | null | from hipchat import HipChatManager
import time
import configparser
_MAX_SLEEP_TIME = 5
_MIN_SLEEP_TIME = 2
_SPAM_EODBOT_URL = 3500
class HipChatMonitor:
def __init__(self, eodBotParser):
print("Initializing HipChatMonitor with eodBotParser: ",eodBotParser)
self.sleepTime = _MIN_SLEEP_TIME
self.lastIdChecked = ... | 35.288462 | 149 | 0.725886 | from hipchat import HipChatManager
import time
import configparser
_MAX_SLEEP_TIME = 5
_MIN_SLEEP_TIME = 2
_SPAM_EODBOT_URL = 3500
class HipChatMonitor:
def __init__(self, eodBotParser):
print("Initializing HipChatMonitor with eodBotParser: ",eodBotParser)
self.sleepTime = _MIN_SLEEP_TIME
self.lastIdChecked = ... | true | true |
f71010536d580e3dc257b139c71119eec3b95907 | 2,202 | py | Python | tulip/transys/__init__.py | miquelramirez/tulip-control | ce54897c242689f45ad33650f157bf1805b35ed6 | [
"BSD-3-Clause"
] | 1 | 2020-02-13T14:13:50.000Z | 2020-02-13T14:13:50.000Z | tulip/transys/__init__.py | miquelramirez/tulip-control | ce54897c242689f45ad33650f157bf1805b35ed6 | [
"BSD-3-Clause"
] | null | null | null | tulip/transys/__init__.py | miquelramirez/tulip-control | ce54897c242689f45ad33650f157bf1805b35ed6 | [
"BSD-3-Clause"
] | 1 | 2019-07-09T16:32:39.000Z | 2019-07-09T16:32:39.000Z | # Copyright (c) 2013-2014 by California Institute of Technology
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice,... | 38.631579 | 73 | 0.781108 | from __future__ import absolute_import
from .mathset import MathSet, SubSet, PowerSet, TypedDict
from .labeled_graphs import prepend_with
from .transys import (
KripkeStructure, FiniteTransitionSystem, FTS,
LabeledGameGraph,
tuple2fts, line_labeled_with, cycle_labeled_with
)
from .automata import (
Buc... | true | true |
f71011ebc8324e6ec4b4d16a31c684a403ca6635 | 325 | py | Python | FindNumberswithEvenNumberofDigits.py | eagletusk/pythonPractice | 4ac8d8c2f45072407b8f25514a3e54bddcd38a33 | [
"MIT"
] | null | null | null | FindNumberswithEvenNumberofDigits.py | eagletusk/pythonPractice | 4ac8d8c2f45072407b8f25514a3e54bddcd38a33 | [
"MIT"
] | null | null | null | FindNumberswithEvenNumberofDigits.py | eagletusk/pythonPractice | 4ac8d8c2f45072407b8f25514a3e54bddcd38a33 | [
"MIT"
] | null | null | null | class Solution:
def findNumbers(self, nums: List[int]) -> int:
bkt =[]
for n in nums:
count = str(n).count('')-1
print (str(n), count)
if count%2 == 0 :
bkt.append(count)
count =0
count =0
return len(bkt)
... | 27.083333 | 50 | 0.412308 | class Solution:
def findNumbers(self, nums: List[int]) -> int:
bkt =[]
for n in nums:
count = str(n).count('')-1
print (str(n), count)
if count%2 == 0 :
bkt.append(count)
count =0
count =0
return len(bkt)
... | true | true |
f710122a35afda1f83e03c6f8b0342dcee505738 | 12,984 | py | Python | tests/rest_api/test_jobs.py | campin11/cvat | 085ccce1cfb018d4eea2309d3086f4c8909c2cd3 | [
"Intel",
"MIT"
] | null | null | null | tests/rest_api/test_jobs.py | campin11/cvat | 085ccce1cfb018d4eea2309d3086f4c8909c2cd3 | [
"Intel",
"MIT"
] | null | null | null | tests/rest_api/test_jobs.py | campin11/cvat | 085ccce1cfb018d4eea2309d3086f4c8909c2cd3 | [
"Intel",
"MIT"
] | null | null | null | # Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
from http import HTTPStatus
from deepdiff import DeepDiff
import pytest
from .utils.config import get_method, patch_method
def get_job_staff(job, tasks, projects):
job_staff = []
job_staff.append(job['assignee'])
tid = job['task_id']
... | 41.883871 | 97 | 0.614911 |
from http import HTTPStatus
from deepdiff import DeepDiff
import pytest
from .utils.config import get_method, patch_method
def get_job_staff(job, tasks, projects):
job_staff = []
job_staff.append(job['assignee'])
tid = job['task_id']
job_staff.append(tasks[tid]['owner'])
job_staff.append(tasks[tid... | true | true |
f71012b82436e5dd37274c5125768f25f6343cca | 371 | py | Python | polls/migrations/0002_auto_20200211_1555.py | rpesce/django_tutorial | b0a3c10c1246ec42e9c86c03a7b441ff8be1c495 | [
"Apache-2.0"
] | 11 | 2020-03-25T16:03:08.000Z | 2022-03-19T17:59:43.000Z | polls/migrations/0002_auto_20200211_1555.py | rpesce/django_tutorial | b0a3c10c1246ec42e9c86c03a7b441ff8be1c495 | [
"Apache-2.0"
] | null | null | null | polls/migrations/0002_auto_20200211_1555.py | rpesce/django_tutorial | b0a3c10c1246ec42e9c86c03a7b441ff8be1c495 | [
"Apache-2.0"
] | 3 | 2020-08-18T03:34:59.000Z | 2022-03-21T13:44:45.000Z | # Generated by Django 3.0.3 on 2020-02-11 20:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('polls', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='choice',
name='votes',
fiel... | 19.526316 | 49 | 0.58221 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('polls', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='choice',
name='votes',
field=models.IntegerField(default=0),
),
... | true | true |
f71013d279ee02e1a4eef74c167f62131c79ae29 | 1,991 | py | Python | evosoro_pymoo/Algorithms/RankAndNoveltySurvival.py | leguiart/MSc_Thesis | 22ffc73c75d814856850f26c4586d90896b74cf3 | [
"MIT"
] | null | null | null | evosoro_pymoo/Algorithms/RankAndNoveltySurvival.py | leguiart/MSc_Thesis | 22ffc73c75d814856850f26c4586d90896b74cf3 | [
"MIT"
] | null | null | null | evosoro_pymoo/Algorithms/RankAndNoveltySurvival.py | leguiart/MSc_Thesis | 22ffc73c75d814856850f26c4586d90896b74cf3 | [
"MIT"
] | null | null | null | import numpy as np
from pymoo.core.survival import Survival
from pymoo.util.nds.non_dominated_sorting import NonDominatedSorting
from pymoo.util.randomized_argsort import randomized_argsort
# ---------------------------------------------------------------------------------------------------------
# Survival Selection... | 35.553571 | 107 | 0.57559 | import numpy as np
from pymoo.core.survival import Survival
from pymoo.util.nds.non_dominated_sorting import NonDominatedSorting
from pymoo.util.randomized_argsort import randomized_argsort
class RankAndNoveltySurvival(Survival):
def __init__(self, nds=None) -> None:
super().__init__(filter_infeasible=... | true | true |
f7101568fd06e7609738fb50b7989e279bd9adf1 | 321 | py | Python | tests/resources/functional/test_all.py | IamSaurabh1/taurus | 928d44e30e6cd5b979e675bfdce4c1dbeb5d0eff | [
"Apache-2.0"
] | 1,743 | 2015-03-30T20:56:03.000Z | 2022-03-31T09:08:37.000Z | tests/resources/functional/test_all.py | IamSaurabh1/taurus | 928d44e30e6cd5b979e675bfdce4c1dbeb5d0eff | [
"Apache-2.0"
] | 1,159 | 2015-04-01T08:25:53.000Z | 2022-03-29T08:15:31.000Z | tests/resources/functional/test_all.py | IamSaurabh1/taurus | 928d44e30e6cd5b979e675bfdce4c1dbeb5d0eff | [
"Apache-2.0"
] | 497 | 2015-03-31T21:05:18.000Z | 2022-03-17T12:45:21.000Z | from unittest import TestCase, skipIf
class TestAll(TestCase):
def test_passing(self):
pass
def test_erroring(self):
raise Exception("Ima broke")
def test_failing(self):
self.assertEquals(2 + 2 * 2, 8)
@skipIf(2 > 1, "Skip everytime")
def test_skipped(self):
pass... | 18.882353 | 39 | 0.623053 | from unittest import TestCase, skipIf
class TestAll(TestCase):
def test_passing(self):
pass
def test_erroring(self):
raise Exception("Ima broke")
def test_failing(self):
self.assertEquals(2 + 2 * 2, 8)
@skipIf(2 > 1, "Skip everytime")
def test_skipped(self):
pass... | true | true |
f71015ada55db9be78eab80611c4bfe815bfe940 | 512 | py | Python | regexlib/2021-5-15/python_re_test_file/regexlib_6851.py | yetingli/ReDoS-Benchmarks | f5b5094d835649e957bf3fec6b8bd4f6efdb35fc | [
"MIT"
] | 1 | 2022-01-24T14:43:23.000Z | 2022-01-24T14:43:23.000Z | regexlib/2021-5-15/python_re_test_file/regexlib_6851.py | yetingli/ReDoS-Benchmarks | f5b5094d835649e957bf3fec6b8bd4f6efdb35fc | [
"MIT"
] | null | null | null | regexlib/2021-5-15/python_re_test_file/regexlib_6851.py | yetingli/ReDoS-Benchmarks | f5b5094d835649e957bf3fec6b8bd4f6efdb35fc | [
"MIT"
] | null | null | null | # 6851
# ^[a-zA-Z0-9]+(([_][a-zA-Z0-9])?[a-zA-Z0-9]*)*$
# EXPONENT
# nums:4
# EXPONENT AttackString:"a"+"0"*32+"!1 __NQ"
import re
from time import perf_counter
regex = """^[a-zA-Z0-9]+(([_][a-zA-Z0-9])?[a-zA-Z0-9]*)*$"""
REGEX = re.compile(regex)
for i in range(0, 150000):
ATTACK = "a" + "0" * i * 1 + "!1 __NQ"
... | 26.947368 | 60 | 0.568359 |
import re
from time import perf_counter
regex = """^[a-zA-Z0-9]+(([_][a-zA-Z0-9])?[a-zA-Z0-9]*)*$"""
REGEX = re.compile(regex)
for i in range(0, 150000):
ATTACK = "a" + "0" * i * 1 + "!1 __NQ"
LEN = len(ATTACK)
BEGIN = perf_counter()
m = REGEX.search(ATTACK)
DURATION = perf_counter() - BEGIN
... | true | true |
f71016e8f4f652bd02e3c9822c374573d6ee503c | 844 | py | Python | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/lms/djangoapps/discussion/management/commands/create_roles_for_existing.py | osoco/better-ways-of-thinking-about-software | 83e70d23c873509e22362a09a10d3510e10f6992 | [
"MIT"
] | 3 | 2021-12-15T04:58:18.000Z | 2022-02-06T12:15:37.000Z | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/lms/djangoapps/discussion/management/commands/create_roles_for_existing.py | osoco/better-ways-of-thinking-about-software | 83e70d23c873509e22362a09a10d3510e10f6992 | [
"MIT"
] | null | null | null | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/lms/djangoapps/discussion/management/commands/create_roles_for_existing.py | osoco/better-ways-of-thinking-about-software | 83e70d23c873509e22362a09a10d3510e10f6992 | [
"MIT"
] | 1 | 2019-01-02T14:38:50.000Z | 2019-01-02T14:38:50.000Z | """
This must be run only after seed_permissions_roles.py!
Creates default roles for all users currently in the database. Just runs through
Enrollments.
"""
from django.core.management.base import BaseCommand
from common.djangoapps.student.models import CourseEnrollment
from openedx.core.djangoapps.django_comment_c... | 33.76 | 98 | 0.716825 |
from django.core.management.base import BaseCommand
from common.djangoapps.student.models import CourseEnrollment
from openedx.core.djangoapps.django_comment_common.models import assign_default_role_on_enrollment
class Command(BaseCommand): help = 'Seed default permisssions and roles.'
def handle(self, *... | true | true |
f71017b7f644057a8140806f89c03842a4395186 | 1,962 | py | Python | notebooks/imgaug-playground.py | robertklee/SENG474-DataMining | 1996e263fb9a84d62ceab2b2402cbbcaf7a1e2d7 | [
"MIT"
] | 14 | 2021-03-09T06:38:39.000Z | 2022-03-11T16:21:46.000Z | notebooks/imgaug-playground.py | axjing/PoseEstimate | 85b6ff300e18320fe8b40c89d5f22fde51ba588e | [
"MIT"
] | 23 | 2021-03-07T20:50:50.000Z | 2022-01-17T04:01:08.000Z | notebooks/imgaug-playground.py | axjing/PoseEstimate | 85b6ff300e18320fe8b40c89d5f22fde51ba588e | [
"MIT"
] | 9 | 2021-04-13T16:21:44.000Z | 2022-02-23T06:08:30.000Z | import imgaug as ia
from imgaug import augmenters as iaa
import numpy as np
from scipy import misc
import imageio
import cv2
import imgaug as ia
import imgaug.augmenters as iaa
from imgaug.augmentables import Keypoint, KeypointsOnImage
ia.seed(1)
image = ia.quokka(size=(256, 256))
kps = KeypointsOnImage([
Keypo... | 27.25 | 75 | 0.667686 | import imgaug as ia
from imgaug import augmenters as iaa
import numpy as np
from scipy import misc
import imageio
import cv2
import imgaug as ia
import imgaug.augmenters as iaa
from imgaug.augmentables import Keypoint, KeypointsOnImage
ia.seed(1)
image = ia.quokka(size=(256, 256))
kps = KeypointsOnImage([
Keypo... | true | true |
f71018380534b07b785f0c1841cc61cff5c72b7b | 2,407 | py | Python | rllib/env/wrappers/tests/test_moab_wrapper.py | BonsaiAI/ray | 941d30f082fe879ea30618af14327c25b5a21a74 | [
"Apache-2.0"
] | 3 | 2021-06-22T19:57:41.000Z | 2021-06-23T07:16:44.000Z | rllib/env/wrappers/tests/test_moab_wrapper.py | BonsaiAI/ray | 941d30f082fe879ea30618af14327c25b5a21a74 | [
"Apache-2.0"
] | 26 | 2020-03-14T19:27:37.000Z | 2022-03-30T21:45:17.000Z | rllib/env/wrappers/tests/test_moab_wrapper.py | BonsaiAI/ray | 941d30f082fe879ea30618af14327c25b5a21a74 | [
"Apache-2.0"
] | 2 | 2021-05-05T21:05:16.000Z | 2021-06-22T21:16:03.000Z | from typing import Optional
import gym
import pytest
from ray.rllib.env.wrappers.moab_wrapper import _MoabBaseWrapper
from ray.tune.registry import ENV_CREATOR, _global_registry
@pytest.mark.parametrize("env_name, iterations",
[
("MoabMoveToCenterSim-v0", 10),
... | 33.901408 | 88 | 0.633153 | from typing import Optional
import gym
import pytest
from ray.rllib.env.wrappers.moab_wrapper import _MoabBaseWrapper
from ray.tune.registry import ENV_CREATOR, _global_registry
@pytest.mark.parametrize("env_name, iterations",
[
("MoabMoveToCenterSim-v0", 10),
... | true | true |
f7101a37da6bdc31a3c3985e7b25b86ddef44ed1 | 29,931 | py | Python | code/pyto/tomo/ctf.py | anmartinezs/pyseg_system | 5bb07c7901062452a34b73f376057cabc15a13c3 | [
"Apache-2.0"
] | 12 | 2020-01-08T01:33:02.000Z | 2022-03-16T00:25:34.000Z | code/pyto/tomo/ctf.py | anmartinezs/pyseg_system | 5bb07c7901062452a34b73f376057cabc15a13c3 | [
"Apache-2.0"
] | 8 | 2019-12-19T19:34:56.000Z | 2022-03-10T10:11:28.000Z | code/pyto/tomo/ctf.py | anmartinezs/pyseg_system | 5bb07c7901062452a34b73f376057cabc15a13c3 | [
"Apache-2.0"
] | 2 | 2022-03-30T13:12:22.000Z | 2022-03-30T18:12:10.000Z | """
Functions related to ctf.
Currently only few that allow running ctffind from console or notebook.
Work in progress.
# Author: Vladan Lucic (Max Planck Institute for Biochemistry)
# $Id$
"""
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from builtins... | 39.074413 | 80 | 0.558685 | from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from builtins import zip
from builtins import str
from builtins import range
from builtins import object
from past.utils import old_div
from past.builtins import basestring
__version__ = "$Revision$"
import o... | true | true |
f7101a83b95d3f574f2be24cf7bb5968d97a4765 | 3,783 | py | Python | examples/bengali/bengali_deepoffense_config.py | TharinduDR/DeepOffense | 8715006707ac0272cc534b3d6844ef10367400e9 | [
"Apache-2.0"
] | 5 | 2020-05-31T07:40:36.000Z | 2022-02-13T19:18:40.000Z | examples/greek/greek_deepoffense_config.py | TharinduDR/DeepOffense | 8715006707ac0272cc534b3d6844ef10367400e9 | [
"Apache-2.0"
] | null | null | null | examples/greek/greek_deepoffense_config.py | TharinduDR/DeepOffense | 8715006707ac0272cc534b3d6844ef10367400e9 | [
"Apache-2.0"
] | 2 | 2021-03-25T12:44:04.000Z | 2021-03-25T16:50:59.000Z | from multiprocessing import cpu_count
TEMP_DIRECTORY = "temp/data"
TRAIN_FILE = "train.tsv"
TEST_FILE = "test.tsv"
DEV_RESULT_FILE = "dev_result.tsv"
DEV_EVAL_FILE = 'dev_eval.txt'
RESULT_FILE = "result.csv"
SUBMISSION_FOLDER = "transformers"
SUBMISSION_FILE = "transformers"
MODEL_TYPE = "xlmroberta"
MODEL_NAME = "xlm... | 26.089655 | 106 | 0.665609 | from multiprocessing import cpu_count
TEMP_DIRECTORY = "temp/data"
TRAIN_FILE = "train.tsv"
TEST_FILE = "test.tsv"
DEV_RESULT_FILE = "dev_result.tsv"
DEV_EVAL_FILE = 'dev_eval.txt'
RESULT_FILE = "result.csv"
SUBMISSION_FOLDER = "transformers"
SUBMISSION_FILE = "transformers"
MODEL_TYPE = "xlmroberta"
MODEL_NAME = "xlm... | true | true |
f7101a8b865c1f87f28c1270c97bd9246634db2e | 69 | py | Python | emailtrail/__init__.py | akshaykmr/emailtrail | 8298e4b68c70f9b64198f54e4f3baf77d5fe54fa | [
"MIT"
] | 11 | 2020-04-05T07:24:46.000Z | 2021-01-10T06:58:00.000Z | emailtrail/__init__.py | akshaykmr/emailtrail | 8298e4b68c70f9b64198f54e4f3baf77d5fe54fa | [
"MIT"
] | 1 | 2021-09-09T16:46:18.000Z | 2021-09-09T16:46:18.000Z | emailtrail/__init__.py | akshaykmr/emailtrail | 8298e4b68c70f9b64198f54e4f3baf77d5fe54fa | [
"MIT"
] | 1 | 2020-10-26T17:50:10.000Z | 2020-10-26T17:50:10.000Z | from .module import * # noqa
from .models import Trail, Hop # noqa
| 17.25 | 37 | 0.695652 | from .module import *
from .models import Trail, Hop | true | true |
f7101aab8fc3aaf31dfafe13235193eac5d70266 | 8,534 | py | Python | psi/controller/engine.py | bburan/psiexperiment | 9b70f7f0b4a4379d8c3fc463e1df272153afd247 | [
"MIT"
] | 5 | 2016-05-26T13:46:00.000Z | 2020-03-03T13:07:47.000Z | psi/controller/engine.py | bburan/psiexperiment | 9b70f7f0b4a4379d8c3fc463e1df272153afd247 | [
"MIT"
] | 2 | 2018-04-17T15:06:35.000Z | 2019-03-25T18:13:10.000Z | psi/controller/engine.py | bburan/psiexperiment | 9b70f7f0b4a4379d8c3fc463e1df272153afd247 | [
"MIT"
] | 1 | 2016-05-28T19:36:38.000Z | 2016-05-28T19:36:38.000Z | import logging
log = logging.getLogger(__name__)
import threading
import numpy as np
from atom.api import (Unicode, Float, Bool, observe, Property, Int, Typed,
Long, Value)
from enaml.core.api import Declarative, d_
from psi.core.enaml.api import PSIContribution
from ..util import copy_declara... | 35.707113 | 80 | 0.639325 | import logging
log = logging.getLogger(__name__)
import threading
import numpy as np
from atom.api import (Unicode, Float, Bool, observe, Property, Int, Typed,
Long, Value)
from enaml.core.api import Declarative, d_
from psi.core.enaml.api import PSIContribution
from ..util import copy_declara... | true | true |
f7101b9b13578e8edd6324341c1a4a1243423eca | 1,967 | py | Python | model.py | adinahhh/educated-citizen | 057406bbe4b348a88aeeed91bafbf337666d33ce | [
"Unlicense"
] | 1 | 2020-03-06T19:41:59.000Z | 2020-03-06T19:41:59.000Z | model.py | adinahhh/ballot-project | 057406bbe4b348a88aeeed91bafbf337666d33ce | [
"Unlicense"
] | 5 | 2020-03-24T18:21:24.000Z | 2021-08-23T20:39:22.000Z | model.py | adinahhh/ballot-project | 057406bbe4b348a88aeeed91bafbf337666d33ce | [
"Unlicense"
] | 1 | 2020-03-27T17:21:25.000Z | 2020-03-27T17:21:25.000Z | """Models for final hackbright project """
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
app = Flask(__name__)
class Legislator(db.Model):
""" Info on current legislators. """
__tablename__ = "current_legislators"
legislator_id = db.Column(db.Integer, autoincrement=T... | 33.913793 | 79 | 0.675648 |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
app = Flask(__name__)
class Legislator(db.Model):
__tablename__ = "current_legislators"
legislator_id = db.Column(db.Integer, autoincrement=True, primary_key=True)
last_name = db.Column(db.String(25), nullable=False)
... | true | true |
f7101db4a3c92bf5fa914e5b238683710b1a59e8 | 827 | py | Python | server/clothes_shop/urls.py | Meerkat007/Clothes-Shop-Website- | 0f5f113c49b550a593ea50c8d409e9228381a81b | [
"MIT"
] | null | null | null | server/clothes_shop/urls.py | Meerkat007/Clothes-Shop-Website- | 0f5f113c49b550a593ea50c8d409e9228381a81b | [
"MIT"
] | null | null | null | server/clothes_shop/urls.py | Meerkat007/Clothes-Shop-Website- | 0f5f113c49b550a593ea50c8d409e9228381a81b | [
"MIT"
] | null | null | null | """clothes_shop URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... | 35.956522 | 79 | 0.70133 | from django.conf.urls import url, include
from django.contrib import admin
urlpatterns = [
url(r'^products/', include('products.urls')),
url(r'^admin/', admin.site.urls),
]
| true | true |
f7101e05d6aa3f6fae0e0f1f853fa0dab34e1ab0 | 8,060 | py | Python | sdk/storage/azure-storage-blob/azure/storage/blob/_deserialize.py | vincenttran-msft/azure-sdk-for-python | 348b56f9f03eeb3f7b502eed51daf494ffff874d | [
"MIT"
] | 2,728 | 2015-01-09T10:19:32.000Z | 2022-03-31T14:50:33.000Z | sdk/storage/azure-storage-blob/azure/storage/blob/_deserialize.py | v-xuto/azure-sdk-for-python | 9c6296d22094c5ede410bc83749e8df8694ccacc | [
"MIT"
] | 17,773 | 2015-01-05T15:57:17.000Z | 2022-03-31T23:50:25.000Z | sdk/storage/azure-storage-blob/azure/storage/blob/_deserialize.py | v-xuto/azure-sdk-for-python | 9c6296d22094c5ede410bc83749e8df8694ccacc | [
"MIT"
] | 1,916 | 2015-01-19T05:05:41.000Z | 2022-03-31T19:36:44.000Z | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
# pylint: ... | 46.057143 | 138 | 0.735732 | from typing import ( Tuple, Dict, List,
TYPE_CHECKING
)
try:
from urllib.parse import unquote
except ImportError:
from urllib import unquote
from ._models import BlobType, CopyProperties, ContentSettings, LeaseProperties, BlobProperties, ImmutabilityPolicy
from ._shared.models import get_enum_value
fro... | true | true |
f71020a081e97b8e419611b4ff2a1a7fefc0a0c9 | 2,253 | py | Python | setup.py | SCECcode/ucvm_plotting | 0fad66043c81bdc5e616f87020f38177bdae9503 | [
"BSD-3-Clause"
] | null | null | null | setup.py | SCECcode/ucvm_plotting | 0fad66043c81bdc5e616f87020f38177bdae9503 | [
"BSD-3-Clause"
] | 4 | 2021-11-30T08:28:42.000Z | 2022-03-07T21:27:14.000Z | setup.py | SCECcode/ucvm_plotting | 0fad66043c81bdc5e616f87020f38177bdae9503 | [
"BSD-3-Clause"
] | 1 | 2021-06-05T03:28:51.000Z | 2021-06-05T03:28:51.000Z | """
@file setup.py
@brief Build and install the pycvm
@author The SCEC/UCVM Developers - <software@scec.usc.edu>
"""
from setuptools import setup
NAME = "ucvm_plotting"
FULLNAME = "ucvm_plotting with pycvm"
AUTHOR = "The SCEC/UCVM Developers"
AUTHOR_EMAIL = "software@scec.usc.edu"
MAINTAINER = AUTHOR
MAINTAIN... | 33.132353 | 89 | 0.717266 |
from setuptools import setup
NAME = "ucvm_plotting"
FULLNAME = "ucvm_plotting with pycvm"
AUTHOR = "The SCEC/UCVM Developers"
AUTHOR_EMAIL = "software@scec.usc.edu"
MAINTAINER = AUTHOR
MAINTAINER_EMAIL = AUTHOR_EMAIL
LICENSE = "Apache 2.0 license"
URL = "https://github.com/SCEC/ucvm_plotting"
DESCRIPTION = "Python c... | true | true |
f71022c75b49c0c56102043edb4100618ba8208a | 348 | py | Python | models.py | ashelto6/unJumble | cf557668133186e7ea419f6f08ccadef4cad89a1 | [
"MIT"
] | null | null | null | models.py | ashelto6/unJumble | cf557668133186e7ea419f6f08ccadef4cad89a1 | [
"MIT"
] | 7 | 2021-02-26T07:31:12.000Z | 2021-04-25T03:21:35.000Z | models.py | ashelto6/unJumble | cf557668133186e7ea419f6f08ccadef4cad89a1 | [
"MIT"
] | null | null | null | from flask_login import UserMixin
from . import db
#run the creat_all() command to create the database
class User(UserMixin, db.Model):
id = db.Column(db.Integer, primary_key=True)
last_name = db.Column(db.String(100))
first_name = db.Column(db.String(100))
email = db.Column(db.String(100), unique=True)
password... | 31.636364 | 51 | 0.747126 | from flask_login import UserMixin
from . import db
class User(UserMixin, db.Model):
id = db.Column(db.Integer, primary_key=True)
last_name = db.Column(db.String(100))
first_name = db.Column(db.String(100))
email = db.Column(db.String(100), unique=True)
password = db.Column(db.String(100)) | true | true |
f71022f0eb2883e2876c9b9966ee83e21f069013 | 6,566 | py | Python | cookiecutter_mbam/scan/service.py | tiburona/cookiecutter_mbam | 13788774a4c1426c133b3f689f98d8f0c54de9c6 | [
"BSD-3-Clause"
] | null | null | null | cookiecutter_mbam/scan/service.py | tiburona/cookiecutter_mbam | 13788774a4c1426c133b3f689f98d8f0c54de9c6 | [
"BSD-3-Clause"
] | null | null | null | cookiecutter_mbam/scan/service.py | tiburona/cookiecutter_mbam | 13788774a4c1426c133b3f689f98d8f0c54de9c6 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""Scan service.
This module implements uploading a scan file to XNAT and adding a scan to the database.
Todo: Maybe the public method should be called add, and that should kick off an upload procedure, rather than the
other way around.
Todo: do we want to infer file type from extension? Or ... | 38.397661 | 120 | 0.655955 | import os
from cookiecutter_mbam.xnat import XNATConnection
from cookiecutter_mbam.experiment import Experiment
from cookiecutter_mbam.user import User
from .models import Scan
from .utils import gzip_file
from flask import current_app
def debug():
assert current_app.debug == False, "Don't panic! You're here by re... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.