hexsha stringlengths 40 40 | size int64 3 1.03M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 3 972 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 78 | 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 3 972 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 116k ⌀ | 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 3 972 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 78 | 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 3 1.03M | avg_line_length float64 1.13 941k | max_line_length int64 2 941k | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ebae5eb2311cc50c4233fa23e995ee509d6c6d69 | 1,197 | py | Python | timer.py | jomlearn2/clock | 6ce3a35841508adf5310598e69ff9f70d95e5a3f | [
"CC0-1.0"
] | null | null | null | timer.py | jomlearn2/clock | 6ce3a35841508adf5310598e69ff9f70d95e5a3f | [
"CC0-1.0"
] | null | null | null | timer.py | jomlearn2/clock | 6ce3a35841508adf5310598e69ff9f70d95e5a3f | [
"CC0-1.0"
] | null | null | null | # import only system from os
from os import system, name
import time
from datetime import datetime, timedelta
# defining setcount function /setting the countdown
def setcount():
global hrs
global mins
global secs
global totalsecs
print('Set the countdown timer:')
hrs = int(input('hours: '))
mins = int(input(... | 24.9375 | 78 | 0.645781 |
a89e5b0548fcd38f27b888bc42f9bde35077b713 | 3,765 | py | Python | train.py | DocketScience/WordVectorsForLaw | 057b0e87b9810aea3b7f071b5858ebbdb2cb30f8 | [
"Apache-2.0"
] | 8 | 2020-07-01T19:11:36.000Z | 2021-07-30T12:08:03.000Z | train.py | DocketScience/WordVectorsForLaw | 057b0e87b9810aea3b7f071b5858ebbdb2cb30f8 | [
"Apache-2.0"
] | 2 | 2021-07-22T12:12:08.000Z | 2021-12-16T02:53:59.000Z | train.py | DocketScience/WordVectorsForLaw | 057b0e87b9810aea3b7f071b5858ebbdb2cb30f8 | [
"Apache-2.0"
] | 7 | 2018-03-17T04:36:03.000Z | 2020-04-24T14:42:42.000Z | from __future__ import print_function
import re
import os
import wget
from glove import Glove
from glove import Corpus
from cleanup import extract_text
from regexes import REGEXES, REGEX_TOKENS
from nltk.tokenize import word_tokenize
'''
train.py
--------
This module trains a GloVe model on a given lega... | 35.186916 | 98 | 0.677556 |
ef41ef81c9b055b4e31b3f97f55b1884f6be3a29 | 85,752 | py | Python | python/ccxt/async_support/ftx.py | hrmhatef/ccxt | 3fb0675670f0d9456a25de979e940553a7c8df0e | [
"MIT"
] | null | null | null | python/ccxt/async_support/ftx.py | hrmhatef/ccxt | 3fb0675670f0d9456a25de979e940553a7c8df0e | [
"MIT"
] | null | null | null | python/ccxt/async_support/ftx.py | hrmhatef/ccxt | 3fb0675670f0d9456a25de979e940553a7c8df0e | [
"MIT"
] | 1 | 2021-09-16T08:33:31.000Z | 2021-09-16T08:33:31.000Z | # -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.base.exchange import Exchange
# -----------------------------------------------------------------------------
try... | 41.871094 | 175 | 0.451535 |
c0013c39298be5d72718125a3c6401a131ae58dc | 1,182 | py | Python | fake_switches/cisco/command_processor/config_vlan.py | freedge/fake-switches | 939bf12f2d0f673eb2caf19aa7e99aebbaf68ff3 | [
"Apache-2.0"
] | 42 | 2016-06-29T00:29:55.000Z | 2022-02-09T17:55:42.000Z | fake_switches/cisco/command_processor/config_vlan.py | freedge/fake-switches | 939bf12f2d0f673eb2caf19aa7e99aebbaf68ff3 | [
"Apache-2.0"
] | 89 | 2015-12-15T15:42:49.000Z | 2021-05-27T16:48:41.000Z | fake_switches/cisco/command_processor/config_vlan.py | freedge/fake-switches | 939bf12f2d0f673eb2caf19aa7e99aebbaf68ff3 | [
"Apache-2.0"
] | 40 | 2016-02-04T15:27:19.000Z | 2022-02-22T13:58:38.000Z | # Copyright 2015 Internap.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | 38.129032 | 121 | 0.750423 |
19d1e0c994afe074bf0e3de9ec5a689047a812be | 2,651 | py | Python | misc/versioning.py | cadl/libmc | 10ba59527292d2d415eb963d0080c6b34a1c5f1d | [
"BSD-3-Clause"
] | 502 | 2015-04-02T07:20:45.000Z | 2021-11-08T09:39:11.000Z | misc/versioning.py | cadl/libmc | 10ba59527292d2d415eb963d0080c6b34a1c5f1d | [
"BSD-3-Clause"
] | 80 | 2015-04-03T15:38:07.000Z | 2021-02-10T06:12:00.000Z | misc/versioning.py | cadl/libmc | 10ba59527292d2d415eb963d0080c6b34a1c5f1d | [
"BSD-3-Clause"
] | 89 | 2015-04-03T09:31:19.000Z | 2021-07-27T04:23:54.000Z | #!/usr/bin/env python2
# from: https://gist.githubusercontent.com/pkrusche/7369262/raw/5bf2dc8afb88d3fdde7be6d16ee4290db6735f37/versioning.py
""" Git Versioning Script
Will transform stdin to expand some keywords with git version/author/date information.
Specify --clean to remove this information before commit.
Set... | 28.202128 | 118 | 0.497548 |
b48b19593c08fad299bea25cb0e2da8f245eeddc | 4,268 | py | Python | pysnmp/ASCEND-MIBOSPFNBMA-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 11 | 2021-02-02T16:27:16.000Z | 2021-08-31T06:22:49.000Z | pysnmp/ASCEND-MIBOSPFNBMA-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 75 | 2021-02-24T17:30:31.000Z | 2021-12-08T00:01:18.000Z | pysnmp/ASCEND-MIBOSPFNBMA-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 10 | 2019-04-30T05:51:36.000Z | 2022-02-16T03:33:41.000Z | #
# PySNMP MIB module ASCEND-MIBOSPFNBMA-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASCEND-MIBOSPFNBMA-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:11:54 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | 125.529412 | 595 | 0.802249 |
66cc2d54eb748b38ab723c69855d31071b2ae4e1 | 496 | py | Python | var/spack/repos/builtin.mock/packages/requires-virtual/package.py | player1537-forks/spack | 822b7632222ec5a91dc7b7cda5fc0e08715bd47c | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 11 | 2015-10-04T02:17:46.000Z | 2018-02-07T18:23:00.000Z | var/spack/repos/builtin.mock/packages/requires-virtual/package.py | player1537-forks/spack | 822b7632222ec5a91dc7b7cda5fc0e08715bd47c | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 22 | 2017-08-01T22:45:10.000Z | 2022-03-10T07:46:31.000Z | var/spack/repos/builtin.mock/packages/requires-virtual/package.py | player1537-forks/spack | 822b7632222ec5a91dc7b7cda5fc0e08715bd47c | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 4 | 2016-06-10T17:57:39.000Z | 2018-09-11T04:59:38.000Z | # Copyright 2013-2022 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)
class RequiresVirtual(Package):
"""Package that requires a virtual dependency and is registered
as an external.
... | 29.176471 | 73 | 0.71371 |
817d59a3e8a46d84351ca428aff19074798a5676 | 475 | py | Python | setup.py | IvanYashchuk/jax-fenics | 80fbeb2b2e786b0e03760fca741f84223f1a34d1 | [
"MIT"
] | 35 | 2020-02-25T17:07:32.000Z | 2022-03-21T18:35:38.000Z | setup.py | IvanYashchuk/jax-fenics | 80fbeb2b2e786b0e03760fca741f84223f1a34d1 | [
"MIT"
] | 2 | 2020-11-23T03:02:22.000Z | 2021-04-06T07:50:37.000Z | setup.py | IvanYashchuk/jax-fenics | 80fbeb2b2e786b0e03760fca741f84223f1a34d1 | [
"MIT"
] | 6 | 2020-03-04T19:13:58.000Z | 2022-01-19T03:34:02.000Z | from distutils.core import setup
import sys
if sys.version_info[0] < 3:
raise Exception(
"The jaxfenics only supports Python3. Did you run $python setup.py <option>.? Try running $python3 setup.py <option>."
)
setup(
name="jaxfenics",
description="JAX-FEniCS interface",
url="https://githu... | 25 | 126 | 0.665263 |
f997f0b4276999cdf8e4444e91059c94aaecc75f | 533 | py | Python | everest/ptolemaic/datalike/secondary/__init__.py | rsbyrne/everest | 1ec06301cdeb7c2b7d85daf6075d996c5529247e | [
"MIT"
] | 2 | 2020-12-17T02:27:28.000Z | 2020-12-17T23:50:13.000Z | everest/ptolemaic/datalike/secondary/__init__.py | rsbyrne/everest | 1ec06301cdeb7c2b7d85daf6075d996c5529247e | [
"MIT"
] | 1 | 2020-12-07T10:14:45.000Z | 2020-12-07T10:14:45.000Z | everest/ptolemaic/datalike/secondary/__init__.py | rsbyrne/everest | 1ec06301cdeb7c2b7d85daf6075d996c5529247e | [
"MIT"
] | 1 | 2020-10-22T11:16:50.000Z | 2020-10-22T11:16:50.000Z | ###############################################################################
''''''
###############################################################################
from .. import _classtools, _everestutilities
from .. import _Ptolemaic, _ur
from .. import Datalike as _Datalike
from ._secondary import Secondary
... | 28.052632 | 79 | 0.296435 |
2a9d1c4e13afc964136bfc23af99c2379af2d88d | 4,900 | py | Python | tinyrpc/server/__init__.py | tadmccorkle/tinyrpc | f24c869e45919b31b784c26c6dbd56474e46f9fb | [
"MIT"
] | 117 | 2015-01-13T07:03:04.000Z | 2022-03-24T01:40:50.000Z | tinyrpc/server/__init__.py | tadmccorkle/tinyrpc | f24c869e45919b31b784c26c6dbd56474e46f9fb | [
"MIT"
] | 83 | 2015-02-21T12:41:16.000Z | 2022-01-31T10:15:22.000Z | tinyrpc/server/__init__.py | tadmccorkle/tinyrpc | f24c869e45919b31b784c26c6dbd56474e46f9fb | [
"MIT"
] | 57 | 2015-01-03T17:51:01.000Z | 2022-02-06T12:31:45.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Server definition.
Defines and implements a single-threaded, single-process, synchronous server.
"""
# FIXME: needs (more) unittests
# FIXME: needs checks for out-of-order, concurrency, etc as attributes
from typing import Any, Callable
import tinyrpc.exc
from tinyrpc... | 36.842105 | 111 | 0.657347 |
1922b80f7f3568d0d5847b54ef5dc196995219ed | 2,149 | py | Python | tests/test_future.py | tarcisioe/ampdup | 047055a9d748ed5b8c9d87e06f50881c2a3fa2c0 | [
"MIT"
] | null | null | null | tests/test_future.py | tarcisioe/ampdup | 047055a9d748ed5b8c9d87e06f50881c2a3fa2c0 | [
"MIT"
] | 2 | 2021-10-02T02:28:42.000Z | 2021-10-10T22:28:33.000Z | tests/test_future.py | tarcisioe/ampdup | 047055a9d748ed5b8c9d87e06f50881c2a3fa2c0 | [
"MIT"
] | null | null | null | """Tests for the ampdup.future module."""
import pytest
from ampdup.future import Future, FutureAlreadySetError
@pytest.mark.anyio
async def test_get_set_future() -> None:
"""Checks that a set future returns the set value."""
f: Future[int] = Future()
f.set(1)
assert await f.get() == 1
@pytest.mar... | 23.107527 | 87 | 0.647278 |
6601c76a94318899e0399e0998385184f661aa45 | 91 | py | Python | tests/roots/test-directive-code/conf.py | sephalon/sphinx | c892fe98f7a311dc51340f8d98e63d9790b7f820 | [
"BSD-2-Clause"
] | 1 | 2021-11-06T17:09:04.000Z | 2021-11-06T17:09:04.000Z | tests/roots/test-directive-code/conf.py | sephalon/sphinx | c892fe98f7a311dc51340f8d98e63d9790b7f820 | [
"BSD-2-Clause"
] | 1 | 2017-07-15T22:46:50.000Z | 2017-07-15T22:46:50.000Z | tests/roots/test-directive-code/conf.py | sephalon/sphinx | c892fe98f7a311dc51340f8d98e63d9790b7f820 | [
"BSD-2-Clause"
] | 1 | 2018-11-29T06:45:05.000Z | 2018-11-29T06:45:05.000Z | # -*- coding: utf-8 -*-
master_doc = 'index'
exclude_patterns = ['_build']
numfig = True
| 13 | 29 | 0.626374 |
8ce3c2efe1948a109dcc2c7ff0df11f6d514e2e7 | 230 | py | Python | depimpact/tests/__init__.py | NazBen/dep-impact | 284e72bccfb6309110df5191dfae3c0a93ce813b | [
"MIT"
] | null | null | null | depimpact/tests/__init__.py | NazBen/dep-impact | 284e72bccfb6309110df5191dfae3c0a93ce813b | [
"MIT"
] | null | null | null | depimpact/tests/__init__.py | NazBen/dep-impact | 284e72bccfb6309110df5191dfae3c0a93ce813b | [
"MIT"
] | null | null | null | """
"""
from .test_functions import func_overflow, margins_overflow, var_names_overflow, func_sum, multi_output_func_sum
__all__ = ["func_overflow", "margins_overflow", "var_names_overflow", "func_sum", "multi_output_func_sum"]
| 38.333333 | 112 | 0.795652 |
07cff21d431df085a8e6938c078f5f0a4582f319 | 10,203 | py | Python | apprise/plugins/NotifyParsePlatform.py | linkmauve/apprise | 76700bfa1ddcb2812d9ed14dfa7736125bcd346e | [
"MIT"
] | 4,764 | 2018-02-02T18:17:06.000Z | 2022-03-31T20:41:13.000Z | apprise/plugins/NotifyParsePlatform.py | linkmauve/apprise | 76700bfa1ddcb2812d9ed14dfa7736125bcd346e | [
"MIT"
] | 504 | 2017-11-26T15:56:14.000Z | 2022-03-31T22:38:49.000Z | apprise/plugins/NotifyParsePlatform.py | linkmauve/apprise | 76700bfa1ddcb2812d9ed14dfa7736125bcd346e | [
"MIT"
] | 217 | 2018-05-22T14:29:20.000Z | 2022-03-28T06:24:46.000Z | # -*- coding: utf-8 -*-
#
# Copyright (C) 2020 Chris Caron <lead2gold@gmail.com>
# All rights reserved.
#
# This code is licensed under the MIT License.
#
# 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 th... | 31.785047 | 79 | 0.56895 |
e24e6bb928164f1904be03431be250e60f2eb0bf | 433 | py | Python | core/admin.py | Edinburgh-College-of-Art/learning-energy-systems-v2 | 4ac57d867f2897da8cd8a7c6c6c697d04c447f01 | [
"MIT"
] | null | null | null | core/admin.py | Edinburgh-College-of-Art/learning-energy-systems-v2 | 4ac57d867f2897da8cd8a7c6c6c697d04c447f01 | [
"MIT"
] | 18 | 2018-05-10T14:34:53.000Z | 2021-06-10T20:27:09.000Z | core/admin.py | Edinburgh-College-of-Art/learning-energy-systems-v2 | 4ac57d867f2897da8cd8a7c6c6c697d04c447f01 | [
"MIT"
] | null | null | null | from django.contrib import admin
# Register your models here.
from .models import Yeargroup, Question, Student, Subject, Prediction, Occurrence
class PredictionAdmin(admin.ModelAdmin):
list_display = ['id', 'user', 'occurrence']
admin.site.register(Yeargroup)
admin.site.register(Question)
admin.site.register(Stude... | 30.928571 | 81 | 0.803695 |
e3c8720a6a77a6ca80ad4888a1c4d51537624c63 | 2,973 | py | Python | books/blackhat_python/ch03/sniffer_with_icmp.py | argodev/learn | d815beb9c1f8fa3dd8cd917640ebcca5822205c3 | [
"MIT"
] | null | null | null | books/blackhat_python/ch03/sniffer_with_icmp.py | argodev/learn | d815beb9c1f8fa3dd8cd917640ebcca5822205c3 | [
"MIT"
] | 15 | 2020-01-28T22:25:10.000Z | 2022-03-11T23:21:02.000Z | books/blackhat_python/ch03/sniffer_with_icmp.py | argodev/learn | d815beb9c1f8fa3dd8cd917640ebcca5822205c3 | [
"MIT"
] | null | null | null | import socket
import os
import struct
from ctypes import *
# host to listen on
host = '192.168.3.157'
# our IP header
class IP(Structure):
# NOTE: The book had the last two fields listed as c_long and that broke things
_fields_ = [
("ihl", c_ubyte, 4),
("version", c_ubyte, 4),
... | 26.544643 | 107 | 0.597713 |
5458f0afb2d59dfda624fdf3831f72a376d29fa3 | 1,060 | py | Python | tests/__init__.py | jdewells/jschon | 14c5415c77b2f1e531bedd8aeeb8051fde7efb3e | [
"MIT"
] | null | null | null | tests/__init__.py | jdewells/jschon | 14c5415c77b2f1e531bedd8aeeb8051fde7efb3e | [
"MIT"
] | null | null | null | tests/__init__.py | jdewells/jschon | 14c5415c77b2f1e531bedd8aeeb8051fde7efb3e | [
"MIT"
] | null | null | null | from jschon import URI
metaschema_uri_2019_09 = URI("https://json-schema.org/draft/2019-09/schema")
metaschema_uri_2020_12 = URI("https://json-schema.org/draft/2020-12/schema")
example_schema = {
"$id": "dynamicRef8_main.json",
"$defs": {
"inner": {
"$id": "dynamicRef8_inner.json",
... | 27.179487 | 76 | 0.516981 |
612e02cc62511d933bc184e99c5b9ca674ac22be | 764 | py | Python | sandcraft/music_mixer.py | jonathansessa/Sandcraft | 22b3d0357a3b13b7a539ee52551f1e5b0c09a56e | [
"MIT"
] | 3 | 2021-06-11T20:43:35.000Z | 2021-06-16T20:01:36.000Z | sandcraft/music_mixer.py | jonathansessa/Sandcraft | 22b3d0357a3b13b7a539ee52551f1e5b0c09a56e | [
"MIT"
] | null | null | null | sandcraft/music_mixer.py | jonathansessa/Sandcraft | 22b3d0357a3b13b7a539ee52551f1e5b0c09a56e | [
"MIT"
] | null | null | null | import os
from pygame import mixer
class MusicMixer:
def __init__(self):
mixer.init()
self.__foundParticle = mixer.Sound(os.path.join(os.path.dirname(__file__), 'soundFiles', 'newParticle.wav'))
self.__foundParticle.set_volume(.05)
self.__backgroundMusic = mixer.Sound(os.path.join(o... | 30.56 | 117 | 0.675393 |
5a86f5dba0f6a2ec05a11d97288d854cf854a1fb | 2,199 | py | Python | allure-pytest/test/steps/simple_steps_test.py | vdsbenoit/allure-python | 7b56b031c42369dd73844105382e9ceb9a88d6cd | [
"Apache-2.0"
] | 1 | 2021-02-19T21:00:11.000Z | 2021-02-19T21:00:11.000Z | allure-pytest/test/steps/simple_steps_test.py | vdsbenoit/allure-python | 7b56b031c42369dd73844105382e9ceb9a88d6cd | [
"Apache-2.0"
] | null | null | null | allure-pytest/test/steps/simple_steps_test.py | vdsbenoit/allure-python | 7b56b031c42369dd73844105382e9ceb9a88d6cd | [
"Apache-2.0"
] | 1 | 2020-08-05T05:40:44.000Z | 2020-08-05T05:40:44.000Z | """
>>> allure_report = getfixture('allure_report')
>>> assert_that(allure_report,
... all_of(
... has_property('test_cases', has_length(8)),
... has_property('test_groups', has_length(0))
... )) # doctest: +SKIP
SEQUENCE OF STEPS
>>> for test_case_name in ['... | 32.338235 | 112 | 0.582992 |
0ede3340d0e0320453124f959a9bd9a0b55a0b44 | 11,173 | py | Python | ccyclegan/ccyclegan_t4.py | gtesei/Keras-GAN | 8f57901fb637d8d179e780a191683da347af30b2 | [
"MIT"
] | 9 | 2019-08-15T10:36:09.000Z | 2022-03-13T09:27:47.000Z | ccyclegan/ccyclegan_t4.py | gtesei/Keras-GAN | 8f57901fb637d8d179e780a191683da347af30b2 | [
"MIT"
] | null | null | null | ccyclegan/ccyclegan_t4.py | gtesei/Keras-GAN | 8f57901fb637d8d179e780a191683da347af30b2 | [
"MIT"
] | 5 | 2019-11-21T12:04:33.000Z | 2021-12-08T16:40:32.000Z | from __future__ import print_function, division
import scipy
from keras.datasets import mnist
from keras_contrib.layers.normalization.instancenormalization import InstanceNormalization
from keras.layers import Input, Dense, Reshape, Flatten, Dropout, Concatenate
from keras.layers import BatchNormalization, Activation,... | 40.481884 | 184 | 0.545422 |
26462bdd5119fd37457abdc77e76c2d90a50cc9b | 925 | py | Python | test_on_image.py | psethwick/Fast-Neural-Style-Transfer | 414b0a2ab08e01f9238671589a7794efad68a44d | [
"MIT"
] | null | null | null | test_on_image.py | psethwick/Fast-Neural-Style-Transfer | 414b0a2ab08e01f9238671589a7794efad68a44d | [
"MIT"
] | null | null | null | test_on_image.py | psethwick/Fast-Neural-Style-Transfer | 414b0a2ab08e01f9238671589a7794efad68a44d | [
"MIT"
] | null | null | null | from models import TransformerNet
from utils import *
import torch
from torch.autograd import Variable
import os
import tqdm
from torchvision.utils import save_image
from PIL import Image
def style_image(image_path, model):
os.makedirs("images/outputs", exist_ok=True)
device = torch.device("cuda" if torch.cu... | 27.205882 | 73 | 0.728649 |
16fe8530cc9bef146858286ca2046c886f8848a1 | 7,324 | py | Python | sdk/python/pulumi_azure_native/avs/v20200717preview/global_reach_connection.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/avs/v20200717preview/global_reach_connection.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/avs/v20200717preview/global_reach_connection.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
__a... | 44.932515 | 417 | 0.669306 |
0aeec95318966b1faebddfa93dcae7b668693156 | 2,376 | py | Python | challenges/2020/python/utils.py | basoares/advent-of-code | 3b8216f0e73b12fd879aecea56783b8db7a4bc16 | [
"MIT"
] | null | null | null | challenges/2020/python/utils.py | basoares/advent-of-code | 3b8216f0e73b12fd879aecea56783b8db7a4bc16 | [
"MIT"
] | null | null | null | challenges/2020/python/utils.py | basoares/advent-of-code | 3b8216f0e73b12fd879aecea56783b8db7a4bc16 | [
"MIT"
] | null | null | null | '''
Imports and utility functions
'''
#region Imports
import os, sys
import re
from collections import defaultdict, Counter, deque, namedtuple
from itertools import chain, combinations, product, permutations, cycle
from copy import deepcopy
from math import gcd, sqrt, atan2, degrees
from networkx import Graph, D... | 25.548387 | 102 | 0.611953 |
e23e0ab7fe32d520eea505487c2c4d180f7f7927 | 1,750 | py | Python | src/probnum/statespace/generate_samples.py | NinaEffenberger/probnum | 595f55f9f235fd0396d02b9a6f828aba2383dceb | [
"MIT"
] | 4 | 2020-12-07T11:56:48.000Z | 2021-04-16T14:50:40.000Z | src/probnum/statespace/generate_samples.py | NinaEffenberger/probnum | 595f55f9f235fd0396d02b9a6f828aba2383dceb | [
"MIT"
] | 42 | 2021-04-12T08:11:41.000Z | 2022-03-28T00:21:55.000Z | src/probnum/statespace/generate_samples.py | NinaEffenberger/probnum | 595f55f9f235fd0396d02b9a6f828aba2383dceb | [
"MIT"
] | null | null | null | """Convenience function(s) for state space models."""
import numpy as np
import scipy.stats
def generate_samples(dynmod, measmod, initrv, times, random_state=None):
"""Samples true states and observations at pre-determined timesteps "times" for a
state space model.
Parameters
----------
dynmod :... | 35.714286 | 85 | 0.690286 |
76de81819675ee3517b3614931ecdfafb0eb6e81 | 13,462 | py | Python | datumaro/plugins/camvid_format.py | chuneuny-emily/datumaro | 25d459e0d130f250f071f9de52171d52a454d381 | [
"MIT"
] | null | null | null | datumaro/plugins/camvid_format.py | chuneuny-emily/datumaro | 25d459e0d130f250f071f9de52171d52a454d381 | [
"MIT"
] | null | null | null | datumaro/plugins/camvid_format.py | chuneuny-emily/datumaro | 25d459e0d130f250f071f9de52171d52a454d381 | [
"MIT"
] | 9 | 2021-05-17T07:00:03.000Z | 2021-06-26T02:15:10.000Z |
# Copyright (C) 2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
import logging as log
import os
import os.path as osp
from collections import OrderedDict
from enum import Enum
import numpy as np
from datumaro.components.converter import Converter
from datumaro.components.extractor import (AnnotationType, Co... | 37.394444 | 81 | 0.580894 |
da18571d5b9802bd69788b3072aea6066daacfa0 | 1,517 | py | Python | examples/integration/annotations/label_set.py | timgates42/bokeh | fb8b07b838f4d07d520cfe899779a11bc89f3c77 | [
"BSD-3-Clause"
] | 1 | 2015-01-31T14:42:39.000Z | 2015-01-31T14:42:39.000Z | examples/integration/annotations/label_set.py | timgates42/bokeh | fb8b07b838f4d07d520cfe899779a11bc89f3c77 | [
"BSD-3-Clause"
] | 1 | 2021-05-11T23:19:27.000Z | 2021-05-11T23:19:27.000Z | examples/integration/annotations/label_set.py | timgates42/bokeh | fb8b07b838f4d07d520cfe899779a11bc89f3c77 | [
"BSD-3-Clause"
] | 1 | 2020-03-06T07:38:50.000Z | 2020-03-06T07:38:50.000Z | from bokeh.io import save
from bokeh.models import ColumnDataSource, LabelSet, LinearAxis, Plot, Range1d
source = ColumnDataSource(data=dict(text=['one', 'two', 'three'],
x1=[1,4,7],
x2=[60,240,420]))
# Have to specify x/y range as labels aren't ... | 42.138889 | 79 | 0.57416 |
a0c3f0dac36f9e7016e9660fe24ac5f4c67ffe6c | 3,463 | py | Python | setup.py | itomaldonado/PyTravisCI | 0b6d4ce84d7b0c596e3174d96753a2c1d8e4b280 | [
"MIT"
] | 3 | 2020-03-18T09:15:40.000Z | 2021-12-05T11:09:23.000Z | setup.py | itomaldonado/PyTravisCI | 0b6d4ce84d7b0c596e3174d96753a2c1d8e4b280 | [
"MIT"
] | 4 | 2020-12-12T16:10:13.000Z | 2021-04-12T07:07:08.000Z | setup.py | itomaldonado/PyTravisCI | 0b6d4ce84d7b0c596e3174d96753a2c1d8e4b280 | [
"MIT"
] | 1 | 2021-03-11T15:33:46.000Z | 2021-03-11T15:33:46.000Z | """
Just another Python API for Travis CI (API).
Author
Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
Project link
https://github.com/funilrys/PyTravisCI
License
::
MIT License
Copyright (c) 2019 Nissar Chababy
Permission is hereby granted, free of charge, to any per... | 30.377193 | 86 | 0.65117 |
6ceb6c1a3107d099c85149be0cad8989f744d8da | 7,242 | py | Python | albumy/blueprints/admin.py | nandou1006/albumy | 1dc339c3dccc1d4fc6cb94dc1da2858ee829d695 | [
"MIT"
] | null | null | null | albumy/blueprints/admin.py | nandou1006/albumy | 1dc339c3dccc1d4fc6cb94dc1da2858ee829d695 | [
"MIT"
] | null | null | null | albumy/blueprints/admin.py | nandou1006/albumy | 1dc339c3dccc1d4fc6cb94dc1da2858ee829d695 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
:author: Grey Li
:url: http://greyli.com
:copyright: © 2018 Grey Li <withlihui@gmail.com>
:license: MIT, see LICENSE for more details.
"""
from flask import render_template, flash, Blueprint, request, current_app
from flask_login import login_required
from albumy.decorators... | 36.575758 | 120 | 0.703535 |
46545c82a3826a31b5e646f1de593769a00e7ba8 | 665 | py | Python | backend/eatandmeet/api/serializers.py | lysnikolaou/eatandmeet | fd9857f61d6e2e9861a3f4d477089af320181687 | [
"MIT"
] | 2 | 2019-07-05T09:00:19.000Z | 2019-08-13T12:09:42.000Z | backend/eatandmeet/api/serializers.py | lysnikolaou/eatandmeet | fd9857f61d6e2e9861a3f4d477089af320181687 | [
"MIT"
] | 55 | 2019-05-20T16:24:39.000Z | 2022-03-11T23:50:04.000Z | backend/eatandmeet/api/serializers.py | lysnikolaou/eatandmeet | fd9857f61d6e2e9861a3f4d477089af320181687 | [
"MIT"
] | null | null | null | from rest_framework import serializers, fields
from .models import Event, Comment, TOPIC_CHOICES
class EventSerializer(serializers.ModelSerializer):
topics = fields.MultipleChoiceField(choices = TOPIC_CHOICES)
class Meta:
model = Event
fields = ('id', 'event_creator', 'title', 'date', 'topic... | 31.666667 | 140 | 0.664662 |
d5b2732e7b57e793e967c300de1f28a27b6267a8 | 8,132 | py | Python | master/doctest.py | Keno/julia-buildbot | 9bbd4068797ae88d59d5dd2a7c41bdaed64110a9 | [
"MIT"
] | 1 | 2021-06-20T02:46:51.000Z | 2021-06-20T02:46:51.000Z | master/doctest.py | Keno/julia-buildbot | 9bbd4068797ae88d59d5dd2a7c41bdaed64110a9 | [
"MIT"
] | null | null | null | master/doctest.py | Keno/julia-buildbot | 9bbd4068797ae88d59d5dd2a7c41bdaed64110a9 | [
"MIT"
] | null | null | null | julia_doctest_factory = util.BuildFactory()
julia_doctest_factory.useProgress = True
julia_doctest_factory.addSteps([
# Fetch first (allowing failure if no existing clone is present)
steps.ShellCommand(
name="git fetch",
command=["git", "fetch", "--tags", "--all", "--force"],
flunkOnFail... | 40.457711 | 173 | 0.648549 |
0c800815b98128f5fcd530f4b6d7e5fdaaa9083b | 5,859 | py | Python | pytype/errors_test.py | JelleZijlstra/pytype | 962a0ebc05bd24dea172381b2bedcc547ba53dd5 | [
"Apache-2.0"
] | 11 | 2017-02-12T12:19:50.000Z | 2022-03-06T08:56:48.000Z | pytype/errors_test.py | JelleZijlstra/pytype | 962a0ebc05bd24dea172381b2bedcc547ba53dd5 | [
"Apache-2.0"
] | null | null | null | pytype/errors_test.py | JelleZijlstra/pytype | 962a0ebc05bd24dea172381b2bedcc547ba53dd5 | [
"Apache-2.0"
] | 2 | 2017-06-27T14:41:57.000Z | 2021-12-05T11:27:33.000Z | """Test errors.py."""
import collections
import csv
import textwrap
from pytype import errors
from pytype import utils
import unittest
_TEST_ERROR = "test-error"
_MESSAGE = "an error message"
FakeCode = collections.namedtuple("FakeCode", "co_filename co_name")
class FakeOpcode(object):
def __init__(self, file... | 35.72561 | 78 | 0.687489 |
02f2892e7e02122a6a6b515d746a195fd27bd4f9 | 302 | py | Python | betfund_event_broker/tasks/mongo/__init__.py | betfund/betfund-event-broker | 524aec73d9cf66cbeeb0fab67e6816b836c1d98e | [
"MIT"
] | 1 | 2020-09-23T02:36:35.000Z | 2020-09-23T02:36:35.000Z | betfund_event_broker/tasks/mongo/__init__.py | betfund/betfund-event-broker | 524aec73d9cf66cbeeb0fab67e6816b836c1d98e | [
"MIT"
] | 5 | 2020-04-13T23:55:07.000Z | 2020-06-04T15:09:12.000Z | betfund_event_broker/tasks/mongo/__init__.py | betfund/betfund-event-broker | 524aec73d9cf66cbeeb0fab67e6816b836c1d98e | [
"MIT"
] | null | null | null | """Betfund Event Broker MongoDB namesapce."""
from .base_task import MongoTask
from .find import MongoFindEvents
from .upsert_events import MongoEventsUpsert
from .upsert_odds import MongoOddsUpsert
__all__ = [
"MongoFindEvents",
"MongoEventsUpsert",
"MongoOddsUpsert",
"MongoTask"
]
| 21.571429 | 45 | 0.761589 |
21b7e280aa5854449ab8af0895d6f286ee0e92e4 | 1,044 | py | Python | Misc/Legacy/Avg_data_getter.py | BadenLab/2Panalysis | 8b23b3eaa1700f4fb5729eb7e89bfd55e7b4811a | [
"MIT"
] | null | null | null | Misc/Legacy/Avg_data_getter.py | BadenLab/2Panalysis | 8b23b3eaa1700f4fb5729eb7e89bfd55e7b4811a | [
"MIT"
] | null | null | null | Misc/Legacy/Avg_data_getter.py | BadenLab/2Panalysis | 8b23b3eaa1700f4fb5729eb7e89bfd55e7b4811a | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 2 12:27:40 2021
@author: skrem
"""
import pandas as pd
def Avg_data_getter(file):
"""A function which gets and prepares data, as well as returning some
additional params like an number of ROIs and their corresponding
labels.
Parameters
--------... | 29 | 98 | 0.662835 |
7b71ff6bb90097ccaf9e46989e8ea99594ac6ff2 | 6,110 | py | Python | indicators/moneyflowindex.py | webclinic017/pyStock-1 | 4ed6bf20130dcfc37d542bd5b3aec505a12f3106 | [
"MIT"
] | 45 | 2020-01-29T18:17:02.000Z | 2022-02-13T04:52:46.000Z | indicators/moneyflowindex.py | webclinic017/pyStock-1 | 4ed6bf20130dcfc37d542bd5b3aec505a12f3106 | [
"MIT"
] | 27 | 2020-04-29T12:11:14.000Z | 2021-03-13T08:54:33.000Z | indicators/moneyflowindex.py | webclinic017/pyStock-1 | 4ed6bf20130dcfc37d542bd5b3aec505a12f3106 | [
"MIT"
] | 8 | 2020-02-15T10:59:35.000Z | 2020-12-04T20:01:55.000Z | # Add import from parent directory possible
import pandas as pd
import matplotlib.pyplot as plt
from helpers.DataOperations import *
from core.ReportSignals import *
from helpers.Stock import *
from core.indicator import indicator
# Creates MoneyFlowIndex object
def CreateMoneyFlowIndex(high, low, close, volume, inf... | 43.333333 | 130 | 0.605728 |
748d2191e8d1179f4d258d1d6370fb45d68d9c09 | 11,477 | py | Python | data_prep_scripts/npz_shuffler.py | dlpbc/comma.ai-speed-challenge | fd4bd8097feb859234de9333700838fe71efb9dc | [
"MIT"
] | 26 | 2018-04-16T04:30:33.000Z | 2021-06-09T17:39:52.000Z | data_prep_scripts/npz_shuffler.py | dlpbc/comma.ai-speed-challenge | fd4bd8097feb859234de9333700838fe71efb9dc | [
"MIT"
] | 2 | 2019-02-11T09:43:54.000Z | 2020-07-14T23:37:17.000Z | data_prep_scripts/npz_shuffler.py | dlpbc/comma.ai-speed-challenge | fd4bd8097feb859234de9333700838fe71efb9dc | [
"MIT"
] | 10 | 2018-05-12T18:26:54.000Z | 2020-12-27T16:55:36.000Z | '''
The script takes 2 or 3 npz batch files (containing example clips) and shuffles them.
The reason for this is because a single batch file can contain a large number of
examples within a speed (label) range category. A batch might contain more of 11-15 speed
range example clips than any other speed range and this af... | 34.884498 | 103 | 0.632308 |
e8963f6237e3584245f2d15d48e5f6ea02585133 | 6,298 | py | Python | montage/app.py | baturin/montage | 9d1bb640d0d4f78359000d18de2206be84c12be0 | [
"BSD-3-Clause"
] | 33 | 2016-08-22T17:09:16.000Z | 2021-08-30T15:49:09.000Z | montage/app.py | baturin/montage | 9d1bb640d0d4f78359000d18de2206be84c12be0 | [
"BSD-3-Clause"
] | 197 | 2016-10-02T20:16:29.000Z | 2022-02-26T16:59:44.000Z | montage/app.py | baturin/montage | 9d1bb640d0d4f78359000d18de2206be84c12be0 | [
"BSD-3-Clause"
] | 11 | 2016-09-01T15:52:59.000Z | 2021-11-14T20:54:33.000Z | import sys
import os.path
import logging
from clastic import Application, StaticFileRoute, MetaApplication
from clastic.static import StaticApplication
from clastic.middleware import HTTPCacheMiddleware
from clastic.middleware.cookie import SignedCookieMiddleware, NEVER
from clastic.render import AshesRenderFactory, ... | 37.266272 | 114 | 0.651318 |
64d8158189af51f7b0990951973ca1a4db773201 | 1,963 | py | Python | docs/conf.py | dymaxionlabs/nb_workflows | 336e4d83dd5f8a7edfbaacfa426b23a42c0a68a9 | [
"Apache-2.0"
] | null | null | null | docs/conf.py | dymaxionlabs/nb_workflows | 336e4d83dd5f8a7edfbaacfa426b23a42c0a68a9 | [
"Apache-2.0"
] | null | null | null | docs/conf.py | dymaxionlabs/nb_workflows | 336e4d83dd5f8a7edfbaacfa426b23a42c0a68a9 | [
"Apache-2.0"
] | null | null | null | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | 35.690909 | 79 | 0.674478 |
c2a0cc2b77b21032af52f8bd7f7a9bc0f20032ca | 521 | py | Python | MiddleKit/Tests/MKRefresh.mkmodel/TestEmpty.py | PeaceWorksTechnologySolutions/w4py | 74f5a03a63f1a93563502b908474aefaae2abda2 | [
"MIT"
] | 18 | 2016-08-01T20:15:59.000Z | 2019-12-24T16:00:03.000Z | MiddleKit/Tests/MKRefresh.mkmodel/TestEmpty.py | WebwareForPython/w4py | bba08f5974d49f5da7e88abe3eeda1037d0824a3 | [
"MIT"
] | 6 | 2016-09-13T05:48:45.000Z | 2020-01-09T18:29:12.000Z | webware/MiddleKit/Tests/MKRefresh.mkmodel/TestEmpty.py | PeaceWorksTechnologySolutions/w4py3-middlekit | a9554e20c47010e7b0c0deee63e1786482c59a1c | [
"MIT"
] | 6 | 2016-09-16T14:32:29.000Z | 2020-01-03T18:52:16.000Z | def test(store):
from Book import Book
b = Book()
b.setTitle('foo')
store.addObject(b)
store.saveChanges()
serialNum = b.serialNum()
b = store.fetchObject(Book, serialNum)
b.setTitle('bar')
try:
b = store.fetchObject(Book, serialNum)
except AssertionError:
# an ... | 26.05 | 78 | 0.633397 |
b3eee4d0616eb8b748b0c9a4450df0f15cdd34c5 | 1,016 | py | Python | tests/test_cli.py | shakhat/python-license-check | 708545e189bc9bb1e45ad359cb9c1f3c4525ca17 | [
"Apache-2.0"
] | null | null | null | tests/test_cli.py | shakhat/python-license-check | 708545e189bc9bb1e45ad359cb9c1f3c4525ca17 | [
"Apache-2.0"
] | null | null | null | tests/test_cli.py | shakhat/python-license-check | 708545e189bc9bb1e45ad359cb9c1f3c4525ca17 | [
"Apache-2.0"
] | null | null | null | from liccheck.command_line import parse_args, read_strategy, run, Level
def test_parse_arguments():
args = parse_args(['--sfile', 'my_strategy.ini'])
assert args.strategy_ini_file == 'my_strategy.ini'
assert args.requirement_txt_file == './requirements.txt'
assert args.level is Level.STANDARD
... | 39.076923 | 111 | 0.699803 |
3c212cb082a29e3b83ca5b552c6298ad6f059324 | 2,090 | py | Python | malib/envs/maatari/env.py | apexrl/malib | 3785309e9b695ff359131fbbecabb6b5a52ef559 | [
"MIT"
] | 258 | 2021-05-10T11:17:45.000Z | 2022-03-30T13:41:09.000Z | malib/envs/maatari/env.py | apexrl/malib | 3785309e9b695ff359131fbbecabb6b5a52ef559 | [
"MIT"
] | 28 | 2021-05-13T06:50:04.000Z | 2022-03-30T14:19:15.000Z | malib/envs/maatari/env.py | apexrl/malib | 3785309e9b695ff359131fbbecabb6b5a52ef559 | [
"MIT"
] | 34 | 2021-05-31T16:17:49.000Z | 2022-03-26T06:59:59.000Z | import logging
import importlib
import supersuit
from malib.envs import Environment
from malib.utils.typing import Dict, Any, Sequence, AgentID
from malib.backend.datapool.offline_dataset_server import Episode
def nested_env_creator(ori_creator: type, wrappers: Sequence[Dict]) -> type:
"""Wrap original atari env... | 32.153846 | 87 | 0.629187 |
5ac75695783137e1c057a7e8cb6a9d8bc83df574 | 744 | py | Python | setup.py | nargyrop/pyna | a90e0f33846e10883ead8aaa710300f05f22f575 | [
"MIT"
] | null | null | null | setup.py | nargyrop/pyna | a90e0f33846e10883ead8aaa710300f05f22f575 | [
"MIT"
] | null | null | null | setup.py | nargyrop/pyna | a90e0f33846e10883ead8aaa710300f05f22f575 | [
"MIT"
] | null | null | null | from setuptools import setup, find_packages
from pathlib import Path
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()
setup(
name='resens',
version='0.2.2',
description='Raster Processing package for Remote Sensing and Earth Observation',
lon... | 29.76 | 87 | 0.665323 |
7a09a7f2ee83a5b5aa999984bd8f2d9e82626d1c | 3,106 | py | Python | climatetalk/hvac.py | kdschlosser/ClimateTalk | 3b09a45c295cf5228283d7095834e8f133ed7de3 | [
"MIT"
] | 3 | 2021-04-30T20:12:16.000Z | 2022-03-09T11:53:12.000Z | climatetalk/hvac.py | kdschlosser/ClimateTalk | 3b09a45c295cf5228283d7095834e8f133ed7de3 | [
"MIT"
] | null | null | null | climatetalk/hvac.py | kdschlosser/ClimateTalk | 3b09a45c295cf5228283d7095834e8f133ed7de3 | [
"MIT"
] | 2 | 2021-04-08T18:29:39.000Z | 2021-04-30T20:13:55.000Z |
import datetime
from .utils import (
set_bit as _set_bit,
get_bit as _get_bit
)
from .commands import (
# HVAC commands
HVAC_HEAT_SET_POINT_TEMPERATURE_MODIFY,
HVAC_COOL_SET_POINT_TEMPERATURE_MODIFY,
HVAC_HEAT_PROFILE_CHANGE,
HVAC_COOL_PROFILE_CHANGE,
HVAC_SYSTEM_SWITCH_MODIFY,
HVA... | 31.06 | 73 | 0.814874 |
469777cc3839fee97bea2e884359ab09aa5ff00c | 11,108 | py | Python | pytorch_named_dims/utils/__init__.py | stared/pytorch-named-dims | 86c83177cd0e22fcae3b356be71044e332c6fa16 | [
"MIT"
] | null | null | null | pytorch_named_dims/utils/__init__.py | stared/pytorch-named-dims | 86c83177cd0e22fcae3b356be71044e332c6fa16 | [
"MIT"
] | null | null | null | pytorch_named_dims/utils/__init__.py | stared/pytorch-named-dims | 86c83177cd0e22fcae3b356be71044e332c6fa16 | [
"MIT"
] | 1 | 2020-06-17T08:54:22.000Z | 2020-06-17T08:54:22.000Z | from typing import Type, Tuple, List, Optional, Iterable
import torch
from torch import nn
DimensionNames = List[Optional[str]]
# helper functions
def split_names(names_operation: DimensionNames) -> Tuple[DimensionNames, DimensionNames]:
"""Splits dimension names in ones before and after '*'.
Arguments:
... | 42.075758 | 158 | 0.615142 |
c87bf719e2af8af96610dac48e29f95df766f74f | 620 | py | Python | v3/scripts/testing/empireofcode/crystal-row.py | TheShellLand/python | a35e9b32bec3a3ff03d6f0f4c2c2cc891180e516 | [
"MIT"
] | null | null | null | v3/scripts/testing/empireofcode/crystal-row.py | TheShellLand/python | a35e9b32bec3a3ff03d6f0f4c2c2cc891180e516 | [
"MIT"
] | 1 | 2021-06-01T22:50:19.000Z | 2021-06-01T22:50:19.000Z | v3/scripts/testing/empireofcode/crystal-row.py | TheShellLand/python | a35e9b32bec3a3ff03d6f0f4c2c2cc891180e516 | [
"MIT"
] | null | null | null | def check_line(line):
print(line)
index = 0
while index + 1 < len(line):
_current = line[index]
if index + 1 < len(line):
_next = line[index + 1]
if _current == _next:
print(_current, _next, 'False')
return False
if _current != _next:
... | 22.962963 | 85 | 0.514516 |
54c6aa6417172638ad30a9d43693368d93a87431 | 3,565 | py | Python | my_configs/cattle/resnet_50/leg_front_black.py | EricChan-OC/mmpose | b7f36b29eb077b69791675cce39dfcc23c658647 | [
"Apache-2.0"
] | null | null | null | my_configs/cattle/resnet_50/leg_front_black.py | EricChan-OC/mmpose | b7f36b29eb077b69791675cce39dfcc23c658647 | [
"Apache-2.0"
] | null | null | null | my_configs/cattle/resnet_50/leg_front_black.py | EricChan-OC/mmpose | b7f36b29eb077b69791675cce39dfcc23c658647 | [
"Apache-2.0"
] | null | null | null | log_level = 'INFO'
load_from = None
resume_from = None
dist_params = dict(backend='nccl')
workflow = [('train', 1)]
checkpoint_config = dict(interval=100)
evaluation = dict(interval=5, metric='PCK', key_indicator='PCK')
COLOR = 'black'
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip... | 27.21374 | 79 | 0.624965 |
9c02aca6e9a92ec02002893e119c3d69d64d31af | 2,129 | py | Python | model.py | aliyun/The-Blessings-of-Unlabeled-Background-in-Untrimmed-Videos | aca214c56fc05778a1f9f382c2f634cbeca4d852 | [
"MIT"
] | 18 | 2021-05-25T13:05:25.000Z | 2022-03-21T01:37:44.000Z | model.py | aliyun/The-Blessings-of-Unlabeled-Background-in-Untrimmed-Videos | aca214c56fc05778a1f9f382c2f634cbeca4d852 | [
"MIT"
] | 2 | 2021-09-17T15:35:48.000Z | 2022-03-09T01:32:47.000Z | model.py | aliyun/The-Blessings-of-Unlabeled-Background-in-Untrimmed-Videos | aca214c56fc05778a1f9f382c2f634cbeca4d852 | [
"MIT"
] | 2 | 2021-11-20T05:12:19.000Z | 2021-12-15T03:07:19.000Z | import torch
import torch.nn as nn
from torch.nn import init
from torch.nn.utils import weight_norm
import torch.nn.functional as F
import numpy as np
import math
project_num = 5
class Deconfounder(nn.Module):
def __init__(self, len_feature, num_classes, num_segments):
super(Deconfounder, self).__init__(... | 38.017857 | 113 | 0.703617 |
dfc7331a637eba706d44a7f3cbb15bd60caa3135 | 152 | py | Python | alibi_detect/ad/__init__.py | Clusks/alibi-detect | b39406a6cf88f315f401562d4fea93a42aa6dcc1 | [
"ECL-2.0",
"Apache-2.0",
"CC0-1.0"
] | 1 | 2021-01-19T09:13:12.000Z | 2021-01-19T09:13:12.000Z | alibi_detect/ad/__init__.py | Clusks/alibi-detect | b39406a6cf88f315f401562d4fea93a42aa6dcc1 | [
"ECL-2.0",
"Apache-2.0",
"CC0-1.0"
] | null | null | null | alibi_detect/ad/__init__.py | Clusks/alibi-detect | b39406a6cf88f315f401562d4fea93a42aa6dcc1 | [
"ECL-2.0",
"Apache-2.0",
"CC0-1.0"
] | null | null | null | from .adversarialae import AdversarialAE
from .model_distillation import ModelDistillation
__all__ = ["AdversarialAE",
"ModelDistillation"]
| 25.333333 | 49 | 0.776316 |
8068de29f7cef763b8f30a674b0263a68ad8cc6b | 7,816 | py | Python | conda/cli/main_remove.py | javabrett/conda | 61fe720c94f698b9a1c42b8fbdf99ba01b07f4a5 | [
"BSD-3-Clause"
] | 6 | 2017-09-09T04:47:49.000Z | 2020-09-30T11:20:46.000Z | conda/cli/main_remove.py | javabrett/conda | 61fe720c94f698b9a1c42b8fbdf99ba01b07f4a5 | [
"BSD-3-Clause"
] | 2 | 2016-11-08T22:21:58.000Z | 2017-05-03T07:06:18.000Z | conda/cli/main_remove.py | javabrett/conda | 61fe720c94f698b9a1c42b8fbdf99ba01b07f4a5 | [
"BSD-3-Clause"
] | 3 | 2019-05-22T01:27:00.000Z | 2019-10-07T02:01:15.000Z | # -*- coding: utf-8 -*-
# Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import sys
from .common import check_non_admin, specs_from_args
from .install import handle_txn
from ..base.context impor... | 40.497409 | 108 | 0.591223 |
e536bc5fc5cf22b5e8132ffc6a54cb7f28ffed6d | 555 | py | Python | tokopedia/response.py | hexatester/tokopedia | 20e46c3ec2c70de6b24460634b7c185ffdb15691 | [
"MIT"
] | 5 | 2021-07-01T05:09:20.000Z | 2022-03-06T10:53:07.000Z | tokopedia/response.py | hexatester/tokopedia | 20e46c3ec2c70de6b24460634b7c185ffdb15691 | [
"MIT"
] | null | null | null | tokopedia/response.py | hexatester/tokopedia | 20e46c3ec2c70de6b24460634b7c185ffdb15691 | [
"MIT"
] | 1 | 2022-02-14T01:20:34.000Z | 2022-02-14T01:20:34.000Z | import attr
from typing import List, Optional, Union
@attr.dataclass(slots=True)
class BaseResponseHeader:
process_time: float
messages: str
class ResponseHeader(BaseResponseHeader):
pass
@attr.dataclass(slots=True)
class ErrorResponseHeader(BaseResponseHeader):
reason: str
error_code: str
@... | 18.5 | 60 | 0.767568 |
371fe52d0071a5ea8d99ffa23b9af02850bd5072 | 796 | py | Python | python/scrapy/OfficialSpider/tutorial/tutorial/spiders/quotes_xpath.py | RitamDey/My-Simple-Programs | 147b455a6a40c371ec894ce979e8a61d242e03bd | [
"Unlicense"
] | 2 | 2016-10-14T16:58:05.000Z | 2017-05-04T04:59:18.000Z | python/scrapy/OfficialSpider/tutorial/tutorial/spiders/quotes_xpath.py | GreenJoey/My-Simple-Programs | 147b455a6a40c371ec894ce979e8a61d242e03bd | [
"Unlicense"
] | null | null | null | python/scrapy/OfficialSpider/tutorial/tutorial/spiders/quotes_xpath.py | GreenJoey/My-Simple-Programs | 147b455a6a40c371ec894ce979e8a61d242e03bd | [
"Unlicense"
] | null | null | null | from scarpy import Spider
class QuotesXpathSpider(Spider):
name = 'quotes-xpath'
start_urls = [
'http://quotes.toscrape.com/'
]
def parse(self, response):
for quote in response.xpath('//div[@class="quote"]'):
yield {
'text': quote.xpath('./span[@class="tex... | 33.166667 | 99 | 0.536432 |
59bd3ed904a16077a6b3b49ba3a6ed8417a21589 | 4,109 | py | Python | pep263/core.py | B3QL/pep263 | ca1f3772f59bb5b5eef9bf8ba41c21f823778895 | [
"MIT"
] | 1 | 2018-06-15T13:08:10.000Z | 2018-06-15T13:08:10.000Z | pep263/core.py | B3QL/pep263 | ca1f3772f59bb5b5eef9bf8ba41c21f823778895 | [
"MIT"
] | null | null | null | pep263/core.py | B3QL/pep263 | ca1f3772f59bb5b5eef9bf8ba41c21f823778895 | [
"MIT"
] | null | null | null | """Core functionalities."""
import logging
import re
from collections import namedtuple
from .decorators import seek_file
from .errors import EncodingError
try:
from os import scandir
except ImportError:
from scandir import scandir
logger = logging.getLogger(__name__)
# Official regex from https://www.pyth... | 29.775362 | 86 | 0.666586 |
0ba96a49ee2a47b66e2d8e3cc64349fcbf227836 | 440 | py | Python | test_gspread.py | yeongseon/django_beautifulseodang | c79febd2addc67094e696aa731677a72048e4482 | [
"MIT"
] | 1 | 2021-11-22T05:09:00.000Z | 2021-11-22T05:09:00.000Z | test_gspread.py | yeongseon/django_beautifulseodang | c79febd2addc67094e696aa731677a72048e4482 | [
"MIT"
] | null | null | null | test_gspread.py | yeongseon/django_beautifulseodang | c79febd2addc67094e696aa731677a72048e4482 | [
"MIT"
] | null | null | null | import gspread
from oauth2client.service_account import ServiceAccountCredentials
# use creds to create a client to interact with the Google Drive API
scope = ['https://spreadsheets.google.com/feeds']
creds = ServiceAccountCredentials.from_json_keyfile_name('Beautifulseodang-c0a5cc61a537.json', scope)
client = gsprea... | 31.428571 | 101 | 0.815909 |
154d1c15999ee7b43c1a9eef7288fda11804ce4a | 475 | py | Python | app/__init__.py | brianraila/fastapi-peewee-api | f2a4b4e0a42dee981758547838d9e6b473c74ce2 | [
"MIT"
] | null | null | null | app/__init__.py | brianraila/fastapi-peewee-api | f2a4b4e0a42dee981758547838d9e6b473c74ce2 | [
"MIT"
] | null | null | null | app/__init__.py | brianraila/fastapi-peewee-api | f2a4b4e0a42dee981758547838d9e6b473c74ce2 | [
"MIT"
] | null | null | null | import os
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
def create_app():
app = FastAPI()
# app.config.from_mapping( SECRET_KEY=os.environ.get('SECRET_KEY') or 'you-will-never-guess',)
from app.routes import index
app.include_router(index.router)
app.... | 23.75 | 127 | 0.709474 |
1bb8bedc38e3e08ae2071a89a038afef9f81932e | 1,243 | py | Python | python/2015/aoc_15_b.py | nickspoons/adventofcode | 4aef222ccc9dcea09b4010d65d5f9cd32683323a | [
"MIT"
] | null | null | null | python/2015/aoc_15_b.py | nickspoons/adventofcode | 4aef222ccc9dcea09b4010d65d5f9cd32683323a | [
"MIT"
] | null | null | null | python/2015/aoc_15_b.py | nickspoons/adventofcode | 4aef222ccc9dcea09b4010d65d5f9cd32683323a | [
"MIT"
] | null | null | null | """ Advent of Code, 2015: Day 15, b """
import re
with open(__file__[:-5] + "_input") as f:
inputs = [line.strip() for line in f]
def score(ingredients, teaspoons):
""" Find the product of the 500 calory ingredient scores """
calories = 0
for j, spoons in enumerate(teaspoons):
calories += in... | 27.021739 | 77 | 0.548673 |
a4ddc1e4206950125cceea161d2f59636235fcd0 | 2,641 | py | Python | tools/telemetry/telemetry/page/page_set.py | kjthegod/chromium | cf940f7f418436b77e15b1ea23e6fa100ca1c91a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 1 | 2019-11-28T10:46:52.000Z | 2019-11-28T10:46:52.000Z | tools/telemetry/telemetry/page/page_set.py | kjthegod/chromium | cf940f7f418436b77e15b1ea23e6fa100ca1c91a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | tools/telemetry/telemetry/page/page_set.py | kjthegod/chromium | cf940f7f418436b77e15b1ea23e6fa100ca1c91a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 2 | 2015-03-27T11:15:39.000Z | 2016-08-17T14:19:56.000Z | # Copyright 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import csv
import inspect
import os
from telemetry.page import page as page_module
from telemetry.user_story import user_story_set
from telemetry.util impor... | 31.819277 | 80 | 0.723211 |
1ea5145d666b5b425487cb523a766bfa2fddc8c8 | 3,595 | py | Python | sdk/python/pulumi_aws/kms/alias.py | Charliekenney23/pulumi-aws | 55bd0390160d27350b297834026fee52114a2d41 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_aws/kms/alias.py | Charliekenney23/pulumi-aws | 55bd0390160d27350b297834026fee52114a2d41 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_aws/kms/alias.py | Charliekenney23/pulumi-aws | 55bd0390160d27350b297834026fee52114a2d41 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import pulumi
import pulumi.runtime
from .. import utilities, tables
class Alias(pulumi.CustomResource):
... | 42.294118 | 148 | 0.672045 |
2f035323fe1909b4337ef1fd89accb7aae86378b | 15,317 | py | Python | tests/test_schema.py | mnm678/securesystemslib | caf029ea61339dc5fa9beedf230ca1d026129169 | [
"MIT"
] | 1 | 2021-11-27T00:05:15.000Z | 2021-11-27T00:05:15.000Z | tests/test_schema.py | trailofbits/securesystemslib | 9b3a78e998412c39418efb29f411591b20cdd236 | [
"MIT"
] | null | null | null | tests/test_schema.py | trailofbits/securesystemslib | 9b3a78e998412c39418efb29f411591b20cdd236 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
"""
<Program Name>
test_schema.py
<Author>
Vladimir Diaz <vladimir.v.diaz@gmail.com>
<Started>
October 2012.
<Copyright>
See LICENSE for licensing information.
<Purpose>
Unit test for 'schema.py'
"""
# Help with Python 3 compatibility, where the print statement is a function, an
# ... | 34.266219 | 83 | 0.709081 |
212ee81ae6bb5d4d0cd548e6ab62cab8ca390b88 | 1,721 | py | Python | tests/unit/executors/test_dump_executor_with_drivers.py | liushuigs/jina | b3550e901b2a340924330b5ba2801603e493c933 | [
"Apache-2.0"
] | null | null | null | tests/unit/executors/test_dump_executor_with_drivers.py | liushuigs/jina | b3550e901b2a340924330b5ba2801603e493c933 | [
"Apache-2.0"
] | 2 | 2021-02-15T01:40:38.000Z | 2021-02-15T02:00:21.000Z | tests/unit/executors/test_dump_executor_with_drivers.py | liushuigs/jina | b3550e901b2a340924330b5ba2801603e493c933 | [
"Apache-2.0"
] | null | null | null | import os
import pickle
import pytest
from jina.drivers.control import RouteDriver
from jina.executors import BaseExecutor
cur_dir = os.path.dirname(os.path.abspath(__file__))
def test_dump_driver(tmpdir):
rd = RouteDriver(raise_no_dealer=True)
rd.idle_dealer_ids = ('hello', 'there')
with open(str(tmpd... | 30.732143 | 81 | 0.728646 |
c05cd0448f442bd3d531a82cc383a6bd232a8197 | 19,726 | py | Python | grow_bert/progressive/masked_lm.py | DionysisChristopoulos/google-research | 7f59ef421beef32ca16c2a7215be74f7eba01a0f | [
"Apache-2.0"
] | 7 | 2021-06-15T05:54:29.000Z | 2022-02-21T06:57:06.000Z | grow_bert/progressive/masked_lm.py | DionysisChristopoulos/google-research | 7f59ef421beef32ca16c2a7215be74f7eba01a0f | [
"Apache-2.0"
] | 12 | 2021-08-25T16:15:31.000Z | 2022-02-10T05:10:37.000Z | grow_bert/progressive/masked_lm.py | DionysisChristopoulos/google-research | 7f59ef421beef32ca16c2a7215be74f7eba01a0f | [
"Apache-2.0"
] | 5 | 2021-11-25T07:40:17.000Z | 2022-03-22T11:13:39.000Z | # coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | 43.738359 | 108 | 0.70587 |
4aab98f123c7d9a623de6eea151e4ef11008dead | 8,372 | py | Python | data/sheet_to_story.py | tcyrus/AIDungeon | 591f318091f46306d01a5307505534a32bd18024 | [
"MIT"
] | 2,409 | 2019-12-08T23:24:46.000Z | 2020-12-15T00:46:07.000Z | data/sheet_to_story.py | tcyrus/AIDungeon | 591f318091f46306d01a5307505534a32bd18024 | [
"MIT"
] | 181 | 2019-12-08T23:24:15.000Z | 2020-08-19T15:07:33.000Z | data/sheet_to_story.py | tcyrus/AIDungeon | 591f318091f46306d01a5307505534a32bd18024 | [
"MIT"
] | 401 | 2019-12-08T23:48:25.000Z | 2020-12-01T12:20:30.000Z | """
format of tree is
dict {
tree_id: tree_id_text
context: context text?
first_story_block
action_results: [act_res1, act_res2, act_res3...]
}
where each action_result's format is:
dict{
action: action_text
result: result_text
action_results: [act_res1, act_res2, act_res3...]
}
"""
import ... | 28 | 85 | 0.53667 |
65ed59272b44f39871d62d840341da4f9971438b | 158 | py | Python | remo/remozilla/apps.py | Mozilla-GitHub-Standards/6f6b18ac63685c6bf60fff95a3bbcc598378c77ceb14c7404172c570dd1e971d | 23ca8d46496b491fbdb2b8a72c91e75372932f23 | [
"BSD-3-Clause"
] | 27 | 2015-01-02T18:47:56.000Z | 2021-08-14T11:48:24.000Z | remo/remozilla/apps.py | Mozilla-GitHub-Standards/6f6b18ac63685c6bf60fff95a3bbcc598378c77ceb14c7404172c570dd1e971d | 23ca8d46496b491fbdb2b8a72c91e75372932f23 | [
"BSD-3-Clause"
] | 450 | 2015-01-02T12:29:50.000Z | 2020-10-27T21:41:38.000Z | remo/remozilla/apps.py | Mozilla-GitHub-Standards/6f6b18ac63685c6bf60fff95a3bbcc598378c77ceb14c7404172c570dd1e971d | 23ca8d46496b491fbdb2b8a72c91e75372932f23 | [
"BSD-3-Clause"
] | 81 | 2015-01-10T23:59:32.000Z | 2021-08-19T17:08:56.000Z | from django.apps import AppConfig
class RemozillaConfig(AppConfig):
name = 'remo.remozilla'
label = 'remozilla'
verbose_name = 'ReMo Remozilla'
| 19.75 | 35 | 0.721519 |
42d9fc096f17fe81a81a429247f9e262d0dfb1ef | 321 | py | Python | bitmovin_api_sdk/encoding/encodings/muxings/mp4/drm/speke/__init__.py | jaythecaesarean/bitmovin-api-sdk-python | 48166511fcb9082041c552ace55a9b66cc59b794 | [
"MIT"
] | 11 | 2019-07-03T10:41:16.000Z | 2022-02-25T21:48:06.000Z | bitmovin_api_sdk/encoding/encodings/muxings/mp4/drm/speke/__init__.py | jaythecaesarean/bitmovin-api-sdk-python | 48166511fcb9082041c552ace55a9b66cc59b794 | [
"MIT"
] | 8 | 2019-11-23T00:01:25.000Z | 2021-04-29T12:30:31.000Z | bitmovin_api_sdk/encoding/encodings/muxings/mp4/drm/speke/__init__.py | jaythecaesarean/bitmovin-api-sdk-python | 48166511fcb9082041c552ace55a9b66cc59b794 | [
"MIT"
] | 13 | 2020-01-02T14:58:18.000Z | 2022-03-26T12:10:30.000Z | from bitmovin_api_sdk.encoding.encodings.muxings.mp4.drm.speke.speke_api import SpekeApi
from bitmovin_api_sdk.encoding.encodings.muxings.mp4.drm.speke.customdata.customdata_api import CustomdataApi
from bitmovin_api_sdk.encoding.encodings.muxings.mp4.drm.speke.speke_drm_list_query_params import SpekeDrmListQueryParams... | 80.25 | 121 | 0.894081 |
92686727b1a64f7c61688c0783a53396b610aad9 | 24,436 | py | Python | tests/core/test_processor.py | YourThomasLee/rasa | 501b1b312c158e19e54c67cbca8ed3728ea60ca3 | [
"Apache-2.0"
] | 1 | 2020-07-07T06:58:51.000Z | 2020-07-07T06:58:51.000Z | tests/core/test_processor.py | YourThomasLee/rasa | 501b1b312c158e19e54c67cbca8ed3728ea60ca3 | [
"Apache-2.0"
] | 75 | 2020-08-06T08:55:42.000Z | 2022-03-01T13:22:11.000Z | tests/core/test_processor.py | YourThomasLee/rasa | 501b1b312c158e19e54c67cbca8ed3728ea60ca3 | [
"Apache-2.0"
] | null | null | null | import asyncio
import datetime
import pytest
import time
import uuid
import json
from _pytest.monkeypatch import MonkeyPatch
from aioresponses import aioresponses
from typing import Optional, Text, List, Callable
from unittest.mock import patch, Mock
from rasa.core import jobs
from rasa.core.actions.action import ACT... | 33.658402 | 87 | 0.721968 |
87c352d8bca75d9424f4840654b104bb4974696f | 33,906 | py | Python | zipline/history/history_container.py | wware/zipline | 760bbced73b1d04cf37bf7bd098dac168e4ff823 | [
"Apache-2.0"
] | null | null | null | zipline/history/history_container.py | wware/zipline | 760bbced73b1d04cf37bf7bd098dac168e4ff823 | [
"Apache-2.0"
] | null | null | null | zipline/history/history_container.py | wware/zipline | 760bbced73b1d04cf37bf7bd098dac168e4ff823 | [
"Apache-2.0"
] | null | null | null | #
# Copyright 2014 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | 34.811088 | 79 | 0.58379 |
af5fb47de419dd28e496529971a4216375769167 | 81,292 | py | Python | solutions/previous_solution_python/contest_leetcode_5461.py | YuhanShi53/Leetcode_solutions | cdcad34656d25d6af09b226e17250c6070305ab0 | [
"MIT"
] | null | null | null | solutions/previous_solution_python/contest_leetcode_5461.py | YuhanShi53/Leetcode_solutions | cdcad34656d25d6af09b226e17250c6070305ab0 | [
"MIT"
] | null | null | null | solutions/previous_solution_python/contest_leetcode_5461.py | YuhanShi53/Leetcode_solutions | cdcad34656d25d6af09b226e17250c6070305ab0 | [
"MIT"
] | null | null | null | class Solution:
def numSub(self, s: str) -> int:
s = s.split('0')
res = 0
for x in s:
y = len(x)
res += (y + 1) * y // 2
return res
if __name__ == '__main__':
s = "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111... | 6,253.230769 | 81,026 | 0.998056 |
688d95ae217e7b53ebae30d519a742382f10c1f7 | 575 | py | Python | mtaa/forms.py | ibukamshindi/Neighborhood-Watch | cc875b3f3ce562bd424921def24262578e881700 | [
"MIT"
] | null | null | null | mtaa/forms.py | ibukamshindi/Neighborhood-Watch | cc875b3f3ce562bd424921def24262578e881700 | [
"MIT"
] | null | null | null | mtaa/forms.py | ibukamshindi/Neighborhood-Watch | cc875b3f3ce562bd424921def24262578e881700 | [
"MIT"
] | null | null | null | from django import forms
from .models import *
class AddHoodForm(forms.ModelForm):
class Meta:
model = Hood
fields = ('hood_name', 'hood_photo', 'population')
class ProfileForm(forms.ModelForm):
class Meta:
model = Profile
fields = ('name', 'neighborhood','email_address')
class ... | 30.263158 | 58 | 0.645217 |
d88d1248aa205ae7dd93bf2aa1239f394a96a33b | 1,768 | py | Python | petastorm/tests/test_end_to_end_predicates_impl.py | rizalgowandy/petastorm | f7aad8cf5ef6878231b335911e3e95541b388d40 | [
"Apache-2.0"
] | 1,393 | 2018-08-17T19:01:12.000Z | 2022-03-31T22:33:45.000Z | petastorm/tests/test_end_to_end_predicates_impl.py | rizalgowandy/petastorm | f7aad8cf5ef6878231b335911e3e95541b388d40 | [
"Apache-2.0"
] | 554 | 2018-08-17T19:59:42.000Z | 2022-03-31T23:15:07.000Z | petastorm/tests/test_end_to_end_predicates_impl.py | rizalgowandy/petastorm | f7aad8cf5ef6878231b335911e3e95541b388d40 | [
"Apache-2.0"
] | 241 | 2018-08-17T20:03:10.000Z | 2022-03-22T11:18:47.000Z | # Copyright (c) 2017-2018 Uber Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 32.740741 | 113 | 0.719457 |
213d929a3c980e9fe834f7fa747acce8f309753a | 1,314 | py | Python | views/parameterizer/state.py | computablelabs/compas | fbde4e2ef61ebadc5ffd6453bff60f678e6002d6 | [
"MIT"
] | 1 | 2019-10-24T19:16:10.000Z | 2019-10-24T19:16:10.000Z | views/parameterizer/state.py | computablelabs/compas | fbde4e2ef61ebadc5ffd6453bff60f678e6002d6 | [
"MIT"
] | 7 | 2019-10-31T14:55:07.000Z | 2019-12-11T19:29:15.000Z | views/parameterizer/state.py | computablelabs/compas | fbde4e2ef61ebadc5ffd6453bff60f678e6002d6 | [
"MIT"
] | null | null | null | from asciimatics.widgets import Label, Divider, Text
from viewmodels.parameterizer.state import State
"""
Our subviews simply take a layout and inject their content into it
"""
def inject_parameterizer_state(layout, col=0):
layout.add_widget(Label('Parameterizer'), col)
layout.add_widget(Divider(line_char='-'),... | 46.928571 | 83 | 0.716895 |
4097af1bc3aebeeffa30dbeea0a2cffefa6f4c51 | 1,651 | py | Python | scripts/create_cert.py | g10f/sso | ba6eb712add388c69d4880f5620a2e4ce42d3fee | [
"BSD-3-Clause"
] | 3 | 2021-05-16T17:06:57.000Z | 2021-05-28T17:14:05.000Z | scripts/create_cert.py | g10f/sso | ba6eb712add388c69d4880f5620a2e4ce42d3fee | [
"BSD-3-Clause"
] | null | null | null | scripts/create_cert.py | g10f/sso | ba6eb712add388c69d4880f5620a2e4ce42d3fee | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
import os
import uuid
import subprocess
from OpenSSL import crypto
def create_self_signed_cert(cert_dir, cn, serial=int(uuid.uuid4().hex, 16)):
"""
create a new
self-signed cert and keypair and write them into that directory.
"""
# create a key pair
k = crypto.PKey()
... | 29.482143 | 100 | 0.656572 |
eec43671ab7edf56ade093b33091d6bf5dd51603 | 451 | py | Python | misc/config.py | monill/timer | b03e85b30b74fc785ddc3e0e02eb1519fa3e3399 | [
"MIT"
] | null | null | null | misc/config.py | monill/timer | b03e85b30b74fc785ddc3e0e02eb1519fa3e3399 | [
"MIT"
] | null | null | null | misc/config.py | monill/timer | b03e85b30b74fc785ddc3e0e02eb1519fa3e3399 | [
"MIT"
] | null | null | null | # Gui constants
TIMER_WIDTH = 200
TIMER_HEIGHT = 100
IDLE_TEXT = "--:--"
BOMB_TIME = 40
HURRY_UP_THRESHOLD = 15
WITHOUT_DEFUSER_THRESHOLD = 10
WITH_DEFUSER_THRESHOLD = 5
BG_COLOUR = "#191919"
FG_COLOUR = "#FFFFFF"
HURRY_UP_COLOUR = "#FFCC00"
WITHOUT_DEFUSER_COLOUR = "#FFCC00"
WITH_DEFUSER_COLOUR = "#FF4D4D"
FONT =... | 18.791667 | 51 | 0.742794 |
7f0d0a58ca9ec8594f9f9f23f6e63e6ead22c642 | 154 | py | Python | venv/bin/django-admin.py | OwinoLucas/Awwards-Clone | 502bb47f08df4f01fecdc45debba0a4e6d3e51b4 | [
"Unlicense"
] | null | null | null | venv/bin/django-admin.py | OwinoLucas/Awwards-Clone | 502bb47f08df4f01fecdc45debba0a4e6d3e51b4 | [
"Unlicense"
] | 7 | 2021-03-19T04:35:59.000Z | 2021-09-08T02:08:35.000Z | venv/bin/django-admin.py | OwinoLucas/Awwards-Clone | 502bb47f08df4f01fecdc45debba0a4e6d3e51b4 | [
"Unlicense"
] | null | null | null | #!/home/lucas/Documents/Awwards/venv/bin/python
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| 25.666667 | 47 | 0.785714 |
dd34b1d6a8176f5094fae04cec61a6fe4a0aa46e | 5,789 | py | Python | mayan/apps/metadata/serializers.py | CMU-313/fall-2021-hw2-451-unavailable-for-legal-reasons | 0e4e919fd2e1ded6711354a0330135283e87f8c7 | [
"Apache-2.0"
] | 2 | 2021-09-12T19:41:19.000Z | 2021-09-12T19:41:20.000Z | mayan/apps/metadata/serializers.py | CMU-313/fall-2021-hw2-451-unavailable-for-legal-reasons | 0e4e919fd2e1ded6711354a0330135283e87f8c7 | [
"Apache-2.0"
] | 37 | 2021-09-13T01:00:12.000Z | 2021-10-02T03:54:30.000Z | mayan/apps/metadata/serializers.py | CMU-313/fall-2021-hw2-451-unavailable-for-legal-reasons | 0e4e919fd2e1ded6711354a0330135283e87f8c7 | [
"Apache-2.0"
] | 1 | 2021-09-22T13:17:30.000Z | 2021-09-22T13:17:30.000Z | from django.core.exceptions import ValidationError as DjangoValidationError
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
from rest_framework.exceptions import ValidationError
from rest_framework.reverse import reverse
from mayan.apps.documents.serializers.docum... | 35.084848 | 82 | 0.634479 |
5ef864aad937bf098827ccb045d6ca12a6f532b5 | 1,258 | py | Python | ml/ml_logger.py | T-Sumida/sound-recognition | e043812bc6deb6d7f3fa7200472ce6aa58952095 | [
"MIT"
] | 1 | 2021-06-02T21:39:26.000Z | 2021-06-02T21:39:26.000Z | ml/ml_logger.py | T-Sumida/sound-recognition | e043812bc6deb6d7f3fa7200472ce6aa58952095 | [
"MIT"
] | null | null | null | ml/ml_logger.py | T-Sumida/sound-recognition | e043812bc6deb6d7f3fa7200472ce6aa58952095 | [
"MIT"
] | null | null | null | # coding: utf-8
import mlflow
from typing import Dict
class MlLogger(object):
def __init__(self, exp_name: str, tag: Dict):
"""mlflowの初期化
Args:
exp_name (str): 実験名
tag (Dict): タグ情報
"""
mlflow.set_experiment(exp_name)
mlflow.set_tags(tag)
def l... | 21.689655 | 68 | 0.54531 |
d8cb92d2440e78854bccded907d171737d327f7d | 882 | py | Python | lib/apiclient/ext/django_orm.py | motord/Motorcycle-Diaries | bb5e5e2d4d79573b4231e760d7662db26c03a55e | [
"BSD-3-Clause"
] | 1 | 2022-01-10T03:07:22.000Z | 2022-01-10T03:07:22.000Z | lib/apiclient/ext/django_orm.py | motord/Motorcycle-Diaries | bb5e5e2d4d79573b4231e760d7662db26c03a55e | [
"BSD-3-Clause"
] | null | null | null | lib/apiclient/ext/django_orm.py | motord/Motorcycle-Diaries | bb5e5e2d4d79573b4231e760d7662db26c03a55e | [
"BSD-3-Clause"
] | null | null | null | from django.db import models
class OAuthCredentialsField(models.Field):
__metaclass__ = models.SubfieldBase
def db_type(self):
return 'VARCHAR'
def to_python(self, value):
if value is None:
return None
if isinstance(value, apiclient.oauth.Credentials):
return value
return pickle.l... | 22.615385 | 58 | 0.723356 |
a2428c4314ebe89f10ec337c5717c6e27e0eb1d0 | 10,095 | py | Python | parseridge/parser/model.py | jgontrum/parseridge | f87ef82a9468addeb09a91c3b5310db38840bf0f | [
"Apache-2.0"
] | 6 | 2019-10-06T23:00:29.000Z | 2020-04-08T02:04:24.000Z | parseridge/parser/model.py | jgontrum/parseridge | f87ef82a9468addeb09a91c3b5310db38840bf0f | [
"Apache-2.0"
] | 2 | 2020-04-28T12:06:23.000Z | 2020-04-28T13:30:03.000Z | parseridge/parser/model.py | jgontrum/parseridge | f87ef82a9468addeb09a91c3b5310db38840bf0f | [
"Apache-2.0"
] | 1 | 2019-12-23T00:53:38.000Z | 2019-12-23T00:53:38.000Z | from typing import List, Tuple, Optional
import torch
import torch.nn as nn
from parseridge.corpus.relations import Relations
from parseridge.corpus.vocabulary import Vocabulary
from parseridge.parser.modules.add_and_norm_layer import AddAndNormLayer
from parseridge.parser.modules.configuration_encoder import (
C... | 36.978022 | 89 | 0.658049 |
70d6ee22e8701cd028966d810ff94190757918ad | 9,037 | py | Python | venv/share/pyshared/pyx/pswriter.py | pengwu/scapy_env | 3db9c5dea2e219048a2387649d6d89be342903d9 | [
"MIT"
] | null | null | null | venv/share/pyshared/pyx/pswriter.py | pengwu/scapy_env | 3db9c5dea2e219048a2387649d6d89be342903d9 | [
"MIT"
] | null | null | null | venv/share/pyshared/pyx/pswriter.py | pengwu/scapy_env | 3db9c5dea2e219048a2387649d6d89be342903d9 | [
"MIT"
] | null | null | null | # -*- encoding: utf-8 -*-
#
#
# Copyright (C) 2005-2011 Jörg Lehmann <joergl@users.sourceforge.net>
# Copyright (C) 2005-2011 André Wobst <wobsta@users.sourceforge.net>
#
# This file is part of PyX (http://pyx.sourceforge.net/).
#
# PyX is free software; you can redistribute it and/or modify
# it under the terms of the... | 34.361217 | 126 | 0.610822 |
ec16df41406cbf057fa319d2d46e854377d05c0c | 7,327 | py | Python | linkml/generators/pydanticgen.py | rosdyana/linkml | dc2a082d59b32fadde709650f0f6581275db5658 | [
"CC0-1.0"
] | null | null | null | linkml/generators/pydanticgen.py | rosdyana/linkml | dc2a082d59b32fadde709650f0f6581275db5658 | [
"CC0-1.0"
] | null | null | null | linkml/generators/pydanticgen.py | rosdyana/linkml | dc2a082d59b32fadde709650f0f6581275db5658 | [
"CC0-1.0"
] | null | null | null | import os
import logging
from typing import Optional, Tuple, List, Union, TextIO, Callable, Dict, Iterator, Set
from copy import deepcopy
import click
from jinja2 import Template
from linkml_runtime.utils.schemaview import SchemaView
#from linkml.generators import pydantic_GEN_VERSION
from linkml_runtime.linkml_mode... | 38.973404 | 171 | 0.587143 |
cf5ec17a1cdce1b2a9a7f37ac1145139cc00978e | 11,056 | py | Python | udocker/tools.py | vsoch/udocker | 783b339934b0208ce1501fbd2bccb8362271a321 | [
"Apache-2.0"
] | null | null | null | udocker/tools.py | vsoch/udocker | 783b339934b0208ce1501fbd2bccb8362271a321 | [
"Apache-2.0"
] | null | null | null | udocker/tools.py | vsoch/udocker | 783b339934b0208ce1501fbd2bccb8362271a321 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""Tools for udocker"""
import os
import sys
import tarfile
import random
import json
import stat
from udocker import is_genstr
from udocker.config import Config
from udocker.utils.curl import GetURL
from udocker.utils.fileutil import FileUtil
from udocker.msg import Msg
from udocker import __... | 38.929577 | 80 | 0.587464 |
82572407eb58b6783dac49705f0a1b5bec3dbe54 | 13,809 | py | Python | runtime/python/Lib/encodings/cp1254.py | hwaipy/InteractionFreeNode | 88642b68430f57b028fd0f276a5709f89279e30d | [
"MIT"
] | 5,926 | 2015-01-01T07:45:08.000Z | 2022-03-31T12:34:38.000Z | lib/assets/Lib/encodings/cp1254.py | it56660024/cafe-grader-web | e9a1305fd62e79e54f6961f97ddc5cd57bafd73c | [
"MIT"
] | 1,728 | 2015-01-01T01:09:12.000Z | 2022-03-30T23:25:22.000Z | lib/assets/Lib/encodings/cp1254.py | it56660024/cafe-grader-web | e9a1305fd62e79e54f6961f97ddc5cd57bafd73c | [
"MIT"
] | 574 | 2015-01-02T01:36:10.000Z | 2022-03-26T10:18:48.000Z | """ Python Character Mapping Codec cp1254 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1254.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def d... | 44.834416 | 120 | 0.522775 |
81ee3124ddb9e0cf528d70831e82bea248bbef7c | 1,168 | py | Python | podcast-backend/src/app/pcasts/models/series.py | cuappdev/archives | 061d0f9cccf278363ffaeb27fc655743b1052ae5 | [
"MIT"
] | null | null | null | podcast-backend/src/app/pcasts/models/series.py | cuappdev/archives | 061d0f9cccf278363ffaeb27fc655743b1052ae5 | [
"MIT"
] | null | null | null | podcast-backend/src/app/pcasts/models/series.py | cuappdev/archives | 061d0f9cccf278363ffaeb27fc655743b1052ae5 | [
"MIT"
] | null | null | null | from . import *
from app.pcasts.utils import topic_utils
class Series(Base):
__tablename__ = 'series'
__bind_key__ = 'podcast_db'
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.Text)
country = db.Column(db.String(190))
author = db.Column(db.String(190))
image_url_lg = db.Column(db.Tex... | 36.5 | 63 | 0.695205 |
e3d6f299d1c840616368742aa77c420dd8f2b99e | 2,622 | py | Python | ios_image_clean.py | FisherEat/python_ios_projects | 1d1bba34d31ff31b732b5ae573c0eca0a4a0fb7b | [
"MIT"
] | null | null | null | ios_image_clean.py | FisherEat/python_ios_projects | 1d1bba34d31ff31b732b5ae573c0eca0a4a0fb7b | [
"MIT"
] | null | null | null | ios_image_clean.py | FisherEat/python_ios_projects | 1d1bba34d31ff31b732b5ae573c0eca0a4a0fb7b | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
剔除iOS Xcode项目中没有用到的图片
'''
import csv
import codecs
import os
import re
import time
import openpyxl
def cur_file_dir():
# 文件的当前路径
path = os.path.split(os.path.realpath(__file__))[0]
return path
placeholdRe = re.compile(r'\%\d{1,2}\$s(\s|\?)?')
rootPath... | 31.97561 | 104 | 0.528986 |
c1fa97b3e4c562f18051278b9a800e1c2e4afb5a | 10,774 | py | Python | src/python/grpcio_tests/tests_aio/unit/metadata_test.py | emkornfield/grpc | 34566361503541b7f080406d4b282088759071cf | [
"Apache-2.0"
] | 1 | 2021-02-20T04:07:31.000Z | 2021-02-20T04:07:31.000Z | src/python/grpcio_tests/tests_aio/unit/metadata_test.py | emkornfield/grpc | 34566361503541b7f080406d4b282088759071cf | [
"Apache-2.0"
] | 1 | 2019-11-12T15:41:31.000Z | 2020-01-09T12:00:04.000Z | src/python/grpcio_tests/tests_aio/unit/metadata_test.py | emkornfield/grpc | 34566361503541b7f080406d4b282088759071cf | [
"Apache-2.0"
] | 2 | 2020-11-24T04:42:45.000Z | 2020-11-24T05:22:12.000Z | # Copyright 2020 The 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 writ... | 37.409722 | 112 | 0.676536 |
b61444f361d1862c332036e75321a1a0ef16ebbd | 584 | py | Python | run.py | playgrdstar/almost_simplest_server | fe99a79afac1bfdff493a73b724ae5e608290070 | [
"MIT"
] | 1 | 2019-01-28T00:20:57.000Z | 2019-01-28T00:20:57.000Z | run.py | playgrdstar/almost_simplest_server | fe99a79afac1bfdff493a73b724ae5e608290070 | [
"MIT"
] | null | null | null | run.py | playgrdstar/almost_simplest_server | fe99a79afac1bfdff493a73b724ae5e608290070 | [
"MIT"
] | null | null | null | from flask import Flask
from flask import render_template
app = Flask(__name__)
@app.route("/")
def main():
return render_template('base.html',
title='This is the title',
bodytext='This is the body text')
@app.route("/extended")
def extended():
return render_tem... | 29.2 | 83 | 0.60274 |
80e90ccbc0081b6ad70785d6ac8ccaaf59380ff2 | 817 | py | Python | game/pathutils.py | Kupoman/prototype-mercury | 895bd8f62bbff66f6cbce3dd6b98efc5468395c2 | [
"Apache-2.0"
] | 2 | 2018-04-03T02:49:48.000Z | 2019-03-11T00:27:57.000Z | game/pathutils.py | Moguri/prototype-mercury | 895bd8f62bbff66f6cbce3dd6b98efc5468395c2 | [
"Apache-2.0"
] | 58 | 2020-04-13T05:45:45.000Z | 2022-02-23T01:49:44.000Z | game/pathutils.py | Moguri/prototype-mercury | 895bd8f62bbff66f6cbce3dd6b98efc5468395c2 | [
"Apache-2.0"
] | null | null | null | import appdirs
import panda3d.core as p3d
_APPNAME = 'mercury'
_APPAUTHOR = False
_APPDIRS = appdirs.AppDirs(appname=_APPNAME, appauthor=_APPAUTHOR, roaming=True)
APP_ROOT_DIR = p3d.Filename.expand_from('$MAIN_DIR')
CONFIG_DIR = p3d.Filename(APP_ROOT_DIR, 'config')
USER_CONFIG_DIR = p3d.Filename.from_os_specific(_A... | 22.081081 | 84 | 0.71481 |
4a6e98f234b3d04f907e9fd6f4901b14a10ba684 | 4,766 | py | Python | cfgov/regulations3k/wagtail_hooks.py | adebisi-aden/consumerfinance.gov | 8c0f5afac341823c59f73b0c6bd60592e0f5eaca | [
"CC0-1.0"
] | 37 | 2020-08-18T19:52:39.000Z | 2022-03-23T08:08:41.000Z | cfgov/regulations3k/wagtail_hooks.py | adebisi-aden/consumerfinance.gov | 8c0f5afac341823c59f73b0c6bd60592e0f5eaca | [
"CC0-1.0"
] | 338 | 2020-08-14T20:46:36.000Z | 2022-03-31T20:49:32.000Z | cfgov/regulations3k/wagtail_hooks.py | adebisi-aden/consumerfinance.gov | 8c0f5afac341823c59f73b0c6bd60592e0f5eaca | [
"CC0-1.0"
] | 14 | 2020-10-21T15:27:03.000Z | 2022-03-17T03:16:36.000Z | from datetime import date
from django.utils.encoding import force_text
from wagtail.contrib.modeladmin.options import modeladmin_register
from treemodeladmin.helpers import TreeAdminURLHelper
from treemodeladmin.options import TreeModelAdmin
from treemodeladmin.views import TreeIndexView
from regulations3k.copyable... | 29.974843 | 79 | 0.63911 |
c1506ca6215e94c048d32881551be919e081901a | 2,528 | py | Python | app.py | carusooo/tapper-time | 26eaf36b1ad2732c1de687ba52776e383a756339 | [
"MIT"
] | null | null | null | app.py | carusooo/tapper-time | 26eaf36b1ad2732c1de687ba52776e383a756339 | [
"MIT"
] | null | null | null | app.py | carusooo/tapper-time | 26eaf36b1ad2732c1de687ba52776e383a756339 | [
"MIT"
] | null | null | null | import logging
import threading
import time
from lib.screens import core, task_list, task_timer, timer_done
from lib.service import todoist
logging.basicConfig(level=logging.DEBUG)
class Application(core.App):
""" The core application """
service: todoist.Todoist
current_screen: core.Screen = None
__... | 32 | 89 | 0.672468 |
d86d20bf7ce4365ecff4e232e65ef6077b70dbad | 3,899 | py | Python | code/data/util.py | Steve-Tod/DeformSyncNet | c4e6628ae4fd80e6e6aa702f4cd5885368047b4f | [
"MIT"
] | 19 | 2020-09-09T10:38:25.000Z | 2021-09-08T03:24:02.000Z | code/data/util.py | Steve-Tod/DeformSyncNet | c4e6628ae4fd80e6e6aa702f4cd5885368047b4f | [
"MIT"
] | null | null | null | code/data/util.py | Steve-Tod/DeformSyncNet | c4e6628ae4fd80e6e6aa702f4cd5885368047b4f | [
"MIT"
] | 4 | 2020-09-16T10:59:50.000Z | 2022-01-07T00:10:18.000Z | import torch
import random
import numpy as np
def read_cat2id_dict(path):
with open(path) as f:
lines = f.read().splitlines()
cat2id_dict = {}
for l in lines:
cat, identity = l.split('\t')
cat2id_dict[cat] = identity
return cat2id_dict
# Normalization
def center_bounding_box(p... | 32.764706 | 98 | 0.582457 |
5d9d6a3fc17125432a4567bf195ede8c0582038f | 879 | py | Python | tests/test_options_in_viewfunc.py | this-id/flask-openapi3 | b587e4e1534b0b04f7200f64264ec9d9f70f2103 | [
"MIT"
] | null | null | null | tests/test_options_in_viewfunc.py | this-id/flask-openapi3 | b587e4e1534b0b04f7200f64264ec9d9f70f2103 | [
"MIT"
] | 2 | 2022-03-31T10:02:42.000Z | 2022-03-31T13:44:32.000Z | tests/test_options_in_viewfunc.py | this-id/flask-openapi3 | b587e4e1534b0b04f7200f64264ec9d9f70f2103 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# @Author : llc
# @Time : 2022/5/15 14:19
import pytest
from flask_openapi3 import APIBlueprint, OpenAPI
app = OpenAPI(__name__)
app.config["TESTING"] = True
api = APIBlueprint(
'/book',
__name__,
url_prefix='/api',
)
@pytest.fixture
def client():
client = app.test_clie... | 16.903846 | 66 | 0.67008 |
845b7efe93a701d1f845fea3a18ec84c6dc93ac9 | 467 | py | Python | gallery/migrations/0003_auto_20200309_1402.py | D0nmoses/dagram | 4416c4eafda83adea4ebfc2946386dfdfc9ab520 | [
"MIT"
] | null | null | null | gallery/migrations/0003_auto_20200309_1402.py | D0nmoses/dagram | 4416c4eafda83adea4ebfc2946386dfdfc9ab520 | [
"MIT"
] | 6 | 2021-03-19T00:49:29.000Z | 2021-09-08T01:50:57.000Z | gallery/migrations/0003_auto_20200309_1402.py | D0nmoses/dagram | 4416c4eafda83adea4ebfc2946386dfdfc9ab520 | [
"MIT"
] | null | null | null | # Generated by Django 3.0.4 on 2020-03-09 11:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gallery', '0002_auto_20200309_1302'),
]
operations = [
migrations.AlterField(
model_name='profile',
name='profile_pi... | 24.578947 | 125 | 0.627409 |
a210e3ca67217c02d3dfdfa2dced73963e0c5237 | 4,711 | py | Python | src/rightsizer/main.py | gregoryjordanm/awsrightsizer | 6c9cb993437e9dd45356bf283d80eefbaf83e0d4 | [
"Apache-2.0"
] | 27 | 2018-07-10T18:21:52.000Z | 2018-09-29T14:50:40.000Z | src/rightsizer/main.py | gregoryjordanm/awsrightsizer | 6c9cb993437e9dd45356bf283d80eefbaf83e0d4 | [
"Apache-2.0"
] | 8 | 2018-07-11T01:49:25.000Z | 2018-07-25T14:14:15.000Z | src/rightsizer/main.py | gregoryjordanm/awsrightsizer | 6c9cb993437e9dd45356bf283d80eefbaf83e0d4 | [
"Apache-2.0"
] | 1 | 2018-07-07T15:55:26.000Z | 2018-07-07T15:55:26.000Z | # Standard Library Imports
import csv
import sys
from logging import DEBUG, WARNING
from datetime import datetime
# Third-party Imports
import click
# Local Imports
from .AwsRightSizer import Main
def print_help(ctx, param, value):
if value is False:
return
click.echo(ctx.get_help())
ctx.exit()
... | 25.464865 | 163 | 0.516239 |
225a2c587748c42a11ad080786aa506841e79f67 | 970 | py | Python | config.py | zhongxinghong/pkuyouth | 9262346b3c88109ca731387095d5678071a05d60 | [
"Apache-2.0"
] | 1 | 2018-06-19T04:00:35.000Z | 2018-06-19T04:00:35.000Z | config.py | zhongxinghong/PKUyouth | 9262346b3c88109ca731387095d5678071a05d60 | [
"Apache-2.0"
] | null | null | null | config.py | zhongxinghong/PKUyouth | 9262346b3c88109ca731387095d5678071a05d60 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# filename: config.py
import os
basedir = os.path.abspath(os.path.dirname(__file__))
from app.lib.utilfuncs import get_secret
class Config(object):
"""基础配置"""
DEBUG = True
APPLICATION_ROOT = basedir
TRAP_BAD_REQUEST_ERRORS = False
JSON_AS_ASCII = False
SECRET_K... | 19.795918 | 60 | 0.76701 |
0de3122d057ef28e8f842158f5e44445ed6e01bb | 376 | py | Python | utils.py | AsianZeus/Clinical-ICD10-Code-Prediction | cbfa9191641d8c832e724a1fe607f25ee28b29cd | [
"Apache-2.0"
] | null | null | null | utils.py | AsianZeus/Clinical-ICD10-Code-Prediction | cbfa9191641d8c832e724a1fe607f25ee28b29cd | [
"Apache-2.0"
] | null | null | null | utils.py | AsianZeus/Clinical-ICD10-Code-Prediction | cbfa9191641d8c832e724a1fe607f25ee28b29cd | [
"Apache-2.0"
] | null | null | null | from resources import config, tokenizer, model
from pydantic import BaseModel
class Description(BaseModel):
description: str
def get_code(text):
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
codes = [config.id2label[ids] for ids in output.logits.detach().cpu().nu... | 28.923077 | 82 | 0.699468 |
7b78b63ab10e9c6dd58df99a8e6622cf35f61091 | 3,828 | py | Python | jax/_src/source_info_util.py | jamestwebber/jax | 9450b8f8f96cb4d57b3f6337dcc18d3d104ecf6b | [
"ECL-2.0",
"Apache-2.0"
] | 2 | 2021-06-12T07:03:42.000Z | 2021-06-27T08:48:12.000Z | jax/_src/source_info_util.py | jamestwebber/jax | 9450b8f8f96cb4d57b3f6337dcc18d3d104ecf6b | [
"ECL-2.0",
"Apache-2.0"
] | 2 | 2022-01-31T13:20:35.000Z | 2022-02-14T13:20:49.000Z | jax/_src/source_info_util.py | jamestwebber/jax | 9450b8f8f96cb4d57b3f6337dcc18d3d104ecf6b | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 34.486486 | 108 | 0.742947 |
7bbf7d0b16035b7ccb9b6b02418d2d78ada49d45 | 4,681 | py | Python | network/resnet.py | ustato/sber-swap | 1140e085e165ed14e1098d81b7abd63feafedecf | [
"Apache-2.0"
] | 210 | 2022-01-24T12:58:08.000Z | 2022-03-31T07:54:22.000Z | network/resnet.py | ustato/sber-swap | 1140e085e165ed14e1098d81b7abd63feafedecf | [
"Apache-2.0"
] | 16 | 2022-01-24T23:45:04.000Z | 2022-03-30T22:53:46.000Z | network/resnet.py | ustato/sber-swap | 1140e085e165ed14e1098d81b7abd63feafedecf | [
"Apache-2.0"
] | 35 | 2022-01-25T00:55:36.000Z | 2022-03-30T22:45:27.000Z | import torch.nn as nn
import math
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False)
class BasicBlock(nn.Module):
expansion = 1
def __init__(self, inplanes... | 31.416107 | 94 | 0.582568 |
5f32f092c7cbe640bb3669e18634121cf47c8813 | 16,565 | py | Python | python/pyspark/mllib/evaluation.py | shagunsodhani/spark | 5b21139dbf3bd09cb3a590bd0ffb857ea92dc23c | [
"Apache-2.0"
] | null | null | null | python/pyspark/mllib/evaluation.py | shagunsodhani/spark | 5b21139dbf3bd09cb3a590bd0ffb857ea92dc23c | [
"Apache-2.0"
] | null | null | null | python/pyspark/mllib/evaluation.py | shagunsodhani/spark | 5b21139dbf3bd09cb3a590bd0ffb857ea92dc23c | [
"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 us... | 30.962617 | 99 | 0.59668 |
fecc9796c919a2e1c331528fd459e181670d5036 | 220 | py | Python | tor-pysock.py | hanguangchao/scrapy_awesome | 48a64fb3fdaeb00159b3b51e7c53f4d358e83743 | [
"MIT"
] | null | null | null | tor-pysock.py | hanguangchao/scrapy_awesome | 48a64fb3fdaeb00159b3b51e7c53f4d358e83743 | [
"MIT"
] | null | null | null | tor-pysock.py | hanguangchao/scrapy_awesome | 48a64fb3fdaeb00159b3b51e7c53f4d358e83743 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import socket
import socks
import requests
socks.set_default_proxy(socks.SOCKS5, "127.0.0.1", 9050)
socket.socket = socks.socksocket
print(requests.get('http://api.ipify.org?format=json').text)
| 22 | 60 | 0.736364 |
41a766ac529d4197cfa4b35fa9da56dc7af837eb | 655 | py | Python | tests/unit/systems/nfs/client_test.py | gamechanger/dusty | dd9778e3a4f0c623209e53e98aa9dc1fe76fc309 | [
"MIT"
] | 421 | 2015-06-02T16:29:59.000Z | 2021-06-03T18:44:42.000Z | tests/unit/systems/nfs/client_test.py | gamechanger/dusty | dd9778e3a4f0c623209e53e98aa9dc1fe76fc309 | [
"MIT"
] | 404 | 2015-06-02T20:23:42.000Z | 2019-08-21T16:59:41.000Z | tests/unit/systems/nfs/client_test.py | gamechanger/dusty | dd9778e3a4f0c623209e53e98aa9dc1fe76fc309 | [
"MIT"
] | 16 | 2015-06-16T17:21:02.000Z | 2020-03-27T02:27:09.000Z | from mock import Mock, patch
from dusty.systems.nfs import client
from ....testcases import DustyTestCase
class TestNFSClient(DustyTestCase):
@patch('dusty.systems.nfs.client.get_host_ip')
def test_mount_args_string(self, fake_get_host_ip):
fake_get_host_ip.return_value = '192.168.59.3'
fake_r... | 43.666667 | 126 | 0.734351 |
73fe5b99e61507a10dcc46583ac3453bc15943c5 | 11,108 | py | Python | test/test_rosdep_source.py | haraisao/rosdep | 3ee197d8b36e706ab6f8abe5db54f80231cad00a | [
"BSD-3-Clause"
] | null | null | null | test/test_rosdep_source.py | haraisao/rosdep | 3ee197d8b36e706ab6f8abe5db54f80231cad00a | [
"BSD-3-Clause"
] | 1 | 2018-11-14T11:46:12.000Z | 2018-11-15T00:14:04.000Z | test/test_rosdep_source.py | at-wat/rosdep | 6d41913e47ef3ca2f4960d93a61cde3445a3c5fb | [
"BSD-3-Clause"
] | null | null | null | # Copyright (c) 2011, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of cond... | 34.821317 | 171 | 0.708048 |
7137af9d387bd00113f7bd8f1c724e9a740311cc | 4,524 | py | Python | day-8/decoder.py | PeterPrice06/advent-of-code-2021 | d1af22ee2e4778372e626debca1ae9dc7f2ad47c | [
"MIT"
] | null | null | null | day-8/decoder.py | PeterPrice06/advent-of-code-2021 | d1af22ee2e4778372e626debca1ae9dc7f2ad47c | [
"MIT"
] | null | null | null | day-8/decoder.py | PeterPrice06/advent-of-code-2021 | d1af22ee2e4778372e626debca1ae9dc7f2ad47c | [
"MIT"
] | null | null | null | from typing import List, Tuple
class Decoder():
def __init__(self, line_strs: List[str]) -> None:
self.signal_patterns = []
self.output_values = []
for line in line_strs:
line_halves = line.split(' | ')
self.signal_patterns.append(line_halves[0])
self.ou... | 38.666667 | 100 | 0.573386 |
878c1d235e696b4e047ddfb184e2b3656af6ecf8 | 20,701 | py | Python | sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_activity_log_alerts_operations.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 1 | 2021-06-02T08:01:35.000Z | 2021-06-02T08:01:35.000Z | sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_activity_log_alerts_operations.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 226 | 2019-07-24T07:57:21.000Z | 2019-10-15T01:07:24.000Z | sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_04_01/operations/_activity_log_alerts_operations.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 1 | 2019-06-17T22:18:23.000Z | 2019-06-17T22:18:23.000Z | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 48.030162 | 179 | 0.678421 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.