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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f7426acd9ed9d383a67a48a875aee6ad233e48fd | 440 | py | Python | pgAdmin/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/__init__.py | WeilerWebServices/PostgreSQL | ae594ed077bebbad1be3c1d95c38b7c2c2683e8c | [
"PostgreSQL"
] | null | null | null | pgAdmin/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/__init__.py | WeilerWebServices/PostgreSQL | ae594ed077bebbad1be3c1d95c38b7c2c2683e8c | [
"PostgreSQL"
] | null | null | null | pgAdmin/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/tests/__init__.py | WeilerWebServices/PostgreSQL | ae594ed077bebbad1be3c1d95c38b7c2c2683e8c | [
"PostgreSQL"
] | null | null | null | ##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2020, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##########################################################################
from pgadmin.util... | 27.5 | 74 | 0.497727 | true | true | |
f7426bb7b63089a7636636d8b6cebd792e58acab | 5,976 | py | Python | docs/conf.py | sho-87/pyutils_sh | 46b08775b92c294f2be1f53c63fb18932e8a56e0 | [
"MIT"
] | null | null | null | docs/conf.py | sho-87/pyutils_sh | 46b08775b92c294f2be1f53c63fb18932e8a56e0 | [
"MIT"
] | 2 | 2018-04-02T21:41:04.000Z | 2018-04-17T09:27:39.000Z | docs/conf.py | sho-87/pyutils_sh | 46b08775b92c294f2be1f53c63fb18932e8a56e0 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# pyutils_sh documentation build configuration file, created by
# sphinx-quickstart on Thu Mar 15 22:24:38 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
#... | 29.294118 | 79 | 0.684739 |
import os
import re
import sys
sys.path.insert(0, os.path.abspath('../'))
from mock import Mock as MagicMock
class Mock(MagicMock):
@classmethod
def __getattr__(cls, name):
return MagicMock()
MOCK_MODULES = ['numpy', 'matplotlib', 'matplotlib.pyplot', 'pandas']
sys.modules.up... | true | true |
f7426c1dd463a6af7dd4062199632feb129e506d | 3,186 | py | Python | tests/test_abi.py | DmitIv/EVMScriptParser | 2a565cffb9cd890b9ded1978727364270150a72a | [
"MIT"
] | null | null | null | tests/test_abi.py | DmitIv/EVMScriptParser | 2a565cffb9cd890b9ded1978727364270150a72a | [
"MIT"
] | null | null | null | tests/test_abi.py | DmitIv/EVMScriptParser | 2a565cffb9cd890b9ded1978727364270150a72a | [
"MIT"
] | null | null | null | """Tests of getting ABI from different sources."""
import os
from collections import namedtuple
import pytest
from evmscript_parser.core.ABI import get_cached_combined
from evmscript_parser.core.ABI.storage import CachedStorage, ABIKey
from evmscript_parser.core.decode import decode_function_call
CUR_DIR = os.path.d... | 28.446429 | 70 | 0.684557 | import os
from collections import namedtuple
import pytest
from evmscript_parser.core.ABI import get_cached_combined
from evmscript_parser.core.ABI.storage import CachedStorage, ABIKey
from evmscript_parser.core.decode import decode_function_call
CUR_DIR = os.path.dirname(os.path.abspath(__file__))
INTERFACES = os.p... | true | true |
f7426cb1ed0289c2b03e24f5436c10e5dff16777 | 4,560 | py | Python | sudoku_solver.py | a-m-frantz/sudoku-solver | cb1ce01edf600ff9bb7b6b6d0d3938880765a49a | [
"MIT"
] | null | null | null | sudoku_solver.py | a-m-frantz/sudoku-solver | cb1ce01edf600ff9bb7b6b6d0d3938880765a49a | [
"MIT"
] | null | null | null | sudoku_solver.py | a-m-frantz/sudoku-solver | cb1ce01edf600ff9bb7b6b6d0d3938880765a49a | [
"MIT"
] | null | null | null | import time
import algorithms as alg
import puzzle as pzl
class ClueError(Exception):
"""Exception thrown when a puzzle doesn't have enough clues, less than 17, to solve it."""
def __init__(self, file_name, num_clues):
self.file_name = file_name
self.num_clues = num_clues
def parse_file(fil... | 32.340426 | 120 | 0.604167 | import time
import algorithms as alg
import puzzle as pzl
class ClueError(Exception):
def __init__(self, file_name, num_clues):
self.file_name = file_name
self.num_clues = num_clues
def parse_file(file_name):
infile = open(file_name)
file_contents = infile.read()
puzzle_list = [char... | true | true |
f7426d8f38f59f1c51eca58c8afb5231b14a069f | 115,701 | py | Python | statsmodels/discrete/discrete_model.py | bert9bert/statsmodels | 898ddfc483c45bb0f8e5156dd8506abda84c9b63 | [
"BSD-3-Clause"
] | 1 | 2017-11-13T17:13:04.000Z | 2017-11-13T17:13:04.000Z | statsmodels/discrete/discrete_model.py | bert9bert/statsmodels | 898ddfc483c45bb0f8e5156dd8506abda84c9b63 | [
"BSD-3-Clause"
] | null | null | null | statsmodels/discrete/discrete_model.py | bert9bert/statsmodels | 898ddfc483c45bb0f8e5156dd8506abda84c9b63 | [
"BSD-3-Clause"
] | null | null | null | """
Limited dependent variable and qualitative variables.
Includes binary outcomes, count data, (ordered) ordinal data and limited
dependent variables.
General References
--------------------
A.C. Cameron and P.K. Trivedi. `Regression Analysis of Count Data`.
Cambridge, 1998
G.S. Madalla. `Limited-Dependent an... | 36.429786 | 401 | 0.579321 | from __future__ import division
__all__ = ["Poisson", "Logit", "Probit", "MNLogit", "NegativeBinomial"]
from statsmodels.compat.python import lmap, lzip, range
import numpy as np
from scipy.special import gammaln
from scipy import stats, special, optimize
import statsmodels.tools.tools as tools
from statsmodels.too... | true | true |
f7426e21f6e940d5d7943eee6255df17e7518ab5 | 6,857 | py | Python | tests/test_signature.py | Darel13712/typesentry | c5a43920716e06e721d1c06b0ffb4b80b4706c9c | [
"Apache-2.0"
] | 18 | 2017-02-02T19:04:56.000Z | 2022-01-21T12:45:39.000Z | tests/test_signature.py | Darel13712/typesentry | c5a43920716e06e721d1c06b0ffb4b80b4706c9c | [
"Apache-2.0"
] | 11 | 2017-01-28T00:43:15.000Z | 2021-02-16T11:37:14.000Z | tests/test_signature.py | Darel13712/typesentry | c5a43920716e06e721d1c06b0ffb4b80b4706c9c | [
"Apache-2.0"
] | 5 | 2017-08-05T10:11:41.000Z | 2021-11-28T21:15:07.000Z | #!/usr/bin/env python
# Copyright 2017 H2O.ai; Apache License Version 2.0; -*- encoding: utf-8 -*-
import pytest
import time
from tests import typed, py3only, TTypeError
# Stub
def foo():
return False
def test_func_0args0kws():
@typed()
def foo():
return True
assert foo()
with pytest.r... | 25.778195 | 79 | 0.552428 |
import pytest
import time
from tests import typed, py3only, TTypeError
def foo():
return False
def test_func_0args0kws():
@typed()
def foo():
return True
assert foo()
with pytest.raises(TTypeError) as e:
foo(1)
assert str(e.value) == "`foo()` doesn't take any arguments"
... | true | true |
f7426ea00976e99a807367df8f057a858b319b91 | 7,958 | py | Python | example/Bayesian/More advanced examples with FE models - Sfepy/material_homogenization.py | volpatto/UQpy | acbe1d6e655e98917f56b324f019881ea9ccca82 | [
"MIT"
] | 1 | 2020-09-03T12:10:39.000Z | 2020-09-03T12:10:39.000Z | example/Bayesian/More advanced examples with FE models - Sfepy/material_homogenization.py | volpatto/UQpy | acbe1d6e655e98917f56b324f019881ea9ccca82 | [
"MIT"
] | null | null | null | example/Bayesian/More advanced examples with FE models - Sfepy/material_homogenization.py | volpatto/UQpy | acbe1d6e655e98917f56b324f019881ea9ccca82 | [
"MIT"
] | 1 | 2021-04-04T14:17:55.000Z | 2021-04-04T14:17:55.000Z | #!/usr/bin/env python
# This code was adapted from http://sfepy.org/doc-devel/mat_optim.html.
from __future__ import print_function
from __future__ import absolute_import
import sys
sys.path.append('.')
import matplotlib as mlp
import matplotlib.pyplot as plt
from matplotlib.collections import PolyCollection
from mp... | 36.3379 | 93 | 0.574265 |
from __future__ import print_function
from __future__ import absolute_import
import sys
sys.path.append('.')
import matplotlib as mlp
import matplotlib.pyplot as plt
from matplotlib.collections import PolyCollection
from mpl_toolkits.mplot3d.art3d import Poly3DCollection, Line3DCollection
import numpy as np
from... | true | true |
f7426f0017f32ec75b885f227c879785e634d9bf | 1,032 | py | Python | runtests.py | gosuai/django-tinylinks | 6506f3950240542431787e1d18fe39ec73d767f2 | [
"MIT"
] | 11 | 2016-11-27T15:46:42.000Z | 2021-07-31T14:03:54.000Z | runtests.py | gosuai/django-tinylinks | 6506f3950240542431787e1d18fe39ec73d767f2 | [
"MIT"
] | 2 | 2016-12-27T19:53:59.000Z | 2017-05-26T07:12:02.000Z | runtests.py | gosuai/django-tinylinks | 6506f3950240542431787e1d18fe39ec73d767f2 | [
"MIT"
] | 5 | 2015-02-01T01:10:31.000Z | 2015-10-29T18:48:59.000Z | #!/usr/bin/env python
"""
This script is used to run tests, create a coverage report and output the
statistics at the end of the tox run.
To run this script just execute ``tox``
"""
import re
from fabric.api import local, warn
from fabric.colors import green, red
if __name__ == '__main__':
local('flake8 --ignore... | 38.222222 | 75 | 0.653101 |
import re
from fabric.api import local, warn
from fabric.colors import green, red
if __name__ == '__main__':
local('flake8 --ignore=E126 --ignore=W391 --statistics'
' --exclude=submodules,migrations,south_migrations,build,.tox .')
local('coverage run --source="tinylinks" manage.py test -v 2'
... | true | true |
f742704a41eabf26010f1d565068c7d4ce2d9bd4 | 2,698 | py | Python | example/exampleapp/settings.py | The-Politico/politico-civic-demography | 080bb964b64b06db7fd04386530e893ceed1cf98 | [
"MIT"
] | null | null | null | example/exampleapp/settings.py | The-Politico/politico-civic-demography | 080bb964b64b06db7fd04386530e893ceed1cf98 | [
"MIT"
] | null | null | null | example/exampleapp/settings.py | The-Politico/politico-civic-demography | 080bb964b64b06db7fd04386530e893ceed1cf98 | [
"MIT"
] | null | null | null | import os
import dj_database_url
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = os.getenv('SECRET_KEY', 'SECRET')
DEBUG = True
ALLOWED_HOSTS = ['*']
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contri... | 25.214953 | 91 | 0.685322 | import os
import dj_database_url
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = os.getenv('SECRET_KEY', 'SECRET')
DEBUG = True
ALLOWED_HOSTS = ['*']
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contri... | true | true |
f7427169a65d13a6832b4c97e1dcd763825a3aab | 33,583 | bzl | Python | packages/typescript/internal/ts_project.bzl | matthewjh/rules_nodejs | 77b712b81041460389da88f063c62906b11047f9 | [
"Apache-2.0"
] | null | null | null | packages/typescript/internal/ts_project.bzl | matthewjh/rules_nodejs | 77b712b81041460389da88f063c62906b11047f9 | [
"Apache-2.0"
] | null | null | null | packages/typescript/internal/ts_project.bzl | matthewjh/rules_nodejs | 77b712b81041460389da88f063c62906b11047f9 | [
"Apache-2.0"
] | null | null | null | "ts_project rule"
load("@build_bazel_rules_nodejs//:providers.bzl", "DeclarationInfo", "ExternalNpmPackageInfo", "declaration_info", "js_module_info", "run_node")
load("@build_bazel_rules_nodejs//internal/linker:link_node_modules.bzl", "module_mappings_aspect")
load("@build_bazel_rules_nodejs//internal/node:node.bzl",... | 44.71771 | 144 | 0.648781 |
load("@build_bazel_rules_nodejs//:providers.bzl", "DeclarationInfo", "ExternalNpmPackageInfo", "declaration_info", "js_module_info", "run_node")
load("@build_bazel_rules_nodejs//internal/linker:link_node_modules.bzl", "module_mappings_aspect")
load("@build_bazel_rules_nodejs//internal/node:node.bzl", "nodejs_binary")
... | true | true |
f74271ee9e3e73fc3412b9b20a3c52140869efb8 | 9,076 | py | Python | plugins/login.py | MANYDOWN/Check2 | f74c280f5959d3ff8f2482483f7db28267faa454 | [
"MIT"
] | null | null | null | plugins/login.py | MANYDOWN/Check2 | f74c280f5959d3ff8f2482483f7db28267faa454 | [
"MIT"
] | null | null | null | plugins/login.py | MANYDOWN/Check2 | f74c280f5959d3ff8f2482483f7db28267faa454 | [
"MIT"
] | null | null | null | #MIT License
#Copyright (c) 2021 subinps
#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, dis... | 48.276596 | 422 | 0.660423 |
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
from pyrogram import Client, filters
from config import Config
from utils import *
import os
from instaloader import Profile, TwoFactorAuthRequiredException, BadCredentialsException
from asyncio.exceptions import TimeoutError
U... | true | true |
f74272937512fdd4ba41abdf9c5400f15372b82a | 7,854 | py | Python | ExplicitIntegration/Integration/ode_cfl_1.py | robotsorcerer/LevelSetPy | 54064ee7fd0144e0d658dd4f6121cbc1fda664b9 | [
"MIT"
] | 4 | 2022-03-14T07:04:08.000Z | 2022-03-14T18:08:56.000Z | ExplicitIntegration/Integration/ode_cfl_1.py | robotsorcerer/LevelSetPy | 54064ee7fd0144e0d658dd4f6121cbc1fda664b9 | [
"MIT"
] | null | null | null | ExplicitIntegration/Integration/ode_cfl_1.py | robotsorcerer/LevelSetPy | 54064ee7fd0144e0d658dd4f6121cbc1fda664b9 | [
"MIT"
] | null | null | null | __all__ = ["odeCFL1"]
import cupy as cp
import numpy as np
from LevelSetPy.Utilities import *
from .ode_cfl_set import odeCFLset
from .ode_cfl_call import odeCFLcallPostTimestep
def odeCFL1(schemeFunc, tspan, y0, options=None, schemeData=None):
"""
odeCFL1: integrate a CFL constrained ODE (eg a PDE by method... | 44.88 | 95 | 0.567354 | __all__ = ["odeCFL1"]
import cupy as cp
import numpy as np
from LevelSetPy.Utilities import *
from .ode_cfl_set import odeCFLset
from .ode_cfl_call import odeCFLcallPostTimestep
def odeCFL1(schemeFunc, tspan, y0, options=None, schemeData=None):
small = 100 * eps
if not options:
options = ode... | true | true |
f74272e61f165c4f989d645e572aa9f777606d85 | 3,620 | py | Python | tests/superset_test_config.py | venter-zhu/incubator-superset | 329e72885c20d3a36f70dbe2909c4665f51ec92f | [
"Apache-2.0"
] | 1 | 2020-11-05T11:16:15.000Z | 2020-11-05T11:16:15.000Z | tests/superset_test_config.py | venter-zhu/incubator-superset | 329e72885c20d3a36f70dbe2909c4665f51ec92f | [
"Apache-2.0"
] | 38 | 2020-11-23T22:26:13.000Z | 2022-02-17T07:39:23.000Z | tests/superset_test_config.py | venter-zhu/incubator-superset | 329e72885c20d3a36f70dbe2909c4665f51ec92f | [
"Apache-2.0"
] | null | null | null | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 33.831776 | 95 | 0.75663 |
from copy import copy
from superset.config import *
from tests.superset_test_custom_template_processors import CustomPrestoTemplateProcessor
AUTH_USER_REGISTRATION_ROLE = "alpha"
SQLALCHEMY_DATABASE_URI = "sqlite:///" + os.path.join(DATA_DIR, "unittests.db")
DEBUG = True
SUPERSET_WEBSERVER_PORT = 808... | true | true |
f74272f2102efa9e33e0fb26dd4b0aa3c1827cfd | 56 | py | Python | pybio/torch/training/__init__.py | kiryteo/pytorch-bioimage-io | 53373c45d3833b35657914953aaac544ec794a7e | [
"MIT"
] | null | null | null | pybio/torch/training/__init__.py | kiryteo/pytorch-bioimage-io | 53373c45d3833b35657914953aaac544ec794a7e | [
"MIT"
] | null | null | null | pybio/torch/training/__init__.py | kiryteo/pytorch-bioimage-io | 53373c45d3833b35657914953aaac544ec794a7e | [
"MIT"
] | null | null | null | from pybio.torch.training.simple import simple_training
| 28 | 55 | 0.875 | from pybio.torch.training.simple import simple_training
| true | true |
f742730705505435f4472f6c28499babb770a1b9 | 4,658 | py | Python | test/test_gpu4.py | whong92/3D_DL | 3c15bca3cc87c3197d38a785f6d1146911a82921 | [
"MIT"
] | 35 | 2019-03-04T00:06:20.000Z | 2022-02-04T22:34:17.000Z | test/test_gpu4.py | 921kiyo/C530 | e64402575661a1e534cb8effe122d8fe8aed156e | [
"MIT"
] | 3 | 2021-03-12T13:12:26.000Z | 2022-01-17T08:47:49.000Z | test/test_gpu4.py | 921kiyo/C530 | e64402575661a1e534cb8effe122d8fe8aed156e | [
"MIT"
] | 12 | 2019-09-26T08:35:18.000Z | 2021-12-09T05:39:59.000Z | import sys
import os
import pathlib
import unittest
import coverage
import argparse
import subprocess
import site
# Ensure source directory is in python path
project_dir = str(pathlib.Path(__file__).parents[1].resolve())
sys.path.append(os.path.join(project_dir, 'src'))
# for keras
sys.path.append(project_dir)
""" -... | 35.830769 | 109 | 0.706526 | import sys
import os
import pathlib
import unittest
import coverage
import argparse
import subprocess
import site
project_dir = str(pathlib.Path(__file__).parents[1].resolve())
sys.path.append(os.path.join(project_dir, 'src'))
sys.path.append(project_dir)
parser = argparse.ArgumentParser(description='Run all Ocado... | true | true |
f742748602b33f51d0e900a1e4eefca8630ef688 | 6,549 | py | Python | examples/dataset.py | siqim/Machine-Learning-with-Graphs | 697d83bb206be0825ebaf0dad128b9eb24908705 | [
"MIT"
] | 13 | 2021-01-14T18:58:38.000Z | 2022-03-29T04:11:53.000Z | examples/dataset.py | siqim/Machine-Learning-with-Graphs | 697d83bb206be0825ebaf0dad128b9eb24908705 | [
"MIT"
] | null | null | null | examples/dataset.py | siqim/Machine-Learning-with-Graphs | 697d83bb206be0825ebaf0dad128b9eb24908705 | [
"MIT"
] | 6 | 2021-06-01T06:46:37.000Z | 2022-03-29T04:13:50.000Z | # -*- coding: utf-8 -*-
"""
Created on December 30, 2020
@author: Siqi Miao
"""
import torch
from torch_sparse import SparseTensor
import torch_geometric.transforms as T
from pathlib2 import Path
import scipy.io as sio
from sklearn.metrics import f1_score, accuracy_score
from sklearn.model_selection import train_te... | 37.422857 | 114 | 0.596427 |
import torch
from torch_sparse import SparseTensor
import torch_geometric.transforms as T
from pathlib2 import Path
import scipy.io as sio
from sklearn.metrics import f1_score, accuracy_score
from sklearn.model_selection import train_test_split
from skmultilearn.model_selection import iterative_train_test_split
fro... | true | true |
f74274e0418d689e587201a71f8ad10ffe2788e3 | 908 | py | Python | src/train.py | dendisuhubdy/deep_learning_project_skeleton | 325f6e7ec154d93550b0b1e9df8a8a063cedb10a | [
"BSD-3-Clause"
] | 1 | 2020-04-07T16:56:47.000Z | 2020-04-07T16:56:47.000Z | src/train.py | dendisuhubdy/deep_learning_project_skeleton | 325f6e7ec154d93550b0b1e9df8a8a063cedb10a | [
"BSD-3-Clause"
] | null | null | null | src/train.py | dendisuhubdy/deep_learning_project_skeleton | 325f6e7ec154d93550b0b1e9df8a8a063cedb10a | [
"BSD-3-Clause"
] | 1 | 2020-04-07T16:56:47.000Z | 2020-04-07T16:56:47.000Z | """
Copyrigt Dendi Suhubdy, 2018
All rights reserved
"""
from loss import loss_function
def train(args, model, optimizer, train_loader, device, epoch):
model.train()
train_loss = 0
for batch_idx, (data, _) in enumerate(train_loader):
data = data.to(device)
optimizer.zero_grad()
r... | 31.310345 | 75 | 0.585903 | from loss import loss_function
def train(args, model, optimizer, train_loader, device, epoch):
model.train()
train_loss = 0
for batch_idx, (data, _) in enumerate(train_loader):
data = data.to(device)
optimizer.zero_grad()
recon_batch, mu, logvar = model(data)
loss = loss_fu... | true | true |
f74274ed9c198191139ae6816119fd4ce465103b | 2,730 | py | Python | problem-146-lru-cache/lrucache.py | starovp/leetcode-sols | e4b660e1fd70ad3fc1fc54e8a224549d46295a26 | [
"MIT"
] | null | null | null | problem-146-lru-cache/lrucache.py | starovp/leetcode-sols | e4b660e1fd70ad3fc1fc54e8a224549d46295a26 | [
"MIT"
] | null | null | null | problem-146-lru-cache/lrucache.py | starovp/leetcode-sols | e4b660e1fd70ad3fc1fc54e8a224549d46295a26 | [
"MIT"
] | null | null | null | """
146. LRU Cache
Design and implement a data structure for Least Recently Used (LRU) cache.
It should support the following operations: get and put.
get(key) - Get the value (will always be positive) of the key if
the key exists in the cache, otherwise return -1.
put(key, value) - Set or insert the value if the ... | 30 | 85 | 0.627106 |
class DoubleNode:
def __init__(self, key, value):
self.prev = None
self.next = None
self.key = key
self.value = value
class LRUCache:
def __init__(self, capacity):
self.dict = {}
self.capacity = capacity
self.head = DoubleNode(0,0)
self.tail... | true | true |
f74275961d4ee932fedc0e858990284e1138afc9 | 5,731 | py | Python | pysh/shell/builtin.py | yunabe/pysh | 86ec6f2253e9b57ffe59b21bc311c8ef3da8abee | [
"BSD-3-Clause"
] | 41 | 2015-01-31T15:02:09.000Z | 2021-11-16T13:45:13.000Z | pysh/shell/builtin.py | yunabe/pysh | 86ec6f2253e9b57ffe59b21bc311c8ef3da8abee | [
"BSD-3-Clause"
] | 1 | 2018-01-31T13:07:26.000Z | 2018-01-31T13:07:26.000Z | pysh/shell/builtin.py | yunabe/pysh | 86ec6f2253e9b57ffe59b21bc311c8ef3da8abee | [
"BSD-3-Clause"
] | 6 | 2016-02-15T14:39:42.000Z | 2020-05-21T23:19:37.000Z | import collections
import csv
import datetime
import grp
import os
import stat
import optparse
import pwd
import StringIO
import sys
from pysh.shell.pycmd import register_pycmd
from pysh.shell.pycmd import pycmd
from pysh.shell.pycmd import IOType
from pysh.shell.table import PyshTable, CreateTableFromIterableRows
# ... | 25.358407 | 79 | 0.649625 | import collections
import csv
import datetime
import grp
import os
import stat
import optparse
import pwd
import StringIO
import sys
from pysh.shell.pycmd import register_pycmd
from pysh.shell.pycmd import pycmd
from pysh.shell.pycmd import IOType
from pysh.shell.table import PyshTable, CreateTableFromIterableRows
... | false | true |
f742775a538a6b1d8c32076b570e8b275b47bd38 | 3,029 | py | Python | leetcode/lessons/stack/133_clone_graph/__init__.py | wangkuntian/leetcode | e8dc9c8032c805a7d071ad19b94841ee8e52e834 | [
"MIT"
] | null | null | null | leetcode/lessons/stack/133_clone_graph/__init__.py | wangkuntian/leetcode | e8dc9c8032c805a7d071ad19b94841ee8e52e834 | [
"MIT"
] | 2 | 2020-03-24T18:00:21.000Z | 2020-03-26T11:33:51.000Z | leetcode/lessons/stack/133_clone_graph/__init__.py | wangkuntian/leetcode | e8dc9c8032c805a7d071ad19b94841ee8e52e834 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__project__ = 'leetcode'
__file__ = '__init__.py'
__author__ = 'king'
__time__ = '2020/2/23 21:09'
_ooOoo_
o8888888o
88" . "88
(| -_- |)
... | 22.437037 | 69 | 0.427204 |
class Node(object):
def __init__(self, val: int, neighbors: []):
if neighbors is None:
neighbors = [int]
self.val = val
self.neighbors = neighbors
class Solution(object):
def cloneGraph(self, node):
if not node:
return
cloned_start = Node(... | true | true |
f74277f949ce89661862baf2ef2fdd5c4d6c7ed4 | 8,601 | py | Python | plants/non_wood_biomass/non_wood_biomass.py | yinonbaron/biomass_distribution | 783a8d2f59754bde9b0ea802512b131abbe7d8a0 | [
"MIT"
] | 1 | 2021-05-17T13:55:48.000Z | 2021-05-17T13:55:48.000Z | plants/non_wood_biomass/non_wood_biomass.py | yinonbaron/biomass_distribution | 783a8d2f59754bde9b0ea802512b131abbe7d8a0 | [
"MIT"
] | null | null | null | plants/non_wood_biomass/non_wood_biomass.py | yinonbaron/biomass_distribution | 783a8d2f59754bde9b0ea802512b131abbe7d8a0 | [
"MIT"
] | 2 | 2018-01-10T08:53:35.000Z | 2021-05-17T13:55:50.000Z |
# coding: utf-8
# # Estimating the fraction of plant biomass which is not woody
# To estimate the total non-woody plant biomass, we rely on two methods. The first is to estimate the global average leaf and root mass fractions, and the second is by estimating the total biomass of roots and leaves.
#
# ## Method1 - fr... | 46.241935 | 444 | 0.76433 |
action_helper import *
fractions = pd.read_excel('non_wood_biomass_data.xlsx','Poorter',skiprows=1,index_col=0)
fractions
biomes = pd.read_excel('non_wood_biomass_data.xlsx','Erb',skiprows=1)
biomes
non_wood_frac = (fractions['LMF']+fractions['RMF'])/fractions.sum(axis=1)
tot_biomass = biomes.group... | true | true |
f742792c21e6a920b532f8bdbe99797aeaca732f | 866 | py | Python | Library Management System/Book.py | AtharvaJoshi21/PythonPOC | 6b95eb5bab7b28e9811e43b39e863faf2ee7565b | [
"MIT"
] | 1 | 2019-04-27T15:37:04.000Z | 2019-04-27T15:37:04.000Z | Library Management System/Book.py | AtharvaJoshi21/PythonPOC | 6b95eb5bab7b28e9811e43b39e863faf2ee7565b | [
"MIT"
] | null | null | null | Library Management System/Book.py | AtharvaJoshi21/PythonPOC | 6b95eb5bab7b28e9811e43b39e863faf2ee7565b | [
"MIT"
] | 1 | 2020-08-14T06:57:08.000Z | 2020-08-14T06:57:08.000Z | # Class definition for Book entity
class Book:
bookId = 1
def __init__(self, title, publisher, author, edition, publishedOn):
self.__title = title
self.__publisher = publisher
self.__author = author
self.__edition = edition
self.__publishedOn = publishedOn
self._... | 27.935484 | 157 | 0.630485 |
class Book:
bookId = 1
def __init__(self, title, publisher, author, edition, publishedOn):
self.__title = title
self.__publisher = publisher
self.__author = author
self.__edition = edition
self.__publishedOn = publishedOn
self.__bookId = Book.bookId
Book... | true | true |
f7427974904ce59d069adf181d643213b47ab89c | 3,732 | py | Python | tests/python/relay/test_pass_auto_quantize.py | jiangzoi/incubator-tvm | 144c6f45f7217b9df2f5605e06f0903e470ac11c | [
"Apache-2.0"
] | 2 | 2020-07-07T07:38:45.000Z | 2021-06-02T07:08:09.000Z | tests/python/relay/test_pass_auto_quantize.py | jiangzoi/incubator-tvm | 144c6f45f7217b9df2f5605e06f0903e470ac11c | [
"Apache-2.0"
] | 1 | 2020-07-29T07:29:17.000Z | 2020-07-29T07:29:17.000Z | tests/python/relay/test_pass_auto_quantize.py | jiangzoi/incubator-tvm | 144c6f45f7217b9df2f5605e06f0903e470ac11c | [
"Apache-2.0"
] | 1 | 2021-07-03T08:09:32.000Z | 2021-07-03T08:09:32.000Z | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 33.321429 | 71 | 0.672026 |
import numpy as np
import pytest
import tvm
from tvm import te
from tvm import relay
from tvm.relay import testing
from tvm.relay.expr import Call
def quantize_and_build(out):
f = relay.Function(relay.analysis.free_vars(out), out)
mod, params = testing.create_workload(f)
with relay.quant... | true | true |
f7427dd9bdecba8b955eab6d5b432ef7abfac7f4 | 1,630 | py | Python | modules/algo.py | Davidyz/AutoStacker | 9f637891b9379b166e41597bcd44a8011561beea | [
"MIT"
] | null | null | null | modules/algo.py | Davidyz/AutoStacker | 9f637891b9379b166e41597bcd44a8011561beea | [
"MIT"
] | null | null | null | modules/algo.py | Davidyz/AutoStacker | 9f637891b9379b166e41597bcd44a8011561beea | [
"MIT"
] | null | null | null | import numpy as np
from modules.imageRW import Image
from typing import Iterator, Optional, List
from __future__ import annotations
class InputException(Exception):
pass
def mean(images: Iterator[Image], group_size: int) -> Iterator[Image|None]:
stackImage: Image|None = None
while True:
try:
... | 30.185185 | 80 | 0.56135 | import numpy as np
from modules.imageRW import Image
from typing import Iterator, Optional, List
from __future__ import annotations
class InputException(Exception):
pass
def mean(images: Iterator[Image], group_size: int) -> Iterator[Image|None]:
stackImage: Image|None = None
while True:
try:
... | true | true |
f7427e3e091e4b7bc43db2bc2372dfafe57fa435 | 1,335 | py | Python | alipay/aop/api/response/AlipayFundCouponWufuLiveAcceptResponse.py | antopen/alipay-sdk-python-all | 8e51c54409b9452f8d46c7bb10eea7c8f7e8d30c | [
"Apache-2.0"
] | 213 | 2018-08-27T16:49:32.000Z | 2021-12-29T04:34:12.000Z | alipay/aop/api/response/AlipayFundCouponWufuLiveAcceptResponse.py | antopen/alipay-sdk-python-all | 8e51c54409b9452f8d46c7bb10eea7c8f7e8d30c | [
"Apache-2.0"
] | 29 | 2018-09-29T06:43:00.000Z | 2021-09-02T03:27:32.000Z | alipay/aop/api/response/AlipayFundCouponWufuLiveAcceptResponse.py | antopen/alipay-sdk-python-all | 8e51c54409b9452f8d46c7bb10eea7c8f7e8d30c | [
"Apache-2.0"
] | 59 | 2018-08-27T16:59:26.000Z | 2022-03-25T10:08:15.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.CommonPrizeModelVo import CommonPrizeModelVo
class AlipayFundCouponWufuLiveAcceptResponse(AlipayResponse):
def __init__(self):
super(AlipayFundCouponWufu... | 31.046512 | 111 | 0.662172 |
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.CommonPrizeModelVo import CommonPrizeModelVo
class AlipayFundCouponWufuLiveAcceptResponse(AlipayResponse):
def __init__(self):
super(AlipayFundCouponWufuLiveAcceptResponse, self).__init__()
... | true | true |
f7427e4b9f5e9374b1ac340794143e370ea5f0c5 | 3,932 | py | Python | pyDNase/scripts/dnase_average_profile.py | zoi-mibtp/pyDNase | 047d2f89af6109a530505b370782c4841d710cbf | [
"MIT"
] | 34 | 2015-05-28T17:16:18.000Z | 2022-03-04T11:54:37.000Z | pyDNase/scripts/dnase_average_profile.py | zoi-mibtp/pyDNase | 047d2f89af6109a530505b370782c4841d710cbf | [
"MIT"
] | 39 | 2015-05-14T09:03:07.000Z | 2020-05-13T11:40:28.000Z | pyDNase/scripts/dnase_average_profile.py | zoi-mibtp/pyDNase | 047d2f89af6109a530505b370782c4841d710cbf | [
"MIT"
] | 24 | 2015-09-24T07:39:53.000Z | 2021-07-13T02:37:24.000Z | #!/usr/bin/env python
import argparse
import pyDNase
import numpy as np
import matplotlib as mpl
from clint.textui import progress, puts
#Required for headless operation
mpl.use('Agg')
import matplotlib.pyplot as plt
from matplotlib import rcParams
parser = argparse.ArgumentParser(description='Plots average profile of... | 39.717172 | 154 | 0.698372 |
import argparse
import pyDNase
import numpy as np
import matplotlib as mpl
from clint.textui import progress, puts
mpl.use('Agg')
import matplotlib.pyplot as plt
from matplotlib import rcParams
parser = argparse.ArgumentParser(description='Plots average profile of DNase (or Tn5 for ATAC-seq) activity surrounding a l... | true | true |
f7427e5e34c3f1de4190cb6c792627ffcae62126 | 49,211 | py | Python | nemo/collections/nlp/data/machine_translation/preproc_mt_data.py | PatrykNeubauer/NeMo | 3ada744b884dba5f233f22c6991fc6092c6ca8d0 | [
"Apache-2.0"
] | 1 | 2021-08-19T03:20:44.000Z | 2021-08-19T03:20:44.000Z | nemo/collections/nlp/data/machine_translation/preproc_mt_data.py | PatrykNeubauer/NeMo | 3ada744b884dba5f233f22c6991fc6092c6ca8d0 | [
"Apache-2.0"
] | null | null | null | nemo/collections/nlp/data/machine_translation/preproc_mt_data.py | PatrykNeubauer/NeMo | 3ada744b884dba5f233f22c6991fc6092c6ca8d0 | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2020, NVIDIA 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 by appli... | 47.409441 | 144 | 0.578021 |
import glob
import json
import os
import pickle
import tarfile
import tempfile
import youtokentome as yttm
from joblib import Parallel, delayed
from omegaconf import ListConfig, OmegaConf
from pytorch_lightning import Trainer
from nemo.collections.common.tokenizers.sentencepiece_tokenizer import create... | true | true |
f7427f1354bf3b226bce8090848a2ebbad5185d6 | 3,261 | py | Python | Leg.py | Uxeron/Spiderbot | 67003b67697536349a7aedcc8109930680d5cea5 | [
"MIT"
] | 2 | 2020-03-07T07:46:54.000Z | 2021-11-01T16:35:24.000Z | Leg.py | Uxeron/Spiderbot | 67003b67697536349a7aedcc8109930680d5cea5 | [
"MIT"
] | null | null | null | Leg.py | Uxeron/Spiderbot | 67003b67697536349a7aedcc8109930680d5cea5 | [
"MIT"
] | 1 | 2020-03-07T07:47:05.000Z | 2020-03-07T07:47:05.000Z | from __future__ import division
import random
import Adafruit_PCA9685
import thread
import sys
from time import sleep
from inputs import get_gamepad
pwmL = Adafruit_PCA9685.PCA9685(0x41)
pwmR = Adafruit_PCA9685.PCA9685(0x40)
pwmL.set_pwm_freq(50)
pwmR.set_pwm_freq(50)
motors = [12, 13, 14, 3, 2, 1]
start = [160, 130,... | 30.476636 | 73 | 0.531739 | from __future__ import division
import random
import Adafruit_PCA9685
import thread
import sys
from time import sleep
from inputs import get_gamepad
pwmL = Adafruit_PCA9685.PCA9685(0x41)
pwmR = Adafruit_PCA9685.PCA9685(0x40)
pwmL.set_pwm_freq(50)
pwmR.set_pwm_freq(50)
motors = [12, 13, 14, 3, 2, 1]
start = [160, 130,... | false | true |
f7427f7da06fb74060284279677f278e898c0af0 | 281,502 | py | Python | tests/admin_views/tests.py | metamatik/django | 415ae960bb9f1bdae798023fdce3247d2c938eec | [
"PSF-2.0",
"BSD-3-Clause"
] | null | null | null | tests/admin_views/tests.py | metamatik/django | 415ae960bb9f1bdae798023fdce3247d2c938eec | [
"PSF-2.0",
"BSD-3-Clause"
] | null | null | null | tests/admin_views/tests.py | metamatik/django | 415ae960bb9f1bdae798023fdce3247d2c938eec | [
"PSF-2.0",
"BSD-3-Clause"
] | 1 | 2020-09-16T07:19:02.000Z | 2020-09-16T07:19:02.000Z | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import json
import os
import re
import unittest
from django.contrib.admin import AdminSite, ModelAdmin
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
from django.contrib.admin.models import ADDITION, DELETION, LogEntry
from... | 46.292057 | 119 | 0.65082 |
from __future__ import unicode_literals
import datetime
import json
import os
import re
import unittest
from django.contrib.admin import AdminSite, ModelAdmin
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
from django.contrib.admin.models import ADDITION, DELETION, LogEntry
from django.contrib.admin.o... | true | true |
f7427fa61a22e6628b60e173ba1711d321fff4d6 | 3,060 | py | Python | archiveOldVersions/generator_v02.py | remichartier/014_selfDrivingCarND_BehavioralCloningProject | 1dcaa7c5a937929d4481e5efbf7ccc856c04c4ff | [
"MIT"
] | 1 | 2021-02-23T08:28:54.000Z | 2021-02-23T08:28:54.000Z | archiveOldVersions/generator_v02.py | remichartier/014_selfDrivingCarND_BehavioralCloningProject | 1dcaa7c5a937929d4481e5efbf7ccc856c04c4ff | [
"MIT"
] | null | null | null | archiveOldVersions/generator_v02.py | remichartier/014_selfDrivingCarND_BehavioralCloningProject | 1dcaa7c5a937929d4481e5efbf7ccc856c04c4ff | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# History
# v01 : adaptation from the one given by Udacity to work
# v02 : adapt to commonFunctions_v10.py to use generator.
# Start adding again everything from model_v12.py (image augmentation)
import os
import csv
import cv2
import numpy as np
import sklearn
from math import ceil
from ... | 37.777778 | 102 | 0.715686 |
import os
import csv
import cv2
import numpy as np
import sklearn
from math import ceil
from random import shuffle
from sklearn.model_selection import train_test_split
from commonFunctions_v10 import get_lines_logfile
from commonFunctions_v10 import get_info_from_lines
from commonFunctions_v10 import flip_hor... | true | true |
f74280739b93896df5c5e31df783089f1d27e061 | 5,844 | py | Python | babelscan_unit_test.py | DanPorter/babelscan | 71fa43f13a8318efbcdb412c4fca533d4b6f9ec9 | [
"Apache-2.0"
] | null | null | null | babelscan_unit_test.py | DanPorter/babelscan | 71fa43f13a8318efbcdb412c4fca533d4b6f9ec9 | [
"Apache-2.0"
] | null | null | null | babelscan_unit_test.py | DanPorter/babelscan | 71fa43f13a8318efbcdb412c4fca533d4b6f9ec9 | [
"Apache-2.0"
] | null | null | null | """
Unit test for babelscan
"""
import numpy as np
import matplotlib.pyplot as plt
import babelscan
print('####################################################')
print('############## babelscan unit tests ################')
print('####################################################')
print('\n')
print(babelscan.mod... | 33.780347 | 150 | 0.648871 |
import numpy as np
import matplotlib.pyplot as plt
import babelscan
print('####################################################')
print('############## babelscan unit tests ################')
print('####################################################')
print('\n')
print(babelscan.module_info())
file = r"C:\Users\d... | true | true |
f742817e2fd6d96a23dbfc508965ac0583cd3f0c | 2,491 | py | Python | pytest_splunk_addon_ui_smartx/components/controls/toggle.py | artemrys/addon-factory-smartx-ui-test-library | a0ea68a2f90f5662eac383b74043f69e01830251 | [
"Apache-2.0"
] | 1 | 2021-03-29T07:03:15.000Z | 2021-03-29T07:03:15.000Z | pytest_splunk_addon_ui_smartx/components/controls/toggle.py | artemrys/addon-factory-smartx-ui-test-library | a0ea68a2f90f5662eac383b74043f69e01830251 | [
"Apache-2.0"
] | 181 | 2020-12-15T19:31:07.000Z | 2022-03-18T08:06:06.000Z | pytest_splunk_addon_ui_smartx/components/controls/toggle.py | splunk/addon-factory-smartx-ui-test-library | d1bb8d0ce728d53d3c15425c3b5a25e2e526d80e | [
"Apache-2.0"
] | 2 | 2022-02-01T18:39:37.000Z | 2022-03-27T16:51:40.000Z | #
# Copyright 2021 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | 31.531646 | 87 | 0.598956 |
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from ..base_component import Selector
from .base_control import BaseControl
class Toggle(BaseControl):
def __init__(self, browser, container):
super().__init__(browser, container)
... | true | true |
f7428198d951fefa1de0138e18e0fcbcfe3359f9 | 2,363 | py | Python | snake/utils.py | ishitajs/npc-cogs | 6664d5825fd150486ad026631540278b7f46eeb3 | [
"MIT"
] | 28 | 2020-10-19T17:55:04.000Z | 2022-03-13T04:43:12.000Z | snake/utils.py | ishitajs/npc-cogs | 6664d5825fd150486ad026631540278b7f46eeb3 | [
"MIT"
] | 46 | 2021-01-17T19:07:01.000Z | 2022-03-07T09:04:01.000Z | snake/utils.py | ishitajs/npc-cogs | 6664d5825fd150486ad026631540278b7f46eeb3 | [
"MIT"
] | 53 | 2020-11-25T15:54:21.000Z | 2022-03-26T16:03:50.000Z | import asyncio
import discord
from redbot.vendored.discord.ext import menus
from .game import Game
TRANS = {
0: "\N{BLACK LARGE SQUARE}",
1: "\N{RED APPLE}",
2: "\N{LARGE GREEN CIRCLE}",
3: "\N{LARGE GREEN SQUARE}",
}
GET_DIR = {
"w": "up",
"s": "down",
"a": "left",
"d": "right",
... | 27.8 | 86 | 0.590774 | import asyncio
import discord
from redbot.vendored.discord.ext import menus
from .game import Game
TRANS = {
0: "\N{BLACK LARGE SQUARE}",
1: "\N{RED APPLE}",
2: "\N{LARGE GREEN CIRCLE}",
3: "\N{LARGE GREEN SQUARE}",
}
GET_DIR = {
"w": "up",
"s": "down",
"a": "left",
"d": "right",
... | true | true |
f74281a04ea26f96fc74daf2aff9f5e83498dd76 | 2,556 | py | Python | src/HAnDS/qualitative_analysis.py | abhipec/hands | ff9658d4226c78b96c02ccf3b91b7d2699f0e4cf | [
"MIT"
] | 13 | 2019-05-02T01:44:04.000Z | 2022-02-21T13:39:47.000Z | src/HAnDS/qualitative_analysis.py | abhipec/hands | ff9658d4226c78b96c02ccf3b91b7d2699f0e4cf | [
"MIT"
] | 1 | 2021-06-01T13:04:51.000Z | 2021-06-08T16:07:35.000Z | src/HAnDS/qualitative_analysis.py | abhipec/hands | ff9658d4226c78b96c02ccf3b91b7d2699f0e4cf | [
"MIT"
] | 1 | 2019-12-26T07:24:03.000Z | 2019-12-26T07:24:03.000Z | """
Qualitative analysis of dataset generated using CADS vs NDS approach.
"""
import sys
import glob
import json
import gzip
def sentence_id(json_sentence):
"""
Return the unique if of a sentence.
"""
return '_'.join([
str(json_sentence['did']),
str(json_sentence['pid']),
str(j... | 36 | 80 | 0.554773 |
import sys
import glob
import json
import gzip
def sentence_id(json_sentence):
return '_'.join([
str(json_sentence['did']),
str(json_sentence['pid']),
str(json_sentence['sid'])
])
def parse_dataset(input_directory, restrict=None):
filepaths = sorted(glob.iglob(input_directory + '... | true | true |
f74281a2aca3dde534e168e52c00ec688047557d | 2,760 | py | Python | bindings/python/ensmallen/datasets/networkrepository/dbpediaoccupation.py | AnacletoLAB/ensmallen_graph | b2c1b18fb1e5801712852bcc239f239e03076f09 | [
"MIT"
] | 5 | 2021-02-17T00:44:45.000Z | 2021-08-09T16:41:47.000Z | bindings/python/ensmallen/datasets/networkrepository/dbpediaoccupation.py | AnacletoLAB/ensmallen_graph | b2c1b18fb1e5801712852bcc239f239e03076f09 | [
"MIT"
] | 18 | 2021-01-07T16:47:39.000Z | 2021-08-12T21:51:32.000Z | bindings/python/ensmallen/datasets/networkrepository/dbpediaoccupation.py | AnacletoLAB/ensmallen | b2c1b18fb1e5801712852bcc239f239e03076f09 | [
"MIT"
] | 3 | 2021-01-14T02:20:59.000Z | 2021-08-04T19:09:52.000Z | """
This file offers the methods to automatically retrieve the graph dbpedia-occupation.
The graph is automatically retrieved from the NetworkRepository repository.
References
---------------------
Please cite the following if you use the data:
```bib
@inproceedings{nr,
title = {The Network Data Repository wit... | 29.052632 | 94 | 0.660145 | from typing import Dict
from ..automatic_graph_retrieval import AutomaticallyRetrievedGraph
from ...ensmallen import Graph
def DbpediaOccupation(
directed: bool = False,
preprocess: bool = True,
load_nodes: bool = True,
verbose: int = 2,
cache: bool = True,
cache_path: str = "graphs/network... | true | true |
f742833d30a37adca0fa495770ff4c465783b02e | 8,762 | py | Python | app_filter.py | lestieve/ODATAF | de2c077a4e24ccc6783adf73fc8d7ae1c140bfe6 | [
"MIT"
] | null | null | null | app_filter.py | lestieve/ODATAF | de2c077a4e24ccc6783adf73fc8d7ae1c140bfe6 | [
"MIT"
] | null | null | null | app_filter.py | lestieve/ODATAF | de2c077a4e24ccc6783adf73fc8d7ae1c140bfe6 | [
"MIT"
] | null | null | null | from tkinter import *
from odf_query import *
from app_tools import *
from app_selector import *
from app_dictionary import _, load_dictionary
class AppFilter(Toplevel):
"""Window for managing a filter (for adding or modifying a filter)
Arguments:
Toplevel {Toplevel (tkinter)} -- Window ... | 52.467066 | 176 | 0.599863 | from tkinter import *
from odf_query import *
from app_tools import *
from app_selector import *
from app_dictionary import _, load_dictionary
class AppFilter(Toplevel):
def __init__(self, federation=None, app_parent=None, query_filters=[], query_tables=[], filter_index=None):
Toplevel.__init__(sel... | true | true |
f74283d3eae87159475da2719a6acfef86d9d988 | 987 | py | Python | sonic/config.py | jakhax/self-driving-with-a-raspberry-pi-car- | 351fd3d30306002d0bb2caafb4162a23f6af116e | [
"MIT"
] | 4 | 2018-12-13T07:53:49.000Z | 2021-06-27T03:50:46.000Z | sonic/config.py | jakhax/self-driving-with-a-raspberry-pi-car- | 351fd3d30306002d0bb2caafb4162a23f6af116e | [
"MIT"
] | 5 | 2018-12-04T05:33:13.000Z | 2022-03-11T23:35:08.000Z | sonic/config.py | jakhax/self-driving-with-a-raspberry-pi-car- | 351fd3d30306002d0bb2caafb4162a23f6af116e | [
"MIT"
] | 1 | 2020-04-17T23:17:16.000Z | 2020-04-17T23:17:16.000Z | """
CAR CONFIG
This file is read by your car application's manage.py script to change the car
performance.
EXMAPLE
-----------
import dk
cfg = dk.load_config(config_path='~/mycar/config.py')
print(cfg.CAMERA_RESOLUTION)
"""
import os
#PATHS
CAR_PATH = PACKAGE_PATH = os.path.dirname(os.path.realpath(__file__))
DAT... | 18.622642 | 78 | 0.765957 |
import os
CAR_PATH = PACKAGE_PATH = os.path.dirname(os.path.realpath(__file__))
DATA_PATH = os.path.join(CAR_PATH, 'data')
MODELS_PATH = os.path.join(CAR_PATH, 'models')
DRIVE_LOOP_HZ = 20
MAX_LOOPS = 100000
CAMERA_RESOLUTION = (480, 640)
CAMERA_FRAMERATE = DRIVE_LOOP_HZ
STEERING_CHANNEL = 1
STEERING_LEFT_PW... | true | true |
f742842a1658aa53e43099e22f59c66037d345cb | 6,507 | py | Python | mmdet-v2/tools/third_party/useless/cocoutils/coco_check.py | li-phone/DetectionCompetition | a917f16790ec30358e3cfe1aa6e327a2070a1235 | [
"Apache-2.0"
] | null | null | null | mmdet-v2/tools/third_party/useless/cocoutils/coco_check.py | li-phone/DetectionCompetition | a917f16790ec30358e3cfe1aa6e327a2070a1235 | [
"Apache-2.0"
] | null | null | null | mmdet-v2/tools/third_party/useless/cocoutils/coco_check.py | li-phone/DetectionCompetition | a917f16790ec30358e3cfe1aa6e327a2070a1235 | [
"Apache-2.0"
] | null | null | null | import os
import json
import cv2 as cv
import numpy as np
from tqdm import tqdm
try:
from pandas import json_normalize
except:
from pandas.io.json import json_normalize
def load_dict(fname):
with open(fname, "r") as fp:
o = json.load(fp, )
return o
def save_dict(fname, d, mode='w', **kw... | 34.068063 | 115 | 0.52528 | import os
import json
import cv2 as cv
import numpy as np
from tqdm import tqdm
try:
from pandas import json_normalize
except:
from pandas.io.json import json_normalize
def load_dict(fname):
with open(fname, "r") as fp:
o = json.load(fp, )
return o
def save_dict(fname, d, mode='w', **kw... | true | true |
f742862ba0025cfcee3d87f7cfc4d5fe793f283d | 20,962 | py | Python | plaso/engine/extractors.py | jonathan-greig/plaso | b88a6e54c06a162295d09b016bddbfbfe7ca9070 | [
"Apache-2.0"
] | 1,253 | 2015-01-02T13:58:02.000Z | 2022-03-31T08:43:39.000Z | plaso/engine/extractors.py | jonathan-greig/plaso | b88a6e54c06a162295d09b016bddbfbfe7ca9070 | [
"Apache-2.0"
] | 3,388 | 2015-01-02T11:17:58.000Z | 2022-03-30T10:21:45.000Z | plaso/engine/extractors.py | jonathan-greig/plaso | b88a6e54c06a162295d09b016bddbfbfe7ca9070 | [
"Apache-2.0"
] | 376 | 2015-01-20T07:04:54.000Z | 2022-03-04T23:53:00.000Z | # -*- coding: utf-8 -*-
"""The extractor class definitions.
An extractor is a class used to extract information from "raw" data.
"""
import copy
import re
import pysigscan
from dfvfs.helpers import file_system_searcher
from dfvfs.lib import definitions as dfvfs_definitions
from dfvfs.lib import errors as dfvfs_erro... | 36.519164 | 80 | 0.710094 |
import copy
import re
import pysigscan
from dfvfs.helpers import file_system_searcher
from dfvfs.lib import definitions as dfvfs_definitions
from dfvfs.lib import errors as dfvfs_errors
from dfvfs.resolver import resolver as path_spec_resolver
from plaso.engine import logger
from plaso.lib import errors
from plaso... | true | true |
f7428672141d379ebc5c8946bf392b4d6996cca5 | 3,749 | py | Python | Tools/Tools/Scripts/webkitpy/common/net/irc/ircbot.py | VincentWei/mdolphin-core | 48ffdcf587a48a7bb4345ae469a45c5b64ffad0e | [
"Apache-2.0"
] | 6 | 2017-05-31T01:46:45.000Z | 2018-06-12T10:53:30.000Z | Tools/Tools/Scripts/webkitpy/common/net/irc/ircbot.py | FMSoftCN/mdolphin-core | 48ffdcf587a48a7bb4345ae469a45c5b64ffad0e | [
"Apache-2.0"
] | null | null | null | Tools/Tools/Scripts/webkitpy/common/net/irc/ircbot.py | FMSoftCN/mdolphin-core | 48ffdcf587a48a7bb4345ae469a45c5b64ffad0e | [
"Apache-2.0"
] | 2 | 2017-07-17T06:02:42.000Z | 2018-09-19T10:08:38.000Z | # Copyright (c) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | 40.75 | 113 | 0.720192 |
import webkitpy.common.config.irc as config_irc
from webkitpy.common.thread.messagepump import MessagePump, MessagePumpDelegate
from webkitpy.thirdparty.autoinstalled.irc import ircbot
from webkitpy.thirdparty.autoinstalled.irc import irclib
class IRCBotDelegate(object):
def irc_messa... | false | true |
f74286e676eb344ed971789e33328523c4fcad9b | 1,605 | py | Python | daemon/globus_cw_daemon/config.py | sirosen/globus-cwlogger | fbe0229e9bb1bacaa81046bcc7a8da168659e806 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | daemon/globus_cw_daemon/config.py | sirosen/globus-cwlogger | fbe0229e9bb1bacaa81046bcc7a8da168659e806 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | daemon/globus_cw_daemon/config.py | sirosen/globus-cwlogger | fbe0229e9bb1bacaa81046bcc7a8da168659e806 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | """
Provides access to /etc/cwlogd.ini config values
"""
import configparser
CONFIG_PATH = "/etc/cwlogd.ini"
_config = None
def _get_config():
"""
Either returns an already loaded configparser
Or creates a configparser and loads ini config at /etc/cwlogd.ini
"""
global _config
if _config is N... | 28.660714 | 71 | 0.670405 | import configparser
CONFIG_PATH = "/etc/cwlogd.ini"
_config = None
def _get_config():
global _config
if _config is None:
_config = configparser.ConfigParser()
_config.read(CONFIG_PATH)
return _config
def get_string(key):
try:
return _get_config().get("general", key)
exc... | true | true |
f742874d2b694357d57492e9f34ebf0ea8c776e1 | 11,946 | py | Python | config_v1.py | eyeris/OpenRadar | 1bdb4054e7cb68b9a13be968aaf3b94108a66a10 | [
"Apache-2.0"
] | 7 | 2021-05-20T01:12:39.000Z | 2021-12-30T12:38:07.000Z | radicalsdk/radar/config_v1.py | moodoki/radical_sdk | 4438678cf73e156e5058ddb035ec8e5875fca84e | [
"Apache-2.0"
] | null | null | null | radicalsdk/radar/config_v1.py | moodoki/radical_sdk | 4438678cf73e156e5058ddb035ec8e5875fca84e | [
"Apache-2.0"
] | null | null | null | # AUTOGENERATED! DO NOT EDIT! File to edit: nbs/04_radarcfg_v1.ipynb (unless otherwise specified).
__all__ = ['logger', 'read_radar_params', 'parse_commands', 'dict_to_list', 'channelStr_to_dict', 'profileStr_to_dict',
'chirp_to_dict', 'power_to_dict', 'frameStr_to_dict', 'adcStr_to_dict', 'command_handlers... | 40.222222 | 147 | 0.594676 |
__all__ = ['logger', 'read_radar_params', 'parse_commands', 'dict_to_list', 'channelStr_to_dict', 'profileStr_to_dict',
'chirp_to_dict', 'power_to_dict', 'frameStr_to_dict', 'adcStr_to_dict', 'command_handlers']
import logging
logger = logging.getLogger()
def read_radar_params(filename):
with ope... | true | true |
f7428815d2f4e93bf2d3fa38ab651d6f96f1851d | 2,438 | py | Python | mips_prog.py | madhav-datt/assembler | 95138c172712dc403e6bcfa48b1916edce95c896 | [
"MIT"
] | null | null | null | mips_prog.py | madhav-datt/assembler | 95138c172712dc403e6bcfa48b1916edce95c896 | [
"MIT"
] | null | null | null | mips_prog.py | madhav-datt/assembler | 95138c172712dc403e6bcfa48b1916edce95c896 | [
"MIT"
] | null | null | null |
import itertools
import re
import sys
import traceback
from instruction import Instruction
class MIPSProg:
def __init__(self, lines=None):
self.text_base = 0
self.data_base = 0x00400000
self.instructions = []
self.data = []
self.labels = {}
self.defines = {}
... | 28.022989 | 95 | 0.521739 |
import itertools
import re
import sys
import traceback
from instruction import Instruction
class MIPSProg:
def __init__(self, lines=None):
self.text_base = 0
self.data_base = 0x00400000
self.instructions = []
self.data = []
self.labels = {}
self.defines = {}
... | false | true |
f742895a6d6c6a3d4529ebb0db36167c295afef5 | 296 | py | Python | src/ramstk/models/programdb/mechanism/__init__.py | TahaEntezari/ramstk | f82e5b31ef5c4e33cc02252263247b99a9abe129 | [
"BSD-3-Clause"
] | 26 | 2019-05-15T02:03:47.000Z | 2022-02-21T07:28:11.000Z | src/ramstk/models/programdb/mechanism/__init__.py | TahaEntezari/ramstk | f82e5b31ef5c4e33cc02252263247b99a9abe129 | [
"BSD-3-Clause"
] | 815 | 2019-05-10T12:31:52.000Z | 2022-03-31T12:56:26.000Z | src/ramstk/models/programdb/mechanism/__init__.py | TahaEntezari/ramstk | f82e5b31ef5c4e33cc02252263247b99a9abe129 | [
"BSD-3-Clause"
] | 9 | 2019-04-20T23:06:29.000Z | 2022-01-24T21:21:04.000Z | # pylint: disable=unused-import
# -*- coding: utf-8 -*-
#
# ramstk.models.mechanism.__init__.py is part of The RAMSTK Project
#
# All rights reserved.
# Copyright since 2007 Doyle "weibullguy" Rowland doyle.rowland <AT> reliaqual <DOT> com
"""The RAMSTK failure Mechanism model package."""
| 32.888889 | 88 | 0.719595 | true | true | |
f7428af4872c5b3f086a0a690b5dfe13c5ddd3fc | 1,399 | py | Python | migrations/versions/b7ab14de6d0f_added_macros_table.py | ukblumf/randomise-it | 0610721eba649dfa205b0d3c4b3e24d67aa1d781 | [
"MIT"
] | null | null | null | migrations/versions/b7ab14de6d0f_added_macros_table.py | ukblumf/randomise-it | 0610721eba649dfa205b0d3c4b3e24d67aa1d781 | [
"MIT"
] | null | null | null | migrations/versions/b7ab14de6d0f_added_macros_table.py | ukblumf/randomise-it | 0610721eba649dfa205b0d3c4b3e24d67aa1d781 | [
"MIT"
] | null | null | null | """Added Macros table
Revision ID: b7ab14de6d0f
Revises: 183d3f0348eb
Create Date: 2017-11-28 11:54:23.897000
"""
# revision identifiers, used by Alembic.
revision = 'b7ab14de6d0f'
down_revision = '183d3f0348eb'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto... | 34.121951 | 91 | 0.670479 |
revision = 'b7ab14de6d0f'
down_revision = '183d3f0348eb'
from alembic import op
import sqlalchemy as sa
def upgrade():
rue),
sa.Column('definition', sa.Text(), nullable=True),
sa.Column('definition_html', sa.Text(), nullable=True),
sa.Column('permissions', sa.Integer(), nullable=True),
... | true | true |
f7428b0c27edbb119da0aeb395c2eff213e2b9c2 | 399 | py | Python | api/api/wsgi.py | haavardnk/Vinmonopolet-x-Untappd | 950db7201593d7b94daf091884949aed4377d4ca | [
"MIT"
] | null | null | null | api/api/wsgi.py | haavardnk/Vinmonopolet-x-Untappd | 950db7201593d7b94daf091884949aed4377d4ca | [
"MIT"
] | null | null | null | api/api/wsgi.py | haavardnk/Vinmonopolet-x-Untappd | 950db7201593d7b94daf091884949aed4377d4ca | [
"MIT"
] | null | null | null | """
WSGI config for api project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJA... | 23.470588 | 79 | 0.749373 |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'api.settings')
application = get_wsgi_application()
| true | true |
f7428b7ff1968904c5ad91436365926ac4723142 | 11,255 | py | Python | py/hookandline_hookmatrix/StateMachine.py | nwfsc-fram/pyFieldSoftware | 477ba162b66ede2263693cda8c5a51d27eaa3b89 | [
"MIT"
] | null | null | null | py/hookandline_hookmatrix/StateMachine.py | nwfsc-fram/pyFieldSoftware | 477ba162b66ede2263693cda8c5a51d27eaa3b89 | [
"MIT"
] | 176 | 2019-11-22T17:44:55.000Z | 2021-10-20T23:40:03.000Z | py/hookandline_hookmatrix/StateMachine.py | nwfsc-fram/pyFieldSoftware | 477ba162b66ede2263693cda8c5a51d27eaa3b89 | [
"MIT"
] | 1 | 2021-05-07T01:06:32.000Z | 2021-05-07T01:06:32.000Z | __author__ = 'Todd.Hay'
# -------------------------------------------------------------------------------
# Name: StateMachine.py
# Purpose:
#
# Author: Todd.Hay
# Email: Todd.Hay@noaa.gov
#
# Created: Feb 03, 2016
# License: MIT
#-------------------------------------------------------------... | 25.235426 | 99 | 0.583741 | __author__ = 'Todd.Hay'
from PyQt5.QtCore import pyqtProperty, pyqtSlot, QVariant, pyqtSignal, QObject
from PyQt5.QtQml import QJSValue
import logging
import arrow
import sys
from py.hookandline_hookmatrix.HookMatrixConfig import HOOKMATRIX_VERSION
from py.hookandline_hookmatrix.HookMatrixConfig import HO... | true | true |
f7428c89b0a49d108aaa723ccef6afcc3508e1a8 | 2,152 | py | Python | hackathon/lib/qiskitflow/cli/cli.py | IceKhan13/QiskitFlow | ec9a403a04145454c35b21bdfb26e893f52a428f | [
"Apache-2.0"
] | 7 | 2020-10-21T20:51:00.000Z | 2021-08-24T14:21:35.000Z | hackathon/lib/qiskitflow/cli/cli.py | IceKhan13/QiskitFlow | ec9a403a04145454c35b21bdfb26e893f52a428f | [
"Apache-2.0"
] | 11 | 2020-10-22T03:24:54.000Z | 2021-02-13T02:41:06.000Z | hackathon/lib/qiskitflow/cli/cli.py | IceKhan13/QiskitFlow | ec9a403a04145454c35b21bdfb26e893f52a428f | [
"Apache-2.0"
] | 5 | 2020-10-08T17:24:59.000Z | 2022-01-30T16:27:03.000Z | import click
import time
import glob
import json
import tarfile
import requests
import os
from shutil import copyfile
_FOLDER = "_experiments"
@click.group(help="""
Base QiskitFlow cli function.
""")
def qiskitflow():
click.echo(click.style("== QiskitFlow. Reproducible quantum experiments ==", fg='magenta'))
... | 28.693333 | 104 | 0.639405 | import click
import time
import glob
import json
import tarfile
import requests
import os
from shutil import copyfile
_FOLDER = "_experiments"
@click.group(help="""
Base QiskitFlow cli function.
""")
def qiskitflow():
click.echo(click.style("== QiskitFlow. Reproducible quantum experiments ==", fg='magenta'))
... | true | true |
f7428d78467189e3c7a56c8df336b8ce6bd066f8 | 22,877 | py | Python | modules/tools/create_map/create_map.py | BaiduXLab/apollo | 2764e934b6d0da1342be781447348288ac84c5e9 | [
"Apache-2.0"
] | 22 | 2018-10-10T14:46:32.000Z | 2022-02-28T12:43:43.000Z | modules/tools/create_map/create_map.py | BaiduXLab/apollo | 2764e934b6d0da1342be781447348288ac84c5e9 | [
"Apache-2.0"
] | 5 | 2020-06-13T00:36:33.000Z | 2022-02-10T17:50:43.000Z | modules/tools/create_map/create_map.py | BaiduXLab/apollo | 2764e934b6d0da1342be781447348288ac84c5e9 | [
"Apache-2.0"
] | 12 | 2018-12-24T02:17:19.000Z | 2021-12-06T01:54:09.000Z | #!/usr/bin/env python
###############################################################################
# Copyright 2017 The Apollo Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy ... | 33.348397 | 177 | 0.622634 |
'center_x':
entry.center_x = new_entry
elif dim == 'center_y':
entry.center_y = new_entry
elif dim == 'width':
entry.width = new_entry
def smooth_dimension(data, dim):
extracted_data = extract_data(data, dim)
if dim == 'width':
laplacian_smooth(ex... | true | true |
f7428e1b6cc6fec86deadc41fcbfa377b7a07b12 | 565 | py | Python | examples/tokenize_wiki.py | fostroll/toxine | ad1e6b76e08d52b5041b46d542c1c5cec1052e53 | [
"BSD-3-Clause"
] | 6 | 2020-07-27T05:38:26.000Z | 2021-02-04T07:52:53.000Z | examples/tokenize_wiki.py | fostroll/toxine | ad1e6b76e08d52b5041b46d542c1c5cec1052e53 | [
"BSD-3-Clause"
] | null | null | null | examples/tokenize_wiki.py | fostroll/toxine | ad1e6b76e08d52b5041b46d542c1c5cec1052e53 | [
"BSD-3-Clause"
] | 2 | 2020-05-05T10:50:00.000Z | 2020-12-04T13:49:25.000Z | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Toxine project
#
# Copyright (C) 2019-present by Sergei Ternovykh
# License: BSD, see LICENSE for details
"""
Example: Tokenize Wikipedia and save articles as CoNLL-U.
"""
from corpuscula import Conllu
from corpuscula.wikipedia_utils import download_wikipedia
from toxine.wiki... | 28.25 | 70 | 0.762832 |
from corpuscula import Conllu
from corpuscula.wikipedia_utils import download_wikipedia
from toxine.wikipedia_utils import TokenizedWikipedia
download_wikipedia(overwrite=False)
# tokenize and save articles
Conllu.save(TokenizedWikipedia().articles(), 'wiki.conllu', fix=False,
log_file=None)
| true | true |
f7428e572f39b4ef1cd857bc6a5efc87c768094f | 13,574 | py | Python | raddoo/core.py | ConsignCloud/raddoo | 71622592644b1871e243563fa2816a7ff278b722 | [
"MIT"
] | 1 | 2022-01-20T17:32:37.000Z | 2022-01-20T17:32:37.000Z | raddoo/core.py | ConsignCloud/raddoo | 71622592644b1871e243563fa2816a7ff278b722 | [
"MIT"
] | null | null | null | raddoo/core.py | ConsignCloud/raddoo | 71622592644b1871e243563fa2816a7ff278b722 | [
"MIT"
] | null | null | null | import uuid as _uuid
import itertools as _itertools
import random as _random
import collections as _collections
import inspect as _inspect
import copy as _copy
import _collections_abc
UUID_PATTERN = "\
^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
def _curry(n, fn, carryover_args=()... | 16.39372 | 78 | 0.598644 | import uuid as _uuid
import itertools as _itertools
import random as _random
import collections as _collections
import inspect as _inspect
import copy as _copy
import _collections_abc
UUID_PATTERN = "\
^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
def _curry(n, fn, carryover_args=()... | true | true |
f7428f184f7d405c484a80da3116e3e60f11c4e5 | 11,516 | py | Python | sdk/python/pulumi_google_native/accesscontextmanager/v1/access_level.py | AaronFriel/pulumi-google-native | 75d1cda425e33d4610348972cd70bddf35f1770d | [
"Apache-2.0"
] | 44 | 2021-04-18T23:00:48.000Z | 2022-02-14T17:43:15.000Z | sdk/python/pulumi_google_native/accesscontextmanager/v1/access_level.py | AaronFriel/pulumi-google-native | 75d1cda425e33d4610348972cd70bddf35f1770d | [
"Apache-2.0"
] | 354 | 2021-04-16T16:48:39.000Z | 2022-03-31T17:16:39.000Z | sdk/python/pulumi_google_native/accesscontextmanager/v1/access_level.py | AaronFriel/pulumi-google-native | 75d1cda425e33d4610348972cd70bddf35f1770d | [
"Apache-2.0"
] | 8 | 2021-04-24T17:46:51.000Z | 2022-01-05T10:40:21.000Z | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... | 44.809339 | 304 | 0.64875 |
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
from . import outputs
from ._enums import *
from ._inputs import *
__all__ = ['AccessLevelArgs', 'AccessLevel']
@pulumi.input_type
class AccessLevelArgs:
def __in... | true | true |
f7428f30924849ddcb6bbe9f34d8254915fd2522 | 964 | py | Python | fedhf/api/dpm/laplace.py | beiyuouo/fedhf | 0caa873a5db7494b0f9197848c34243fcb8c49f6 | [
"Apache-2.0"
] | 2 | 2022-03-04T02:44:14.000Z | 2022-03-24T03:59:07.000Z | fedhf/api/dpm/laplace.py | beiyuouo/FedHF | 0caa873a5db7494b0f9197848c34243fcb8c49f6 | [
"Apache-2.0"
] | null | null | null | fedhf/api/dpm/laplace.py | beiyuouo/FedHF | 0caa873a5db7494b0f9197848c34243fcb8c49f6 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File : fedhf\api\dpm\laplace_noise.py
# @Time : 2022-05-02 22:39:42
# @Author : Bingjie Yan
# @Email : bj.yan.pa@qq.com
# @License : Apache License 2.0
import numpy as np
import torch
def laplace_noise(sensitivity, size, epsilon, **kwargs):
"""
... | 28.352941 | 64 | 0.655602 |
import numpy as np
import torch
def laplace_noise(sensitivity, size, epsilon, **kwargs):
noise_scale = sensitivity / epsilon
return np.random.laplace(0, noise_scale, size)
def laplace_clip(model: torch.nn.Module, clip: float):
for k, v in model.named_parameters():
v.grad /= max(1, v.grad... | true | true |
f7428f333efa60092af6caf202c8325d118622c3 | 1,484 | py | Python | src/websitecontacts/exceptions/error.py | whois-api-llc/website-contacts-py | fe1fa6140346459ea757c21852825bb4661d95e5 | [
"MIT"
] | 1 | 2022-02-07T10:10:56.000Z | 2022-02-07T10:10:56.000Z | src/websitecontacts/exceptions/error.py | whois-api-llc/website-contacts-py | fe1fa6140346459ea757c21852825bb4661d95e5 | [
"MIT"
] | null | null | null | src/websitecontacts/exceptions/error.py | whois-api-llc/website-contacts-py | fe1fa6140346459ea757c21852825bb4661d95e5 | [
"MIT"
] | null | null | null | from json import loads
from ..models.response import ErrorMessage
class WebsiteContactsApiError(Exception):
def __init__(self, message):
self.message = message
@property
def message(self):
return self._message
@message.setter
def message(self, message):
self._message = me... | 20.611111 | 58 | 0.688005 | from json import loads
from ..models.response import ErrorMessage
class WebsiteContactsApiError(Exception):
def __init__(self, message):
self.message = message
@property
def message(self):
return self._message
@message.setter
def message(self, message):
self._message = me... | true | true |
f7429026d15749af7c58f07a1d2edf47c75c251d | 2,453 | py | Python | 2020/test/d01_test.py | michal-jewczuk/advent-of-code | c4933bf0bc4b77d5032f8a7f2fdc385b6013c18d | [
"MIT"
] | null | null | null | 2020/test/d01_test.py | michal-jewczuk/advent-of-code | c4933bf0bc4b77d5032f8a7f2fdc385b6013c18d | [
"MIT"
] | null | null | null | 2020/test/d01_test.py | michal-jewczuk/advent-of-code | c4933bf0bc4b77d5032f8a7f2fdc385b6013c18d | [
"MIT"
] | null | null | null | import unittest
import sys
sys.path.append('../')
import d01_p1 as d01
class TestFindNumbers(unittest.TestCase):
def test_with_only_one_matching_pair(self):
testData = [10, 2010]
expected = (10, 2010)
result = d01.findNumbers(testData)
self.assertEqual(result, expected)
de... | 24.287129 | 64 | 0.598859 | import unittest
import sys
sys.path.append('../')
import d01_p1 as d01
class TestFindNumbers(unittest.TestCase):
def test_with_only_one_matching_pair(self):
testData = [10, 2010]
expected = (10, 2010)
result = d01.findNumbers(testData)
self.assertEqual(result, expected)
de... | true | true |
f742926227c9549f415786db3fd44d7fd9b710e3 | 232 | py | Python | sets.py | stonegrape/hello | 3d5f83371e3353863ce1d80457649fd360629bfc | [
"MIT"
] | null | null | null | sets.py | stonegrape/hello | 3d5f83371e3353863ce1d80457649fd360629bfc | [
"MIT"
] | null | null | null | sets.py | stonegrape/hello | 3d5f83371e3353863ce1d80457649fd360629bfc | [
"MIT"
] | null | null | null | # create an empty set
s = set()
# add elements to the sets
s.add(1)
s.add(2)
s.add(3)
s.add(4)
s.add(3)
print(s)
s.remove(2)
print(s)
# print out how many elements are in the set
print(f"there are {len(s)} elements in the set")
| 12.888889 | 48 | 0.659483 |
s = set()
s.add(1)
s.add(2)
s.add(3)
s.add(4)
s.add(3)
print(s)
s.remove(2)
print(s)
print(f"there are {len(s)} elements in the set")
| true | true |
f74294dc57850dfcec56e2d3428380ca57717a01 | 4,239 | py | Python | docs/source/experiments/legacy/ssl_vs_bald_vs_ssal_basic/mnist/recycle/det_SSL/pseudo_label.py | jiahfong/alr | ee561c545bd98ec17c4f9c3040ef23b0222ef71a | [
"MIT"
] | 2 | 2020-09-20T18:06:35.000Z | 2021-02-03T07:52:58.000Z | docs/source/experiments/old/legacy/ssl_vs_bald_vs_ssal_basic/mnist/recycle/det_SSL/pseudo_label.py | jiahfong/alr | ee561c545bd98ec17c4f9c3040ef23b0222ef71a | [
"MIT"
] | null | null | null | docs/source/experiments/old/legacy/ssl_vs_bald_vs_ssal_basic/mnist/recycle/det_SSL/pseudo_label.py | jiahfong/alr | ee561c545bd98ec17c4f9c3040ef23b0222ef71a | [
"MIT"
] | null | null | null | r"""
vanilla pseudo-labeling implementation
"""
from collections import defaultdict
from alr.utils import timeop, manual_seed
from alr.data.datasets import Dataset
from alr.data import UnlabelledDataset
from alr.training import VanillaPLTrainer
from alr.training.samplers import RandomFixedLengthSampler
from alr import... | 31.634328 | 119 | 0.533616 | from collections import defaultdict
from alr.utils import timeop, manual_seed
from alr.data.datasets import Dataset
from alr.data import UnlabelledDataset
from alr.training import VanillaPLTrainer
from alr.training.samplers import RandomFixedLengthSampler
from alr import MCDropout
import pickle
import numpy as np
imp... | true | true |
f742956a2e623574dcf542f0156c8bfe6e0103eb | 3,315 | py | Python | test_nnet.py | texifter/trust-defender | 08747df28adc3d2431a73087e06cb0647e8397d2 | [
"MIT"
] | 5 | 2021-06-15T12:04:28.000Z | 2021-10-08T15:56:08.000Z | test_nnet.py | texifter/trust-defender | 08747df28adc3d2431a73087e06cb0647e8397d2 | [
"MIT"
] | null | null | null | test_nnet.py | texifter/trust-defender | 08747df28adc3d2431a73087e06cb0647e8397d2 | [
"MIT"
] | null | null | null | import argparse
import numpy
import pandas as pd
import os
from keras import backend as K
from keras.models import Sequential
from keras.layers import Dense
from keras.models import model_from_json
from ngram_classifier import NGramClassifier
from sklearn.metrics import precision_recall_fscore_support
CLASS_WEIGHTS = ... | 32.821782 | 122 | 0.685671 | import argparse
import numpy
import pandas as pd
import os
from keras import backend as K
from keras.models import Sequential
from keras.layers import Dense
from keras.models import model_from_json
from ngram_classifier import NGramClassifier
from sklearn.metrics import precision_recall_fscore_support
CLASS_WEIGHTS = ... | true | true |
f74296e51a418c7b42a68c250fa42944c64784ec | 1,895 | py | Python | neurolib/models/thalamus/model.py | Ronjaa95/neurolib | 6d066a6428718ec85c9b1b87707ea73bc179ebf9 | [
"MIT"
] | 258 | 2020-01-26T14:38:09.000Z | 2022-03-31T14:54:04.000Z | neurolib/models/thalamus/model.py | Ronjaa95/neurolib | 6d066a6428718ec85c9b1b87707ea73bc179ebf9 | [
"MIT"
] | 172 | 2020-01-27T11:02:28.000Z | 2022-03-22T22:25:38.000Z | neurolib/models/thalamus/model.py | Ronjaa95/neurolib | 6d066a6428718ec85c9b1b87707ea73bc179ebf9 | [
"MIT"
] | 49 | 2020-02-04T08:34:44.000Z | 2022-03-28T09:29:12.000Z | from ..model import Model
from . import loadDefaultParams as dp
from . import timeIntegration as ti
class ThalamicMassModel(Model):
"""
Two population thalamic model
Reference:
Costa, M. S., Weigenand, A., Ngo, H. V. V., Marshall, L., Born, J.,
Martinetz, T., & Claussen, J. C. (2016). A thala... | 23.395062 | 80 | 0.538259 | from ..model import Model
from . import loadDefaultParams as dp
from . import timeIntegration as ti
class ThalamicMassModel(Model):
name = "thalamus"
description = "Two population thalamic mass model"
init_vars = [
"V_t_init",
"V_r_init",
"Q_t_init",
"Q_r_init",
"... | true | true |
f742970d05de192bf4795c674cd9551b60aeacb0 | 4,648 | py | Python | apps/dash-web-trader/env/Lib/site-packages/dash_html_components/Datalist.py | alzo425/dash-sample-apps | d3e9f521a3bc2b8d39ed2922838ad35b9b17beb0 | [
"MIT"
] | 1 | 2020-03-01T04:38:24.000Z | 2020-03-01T04:38:24.000Z | apps/dash-web-trader/env/Lib/site-packages/dash_html_components/Datalist.py | alzo425/dash-sample-apps | d3e9f521a3bc2b8d39ed2922838ad35b9b17beb0 | [
"MIT"
] | null | null | null | apps/dash-web-trader/env/Lib/site-packages/dash_html_components/Datalist.py | alzo425/dash-sample-apps | d3e9f521a3bc2b8d39ed2922838ad35b9b17beb0 | [
"MIT"
] | 17 | 2019-11-21T14:11:29.000Z | 2019-11-21T15:26:23.000Z | # AUTO GENERATED FILE - DO NOT EDIT
from dash.development.base_component import Component, _explicitize_args
class Datalist(Component):
"""A Datalist component.
Keyword arguments:
- children (a list of or a singular dash component, string or number; optional): The children of this component
- id (string; optio... | 74.967742 | 586 | 0.737091 |
from dash.development.base_component import Component, _explicitize_args
class Datalist(Component):
@_explicitize_args
def __init__(self, children=None, id=Component.UNDEFINED, n_clicks=Component.UNDEFINED, n_clicks_timestamp=Component.UNDEFINED, key=Component.UNDEFINED, role=Component.UNDEFINED, accessKey=... | true | true |
f742976f167568b2f2d650209b8eb7909d8394da | 5,099 | py | Python | litex_boards/targets/de10lite.py | piotr-binkowski/litex-boards | bee71da7746c6fda0d4e1942452510e11f06c14a | [
"BSD-2-Clause"
] | 1 | 2022-02-20T00:06:32.000Z | 2022-02-20T00:06:32.000Z | litex_boards/targets/de10lite.py | piotr-binkowski/litex-boards | bee71da7746c6fda0d4e1942452510e11f06c14a | [
"BSD-2-Clause"
] | null | null | null | litex_boards/targets/de10lite.py | piotr-binkowski/litex-boards | bee71da7746c6fda0d4e1942452510e11f06c14a | [
"BSD-2-Clause"
] | null | null | null | #!/usr/bin/env python3
#
# This file is part of LiteX-Boards.
#
# Copyright (c) 2019 msloniewski <marcin.sloniewski@gmail.com>
# SPDX-License-Identifier: BSD-2-Clause
import os
import argparse
from migen import *
from migen.genlib.resetsync import AsyncResetSynchronizer
from litex.build.io import DDROutput
from li... | 39.527132 | 112 | 0.539714 |
import os
import argparse
from migen import *
from migen.genlib.resetsync import AsyncResetSynchronizer
from litex.build.io import DDROutput
from litex_boards.platforms import de10lite
from litex.soc.cores.clock import Max10PLL
from litex.soc.integration.soc import SoCRegion
from litex.soc.integration.soc_c... | true | true |
f74299af0e78e32d3fc83a47422b53948e3f45a4 | 726 | py | Python | utils/exceptions.py | xianfang-qian/docker_ci | 0ff773d1e7d9420ef6a05a63bc56b32952b71192 | [
"Apache-2.0"
] | 35 | 2020-10-11T07:39:42.000Z | 2022-03-20T06:17:08.000Z | utils/exceptions.py | xianfang-qian/docker_ci | 0ff773d1e7d9420ef6a05a63bc56b32952b71192 | [
"Apache-2.0"
] | 32 | 2020-10-13T06:58:20.000Z | 2022-02-10T04:34:03.000Z | utils/exceptions.py | xianfang-qian/docker_ci | 0ff773d1e7d9420ef6a05a63bc56b32952b71192 | [
"Apache-2.0"
] | 39 | 2020-10-07T07:22:20.000Z | 2022-03-14T18:21:56.000Z | # -*- coding: utf-8 -*-
# Copyright (C) 2019-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Custom exceptions for this framework"""
class FailedStepError(Exception):
"""Generic non-specific exception"""
pass
class FailedBuildError(Exception):
"""Exception on failed Docker image build"""... | 20.742857 | 67 | 0.707989 |
class FailedStepError(Exception):
pass
class FailedBuildError(Exception):
pass
class FailedDeployError(Exception):
pass
class FailedTestError(Exception):
pass
class LayerNotFoundError(Exception):
pass
class InputNotValidError(Exception):
pass
| true | true |
f7429ad2198e24f0e023aab768c4500eb7130a3f | 231 | py | Python | scripts/plotFlops.py | tom-klotz/ellipsoid-solvation | 2bcaab45a9096ae078711b4f4e1495c2bead16a0 | [
"BSD-2-Clause"
] | 1 | 2016-11-05T20:15:01.000Z | 2016-11-05T20:15:01.000Z | scripts/plotFlops.py | tom-klotz/ellipsoid-solvation | 2bcaab45a9096ae078711b4f4e1495c2bead16a0 | [
"BSD-2-Clause"
] | null | null | null | scripts/plotFlops.py | tom-klotz/ellipsoid-solvation | 2bcaab45a9096ae078711b4f4e1495c2bead16a0 | [
"BSD-2-Clause"
] | null | null | null | from numpy import *
from matplotlib.pyplot import *
figure()
A = loadtxt('flopsext.txt', usecols={3})
B = loadtxt('flopsint.txt', usecols={3})
A = cumsum(A)
Awow = A / 100;
B = cumsum(B)
semilogy(A, '+', Awow, '_', B, 'o')
show()
| 19.25 | 40 | 0.627706 | from numpy import *
from matplotlib.pyplot import *
figure()
A = loadtxt('flopsext.txt', usecols={3})
B = loadtxt('flopsint.txt', usecols={3})
A = cumsum(A)
Awow = A / 100;
B = cumsum(B)
semilogy(A, '+', Awow, '_', B, 'o')
show()
| true | true |
f7429c132466c1c2f5ab153e46e7b1f8dcbf4713 | 7,286 | py | Python | ppapi/generators/idl_namespace.py | Scopetta197/chromium | b7bf8e39baadfd9089de2ebdc0c5d982de4a9820 | [
"BSD-3-Clause"
] | 212 | 2015-01-31T11:55:58.000Z | 2022-02-22T06:35:11.000Z | ppapi/generators/idl_namespace.py | 1065672644894730302/Chromium | 239dd49e906be4909e293d8991e998c9816eaa35 | [
"BSD-3-Clause"
] | 5 | 2015-03-27T14:29:23.000Z | 2019-09-25T13:23:12.000Z | ppapi/generators/idl_namespace.py | 1065672644894730302/Chromium | 239dd49e906be4909e293d8991e998c9816eaa35 | [
"BSD-3-Clause"
] | 221 | 2015-01-07T06:21:24.000Z | 2022-02-11T02:51:12.000Z | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
IDLNamespace for PPAPI
This file defines the behavior of the AST namespace which allows for resolving
a symbol as one or more ... | 29.144 | 79 | 0.667719 |
"""
IDLNamespace for PPAPI
This file defines the behavior of the AST namespace which allows for resolving
a symbol as one or more AST nodes given a release or range of releases.
"""
import sys
from idl_option import GetOption, Option, ParseOptions
from idl_log import ErrOut, InfoOut, WarnOut
from idl_release im... | false | true |
f7429cc3bf46b07ab633bfab316a2659cbd94b06 | 7,819 | py | Python | proteus/tests/ProjScheme_with_EV/NS_convergence.py | acatwithacomputer/proteus | 80dfad95da6ab4d18a88a035f55c26b03540a864 | [
"MIT"
] | null | null | null | proteus/tests/ProjScheme_with_EV/NS_convergence.py | acatwithacomputer/proteus | 80dfad95da6ab4d18a88a035f55c26b03540a864 | [
"MIT"
] | 13 | 2018-02-08T23:22:59.000Z | 2020-12-06T19:40:32.000Z | proteus/tests/ProjScheme_with_EV/NS_convergence.py | acatwithacomputer/proteus | 80dfad95da6ab4d18a88a035f55c26b03540a864 | [
"MIT"
] | 1 | 2020-02-17T03:25:34.000Z | 2020-02-17T03:25:34.000Z | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from past.utils import old_div
from math import *
import proteus.MeshTools
from proteus import Domain
from proteus.default_n import *
from proteus.Profiling import logEvent
from .parameters import *
manufacture... | 30.905138 | 125 | 0.649188 | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from past.utils import old_div
from math import *
import proteus.MeshTools
from proteus import Domain
from proteus.default_n import *
from proteus.Profiling import logEvent
from .parameters import *
manufacture... | true | true |
f7429da2993d70de73b1401ab6d5490af2b25913 | 1,686 | py | Python | setup.py | verdel/transmission-telegram-bot | e6b48e45c8b273f98771bb17177b29ec7c27b67d | [
"MIT"
] | null | null | null | setup.py | verdel/transmission-telegram-bot | e6b48e45c8b273f98771bb17177b29ec7c27b67d | [
"MIT"
] | null | null | null | setup.py | verdel/transmission-telegram-bot | e6b48e45c8b273f98771bb17177b29ec7c27b67d | [
"MIT"
] | 3 | 2020-06-27T03:56:01.000Z | 2020-09-03T07:15:50.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from codecs import open
from os import path
from setuptools import setup, find_packages
here = path.abspath(path.dirname(__file__))
with open('transmission_telegram_bot/__init__.py') as f:
for line in f:
if line.find("__version__") >= 0:
version =... | 33.72 | 87 | 0.650059 |
from codecs import open
from os import path
from setuptools import setup, find_packages
here = path.abspath(path.dirname(__file__))
with open('transmission_telegram_bot/__init__.py') as f:
for line in f:
if line.find("__version__") >= 0:
version = line.split("=")[1].strip()
vers... | true | true |
f7429e4d5b98ba3325a8628333fdc367c22c1aaf | 18,447 | py | Python | insights/parsers/modinfo.py | lhuett/insights-core | 1c84eeffc037f85e2bbf60c9a302c83aa1a50cf8 | [
"Apache-2.0"
] | 121 | 2017-05-30T20:23:25.000Z | 2022-03-23T12:52:15.000Z | insights/parsers/modinfo.py | lhuett/insights-core | 1c84eeffc037f85e2bbf60c9a302c83aa1a50cf8 | [
"Apache-2.0"
] | 1,977 | 2017-05-26T14:36:03.000Z | 2022-03-31T10:38:53.000Z | insights/parsers/modinfo.py | lhuett/insights-core | 1c84eeffc037f85e2bbf60c9a302c83aa1a50cf8 | [
"Apache-2.0"
] | 244 | 2017-05-30T20:22:57.000Z | 2022-03-26T10:09:39.000Z | """
ModInfo - Commands ``modinfo <module_name>``
============================================
Parsers to parse the output of ``modinfo <module_name>`` commands.
ModInfoI40e - Command ``modinfo i40e``
--------------------------------------
ModInfoVmxnet3 - Command ``modinfo vmxnet3``
----------------------------------... | 37.80123 | 203 | 0.576408 |
from insights import parser, CommandParser
from insights.parsers import SkipException
from insights.specs import Specs
class ModInfo(dict):
@classmethod
def from_content(cls, content):
if not content:
raise SkipException("No Contents")
data = {}
for line in content:
... | true | true |
f7429e7f27a5ea350d00f6c5e99f03ab2f84dee3 | 1,264 | py | Python | metadrive/examples/profile_metadrive.py | liuzuxin/metadrive | 850c207536531bc85179084acd7c30ab14a66111 | [
"Apache-2.0"
] | 125 | 2021-08-30T06:33:57.000Z | 2022-03-31T09:02:44.000Z | metadrive/examples/profile_metadrive.py | liuzuxin/metadrive | 850c207536531bc85179084acd7c30ab14a66111 | [
"Apache-2.0"
] | 72 | 2021-08-30T16:23:41.000Z | 2022-03-31T19:17:16.000Z | metadrive/examples/profile_metadrive.py | liuzuxin/metadrive | 850c207536531bc85179084acd7c30ab14a66111 | [
"Apache-2.0"
] | 20 | 2021-09-09T08:20:25.000Z | 2022-03-24T13:24:07.000Z | import time
import numpy as np
from metadrive import MetaDriveEnv
from metadrive.utils import setup_logger
if __name__ == '__main__':
print("Start to profile the efficiency of MetaDrive with 1000 maps and ~8 vehicles!")
setup_logger(debug=False)
env = MetaDriveEnv(dict(
environment_num=1000,
... | 33.263158 | 112 | 0.560127 | import time
import numpy as np
from metadrive import MetaDriveEnv
from metadrive.utils import setup_logger
if __name__ == '__main__':
print("Start to profile the efficiency of MetaDrive with 1000 maps and ~8 vehicles!")
setup_logger(debug=False)
env = MetaDriveEnv(dict(
environment_num=1000,
... | true | true |
f7429fcd096d956f247ba903d5f835404932df07 | 15,469 | py | Python | src/blueprint/azext_blueprint/vendored_sdks/blueprint/aio/operations/_published_blueprints_operations.py | haroonf/azure-cli-extensions | 61c044d34c224372f186934fa7c9313f1cd3a525 | [
"MIT"
] | 207 | 2017-11-29T06:59:41.000Z | 2022-03-31T10:00:53.000Z | src/blueprint/azext_blueprint/vendored_sdks/blueprint/aio/operations/_published_blueprints_operations.py | haroonf/azure-cli-extensions | 61c044d34c224372f186934fa7c9313f1cd3a525 | [
"MIT"
] | 4,061 | 2017-10-27T23:19:56.000Z | 2022-03-31T23:18:30.000Z | src/blueprint/azext_blueprint/vendored_sdks/blueprint/aio/operations/_published_blueprints_operations.py | haroonf/azure-cli-extensions | 61c044d34c224372f186934fa7c9313f1cd3a525 | [
"MIT"
] | 802 | 2017-10-11T17:36:26.000Z | 2022-03-31T22:24:32.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 ... | 48.190031 | 143 | 0.669145 |
from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar
import warnings
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pi... | true | true |
f742a0a303b4ddb2bd9f0cc47789054f0f8d7f9a | 7,148 | py | Python | assignment_4/dtd.py | archiviral/machine-learning-assignments | 198d5a713344ac33fe479eed01c534a3ab12d78c | [
"MIT"
] | null | null | null | assignment_4/dtd.py | archiviral/machine-learning-assignments | 198d5a713344ac33fe479eed01c534a3ab12d78c | [
"MIT"
] | null | null | null | assignment_4/dtd.py | archiviral/machine-learning-assignments | 198d5a713344ac33fe479eed01c534a3ab12d78c | [
"MIT"
] | 1 | 2021-09-29T17:00:14.000Z | 2021-09-29T17:00:14.000Z | import argparse
import os
import sys
import time
import datetime
from copy import deepcopy
import numpy as np
CONTINOUS_COLUMNS = [0, 2, 3, 9, 10, 11]
TTL = 30
class Node:
def __init__(self, prediction, continuous=None, unqs=None, column=None, median=None):
self.children = []
self.column = colum... | 28.365079 | 119 | 0.58394 | import argparse
import os
import sys
import time
import datetime
from copy import deepcopy
import numpy as np
CONTINOUS_COLUMNS = [0, 2, 3, 9, 10, 11]
TTL = 30
class Node:
def __init__(self, prediction, continuous=None, unqs=None, column=None, median=None):
self.children = []
self.column = colum... | true | true |
f742a124db26f049b296f2ac70cac7c8f2d49eee | 4,212 | py | Python | rv/params.py | 6aika/rest-validator | db536ed8b840a254adf76c234a39181a1802863d | [
"MIT"
] | null | null | null | rv/params.py | 6aika/rest-validator | db536ed8b840a254adf76c234a39181a1802863d | [
"MIT"
] | null | null | null | rv/params.py | 6aika/rest-validator | db536ed8b840a254adf76c234a39181a1802863d | [
"MIT"
] | null | null | null | import datetime
import random
from operator import eq
import dateutil.parser
class Param(object):
"""
Wraps a property on an object and optionally how it corresponds to a
parameter of some sort.
"""
def __init__(self, *, property, parameter=None, operator=eq, bucket=None, discrete=True):
... | 29.25 | 120 | 0.608262 | import datetime
import random
from operator import eq
import dateutil.parser
class Param(object):
def __init__(self, *, property, parameter=None, operator=eq, bucket=None, discrete=True):
assert property
self.property = property
self.parameter = (parameter or property)
self.opera... | true | true |
f742a1c70910d4066ed32ea9f31357eafe73ee24 | 147 | py | Python | 1_Fibonacci/Python_C/fib.py | thmosqueiro/ctypes_tests | 200c92e6f38cea2b6b7208565965e5bbdbf46262 | [
"MIT"
] | null | null | null | 1_Fibonacci/Python_C/fib.py | thmosqueiro/ctypes_tests | 200c92e6f38cea2b6b7208565965e5bbdbf46262 | [
"MIT"
] | null | null | null | 1_Fibonacci/Python_C/fib.py | thmosqueiro/ctypes_tests | 200c92e6f38cea2b6b7208565965e5bbdbf46262 | [
"MIT"
] | null | null | null | import ctypes
lib = ctypes.cdll['./FibonacciLib.so']
fib = lib['fib']
for j in range(15):
x = 3*j + 3
print "fib(%d) = %d" %( x,fib(x) )
| 16.333333 | 38 | 0.544218 | import ctypes
lib = ctypes.cdll['./FibonacciLib.so']
fib = lib['fib']
for j in range(15):
x = 3*j + 3
print "fib(%d) = %d" %( x,fib(x) )
| false | true |
f742a3327472b238ecd66bc4a53b16282afcfef2 | 3,816 | py | Python | magenta/video/tools/convert2jpg.py | bugrevelio/magenta | a54c6e4aa8b32f2625d416fb1b39b03d123e1e51 | [
"Apache-2.0"
] | 2 | 2020-08-06T07:29:33.000Z | 2020-10-26T22:00:53.000Z | magenta/video/tools/convert2jpg.py | bugrevelio/magenta | a54c6e4aa8b32f2625d416fb1b39b03d123e1e51 | [
"Apache-2.0"
] | 1 | 2022-02-11T19:01:43.000Z | 2022-02-11T19:01:56.000Z | magenta/video/tools/convert2jpg.py | bugrevelio/magenta | a54c6e4aa8b32f2625d416fb1b39b03d123e1e51 | [
"Apache-2.0"
] | 2 | 2020-02-11T13:01:58.000Z | 2020-03-03T08:11:00.000Z | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | 31.53719 | 78 | 0.658281 |
"""convert all files in a folder to jpg."""
import argparse
import glob
import ntpath
import os
from PIL import Image
PARSER = argparse.ArgumentParser(description='')
PARSER.add_argument(
'--path_in',
dest='path_in',
default='',
help='folder where the pictures are',
required=True)
PAR... | false | true |
f742a37c18e7aa7931bd266dccc76ef8b9ef6e57 | 24,078 | py | Python | src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations/_host_pools_operations.py | haroonf/azure-cli-extensions | 61c044d34c224372f186934fa7c9313f1cd3a525 | [
"MIT"
] | 1 | 2022-01-25T07:33:18.000Z | 2022-01-25T07:33:18.000Z | src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations/_host_pools_operations.py | haroonf/azure-cli-extensions | 61c044d34c224372f186934fa7c9313f1cd3a525 | [
"MIT"
] | 9 | 2022-03-25T19:35:49.000Z | 2022-03-31T06:09:47.000Z | src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations/_host_pools_operations.py | haroonf/azure-cli-extensions | 61c044d34c224372f186934fa7c9313f1cd3a525 | [
"MIT"
] | 1 | 2022-03-10T22:13:02.000Z | 2022-03-10T22:13:02.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 ... | 48.740891 | 229 | 0.667082 |
from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union
import warnings
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.... | true | true |
f742a4cb3a41f591c76d4933bb4c66d3954de8ab | 5,271 | py | Python | ocr2text.py | danijel1124/ocr2text | 26fec917ec72299f9255546a5c3469bd0f84dab7 | [
"MIT"
] | 72 | 2019-10-11T03:15:23.000Z | 2022-03-28T21:38:59.000Z | ocr2text.py | junmei/ocr2text | 14cc9e70506456c4e0b65a3687a63f53c0ffb5db | [
"MIT"
] | 7 | 2020-05-20T07:53:12.000Z | 2022-02-01T07:53:58.000Z | ocr2text.py | junmei/ocr2text | 14cc9e70506456c4e0b65a3687a63f53c0ffb5db | [
"MIT"
] | 19 | 2019-10-11T03:15:33.000Z | 2022-02-22T17:00:21.000Z | import os
import shutil
import errno
import subprocess
import tempfile
from tempfile import mkdtemp
try:
from PIL import Image
except ImportError:
print('Error: You need to install the "Image" package. Type the following:')
print('pip install Image')
try:
import pytesseract
except ImportError:
pri... | 32.337423 | 91 | 0.605957 | import os
import shutil
import errno
import subprocess
import tempfile
from tempfile import mkdtemp
try:
from PIL import Image
except ImportError:
print('Error: You need to install the "Image" package. Type the following:')
print('pip install Image')
try:
import pytesseract
except ImportError:
pri... | true | true |
f742a51d6eebf12b9ba603cda72561893732604c | 780 | py | Python | galleria/migrations/0008_auto_20210906_0623.py | Awadh-Awadh/AGalleria | a0313497d6b090223af93cd309bc1cd2de92dd02 | [
"MIT"
] | null | null | null | galleria/migrations/0008_auto_20210906_0623.py | Awadh-Awadh/AGalleria | a0313497d6b090223af93cd309bc1cd2de92dd02 | [
"MIT"
] | null | null | null | galleria/migrations/0008_auto_20210906_0623.py | Awadh-Awadh/AGalleria | a0313497d6b090223af93cd309bc1cd2de92dd02 | [
"MIT"
] | null | null | null | # Generated by Django 3.2.7 on 2021-09-06 06:23
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('galleria', '0007_rename_cats_cat'),
]
operations = [
migrations.CreateModel(
name='Location',
... | 28.888889 | 128 | 0.6 |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('galleria', '0007_rename_cats_cat'),
]
operations = [
migrations.CreateModel(
name='Location',
fields=[
('id', mode... | true | true |
f742a5739d6555c65365df4f3f7466b6b45467ab | 1,164 | py | Python | bootstrap/pentagram/interpret/block_test.py | pentagram-lang/pentagram | 5c4dc2fc516ec2844dc71ddb778ddadec036ce55 | [
"MIT"
] | 2 | 2018-07-28T22:41:12.000Z | 2018-08-11T02:17:02.000Z | bootstrap/pentagram/interpret/block_test.py | tacit-lang/tacit | 5c4dc2fc516ec2844dc71ddb778ddadec036ce55 | [
"MIT"
] | 17 | 2017-12-23T02:15:03.000Z | 2019-03-31T01:15:15.000Z | bootstrap/pentagram/interpret/block_test.py | tacit-lang/tacit | 5c4dc2fc516ec2844dc71ddb778ddadec036ce55 | [
"MIT"
] | null | null | null | from __future__ import annotations
from numpy import int32
from pentagram.interpret.block import interpret_block
from pentagram.interpret.test import init_test_frame_stack
from pentagram.machine import MachineExpressionStack
from pentagram.machine import MachineFrameStack
from pentagram.machine import MachineNumber
fr... | 30.631579 | 60 | 0.752577 | from __future__ import annotations
from numpy import int32
from pentagram.interpret.block import interpret_block
from pentagram.interpret.test import init_test_frame_stack
from pentagram.machine import MachineExpressionStack
from pentagram.machine import MachineFrameStack
from pentagram.machine import MachineNumber
fr... | true | true |
f742a5b5d303e4f4824c0f008eaa8c25bf165081 | 621 | py | Python | noisify/helpers/saved_init_statement.py | dstl/Noisify | d776a74a66fa71c3f6aacd64f8c21af4f41f1714 | [
"MIT"
] | 11 | 2019-05-03T17:25:05.000Z | 2020-05-20T16:23:00.000Z | noisify/helpers/saved_init_statement.py | dstl/Noisify | d776a74a66fa71c3f6aacd64f8c21af4f41f1714 | [
"MIT"
] | null | null | null | noisify/helpers/saved_init_statement.py | dstl/Noisify | d776a74a66fa71c3f6aacd64f8c21af4f41f1714 | [
"MIT"
] | 2 | 2021-04-10T22:02:12.000Z | 2021-11-29T08:46:50.000Z | """
.. Dstl (c) Crown Copyright 2019
"""
import inspect
class SavedInitStatement:
"""Init statement saving mixin, introspects on object instantiation arguments and
saves them to the final object"""
def __init__(self, *args, **kwargs):
frame = inspect.currentframe()
_, _, _, values = inspe... | 28.227273 | 85 | 0.584541 | import inspect
class SavedInitStatement:
def __init__(self, *args, **kwargs):
frame = inspect.currentframe()
_, _, _, values = inspect.getargvalues(frame)
value_set = [str(values['args'])]
if kwargs:
if values['args']:
value_set += [str(values['kwargs']... | true | true |
f742a5c8321e25e3467e825bea40168c002d97f3 | 2,459 | py | Python | src/main/python/countries/vocabulary.py | phohenecker/country-data-gen | 16db50fe7383671c526d6c3c8101e51953b613b2 | [
"BSD-2-Clause"
] | 4 | 2018-09-03T09:48:05.000Z | 2021-09-20T16:40:35.000Z | src/main/python/countries/vocabulary.py | phohenecker/country-data-gen | 16db50fe7383671c526d6c3c8101e51953b613b2 | [
"BSD-2-Clause"
] | null | null | null | src/main/python/countries/vocabulary.py | phohenecker/country-data-gen | 16db50fe7383671c526d6c3c8101e51953b613b2 | [
"BSD-2-Clause"
] | 1 | 2020-03-21T20:12:00.000Z | 2020-03-21T20:12:00.000Z | # -*- coding: utf-8 -*-
"""This module defines various constants that describe the vocabulary of the used ontology."""
__author__ = "Patrick Hohenecker"
__copyright__ = (
"Copyright (c) 2018, Patrick Hohenecker\n"
"All rights reserved.\n"
"\n"
"Redistribution and use in source and bin... | 46.396226 | 94 | 0.704758 |
__author__ = "Patrick Hohenecker"
__copyright__ = (
"Copyright (c) 2018, Patrick Hohenecker\n"
"All rights reserved.\n"
"\n"
"Redistribution and use in source and binary forms, with or without\n"
"modification, are permitted provided that the following conditions are met:\n"
... | true | true |
f742a5c9df24d696a77918127127f5d992d640d6 | 2,890 | py | Python | examples/guarded/guarded.py | schwabe/nevow | 12fce8aed130aeab74352e232666f3c5a2223817 | [
"MIT"
] | null | null | null | examples/guarded/guarded.py | schwabe/nevow | 12fce8aed130aeab74352e232666f3c5a2223817 | [
"MIT"
] | null | null | null | examples/guarded/guarded.py | schwabe/nevow | 12fce8aed130aeab74352e232666f3c5a2223817 | [
"MIT"
] | 1 | 2019-02-28T13:46:26.000Z | 2019-02-28T13:46:26.000Z |
from zope.interface import implements
from twisted.cred import portal, checkers, credentials
from nevow import inevow, rend, tags, guard, loaders
### Renderers
class NotLoggedIn(rend.Page):
"""The resource that is returned when you are not logged in"""
addSlash = True
docFactory = loaders.stan(
tag... | 29.191919 | 105 | 0.568858 |
from zope.interface import implements
from twisted.cred import portal, checkers, credentials
from nevow import inevow, rend, tags, guard, loaders
.Page):
addSlash = True
docFactory = loaders.stan(
tags.html[
tags.head[tags.title["Not Logged In"]],
tags.body[
tags.form(action... | true | true |
f742a63ec55a16ffca53f1a4d8bf318e962cfc73 | 2,039 | py | Python | unclecrypto/crypto.py | UncleEngineer/unclecrypto | fd26b123dab32a2b259b6226d26317f76a939b6f | [
"MIT"
] | 1 | 2021-04-20T01:56:02.000Z | 2021-04-20T01:56:02.000Z | unclecrypto/crypto.py | UncleEngineer/unclecrypto | fd26b123dab32a2b259b6226d26317f76a939b6f | [
"MIT"
] | null | null | null | unclecrypto/crypto.py | UncleEngineer/unclecrypto | fd26b123dab32a2b259b6226d26317f76a939b6f | [
"MIT"
] | null | null | null | #crypto.py
from urllib.request import urlopen as req
from bs4 import BeautifulSoup as soup
def rangeprice(name='bitcoin',start='20200101',end='20200131'):
url = 'https://coinmarketcap.com/currencies/{}/historical-data/?start={}&end={}'.format(name,start,end)
webopen = req(url)
page_html = webopen.read()
webopen... | 25.17284 | 137 | 0.632663 |
from urllib.request import urlopen as req
from bs4 import BeautifulSoup as soup
def rangeprice(name='bitcoin',start='20200101',end='20200131'):
url = 'https://coinmarketcap.com/currencies/{}/historical-data/?start={}&end={}'.format(name,start,end)
webopen = req(url)
page_html = webopen.read()
webopen.close()
... | true | true |
f742a6b635a76426f87fe1fe8f4b8896a048e5ea | 4,090 | py | Python | Learning/Contests/HackerEarth/ChipMonk/loader_test.py | shiva92/Contests | 720bb3699f774a6ea1f99e888e0cd784e63130c8 | [
"Apache-2.0"
] | null | null | null | Learning/Contests/HackerEarth/ChipMonk/loader_test.py | shiva92/Contests | 720bb3699f774a6ea1f99e888e0cd784e63130c8 | [
"Apache-2.0"
] | null | null | null | Learning/Contests/HackerEarth/ChipMonk/loader_test.py | shiva92/Contests | 720bb3699f774a6ea1f99e888e0cd784e63130c8 | [
"Apache-2.0"
] | null | null | null | __author__ = 'anonymous'
import unittest
import json
from config_loader import ConfigLoader
class LoaderTest(unittest.TestCase):
def test_settings_1(self):
loader = ConfigLoader('config.ini', ['production', 'staging'])
expected = json.dumps('26214400')
actual = loader.get('common.basic_si... | 36.846847 | 82 | 0.595599 | __author__ = 'anonymous'
import unittest
import json
from config_loader import ConfigLoader
class LoaderTest(unittest.TestCase):
def test_settings_1(self):
loader = ConfigLoader('config.ini', ['production', 'staging'])
expected = json.dumps('26214400')
actual = loader.get('common.basic_si... | true | true |
f742a6f2f4fff160e99ef6eb243f208e29887477 | 460 | py | Python | manage.py | pskfry/wowrecruitapi | 42dba9745a44c18bc001b9d36f338ee65023a36e | [
"MIT"
] | null | null | null | manage.py | pskfry/wowrecruitapi | 42dba9745a44c18bc001b9d36f338ee65023a36e | [
"MIT"
] | 1 | 2021-06-02T00:28:16.000Z | 2021-06-02T00:28:16.000Z | manage.py | pskfry/wowrecruitapi | 42dba9745a44c18bc001b9d36f338ee65023a36e | [
"MIT"
] | null | null | null | import os
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from scraper import scrape
import sys
from app import app, db
app.config.from_object(os.environ['APP_SETTINGS'])
migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command('db', MigrateCommand)
@manager.command
... | 20 | 50 | 0.773913 | import os
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from scraper import scrape
import sys
from app import app, db
app.config.from_object(os.environ['APP_SETTINGS'])
migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command('db', MigrateCommand)
@manager.command
... | true | true |
f742a8164b847312a5823eaaec3d534c61ba4a4e | 4,684 | py | Python | ts_datasets/ts_datasets/anomaly/smd.py | cnll0075/Merlion | 37fb75ccb204d128fde8ad4230f7893da724cf7c | [
"BSD-3-Clause"
] | 2,215 | 2021-09-21T18:11:36.000Z | 2022-03-31T20:21:42.000Z | ts_datasets/ts_datasets/anomaly/smd.py | cnll0075/Merlion | 37fb75ccb204d128fde8ad4230f7893da724cf7c | [
"BSD-3-Clause"
] | 56 | 2021-09-22T14:45:50.000Z | 2022-03-29T22:28:19.000Z | ts_datasets/ts_datasets/anomaly/smd.py | cnll0075/Merlion | 37fb75ccb204d128fde8ad4230f7893da724cf7c | [
"BSD-3-Clause"
] | 181 | 2021-09-22T09:04:22.000Z | 2022-03-29T16:04:43.000Z | #
# Copyright (c) 2021 salesforce.com, inc.
# All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
# For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
#
import os
import sys
import logging
import requests
import tarfile
import numpy as np
import pandas ... | 40.034188 | 110 | 0.648377 |
import os
import sys
import logging
import requests
import tarfile
import numpy as np
import pandas as pd
from pathlib import Path
from ts_datasets.anomaly.base import TSADBaseDataset
_logger = logging.getLogger(__name__)
_logger.setLevel(logging.DEBUG)
_handler = logging.StreamHandler(sys.stdout)
_handler.setLe... | true | true |
f742a886ed3869e06ef2decc3cbd535560b94e94 | 4,969 | py | Python | configs/body/2d_kpt_sview_rgb_img/topdown_heatmap/coco/hrnet_w32_coco_256x192_photometric.py | ALISCIFP/mmpose | 2433e3dbcc44baa2253e2a7c748ba0216937933e | [
"Apache-2.0"
] | 1 | 2022-02-13T12:27:40.000Z | 2022-02-13T12:27:40.000Z | configs/body/2d_kpt_sview_rgb_img/topdown_heatmap/coco/hrnet_w32_coco_256x192_photometric.py | ALISCIFP/mmpose | 2433e3dbcc44baa2253e2a7c748ba0216937933e | [
"Apache-2.0"
] | null | null | null | configs/body/2d_kpt_sview_rgb_img/topdown_heatmap/coco/hrnet_w32_coco_256x192_photometric.py | ALISCIFP/mmpose | 2433e3dbcc44baa2253e2a7c748ba0216937933e | [
"Apache-2.0"
] | null | null | null | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco.py'
]
evaluation = dict(interval=10, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='l... | 29.577381 | 79 | 0.587643 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco.py'
]
evaluation = dict(interval=10, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
lr_config = dict(
policy='step',
warmup='linear',
warmu... | true | true |
f742a8880c6e70d762a87ce81a2c2abd67031312 | 348 | py | Python | examples/usage_examples/dial_example.py | jha929/pyMODI | 6175e6579b7fab4d26a8add852bbc8357eb8bf30 | [
"MIT"
] | 13 | 2020-05-19T02:34:05.000Z | 2022-02-18T06:44:34.000Z | examples/usage_examples/dial_example.py | jha929/pyMODI | 6175e6579b7fab4d26a8add852bbc8357eb8bf30 | [
"MIT"
] | 48 | 2018-08-21T07:56:35.000Z | 2020-05-03T02:08:26.000Z | examples/usage_examples/dial_example.py | jha929/pyMODI | 6175e6579b7fab4d26a8add852bbc8357eb8bf30 | [
"MIT"
] | 23 | 2020-05-18T06:34:54.000Z | 2021-02-25T11:50:17.000Z | import modi
import time
"""
Example script for the usage of dial module
Make sure you connect 1 dial module and 1 speaker module to your network module
"""
if __name__ == "__main__":
bundle = modi.MODI()
dial = bundle.dials[0]
speak = bundle.speakers[0]
while True:
speak.tune = 800, dial.degr... | 20.470588 | 79 | 0.666667 | import modi
import time
if __name__ == "__main__":
bundle = modi.MODI()
dial = bundle.dials[0]
speak = bundle.speakers[0]
while True:
speak.tune = 800, dial.degree
time.sleep(0.02)
| true | true |
f742a889e01c5722d8e2c7c5ce68a091278318e6 | 6,699 | py | Python | xarmedbandits/HOO.py | christiangeissler/gradoptbenchmark | 4ea7928c2184728ffc8bf018d693ed27c2f2c9f1 | [
"MIT"
] | 1 | 2019-07-03T13:56:55.000Z | 2019-07-03T13:56:55.000Z | xarmedbandits/HOO.py | christiangeissler/gradoptbenchmark | 4ea7928c2184728ffc8bf018d693ed27c2f2c9f1 | [
"MIT"
] | null | null | null | xarmedbandits/HOO.py | christiangeissler/gradoptbenchmark | 4ea7928c2184728ffc8bf018d693ed27c2f2c9f1 | [
"MIT"
] | 1 | 2020-07-02T12:09:04.000Z | 2020-07-02T12:09:04.000Z | # -*- coding: utf-8 -*-
from xarmedbandits import TreeNode
import random
import math
"""
This class is built around the ideas that are thoroughly explained in the paper
"X-armed Bandits" by Bubeck et al., 2011.
"""
class HOO(object):
"""
The hierarchical optimistic optimization algorithm.
"""
... | 39.175439 | 117 | 0.616361 |
from xarmedbandits import TreeNode
import random
import math
class HOO(object):
def __init__(self, v1, ro, covering_generator_function):
if 0 >= ro:
ro = 0.001
elif ro >= 1:
ro = 0.999
self.ro = ro
self.v1 = v1
self.tree_coverings = cov... | true | true |
f742a8a0098fcdc80e572b74fde7292eb1682458 | 3,041 | py | Python | flexget/plugins/urlrewrite_torrentz.py | Crupuk/Flexget | 0ede246fd4b90e3cd75120ba13746187e11968d2 | [
"MIT"
] | null | null | null | flexget/plugins/urlrewrite_torrentz.py | Crupuk/Flexget | 0ede246fd4b90e3cd75120ba13746187e11968d2 | [
"MIT"
] | null | null | null | flexget/plugins/urlrewrite_torrentz.py | Crupuk/Flexget | 0ede246fd4b90e3cd75120ba13746187e11968d2 | [
"MIT"
] | null | null | null | from __future__ import unicode_literals, division, absolute_import
import logging
import re
import urllib
import feedparser
from flexget.plugin import register_plugin, PluginWarning
from flexget.entry import Entry
from flexget.utils.search import torrent_availability, normalize_unicode
from flexget import validator
l... | 35.776471 | 111 | 0.609668 | from __future__ import unicode_literals, division, absolute_import
import logging
import re
import urllib
import feedparser
from flexget.plugin import register_plugin, PluginWarning
from flexget.entry import Entry
from flexget.utils.search import torrent_availability, normalize_unicode
from flexget import validator
l... | true | true |
f742aaab43388a7b5b65a6263e91ba03ee72084a | 4,260 | py | Python | demos/vst.py | peterhinch/micropython_ra8875 | a61314d62d6add831f6618c857b01d1a5b7ce388 | [
"MIT"
] | 6 | 2019-08-15T11:50:20.000Z | 2022-01-22T12:09:57.000Z | demos/vst.py | peterhinch/micropython_ra8875 | a61314d62d6add831f6618c857b01d1a5b7ce388 | [
"MIT"
] | null | null | null | demos/vst.py | peterhinch/micropython_ra8875 | a61314d62d6add831f6618c857b01d1a5b7ce388 | [
"MIT"
] | 2 | 2020-04-19T13:38:52.000Z | 2021-08-16T13:31:39.000Z | # vst.py Demo/test program for vertical slider class for Pyboard RA8875 GUI
# Released under the MIT License (MIT). See LICENSE.
# Copyright (c) 2019-2020 Peter Hinch
# Updated for uasyncio V3
import uasyncio as asyncio
from math import pi
from micropython_ra8875.py.ugui import Screen
from micropython_ra8875.py.col... | 37.368421 | 114 | 0.6 |
import uasyncio as asyncio
from math import pi
from micropython_ra8875.py.ugui import Screen
from micropython_ra8875.py.colors import *
from micropython_ra8875.widgets.buttons import Button, ButtonList
from micropython_ra8875.widgets.label import Label
from micropython_ra8875.widgets.dial import Dial
from micr... | true | true |
f742adc89aa22962515d97de7fcea7ceefef387d | 1,475 | py | Python | mayan/apps/converter/apps.py | eshbeata/open-paperless | 6b9ed1f21908116ad2795b3785b2dbd66713d66e | [
"Apache-2.0"
] | 2,743 | 2017-12-18T07:12:30.000Z | 2022-03-27T17:21:25.000Z | mayan/apps/converter/apps.py | eshbeata/open-paperless | 6b9ed1f21908116ad2795b3785b2dbd66713d66e | [
"Apache-2.0"
] | 15 | 2020-06-06T00:00:48.000Z | 2022-03-12T00:03:54.000Z | mayan/apps/converter/apps.py | eshbeata/open-paperless | 6b9ed1f21908116ad2795b3785b2dbd66713d66e | [
"Apache-2.0"
] | 257 | 2017-12-18T03:12:58.000Z | 2022-03-25T08:59:10.000Z | from __future__ import unicode_literals
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from common import MayanAppConfig, menu_object, menu_sidebar
from navigation import SourceColumn
from .links import (
link_transformation_create, link_transformation_delet... | 29.5 | 80 | 0.665763 | from __future__ import unicode_literals
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from common import MayanAppConfig, menu_object, menu_sidebar
from navigation import SourceColumn
from .links import (
link_transformation_create, link_transformation_delet... | true | true |
f742aebd31e1769400984a7e9498009dc9a956c0 | 2,167 | py | Python | backend/api/ocr/text/keras_detect.py | asa008/nhyai | d97f8a4d18e315dcbd1159c2ed03611adb76ba70 | [
"Apache-2.0"
] | 3 | 2021-02-12T11:49:50.000Z | 2022-03-07T02:05:54.000Z | backend/api/ocr/text/keras_detect.py | ettingshausen/nhyai | 33be2078cf2835d85fedc901d343568e79a5941f | [
"Apache-2.0"
] | null | null | null | backend/api/ocr/text/keras_detect.py | ettingshausen/nhyai | 33be2078cf2835d85fedc901d343568e79a5941f | [
"Apache-2.0"
] | 3 | 2020-04-24T05:39:30.000Z | 2021-08-16T03:23:29.000Z | """
YOLO_v3 Model Defined in Keras.
Reference: https://github.com/qqwweee/keras-yolo3.git
"""
from config import kerasTextModel,IMGSIZE,keras_anchors,class_names,GPU,GPUID
from .keras_yolo3 import yolo_text,box_layer,K
from apphelper.image import resize_im,letterbox_image
from PIL import Image
import numpy as np
impor... | 30.097222 | 87 | 0.623904 | from config import kerasTextModel,IMGSIZE,keras_anchors,class_names,GPU,GPUID
from .keras_yolo3 import yolo_text,box_layer,K
from apphelper.image import resize_im,letterbox_image
from PIL import Image
import numpy as np
import tensorflow as tf
graph = tf.get_default_graph()at(x) for x in keras_anchors.split(',')]
anch... | true | true |
f742af90db665ef1dbe10a4988b1ec91b7f78a5a | 421 | py | Python | src/discsocket/utils/__init__.py | murillotadeo/discsocket | 63d71e7623cf364c19398f00305816623ebc4a41 | [
"MIT"
] | null | null | null | src/discsocket/utils/__init__.py | murillotadeo/discsocket | 63d71e7623cf364c19398f00305816623ebc4a41 | [
"MIT"
] | null | null | null | src/discsocket/utils/__init__.py | murillotadeo/discsocket | 63d71e7623cf364c19398f00305816623ebc4a41 | [
"MIT"
] | null | null | null | from .cdn import return_cdn_avatar
# Set interaction opcodes
DISPATCH = 0
HEARTBEAT = 1
IDENTIFY = 2
RESUME = 6
RECONNECT = 7
INVALID_SESSION = 9
HELLO = 10
HEARTBEAT_ACK = 11
# Set application command types
SLASH = 2
USER = 2
MESSAGE = 3
# Set message response types
CHANNEL_WITH_SOURCE = 4
DEFERRED_CHANNEL_WITH_SOU... | 16.84 | 34 | 0.769596 | from .cdn import return_cdn_avatar
DISPATCH = 0
HEARTBEAT = 1
IDENTIFY = 2
RESUME = 6
RECONNECT = 7
INVALID_SESSION = 9
HELLO = 10
HEARTBEAT_ACK = 11
SLASH = 2
USER = 2
MESSAGE = 3
CHANNEL_WITH_SOURCE = 4
DEFERRED_CHANNEL_WITH_SOURCE = 5
DEFERRED_UPDATE_MESSAGE = 6
UPDATE_MESSAGE = 7
AUTOCOMPLETE_RESULT = 8
__ve... | true | true |
f742afa62f1ea6e852c404f2e5887b2cb5ce2c79 | 382 | py | Python | streamlit/components/sidebar.py | teresaromero/palmer-penguins | 79c3279775d239ed2528ea22f8f6cb92600bd49e | [
"MIT"
] | null | null | null | streamlit/components/sidebar.py | teresaromero/palmer-penguins | 79c3279775d239ed2528ea22f8f6cb92600bd49e | [
"MIT"
] | 21 | 2021-07-24T11:17:18.000Z | 2021-08-18T15:37:00.000Z | streamlit/components/sidebar.py | teresaromero/palmer-penguins | 79c3279775d239ed2528ea22f8f6cb92600bd49e | [
"MIT"
] | null | null | null | import streamlit as st
from utils.constants import NAVIGATION, NAV_VIZ
from pages.data_visualization import sidebar_filter
def navbar():
st.subheader("Navigation")
st.radio("Go to...", options=NAVIGATION, key="page")
def show_sidebar():
sidebar = st.sidebar
with sidebar:
navbar()
if s... | 23.875 | 56 | 0.685864 | import streamlit as st
from utils.constants import NAVIGATION, NAV_VIZ
from pages.data_visualization import sidebar_filter
def navbar():
st.subheader("Navigation")
st.radio("Go to...", options=NAVIGATION, key="page")
def show_sidebar():
sidebar = st.sidebar
with sidebar:
navbar()
if s... | true | true |
f742afee3266519b14f56895d84d8edf84e2747c | 11,503 | py | Python | torch_resizer.py | eyalnaor/DeepTemporalSR | 7d8c821431dec3a4c480550c61a6033fcac5e640 | [
"MIT"
] | 38 | 2020-09-04T10:53:50.000Z | 2021-08-29T13:10:41.000Z | torch_resizer.py | eyalnaor/DeepTemporalSR | 7d8c821431dec3a4c480550c61a6033fcac5e640 | [
"MIT"
] | 1 | 2021-02-24T17:20:58.000Z | 2021-02-24T17:20:58.000Z | torch_resizer.py | eyalnaor/DeepTemporalSR | 7d8c821431dec3a4c480550c61a6033fcac5e640 | [
"MIT"
] | 7 | 2020-12-03T12:11:49.000Z | 2021-08-16T14:43:28.000Z | '''
Code courtesy of Ben Feinstein & Assaf Shocher
Please see their work:
https://github.com/assafshocher/PyTorch-Resizer
https://github.com/feinsteinben
'''
import numpy as np
import torch
from math import pi
from torch import nn
class Resizer(nn.Module):
def __init__(self, in_shape, scale_factor=None, output_sh... | 56.387255 | 153 | 0.666783 | import numpy as np
import torch
from math import pi
from torch import nn
class Resizer(nn.Module):
def __init__(self, in_shape, scale_factor=None, output_shape=None, kernel=None, antialiasing=True, device=None, dtype=None):
super(Resizer, self).__init__()
scale_factor, output_shape = self... | true | true |
f742b256a780ffe56e28ed045c2389437256069e | 1,482 | py | Python | train.py | guopeiming/crosslingual-DepPar | 2d9db02de545bf8920069a20c322498a436a970a | [
"Apache-2.0"
] | 2 | 2022-03-04T14:47:58.000Z | 2022-03-14T03:33:10.000Z | train.py | guopeiming/crosslingual-DepPar | 2d9db02de545bf8920069a20c322498a436a970a | [
"Apache-2.0"
] | null | null | null | train.py | guopeiming/crosslingual-DepPar | 2d9db02de545bf8920069a20c322498a436a970a | [
"Apache-2.0"
] | null | null | null | """
The debug wrapper script.
"""
import argparse
import os
import sys
_ARG_PARSER = argparse.ArgumentParser(description="我的实验,需要指定配置文件")
_ARG_PARSER.add_argument('--cuda', '-c', type=str, default='0', help='gpu ids, like: 1,2,3')
_ARG_PARSER.add_argument('--name', '-n', type=str, default='debug', help='save name.')
... | 27.444444 | 114 | 0.709852 |
import argparse
import os
import sys
_ARG_PARSER = argparse.ArgumentParser(description="我的实验,需要指定配置文件")
_ARG_PARSER.add_argument('--cuda', '-c', type=str, default='0', help='gpu ids, like: 1,2,3')
_ARG_PARSER.add_argument('--name', '-n', type=str, default='debug', help='save name.')
_ARG_PARSER.add_argument('--debug'... | true | true |
f742b266f0216111034fbf4002af35be2b91a59c | 414 | py | Python | examples/termination/n_gen.py | SunTzunami/pymoo-doc | f82d8908fe60792d49a7684c4bfba4a6c1339daf | [
"Apache-2.0"
] | 2 | 2021-09-11T06:43:49.000Z | 2021-11-10T13:36:09.000Z | examples/termination/n_gen.py | SunTzunami/pymoo-doc | f82d8908fe60792d49a7684c4bfba4a6c1339daf | [
"Apache-2.0"
] | 3 | 2021-09-21T14:04:47.000Z | 2022-03-07T13:46:09.000Z | examples/termination/n_gen.py | SunTzunami/pymoo-doc | f82d8908fe60792d49a7684c4bfba4a6c1339daf | [
"Apache-2.0"
] | 3 | 2021-10-09T02:47:26.000Z | 2022-02-10T07:02:37.000Z | from pymoo.algorithms.moo.nsga2 import NSGA2
from pymoo.factory import get_problem, get_termination
from pymoo.optimize import minimize
problem = get_problem("zdt3")
algorithm = NSGA2(pop_size=100)
termination = get_termination("n_gen", 10)
res = minimize(problem,
algorithm,
termination,... | 29.571429 | 54 | 0.657005 | from pymoo.algorithms.moo.nsga2 import NSGA2
from pymoo.factory import get_problem, get_termination
from pymoo.optimize import minimize
problem = get_problem("zdt3")
algorithm = NSGA2(pop_size=100)
termination = get_termination("n_gen", 10)
res = minimize(problem,
algorithm,
termination,... | true | true |
f742b28daa0568636cba854a6322d4a22134ad04 | 448 | py | Python | bin/xray_success.py | tunnysun/SonarqubeTest | ee226a7e334c7d4a600059b33d9123a0d1da46c8 | [
"Apache-2.0"
] | null | null | null | bin/xray_success.py | tunnysun/SonarqubeTest | ee226a7e334c7d4a600059b33d9123a0d1da46c8 | [
"Apache-2.0"
] | null | null | null | bin/xray_success.py | tunnysun/SonarqubeTest | ee226a7e334c7d4a600059b33d9123a0d1da46c8 | [
"Apache-2.0"
] | null | null | null | import time
import json
import socket
import sys
SEGMENT_DOC = json.loads(sys.argv[1])
del SEGMENT_DOC["in_progress"]
END_TIME = time.time()
SEGMENT_DOC["end_time"] = END_TIME
HEADER=json.dumps({"format": "json", "version": 1})
TRACE_DATA = HEADER + "\n" + json.dumps(SEGMENT_DOC)
UDP_IP= "127.0.0.1"
UDP_PORT=2000
soc... | 23.578947 | 55 | 0.747768 | import time
import json
import socket
import sys
SEGMENT_DOC = json.loads(sys.argv[1])
del SEGMENT_DOC["in_progress"]
END_TIME = time.time()
SEGMENT_DOC["end_time"] = END_TIME
HEADER=json.dumps({"format": "json", "version": 1})
TRACE_DATA = HEADER + "\n" + json.dumps(SEGMENT_DOC)
UDP_IP= "127.0.0.1"
UDP_PORT=2000
soc... | false | true |
f742b2d3bbcf1081015ebcba7492dc70601633b4 | 348 | py | Python | examples/example1.py | jayvdb/pubdns | bc6f70d2954a1841a2ae4d5b6235390300f89f3d | [
"MIT"
] | 38 | 2017-12-15T02:23:11.000Z | 2022-02-27T04:54:13.000Z | examples/example1.py | jayvdb/pubdns | bc6f70d2954a1841a2ae4d5b6235390300f89f3d | [
"MIT"
] | 1 | 2020-08-29T07:32:34.000Z | 2020-09-01T13:23:28.000Z | examples/example1.py | jayvdb/pubdns | bc6f70d2954a1841a2ae4d5b6235390300f89f3d | [
"MIT"
] | 4 | 2017-12-21T23:26:49.000Z | 2020-08-29T07:08:45.000Z | from __future__ import print_function
import sys
import logging
import pubdns
logging.basicConfig(level=logging.DEBUG)
try:
pd = pubdns.pubdns()
servers = pd.servers('US', 'los angeles')
rs = pubdns.dns.resolver(servers, 'amazon.com', ['A'])
for r in rs:
print(r)
except pubdns.UpdateError as ... | 21.75 | 58 | 0.689655 | from __future__ import print_function
import sys
import logging
import pubdns
logging.basicConfig(level=logging.DEBUG)
try:
pd = pubdns.pubdns()
servers = pd.servers('US', 'los angeles')
rs = pubdns.dns.resolver(servers, 'amazon.com', ['A'])
for r in rs:
print(r)
except pubdns.UpdateError as ... | true | true |
f742b54201d7d5e529a50ea6fdcae6fe8d7b71d7 | 7,971 | py | Python | salt/utils/process.py | mscherer/salt | 71bba6c676dde3ca762181cd45b45688ea9e0835 | [
"Apache-2.0"
] | null | null | null | salt/utils/process.py | mscherer/salt | 71bba6c676dde3ca762181cd45b45688ea9e0835 | [
"Apache-2.0"
] | null | null | null | salt/utils/process.py | mscherer/salt | 71bba6c676dde3ca762181cd45b45688ea9e0835 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import absolute_import
# Import python libs
import logging
import os
import time
import sys
import multiprocessing
import signal
# Import salt libs
import salt.defaults.exitcodes
import salt.utils
import salt.ext.six as six
log = logging.getLogger(__name__)
HAS_PSUTIL = Fals... | 30.776062 | 99 | 0.555012 |
from __future__ import absolute_import
import logging
import os
import time
import sys
import multiprocessing
import signal
import salt.defaults.exitcodes
import salt.utils
import salt.ext.six as six
log = logging.getLogger(__name__)
HAS_PSUTIL = False
try:
import psutil
HAS_PSUTIL = True
except ImportE... | true | true |
f742b59f5f547febc50fc6397d8808d77842c995 | 21,762 | py | Python | core/dbt/exceptions.py | pushpay/dbt | 8b96de893af692bd77fe9eb9a8104317be7b5413 | [
"Apache-2.0"
] | null | null | null | core/dbt/exceptions.py | pushpay/dbt | 8b96de893af692bd77fe9eb9a8104317be7b5413 | [
"Apache-2.0"
] | null | null | null | core/dbt/exceptions.py | pushpay/dbt | 8b96de893af692bd77fe9eb9a8104317be7b5413 | [
"Apache-2.0"
] | null | null | null | import sys
import six
import functools
from dbt.compat import builtins
from dbt.logger import GLOBAL_LOGGER as logger
import dbt.flags
class Exception(builtins.Exception):
CODE = -32000
MESSAGE = "Server Error"
def data(self):
# if overriding, make sure the result is json-serializable.
r... | 30.393855 | 94 | 0.631054 | import sys
import six
import functools
from dbt.compat import builtins
from dbt.logger import GLOBAL_LOGGER as logger
import dbt.flags
class Exception(builtins.Exception):
CODE = -32000
MESSAGE = "Server Error"
def data(self):
return {
'type': self.__class__.__name__,
... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.