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 417k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 1
class | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c3b43264146acffd4b9791e5ba180dcff39b787 | 3,442 | py | Python | endorsement/urls.py | uw-it-aca/service-endorsement | a1ba3e4221bb3fe6c81c9f6947ad5e93f10a4a45 | [
"Apache-2.0"
] | 3 | 2017-10-16T17:19:32.000Z | 2019-07-31T22:31:48.000Z | endorsement/urls.py | uw-it-aca/service-endorsement | a1ba3e4221bb3fe6c81c9f6947ad5e93f10a4a45 | [
"Apache-2.0"
] | 284 | 2016-06-17T18:21:31.000Z | 2022-03-21T16:55:03.000Z | endorsement/urls.py | uw-it-aca/service-endorsement | a1ba3e4221bb3fe6c81c9f6947ad5e93f10a4a45 | [
"Apache-2.0"
] | null | null | null | # Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from django.urls import re_path
from userservice.views import support as userservice_override
from endorsement.views import page
from endorsement.views.accept import accept
from endorsement.views.support.endorser_search import Endors... | 51.373134 | 76 | 0.733295 | from django.urls import re_path
from userservice.views import support as userservice_override
from endorsement.views import page
from endorsement.views.accept import accept
from endorsement.views.support.endorser_search import EndorserSearch
from endorsement.views.support.endorsee_search import EndorseeSearch
from endo... | true | true |
1c3b43dfa126113a77aed9d9def8d973b850cef5 | 861 | py | Python | img2coe.py | VladLujerdeanu/Image-to-Coe-File | faab54003982ce5b53f89298a9057680a5b63e1c | [
"MIT"
] | 4 | 2021-03-19T16:21:05.000Z | 2022-02-01T18:19:10.000Z | img2coe.py | VladLujerdeanu/Image-to-Coe-File | faab54003982ce5b53f89298a9057680a5b63e1c | [
"MIT"
] | null | null | null | img2coe.py | VladLujerdeanu/Image-to-Coe-File | faab54003982ce5b53f89298a9057680a5b63e1c | [
"MIT"
] | null | null | null | import numpy as np
import sys
import os
from PIL import Image
def img2coe(path, index):
img = Image.open(path)
arr = np.array(img)
output_file = "img" + str(index) + ".coe"
f = open(output_file, "w")
f.write("memory_initialization_radix=2;\nmemory_initialization_vector=")
for line in arr:
... | 27.774194 | 104 | 0.547038 | import numpy as np
import sys
import os
from PIL import Image
def img2coe(path, index):
img = Image.open(path)
arr = np.array(img)
output_file = "img" + str(index) + ".coe"
f = open(output_file, "w")
f.write("memory_initialization_radix=2;\nmemory_initialization_vector=")
for line in arr:
... | true | true |
1c3b446d870b656182874f023654cee42a310142 | 192 | py | Python | commerce/auctions/admin.py | p-schlickmann/e-commerce | fecc1403dde898f1058662e642ed2678c4d7c224 | [
"MIT"
] | null | null | null | commerce/auctions/admin.py | p-schlickmann/e-commerce | fecc1403dde898f1058662e642ed2678c4d7c224 | [
"MIT"
] | null | null | null | commerce/auctions/admin.py | p-schlickmann/e-commerce | fecc1403dde898f1058662e642ed2678c4d7c224 | [
"MIT"
] | null | null | null | from django.contrib import admin
from . import models
admin.site.register(models.Item)
admin.site.register(models.User)
admin.site.register(models.Category)
admin.site.register(models.Bid)
| 19.2 | 36 | 0.807292 | from django.contrib import admin
from . import models
admin.site.register(models.Item)
admin.site.register(models.User)
admin.site.register(models.Category)
admin.site.register(models.Bid)
| true | true |
1c3b44a2d17a59f486047938d58c7aae75ab6375 | 23,160 | py | Python | Contents/scripts/scnexpl/explorer.py | mochio326/SceneExplorer | 1d93788014ce1eab2dc91258e3efc2c71b7c20cd | [
"MIT"
] | 7 | 2017-03-15T03:09:52.000Z | 2019-09-29T09:34:34.000Z | Contents/scripts/scnexpl/explorer.py | mochio326/SceneExplorer | 1d93788014ce1eab2dc91258e3efc2c71b7c20cd | [
"MIT"
] | null | null | null | Contents/scripts/scnexpl/explorer.py | mochio326/SceneExplorer | 1d93788014ce1eab2dc91258e3efc2c71b7c20cd | [
"MIT"
] | null | null | null | ## -*- coding: utf-8 -*-
import sys
import re
import os.path
import subprocess
from .vendor.Qt import QtCore, QtGui, QtWidgets
from .gui import explorer_ui
from maya.app.general.mayaMixin import MayaQWidgetBaseMixin
import maya.OpenMaya as om
import maya.cmds as cmds
class SceneExplorerWeight(MayaQWidgetBaseMixin, ... | 34.311111 | 117 | 0.633679 | import sys
import re
import os.path
import subprocess
from .vendor.Qt import QtCore, QtGui, QtWidgets
from .gui import explorer_ui
from maya.app.general.mayaMixin import MayaQWidgetBaseMixin
import maya.OpenMaya as om
import maya.cmds as cmds
class SceneExplorerWeight(MayaQWidgetBaseMixin, QtWidgets.QDialog, explor... | true | true |
1c3b44f4831afbfe369cc749854816caaf8baacb | 402 | py | Python | ros/build/camera_info_publisher/catkin_generated/pkg.develspace.context.pc.py | Emad-W/CarND-Capstone-Project | d058533d0815559918f4128051b12d47b995980d | [
"MIT"
] | null | null | null | ros/build/camera_info_publisher/catkin_generated/pkg.develspace.context.pc.py | Emad-W/CarND-Capstone-Project | d058533d0815559918f4128051b12d47b995980d | [
"MIT"
] | 10 | 2019-12-16T22:12:07.000Z | 2022-02-10T00:24:31.000Z | ros/build/camera_info_publisher/catkin_generated/pkg.develspace.context.pc.py | Emad-W/CarND-Capstone-Project | d058533d0815559918f4128051b12d47b995980d | [
"MIT"
] | null | null | null | # generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else []
PROJECT_CATKIN_DEPENDS = "".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
PROJECT_NAME = "camera_info_publisher"
PROJECT_SPACE_... | 44.666667 | 69 | 0.718905 | CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else []
PROJECT_CATKIN_DEPENDS = "".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
PROJECT_NAME = "camera_info_publisher"
PROJECT_SPACE_DIR = "/home/student/capstone/CarND-Capstone/ros/devel"
P... | true | true |
1c3b45b01c0a93ee7b6ac0d613320683c9148afc | 1,648 | py | Python | test_Data_update_1.py | eduardcd/mas_fc | 990f0465081da52078fd28a95dbde535db073c18 | [
"MIT"
] | null | null | null | test_Data_update_1.py | eduardcd/mas_fc | 990f0465081da52078fd28a95dbde535db073c18 | [
"MIT"
] | null | null | null | test_Data_update_1.py | eduardcd/mas_fc | 990f0465081da52078fd28a95dbde535db073c18 | [
"MIT"
] | null | null | null | from code_1 import Data
from unittest import TestCase
def test_calculate1():
rgbd = [('knife',1, .99), ('scissor', 2, .65), ('spoon', 3, .33), ('spoon', 4, .80), ('keys', 5, .95)]
rgb = [('keys', 5, .95), ('spoon', 4, .99),('fork', 3, .99), ('scissor', 2, .95), ('knife',1, .55)]
data = Data(rgbd, rgb)
... | 43.368421 | 136 | 0.517597 | from code_1 import Data
from unittest import TestCase
def test_calculate1():
rgbd = [('knife',1, .99), ('scissor', 2, .65), ('spoon', 3, .33), ('spoon', 4, .80), ('keys', 5, .95)]
rgb = [('keys', 5, .95), ('spoon', 4, .99),('fork', 3, .99), ('scissor', 2, .95), ('knife',1, .55)]
data = Data(rgbd, rgb)
... | true | true |
1c3b46e3834dbde23cdba1ede29bd6d1494176a7 | 2,149 | py | Python | s3_tar/s3_mpu.py | STARInformatics/s3-tar | 20071e8acc6b8110624fac470d2e51a0b967df55 | [
"MIT"
] | 17 | 2020-02-12T00:14:54.000Z | 2022-03-25T17:53:06.000Z | s3_tar/s3_mpu.py | STARInformatics/s3-tar | 20071e8acc6b8110624fac470d2e51a0b967df55 | [
"MIT"
] | 9 | 2020-02-08T21:32:45.000Z | 2021-03-18T17:49:03.000Z | s3_tar/s3_mpu.py | STARInformatics/s3-tar | 20071e8acc6b8110624fac470d2e51a0b967df55 | [
"MIT"
] | 10 | 2020-03-23T06:53:35.000Z | 2022-01-04T11:52:45.000Z | import logging
logger = logging.getLogger(__name__)
class S3MPU:
def __init__(self, s3, target_bucket, target_key):
self.s3 = s3
self.target_bucket = target_bucket
self.target_key = target_key
self.parts_mapping = []
logger.info("Creating file {}".format(self.target_key)... | 29.847222 | 72 | 0.581201 | import logging
logger = logging.getLogger(__name__)
class S3MPU:
def __init__(self, s3, target_bucket, target_key):
self.s3 = s3
self.target_bucket = target_bucket
self.target_key = target_key
self.parts_mapping = []
logger.info("Creating file {}".format(self.target_key)... | true | true |
1c3b486cb56678a3a738379132713ae72357262c | 26,769 | py | Python | autoflow/feature_engineer/generate/autofeat/autofeat.py | auto-flow/autoflow | f5903424ad8694d57741a0bd6dfeaba320ea6517 | [
"BSD-3-Clause"
] | 49 | 2020-04-16T11:17:28.000Z | 2020-05-06T01:32:44.000Z | autoflow/feature_engineer/generate/autofeat/autofeat.py | auto-flow/autoflow | f5903424ad8694d57741a0bd6dfeaba320ea6517 | [
"BSD-3-Clause"
] | null | null | null | autoflow/feature_engineer/generate/autofeat/autofeat.py | auto-flow/autoflow | f5903424ad8694d57741a0bd6dfeaba320ea6517 | [
"BSD-3-Clause"
] | 3 | 2020-04-17T00:53:24.000Z | 2020-04-23T03:04:26.000Z | # -*- coding: utf-8 -*-
# Author: Franziska Horn <cod3licious@gmail.com>
# License: MIT
from __future__ import unicode_literals, division, print_function, absolute_import
from builtins import range
from copy import copy
from typing import List, Optional
import numpy as np
import pandas as pd
import pint
from sklearn... | 51.085878 | 140 | 0.606859 |
from __future__ import unicode_literals, division, print_function, absolute_import
from builtins import range
from copy import copy
from typing import List, Optional
import numpy as np
import pandas as pd
import pint
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.ensemble import ExtraTreesClas... | true | true |
1c3b489ac6f0e700b06e5ce05f81b8a4a447c5d4 | 1,525 | bzl | Python | test/com/google/javascript/jscomp/serialization/integration_tests.bzl | lukec611/closure-compiler | f2fa8b35b8127bfb9e8852963a534eafa324e0c6 | [
"Apache-2.0"
] | 6,240 | 2015-01-01T00:20:53.000Z | 2022-03-31T10:33:32.000Z | test/com/google/javascript/jscomp/serialization/integration_tests.bzl | lukec611/closure-compiler | f2fa8b35b8127bfb9e8852963a534eafa324e0c6 | [
"Apache-2.0"
] | 3,139 | 2015-01-03T02:13:16.000Z | 2022-03-31T16:44:22.000Z | test/com/google/javascript/jscomp/serialization/integration_tests.bzl | lukec611/closure-compiler | f2fa8b35b8127bfb9e8852963a534eafa324e0c6 | [
"Apache-2.0"
] | 1,272 | 2015-01-07T01:22:20.000Z | 2022-03-28T07:23:29.000Z | load("//tools/build_defs/js:rules.bzl", "js_binary")
def serialized_ast_file(name, ordered_srcs = []):
"""Creates a single serialized AST file from compiling all of the input files."""
jsast = name
binary_name = name + "_bin"
js_binary(
name = binary_name,
compiler = "//javascript/tools... | 33.888889 | 104 | 0.588852 | load("//tools/build_defs/js:rules.bzl", "js_binary")
def serialized_ast_file(name, ordered_srcs = []):
jsast = name
binary_name = name + "_bin"
js_binary(
name = binary_name,
compiler = "//javascript/tools/jscompiler:head",
compile = 1,
defs = [
"--language_out=N... | true | true |
1c3b494b32b82b353c8d58d2e884213ea3910e94 | 729 | py | Python | tests/test_config.py | flxbe/flumine | a03a0b55373f79c460b2baafa3f1b4068f2cb4da | [
"MIT"
] | null | null | null | tests/test_config.py | flxbe/flumine | a03a0b55373f79c460b2baafa3f1b4068f2cb4da | [
"MIT"
] | 24 | 2021-06-01T07:20:01.000Z | 2022-03-29T16:13:08.000Z | tests/test_config.py | lunswor/flumine | f0e7e6542942d00685ceb6d72951456684998739 | [
"MIT"
] | null | null | null | import unittest
from flumine import config
class ConfigTest(unittest.TestCase):
def test_init(self):
self.assertFalse(config.simulated)
self.assertIsInstance(config.hostname, str)
self.assertIsInstance(config.process_id, int)
self.assertIsNone(config.current_time)
self.ass... | 36.45 | 58 | 0.721536 | import unittest
from flumine import config
class ConfigTest(unittest.TestCase):
def test_init(self):
self.assertFalse(config.simulated)
self.assertIsInstance(config.hostname, str)
self.assertIsInstance(config.process_id, int)
self.assertIsNone(config.current_time)
self.ass... | true | true |
1c3b49fbde9909f298cfa3b82da488df0e433628 | 389 | py | Python | kuring/kuring/wsgi.py | rtubio/kuring | bceb7accbb1e99a66be8112f0e396d0a16896bb9 | [
"Apache-2.0"
] | null | null | null | kuring/kuring/wsgi.py | rtubio/kuring | bceb7accbb1e99a66be8112f0e396d0a16896bb9 | [
"Apache-2.0"
] | 1 | 2021-09-22T19:38:06.000Z | 2021-09-22T19:38:06.000Z | kuring/kuring/wsgi.py | rtubio/kuring | bceb7accbb1e99a66be8112f0e396d0a16896bb9 | [
"Apache-2.0"
] | null | null | null | """
WSGI config for kuring project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTIN... | 22.882353 | 78 | 0.784062 |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'kuring.settings')
application = get_wsgi_application()
| true | true |
1c3b4a36806beb973d99a320bab84a2c8338cef2 | 10,119 | bzl | Python | go/private/actions/link.bzl | aignas/rules_go | 2f3533598303e985110e6fff4f3adf2125d4750e | [
"Apache-2.0"
] | null | null | null | go/private/actions/link.bzl | aignas/rules_go | 2f3533598303e985110e6fff4f3adf2125d4750e | [
"Apache-2.0"
] | 1 | 2022-02-18T15:47:32.000Z | 2022-02-18T15:47:32.000Z | go/private/actions/link.bzl | aignas/rules_go | 2f3533598303e985110e6fff4f3adf2125d4750e | [
"Apache-2.0"
] | null | null | null | # Copyright 2014 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | 39.838583 | 106 | 0.658662 |
load(
"//go/private:common.bzl",
"as_set",
"has_shared_lib_extension",
)
load(
"//go/private:mode.bzl",
"LINKMODE_C_SHARED",
"LINKMODE_NORMAL",
"LINKMODE_PLUGIN",
"extld_from_cc_toolchain",
"extldflags_from_cc_toolchain",
)
load(
"//go/private:rpath.bzl",
"rpath",
)
load(
... | true | true |
1c3b4a4e3e663c47a5fcc888a631a24a374932c2 | 2,249 | py | Python | examples/07-filter/05-render.py | pepsipepsi/nodebox_opengl_python3 | cfb2633df1055a028672b11311603cc2241a1378 | [
"BSD-3-Clause"
] | 1 | 2017-03-19T16:56:46.000Z | 2017-03-19T16:56:46.000Z | examples/07-filter/05-render.py | pepsipepsi/nodebox_opengl_python3 | cfb2633df1055a028672b11311603cc2241a1378 | [
"BSD-3-Clause"
] | null | null | null | examples/07-filter/05-render.py | pepsipepsi/nodebox_opengl_python3 | cfb2633df1055a028672b11311603cc2241a1378 | [
"BSD-3-Clause"
] | null | null | null | import os, sys
sys.path.insert(0, os.path.join("..",".."))
from nodebox.graphics.context import *
from nodebox.graphics import *
from nodebox.graphics.shader import render, blur
# render invokes psyco, and old compiler I'll need to replace here
# The render() command executes a function with drawing commands
# in... | 34.6 | 78 | 0.692308 | import os, sys
sys.path.insert(0, os.path.join("..",".."))
from nodebox.graphics.context import *
from nodebox.graphics import *
from nodebox.graphics.shader import render, blur
# The render() command executes a function with drawing commands
# in an offscreen (i.e. hidden) canvas and returns an Image object.
# T... | true | true |
1c3b4b0d67207d18e3ba44a1ef87f6b19942597e | 15,842 | py | Python | tests/components/filter/test_sensor.py | dlintott/core | a6c83cc46a34084fdc4c0e7221b6ba493f82cbac | [
"Apache-2.0"
] | 1 | 2020-12-24T23:23:24.000Z | 2020-12-24T23:23:24.000Z | tests/components/filter/test_sensor.py | dlintott/core | a6c83cc46a34084fdc4c0e7221b6ba493f82cbac | [
"Apache-2.0"
] | 48 | 2021-01-06T07:02:41.000Z | 2022-03-31T06:10:45.000Z | tests/components/filter/test_sensor.py | dlintott/core | a6c83cc46a34084fdc4c0e7221b6ba493f82cbac | [
"Apache-2.0"
] | 2 | 2021-07-14T20:22:04.000Z | 2021-09-22T08:56:16.000Z | """The test for the data filter sensor platform."""
from datetime import timedelta
from os import path
from pytest import fixture
from homeassistant import config as hass_config
from homeassistant.components.filter.sensor import (
DOMAIN,
LowPassFilter,
OutlierFilter,
RangeFilter,
ThrottleFilter,
... | 32.00404 | 96 | 0.603585 | from datetime import timedelta
from os import path
from pytest import fixture
from homeassistant import config as hass_config
from homeassistant.components.filter.sensor import (
DOMAIN,
LowPassFilter,
OutlierFilter,
RangeFilter,
ThrottleFilter,
TimeSMAFilter,
TimeThrottleFilter,
)
from ho... | true | true |
1c3b4b384361661b0a0d69363bc38a617ec79aba | 1,415 | py | Python | hapic/error/serpyco.py | raphj/hapic | b169ee901005bbe535e27ec878a051c2c1226e43 | [
"MIT"
] | 20 | 2017-10-13T11:23:33.000Z | 2021-12-09T12:42:06.000Z | hapic/error/serpyco.py | raphj/hapic | b169ee901005bbe535e27ec878a051c2c1226e43 | [
"MIT"
] | 130 | 2017-10-10T15:09:13.000Z | 2021-12-30T10:36:08.000Z | hapic/error/serpyco.py | raphj/hapic | b169ee901005bbe535e27ec878a051c2c1226e43 | [
"MIT"
] | 7 | 2017-10-17T07:24:42.000Z | 2021-09-16T14:33:17.000Z | # coding: utf-8
import dataclasses
import typing
from hapic.error.main import DefaultErrorBuilder
from hapic.processor.main import ProcessValidationError
from hapic.type import TYPE_SCHEMA
@dataclasses.dataclass
class DefaultErrorSchema(object):
message: str
details: typing.Dict[str, typing.Any] = dataclasse... | 34.512195 | 97 | 0.719435 | import dataclasses
import typing
from hapic.error.main import DefaultErrorBuilder
from hapic.processor.main import ProcessValidationError
from hapic.type import TYPE_SCHEMA
@dataclasses.dataclass
class DefaultErrorSchema(object):
message: str
details: typing.Dict[str, typing.Any] = dataclasses.field(default_... | true | true |
1c3b4c1ef04754816e4ee8dd71bc0b72e79d526e | 672 | py | Python | bitirmetezi/venv/Lib/site-packages/plot/parameter/update.py | busraltun/IMPLEMENTATIONOFEYECONTROLLEDVIRTUALKEYBOARD | fa3a9b150419a17aa82f41b068a5d69d0ff0d0f3 | [
"MIT"
] | 1 | 2020-04-10T08:14:43.000Z | 2020-04-10T08:14:43.000Z | bitirmetezi/venv/Lib/site-packages/plot/parameter/update.py | busraltun/IMPLEMENTATIONOFEYECONTROLLEDVIRTUALKEYBOARD | fa3a9b150419a17aa82f41b068a5d69d0ff0d0f3 | [
"MIT"
] | 1 | 2016-11-30T20:37:27.000Z | 2016-12-12T11:55:50.000Z | bitirmetezi/venv/Lib/site-packages/plot/parameter/update.py | busraltun/IMPLEMENTATIONOFEYECONTROLLEDVIRTUALKEYBOARD | fa3a9b150419a17aa82f41b068a5d69d0ff0d0f3 | [
"MIT"
] | 1 | 2019-12-18T07:56:00.000Z | 2019-12-18T07:56:00.000Z | """
Return an updated parameter dictionary based on
user input dictionary.
"""
from typing import AnyStr, Dict
import os
from ..io.input.parse import parse
def update(user_config_file):
# type: (AnyStr) -> Dict
"""Return an updated parameter dictionary
Parse user configuration file and use the informatio... | 25.846154 | 60 | 0.721726 | from typing import AnyStr, Dict
import os
from ..io.input.parse import parse
def update(user_config_file):
here = os.path.dirname(os.path.realpath(__file__))
default_config_file = os.path.join(here, "all.json")
return parse(user_config_file, default_config_file)
| true | true |
1c3b4c2556d0ca6a4f8386459171ee3d3882f52c | 5,816 | py | Python | DSB3Tutorial/LUNA_train_unet.py | taoddiao/dr.b | 87f9ae4a5001e1a9248b0e19ad90aa252e426fe9 | [
"Apache-2.0"
] | 10 | 2017-12-15T03:56:56.000Z | 2020-03-17T03:54:49.000Z | DSB3Tutorial/LUNA_train_unet.py | taoddiao/dr.b | 87f9ae4a5001e1a9248b0e19ad90aa252e426fe9 | [
"Apache-2.0"
] | 3 | 2017-12-15T20:22:46.000Z | 2018-04-27T17:56:13.000Z | DSB3Tutorial/LUNA_train_unet.py | taoddiao/dr.b | 87f9ae4a5001e1a9248b0e19ad90aa252e426fe9 | [
"Apache-2.0"
] | 3 | 2017-12-09T10:47:15.000Z | 2019-10-17T16:03:48.000Z | from __future__ import print_function
import numpy as np
from keras.models import Model
from keras.layers import Input, merge, Convolution2D, MaxPooling2D, UpSampling2D
from keras.optimizers import Adam
from keras.optimizers import SGD
from keras.callbacks import ModelCheckpoint, LearningRateScheduler
from keras impor... | 39.564626 | 92 | 0.682256 | from __future__ import print_function
import numpy as np
from keras.models import Model
from keras.layers import Input, merge, Convolution2D, MaxPooling2D, UpSampling2D
from keras.optimizers import Adam
from keras.optimizers import SGD
from keras.callbacks import ModelCheckpoint, LearningRateScheduler
from keras impor... | true | true |
1c3b4c35ea45da38f5085a7c3d225839dc29b221 | 5,952 | py | Python | simulator/game.py | Yuta1004/procon30-battle-simulator-py | dcd0bb34efab3201705ff2188c2fc62f6ac7bc09 | [
"MIT"
] | null | null | null | simulator/game.py | Yuta1004/procon30-battle-simulator-py | dcd0bb34efab3201705ff2188c2fc62f6ac7bc09 | [
"MIT"
] | null | null | null | simulator/game.py | Yuta1004/procon30-battle-simulator-py | dcd0bb34efab3201705ff2188c2fc62f6ac7bc09 | [
"MIT"
] | null | null | null | # Copylight(c) 2019 NakagamiYuta
# LICENCE : MIT
import numpy as np
import json
from simulator.common import flatten_2d, gen_2d_list
class Game:
"""
Gameクラス
Brief:
シミュレーター
"""
def __init__(self, board, agents):
"""
コンストラクタ
Params
----------
board... | 28.753623 | 112 | 0.514785 |
import numpy as np
import json
from simulator.common import flatten_2d, gen_2d_list
class Game:
def __init__(self, board, agents):
self.board = board
self.agents = agents
self.turn = 0
def set_action(self, team_id, agent_id, dx, dy, remove_panel=False):
if abs(dx) > 1 or abs... | true | true |
1c3b4c5691828c47807f6cb8ed1b32e8d9038956 | 1,102 | py | Python | python/controls/progress/basic_progress.py | pglet/pglet-samples | ab47e797a4daccfa4779daa3d1fd1cc27d92e7f9 | [
"MIT"
] | null | null | null | python/controls/progress/basic_progress.py | pglet/pglet-samples | ab47e797a4daccfa4779daa3d1fd1cc27d92e7f9 | [
"MIT"
] | null | null | null | python/controls/progress/basic_progress.py | pglet/pglet-samples | ab47e797a4daccfa4779daa3d1fd1cc27d92e7f9 | [
"MIT"
] | null | null | null | import time
import pglet
from pglet import Progress, Text
with pglet.page("basic-progress") as page:
prog1 = Progress("Copying file1.txt to file2.txt", value=0, width="50%")
page.add(Text("Default Progress", size="xLarge"), prog1)
for i in range(0, 101):
prog1.value = i
prog1.update()
... | 23.446809 | 76 | 0.637931 | import time
import pglet
from pglet import Progress, Text
with pglet.page("basic-progress") as page:
prog1 = Progress("Copying file1.txt to file2.txt", value=0, width="50%")
page.add(Text("Default Progress", size="xLarge"), prog1)
for i in range(0, 101):
prog1.value = i
prog1.update()
... | true | true |
1c3b4cff38fbd3e0ac656b6c5d5470120e680caa | 9,275 | py | Python | tests/test_caper_workflow_opts.py | dfeinzeig/caper | 35a693448179674acfae95590e329ab5d1eea0b7 | [
"MIT"
] | null | null | null | tests/test_caper_workflow_opts.py | dfeinzeig/caper | 35a693448179674acfae95590e329ab5d1eea0b7 | [
"MIT"
] | null | null | null | tests/test_caper_workflow_opts.py | dfeinzeig/caper | 35a693448179674acfae95590e329ab5d1eea0b7 | [
"MIT"
] | null | null | null | import json
import os
from textwrap import dedent
import pytest
from caper.caper_workflow_opts import CaperWorkflowOpts
from caper.cromwell_backend import BACKEND_AWS, BACKEND_GCP
def test_create_file(tmp_path):
"""Test without docker/singularity.
"""
use_google_cloud_life_sciences = False
gcp_zones... | 30.610561 | 84 | 0.642372 | import json
import os
from textwrap import dedent
import pytest
from caper.caper_workflow_opts import CaperWorkflowOpts
from caper.cromwell_backend import BACKEND_AWS, BACKEND_GCP
def test_create_file(tmp_path):
use_google_cloud_life_sciences = False
gcp_zones = ['us-west-1', 'us-west-2']
slurm_partitio... | true | true |
1c3b4d30baa1124cda83549bee2b0a5d2cc42353 | 6,811 | py | Python | .ipynb_checkpoints/Model-checkpoint.py | acse-jl8920/IRP-Johnson | 2a70ab9b286726847cc5d5bb65232b2b241f4d5a | [
"MIT"
] | null | null | null | .ipynb_checkpoints/Model-checkpoint.py | acse-jl8920/IRP-Johnson | 2a70ab9b286726847cc5d5bb65232b2b241f4d5a | [
"MIT"
] | null | null | null | .ipynb_checkpoints/Model-checkpoint.py | acse-jl8920/IRP-Johnson | 2a70ab9b286726847cc5d5bb65232b2b241f4d5a | [
"MIT"
] | null | null | null | #coding=utf-8
import tensorflow as tf
import keras
from keras.models import *
from keras.layers import *
import numpy as np
from metrics import metrics
from losses import LOSS_FACTORY
from keras.callbacks import History
from keras.callbacks import ModelCheckpoint
def conv_block(input, filters):
out = Conv2D(filter... | 33.885572 | 119 | 0.56673 | import tensorflow as tf
import keras
from keras.models import *
from keras.layers import *
import numpy as np
from metrics import metrics
from losses import LOSS_FACTORY
from keras.callbacks import History
from keras.callbacks import ModelCheckpoint
def conv_block(input, filters):
out = Conv2D(filters, kernel_size... | true | true |
1c3b4de8c952d03489927337b1b07d56f5cdc1d5 | 106 | py | Python | regex_field/__init__.py | millarm/django-regex-field | f9f8f41d576ac78f36159ec9408d1cf65bdb9532 | [
"MIT"
] | 14 | 2015-06-01T19:29:02.000Z | 2021-12-23T14:33:51.000Z | regex_field/__init__.py | millarm/django-regex-field | f9f8f41d576ac78f36159ec9408d1cf65bdb9532 | [
"MIT"
] | 15 | 2015-03-27T14:40:28.000Z | 2021-11-16T13:36:33.000Z | regex_field/__init__.py | millarm/django-regex-field | f9f8f41d576ac78f36159ec9408d1cf65bdb9532 | [
"MIT"
] | 15 | 2015-03-27T13:38:16.000Z | 2021-12-23T14:33:53.000Z | # flake8: noqa
from .version import __version__
default_app_config = 'regex_field.apps.RegexFieldConfig'
| 21.2 | 56 | 0.820755 | from .version import __version__
default_app_config = 'regex_field.apps.RegexFieldConfig'
| true | true |
1c3b4e50c4ef9848007a3e4dc4cfa4018dff5357 | 42,431 | py | Python | sympy/functions/elementary/complexes.py | hackman01/sympy | 4a74b6f1952b863dfbafc9e14557427e63698dcd | [
"BSD-3-Clause"
] | null | null | null | sympy/functions/elementary/complexes.py | hackman01/sympy | 4a74b6f1952b863dfbafc9e14557427e63698dcd | [
"BSD-3-Clause"
] | null | null | null | sympy/functions/elementary/complexes.py | hackman01/sympy | 4a74b6f1952b863dfbafc9e14557427e63698dcd | [
"BSD-3-Clause"
] | null | null | null | from sympy.core import S, Add, Mul, sympify, Symbol, Dummy, Basic
from sympy.core.expr import Expr
from sympy.core.exprtools import factor_terms
from sympy.core.function import (Function, Derivative, ArgumentIndexError,
AppliedUndef)
from sympy.core.logic import fuzzy_not, fuzzy_or
from sympy.core.numbers import pi... | 29.364014 | 86 | 0.55278 | from sympy.core import S, Add, Mul, sympify, Symbol, Dummy, Basic
from sympy.core.expr import Expr
from sympy.core.exprtools import factor_terms
from sympy.core.function import (Function, Derivative, ArgumentIndexError,
AppliedUndef)
from sympy.core.logic import fuzzy_not, fuzzy_or
from sympy.core.numbers import pi... | true | true |
1c3b4fa254f1daec3297d254064842c05b66f54d | 318 | py | Python | models/schemas.py | muneeb-bashir/Lost_and_Found | e6d8c9f4323e4e0ecf69afd6af9615ac6e48a522 | [
"Apache-2.0"
] | null | null | null | models/schemas.py | muneeb-bashir/Lost_and_Found | e6d8c9f4323e4e0ecf69afd6af9615ac6e48a522 | [
"Apache-2.0"
] | null | null | null | models/schemas.py | muneeb-bashir/Lost_and_Found | e6d8c9f4323e4e0ecf69afd6af9615ac6e48a522 | [
"Apache-2.0"
] | null | null | null | from pydantic import BaseModel
from datetime import date
class User(BaseModel):
name: str
email: str
password: str
contact :str
class Item(BaseModel):
name: str
description: str
lostlocation: str
foundlocation: str
status: bool
Date : date
user_id: int
| 16.736842 | 31 | 0.632075 | from pydantic import BaseModel
from datetime import date
class User(BaseModel):
name: str
email: str
password: str
contact :str
class Item(BaseModel):
name: str
description: str
lostlocation: str
foundlocation: str
status: bool
Date : date
user_id: int
| true | true |
1c3b50bde722640d7c94b1b392bc478bcaf503b5 | 1,193 | py | Python | 6/6.2/favorite_languages.py | liqiwa/python_work | 3d1198d5616b28a37fee7dfba5bbef0e1d489c2d | [
"Apache-2.0"
] | null | null | null | 6/6.2/favorite_languages.py | liqiwa/python_work | 3d1198d5616b28a37fee7dfba5bbef0e1d489c2d | [
"Apache-2.0"
] | null | null | null | 6/6.2/favorite_languages.py | liqiwa/python_work | 3d1198d5616b28a37fee7dfba5bbef0e1d489c2d | [
"Apache-2.0"
] | null | null | null | favorite_languages = {
'jen':'python',
'sarah':'c',
'edward':'ruby',
'phil':'python',}
print("Sarah`s favorite_language is "+str(favorite_languages['sarah'].title())+'.')
#6-1
people = {'name':'mm','xing':'he','age':'30','city':'sjz'}
print(people)
words = {'liebiao':'liebiao,yuansu jihe','yuanzu':'buk... | 27.744186 | 89 | 0.686505 | favorite_languages = {
'jen':'python',
'sarah':'c',
'edward':'ruby',
'phil':'python',}
print("Sarah`s favorite_language is "+str(favorite_languages['sarah'].title())+'.')
people = {'name':'mm','xing':'he','age':'30','city':'sjz'}
print(people)
words = {'liebiao':'liebiao,yuansu jihe','yuanzu':'bukebian... | true | true |
1c3b51b9bba5ad52ab6d1413235c5067c07ac3ac | 5,115 | py | Python | model/unet.py | shvetsiya/carvana | acc594cba53c44d577c9e3e326e0163eea8b4862 | [
"MIT"
] | 11 | 2018-01-28T04:22:57.000Z | 2018-12-20T10:09:40.000Z | model/unet.py | shvetsiya/carvana | acc594cba53c44d577c9e3e326e0163eea8b4862 | [
"MIT"
] | null | null | null | model/unet.py | shvetsiya/carvana | acc594cba53c44d577c9e3e326e0163eea8b4862 | [
"MIT"
] | 2 | 2017-10-04T00:58:10.000Z | 2019-02-14T17:47:25.000Z | import torch
from torch import nn
from torch.nn import functional as F
class Conv3BN(nn.Module):
"""A module which applies the following actions:
- convolution with 3x3 kernel;
- batch normalization (if enabled);
- ELU.
Attributes:
in_ch: Number of input channels.
out_c... | 35.275862 | 120 | 0.577517 | import torch
from torch import nn
from torch.nn import functional as F
class Conv3BN(nn.Module):
def __init__(self, in_ch: int, out_ch: int, bn=True):
super(Conv3BN, self).__init__()
self.conv = nn.Conv2d(in_ch, out_ch, 3, padding=1)
self.bn = nn.BatchNorm2d(out_ch) if bn else None
... | true | true |
1c3b52422aeca1ef8527235caf16ec3b660eddfb | 3,425 | py | Python | mdemo.py | vorticityxyz/Gaia-api | 04e2a9ee2448830df72156aecf432eda0c6eb504 | [
"MIT"
] | null | null | null | mdemo.py | vorticityxyz/Gaia-api | 04e2a9ee2448830df72156aecf432eda0c6eb504 | [
"MIT"
] | null | null | null | mdemo.py | vorticityxyz/Gaia-api | 04e2a9ee2448830df72156aecf432eda0c6eb504 | [
"MIT"
] | null | null | null | # Description:
#
# This example uses Vorticity gaia API's mf28pml operator to run a forward model.
# The operator takes a velocity model and returns a simulated shot record which
# is then plotted using matplotlib.
#
# mf28pml allows for larger velocity models and faster solving than f28pml
#
# Input parameters for... | 29.525862 | 103 | 0.649051 | # The operator takes a velocity model and returns a simulated shot record which
# is then plotted using matplotlib.
#
# mf28pml allows for larger velocity models and faster solving than f28pml
#
# Input parameters for the operator is generated by the
# function generate_test_data() and is as follows:
#
# model - 3D ... | true | true |
1c3b5276307a51b1eefd9095f0058c30e16f3a28 | 159 | py | Python | tests/model_control/detailed/transf_BoxCox/model_control_one_enabled_BoxCox_ConstantTrend_BestCycle_LSTM.py | jmabry/pyaf | afbc15a851a2445a7824bf255af612dc429265af | [
"BSD-3-Clause"
] | null | null | null | tests/model_control/detailed/transf_BoxCox/model_control_one_enabled_BoxCox_ConstantTrend_BestCycle_LSTM.py | jmabry/pyaf | afbc15a851a2445a7824bf255af612dc429265af | [
"BSD-3-Clause"
] | 1 | 2019-11-30T23:39:38.000Z | 2019-12-01T04:34:35.000Z | tests/model_control/detailed/transf_BoxCox/model_control_one_enabled_BoxCox_ConstantTrend_BestCycle_LSTM.py | jmabry/pyaf | afbc15a851a2445a7824bf255af612dc429265af | [
"BSD-3-Clause"
] | null | null | null | import pyaf.tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['BoxCox'] , ['ConstantTrend'] , ['BestCycle'] , ['LSTM'] ); | 39.75 | 81 | 0.748428 | import pyaf.tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['BoxCox'] , ['ConstantTrend'] , ['BestCycle'] , ['LSTM'] ); | true | true |
1c3b5355646cd2b8381429e96d194c9a69b6a3a1 | 2,638 | py | Python | src/spaceone/monitoring/manager/project_alert_config_manager.py | xellos00/monitoring | deb5363a2152e7b3f85a08d27bdede0e00023824 | [
"Apache-2.0"
] | null | null | null | src/spaceone/monitoring/manager/project_alert_config_manager.py | xellos00/monitoring | deb5363a2152e7b3f85a08d27bdede0e00023824 | [
"Apache-2.0"
] | null | null | null | src/spaceone/monitoring/manager/project_alert_config_manager.py | xellos00/monitoring | deb5363a2152e7b3f85a08d27bdede0e00023824 | [
"Apache-2.0"
] | null | null | null | import logging
from spaceone.core.manager import BaseManager
from spaceone.monitoring.error.project_alert_config import *
from spaceone.monitoring.model.project_alert_config_model import ProjectAlertConfig
_LOGGER = logging.getLogger(__name__)
class ProjectAlertConfigManager(BaseManager):
def __init__(self, *a... | 44.711864 | 109 | 0.723275 | import logging
from spaceone.core.manager import BaseManager
from spaceone.monitoring.error.project_alert_config import *
from spaceone.monitoring.model.project_alert_config_model import ProjectAlertConfig
_LOGGER = logging.getLogger(__name__)
class ProjectAlertConfigManager(BaseManager):
def __init__(self, *a... | true | true |
1c3b5466c6c835d5b8d3616e9c7fe92a30b00a93 | 732 | py | Python | Sanctuary/Cogs/Utils/database.py | LeoHartUK/Sanctuary | 8d1d2ddb3a18bcf62a0cecc47bf152f88c90d2b1 | [
"MIT"
] | null | null | null | Sanctuary/Cogs/Utils/database.py | LeoHartUK/Sanctuary | 8d1d2ddb3a18bcf62a0cecc47bf152f88c90d2b1 | [
"MIT"
] | null | null | null | Sanctuary/Cogs/Utils/database.py | LeoHartUK/Sanctuary | 8d1d2ddb3a18bcf62a0cecc47bf152f88c90d2b1 | [
"MIT"
] | 1 | 2018-10-01T12:44:24.000Z | 2018-10-01T12:44:24.000Z | import asyncpg
class DatabaseConnection(object):
config = None
def __init__(self):
self.db = None
async def __aenter__(self):
self.db = await self.get_database_connection()
return self
async def __aexit__(self, exc_type, exc, tb):
await self.db.close()
async def get_database_connection(self):
'''
... | 19.263158 | 82 | 0.704918 | import asyncpg
class DatabaseConnection(object):
config = None
def __init__(self):
self.db = None
async def __aenter__(self):
self.db = await self.get_database_connection()
return self
async def __aexit__(self, exc_type, exc, tb):
await self.db.close()
async def get_database_connection(self):
con... | true | true |
1c3b55432f94cbcc20756c830407214cf91aa54f | 3,566 | py | Python | demo/demo_dec.py | Shuai-Xie/RSRailway | f710b6720abd1a8356004bd0b1b4db4dab2592ab | [
"MIT"
] | 1 | 2020-10-22T09:33:58.000Z | 2020-10-22T09:33:58.000Z | demo/demo_dec.py | Shuai-Xie/RSRailway | f710b6720abd1a8356004bd0b1b4db4dab2592ab | [
"MIT"
] | null | null | null | demo/demo_dec.py | Shuai-Xie/RSRailway | f710b6720abd1a8356004bd0b1b4db4dab2592ab | [
"MIT"
] | null | null | null | """
地物检测,17类目标检测
"""
import os
# os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
# os.environ["CUDA_HOME"] = "/nfs/xs/local/cuda-10.2"
# os.environ['CUDA_VISIBLE_DEVICES'] = '1'
import torch
import cv2
import matplotlib.pyplot as plt
from models.ctrbox_net import CTRBOX
from tqdm import tqdm
from datas... | 29.229508 | 113 | 0.620303 | import os
import torch
import cv2
import matplotlib.pyplot as plt
from models.ctrbox_net import CTRBOX
from tqdm import tqdm
from datasets.config.railway import dec_label_names
from utils.func_utils import *
from utils.decoder import DecDecoder
from utils.misc import *
from pprint import pprint
dec... | true | true |
1c3b55ddf826dcafe1ddb15f497f79a7db57b86f | 1,137 | py | Python | typish/functions/_common_ancestor.py | georgeharker/typish | 1c043beb74d89e62b10339a2a964f60ec175adfa | [
"MIT"
] | 16 | 2019-08-03T13:57:17.000Z | 2021-11-08T11:51:52.000Z | typish/functions/_common_ancestor.py | georgeharker/typish | 1c043beb74d89e62b10339a2a964f60ec175adfa | [
"MIT"
] | 27 | 2019-09-11T13:24:38.000Z | 2022-02-11T07:04:12.000Z | typish/functions/_common_ancestor.py | georgeharker/typish | 1c043beb74d89e62b10339a2a964f60ec175adfa | [
"MIT"
] | 7 | 2019-11-18T16:50:09.000Z | 2021-11-01T14:34:39.000Z | import typing
def common_ancestor(*args: object) -> type:
"""
Get the closest common ancestor of the given objects.
:param args: any objects.
:return: the ``type`` of the closest common ancestor of the given ``args``.
"""
return _common_ancestor(args, False)
def common_ancestor_of_types(*arg... | 30.72973 | 79 | 0.644679 | import typing
def common_ancestor(*args: object) -> type:
return _common_ancestor(args, False)
def common_ancestor_of_types(*args: type) -> type:
return _common_ancestor(args, True)
def _common_ancestor(args: typing.Sequence[object], types: bool) -> type:
from typish.functions._get_type import get_typ... | true | true |
1c3b56185a74e835a8e187ab844d383e4d9b1e36 | 3,378 | py | Python | test/MSVS/vs-10.0Exp-exec.py | Valkatraz/scons | 5e70c65f633dcecc035751c9f0c6f894088df8a0 | [
"MIT"
] | 1,403 | 2017-11-23T14:24:01.000Z | 2022-03-30T20:59:39.000Z | test/MSVS/vs-10.0Exp-exec.py | Valkatraz/scons | 5e70c65f633dcecc035751c9f0c6f894088df8a0 | [
"MIT"
] | 3,708 | 2017-11-27T13:47:12.000Z | 2022-03-29T17:21:17.000Z | test/MSVS/vs-10.0Exp-exec.py | Valkatraz/scons | 5e70c65f633dcecc035751c9f0c6f894088df8a0 | [
"MIT"
] | 281 | 2017-12-01T23:48:38.000Z | 2022-03-31T15:25:44.000Z | #!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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,
... | 29.373913 | 85 | 0.705151 |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
import sys
import TestSConsMSVS
test = TestSConsMSVS.TestSConsMSVS()
if sys.platform != 'win32':
msg = "Skipping Visual Studio test on non-Windows platform '%s'\n" % sys.platform
test.skip_test(msg)
msvs_version = '10.0Exp'
if not m... | true | true |
1c3b572e793165fe911d98ddd9cd2c94e5258db8 | 11,345 | py | Python | ps5_II.2_II.3.py | gerkamspiano/QuantMacro | f7e6e4ff7ae075d556f73cb1434c45652b4180cb | [
"MIT"
] | null | null | null | ps5_II.2_II.3.py | gerkamspiano/QuantMacro | f7e6e4ff7ae075d556f73cb1434c45652b4180cb | [
"MIT"
] | null | null | null | ps5_II.2_II.3.py | gerkamspiano/QuantMacro | f7e6e4ff7ae075d556f73cb1434c45652b4180cb | [
"MIT"
] | null | null | null | # Problem Set 5 - Germán Sánchez Arce
# In collaboration with María González
# Import packages
import numpy as np
from numpy import vectorize
from itertools import product
import matplotlib.pyplot as plt
import scipy as sp
from scipy.interpolate import BSpline
from scipy.interpolate import interp1d
#... | 22.781124 | 149 | 0.548876 |
import numpy as np
from numpy import vectorize
from itertools import product
import matplotlib.pyplot as plt
import scipy as sp
from scipy.interpolate import BSpline
from scipy.interpolate import interp1d
ro = 0.06
beta = 1/(1+ro)
w = 1
r = 0.04
gamma = 0.5
sigmay = 0.2
pi = np.array([((1+gam... | true | true |
1c3b574492692395aa10d6c247780a0fddbb2853 | 5,525 | py | Python | mmcls/models/losses/asymmetric_loss.py | YuxinZou/mmclassification | 2037260ea6c98a3b115e97727e1151a1c2c32f7a | [
"Apache-2.0"
] | 1 | 2022-03-15T07:36:04.000Z | 2022-03-15T07:36:04.000Z | mmcls/models/losses/asymmetric_loss.py | YuxinZou/mmclassification | 2037260ea6c98a3b115e97727e1151a1c2c32f7a | [
"Apache-2.0"
] | null | null | null | mmcls/models/losses/asymmetric_loss.py | YuxinZou/mmclassification | 2037260ea6c98a3b115e97727e1151a1c2c32f7a | [
"Apache-2.0"
] | 1 | 2022-03-25T08:40:07.000Z | 2022-03-25T08:40:07.000Z | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from ..builder import LOSSES
from .utils import convert_to_one_hot, weight_reduce_loss
def asymmetric_loss(pred,
target,
weight=None,
gamma_pos=1.0,
gamma... | 36.833333 | 79 | 0.566878 | import torch
import torch.nn as nn
from ..builder import LOSSES
from .utils import convert_to_one_hot, weight_reduce_loss
def asymmetric_loss(pred,
target,
weight=None,
gamma_pos=1.0,
gamma_neg=4.0,
clip=0.05,
... | true | true |
1c3b57690461d1837c56b4565a9ecc8958073025 | 7,896 | py | Python | python_modules/dagster/dagster/core/execution/context/compute.py | JBrVJxsc/dagster | 680aa23387308335eb0eccfa9241b26d10a2d627 | [
"Apache-2.0"
] | null | null | null | python_modules/dagster/dagster/core/execution/context/compute.py | JBrVJxsc/dagster | 680aa23387308335eb0eccfa9241b26d10a2d627 | [
"Apache-2.0"
] | null | null | null | python_modules/dagster/dagster/core/execution/context/compute.py | JBrVJxsc/dagster | 680aa23387308335eb0eccfa9241b26d10a2d627 | [
"Apache-2.0"
] | null | null | null | from abc import ABC, abstractmethod, abstractproperty
from typing import Any, Optional
from dagster import check
from dagster.core.definitions.dependency import Solid, SolidHandle
from dagster.core.definitions.mode import ModeDefinition
from dagster.core.definitions.pipeline import PipelineDefinition
from dagster.core... | 31.710843 | 107 | 0.674772 | from abc import ABC, abstractmethod, abstractproperty
from typing import Any, Optional
from dagster import check
from dagster.core.definitions.dependency import Solid, SolidHandle
from dagster.core.definitions.mode import ModeDefinition
from dagster.core.definitions.pipeline import PipelineDefinition
from dagster.core... | true | true |
1c3b57690a12ceecf8678804ef6ad197cfd0f51d | 154,195 | py | Python | test/orm/test_eager_relations.py | balabit-deps/balabit-os-6-sqlalchemy | 61defc84f2aab5e579080a1958375b805470b461 | [
"MIT"
] | null | null | null | test/orm/test_eager_relations.py | balabit-deps/balabit-os-6-sqlalchemy | 61defc84f2aab5e579080a1958375b805470b461 | [
"MIT"
] | null | null | null | test/orm/test_eager_relations.py | balabit-deps/balabit-os-6-sqlalchemy | 61defc84f2aab5e579080a1958375b805470b461 | [
"MIT"
] | null | null | null | """tests of joined-eager loaded attributes"""
from sqlalchemy.testing import eq_, is_, is_not_
import sqlalchemy as sa
from sqlalchemy import testing
from sqlalchemy.orm import joinedload, deferred, undefer, \
joinedload_all, backref, Session,\
defaultload, Load, load_only
from sqlalchemy import Integer, Strin... | 36.879933 | 79 | 0.513331 |
from sqlalchemy.testing import eq_, is_, is_not_
import sqlalchemy as sa
from sqlalchemy import testing
from sqlalchemy.orm import joinedload, deferred, undefer, \
joinedload_all, backref, Session,\
defaultload, Load, load_only
from sqlalchemy import Integer, String, Date, ForeignKey, and_, select, \
func,... | true | true |
1c3b57aeaf4fd15721d9e0c57215bb330c0fdb16 | 756 | py | Python | var/spack/repos/builtin/packages/py-fastcov/package.py | LiamBindle/spack | e90d5ad6cfff2ba3de7b537d6511adccd9d5fcf1 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 2,360 | 2017-11-06T08:47:01.000Z | 2022-03-31T14:45:33.000Z | var/spack/repos/builtin/packages/py-fastcov/package.py | LiamBindle/spack | e90d5ad6cfff2ba3de7b537d6511adccd9d5fcf1 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 13,838 | 2017-11-04T07:49:45.000Z | 2022-03-31T23:38:39.000Z | var/spack/repos/builtin/packages/py-fastcov/package.py | LiamBindle/spack | e90d5ad6cfff2ba3de7b537d6511adccd9d5fcf1 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 1,793 | 2017-11-04T07:45:50.000Z | 2022-03-30T14:31:53.000Z | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyFastcov(PythonPackage):
"""
A parallelized gcov wrapper for generating intermediate ... | 30.24 | 94 | 0.715608 |
from spack import *
class PyFastcov(PythonPackage):
homepage = "https://github.com/RPGillespie6/fastcov"
pypi = "fastcov/fastcov-1.13.tar.gz"
maintainers = ['haampie']
version('1.13', sha256='ec8a5271f90a2f8b894cb999e262c33e225ed6072d9a6ca38f636f88cc0543e8')
depends_on('python@3.5:', ... | true | true |
1c3b57da8d3433fdd503a15495d4fbd01591b59f | 712 | py | Python | tutorials/W2D1_BayesianStatistics/solutions/W2D1_Tutorial1_Solution_fd84cbd0.py | liuxiaomiao123/NeuroMathAcademy | 16a7969604a300bf9fbb86f8a5b26050ebd14c65 | [
"CC-BY-4.0"
] | 2 | 2020-07-03T04:39:09.000Z | 2020-07-12T02:08:31.000Z | tutorials/W2D1_BayesianStatistics/solutions/W2D1_Tutorial1_Solution_fd84cbd0.py | NinaHKivanani/course-content | 3c91dd1a669cebce892486ba4f8086b1ef2e1e49 | [
"CC-BY-4.0"
] | 1 | 2020-06-22T22:57:03.000Z | 2020-06-22T22:57:03.000Z | tutorials/W2D1_BayesianStatistics/solutions/W2D1_Tutorial1_Solution_fd84cbd0.py | NinaHKivanani/course-content | 3c91dd1a669cebce892486ba4f8086b1ef2e1e49 | [
"CC-BY-4.0"
] | 1 | 2021-04-26T11:30:26.000Z | 2021-04-26T11:30:26.000Z | with plt.xkcd():
mu_posteriors = []
max_posteriors = []
for mu_visual in mu_visuals:
max_posterior = compute_mode_posterior_multiply(x,
mu_auditory, sigma_auditory,
mu_visual, sigma_visual)
... | 35.6 | 81 | 0.508427 | with plt.xkcd():
mu_posteriors = []
max_posteriors = []
for mu_visual in mu_visuals:
max_posterior = compute_mode_posterior_multiply(x,
mu_auditory, sigma_auditory,
mu_visual, sigma_visual)
... | true | true |
1c3b58290e3527f2bd100b7ab4eee0f95395fece | 5,385 | py | Python | evaluate.py | yangapku/OFA | 6bf21b0f2483d53b2750db1ea3fd103ec7d331d1 | [
"Apache-2.0"
] | 1 | 2022-03-25T09:30:24.000Z | 2022-03-25T09:30:24.000Z | evaluate.py | yangapku/OFA | 6bf21b0f2483d53b2750db1ea3fd103ec7d331d1 | [
"Apache-2.0"
] | null | null | null | evaluate.py | yangapku/OFA | 6bf21b0f2483d53b2750db1ea3fd103ec7d331d1 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3 -u
# Copyright 2022 The OFA-Sys Team.
# All rights reserved.
# This source code is licensed under the Apache 2.0 license
# found in the LICENSE file in the root directory.
import logging
import os
import sys
import numpy as np
import torch
from fairseq import distributed_utils, options, tasks... | 38.741007 | 280 | 0.712906 |
import logging
import os
import sys
import numpy as np
import torch
from fairseq import distributed_utils, options, tasks, utils
from fairseq.dataclass.utils import convert_namespace_to_omegaconf
from fairseq.logging import progress_bar
from fairseq.utils import reset_logging
from omegaconf import DictConfig
from ut... | true | true |
1c3b582ae8514b7fd13c1904986f59e812406230 | 974 | py | Python | cpdb/trr/models/action_response.py | invinst/CPDBv2_backend | b4e96d620ff7a437500f525f7e911651e4a18ef9 | [
"Apache-2.0"
] | 25 | 2018-07-20T22:31:40.000Z | 2021-07-15T16:58:41.000Z | cpdb/trr/models/action_response.py | invinst/CPDBv2_backend | b4e96d620ff7a437500f525f7e911651e4a18ef9 | [
"Apache-2.0"
] | 13 | 2018-06-18T23:08:47.000Z | 2022-02-10T07:38:25.000Z | cpdb/trr/models/action_response.py | invinst/CPDBv2_backend | b4e96d620ff7a437500f525f7e911651e4a18ef9 | [
"Apache-2.0"
] | 6 | 2018-05-17T21:59:43.000Z | 2020-11-17T00:30:26.000Z | from django.contrib.gis.db import models
from trr.constants import (
ACTION_PERSON_CHOICES,
RESISTANCE_TYPE_CHOICES,
RESISTANCE_LEVEL_CHOICES,
)
from data.models.common import TimeStampsModel
class ActionResponse(TimeStampsModel):
trr = models.ForeignKey('trr.TRR', on_delete=models.CASCADE)
perso... | 44.272727 | 99 | 0.785421 | from django.contrib.gis.db import models
from trr.constants import (
ACTION_PERSON_CHOICES,
RESISTANCE_TYPE_CHOICES,
RESISTANCE_LEVEL_CHOICES,
)
from data.models.common import TimeStampsModel
class ActionResponse(TimeStampsModel):
trr = models.ForeignKey('trr.TRR', on_delete=models.CASCADE)
perso... | true | true |
1c3b598fd837994e810cd2153f3b614a4572e952 | 19,110 | py | Python | archivist/archivist.py | leflambeur/archivist-python | cf0790f103d575e87c49334614a552395e4b1903 | [
"MIT"
] | 2 | 2021-05-04T15:12:37.000Z | 2021-09-08T10:04:41.000Z | archivist/archivist.py | leflambeur/archivist-python | cf0790f103d575e87c49334614a552395e4b1903 | [
"MIT"
] | 35 | 2021-05-04T12:39:26.000Z | 2022-03-28T09:20:19.000Z | archivist/archivist.py | leflambeur/archivist-python | cf0790f103d575e87c49334614a552395e4b1903 | [
"MIT"
] | 6 | 2021-04-28T14:49:48.000Z | 2022-01-07T15:29:05.000Z | # -*- coding: utf-8 -*-
"""Archivist connection interface
This module contains the base Archivist class which manages
the connection parameters to a Jitsuin Archivist instance and
the basic REST verbs to GET, POST, PATCH and DELETE entities..
The REST methods in this class should only be used directly whe... | 28.998483 | 94 | 0.595552 |
import logging
import json
from collections import deque
from copy import deepcopy
from time import time
from typing import BinaryIO, Dict, List, Optional, Union
import requests
from requests.models import Response
from requests_toolbelt.multipart.encoder import MultipartEncoder
from .constants import (
HEADER... | true | true |
1c3b5a486742d083e08034ad044e4be97599f9a4 | 7,493 | py | Python | surveysite/settings.py | r-anime/surveysite | 85c10882a8fcb0b01c180ba4ebe11c229d99c60e | [
"MIT"
] | 6 | 2021-01-23T22:21:41.000Z | 2021-06-30T00:45:34.000Z | surveysite/settings.py | r-anime/surveysite | 85c10882a8fcb0b01c180ba4ebe11c229d99c60e | [
"MIT"
] | 46 | 2021-01-02T02:52:42.000Z | 2022-03-28T18:54:48.000Z | surveysite/settings.py | r-anime/surveysite | 85c10882a8fcb0b01c180ba4ebe11c229d99c60e | [
"MIT"
] | 2 | 2021-04-20T05:20:45.000Z | 2021-04-20T05:28:13.000Z | """
Django settings for surveysite project.
Generated by 'django-admin startproject' using Django 3.1.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from pathli... | 27.751852 | 131 | 0.669558 |
from pathlib import Path
from django.contrib.messages import constants as message_constants
import os
import datetime
BASE_DIR = Path(__file__).resolve(strict=True).parent.parent
SECRET_KEY = os.environ.get('WEBSITE_SECRET')
REDDIT_OAUTH_SECRET = os.environ.get('WEBSITE_REDDIT_OAUTH_SECRET')
REDDIT_OAUTH_CLIENT_I... | true | true |
1c3b5a934e3be37f7112f3b58cc9fd7dc8ef632a | 7,743 | py | Python | doc/conf.py | bioidiap/bob.ip.tensorflow_extractor | 14ab1f878a352e1075c31d94c715b4f7556e7afb | [
"BSD-3-Clause"
] | null | null | null | doc/conf.py | bioidiap/bob.ip.tensorflow_extractor | 14ab1f878a352e1075c31d94c715b4f7556e7afb | [
"BSD-3-Clause"
] | null | null | null | doc/conf.py | bioidiap/bob.ip.tensorflow_extractor | 14ab1f878a352e1075c31d94c715b4f7556e7afb | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# vim: set fileencoding=utf-8 :
import os
import sys
import glob
import pkg_resources
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
needs_sphinx = "1.3"
# Add any Sphinx extension module ... | 30.604743 | 88 | 0.718455 |
import os
import sys
import glob
import pkg_resources
needs_sphinx = "1.3"
extensions = [
"sphinx.ext.todo",
"sphinx.ext.coverage",
"sphinx.ext.ifconfig",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.doctest",
"sphinx.ext.graphviz",
"sphinx.ext.intersphinx",
"sphi... | true | true |
1c3b5b74f45d677071fa6a87f980d8bd333fdc67 | 3,980 | py | Python | hue_sensors_phue.py | robmarkcole/Hue-sensors-phue | d7214ad313c46c7ff48d4f062fe772e4e3b2c1bf | [
"MIT"
] | 3 | 2017-12-21T06:17:55.000Z | 2019-03-15T16:37:45.000Z | hue_sensors_phue.py | robmarkcole/Hue-sensors-phue | d7214ad313c46c7ff48d4f062fe772e4e3b2c1bf | [
"MIT"
] | null | null | null | hue_sensors_phue.py | robmarkcole/Hue-sensors-phue | d7214ad313c46c7ff48d4f062fe772e4e3b2c1bf | [
"MIT"
] | null | null | null | """
Standalone code for parsing phue sensor data.
Robin Cole. 19-12-2017
"""
from phue import Bridge
__version__ = 1.0
def get_response_from_ip(bridge_ip):
"""Returns the phue sensors response for a bridge_ip."""
b = Bridge(bridge_ip)
response = b.get_sensor_objects('name')
return response
def pars... | 31.338583 | 78 | 0.557286 | from phue import Bridge
__version__ = 1.0
def get_response_from_ip(bridge_ip):
b = Bridge(bridge_ip)
response = b.get_sensor_objects('name')
return response
def parse_sml(response):
if response.type == "ZLLLightLevel":
lightlevel = response.state['lightlevel']
if lightlevel is not N... | true | true |
1c3b5b94e089f52f18d59ebd2d3121a21de46f0a | 2,449 | py | Python | data/cirq_new/cirq_program/startCirq_pragma182.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | data/cirq_new/cirq_program/startCirq_pragma182.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | data/cirq_new/cirq_program/startCirq_pragma182.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=4
# total number=12
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
class Opty(cirq.PointOptimizer):
def optimization_at(
... | 31 | 92 | 0.639853 |
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
class Opty(cirq.PointOptimizer):
def optimization_at(
self,
circuit: 'cirq.Circuit',
index: int,
op: 'cirq.Operation'
) -> Optional[cirq.PointOpti... | true | true |
1c3b5c6e0d48501de1a38795e0fcf84cb9e36606 | 16,927 | py | Python | seml/config.py | cqql/seml | 9c0c8fed0135508e1f151662843af6d6adf7102b | [
"MIT"
] | 69 | 2019-12-14T06:04:54.000Z | 2022-03-24T08:58:23.000Z | seml/config.py | cqql/seml | 9c0c8fed0135508e1f151662843af6d6adf7102b | [
"MIT"
] | 60 | 2020-04-02T13:19:20.000Z | 2022-03-31T10:24:43.000Z | seml/config.py | cqql/seml | 9c0c8fed0135508e1f151662843af6d6adf7102b | [
"MIT"
] | 21 | 2020-04-02T10:04:51.000Z | 2022-03-23T17:34:10.000Z | import logging
import numpy as np
import yaml
import ast
import jsonpickle
import json
import os
from pathlib import Path
import copy
from itertools import combinations
from seml.sources import import_exe
from seml.parameters import sample_random_configs, generate_grid, cartesian_product_dict
from seml.utils import me... | 38.734554 | 120 | 0.659184 | import logging
import numpy as np
import yaml
import ast
import jsonpickle
import json
import os
from pathlib import Path
import copy
from itertools import combinations
from seml.sources import import_exe
from seml.parameters import sample_random_configs, generate_grid, cartesian_product_dict
from seml.utils import me... | true | true |
1c3b5d034c1f5cc82d2da4d439996a66a0eefad5 | 16 | py | Python | radioxenon_ml/test_files/__init__.py | manninosi/radioxenon_ml | e901a2465bcbe491184cefc58db021a9321b9555 | [
"MIT"
] | null | null | null | radioxenon_ml/test_files/__init__.py | manninosi/radioxenon_ml | e901a2465bcbe491184cefc58db021a9321b9555 | [
"MIT"
] | 1 | 2018-04-24T03:26:56.000Z | 2018-05-09T17:10:55.000Z | radioxenon_ml/test_files/__init__.py | manninosi/radioxenon_ml | e901a2465bcbe491184cefc58db021a9321b9555 | [
"MIT"
] | 1 | 2018-04-23T20:52:43.000Z | 2018-04-23T20:52:43.000Z | #read_in__init__ | 16 | 16 | 0.9375 | true | true | |
1c3b5d09ff767e14087b63a78fa7d9321583e55c | 3,951 | py | Python | financial_canvas/figures/CustomFigure.py | EvgeniiaVak/financial-canvas | 1726c62f2735b67afd853a02f1130cc59ae28963 | [
"MIT"
] | null | null | null | financial_canvas/figures/CustomFigure.py | EvgeniiaVak/financial-canvas | 1726c62f2735b67afd853a02f1130cc59ae28963 | [
"MIT"
] | 2 | 2021-08-21T14:03:45.000Z | 2021-10-01T11:32:11.000Z | financial_canvas/figures/CustomFigure.py | EvgeniiaVak/financial_canvas | 1726c62f2735b67afd853a02f1130cc59ae28963 | [
"MIT"
] | null | null | null | from functools import partial
from bokeh.plotting import figure as bokeh_figure
from bokeh.models import CustomJS
from financial_canvas.figures.utils import create_sources
from financial_canvas.figures.utils import read_file
class CustomFigure(object):
'''
A base class for creating bokeh figures that will fi... | 42.031915 | 99 | 0.618578 | from functools import partial
from bokeh.plotting import figure as bokeh_figure
from bokeh.models import CustomJS
from financial_canvas.figures.utils import create_sources
from financial_canvas.figures.utils import read_file
class CustomFigure(object):
def __init__(self, df, *, selected_from=None):
if se... | true | true |
1c3b5d954ad0aee1b9e5fb0e78f9cd2780d1d5a1 | 1,330 | py | Python | src/models/stochastic/bbb/utils.py | tiwalayo/flexible-bnn | 424572de879d64ee0b2f004d9649e823d2004430 | [
"Apache-2.0"
] | 1 | 2020-12-20T09:49:10.000Z | 2020-12-20T09:49:10.000Z | src/models/stochastic/bbb/utils.py | tiwalayo/flexible-bnn | 424572de879d64ee0b2f004d9649e823d2004430 | [
"Apache-2.0"
] | 1 | 2020-10-22T03:39:50.000Z | 2020-11-02T18:30:49.000Z | src/models/stochastic/bbb/utils.py | tiwalayo/flexible-bnn | 424572de879d64ee0b2f004d9649e823d2004430 | [
"Apache-2.0"
] | null | null | null | import torch
import numpy as np
import torch.nn.functional as F
def kl_divergence(mu, sigma, mu_prior, sigma_prior):
kl = 0.5 * (2 * torch.log(sigma_prior / sigma) - 1 + (sigma / sigma_prior).pow(2) + ((mu_prior - mu) / sigma_prior).pow(2)).sum()
return kl
def normpdf(x, mu=0.0, sigma=0.3):
m =... | 44.333333 | 135 | 0.606767 | import torch
import numpy as np
import torch.nn.functional as F
def kl_divergence(mu, sigma, mu_prior, sigma_prior):
kl = 0.5 * (2 * torch.log(sigma_prior / sigma) - 1 + (sigma / sigma_prior).pow(2) + ((mu_prior - mu) / sigma_prior).pow(2)).sum()
return kl
def normpdf(x, mu=0.0, sigma=0.3):
m =... | true | true |
1c3b605c52be0f323cf4325abca5c1af9c2a8497 | 1,172 | py | Python | parameter_init_adjustments.py | ChristophRaab/DATL | e1d44992e41060bb842525591181bfbbf7fd3c23 | [
"MIT"
] | 2 | 2022-01-27T22:30:42.000Z | 2022-01-29T14:14:30.000Z | parameter_init_adjustments.py | ChristophRaab/DATL | e1d44992e41060bb842525591181bfbbf7fd3c23 | [
"MIT"
] | null | null | null | parameter_init_adjustments.py | ChristophRaab/DATL | e1d44992e41060bb842525591181bfbbf7fd3c23 | [
"MIT"
] | null | null | null | import numpy as np
import torch
from torch import nn
def init_weights(m):
classname = m.__class__.__name__
if classname.find('Conv2d') != -1 or classname.find('ConvTranspose2d') != -1:
nn.init.kaiming_uniform_(m.weight)
nn.init.zeros_(m.bias)
elif classname.find('BatchNorm') != -1:
... | 39.066667 | 122 | 0.654437 | import numpy as np
import torch
from torch import nn
def init_weights(m):
classname = m.__class__.__name__
if classname.find('Conv2d') != -1 or classname.find('ConvTranspose2d') != -1:
nn.init.kaiming_uniform_(m.weight)
nn.init.zeros_(m.bias)
elif classname.find('BatchNorm') != -1:
... | true | true |
1c3b61505602f8e0d3ede08e1930940d3e13eaf6 | 9,934 | py | Python | armory/utils/metrics.py | mzweilin/armory | da3fedc02f6f4841a813c4af8aafcc3ff7501665 | [
"MIT"
] | null | null | null | armory/utils/metrics.py | mzweilin/armory | da3fedc02f6f4841a813c4af8aafcc3ff7501665 | [
"MIT"
] | null | null | null | armory/utils/metrics.py | mzweilin/armory | da3fedc02f6f4841a813c4af8aafcc3ff7501665 | [
"MIT"
] | null | null | null | """
Metrics for scenarios
Outputs are lists of python variables amenable to JSON serialization:
e.g., bool, int, float
numpy data types and tensors generally fail to serialize
"""
import logging
import numpy as np
logger = logging.getLogger(__name__)
def categorical_accuracy(y, y_pred):
"""
Return ... | 30.472393 | 86 | 0.599859 |
import logging
import numpy as np
logger = logging.getLogger(__name__)
def categorical_accuracy(y, y_pred):
y = np.asarray(y)
y_pred = np.asarray(y_pred)
if y.ndim == 0:
y = np.array([y])
y_pred = np.array([y_pred])
if y.shape == y_pred.shape:
return [int(x) for x in list(y ... | true | true |
1c3b61d2af6ef4297abcbc41f6994d956956b8f5 | 7,048 | py | Python | src/frontend.py | Samhuw8a/Jakob | 86ac574b9191b856d46fefc5e90c732f6d5265df | [
"MIT"
] | null | null | null | src/frontend.py | Samhuw8a/Jakob | 86ac574b9191b856d46fefc5e90c732f6d5265df | [
"MIT"
] | 1 | 2022-01-15T16:34:53.000Z | 2022-01-15T16:34:53.000Z | src/frontend.py | Samhuw8a/Jakob | 86ac574b9191b856d46fefc5e90c732f6d5265df | [
"MIT"
] | null | null | null | from tkinter import *
from tkinter.colorchooser import askcolor
import sys
class SettingsWindow(Toplevel):
def __init__(self,window):
self.root_window=window
super().__init__(window)
self.title("Einstellungen")
self.get_conf()
self.make_mess_methode_menu()
... | 33.884615 | 130 | 0.610244 | from tkinter import *
from tkinter.colorchooser import askcolor
import sys
class SettingsWindow(Toplevel):
def __init__(self,window):
self.root_window=window
super().__init__(window)
self.title("Einstellungen")
self.get_conf()
self.make_mess_methode_menu()
... | true | true |
1c3b62adbe33c307499ef5ecfd5530a3a22e0a35 | 10,715 | py | Python | jwplatform/upload.py | jwplayer/jwplayer-py | 2f478550414145e9d36b1cdf901dcf5360f8fe2b | [
"MIT"
] | 37 | 2016-09-14T20:34:42.000Z | 2022-02-15T06:47:21.000Z | jwplatform/upload.py | jwplayer/jwplayer-py | 2f478550414145e9d36b1cdf901dcf5360f8fe2b | [
"MIT"
] | 24 | 2016-11-16T21:36:13.000Z | 2022-02-18T14:37:35.000Z | jwplatform/upload.py | jwplayer/jwplayer-py | 2f478550414145e9d36b1cdf901dcf5360f8fe2b | [
"MIT"
] | 45 | 2016-10-13T08:41:35.000Z | 2022-03-06T02:31:23.000Z | import http.client
import logging
import math
import os
from dataclasses import dataclass
from enum import Enum
from hashlib import md5
from urllib.parse import urlparse
MAX_PAGE_SIZE = 1000
MIN_PART_SIZE = 5 * 1024 * 1024
UPLOAD_BASE_URL = 'upload.jwplayer.com'
MAX_FILE_SIZE = 25 * 1000 * 1024 * 1024
class UploadTy... | 37.996454 | 120 | 0.629585 | import http.client
import logging
import math
import os
from dataclasses import dataclass
from enum import Enum
from hashlib import md5
from urllib.parse import urlparse
MAX_PAGE_SIZE = 1000
MIN_PART_SIZE = 5 * 1024 * 1024
UPLOAD_BASE_URL = 'upload.jwplayer.com'
MAX_FILE_SIZE = 25 * 1000 * 1024 * 1024
class UploadTy... | true | true |
1c3b634299fe4ae82ea90f3fdf2e6fe6c49b7c23 | 2,257 | py | Python | model/python/svg/connection_edge_point.py | demx8as6/network-topology-instance-generator | 5dcdba9ad295de32a5a0986f6f39c36c5a4695db | [
"Apache-2.0"
] | null | null | null | model/python/svg/connection_edge_point.py | demx8as6/network-topology-instance-generator | 5dcdba9ad295de32a5a0986f6f39c36c5a4695db | [
"Apache-2.0"
] | null | null | null | model/python/svg/connection_edge_point.py | demx8as6/network-topology-instance-generator | 5dcdba9ad295de32a5a0986f6f39c36c5a4695db | [
"Apache-2.0"
] | null | null | null | # Copyright 2022 highstreet technologies GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 34.19697 | 83 | 0.626052 |
from typing import Dict
from lxml import etree
from model.python.svg.svg import Svg
class ConnectionEdgePoint(Svg):
def svg_main(self) -> etree.Element:
main = etree.Element("ellipse")
main.attrib['cx'] = str(self.center_x())
main.attrib['cy'] = str(self.center_y())
main.attr... | true | true |
1c3b63a9da742d8fa84f8684ae951375394f55f9 | 1,261 | py | Python | image/drawing/drawing_pen.py | shuge/Qt-Python-Binding-Examples | efe40c8af6c3e0805a5a7c3d053b8c8bf893a803 | [
"BSD-3-Clause"
] | 179 | 2015-01-08T10:21:28.000Z | 2020-03-24T07:03:04.000Z | image/drawing/drawing_pen.py | tonytony2020/Qt-Python-Binding-Examples | efe40c8af6c3e0805a5a7c3d053b8c8bf893a803 | [
"BSD-3-Clause"
] | 1 | 2019-12-23T17:14:37.000Z | 2020-01-09T16:45:58.000Z | image/drawing/drawing_pen.py | shuge/Qt-Python-Binding-Examples | efe40c8af6c3e0805a5a7c3d053b8c8bf893a803 | [
"BSD-3-Clause"
] | 57 | 2015-01-05T09:34:15.000Z | 2019-11-18T06:12:08.000Z | #!/usr/bin/python
# -*- coding: utf-8 -*-
# penstyles.py
import sys
from PySide import QtGui, QtCore
class Example(QtGui.QWidget):
def __init__(self):
super(Example, self).__init__()
self.setGeometry(300, 300, 280, 270)
self.setWindowTitle('penstyles')
def paintEvent(self, e):
... | 21.372881 | 65 | 0.570182 |
import sys
from PySide import QtGui, QtCore
class Example(QtGui.QWidget):
def __init__(self):
super(Example, self).__init__()
self.setGeometry(300, 300, 280, 270)
self.setWindowTitle('penstyles')
def paintEvent(self, e):
qp = QtGui.QPainter()
qp.begin(sel... | true | true |
1c3b6427f9cbf4c095ef56d602b113ff3e241190 | 2,215 | py | Python | test/test_scio.py | tomd/act-workers | ef42eaf26b14197a6bd1ac9ae12c4d39acc740c1 | [
"ISC"
] | null | null | null | test/test_scio.py | tomd/act-workers | ef42eaf26b14197a6bd1ac9ae12c4d39acc740c1 | [
"ISC"
] | null | null | null | test/test_scio.py | tomd/act-workers | ef42eaf26b14197a6bd1ac9ae12c4d39acc740c1 | [
"ISC"
] | null | null | null | """ Test for scio worker """
import json
import act.api
from act.workers import scio
def test_scio_facts(capsys) -> None: # type: ignore
""" Test for scio facts, by comparing to captue of stdout """
with open("test/scio-doc.json") as scio_doc:
doc = json.loads(scio_doc.read())
api = act.api.Act... | 48.152174 | 120 | 0.649661 | import json
import act.api
from act.workers import scio
def test_scio_facts(capsys) -> None: with open("test/scio-doc.json") as scio_doc:
doc = json.loads(scio_doc.read())
api = act.api.Act("", None, "error")
scio.add_to_act(api, doc, output_format="str")
captured = capsys.readouterr()
... | true | true |
1c3b64777d39f62668262347595156cf7f937d70 | 69,565 | py | Python | aiida/orm/nodes/data/array/bands.py | HaoZeke/aiida-core | 1a4cada67fe36353326dcebfe888ebc01a6c5b7b | [
"MIT",
"BSD-3-Clause"
] | null | null | null | aiida/orm/nodes/data/array/bands.py | HaoZeke/aiida-core | 1a4cada67fe36353326dcebfe888ebc01a6c5b7b | [
"MIT",
"BSD-3-Clause"
] | 2 | 2019-03-06T11:23:42.000Z | 2020-03-09T09:34:07.000Z | aiida/orm/nodes/data/array/bands.py | lorisercole/aiida-core | 84c2098318bf234641219e55795726f99dc25a16 | [
"MIT",
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | 38.625763 | 128 | 0.617595 | from string import Template
import numpy
from aiida.common.exceptions import ValidationError
from aiida.common.utils import prettify_labels, join_labels
from .kpoints import KpointsData
def prepare_header_comment(uuid, plot_info, comment_char='#'):
from aiida import get_file_header
filetext = []
filete... | true | true |
1c3b649fe1c28b0257033d6e497222d0913c9d9c | 7,396 | py | Python | saleor/billpayment/income_api/views.py | glosoftgroup/tenants | a6b229ad1f6d567b7078f83425a532830b71e1bb | [
"BSD-3-Clause"
] | 1 | 2018-05-03T06:17:02.000Z | 2018-05-03T06:17:02.000Z | saleor/billpayment/income_api/views.py | glosoftgroup/tenants | a6b229ad1f6d567b7078f83425a532830b71e1bb | [
"BSD-3-Clause"
] | 8 | 2018-05-07T16:42:35.000Z | 2022-02-26T03:31:56.000Z | saleor/billpayment/income_api/views.py | glosoftgroup/tenants | a6b229ad1f6d567b7078f83425a532830b71e1bb | [
"BSD-3-Clause"
] | null | null | null | from rest_framework import generics
from django.db.models import Q
from django.contrib.auth import get_user_model
from rest_framework.permissions import IsAuthenticatedOrReadOnly
from rest_framework import pagination
from .pagination import PostLimitOffsetPagination
from saleor.billpayment.models import BillPayment as... | 42.505747 | 155 | 0.631558 | from rest_framework import generics
from django.db.models import Q
from django.contrib.auth import get_user_model
from rest_framework.permissions import IsAuthenticatedOrReadOnly
from rest_framework import pagination
from .pagination import PostLimitOffsetPagination
from saleor.billpayment.models import BillPayment as... | true | true |
1c3b64bc4bf2b7569679a67aa99de3fa72d31013 | 777 | py | Python | greeter_server.py | mbchristoff/grpc-hello-world | c49bad4a650f783b12ad277c7856ecf63d318af0 | [
"Apache-2.0"
] | null | null | null | greeter_server.py | mbchristoff/grpc-hello-world | c49bad4a650f783b12ad277c7856ecf63d318af0 | [
"Apache-2.0"
] | null | null | null | greeter_server.py | mbchristoff/grpc-hello-world | c49bad4a650f783b12ad277c7856ecf63d318af0 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
from concurrent import futures
import time
import socket
import grpc
import helloworld_pb2
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
class Greeter(helloworld_pb2.GreeterServicer):
def SayHello(self, request, context):
return helloworld_pb2.HelloReply(message='Hello, %s! Greetings from %s,' %... | 22.852941 | 116 | 0.747748 |
from concurrent import futures
import time
import socket
import grpc
import helloworld_pb2
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
class Greeter(helloworld_pb2.GreeterServicer):
def SayHello(self, request, context):
return helloworld_pb2.HelloReply(message='Hello, %s! Greetings from %s,' % (request.name, socket... | true | true |
1c3b65ac63df0e9f4aed422b094ec0c28e1f9ece | 2,200 | py | Python | waveforms/quantum/circuit/qlisp/utils.py | feihoo87/waveforms | d986852019206f18269a702f4dfbd17a78dc135a | [
"MIT"
] | 7 | 2020-08-10T12:07:52.000Z | 2021-11-11T08:40:07.000Z | waveforms/quantum/circuit/qlisp/utils.py | feihoo87/waveforms | d986852019206f18269a702f4dfbd17a78dc135a | [
"MIT"
] | null | null | null | waveforms/quantum/circuit/qlisp/utils.py | feihoo87/waveforms | d986852019206f18269a702f4dfbd17a78dc135a | [
"MIT"
] | null | null | null | from itertools import repeat
import numpy as np
def DD(qubit, t, gates, pos, f=0):
seq = [('X/2', qubit)]
i = 0
for gate in gates:
gap = t * (pos[i] - pos[i - 1]) if i > 0 else t * pos[0]
seq.append((('Delay', gap), qubit))
seq.append((gate, qubit))
i += 1
gap = t * (1... | 28.205128 | 77 | 0.419545 | from itertools import repeat
import numpy as np
def DD(qubit, t, gates, pos, f=0):
seq = [('X/2', qubit)]
i = 0
for gate in gates:
gap = t * (pos[i] - pos[i - 1]) if i > 0 else t * pos[0]
seq.append((('Delay', gap), qubit))
seq.append((gate, qubit))
i += 1
gap = t * (1... | true | true |
1c3b670d4bfa60482306031762c79099ed9a9b78 | 34 | py | Python | models/__init__.py | vanja/browserentropy | f541c1f29457f865cb2b8ecf84b1ab8f4b7fb243 | [
"MIT"
] | null | null | null | models/__init__.py | vanja/browserentropy | f541c1f29457f865cb2b8ecf84b1ab8f4b7fb243 | [
"MIT"
] | 1 | 2018-03-05T12:53:57.000Z | 2018-03-05T12:53:57.000Z | models/__init__.py | vanja/browserentropy | f541c1f29457f865cb2b8ecf84b1ab8f4b7fb243 | [
"MIT"
] | null | null | null | """Package for classes.
"""
| 6.8 | 24 | 0.5 | true | true | |
1c3b695591253e4ad35f6585380f0a804675b030 | 9,272 | py | Python | active_learning_dd/utils/generate_dissimilarity_matrix.py | gitter-lab/active-learning-drug-discovery | b24004a359037b3a1175a61c181ec231b711c797 | [
"MIT"
] | null | null | null | active_learning_dd/utils/generate_dissimilarity_matrix.py | gitter-lab/active-learning-drug-discovery | b24004a359037b3a1175a61c181ec231b711c797 | [
"MIT"
] | null | null | null | active_learning_dd/utils/generate_dissimilarity_matrix.py | gitter-lab/active-learning-drug-discovery | b24004a359037b3a1175a61c181ec231b711c797 | [
"MIT"
] | null | null | null | """
Script for generating the dissimilarity matrix.
csv_file_or_dir: specifies a single file or path with format of csv files to be loaded. e.g: /path/iter_{}.csv or /path/iter_*.csv.
output_dir: where to save the memmap file of the dissimilarity matrix.
feature_name: specifies the column name for featu... | 50.945055 | 206 | 0.663503 | from __future__ import print_function
import argparse
import pandas as pd
import numpy as np
import glob
import time
import pathlib
from multiprocessing import Process
from .data_utils import *
def get_features(csv_files_list, feature_name, index_name, tmp_dir, process_batch_size) :
instances_per_file = []
... | true | true |
1c3b6a68ef1c98aebe02c2059f7150413d2f0201 | 1,007 | py | Python | tests/unit/cli/formatter_test.py | matthieudelaro/dockernut | 998f614c6ad018873f3b3aee58841c62e1b160da | [
"Apache-2.0"
] | 1 | 2019-11-04T06:52:35.000Z | 2019-11-04T06:52:35.000Z | tests/unit/cli/formatter_test.py | matthieudelaro/dockernut | 998f614c6ad018873f3b3aee58841c62e1b160da | [
"Apache-2.0"
] | 1 | 2021-03-26T00:26:31.000Z | 2021-03-26T00:26:31.000Z | tests/unit/cli/formatter_test.py | matthieudelaro/dockernut | 998f614c6ad018873f3b3aee58841c62e1b160da | [
"Apache-2.0"
] | 1 | 2019-11-04T06:52:37.000Z | 2019-11-04T06:52:37.000Z | from __future__ import absolute_import
from __future__ import unicode_literals
import logging
from compose.cli import colors
from compose.cli.formatter import ConsoleWarningFormatter
from tests import unittest
MESSAGE = 'this is the message'
def makeLogRecord(level):
return logging.LogRecord('name', level, 'p... | 27.972222 | 76 | 0.714002 | from __future__ import absolute_import
from __future__ import unicode_literals
import logging
from compose.cli import colors
from compose.cli.formatter import ConsoleWarningFormatter
from tests import unittest
MESSAGE = 'this is the message'
def makeLogRecord(level):
return logging.LogRecord('name', level, 'p... | true | true |
1c3b6b134598894e4dda51d1cfcb8e9c4e2d366b | 5,495 | py | Python | TSP-VRP/TSPalgos.py | elifaydin00/ENS208-Introduction-To-Industrial-Engineering | f17932a773ed4c83d960c4a3657db50abb68c3a9 | [
"MIT"
] | 2 | 2021-06-11T22:19:36.000Z | 2021-10-04T13:40:46.000Z | TSP-VRP/TSPalgos.py | elifaydin00/ENS208-Introduction-To-Industrial-Engineering | f17932a773ed4c83d960c4a3657db50abb68c3a9 | [
"MIT"
] | null | null | null | TSP-VRP/TSPalgos.py | elifaydin00/ENS208-Introduction-To-Industrial-Engineering | f17932a773ed4c83d960c4a3657db50abb68c3a9 | [
"MIT"
] | 1 | 2021-10-04T13:40:48.000Z | 2021-10-04T13:40:48.000Z | '''
ENS 208 - Introduction to IE
Function definitions for nearest neighbor, savings, and 2-opt algorithms.
'''
from pqdict import pqdict
# =============================================================================
def nearest_neighbor(nodes, origin, d):
'''
Constructs a TSP solution using the nearest neig... | 38.697183 | 107 | 0.549227 |
from pqdict import pqdict
def nearest_neighbor(nodes, origin, d):
tour = [origin]
tour_length = 0
if origin not in nodes:
nodes.append(origin)
while len(tour) < len(nodes):
dist, next_node = min((d[tour[-1]][i], i) for i in nodes if i not in tour)
... | true | true |
1c3b6db6915f10b4aa96caac0847d740e301d886 | 3,611 | py | Python | samples/contrib/pytorch-samples/bert/wrapper.py | hwk42/pipelines | c89ed71cf6339cdcdd957d4dca4b1f32c10db9c9 | [
"Apache-2.0"
] | 1 | 2021-08-23T19:09:56.000Z | 2021-08-23T19:09:56.000Z | samples/contrib/pytorch-samples/bert/wrapper.py | hwk42/pipelines | c89ed71cf6339cdcdd957d4dca4b1f32c10db9c9 | [
"Apache-2.0"
] | 2 | 2021-06-01T10:02:51.000Z | 2021-06-07T07:19:14.000Z | samples/contrib/pytorch-samples/bert/wrapper.py | hwk42/pipelines | c89ed71cf6339cdcdd957d4dca4b1f32c10db9c9 | [
"Apache-2.0"
] | 1 | 2022-03-04T14:26:55.000Z | 2022-03-04T14:26:55.000Z | # !/usr/bin/env/python3
# Copyright (c) Facebook, Inc. and its affiliates.
# 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 ... | 35.752475 | 78 | 0.61368 | import torch
import torch.nn as nn
import torch.nn.functional as F
class AGNewsmodelWrapper(nn.Module):
def __init__(self, model):
super( AGNewsmodelWrapper, self
).__init__()
self.model = model
def compute_bert_outputs( self, model_bert, embedding_input, attent... | true | true |
1c3b6e7d260fb2296297ff4d554f3d2741b0f933 | 207 | py | Python | plaid_project/plaid_app/signals.py | reetikaSR/PlaidProject | 904bd7fd3412a4b5149aae899abcf8794bebba81 | [
"MIT"
] | null | null | null | plaid_project/plaid_app/signals.py | reetikaSR/PlaidProject | 904bd7fd3412a4b5149aae899abcf8794bebba81 | [
"MIT"
] | null | null | null | plaid_project/plaid_app/signals.py | reetikaSR/PlaidProject | 904bd7fd3412a4b5149aae899abcf8794bebba81 | [
"MIT"
] | null | null | null | import django.dispatch
fetch_transactions = django.dispatch.Signal(providing_args=['access_token', 'user_id'])
fetch_accounts = django.dispatch.Signal(providing_args=['access_token', 'user_id', 'item_id']) | 41.4 | 94 | 0.797101 | import django.dispatch
fetch_transactions = django.dispatch.Signal(providing_args=['access_token', 'user_id'])
fetch_accounts = django.dispatch.Signal(providing_args=['access_token', 'user_id', 'item_id']) | true | true |
1c3b6f3dec6348c1f3e5a4afd8ab545d45f2c423 | 945 | py | Python | full_cost/implant/migrations/0006_auto_20200422_1614.py | CEMES-CNRS/full_cost_git | 600409b49db123db82e7f66462395294dde320ce | [
"CECILL-B"
] | null | null | null | full_cost/implant/migrations/0006_auto_20200422_1614.py | CEMES-CNRS/full_cost_git | 600409b49db123db82e7f66462395294dde320ce | [
"CECILL-B"
] | null | null | null | full_cost/implant/migrations/0006_auto_20200422_1614.py | CEMES-CNRS/full_cost_git | 600409b49db123db82e7f66462395294dde320ce | [
"CECILL-B"
] | null | null | null | # Generated by Django 2.2.8 on 2020-04-22 14:14
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('implant', '0005_auto_20200421_1743'),
]
operations = [
migrations.AlterField(
model_name='historicalrecord',
... | 27 | 64 | 0.574603 |
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('implant', '0005_auto_20200421_1743'),
]
operations = [
migrations.AlterField(
model_name='historicalrecord',
name='time_from',
field=mod... | true | true |
1c3b6fb390c84f75c083897c59cc206166c7975c | 271 | py | Python | src/app_messages/views.py | abairo/presentation_poetry_docker | b22785eb567ecf81e00ce3762bcc074e8c0de9c7 | [
"MIT"
] | null | null | null | src/app_messages/views.py | abairo/presentation_poetry_docker | b22785eb567ecf81e00ce3762bcc074e8c0de9c7 | [
"MIT"
] | null | null | null | src/app_messages/views.py | abairo/presentation_poetry_docker | b22785eb567ecf81e00ce3762bcc074e8c0de9c7 | [
"MIT"
] | null | null | null | from django.http import HttpResponse
from .models import Message
def current_message(request):
message = Message.objects.all().last()
html = "<html><body><h1>%s</h1>.</body></html>" % message.text if message else 'Nenhuma mensagem'
return HttpResponse(html) | 33.875 | 101 | 0.715867 | from django.http import HttpResponse
from .models import Message
def current_message(request):
message = Message.objects.all().last()
html = "<html><body><h1>%s</h1>.</body></html>" % message.text if message else 'Nenhuma mensagem'
return HttpResponse(html) | true | true |
1c3b70ccf0f780ce1b5004dd03b412b1672e00d7 | 6,345 | py | Python | attachments/matrix_util.py | 11wi/11wi.github.io | c89f6999ece59cba3ba5bdfd378028adcbad5ee3 | [
"CC-BY-4.0"
] | null | null | null | attachments/matrix_util.py | 11wi/11wi.github.io | c89f6999ece59cba3ba5bdfd378028adcbad5ee3 | [
"CC-BY-4.0"
] | 5 | 2021-03-30T13:59:01.000Z | 2022-02-26T10:25:24.000Z | attachments/matrix_util.py | 11wi/11wi.github.io | c89f6999ece59cba3ba5bdfd378028adcbad5ee3 | [
"CC-BY-4.0"
] | null | null | null | import numpy as _np
from multiprocessing import RawArray as _RawArray
from multiprocessing import Pool as _Pool
from functools import partial as _partial
from numba import njit
def nonzero(array):
index_array = _np.nonzero(array)[0]
return index_array
def inverse(mat):
return _np.ascontiguousarray(_np.l... | 36.889535 | 120 | 0.709535 | import numpy as _np
from multiprocessing import RawArray as _RawArray
from multiprocessing import Pool as _Pool
from functools import partial as _partial
from numba import njit
def nonzero(array):
index_array = _np.nonzero(array)[0]
return index_array
def inverse(mat):
return _np.ascontiguousarray(_np.l... | true | true |
1c3b71311b38054abbc680b04e743b1557f30ce3 | 3,404 | py | Python | ExamplesAndTests_Wimp_reach/params_test_single_bkg_nu_DSNB_3.py | sbaum90/paleoSens | 0f501780858059bac5e563b60250947e28416109 | [
"MIT"
] | null | null | null | ExamplesAndTests_Wimp_reach/params_test_single_bkg_nu_DSNB_3.py | sbaum90/paleoSens | 0f501780858059bac5e563b60250947e28416109 | [
"MIT"
] | null | null | null | ExamplesAndTests_Wimp_reach/params_test_single_bkg_nu_DSNB_3.py | sbaum90/paleoSens | 0f501780858059bac5e563b60250947e28416109 | [
"MIT"
] | null | null | null | # ------------------------------------------------
# output file name
# ------------------------------------------------
fout_name = "ExamplesAndTests_Wimp_reach/test_single_bkg_nu_DSNB_3"
# ------------------------------------------------
# parameter block for sample and read-out info
# -----------------------------... | 43.641026 | 143 | 0.668038 | fout_name = "ExamplesAndTests_Wimp_reach/test_single_bkg_nu_DSNB_3"
sample_age_Myr = 1e3 sample_mass_kg = 1e-3 readout_resolution_Aa = 10.0 C238 = 1e-11 mineral_name = "Gypsum" keep_H_tracks = False
ext_sample_age_bool = True
ext_sample_age_unc = 0.05
ext_sample_mass_bool = True
ext_sample_mass_unc = 1e-5
ext... | true | true |
1c3b7148b68e89bd4aada1bea08d2093e8f7ae58 | 4,247 | py | Python | migration/db_init.py | cocobear/fuxi | a3916131689d82ce6b804e0993d89f755d1108ec | [
"MIT"
] | 731 | 2018-06-13T05:41:04.000Z | 2019-09-06T01:36:57.000Z | migration/db_init.py | riusksk/fuxi | fadb1136b8896fe2a0f7783627bda867d5e6fd98 | [
"MIT"
] | 16 | 2019-10-14T08:17:13.000Z | 2021-12-13T20:13:23.000Z | migration/db_init.py | riusksk/fuxi | fadb1136b8896fe2a0f7783627bda867d5e6fd98 | [
"MIT"
] | 238 | 2018-06-14T08:59:44.000Z | 2019-09-04T06:35:37.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : jeffzhang
# @Time : 2019/5/22
# @File : db_init.py
# @Desc : ""
#
# import os
# import re
# import subprocess
# import sys
# from fuxi.common.utils.logger import logger
# from sqlalchemy.exc import OperationalError
# from fuxi.common.utils.poc_handler ... | 43.783505 | 119 | 0.561808 | # sys.exit(0)
# except Exception as e:
# # catch database error
# logger.error("database initialization failure: {}".format(e))
# sys.exit(0)
#
# if not DBXssPayloads.find_one():
# # xss payload example
# name = "get document.cookie"
# value = "var api = '... | true | true |
1c3b7203b593306be831ad4edabfb7eedf8274fa | 13,768 | py | Python | django/db/models/deletion.py | MikeAmy/django | 00cb9e13b4cf06ed2be27ee9e7fc18969ae69f7d | [
"PSF-2.0",
"BSD-3-Clause"
] | 1 | 2017-08-30T06:46:16.000Z | 2017-08-30T06:46:16.000Z | django/db/models/deletion.py | MikeAmy/django | 00cb9e13b4cf06ed2be27ee9e7fc18969ae69f7d | [
"PSF-2.0",
"BSD-3-Clause"
] | null | null | null | django/db/models/deletion.py | MikeAmy/django | 00cb9e13b4cf06ed2be27ee9e7fc18969ae69f7d | [
"PSF-2.0",
"BSD-3-Clause"
] | 1 | 2019-10-22T12:16:53.000Z | 2019-10-22T12:16:53.000Z | from collections import Counter, OrderedDict
from operator import attrgetter
from django.db import IntegrityError, connections, transaction
from django.db.models import signals, sql
from django.utils import six
class ProtectedError(IntegrityError):
def __init__(self, msg, protected_objects):
self.protect... | 43.159875 | 90 | 0.615122 | from collections import Counter, OrderedDict
from operator import attrgetter
from django.db import IntegrityError, connections, transaction
from django.db.models import signals, sql
from django.utils import six
class ProtectedError(IntegrityError):
def __init__(self, msg, protected_objects):
self.protect... | true | true |
1c3b743681d6c6d737f3e9a733fc8a941192007f | 1,027 | py | Python | pipecutter/interface.py | binste/pipecutter | 18cac9340ea9f192e524b8a1b8f351cba972d45b | [
"MIT"
] | 3 | 2020-01-05T18:32:40.000Z | 2021-10-13T09:37:14.000Z | pipecutter/interface.py | binste/pipecutter | 18cac9340ea9f192e524b8a1b8f351cba972d45b | [
"MIT"
] | null | null | null | pipecutter/interface.py | binste/pipecutter | 18cac9340ea9f192e524b8a1b8f351cba972d45b | [
"MIT"
] | null | null | null | from typing import Union, List
from contextlib import contextmanager
import luigi
from luigi import worker
def _raise_run_exception(self, ex) -> None:
raise ex
@contextmanager
def debug_mode():
original_handle_run_exception = worker.TaskProcess._handle_run_exception
try:
worker.TaskProcess._han... | 24.452381 | 80 | 0.681597 | from typing import Union, List
from contextlib import contextmanager
import luigi
from luigi import worker
def _raise_run_exception(self, ex) -> None:
raise ex
@contextmanager
def debug_mode():
original_handle_run_exception = worker.TaskProcess._handle_run_exception
try:
worker.TaskProcess._han... | true | true |
1c3b7622f3555e2fb2980f2450b77b596627d868 | 1,347 | py | Python | tests/ecosystem/upgrade/test_upgrade.py | romayalon/ocs-ci | b40428cae0f0766ffb0c2441041744821562c8b5 | [
"MIT"
] | null | null | null | tests/ecosystem/upgrade/test_upgrade.py | romayalon/ocs-ci | b40428cae0f0766ffb0c2441041744821562c8b5 | [
"MIT"
] | null | null | null | tests/ecosystem/upgrade/test_upgrade.py | romayalon/ocs-ci | b40428cae0f0766ffb0c2441041744821562c8b5 | [
"MIT"
] | null | null | null | import logging
import pytest
from ocs_ci.framework.testlib import ocs_upgrade, polarion_id
from ocs_ci.ocs.disruptive_operations import worker_node_shutdown
from ocs_ci.ocs.ocs_upgrade import run_ocs_upgrade
from ocs_ci.utility.reporting import get_polarion_id
log = logging.getLogger(__name__)
@pytest.fixture()
de... | 24.490909 | 81 | 0.756496 | import logging
import pytest
from ocs_ci.framework.testlib import ocs_upgrade, polarion_id
from ocs_ci.ocs.disruptive_operations import worker_node_shutdown
from ocs_ci.ocs.ocs_upgrade import run_ocs_upgrade
from ocs_ci.utility.reporting import get_polarion_id
log = logging.getLogger(__name__)
@pytest.fixture()
de... | true | true |
1c3b77d76c0f8b07da1c3b122d9a67855f9f7434 | 708 | py | Python | seeding-db/convertImages.py | UAlbanyArchives/EspyProject | 1c2b7a29fb4f3791806d2a9e8534fc4ee3aee6c2 | [
"Unlicense"
] | 2 | 2017-04-05T17:45:18.000Z | 2017-04-17T17:40:41.000Z | seeding-db/convertImages.py | UAlbanyArchives/EspyProject | 1c2b7a29fb4f3791806d2a9e8534fc4ee3aee6c2 | [
"Unlicense"
] | null | null | null | seeding-db/convertImages.py | UAlbanyArchives/EspyProject | 1c2b7a29fb4f3791806d2a9e8534fc4ee3aee6c2 | [
"Unlicense"
] | null | null | null | import os
from subprocess import Popen, PIPE
inputPath = "C:\\Projects\\icpsr\\B01"
outputPath = "C:\\Projects\\icpsr\\testFiles"
for root, dirs, files in os.walk(inputPath):
for file in files:
if file.lower().endswith(".tif"):
if file == "B01_AL_000014a.tif" or file == "B01_AL_000052a.tif":
print (file)
... | 32.181818 | 74 | 0.638418 | import os
from subprocess import Popen, PIPE
inputPath = "C:\\Projects\\icpsr\\B01"
outputPath = "C:\\Projects\\icpsr\\testFiles"
for root, dirs, files in os.walk(inputPath):
for file in files:
if file.lower().endswith(".tif"):
if file == "B01_AL_000014a.tif" or file == "B01_AL_000052a.tif":
print (file)
... | true | true |
1c3b7956b60e6d5f552449df4af31b1e83c619a5 | 657 | py | Python | 30-days-of-code/day29/solution.py | eduellery/hackerrank | 250887d8e04841ba538f6c0cee5185155ec70e2d | [
"MIT"
] | null | null | null | 30-days-of-code/day29/solution.py | eduellery/hackerrank | 250887d8e04841ba538f6c0cee5185155ec70e2d | [
"MIT"
] | null | null | null | 30-days-of-code/day29/solution.py | eduellery/hackerrank | 250887d8e04841ba538f6c0cee5185155ec70e2d | [
"MIT"
] | null | null | null | #!/bin/python3
import os
def bitwiseAnd(n, k):
max_ab = 0
for i in range(k - 2, n):
for j in range(i + 1, n + 1):
ab = i & j
if ab == k - 1:
return ab
if max_ab < ab < k:
max_ab = ab
return max_ab
if __name__ == '__main__':
... | 21.9 | 55 | 0.506849 | import os
def bitwiseAnd(n, k):
max_ab = 0
for i in range(k - 2, n):
for j in range(i + 1, n + 1):
ab = i & j
if ab == k - 1:
return ab
if max_ab < ab < k:
max_ab = ab
return max_ab
if __name__ == '__main__':
fptr = open(os.... | true | true |
1c3b795ae3bf6fb749c30c39d971ba6597eb15a7 | 5,930 | py | Python | excel/utils.py | gbmumumu/someTools | 0336b886388d57e8b7d7762446ad5c578732f924 | [
"MIT"
] | null | null | null | excel/utils.py | gbmumumu/someTools | 0336b886388d57e8b7d7762446ad5c578732f924 | [
"MIT"
] | null | null | null | excel/utils.py | gbmumumu/someTools | 0336b886388d57e8b7d7762446ad5c578732f924 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "gbmumumu"
from pathlib import Path
from collections import OrderedDict
from tqdm import tqdm
import re
import shutil
import zipfile
from xml.dom.minidom import parse
class XlsxImages:
def __init__(self, filepath, image_idx=1, symbol_id... | 42.357143 | 93 | 0.580776 |
__author__ = "gbmumumu"
from pathlib import Path
from collections import OrderedDict
from tqdm import tqdm
import re
import shutil
import zipfile
from xml.dom.minidom import parse
class XlsxImages:
def __init__(self, filepath, image_idx=1, symbol_idx=2,
work_space=Path("./data")... | true | true |
1c3b79e941fe8b8ccfe9f77d3ce7e5217f14e8bf | 5,464 | py | Python | tools/c7n_mailer/c7n_mailer/azure/azure_queue_processor.py | ivan-shaporov/cloud-custodian | 619851ac8fb8e9609d42080fac50f9ef70529764 | [
"Apache-2.0"
] | null | null | null | tools/c7n_mailer/c7n_mailer/azure/azure_queue_processor.py | ivan-shaporov/cloud-custodian | 619851ac8fb8e9609d42080fac50f9ef70529764 | [
"Apache-2.0"
] | null | null | null | tools/c7n_mailer/c7n_mailer/azure/azure_queue_processor.py | ivan-shaporov/cloud-custodian | 619851ac8fb8e9609d42080fac50f9ef70529764 | [
"Apache-2.0"
] | null | null | null | # Copyright 2018 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | 42.6875 | 99 | 0.657577 | import base64
import json
import traceback
import zlib
import six
from c7n_mailer.azure.sendgrid_delivery import SendGridDelivery
from c7n_mailer.smtp_delivery import SmtpDelivery
try:
from c7n_azure.storage_utils import StorageUtilities
from c7n_azure.session import Session
except ImportError:
StorageUti... | true | true |
1c3b7a05f023cb371773f817497d23cb6e0825a0 | 21,308 | py | Python | tools/run_tests/python_utils/jobset.py | yongw5/grpc | 3c7b77a613182786d926445801f1f8f197a0c26a | [
"Apache-2.0"
] | null | null | null | tools/run_tests/python_utils/jobset.py | yongw5/grpc | 3c7b77a613182786d926445801f1f8f197a0c26a | [
"Apache-2.0"
] | null | null | null | tools/run_tests/python_utils/jobset.py | yongw5/grpc | 3c7b77a613182786d926445801f1f8f197a0c26a | [
"Apache-2.0"
] | null | null | null | # Copyright 2015 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | 35.632107 | 91 | 0.544678 |
import errno
import logging
import multiprocessing
import os
import platform
import re
import signal
import subprocess
import sys
import tempfile
import time
measure_cpu_costs = False
_DEFAULT_MAX_JOBS = 16 * multiprocessing.cpu_count()
# Only last N bytes of stdout will be kept if the actual output longer.
_MAX_RES... | true | true |
1c3b7a50f8773259f368c03788544406f1cbe60a | 2,647 | py | Python | src/main/transcribers/Transcriber.py | BlkPingu/VoiceControl | f6a32d4307812c19d82cc997433271cc5a282f2b | [
"Apache-2.0"
] | null | null | null | src/main/transcribers/Transcriber.py | BlkPingu/VoiceControl | f6a32d4307812c19d82cc997433271cc5a282f2b | [
"Apache-2.0"
] | null | null | null | src/main/transcribers/Transcriber.py | BlkPingu/VoiceControl | f6a32d4307812c19d82cc997433271cc5a282f2b | [
"Apache-2.0"
] | null | null | null | from interfaces.TranscriberInterface import TranscriberInterface
import deepspeech
import numpy as np
from config import conf
import wave
from utility.Paths import path_to_base
import time
class Transcriber(TranscriberInterface):
def __init__(self):
mfp = path_to_base(conf['model_file_path'])
... | 34.376623 | 152 | 0.603702 | from interfaces.TranscriberInterface import TranscriberInterface
import deepspeech
import numpy as np
from config import conf
import wave
from utility.Paths import path_to_base
import time
class Transcriber(TranscriberInterface):
def __init__(self):
mfp = path_to_base(conf['model_file_path'])
... | true | true |
1c3b7b1f696bb4192c0fc57bc20909fded27f2d2 | 261 | py | Python | ipytone/__init__.py | davidbrochart/ipytone | 82dc97b9075ecb6e3ef411571b4de5c9c90365dd | [
"BSD-3-Clause"
] | null | null | null | ipytone/__init__.py | davidbrochart/ipytone | 82dc97b9075ecb6e3ef411571b4de5c9c90365dd | [
"BSD-3-Clause"
] | null | null | null | ipytone/__init__.py | davidbrochart/ipytone | 82dc97b9075ecb6e3ef411571b4de5c9c90365dd | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# coding: utf-8
# Copyright (c) Benoit Bovy.
# Distributed under the terms of the Modified BSD License.
from .ipytone import Oscillator
from ._version import __version__, version_info
from .nbextension import _jupyter_nbextension_paths
| 23.727273 | 58 | 0.793103 |
from .ipytone import Oscillator
from ._version import __version__, version_info
from .nbextension import _jupyter_nbextension_paths
| true | true |
1c3b7c00bbe41313142f861234e1170e41e02c90 | 3,170 | py | Python | alphaman/strategy/__init__.py | Changsung/Backtrader | 47707e15d08981f4e62d113227ee7a3d20a4201a | [
"MIT"
] | 5 | 2017-02-27T10:33:04.000Z | 2021-02-26T23:25:39.000Z | alphaman/strategy/__init__.py | Changsung/Alphaman | 47707e15d08981f4e62d113227ee7a3d20a4201a | [
"MIT"
] | null | null | null | alphaman/strategy/__init__.py | Changsung/Alphaman | 47707e15d08981f4e62d113227ee7a3d20a4201a | [
"MIT"
] | null | null | null | # MIT License
#
# Copyright (c) 2017 Changsung
#
# 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, pu... | 36.022727 | 93 | 0.752366 |
class BaseStrategy:
__signals = {}
def __init__(self):
pass
def addSignals(self, key, signal):
self.__signals[key] = signal
signal.setStrategy(self)
def getSignal(self, key):
return self.__signals[key].getSignal()
def handleData(self):
raise NotImplementedError()
def setAlphaman(self, alphaman):
... | true | true |
1c3b7f3815d87ef71439de3a52abe3ead37b3761 | 5,475 | py | Python | wagtail/admin/rich_text/editors/hallo.py | samgans/wagtail | 48a8af71e5333fb701476702bd784fa407567e25 | [
"BSD-3-Clause"
] | 2 | 2019-05-23T01:31:18.000Z | 2020-06-27T21:19:10.000Z | wagtail/admin/rich_text/editors/hallo.py | samgans/wagtail | 48a8af71e5333fb701476702bd784fa407567e25 | [
"BSD-3-Clause"
] | 6 | 2020-08-26T03:00:03.000Z | 2020-09-24T02:59:14.000Z | wagtail/admin/rich_text/editors/hallo.py | samgans/wagtail | 48a8af71e5333fb701476702bd784fa407567e25 | [
"BSD-3-Clause"
] | 1 | 2020-05-28T12:25:15.000Z | 2020-05-28T12:25:15.000Z | import json
from collections import OrderedDict
from django.forms import Media, widgets
from django.utils.functional import cached_property
from wagtail.admin.edit_handlers import RichTextFieldPanel
from wagtail.admin.rich_text.converters.editor_html import EditorHTMLConverter
from wagtail.admin.staticfiles import ve... | 33.384146 | 89 | 0.658447 | import json
from collections import OrderedDict
from django.forms import Media, widgets
from django.utils.functional import cached_property
from wagtail.admin.edit_handlers import RichTextFieldPanel
from wagtail.admin.rich_text.converters.editor_html import EditorHTMLConverter
from wagtail.admin.staticfiles import ve... | true | true |
1c3b8019244656610632b52a3c5a9801cfcb4339 | 4,546 | py | Python | befh/ws_api_socket.py | philsong/BitcoinExchangeFH | 3c45d4be2ea2a258f132d982f62f69d649e0b083 | [
"Apache-2.0"
] | 32 | 2017-12-15T07:30:11.000Z | 2020-07-16T10:15:18.000Z | befh/ws_api_socket.py | bijiasuo/BitcoinExchangeFH | 9aa7b790cf74cf9fe48662147c30fc05e045e9ed | [
"Apache-2.0"
] | null | null | null | befh/ws_api_socket.py | bijiasuo/BitcoinExchangeFH | 9aa7b790cf74cf9fe48662147c30fc05e045e9ed | [
"Apache-2.0"
] | 20 | 2017-11-09T15:28:39.000Z | 2019-12-10T01:02:57.000Z | from befh.api_socket import ApiSocket
from befh.util import Logger
import websocket
import threading
import json
import time
import zlib
class WebSocketApiClient(ApiSocket):
"""
Generic REST API call
"""
def __init__(self, id, received_data_compressed=False):
"""
Constructor
:pa... | 37.570248 | 107 | 0.58205 | from befh.api_socket import ApiSocket
from befh.util import Logger
import websocket
import threading
import json
import time
import zlib
class WebSocketApiClient(ApiSocket):
def __init__(self, id, received_data_compressed=False):
ApiSocket.__init__(self)
self.ws = None self.id ... | true | true |
1c3b80e860cb6ee5de4408374e9f96e0b519ae33 | 1,299 | py | Python | aliyun-python-sdk-cloudesl/aliyunsdkcloudesl/request/v20180801/DeleteEslDeviceRequest.py | liumihust/aliyun-openapi-python-sdk | c7b5dd4befae4b9c59181654289f9272531207ef | [
"Apache-2.0"
] | null | null | null | aliyun-python-sdk-cloudesl/aliyunsdkcloudesl/request/v20180801/DeleteEslDeviceRequest.py | liumihust/aliyun-openapi-python-sdk | c7b5dd4befae4b9c59181654289f9272531207ef | [
"Apache-2.0"
] | null | null | null | aliyun-python-sdk-cloudesl/aliyunsdkcloudesl/request/v20180801/DeleteEslDeviceRequest.py | liumihust/aliyun-openapi-python-sdk | c7b5dd4befae4b9c59181654289f9272531207ef | [
"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... | 36.083333 | 73 | 0.765204 |
from aliyunsdkcore.request import RpcRequest
class DeleteEslDeviceRequest(RpcRequest):
def __init__(self):
RpcRequest.__init__(self, 'cloudesl', '2018-08-01', 'DeleteEslDevice')
def get_EslBarCode(self):
return self.get_query_params().get('EslBarCode')
def set_EslBarCode(self,EslBarCode):
self.add_qu... | true | true |
1c3b8343aeb2606f89ad5563292263a637bd9546 | 63 | py | Python | ex016teste.py | JoaoCrescioni/Exercicios-curso-em-video-python | 5db9c79af4e8894b0ed2cc4d0110cdb10b4a467e | [
"MIT"
] | null | null | null | ex016teste.py | JoaoCrescioni/Exercicios-curso-em-video-python | 5db9c79af4e8894b0ed2cc4d0110cdb10b4a467e | [
"MIT"
] | null | null | null | ex016teste.py | JoaoCrescioni/Exercicios-curso-em-video-python | 5db9c79af4e8894b0ed2cc4d0110cdb10b4a467e | [
"MIT"
] | null | null | null | import emoji
print(emoji.emojize(':mouse:', use_aliases=True))
| 21 | 49 | 0.761905 | import emoji
print(emoji.emojize(':mouse:', use_aliases=True))
| true | true |
1c3b838ce620b963a94003861d4f4eae6dadc3cf | 24,878 | py | Python | E03 - Learning programs and models/Architectures/models/backbones/hrnet.py | mialona/Stomatal-segmentation | 149d469ec572c41a13d62149d7d62d6805d19697 | [
"MIT"
] | null | null | null | E03 - Learning programs and models/Architectures/models/backbones/hrnet.py | mialona/Stomatal-segmentation | 149d469ec572c41a13d62149d7d62d6805d19697 | [
"MIT"
] | null | null | null | E03 - Learning programs and models/Architectures/models/backbones/hrnet.py | mialona/Stomatal-segmentation | 149d469ec572c41a13d62149d7d62d6805d19697 | [
"MIT"
] | null | null | null | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import logging
import numpy as np
from typing import List
from .build import BACKBONE_REGISTRY
BN_MOMENTUM = 0.01
logger = logging.getLogger(__name__)
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
... | 34.892006 | 98 | 0.518571 | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import logging
import numpy as np
from typing import List
from .build import BACKBONE_REGISTRY
BN_MOMENTUM = 0.01
logger = logging.getLogger(__name__)
def conv3x3(in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_plan... | true | true |
1c3b83b20278f57b8f3914a591d43e4033d0a48c | 2,721 | py | Python | timefhuman/main.py | panchbhai1969/timefhuman | 5eb82e31eb13bdc098b86920feb8aea146e4f6a0 | [
"Apache-2.0"
] | null | null | null | timefhuman/main.py | panchbhai1969/timefhuman | 5eb82e31eb13bdc098b86920feb8aea146e4f6a0 | [
"Apache-2.0"
] | null | null | null | timefhuman/main.py | panchbhai1969/timefhuman | 5eb82e31eb13bdc098b86920feb8aea146e4f6a0 | [
"Apache-2.0"
] | null | null | null | """
timefhuman
===
Convert human-readable date-like string to Python datetime object.
1. Tokenize string
2. Parse possible synctatic categories: "day", "time", "time range" etc.
3. Build parse tree.
4. Use grammar to resolve lexical ambiguities.
5. Impute with default values. Output extracted datetime and/or ranges.
... | 34.884615 | 84 | 0.673282 |
from .tokenize import tokenize
from .categorize import categorize
from .tree import build_tree
from .data import Token
from .data import TimeToken
from .data import DayToken
from .data import TimeRange
from .data import DayRange
import datetime
import string
__all__ = ('timefhuman',)
def timefhuman(string, now=Non... | true | true |
1c3b8410933ea9b483807e91eb31d4a6ffe40b97 | 3,201 | py | Python | ray/actors/persistent_account_2actors.py | scalingpythonml/scalingpythonml | 2700b7dc4e454ce802a4183aeed4a7b0ffea5b83 | [
"Apache-2.0"
] | 13 | 2020-02-09T16:03:10.000Z | 2022-03-19T14:08:16.000Z | ray/actors/persistent_account_2actors.py | scalingpythonml/scalingpythonml | 2700b7dc4e454ce802a4183aeed4a7b0ffea5b83 | [
"Apache-2.0"
] | 3 | 2020-10-31T16:20:05.000Z | 2020-11-04T01:17:02.000Z | ray/actors/persistent_account_2actors.py | scalingpythonml/scalingpythonml | 2700b7dc4e454ce802a4183aeed4a7b0ffea5b83 | [
"Apache-2.0"
] | 4 | 2020-12-21T22:23:16.000Z | 2022-03-29T20:25:28.000Z | import ray
from os.path import exists
# Start Ray
ray.init()
class BasePersitence:
def exists(self, key:str) -> bool:
pass
def save(self, key: str, data: dict):
pass
def restore(self, key:str) -> dict:
pass
@ray.remote
class FilePersistence(BasePersitence):
def __init__(self, ... | 32.663265 | 96 | 0.614183 | import ray
from os.path import exists
ray.init()
class BasePersitence:
def exists(self, key:str) -> bool:
pass
def save(self, key: str, data: dict):
pass
def restore(self, key:str) -> dict:
pass
@ray.remote
class FilePersistence(BasePersitence):
def __init__(self, basedir: str... | true | true |
1c3b843ec7f91fff2d89feaf4858010ee95ef60a | 3,233 | py | Python | folium/plugins/draw.py | beaswift/folium | b44e95be4ec2bdcf4898e48a749a64edfb8a2ea8 | [
"MIT"
] | 1 | 2018-03-21T13:17:19.000Z | 2018-03-21T13:17:19.000Z | folium/plugins/draw.py | beaswift/folium | b44e95be4ec2bdcf4898e48a749a64edfb8a2ea8 | [
"MIT"
] | null | null | null | folium/plugins/draw.py | beaswift/folium | b44e95be4ec2bdcf4898e48a749a64edfb8a2ea8 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
from branca.element import CssLink, Element, Figure, JavascriptLink, MacroElement
from jinja2 import Template
class Draw(MacroElement):
"""
Vector drawing and editing plugin for Leaflet.
Examples
--------
... | 34.393617 | 111 | 0.560779 |
from __future__ import (absolute_import, division, print_function)
from branca.element import CssLink, Element, Figure, JavascriptLink, MacroElement
from jinja2 import Template
class Draw(MacroElement):
def __init__(self, export=False):
super(Draw, self).__init__()
self._name = 'DrawControl'
... | true | true |
1c3b84eb2d5ed36c3f2fc4ead536712260644ef3 | 299 | py | Python | mmskeleton/deprecated/processor/pseudo.py | fserracant/mmskeleton | 44008bdef3dd6354a17c220fac8bcd8cd08ed201 | [
"Apache-2.0"
] | 1,347 | 2019-08-24T19:03:50.000Z | 2022-03-29T05:44:57.000Z | mmskeleton/deprecated/processor/pseudo.py | fserracant/mmskeleton | 44008bdef3dd6354a17c220fac8bcd8cd08ed201 | [
"Apache-2.0"
] | 246 | 2019-08-24T15:36:11.000Z | 2022-03-23T06:57:02.000Z | mmskeleton/deprecated/processor/pseudo.py | fserracant/mmskeleton | 44008bdef3dd6354a17c220fac8bcd8cd08ed201 | [
"Apache-2.0"
] | 335 | 2019-08-25T14:54:19.000Z | 2022-03-31T23:07:18.000Z | from mmskeleton.utils import call_obj
def train(model_cfg, dataset_cfg, optimizer):
model = call_obj(**model_cfg)
dataset = call_obj(**dataset_cfg)
print('train a pseudo model...')
print('done.')
def hello_world(times=10):
for i in range(times):
print('Hello World!') | 23 | 45 | 0.672241 | from mmskeleton.utils import call_obj
def train(model_cfg, dataset_cfg, optimizer):
model = call_obj(**model_cfg)
dataset = call_obj(**dataset_cfg)
print('train a pseudo model...')
print('done.')
def hello_world(times=10):
for i in range(times):
print('Hello World!') | true | true |
1c3b8633a843a25773f6810027fdabf38915b85d | 586 | py | Python | packages/python/plotly/plotly/validators/layout/xaxis/_tickformatstopdefaults.py | mastermind88/plotly.py | efa70710df1af22958e1be080e105130042f1839 | [
"MIT"
] | null | null | null | packages/python/plotly/plotly/validators/layout/xaxis/_tickformatstopdefaults.py | mastermind88/plotly.py | efa70710df1af22958e1be080e105130042f1839 | [
"MIT"
] | null | null | null | packages/python/plotly/plotly/validators/layout/xaxis/_tickformatstopdefaults.py | mastermind88/plotly.py | efa70710df1af22958e1be080e105130042f1839 | [
"MIT"
] | null | null | null | import _plotly_utils.basevalidators
class TickformatstopdefaultsValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self, plotly_name="tickformatstopdefaults", parent_name="layout.xaxis", **kwargs
):
super(TickformatstopdefaultsValidator, self).__init__(
plotly... | 30.842105 | 88 | 0.622867 | import _plotly_utils.basevalidators
class TickformatstopdefaultsValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self, plotly_name="tickformatstopdefaults", parent_name="layout.xaxis", **kwargs
):
super(TickformatstopdefaultsValidator, self).__init__(
plotly... | true | true |
1c3b86740c517e4f6755d8a7dbc0f587b2e92e38 | 13,302 | py | Python | st2common/tests/unit/services/test_rbac.py | ekhavana/st2 | 2b47b0e317a2dfd7d92d63ec6dcf706493148890 | [
"Apache-2.0"
] | null | null | null | st2common/tests/unit/services/test_rbac.py | ekhavana/st2 | 2b47b0e317a2dfd7d92d63ec6dcf706493148890 | [
"Apache-2.0"
] | null | null | null | st2common/tests/unit/services/test_rbac.py | ekhavana/st2 | 2b47b0e317a2dfd7d92d63ec6dcf706493148890 | [
"Apache-2.0"
] | null | null | null | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | 45.71134 | 96 | 0.663058 |
from pymongo import MongoClient
from st2tests.base import CleanDbTestCase
from st2common.services import rbac as rbac_services
from st2common.rbac.types import PermissionType
from st2common.rbac.types import ResourceType
from st2common.rbac.types import SystemRole
from st2common.persistence.auth import User
from st2c... | true | true |
1c3b882a637f80a50713d18dbe29569837195b4d | 6,860 | py | Python | src/town/town_manager.py | darealmop/botty | bdb8581b4f6b4ae0c20fc1030dfd00a97113e914 | [
"MIT"
] | null | null | null | src/town/town_manager.py | darealmop/botty | bdb8581b4f6b4ae0c20fc1030dfd00a97113e914 | [
"MIT"
] | null | null | null | src/town/town_manager.py | darealmop/botty | bdb8581b4f6b4ae0c20fc1030dfd00a97113e914 | [
"MIT"
] | null | null | null | from typing import Union
from item import ItemFinder
from template_finder import TemplateFinder
from config import Config
from pather import Location
from logger import Logger
from ui import UiManager
from town import IAct, A3, A4, A5
from utils.misc import wait
class TownManager:
def __init__(self, template_find... | 43.974359 | 117 | 0.675802 | from typing import Union
from item import ItemFinder
from template_finder import TemplateFinder
from config import Config
from pather import Location
from logger import Logger
from ui import UiManager
from town import IAct, A3, A4, A5
from utils.misc import wait
class TownManager:
def __init__(self, template_find... | true | true |
1c3b883d40ecbfa89fe733e7e5f4064d03109ce2 | 17,794 | py | Python | tensorflow/tools/api/tests/api_compatibility_test.py | irvifa/tensorflow | b5973195532a786343de6a4278322056574b207c | [
"Apache-2.0"
] | 1 | 2018-08-15T01:28:13.000Z | 2018-08-15T01:28:13.000Z | tensorflow/tools/api/tests/api_compatibility_test.py | irvifa/tensorflow | b5973195532a786343de6a4278322056574b207c | [
"Apache-2.0"
] | 1 | 2019-12-15T06:51:21.000Z | 2019-12-15T06:51:21.000Z | tensorflow/tools/api/tests/api_compatibility_test.py | irvifa/tensorflow | b5973195532a786343de6a4278322056574b207c | [
"Apache-2.0"
] | 1 | 2020-12-16T06:33:59.000Z | 2020-12-16T06:33:59.000Z | # Lint as: python2, python3
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... | 38.184549 | 80 | 0.70417 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import re
import sys
import six
import tensorflow as tf
from google.protobuf import message
from google.protobuf import text_format
from tensorflow.python.lib.io import file_io
fro... | true | true |
1c3b884e735121a071a27e02fa0a5822a54cc9b7 | 986 | py | Python | app/people/utils.py | kiprotichdominic/Moringa-Project-Pitch | 96d532205a82941eb8b9802715815e1aadf0408f | [
"MIT"
] | null | null | null | app/people/utils.py | kiprotichdominic/Moringa-Project-Pitch | 96d532205a82941eb8b9802715815e1aadf0408f | [
"MIT"
] | 3 | 2021-06-08T20:49:09.000Z | 2022-03-12T00:11:37.000Z | app/people/utils.py | kiprotichdominic/Moringa-Project-Pitch | 96d532205a82941eb8b9802715815e1aadf0408f | [
"MIT"
] | null | null | null | import os
import secrets
from PIL import Image
from flask import url_for, current_app
from flask_mail import Message
from app import mail
def save_picture(form_picture):
random_hex = secrets.token_hex(8)
_, f_ext = os.path.splitext(form_picture.filename)
picture_fn = random_hex + f_ext
picture_path = ... | 31.806452 | 91 | 0.710953 | import os
import secrets
from PIL import Image
from flask import url_for, current_app
from flask_mail import Message
from app import mail
def save_picture(form_picture):
random_hex = secrets.token_hex(8)
_, f_ext = os.path.splitext(form_picture.filename)
picture_fn = random_hex + f_ext
picture_path = ... | true | true |
1c3b88c9aac619ae987c9d5fcf65026bf68d19ee | 1,355 | py | Python | test/test_segment_word.py | bertsky/ocrd_tesserocr | c0e1440a53722d617e356901cec79e14b7999c94 | [
"MIT"
] | 37 | 2018-04-16T20:18:25.000Z | 2022-03-06T09:06:12.000Z | test/test_segment_word.py | bertsky/ocrd_tesserocr | c0e1440a53722d617e356901cec79e14b7999c94 | [
"MIT"
] | 162 | 2018-04-18T12:17:53.000Z | 2022-03-09T11:07:36.000Z | test/test_segment_word.py | bertsky/ocrd_tesserocr | c0e1440a53722d617e356901cec79e14b7999c94 | [
"MIT"
] | 12 | 2018-04-11T11:56:22.000Z | 2021-02-12T15:12:13.000Z | import os
import shutil
from test.base import TestCase, main, assets
from ocrd import Resolver
from ocrd_tesserocr import TesserocrSegmentRegion
from ocrd_tesserocr import TesserocrSegmentLine
from ocrd_tesserocr import TesserocrSegmentWord
#METS_HEROLD_SMALL = assets.url_of('SBB0000F29300010000/mets_one_file.xml')
... | 30.111111 | 89 | 0.684871 | import os
import shutil
from test.base import TestCase, main, assets
from ocrd import Resolver
from ocrd_tesserocr import TesserocrSegmentRegion
from ocrd_tesserocr import TesserocrSegmentLine
from ocrd_tesserocr import TesserocrSegmentWord
METS_HEROLD_SMALL = assets.url_of('kant_aufklaerung_1784-binarized/data/mets... | true | true |
1c3b89ac20e89e529baf47b178aa860d90f2e7ed | 3,901 | py | Python | cinder/api/v1/router.py | mail2nsrajesh/cinder | a688b872bec6d1abd4dcd852bdb8e8a921369d2e | [
"Apache-2.0"
] | null | null | null | cinder/api/v1/router.py | mail2nsrajesh/cinder | a688b872bec6d1abd4dcd852bdb8e8a921369d2e | [
"Apache-2.0"
] | 2 | 2018-10-25T13:04:01.000Z | 2019-08-17T13:15:24.000Z | cinder/api/v1/router.py | mail2nsrajesh/cinder | a688b872bec6d1abd4dcd852bdb8e8a921369d2e | [
"Apache-2.0"
] | 2 | 2018-10-17T13:32:50.000Z | 2018-11-08T08:39:39.000Z | # Copyright 2011 OpenStack Foundation
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... | 41.946237 | 78 | 0.616765 |
from cinder.api import extensions
import cinder.api.openstack
from cinder.api.v1 import snapshots
from cinder.api.v1 import volumes
from cinder.api.v2 import limits
from cinder.api.v2 import snapshot_metadata
from cinder.api.v2 import types
from cinder.api.v2 import volume_metadata
from cinder.api import versions
c... | true | true |
1c3b8a6a66224b1070bb699a4bf3678c4a18043d | 4,090 | py | Python | tests3/testutils.py | lidonglifighting/pyodbc-dbmaker | 38d97cdeb05f3b4caf28b4131a85a5c66f999cd4 | [
"MIT-0"
] | null | null | null | tests3/testutils.py | lidonglifighting/pyodbc-dbmaker | 38d97cdeb05f3b4caf28b4131a85a5c66f999cd4 | [
"MIT-0"
] | null | null | null | tests3/testutils.py | lidonglifighting/pyodbc-dbmaker | 38d97cdeb05f3b4caf28b4131a85a5c66f999cd4 | [
"MIT-0"
] | null | null | null | import os, sys, platform
from os.path import join, dirname, abspath, basename, isdir
import unittest
def add_to_path(library):
"""
Prepends the build directory to the path so that newly built pyodbc or pyiodbc libraries
are used, allowing it to be tested without installing it.
* library: The ... | 34.661017 | 117 | 0.610269 | import os, sys, platform
from os.path import join, dirname, abspath, basename, isdir
import unittest
def add_to_path(library):
import imp
library_exts = [ t[0] for t in imp.get_suffixes() if t[-1] == imp.C_EXTENSION ]
library_names = [ '%s%s' % (library, ext) for ext in library_exts... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.