hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 958k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c281018e6e3abe6fd8fe527a123ea7ad2324f9e | 8,053 | py | Python | desktop/libs/notebook/src/notebook/connectors/oozie_batch.py | yetsun/hue | 2e48f0cc70e233ee0e1b40733d4b2a18d8836c66 | [
"Apache-2.0"
] | 5,079 | 2015-01-01T03:39:46.000Z | 2022-03-31T07:38:22.000Z | desktop/libs/notebook/src/notebook/connectors/oozie_batch.py | yetsun/hue | 2e48f0cc70e233ee0e1b40733d4b2a18d8836c66 | [
"Apache-2.0"
] | 1,623 | 2015-01-01T08:06:24.000Z | 2022-03-30T19:48:52.000Z | desktop/libs/notebook/src/notebook/connectors/oozie_batch.py | yetsun/hue | 2e48f0cc70e233ee0e1b40733d4b2a18d8836c66 | [
"Apache-2.0"
] | 2,033 | 2015-01-04T07:18:02.000Z | 2022-03-28T19:55:47.000Z | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | 35.475771 | 139 | 0.675152 |
import logging
import re
import sys
import time
from django.urls import reverse
from django.http import QueryDict
from desktop.lib.exceptions_renderable import PopupException
from desktop.models import Document2
from notebook.connectors.base import Api, QueryError
if sys.version_info[0] > 2:
from... | true | true |
1c2810ea2d41d1ba06bfc7364b8104369eb37f52 | 1,046 | py | Python | darling_ansible/python_venv/lib/python3.7/site-packages/oci/_vendor/chardet/euctwprober.py | revnav/sandbox | f9c8422233d093b76821686b6c249417502cf61d | [
"Apache-2.0"
] | null | null | null | darling_ansible/python_venv/lib/python3.7/site-packages/oci/_vendor/chardet/euctwprober.py | revnav/sandbox | f9c8422233d093b76821686b6c249417502cf61d | [
"Apache-2.0"
] | null | null | null | darling_ansible/python_venv/lib/python3.7/site-packages/oci/_vendor/chardet/euctwprober.py | revnav/sandbox | f9c8422233d093b76821686b6c249417502cf61d | [
"Apache-2.0"
] | 1 | 2020-06-25T03:12:58.000Z | 2020-06-25T03:12:58.000Z | # coding: utf-8
# Modified Work: Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE... | 41.84 | 245 | 0.753346 |
from .mbcharsetprober import MultiByteCharSetProber
from .codingstatemachine import CodingStateMachine
from .chardistribution import EUCTWDistributionAnalysis
from .mbcssm import EUCTW_SM_MODEL
class EUCTWProber(MultiByteCharSetProber):
def __init__(self):
super(EUCTWProber, self).__init__()
s... | true | true |
1c281260d56bc6ff18a80b721eafd16d66b71871 | 1,524 | py | Python | 3. Largest Prime Factor.py | springmaple/projecteuler | 9bf8d4e5348c9bb0877e18a65bd1bf8ad698b85f | [
"Unlicense"
] | null | null | null | 3. Largest Prime Factor.py | springmaple/projecteuler | 9bf8d4e5348c9bb0877e18a65bd1bf8ad698b85f | [
"Unlicense"
] | null | null | null | 3. Largest Prime Factor.py | springmaple/projecteuler | 9bf8d4e5348c9bb0877e18a65bd1bf8ad698b85f | [
"Unlicense"
] | null | null | null | """
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
>>>6857
"""
def solution1(n):
"""
This function returns list of prime factors.
(This is my own solution... but it is complicated and slow)
"""
def find_next_prime_factor(startIndex)... | 19.792208 | 73 | 0.507218 |
def solution1(n):
def find_next_prime_factor(startIndex):
while True:
for y in range(2, startIndex):
if not startIndex % y:
break
else:
return startIndex
startIndex += 1
testNum = n
factorNum = 1
result =... | true | true |
1c2812655d8dae40363f86acf756f0cb4665a28e | 12,105 | py | Python | app/models.py | adrianmisko/bookstore-db-model | b9799d96a18ce27bd9e1d3a6906c38acf4f77f03 | [
"MIT"
] | 2 | 2020-11-12T09:56:45.000Z | 2022-03-20T10:33:50.000Z | app/models.py | adrianmisko/bookstore-db-model | b9799d96a18ce27bd9e1d3a6906c38acf4f77f03 | [
"MIT"
] | null | null | null | app/models.py | adrianmisko/bookstore-db-model | b9799d96a18ce27bd9e1d3a6906c38acf4f77f03 | [
"MIT"
] | 4 | 2019-03-23T14:27:47.000Z | 2021-01-09T08:20:58.000Z | from app import db, app
from werkzeug.security import generate_password_hash, check_password_hash
from itsdangerous import (TimedJSONWebSignatureSerializer as Serializer, BadSignature, SignatureExpired)
from app.search import add_to_index, remove_from_index, query_index
import datetime
class SearchableMixin(object):
... | 38.428571 | 111 | 0.678397 | from app import db, app
from werkzeug.security import generate_password_hash, check_password_hash
from itsdangerous import (TimedJSONWebSignatureSerializer as Serializer, BadSignature, SignatureExpired)
from app.search import add_to_index, remove_from_index, query_index
import datetime
class SearchableMixin(object):
... | true | true |
1c281364d5d37763c26daa7ff66db40a39805906 | 4,820 | py | Python | examples/molecule_embeddings/main.py | seqRep/dgl-lifesci | c4bd45be6dbb59dc270957ed90bb19d9ed6dc157 | [
"Apache-2.0"
] | 1 | 2020-06-22T19:19:24.000Z | 2020-06-22T19:19:24.000Z | examples/molecule_embeddings/main.py | seqRep/dgl-lifesci | c4bd45be6dbb59dc270957ed90bb19d9ed6dc157 | [
"Apache-2.0"
] | null | null | null | examples/molecule_embeddings/main.py | seqRep/dgl-lifesci | c4bd45be6dbb59dc270957ed90bb19d9ed6dc157 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import dgl
import errno
import numpy as np
import os
import torch
from dgl.nn.pytorch.glob import AvgPooling
from dgllife.model import load_pretrained
from dgllife.utils import mol_to_b... | 35.970149 | 90 | 0.59668 |
import dgl
import errno
import numpy as np
import os
import torch
from dgl.nn.pytorch.glob import AvgPooling
from dgllife.model import load_pretrained
from dgllife.utils import mol_to_bigraph, PretrainAtomFeaturizer, PretrainBondFeaturizer
from rdkit import Chem
from torch.utils.data import DataLoader
def mkdir_... | true | true |
1c2813e46ba968d55bde76a95a7d2586de634aed | 9,088 | py | Python | main.py | gabecooney/Exercise-01d-render-get_input-update | d6c61edd210a6c04099bc652f508ad6bba52a85c | [
"MIT"
] | null | null | null | main.py | gabecooney/Exercise-01d-render-get_input-update | d6c61edd210a6c04099bc652f508ad6bba52a85c | [
"MIT"
] | null | null | null | main.py | gabecooney/Exercise-01d-render-get_input-update | d6c61edd210a6c04099bc652f508ad6bba52a85c | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import sys
assert sys.version_info >= (3,9), "This script requires at least Python 3.9"
world = {
"uuid": "216ACD94-C70D-42CE-80F1-FA90A0D7F747",
"name": "Zork",
"creator": "Twine",
"creatorVersion": "2.3.14",
"schemaName": "Harlowe 3 to JSON",
"schemaVersion": "0.0.6",
"createdAtM... | 32.927536 | 308 | 0.526408 |
import sys
assert sys.version_info >= (3,9), "This script requires at least Python 3.9"
world = {
"uuid": "216ACD94-C70D-42CE-80F1-FA90A0D7F747",
"name": "Zork",
"creator": "Twine",
"creatorVersion": "2.3.14",
"schemaName": "Harlowe 3 to JSON",
"schemaVersion": "0.0.6",
"createdAtMs": 1631041405572,
"... | true | true |
1c28163c3139a24e96b67287311873c0588a8cc2 | 3,146 | py | Python | app/console/forms.py | zigellsn/JWConfStage | 684060562a971b2dc33fe44b7f223babd4094786 | [
"Apache-2.0"
] | null | null | null | app/console/forms.py | zigellsn/JWConfStage | 684060562a971b2dc33fe44b7f223babd4094786 | [
"Apache-2.0"
] | 1 | 2019-02-20T21:15:08.000Z | 2019-02-20T21:15:08.000Z | app/console/forms.py | zigellsn/JWConfStage | 684060562a971b2dc33fe44b7f223babd4094786 | [
"Apache-2.0"
] | null | null | null | # Copyright 2019-2022 Simon Zigelli
#
# 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... | 36.581395 | 118 | 0.652893 |
from ssl import SSLError
import aiohttp
from django import forms
from django.conf import settings
from django.forms import ModelChoiceField, ChoiceField, CharField, URLField
from django.utils.translation import gettext_lazy as _
from tenacity import RetryError
from StagyBee.utils import get_request
from... | true | true |
1c2816877031f66ae51a9f875a48f8e4312e766b | 2,703 | py | Python | pysnmp-with-texts/TPLINK-ARP-INSPECTION-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 8 | 2019-05-09T17:04:00.000Z | 2021-06-09T06:50:51.000Z | pysnmp-with-texts/TPLINK-ARP-INSPECTION-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 4 | 2019-05-31T16:42:59.000Z | 2020-01-31T21:57:17.000Z | pysnmp-with-texts/TPLINK-ARP-INSPECTION-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 TPLINK-ARP-INSPECTION-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPLINK-ARP-INSPECTION-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:24:13 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.... | 100.111111 | 477 | 0.798002 |
Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, ConstraintsIntersection, ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint = mibBuild... | true | true |
1c28169223b98603b426088c06f9f6201e1a041c | 1,005 | py | Python | advanced-algorithms-and-complexity/week4_coping_with_np_completeness/reschedule_exams/reschedule_exams.py | yiping-wang/data-structures-and-algorithms-coursera | fc0ba34399c27b358ce52a323a52ab2eb095f156 | [
"MIT"
] | 58 | 2017-12-24T05:08:58.000Z | 2022-01-09T01:00:30.000Z | advanced-algorithms-and-complexity/week4_coping_with_np_completeness/reschedule_exams/reschedule_exams.py | yiping-wang/data-structures-and-algorithms-coursera | fc0ba34399c27b358ce52a323a52ab2eb095f156 | [
"MIT"
] | null | null | null | advanced-algorithms-and-complexity/week4_coping_with_np_completeness/reschedule_exams/reschedule_exams.py | yiping-wang/data-structures-and-algorithms-coursera | fc0ba34399c27b358ce52a323a52ab2eb095f156 | [
"MIT"
] | 49 | 2017-12-07T02:52:46.000Z | 2022-02-08T02:49:09.000Z | # python3
# Arguments:
# * `n` - the number of vertices.
# * `edges` - list of edges, each edge is a tuple (u, v), 1 <= u, v <= n.
# * `colors` - list consisting of `n` characters, each belonging to the set {'R', 'G', 'B'}.
# Return value:
# * If there exists a proper recoloring, return value is a list contai... | 29.558824 | 122 | 0.575124 |
def assign_new_colors(n, edges, colors):
if n % 3 == 0:
new_colors = []
for i in range(n):
new_colors[i].append("RGB"[i % 3])
return new_colors
else:
return None
def main():
n, m = map(int, input().split())
colors = input().split()
edges... | true | true |
1c28169f5923d1ef1c5111bb4355408d2cbfd781 | 1,700 | py | Python | src/ct/dialog_view_mech.py | WayneYann/GPS | 70021c582bb8c68ea2359bd174eb17dc87670886 | [
"MIT"
] | 1 | 2017-11-24T08:28:06.000Z | 2017-11-24T08:28:06.000Z | src/ct/dialog_view_mech.py | WayneYann/GPS | 70021c582bb8c68ea2359bd174eb17dc87670886 | [
"MIT"
] | null | null | null | src/ct/dialog_view_mech.py | WayneYann/GPS | 70021c582bb8c68ea2359bd174eb17dc87670886 | [
"MIT"
] | 2 | 2017-11-24T08:28:08.000Z | 2021-04-20T04:39:59.000Z |
import sys
import os
import cantera as ct
import json
import time
import shutil
import copy
from PyQt4 import uic
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from def_tools_gui import *
from src.core.def_tools import keys_sorted
from src.ct.ck2cti_GPS import ck2cti
class dialog_view_mech(object):
d... | 24.637681 | 69 | 0.688824 |
import sys
import os
import cantera as ct
import json
import time
import shutil
import copy
from PyQt4 import uic
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from def_tools_gui import *
from src.core.def_tools import keys_sorted
from src.ct.ck2cti_GPS import ck2cti
class dialog_view_mech(object):
d... | false | true |
1c28174554c0ecef3d51c015e628ce2bebdd579a | 1,020 | py | Python | Temel_proje/main.py | ozdemirhalilibrahim/Python | 6226112b08d2fa7461556a5b949384e110537972 | [
"MIT"
] | null | null | null | Temel_proje/main.py | ozdemirhalilibrahim/Python | 6226112b08d2fa7461556a5b949384e110537972 | [
"MIT"
] | null | null | null | Temel_proje/main.py | ozdemirhalilibrahim/Python | 6226112b08d2fa7461556a5b949384e110537972 | [
"MIT"
] | null | null | null | """
1- Bir listeyi düzleştiren (flatten) fonksiyon yazın.
Elemanları birden çok katmanlı listelerden ([[3],2] gibi) oluşabileceği gibi, non-scalar verilerden de oluşabilir.
Örnek olarak:
input: [[1,'a',['cat'],2],[[[3]],'dog'],4,5]
output: [1,'a','cat',2,3,'dog',4,5]
"""
t=[[1,'a',['cat'],2],[[[3]],'... | 21.25 | 116 | 0.569608 |
t=[[1,'a',['cat'],2],[[[3]],'dog'],4,5]
new_list=[]
def flaten(t):
for i in t:
if type(i) == list:
flaten(i)
else:
new_list.append(i)
flaten(t)
print(new_list)
param_list=[[1, 2], [3, 4], [5, 6, 7]]
new_param_list=[]
def arr(x):
a=len(x)
for ... | true | true |
1c2818579d5ce3669636615a3a2f529678b6b95a | 1,386 | py | Python | django_beatle/views.py | zhebrak/django-beatle | 39274f2e184ff29c055ed7ea9c81c02e1dd1288b | [
"MIT"
] | null | null | null | django_beatle/views.py | zhebrak/django-beatle | 39274f2e184ff29c055ed7ea9c81c02e1dd1288b | [
"MIT"
] | 1 | 2017-03-16T13:28:03.000Z | 2017-03-17T12:15:48.000Z | django_beatle/views.py | zhebrak/django-beatle | 39274f2e184ff29c055ed7ea9c81c02e1dd1288b | [
"MIT"
] | null | null | null | from functools import wraps
import hmac
import importlib
from django.http import JsonResponse, HttpResponseBadRequest
from django.views.decorators.csrf import csrf_exempt
from .conf import settings
from .models import Task
def get_signature(params=None):
if params is None:
params = {}
msg = ''.join... | 25.666667 | 78 | 0.660895 | from functools import wraps
import hmac
import importlib
from django.http import JsonResponse, HttpResponseBadRequest
from django.views.decorators.csrf import csrf_exempt
from .conf import settings
from .models import Task
def get_signature(params=None):
if params is None:
params = {}
msg = ''.join... | true | true |
1c281979b11df6277f6f272fb2f30d8f021337c9 | 26,480 | py | Python | polypeptide/making_proteins.py | MobleyLab/chemper_SI | e9d7e1157119984f406c2743cd795ec7793e044e | [
"MIT"
] | null | null | null | polypeptide/making_proteins.py | MobleyLab/chemper_SI | e9d7e1157119984f406c2743cd795ec7793e044e | [
"MIT"
] | null | null | null | polypeptide/making_proteins.py | MobleyLab/chemper_SI | e9d7e1157119984f406c2743cd795ec7793e044e | [
"MIT"
] | null | null | null | """
making_proteins.py
It turns out that getting a protein that is parameterized by the
desired force field where you also have a complete molecular
description (bond order, etc) was harder than it sounded.
This script is a bit convoluted and given more time at the end
of Caitlin's PhD she would have cleaned it up, b... | 37.243319 | 128 | 0.602492 |
import os
import copy
import random
import parmed
from parmed.modeller import ResidueTemplate
from simtk.openmm import app
from simtk import unit
from oeommtools import utils as oeo_utils
from chemper.smirksify import SMIRKSifier
from chemper.graphs.cluster_graph import ClusterGraph
from openeye import oechem
class ... | true | true |
1c2819ec3d7bb136f71e38426e03405401da8332 | 3,972 | py | Python | v1/core/file_adapters.py | trisongz/fileio | 2812e13003b79e8d19b5aa1f4e16feb2cd48b115 | [
"MIT"
] | null | null | null | v1/core/file_adapters.py | trisongz/fileio | 2812e13003b79e8d19b5aa1f4e16feb2cd48b115 | [
"MIT"
] | null | null | null | v1/core/file_adapters.py | trisongz/fileio | 2812e13003b79e8d19b5aa1f4e16feb2cd48b115 | [
"MIT"
] | null | null | null | """
adapted from https://github.com/tensorflow/datasets/blob/master/tensorflow_datasets/core/file_adapters.py
"""
"""Adapters for file formats."""
import abc
import enum
import os
from typing import Any, ClassVar, Dict, Iterable, List, Optional, Type
from fileio.core.libs import TF_FUNC
from fileio.core import type_... | 30.790698 | 105 | 0.656596 |
import abc
import enum
import os
from typing import Any, ClassVar, Dict, Iterable, List, Optional, Type
from fileio.core.libs import TF_FUNC
from fileio.core import type_utils
ExamplePositions = List[Any]
class FileFormat(enum.Enum):
TFRECORD = 'tfrecord'
DEFAULT_FILE_FORMAT = FileFormat.TFRECORD
class Fi... | true | true |
1c281ba390edbc78a251cb66a1858577b974e1a8 | 889 | py | Python | python/misc/the_three_programmers_problem.py | christopher-burke/warmups | 140c96ada87ec5e9faa4622504ddee18840dce4a | [
"MIT"
] | null | null | null | python/misc/the_three_programmers_problem.py | christopher-burke/warmups | 140c96ada87ec5e9faa4622504ddee18840dce4a | [
"MIT"
] | 2 | 2022-03-10T03:49:14.000Z | 2022-03-14T00:49:54.000Z | python/misc/the_three_programmers_problem.py | christopher-burke/warmups | 140c96ada87ec5e9faa4622504ddee18840dce4a | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
"""The Three Programmers Problem.
You hired three programmers and you (hopefully) pay them. Create a
function that takes three numbers (the hourly wage of each programmer)
and returns the difference between the highest-paid programmer and
the lowest-paid.
Source:
https://edabit.com/challenge/9... | 28.677419 | 70 | 0.688414 |
def programmers(one, two, three):
pays = (one,two, three,)
return max(pays) - min(pays)
def main():
assert programmers(1, 5, 9) == 8
assert programmers(43, 33, 43) == 10
assert programmers(88, 14, 23) == 74
assert programmers(33, 72, 74) == 41
assert programmers(147, 33, 526) == 493
... | true | true |
1c281c0913225d8b2f7c11e29dd2dc3606c01421 | 312 | py | Python | section3/with_for_file.py | chandramanigit/python3 | c000ede4fdcba09af77a3e6f0b6160f68b576c7a | [
"bzip2-1.0.6"
] | null | null | null | section3/with_for_file.py | chandramanigit/python3 | c000ede4fdcba09af77a3e6f0b6160f68b576c7a | [
"bzip2-1.0.6"
] | null | null | null | section3/with_for_file.py | chandramanigit/python3 | c000ede4fdcba09af77a3e6f0b6160f68b576c7a | [
"bzip2-1.0.6"
] | null | null | null | #this script shows how can we use with to work with file
with open("example.txt" , "w") as myfile:
myfile.write("writing to my file")
# by using with method we dont need to close the file as required in below
"""
myfile = open("example1.txt" , "w")
myfile.write("ting using old method")
myfile.close()
"""
| 26 | 74 | 0.695513 |
with open("example.txt" , "w") as myfile:
myfile.write("writing to my file")
| true | true |
1c281c4a4d0189e1ec374e295798b4222d07155d | 7,211 | py | Python | Lib/site-packages/dns/rdtypes/ANY/NSEC3.py | cristian-12/ProyectoDjango | bf1d1c6ca7f8a50bcbfbfe556d3d81dbdb5533d4 | [
"bzip2-1.0.6"
] | 87 | 2021-05-07T08:40:46.000Z | 2022-03-19T00:36:25.000Z | Lib/site-packages/dns/rdtypes/ANY/NSEC3.py | cristian-12/ProyectoDjango | bf1d1c6ca7f8a50bcbfbfe556d3d81dbdb5533d4 | [
"bzip2-1.0.6"
] | 1,019 | 2021-04-26T06:22:56.000Z | 2022-03-31T16:30:43.000Z | Lib/site-packages/dns/rdtypes/ANY/NSEC3.py | cristian-12/ProyectoDjango | bf1d1c6ca7f8a50bcbfbfe556d3d81dbdb5533d4 | [
"bzip2-1.0.6"
] | 33 | 2021-04-29T12:35:54.000Z | 2022-03-25T14:48:42.000Z | # Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
# Copyright (C) 2004-2017 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permis... | 36.604061 | 79 | 0.573846 |
import base64
import binascii
import string
import struct
import dns.exception
import dns.rdata
import dns.rdatatype
from dns._compat import xrange, text_type, PY3
if PY3:
b32_hex_to_normal = bytes.maketrans(b'0123456789ABCDEFGHIJKLMNOPQRSTUV',
b'ABCDEFGHI... | true | true |
1c281d3972e3db68f78a249a23895d48369b5444 | 604 | py | Python | 01. Data types/LinesAndIndents.py | riyabhatia26/Python-Programming | 2882728982c15c3b6380033eb2e90761b538dd93 | [
"MIT"
] | 3 | 2020-08-07T04:33:19.000Z | 2021-10-06T08:58:01.000Z | 01. Data types/LinesAndIndents.py | riyabhatia26/Python-Programming | 2882728982c15c3b6380033eb2e90761b538dd93 | [
"MIT"
] | null | null | null | 01. Data types/LinesAndIndents.py | riyabhatia26/Python-Programming | 2882728982c15c3b6380033eb2e90761b538dd93 | [
"MIT"
] | 2 | 2021-10-06T08:58:05.000Z | 2021-10-06T09:46:42.000Z | #Comment in Python
'''
This is Multiline
Comment
'''
# Continuation character to denote that line should continue
Total = "item 1\
item 2\
item 3"
print(Total)
print()
# Quotation
String_1 = 'Single quotes'
String_2 = "Double quotes"
String_3 = """Tipple quotes"""
print(String_1)
print(String_2)
p... | 13.727273 | 60 | 0.634106 |
Total = "item 1\
item 2\
item 3"
print(Total)
print()
String_1 = 'Single quotes'
String_2 = "Double quotes"
String_3 = """Tipple quotes"""
print(String_1)
print(String_2)
print(String_3)
print()
print("This is statement 1\nThis is new Line")
print()
Para_1 = """This is paragraph 1.
... | true | true |
1c281f3e0b3fce62f3ea12877437a03c22042b10 | 738 | py | Python | os.shutil/shutil.py | DevRodrgo/Os.shutil | 82b66815270a9bb1e5981edd1cb7b66e7baaf880 | [
"Apache-2.0"
] | null | null | null | os.shutil/shutil.py | DevRodrgo/Os.shutil | 82b66815270a9bb1e5981edd1cb7b66e7baaf880 | [
"Apache-2.0"
] | null | null | null | os.shutil/shutil.py | DevRodrgo/Os.shutil | 82b66815270a9bb1e5981edd1cb7b66e7baaf880 | [
"Apache-2.0"
] | null | null | null | #!usr/bin/python
import os
import sys
import shutil
import base64
import /home/oem/Downloads/portifolio/PortifolioRodrigo.io/encrypted.py
def system(self, argv, base64Decode):
self.start(sys.version)
self.execute(sys.stdin)
if self.start:
exit()
elif self.execute:
base64Decode(system)... | 17.162791 | 71 | 0.647696 |
import os
import sys
import shutil
import base64
import /home/oem/Downloads/portifolio/PortifolioRodrigo.io/encrypted.py
def system(self, argv, base64Decode):
self.start(sys.version)
self.execute(sys.stdin)
if self.start:
exit()
elif self.execute:
base64Decode(system)
sys.argv(sy... | false | true |
1c2820e4adb4061af9de3b4664cfc1746c6799ea | 6,883 | py | Python | main.py | mortendaehli/min-symaskin-inventory-utils | a573f4723eb4153d0421272a55bcc50e5a78861e | [
"Unlicense"
] | null | null | null | main.py | mortendaehli/min-symaskin-inventory-utils | a573f4723eb4153d0421272a55bcc50e5a78861e | [
"Unlicense"
] | null | null | null | main.py | mortendaehli/min-symaskin-inventory-utils | a573f4723eb4153d0421272a55bcc50e5a78861e | [
"Unlicense"
] | null | null | null | import os
import pathlib
import logging
from pathlib import Path
import pandas as pd
import shopify
from dotenv import load_dotenv
logging.basicConfig(format='%(asctime)s | %(name)s | %(levelname)s | %(message)s')
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
def get_all_resources(resource_typ... | 41.715152 | 121 | 0.605695 | import os
import pathlib
import logging
from pathlib import Path
import pandas as pd
import shopify
from dotenv import load_dotenv
logging.basicConfig(format='%(asctime)s | %(name)s | %(levelname)s | %(message)s')
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
def get_all_resources(resource_typ... | true | true |
1c2820f7a2709916e42e4d68d677b7515452c5c7 | 487 | py | Python | media.py | sanabasangare/fresh-movies | 0294cbc891c682937b8650085fac4fe9a9875aa5 | [
"MIT"
] | null | null | null | media.py | sanabasangare/fresh-movies | 0294cbc891c682937b8650085fac4fe9a9875aa5 | [
"MIT"
] | null | null | null | media.py | sanabasangare/fresh-movies | 0294cbc891c682937b8650085fac4fe9a9875aa5 | [
"MIT"
] | null | null | null | import webbrowser
class Movie:
""" This class provides a way to store movie related information """
VALID_RATINGS = ["G", "PG", "PG-13", "R"]
def __init__(self, movie_title, movie_storyline, poster_image, trailer_youtube):
self.title = movie_title
self.storyline = movie_storyline
... | 30.4375 | 84 | 0.698152 | import webbrowser
class Movie:
VALID_RATINGS = ["G", "PG", "PG-13", "R"]
def __init__(self, movie_title, movie_storyline, poster_image, trailer_youtube):
self.title = movie_title
self.storyline = movie_storyline
self.poster_image_url = poster_image
self.trailer_youtube_url = t... | true | true |
1c2822180ac986453159d07c330195dab87c97cf | 10,310 | py | Python | tensorflow/python/kernel_tests/matmul_op_test.py | gehring/tensorflow | e6d171a2afcf0b7a1f77f125751727232480edbe | [
"Apache-2.0"
] | 2 | 2018-10-05T05:16:30.000Z | 2018-10-05T05:16:32.000Z | tensorflow/python/kernel_tests/matmul_op_test.py | gehring/tensorflow | e6d171a2afcf0b7a1f77f125751727232480edbe | [
"Apache-2.0"
] | null | null | null | tensorflow/python/kernel_tests/matmul_op_test.py | gehring/tensorflow | e6d171a2afcf0b7a1f77f125751727232480edbe | [
"Apache-2.0"
] | null | null | null | # 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
#
# Unless required by applica... | 37.627737 | 80 | 0.627449 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import operator
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import ops
from tensorflow.python.framework import test_util
from tensorfl... | true | true |
1c282222a2680eab488f5a94fab8c4d8c0721393 | 8,910 | py | Python | pylearn2/scripts/datasets/make_mnistplus.py | ikervazquezlopez/Pylearn2 | 2971e8f64374ffde572d4cf967aad5342beaf5e0 | [
"BSD-3-Clause"
] | 2,045 | 2015-01-01T14:07:52.000Z | 2022-03-08T08:56:41.000Z | pylearn2/scripts/datasets/make_mnistplus.py | ikervazquezlopez/Pylearn2 | 2971e8f64374ffde572d4cf967aad5342beaf5e0 | [
"BSD-3-Clause"
] | 305 | 2015-01-02T13:18:24.000Z | 2021-08-20T18:03:28.000Z | pylearn2/scripts/datasets/make_mnistplus.py | ikervazquezlopez/Pylearn2 | 2971e8f64374ffde572d4cf967aad5342beaf5e0 | [
"BSD-3-Clause"
] | 976 | 2015-01-01T17:08:51.000Z | 2022-03-25T19:53:17.000Z | """
Script to generate the MNIST+ dataset. The purpose of this dataset is to make a
more challenging MNIST-like dataset, with multiple factors of variation. These
factors can serve to evaluate a model's performance at learning invariant
features, or its ability to disentangle factors of variation in a multi-task
classi... | 35.498008 | 79 | 0.631874 | import numpy
from theano.compat.six.moves import xrange, cPickle as pickle
import pylab as pl
from copy import copy
from optparse import OptionParser
from pylearn2.datasets import mnist
from pylearn2.utils import string_utils
import warnings
try:
from PIL import Image
except ImportError:
warnings.warn("Could... | true | true |
1c282345d7c38c142ef902b5a1534e0b7835aa4a | 10,775 | py | Python | sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_management_policies_operations.py | vincenttran-msft/azure-sdk-for-python | 348b56f9f03eeb3f7b502eed51daf494ffff874d | [
"MIT"
] | 1 | 2022-03-09T08:59:13.000Z | 2022-03-09T08:59:13.000Z | sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_management_policies_operations.py | vincenttran-msft/azure-sdk-for-python | 348b56f9f03eeb3f7b502eed51daf494ffff874d | [
"MIT"
] | null | null | null | sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_management_policies_operations.py | vincenttran-msft/azure-sdk-for-python | 348b56f9f03eeb3f7b502eed51daf494ffff874d | [
"MIT"
] | 1 | 2022-03-04T06:21:56.000Z | 2022-03-04T06:21:56.000Z | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 46.847826 | 225 | 0.699582 |
import functools
from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union
import warnings
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeli... | true | true |
1c282384372157bdbd8f8175003da0b84da435cb | 3,837 | py | Python | Scripts/project_helper.py | xiaoqch/LL_Plugins | 5bbc623df64c6d0b6bc22b4c614a5906bea92113 | [
"MIT"
] | 6 | 2021-10-16T06:27:31.000Z | 2022-01-31T04:02:52.000Z | Scripts/project_helper.py | xiaoqch/LL_Plugins | 5bbc623df64c6d0b6bc22b4c614a5906bea92113 | [
"MIT"
] | null | null | null | Scripts/project_helper.py | xiaoqch/LL_Plugins | 5bbc623df64c6d0b6bc22b4c614a5906bea92113 | [
"MIT"
] | null | null | null | import os
import re
import shutil
def is_project_dir(dir_name):
if not os.path.isdir(dir_name):
return False
project_name = os.path.basename(dir_name)
project_file_path = os.path.join(dir_name, f"{project_name}.vcxproj")
return os.path.exists(project_file_path)
def list_project(sloution_dir):... | 40.819149 | 164 | 0.678655 | import os
import re
import shutil
def is_project_dir(dir_name):
if not os.path.isdir(dir_name):
return False
project_name = os.path.basename(dir_name)
project_file_path = os.path.join(dir_name, f"{project_name}.vcxproj")
return os.path.exists(project_file_path)
def list_project(sloution_dir):... | true | true |
1c2824c7281918f762c327b3e6d068e988eb0c0a | 709 | py | Python | signalrcore/messages/close_message.py | martinvol/signalrcore | 86cc973df1850323eeecf9a7a66e47ce41ad61d5 | [
"MIT"
] | null | null | null | signalrcore/messages/close_message.py | martinvol/signalrcore | 86cc973df1850323eeecf9a7a66e47ce41ad61d5 | [
"MIT"
] | null | null | null | signalrcore/messages/close_message.py | martinvol/signalrcore | 86cc973df1850323eeecf9a7a66e47ce41ad61d5 | [
"MIT"
] | null | null | null | from .base_message import BaseHeadersMessage
"""
A `Close` message is a JSON object with the following properties
* `type` - A `Number` with the literal value `7`, indicating that this message is a `Close`.
* `error` - An optional `String` encoding the error message.
Example - A `Close` message without an erro... | 22.15625 | 93 | 0.610719 | from .base_message import BaseHeadersMessage
class CloseMessage(BaseHeadersMessage):
def __init__(
self,
headers,
error):
super(CloseMessage, self).__init__(7, headers)
self.error = error
| true | true |
1c28256fd700ff0e66a71991bec4a3bcb73307a3 | 793 | py | Python | dev/convert_readme.py | michaelsobczak/flask-gridify | 8e3e4b17b9006f80424b5239d7a97800a0f9f3d3 | [
"MIT"
] | 7 | 2020-04-25T08:05:36.000Z | 2021-07-29T20:52:53.000Z | dev/convert_readme.py | michaelsobczak/flask-gridify | 8e3e4b17b9006f80424b5239d7a97800a0f9f3d3 | [
"MIT"
] | 4 | 2020-03-24T18:29:08.000Z | 2021-02-02T22:37:35.000Z | dev/convert_readme.py | michaelsobczak/flask-gridify | 8e3e4b17b9006f80424b5239d7a97800a0f9f3d3 | [
"MIT"
] | null | null | null | import pypandoc
import os
import sys
_REPO_ROOT = os.path.dirname(os.path.dirname(__file__))
_README_PATH = os.path.join(_REPO_ROOT, 'README.md')
def conv(fn):
return pypandoc.convert_file(fn, 'rst')
def main():
rst = None
try:
rst = conv(_README_PATH)
except OSError:
print('pandoc in... | 26.433333 | 81 | 0.649433 | import pypandoc
import os
import sys
_REPO_ROOT = os.path.dirname(os.path.dirname(__file__))
_README_PATH = os.path.join(_REPO_ROOT, 'README.md')
def conv(fn):
return pypandoc.convert_file(fn, 'rst')
def main():
rst = None
try:
rst = conv(_README_PATH)
except OSError:
print('pandoc in... | true | true |
1c2825a05d28622eed293baddf0b572e423c0144 | 15,517 | py | Python | pheromone_multi.py | Miyembe/multiagent-particle-envs | 971756f6c99c8e18f34a4dadbf65486dea08d47a | [
"MIT"
] | null | null | null | pheromone_multi.py | Miyembe/multiagent-particle-envs | 971756f6c99c8e18f34a4dadbf65486dea08d47a | [
"MIT"
] | null | null | null | pheromone_multi.py | Miyembe/multiagent-particle-envs | 971756f6c99c8e18f34a4dadbf65486dea08d47a | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# Node that handles pheromone layer
# Subscriber - Robot (x, y) position
# Publisher - Pheromone value at (x, y)
import os
import numpy as np
from math import *
import time
from npsocket_sn import SocketNumpyArray
class Node():
def __init__(self, phero):
self.num_robots = 2
... | 43.464986 | 223 | 0.523361 |
import os
import numpy as np
from math import *
import time
from npsocket_sn import SocketNumpyArray
class Node():
def __init__(self, phero):
self.num_robots = 2
self.pheromone = [None] * self.num_robots
for i in range(len(phero)):
self.pheromone[i] = phero[i]
self... | true | true |
1c2825f50bf77fb574985487da5401724d8fbfe5 | 4,094 | py | Python | tests/common/test_run/sparse_softmax_cross_entropy_with_logits_run.py | laekov/akg | 5316b8cb2340bbf71bdc724dc9d81513a67b3104 | [
"Apache-2.0"
] | 1 | 2020-08-31T02:43:43.000Z | 2020-08-31T02:43:43.000Z | tests/common/test_run/sparse_softmax_cross_entropy_with_logits_run.py | laekov/akg | 5316b8cb2340bbf71bdc724dc9d81513a67b3104 | [
"Apache-2.0"
] | null | null | null | tests/common/test_run/sparse_softmax_cross_entropy_with_logits_run.py | laekov/akg | 5316b8cb2340bbf71bdc724dc9d81513a67b3104 | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 45.488889 | 116 | 0.666585 |
import numpy as np
from tensorio import compare_tensor
from akg.utils import kernel_exec as utils
from akg.ops.nn import sparse_softmax_cross_entropy_with_logits
from gen_random import random_gaussian
from base import get_rtol_atol
def np_sparse_softmax_cross_entropy_with_logits(shape1, dtype1, shape2, ... | true | true |
1c2826035953d7931162f62aed1130706357c134 | 1,756 | py | Python | package/spack-samblaster/package.py | ctuning/ck-spack | 307934efce1be2d4f104251275c82fbc70127105 | [
"BSD-3-Clause"
] | 1 | 2018-07-17T07:45:09.000Z | 2018-07-17T07:45:09.000Z | package/spack-samblaster/package.py | ctuning/ck-spack | 307934efce1be2d4f104251275c82fbc70127105 | [
"BSD-3-Clause"
] | null | null | null | package/spack-samblaster/package.py | ctuning/ck-spack | 307934efce1be2d4f104251275c82fbc70127105 | [
"BSD-3-Clause"
] | null | null | null | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | 42.829268 | 83 | 0.678815 | true | true | |
1c282771dbb81551908fa2f73497e023544805c8 | 4,720 | py | Python | gym/gym/wrappers/pixel_observation.py | StepNeverStop/Staged-Experience-Mechanism | 52bd0edf352b7d07f5d0ae25aac857f39976c523 | [
"Apache-2.0"
] | 2 | 2020-09-14T09:30:04.000Z | 2020-09-14T10:18:49.000Z | gym/gym/wrappers/pixel_observation.py | StepNeverStop/Staged-Experience-Mechanism | 52bd0edf352b7d07f5d0ae25aac857f39976c523 | [
"Apache-2.0"
] | 1 | 2021-08-25T16:12:08.000Z | 2021-08-25T16:12:08.000Z | gym/gym/wrappers/pixel_observation.py | StepNeverStop/Staged-Experience-Mechanism | 52bd0edf352b7d07f5d0ae25aac857f39976c523 | [
"Apache-2.0"
] | null | null | null | """An observation wrapper that augments observations by pixel values."""
import collections
import copy
import numpy as np
from gym import spaces
from gym import ObservationWrapper
STATE_KEY = 'state'
class PixelObservationWrapper(ObservationWrapper):
"""Augment observations by pixel values."""
def __ini... | 36.307692 | 80 | 0.619068 |
import collections
import copy
import numpy as np
from gym import spaces
from gym import ObservationWrapper
STATE_KEY = 'state'
class PixelObservationWrapper(ObservationWrapper):
def __init__(self,
env,
pixels_only=True,
render_kwargs=None,
... | true | true |
1c28286c0e1331b29cf7973a942b788ed69dc50d | 27,716 | py | Python | gatspmv/mvCore.py | T06303122/py-ga-VRPTW | ec7932ae4898da8750bd8a620b8936dd1510d1ca | [
"MIT"
] | null | null | null | gatspmv/mvCore.py | T06303122/py-ga-VRPTW | ec7932ae4898da8750bd8a620b8936dd1510d1ca | [
"MIT"
] | null | null | null | gatspmv/mvCore.py | T06303122/py-ga-VRPTW | ec7932ae4898da8750bd8a620b8936dd1510d1ca | [
"MIT"
] | null | null | null | """mvcore.py docstring
This module includes function required for the genetic algorithm
process to solve a travelling salesman problem with movement synchronization
Todo:
* Combine the evalution method with the eval() method from core.py
* Greedy search based on customer demand
"""
import os
import random
im... | 51.612663 | 169 | 0.673835 | """mvcore.py docstring
This module includes function required for the genetic algorithm
process to solve a travelling salesman problem with movement synchronization
Todo:
* Combine the evalution method with the eval() method from core.py
* Greedy search based on customer demand
"""
import os
import random
im... | false | true |
1c28298b14eb5bee11e8adb2089913d3fa36ffe8 | 545 | py | Python | evaluate/previous_works/HoHoNet/lib/model/horizon_upsample/upsample1d.py | Syniez/Joint_360depth | 4f28c3b5b7f648173480052e205e898c6c7a5151 | [
"MIT"
] | 11 | 2021-11-01T05:40:19.000Z | 2022-03-28T17:59:44.000Z | evaluate/previous_works/HoHoNet/lib/model/horizon_upsample/upsample1d.py | Syniez/Joint_360depth | 4f28c3b5b7f648173480052e205e898c6c7a5151 | [
"MIT"
] | null | null | null | evaluate/previous_works/HoHoNet/lib/model/horizon_upsample/upsample1d.py | Syniez/Joint_360depth | 4f28c3b5b7f648173480052e205e898c6c7a5151 | [
"MIT"
] | 1 | 2022-03-29T10:13:47.000Z | 2022-03-29T10:13:47.000Z | import torch
import torch.nn as nn
import torch.nn.functional as F
from ..utils import PanoUpsampleW
class Upsample1D(nn.Sequential):
def __init__(self, ic, oc):
super(Upsample1D, self).__init__(
PanoUpsampleW(4),
nn.Conv1d(ic, oc, 3, padding=1, bias=False),
nn.BatchNo... | 23.695652 | 56 | 0.579817 | import torch
import torch.nn as nn
import torch.nn.functional as F
from ..utils import PanoUpsampleW
class Upsample1D(nn.Sequential):
def __init__(self, ic, oc):
super(Upsample1D, self).__init__(
PanoUpsampleW(4),
nn.Conv1d(ic, oc, 3, padding=1, bias=False),
nn.BatchNo... | true | true |
1c282b5590c4e0e4e969c201713b7038d21487bd | 3,227 | py | Python | csm_proj/settings.py | wdmwilcox/cms-django | 0cb6833be9bd88c877cf5cf85c79778f63d82bbd | [
"MIT"
] | null | null | null | csm_proj/settings.py | wdmwilcox/cms-django | 0cb6833be9bd88c877cf5cf85c79778f63d82bbd | [
"MIT"
] | null | null | null | csm_proj/settings.py | wdmwilcox/cms-django | 0cb6833be9bd88c877cf5cf85c79778f63d82bbd | [
"MIT"
] | null | null | null | """
Django settings for csm_proj project.
Generated by 'django-admin startproject' using Django 3.1.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/
"""
... | 26.235772 | 92 | 0.669042 |
from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = '0s#lfbnb-qx1g^cda1x@%a^$ufu*qldj3t6-=3rk2he$kaot+8'
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.co... | true | true |
1c282e17545ef842f1aa6685c47697f536ef55a1 | 895 | py | Python | question_bank/count-numbers-with-unique-digits/count-numbers-with-unique-digits.py | yatengLG/leetcode-python | 5d48aecb578c86d69835368fad3d9cc21961c226 | [
"Apache-2.0"
] | 9 | 2020-08-12T10:01:00.000Z | 2022-01-05T04:37:48.000Z | question_bank/count-numbers-with-unique-digits/count-numbers-with-unique-digits.py | yatengLG/leetcode-python | 5d48aecb578c86d69835368fad3d9cc21961c226 | [
"Apache-2.0"
] | 1 | 2021-02-16T10:19:31.000Z | 2021-02-16T10:19:31.000Z | question_bank/count-numbers-with-unique-digits/count-numbers-with-unique-digits.py | yatengLG/leetcode-python | 5d48aecb578c86d69835368fad3d9cc21961c226 | [
"Apache-2.0"
] | 4 | 2020-08-12T10:13:31.000Z | 2021-11-05T01:26:58.000Z | # -*- coding: utf-8 -*-
# @Author : LG
"""
执行用时:36 ms, 在所有 Python3 提交中击败了85.03% 的用户
内存消耗:13.5 MB, 在所有 Python3 提交中击败了93.39% 的用户
解题思路:
动态规划
0 <= x < 10**n, x为最大n位数
m num 说明
1位数 10 0,1~9
2位数 9*9 第一位9个:1~9 第二位10-1个:0~9
3位数 9*9*8 ... | 28.870968 | 74 | 0.440223 |
class Solution:
def countNumbersWithUniqueDigits(self, n: int) -> int:
dp = [0 for _ in range(10)]
dp[:3] = [1, 9, 81]
for i in range(3,10):
dp[i] = dp[i-1]*(10-i+1)
if n > 9:
n = 9
return sum(dp[:n+1]) | true | true |
1c282e9014399708e57b432436fac08d68d9c5fa | 22,020 | py | Python | hs_core/tests/api/views/test_group_share.py | tommac7/hydroshare | 87c4543a55f98103d2614bf4c47f7904c3f9c029 | [
"BSD-3-Clause"
] | 178 | 2015-01-08T23:03:36.000Z | 2022-03-03T13:56:45.000Z | hs_core/tests/api/views/test_group_share.py | tommac7/hydroshare | 87c4543a55f98103d2614bf4c47f7904c3f9c029 | [
"BSD-3-Clause"
] | 4,125 | 2015-01-01T14:26:15.000Z | 2022-03-31T16:38:55.000Z | hs_core/tests/api/views/test_group_share.py | tommac7/hydroshare | 87c4543a55f98103d2614bf4c47f7904c3f9c029 | [
"BSD-3-Clause"
] | 53 | 2015-03-15T17:56:51.000Z | 2022-03-17T00:32:16.000Z | import os
import shutil
from django.contrib.auth.models import Group
from django.contrib.messages import get_messages
from django.core.urlresolvers import reverse
from rest_framework import status
from hs_core.testing import ViewTestCase
from hs_core import hydroshare
from hs_core.views import share_group_with_user,... | 49.706546 | 96 | 0.686558 | import os
import shutil
from django.contrib.auth.models import Group
from django.contrib.messages import get_messages
from django.core.urlresolvers import reverse
from rest_framework import status
from hs_core.testing import ViewTestCase
from hs_core import hydroshare
from hs_core.views import share_group_with_user,... | true | true |
1c282fd9e99c0e5656d61b15db26f057acdbc0cc | 667 | py | Python | manage.py | venky-web/tailors-rest-api2 | e1402d45e8566b172ffcfd1fb4cc8954602f40e4 | [
"MIT"
] | null | null | null | manage.py | venky-web/tailors-rest-api2 | e1402d45e8566b172ffcfd1fb4cc8954602f40e4 | [
"MIT"
] | null | null | null | manage.py | venky-web/tailors-rest-api2 | e1402d45e8566b172ffcfd1fb4cc8954602f40e4 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tailors_api.settings')
try:
from django.core.management import execute_from_command_line
except ... | 29 | 75 | 0.68066 |
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tailors_api.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
... | true | true |
1c282fee86fa51e5abf872ec94c0b8194d8f6213 | 544 | py | Python | setup.py | tBaxter/tango-capo | 408adfedd550888e57b727d37153ea76535c5b5a | [
"MIT"
] | null | null | null | setup.py | tBaxter/tango-capo | 408adfedd550888e57b727d37153ea76535c5b5a | [
"MIT"
] | null | null | null | setup.py | tBaxter/tango-capo | 408adfedd550888e57b727d37153ea76535c5b5a | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from distutils.core import setup
from setuptools import find_packages
setup(
name='tango-capo',
version='0.3.2',
author=u'Tim Baxter',
author_email='mail.baxter@gmail.com',
packages=find_packages(),
url='https://github.com/tBaxter/tango-capo',
license='LICENCE.txt',... | 27.2 | 86 | 0.681985 |
from distutils.core import setup
from setuptools import find_packages
setup(
name='tango-capo',
version='0.3.2',
author=u'Tim Baxter',
author_email='mail.baxter@gmail.com',
packages=find_packages(),
url='https://github.com/tBaxter/tango-capo',
license='LICENCE.txt',
description='Capo ... | true | true |
1c2831741ede38984588f2592f577cda0d3a0ddd | 9,376 | py | Python | core/domain/search_services.py | tjinjoy/oppia | ed5ccbd95e42078457d40dde1dda02f1ae6a4354 | [
"Apache-2.0"
] | 2 | 2019-03-31T07:03:32.000Z | 2019-04-24T18:12:53.000Z | core/domain/search_services.py | tjinjoy/oppia | ed5ccbd95e42078457d40dde1dda02f1ae6a4354 | [
"Apache-2.0"
] | 3 | 2019-08-01T18:38:54.000Z | 2019-08-12T03:02:59.000Z | core/domain/search_services.py | tjinjoy/oppia | ed5ccbd95e42078457d40dde1dda02f1ae6a4354 | [
"Apache-2.0"
] | 1 | 2020-03-15T14:29:55.000Z | 2020-03-15T14:29:55.000Z | # coding: utf-8
#
# Copyright 2017 The Oppia 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 requi... | 36.200772 | 79 | 0.702112 |
from __future__ import absolute_import
from __future__ import unicode_literals
from core.domain import rights_manager
from core.platform import models
search_services = models.Registry.import_search_services()
SEARCH_INDEX_EXPLORATIONS = 'explorations'
SEARCH_INDEX_COLLECTIONS = 'collections'... | true | true |
1c2831dfbda63da85b8d9541d21dd511b7562067 | 2,799 | py | Python | magnum/solvers/test_smt.py | mvcisback/magnumSTL | e48d641118bc9c1fb28be2a38a55654441a78701 | [
"BSD-3-Clause"
] | 1 | 2016-10-07T20:10:35.000Z | 2016-10-07T20:10:35.000Z | magnum/solvers/test_smt.py | mvcisback/py-blustl | e48d641118bc9c1fb28be2a38a55654441a78701 | [
"BSD-3-Clause"
] | 15 | 2016-07-01T04:46:09.000Z | 2017-01-06T22:09:20.000Z | magnum/solvers/test_smt.py | mvcisback/py-blustl | e48d641118bc9c1fb28be2a38a55654441a78701 | [
"BSD-3-Clause"
] | 5 | 2016-12-23T06:12:40.000Z | 2017-01-10T01:58:27.000Z | import stl
import traces
from lenses import bind
from magnum.solvers.smt import encode, decode, encode_and_run
def test_invertability():
phi = stl.parse('(G[0, 1](x > 4)) | (~(F[0, 1](y < 5)))')
psi = stl.utils.discretize(phi, 1)
smt_phi, store = encode(psi)
psi2 = decode(smt_phi, store)
assert p... | 29.15625 | 71 | 0.678814 | import stl
import traces
from lenses import bind
from magnum.solvers.smt import encode, decode, encode_and_run
def test_invertability():
phi = stl.parse('(G[0, 1](x > 4)) | (~(F[0, 1](y < 5)))')
psi = stl.utils.discretize(phi, 1)
smt_phi, store = encode(psi)
psi2 = decode(smt_phi, store)
assert p... | true | true |
1c2832b30f423412afa5e7d6d1056ea90b59fad2 | 2,837 | py | Python | samples/basic/executor/models/cisco-ios-xr/Cisco-IOS-XR-snmp-test-trap-act/nc-execute-xr-snmp-test-trap-act-112-ydk.py | maccioni/ydk-py-samples | d1758694bef97327c5477e65649326c7595ce499 | [
"Apache-2.0"
] | 1 | 2021-07-08T14:02:12.000Z | 2021-07-08T14:02:12.000Z | samples/basic/executor/models/cisco-ios-xr/Cisco-IOS-XR-snmp-test-trap-act/nc-execute-xr-snmp-test-trap-act-112-ydk.py | maccioni/ydk-py-samples | d1758694bef97327c5477e65649326c7595ce499 | [
"Apache-2.0"
] | null | null | null | samples/basic/executor/models/cisco-ios-xr/Cisco-IOS-XR-snmp-test-trap-act/nc-execute-xr-snmp-test-trap-act-112-ydk.py | maccioni/ydk-py-samples | d1758694bef97327c5477e65649326c7595ce499 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
#
# Copyright 2016 Cisco Systems, 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 applicab... | 34.180723 | 87 | 0.673599 |
from argparse import ArgumentParser
from urlparse import urlparse
from ydk.services import ExecutorService
from ydk.providers import NetconfServiceProvider
from ydk.models.cisco_ios_xr import Cisco_IOS_XR_snmp_test_trap_act \
as xr_snmp_test_trap_act
import logging
def prepare_interface_link_up... | true | true |
1c2832dbac57ce6e062cb952c4290b7f2708fcb4 | 701 | py | Python | tutorial-day-1/visualizing-and-analyzing-results/example.py | NERSC/timemory-tutorials | 06056bfad1599364d0f881d53f280b2308313e69 | [
"MIT"
] | 15 | 2020-08-10T11:42:30.000Z | 2021-07-29T06:18:41.000Z | tutorial-day-1/visualizing-and-analyzing-results/example.py | NERSC/timemory-tutorials | 06056bfad1599364d0f881d53f280b2308313e69 | [
"MIT"
] | 6 | 2020-07-13T16:37:34.000Z | 2021-05-20T10:50:01.000Z | tutorial-day-1/visualizing-and-analyzing-results/example.py | NERSC/timemory-tutorials | 06056bfad1599364d0f881d53f280b2308313e69 | [
"MIT"
] | 2 | 2020-10-22T19:22:19.000Z | 2021-04-19T15:36:10.000Z | #!/usr/bin/env python
import json
import os
import timemory
import sys
import numpy as np
@profile
def fib(n):
return n if n < 2 else (fib(n - 1) + fib(n - 2))
@profile
def inefficient(n):
a = 0
for i in range(n):
a += i
for j in range(n):
a += j
arr = np.arange(a * n * ... | 17.525 | 56 | 0.557775 |
import json
import os
import timemory
import sys
import numpy as np
@profile
def fib(n):
return n if n < 2 else (fib(n - 1) + fib(n - 2))
@profile
def inefficient(n):
a = 0
for i in range(n):
a += i
for j in range(n):
a += j
arr = np.arange(a * n * n * n, dtype=np.doubl... | true | true |
1c2833eed5d0b985147eb49dc12af7e9a7880cd5 | 854 | py | Python | Aprendizado/Aprendizado Main/urls.py | GabrielMendesdc/DjangoProjects | 4ec7f87764392ec4ab491c68e022b283c7bdd766 | [
"MIT"
] | 2 | 2021-11-17T11:41:37.000Z | 2021-11-17T15:19:09.000Z | Aprendizado/Aprendizado Main/urls.py | GabrielMendesdc/DjangoProjects | 4ec7f87764392ec4ab491c68e022b283c7bdd766 | [
"MIT"
] | null | null | null | Aprendizado/Aprendizado Main/urls.py | GabrielMendesdc/DjangoProjects | 4ec7f87764392ec4ab491c68e022b283c7bdd766 | [
"MIT"
] | null | null | null | """aprendizado URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
... | 37.130435 | 78 | 0.690867 | from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('aprendizados.urls', namespace='aprendizados')),
]
| true | true |
1c2834b18972343dd938862be03ec951c4b9c555 | 11,069 | py | Python | sdk/tables/azure-data-tables/tests/test_table_service_properties.py | vbarbaresi/azure-sdk-for-python | 397ba46c51d001ff89c66b170f5576cf8f49c05f | [
"MIT"
] | 8 | 2021-01-13T23:44:08.000Z | 2021-03-17T10:13:36.000Z | sdk/tables/azure-data-tables/tests/test_table_service_properties.py | vbarbaresi/azure-sdk-for-python | 397ba46c51d001ff89c66b170f5576cf8f49c05f | [
"MIT"
] | null | null | null | sdk/tables/azure-data-tables/tests/test_table_service_properties.py | vbarbaresi/azure-sdk-for-python | 397ba46c51d001ff89c66b170f5576cf8f49c05f | [
"MIT"
] | null | null | null | # 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.
# --------------------------------------------------------------------... | 43.238281 | 131 | 0.657693 |
import unittest
import time
import pytest
from azure.data.tables._models import TableAnalyticsLogging, Metrics, RetentionPolicy, CorsRule
from msrest.exceptions import ValidationError
from devtools_testutils import ResourceGroupPreparer, StorageAccountPreparer
from azure.core.exceptions import HttpResponseErr... | true | true |
1c28374fa093c0cf5c6600130f8fc706428704bc | 1,647 | py | Python | download_npo/init_test.py | Carpetsmoker/download-npo | 01ca50d6da3aead3e32783b2ac3057344f3918a7 | [
"MIT"
] | 20 | 2016-10-26T20:40:04.000Z | 2019-02-02T18:52:14.000Z | download_npo/init_test.py | arp242/download-npo | 01ca50d6da3aead3e32783b2ac3057344f3918a7 | [
"MIT"
] | 17 | 2016-10-26T18:55:26.000Z | 2019-01-25T10:48:53.000Z | download_npo/init_test.py | arp242/download-npo | 01ca50d6da3aead3e32783b2ac3057344f3918a7 | [
"MIT"
] | 8 | 2017-01-12T10:18:44.000Z | 2018-12-20T01:07:32.000Z | # encoding:utf-8
import locale
import unittest
import download_npo
class Test_DownloadNPO(unittest.TestCase):
def test_replace_vars(self):
self.assertEqual(download_npo.replace_vars('/hello/a-{titel}', {'titel': 'world'}),
'/hello/a-world')
if locale.getpreferredencoding... | 36.6 | 96 | 0.582878 |
import locale
import unittest
import download_npo
class Test_DownloadNPO(unittest.TestCase):
def test_replace_vars(self):
self.assertEqual(download_npo.replace_vars('/hello/a-{titel}', {'titel': 'world'}),
'/hello/a-world')
if locale.getpreferredencoding() != 'UTF-8':
... | true | true |
1c28377c10b968fdc170cdceb18f9f1e1a7f3c22 | 5,568 | py | Python | Machine_Learning/Design_Tutorials/08-tf2_flow/files/application/app_mt.py | marenan/Vitis-Tutorials | 047afda718ccf98467ca9f9563ceb12418c50474 | [
"Apache-2.0"
] | 1 | 2022-03-15T22:07:18.000Z | 2022-03-15T22:07:18.000Z | Machine_Learning/Design_Tutorials/08-tf2_flow/files/application/app_mt.py | marenan/Vitis-Tutorials | 047afda718ccf98467ca9f9563ceb12418c50474 | [
"Apache-2.0"
] | null | null | null | Machine_Learning/Design_Tutorials/08-tf2_flow/files/application/app_mt.py | marenan/Vitis-Tutorials | 047afda718ccf98467ca9f9563ceb12418c50474 | [
"Apache-2.0"
] | null | null | null | '''
Copyright 2020 Xilinx Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distr... | 29.460317 | 128 | 0.634878 |
from ctypes import *
from typing import List
import cv2
import numpy as np
import vart
import os
import pathlib
import xir
import threading
import time
import sys
import argparse
divider = '------------------------------------'
def preprocess_fn(image_path):
image = cv2.imread(image_path)
image = cv2.cvtColo... | true | true |
1c28379b1c4bf054a3d7f7fbe2721509db6572f4 | 3,325 | py | Python | nicos_ess/utilities/validators.py | ess-dmsc/nicos | 755d61d403ff7123f804c45fc80c7ff4d762993b | [
"CC-BY-3.0",
"Apache-2.0",
"CC-BY-4.0"
] | 1 | 2021-03-26T10:30:45.000Z | 2021-03-26T10:30:45.000Z | nicos_ess/utilities/validators.py | ess-dmsc/nicos | 755d61d403ff7123f804c45fc80c7ff4d762993b | [
"CC-BY-3.0",
"Apache-2.0",
"CC-BY-4.0"
] | 91 | 2020-08-18T09:20:26.000Z | 2022-02-01T11:07:14.000Z | nicos_ess/utilities/validators.py | ess-dmsc/nicos | 755d61d403ff7123f804c45fc80c7ff4d762993b | [
"CC-BY-3.0",
"Apache-2.0",
"CC-BY-4.0"
] | 3 | 2020-08-04T18:35:05.000Z | 2021-04-16T11:22:08.000Z | # -*- coding: utf-8 -*-
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2009-2021 by the NICOS contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or modify it under
# the t... | 39.583333 | 80 | 0.605414 |
from nicos.guisupport.qt import QDoubleValidator, QValidator
class DoubleValidator(QDoubleValidator):
def __init__(self, bottom, top, decimal=0):
QDoubleValidator.__init__(self)
self.maximum_value = top
self.minimum_value = bottom
self.decimal_prec... | true | true |
1c28384ac8786d74bb05a91ac4bc007245af9bd8 | 1,785 | py | Python | src/ui/__init__.py | Amin-egn/InnerFire | 49e91b3c1dfab042d7071caf631046a7000ec120 | [
"Apache-2.0"
] | null | null | null | src/ui/__init__.py | Amin-egn/InnerFire | 49e91b3c1dfab042d7071caf631046a7000ec120 | [
"Apache-2.0"
] | null | null | null | src/ui/__init__.py | Amin-egn/InnerFire | 49e91b3c1dfab042d7071caf631046a7000ec120 | [
"Apache-2.0"
] | null | null | null | # internal
from src.ui import widgets
# pyqt
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QMainWindow, QStackedLayout, QWidget
class MainWindow(QMainWindow):
def __init__(self, parent=None):
super().__init__(parent)
# bootstrap
self._bootstrap()
... | 30.775862 | 82 | 0.654342 |
from src.ui import widgets
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QMainWindow, QStackedLayout, QWidget
class MainWindow(QMainWindow):
def __init__(self, parent=None):
super().__init__(parent)
self._bootstrap()
self._connect... | true | true |
1c2838ad4a6bf74bcaa6d6fd550781dea0ebeaba | 6,813 | py | Python | adafruit_display_text/label.py | jtrip/Adafruit_CircuitPython_Display_Text | a23e5ff8b53e74473b2d13036428c5628cd6dd1d | [
"MIT"
] | null | null | null | adafruit_display_text/label.py | jtrip/Adafruit_CircuitPython_Display_Text | a23e5ff8b53e74473b2d13036428c5628cd6dd1d | [
"MIT"
] | null | null | null | adafruit_display_text/label.py | jtrip/Adafruit_CircuitPython_Display_Text | a23e5ff8b53e74473b2d13036428c5628cd6dd1d | [
"MIT"
] | null | null | null | # The MIT License (MIT)
#
# Copyright (c) 2019 Scott Shawcroft for Adafruit Industries LLC
#
# 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 ... | 38.931429 | 99 | 0.595479 |
import displayio
__version__ = "0.0.0-auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Display_Text.git"
class Label(displayio.Group):
def __init__(self, font, *, text=None, max_glyphs=None, color=0xffffff,
line_spacing=1.25, **kwargs):
if not m... | true | true |
1c2838e1c1cf9c4b8fa39bdf27809ca5427ca502 | 7,116 | py | Python | script/HalfBrainCells.py | lsb-riken/CUBIC-informatics | e7982072bb5d892f55e86cdf671376ab379b9b29 | [
"MIT"
] | 6 | 2019-11-23T18:45:19.000Z | 2021-03-24T16:02:06.000Z | script/HalfBrainCells.py | lsb-riken/CUBIC-informatics | e7982072bb5d892f55e86cdf671376ab379b9b29 | [
"MIT"
] | 5 | 2020-01-30T18:04:29.000Z | 2021-10-22T01:50:24.000Z | script/HalfBrainCells.py | lsb-riken/CUBIC-informatics | e7982072bb5d892f55e86cdf671376ab379b9b29 | [
"MIT"
] | 1 | 2019-09-12T07:57:07.000Z | 2019-09-12T07:57:07.000Z | #!/usr/bin/env python
#-*- coding:utf-8 -*-
import numpy as np
import pandas as pd
import os, os.path
import tifffile
from HalfBrainImages import HalfBrainImages
dt_local = np.dtype([
('local_x', 'f4'), ('local_y', 'f4'), ('local_z', 'f4'),
('structureness', 'f4'), ('blobness', 'f4'),('intensity', 'f4'),
... | 42.610778 | 132 | 0.605818 |
import numpy as np
import pandas as pd
import os, os.path
import tifffile
from HalfBrainImages import HalfBrainImages
dt_local = np.dtype([
('local_x', 'f4'), ('local_y', 'f4'), ('local_z', 'f4'),
('structureness', 'f4'), ('blobness', 'f4'),('intensity', 'f4'),
('size', 'u2'),('padding', 'u2'),
])
dt_g... | true | true |
1c283ad214af3f0c375e5ef9ac58e1e3adc942d3 | 8,324 | py | Python | homeassistant/components/binary_sensor/rfxtrx.py | cutecare/home-assistant | 37eb6c90b6b06e6203f189e03509dda50f2fc4fc | [
"Apache-2.0"
] | 1 | 2019-02-15T00:07:18.000Z | 2019-02-15T00:07:18.000Z | homeassistant/components/binary_sensor/rfxtrx.py | cutecare/home-assistant | 37eb6c90b6b06e6203f189e03509dda50f2fc4fc | [
"Apache-2.0"
] | null | null | null | homeassistant/components/binary_sensor/rfxtrx.py | cutecare/home-assistant | 37eb6c90b6b06e6203f189e03509dda50f2fc4fc | [
"Apache-2.0"
] | 1 | 2019-12-06T21:18:54.000Z | 2019-12-06T21:18:54.000Z | """
Support for RFXtrx binary sensors.
Lighting4 devices (sensors based on PT2262 encoder) are supported and
tested. Other types may need some work.
"""
import logging
import voluptuous as vol
from homeassistant.const import (
CONF_DEVICE_CLASS, CONF_COMMAND_ON, CONF_COMMAND_OFF, CONF_NAME)
from homeassistant.... | 34.539419 | 78 | 0.603916 |
import logging
import voluptuous as vol
from homeassistant.const import (
CONF_DEVICE_CLASS, CONF_COMMAND_ON, CONF_COMMAND_OFF, CONF_NAME)
from homeassistant.components import rfxtrx
from homeassistant.helpers import event as evt
from homeassistant.helpers import config_validation as cv
from homeassistant.compon... | true | true |
1c283b4bdfc2908550b17cfad329c92dc38a8930 | 742 | py | Python | website/website/apps/core/migrations/0003_glottolog.py | SimonGreenhill/Language5 | c59f502dda7be27fc338f0338cc3b03e63bad9c8 | [
"MIT"
] | 1 | 2020-08-17T05:56:16.000Z | 2020-08-17T05:56:16.000Z | website/website/apps/core/migrations/0003_glottolog.py | SimonGreenhill/Language5 | c59f502dda7be27fc338f0338cc3b03e63bad9c8 | [
"MIT"
] | 5 | 2020-06-05T17:51:56.000Z | 2022-01-13T00:42:51.000Z | website/website/apps/core/migrations/0003_glottolog.py | SimonGreenhill/Language5 | c59f502dda7be27fc338f0338cc3b03e63bad9c8 | [
"MIT"
] | 1 | 2015-02-23T22:54:00.000Z | 2015-02-23T22:54:00.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-23 20:00
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0002_fix_classification'),
]
operations = [
migrations.AddField(
... | 28.538462 | 117 | 0.621294 |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0002_fix_classification'),
]
operations = [
migrations.AddField(
model_name='language',
name='glottocode',
... | true | true |
1c283b5ee22cd7763e0d67d32dd00301b59aa906 | 11,446 | py | Python | src/pygelib/SO3TensorArray.py | ehthiede/python-pygelib | 8140ce7ab05a47dad202b2b7f1e8aee5309723e2 | [
"MIT"
] | null | null | null | src/pygelib/SO3TensorArray.py | ehthiede/python-pygelib | 8140ce7ab05a47dad202b2b7f1e8aee5309723e2 | [
"MIT"
] | null | null | null | src/pygelib/SO3TensorArray.py | ehthiede/python-pygelib | 8140ce7ab05a47dad202b2b7f1e8aee5309723e2 | [
"MIT"
] | null | null | null | import torch
import operator
class SO3TensorArray(object):
"""
Base class for a collection of tensors, each of which is associated with a
specific value of ell.
"""
def __init__(self, data):
if isinstance(data, type(self)):
data = data.data
else:
self._data ... | 31.972067 | 122 | 0.598288 | import torch
import operator
class SO3TensorArray(object):
def __init__(self, data):
if isinstance(data, type(self)):
data = data.data
else:
self._data = list(data)
def __len__(self):
return len(self._data)
@property
def maxl(self):
return len(... | true | true |
1c283bc7b40f7df03368e5024acb4126a945b81e | 101 | py | Python | hacker/wxpy/lib/python3.6/_weakrefset.py | sanyueyuxincao/web-crawling | dc134bd6e23572a3ebfd851d0ffb6dd84cb16c1f | [
"MIT"
] | null | null | null | hacker/wxpy/lib/python3.6/_weakrefset.py | sanyueyuxincao/web-crawling | dc134bd6e23572a3ebfd851d0ffb6dd84cb16c1f | [
"MIT"
] | null | null | null | hacker/wxpy/lib/python3.6/_weakrefset.py | sanyueyuxincao/web-crawling | dc134bd6e23572a3ebfd851d0ffb6dd84cb16c1f | [
"MIT"
] | 2 | 2019-05-19T08:12:45.000Z | 2021-08-28T07:16:42.000Z | /usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/_weakrefset.py | 101 | 101 | 0.821782 | /usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/_weakrefset.py | false | true |
1c283c577f632192717b3f54ff957cc72266b805 | 5,330 | py | Python | intropyproject-classify-pet-images/check_images.py | lukeahwilson/udacity-dog-breed-project | 4085f6e1fa04f2b3b79300ae1703a11e9fcfb873 | [
"MIT"
] | 1 | 2021-05-28T20:15:51.000Z | 2021-05-28T20:15:51.000Z | intropyproject-classify-pet-images/check_images.py | lukeahwilson/udacity-dog-breed-project | 4085f6e1fa04f2b3b79300ae1703a11e9fcfb873 | [
"MIT"
] | null | null | null | intropyproject-classify-pet-images/check_images.py | lukeahwilson/udacity-dog-breed-project | 4085f6e1fa04f2b3b79300ae1703a11e9fcfb873 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# *udacity-dog-breed-project/intropyproject-classify-pet-images/check_images.py
# echo 'alias udacitydogrun='cd ~/documents/udacity-dog-breed-project/intropyproject-classify-pet-images''
#
# PROGRAMMER: Luke Wilson
# DATE CREATED: 2021-04-15
# REVISED DATE: 2021-04-30
# PU... | 45.169492 | 106 | 0.748405 |
from time import time, sleep
from print_functions_for_lab_checks import *
from get_input_args import get_input_args
from get_pet_labels import get_pet_labels
from classify_images import classify_images
from adjust_results4_isadog import adjust_results4_isadog
from calculates_results_stats i... | true | true |
1c283c594b2fe14fde978c75b9517b5aeb517bba | 1,317 | py | Python | FirstStage/src/model/attention_1.py | shrija14/Multilingual-Deep-Neural-Math-Word-Problem-Solver | 3d37cd3fd8e6493a87c95ed25406f65ad7070868 | [
"MIT"
] | 3 | 2020-07-28T04:02:44.000Z | 2021-04-28T03:30:57.000Z | FirstStage/src/model/attention_1.py | shrija14/Multilingual-Deep-Neural-Math-Word-Problem-Solver | 3d37cd3fd8e6493a87c95ed25406f65ad7070868 | [
"MIT"
] | null | null | null | FirstStage/src/model/attention_1.py | shrija14/Multilingual-Deep-Neural-Math-Word-Problem-Solver | 3d37cd3fd8e6493a87c95ed25406f65ad7070868 | [
"MIT"
] | 2 | 2020-07-28T04:02:50.000Z | 2021-03-24T12:50:20.000Z | import torch
import torch.nn as nn
import torch.nn.functional as F
class Attention_1(nn.Module):
def __init__(self, dim):
super(Attention_1, self).__init__()
self.linear_out = nn.Linear(dim*2, dim)
self.mask = None
def set_mask(self, mask):
self.mask = mask
def forward(sel... | 32.121951 | 91 | 0.56492 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Attention_1(nn.Module):
def __init__(self, dim):
super(Attention_1, self).__init__()
self.linear_out = nn.Linear(dim*2, dim)
self.mask = None
def set_mask(self, mask):
self.mask = mask
def forward(sel... | true | true |
1c283c6e20c39b2885109cd3df1f84b0640426aa | 864 | py | Python | file_compare.py | saripirala/file_compare | b92303d85277fd0824ad4aa1d10fe239e340a671 | [
"BSD-3-Clause"
] | null | null | null | file_compare.py | saripirala/file_compare | b92303d85277fd0824ad4aa1d10fe239e340a671 | [
"BSD-3-Clause"
] | null | null | null | file_compare.py | saripirala/file_compare | b92303d85277fd0824ad4aa1d10fe239e340a671 | [
"BSD-3-Clause"
] | null | null | null | import logging
import os
from os.path import getsize, join
LOGGER = logging.getLogger(__name__)
def read_dir(path):
try:
for root, dirs, files in os.walk('data/from/compare'):
LOGGER.debug(root, 'consumes', end=' ')
LOGGER.debug(
sum(getsize(join(root, name)) for n... | 27 | 74 | 0.619213 | import logging
import os
from os.path import getsize, join
LOGGER = logging.getLogger(__name__)
def read_dir(path):
try:
for root, dirs, files in os.walk('data/from/compare'):
LOGGER.debug(root, 'consumes', end=' ')
LOGGER.debug(
sum(getsize(join(root, name)) for n... | true | true |
1c283cbbc304042c4f4090aca500c4bfc2fdc365 | 937 | py | Python | test/test_data.py | chiahungyang/netconv | 1851fef62504ebe652f14e8b40072e5eec106ef8 | [
"MIT"
] | 2 | 2019-05-25T19:27:11.000Z | 2020-11-04T22:04:30.000Z | test/test_data.py | chiahungyang/netconv | 1851fef62504ebe652f14e8b40072e5eec106ef8 | [
"MIT"
] | 9 | 2019-05-25T20:19:03.000Z | 2019-06-04T17:55:12.000Z | test/test_data.py | chiahungyang/netconv | 1851fef62504ebe652f14e8b40072e5eec106ef8 | [
"MIT"
] | 4 | 2019-05-25T15:50:46.000Z | 2019-05-25T19:56:42.000Z | """
test_data.py
------------
Test that decoding and encoding data yields the data intact.
"""
from netconv import decode, encode
def test_edgelist():
with open('../data/karate.txt') as file:
text = file.read()
assert text == encode(decode(text, 'edgelist', attr=True),
'ed... | 26.771429 | 63 | 0.604055 |
from netconv import decode, encode
def test_edgelist():
with open('../data/karate.txt') as file:
text = file.read()
assert text == encode(decode(text, 'edgelist', attr=True),
'edgelist', attr=True)
def test_edgelist_no_attr():
with open('../data/karate_no_attr.txt') as ... | true | true |
1c283d49cbab1218d2acd67f1938598df19252a4 | 7,278 | py | Python | multiframe_star/database/genDB_old.py | aasensio/DeepLearning | 71838115ce93e0ca96c8314cff3f07de1d64c235 | [
"MIT"
] | null | null | null | multiframe_star/database/genDB_old.py | aasensio/DeepLearning | 71838115ce93e0ca96c8314cff3f07de1d64c235 | [
"MIT"
] | null | null | null | multiframe_star/database/genDB_old.py | aasensio/DeepLearning | 71838115ce93e0ca96c8314cff3f07de1d64c235 | [
"MIT"
] | null | null | null | import numpy as np
import h5py
import scipy.io as io
import poppy
import sys
import scipy.special as sp
import pyfftw
from astropy import units as u
import matplotlib.pyplot as pl
from ipdb import set_trace as stop
def even(x):
return x%2 == 0
def zernike_parity(j, jp):
return even(j-jp)
def progressbar(curr... | 33.851163 | 151 | 0.591783 | import numpy as np
import h5py
import scipy.io as io
import poppy
import sys
import scipy.special as sp
import pyfftw
from astropy import units as u
import matplotlib.pyplot as pl
from ipdb import set_trace as stop
def even(x):
return x%2 == 0
def zernike_parity(j, jp):
return even(j-jp)
def progressbar(curr... | true | true |
1c283ece2b35345f2184e8633cfa61ff6c355178 | 12,474 | py | Python | otp/chat/ChatInputWhiteListFrame.py | SuperM0use24/TT-CL-Edition | fdad8394f0656ae122b687d603f72afafd220c65 | [
"MIT"
] | null | null | null | otp/chat/ChatInputWhiteListFrame.py | SuperM0use24/TT-CL-Edition | fdad8394f0656ae122b687d603f72afafd220c65 | [
"MIT"
] | 1 | 2021-06-08T17:16:48.000Z | 2021-06-08T17:16:48.000Z | otp/chat/ChatInputWhiteListFrame.py | SuperM0use24/TT-CL-Edition | fdad8394f0656ae122b687d603f72afafd220c65 | [
"MIT"
] | 3 | 2021-06-03T05:36:36.000Z | 2021-06-22T15:07:31.000Z | from direct.fsm import FSM
from otp.otpbase import OTPGlobals
import sys
from direct.directnotify import DirectNotifyGlobal
from direct.gui.DirectGui import *
from panda3d.core import *
from otp.otpbase import OTPLocalizer
from direct.task import Task
from otp.chat.ChatInputTyped import ChatInputTyped
from libotp impor... | 35.74212 | 236 | 0.579205 | from direct.fsm import FSM
from otp.otpbase import OTPGlobals
import sys
from direct.directnotify import DirectNotifyGlobal
from direct.gui.DirectGui import *
from panda3d.core import *
from otp.otpbase import OTPLocalizer
from direct.task import Task
from otp.chat.ChatInputTyped import ChatInputTyped
from libotp impor... | false | true |
1c283f265d63b24fdc4cf0bd623a8d195822582b | 857 | py | Python | setup.py | cdpierse/aitextgen | 64ca5234ba5a1e0136fc0a10ddbcc94226a51501 | [
"MIT"
] | 4 | 2020-07-10T09:42:35.000Z | 2020-09-27T17:19:49.000Z | setup.py | cdpierse/aitextgen | 64ca5234ba5a1e0136fc0a10ddbcc94226a51501 | [
"MIT"
] | null | null | null | setup.py | cdpierse/aitextgen | 64ca5234ba5a1e0136fc0a10ddbcc94226a51501 | [
"MIT"
] | null | null | null | from setuptools import setup
setup(
name="aitextgen",
packages=["aitextgen"], # this must be the same as the name above
version="0.1.2",
description="A robust Python tool for text-based AI training and generation using GPT-2.",
long_description=open("README.md", "r", encoding="utf-8").read(),
... | 32.961538 | 94 | 0.646441 | from setuptools import setup
setup(
name="aitextgen",
packages=["aitextgen"],
version="0.1.2",
description="A robust Python tool for text-based AI training and generation using GPT-2.",
long_description=open("README.md", "r", encoding="utf-8").read(),
long_description_content_type="text/markd... | true | true |
1c283f2cfaec2819a87681f0f66fc0a5e4517705 | 7,055 | py | Python | src/transformers/models/deberta_v2/configuration_deberta_v2.py | liminghao1630/transformers | 207594be81b8e5a8589c8b11c3b236924555d806 | [
"Apache-2.0"
] | 3 | 2021-12-27T20:13:38.000Z | 2021-12-28T14:11:20.000Z | src/transformers/models/deberta_v2/configuration_deberta_v2.py | liminghao1630/transformers | 207594be81b8e5a8589c8b11c3b236924555d806 | [
"Apache-2.0"
] | 2 | 2022-01-06T05:40:05.000Z | 2022-01-06T15:12:29.000Z | src/transformers/models/deberta_v2/configuration_deberta_v2.py | liminghao1630/transformers | 207594be81b8e5a8589c8b11c3b236924555d806 | [
"Apache-2.0"
] | 3 | 2022-01-06T04:44:13.000Z | 2022-02-18T23:35:21.000Z | # coding=utf-8
# Copyright 2020, Microsoft and the HuggingFace Inc. team.
#
# 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 require... | 50.755396 | 125 | 0.689298 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
logger = logging.get_logger(__name__)
DEBERTA_V2_PRETRAINED_CONFIG_ARCHIVE_MAP = {
"microsoft/deberta-v2-xlarge": "https://huggingface.co/microsoft/deberta-v2-xlarge/resolve/main/config.json",
"microsoft/deberta-v... | true | true |
1c283f7a4b53f58f634d5514f9cad7b224ab20eb | 2,674 | py | Python | moya/reader.py | moyaproject/moya | 78b91d87b4519f91dfdd2b40dab44e72f201a843 | [
"MIT"
] | 129 | 2015-02-16T12:02:50.000Z | 2021-11-06T00:20:01.000Z | moya/reader.py | liaohandel/moya | 78b91d87b4519f91dfdd2b40dab44e72f201a843 | [
"MIT"
] | 5 | 2015-02-19T15:56:41.000Z | 2015-09-08T18:58:35.000Z | moya/reader.py | liaohandel/moya | 78b91d87b4519f91dfdd2b40dab44e72f201a843 | [
"MIT"
] | 14 | 2015-02-19T17:20:34.000Z | 2022-03-28T01:38:09.000Z | from __future__ import unicode_literals, print_function
from fs.path import join, basename
from fs.errors import FSError
import mimetypes
import json
class ReaderError(Exception):
pass
class UnknownFormat(ReaderError):
"""Attempt to read a format we don't understand"""
class RelativePathError(ReaderErro... | 28.752688 | 81 | 0.537023 | from __future__ import unicode_literals, print_function
from fs.path import join, basename
from fs.errors import FSError
import mimetypes
import json
class ReaderError(Exception):
pass
class UnknownFormat(ReaderError):
class RelativePathError(ReaderError):
class DataReader(object):
def __init__(self,... | true | true |
1c284031361440a5ffc056fbc55de714a324849d | 6,473 | py | Python | test/functional/test_framework/blocktools.py | sistemkoin/stkcoin-project | 60f83901526ec014bc692c99c924c78272e927d8 | [
"MIT"
] | null | null | null | test/functional/test_framework/blocktools.py | sistemkoin/stkcoin-project | 60f83901526ec014bc692c99c924c78272e927d8 | [
"MIT"
] | null | null | null | test/functional/test_framework/blocktools.py | sistemkoin/stkcoin-project | 60f83901526ec014bc692c99c924c78272e927d8 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) 2015-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Utilities for manipulating blocks and transactions."""
from .address import (
key_to_p2sh_p2wpkh,
... | 37.416185 | 108 | 0.711726 |
from .address import (
key_to_p2sh_p2wpkh,
key_to_p2wpkh,
script_to_p2sh_p2wsh,
script_to_p2wsh,
)
from .mininode import *
from .script import (
CScript,
OP_0,
OP_1,
OP_CHECKMULTISIG,
OP_CHECKSIG,
OP_RETURN,
OP_TRUE,
hash160,
)
from .util import assert_equal
def cr... | true | true |
1c28404d7a492d0885a9063706f3933a81e8a2f2 | 1,258 | py | Python | examples/example2_basic_agent_no_processing.py | joriwinderickx-fm/pyngsi | 3876db4c7e8fd1351f3072476be73cb255ec340e | [
"Apache-2.0"
] | 13 | 2020-06-05T11:49:56.000Z | 2022-01-12T09:10:27.000Z | examples/example2_basic_agent_no_processing.py | joriwinderickx-fm/pyngsi | 3876db4c7e8fd1351f3072476be73cb255ec340e | [
"Apache-2.0"
] | 4 | 2020-06-17T10:16:44.000Z | 2021-07-13T11:42:39.000Z | examples/example2_basic_agent_no_processing.py | joriwinderickx-fm/pyngsi | 3876db4c7e8fd1351f3072476be73cb255ec340e | [
"Apache-2.0"
] | 5 | 2020-06-17T10:56:59.000Z | 2021-03-08T12:58:54.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This agent takes data from the standard input, performs a basic computation, eventually writes to the standard output.
# Note : a Sink expects a NGSI DataModel class as input. If it is not the case it simply writes the string representation of its input
# Use CTRL-D to ... | 38.121212 | 134 | 0.719396 |
from pyngsi.agent import NgsiAgent
from pyngsi.sources.source import Row
def basic_processing(data: Row):
_ = data.provider
return data.record.replace("ping", "pong")
def main():
agent = NgsiAgent.create_agent(process=basic_processing)
# We could have used a lambda,... | true | true |
1c28405217cae71b78220d6f8b844070565b60f4 | 3,367 | py | Python | examples/references/segmentation/pascal_voc2012/code/dataflow/datasets.py | nzare/ignite | 002b595daa8a8345286c5e096c33e278948686a7 | [
"BSD-3-Clause"
] | 1 | 2020-08-29T16:49:36.000Z | 2020-08-29T16:49:36.000Z | examples/references/segmentation/pascal_voc2012/code/dataflow/datasets.py | M3L6H/ignite | 002b595daa8a8345286c5e096c33e278948686a7 | [
"BSD-3-Clause"
] | 5 | 2020-08-29T16:49:48.000Z | 2020-08-29T17:05:54.000Z | examples/references/segmentation/pascal_voc2012/code/dataflow/datasets.py | M3L6H/ignite | 002b595daa8a8345286c5e096c33e278948686a7 | [
"BSD-3-Clause"
] | 1 | 2020-10-15T06:21:01.000Z | 2020-10-15T06:21:01.000Z | from typing import Type, Callable
import numpy as np
import cv2
from PIL import Image
from torch.utils.data import Dataset
from torchvision.datasets.voc import VOCSegmentation
from torchvision.datasets.sbd import SBDataset
class TransformedDataset(Dataset):
def __init__(self, ds: Dataset, transform_fn: Calla... | 29.278261 | 119 | 0.614791 | from typing import Type, Callable
import numpy as np
import cv2
from PIL import Image
from torch.utils.data import Dataset
from torchvision.datasets.voc import VOCSegmentation
from torchvision.datasets.sbd import SBDataset
class TransformedDataset(Dataset):
def __init__(self, ds: Dataset, transform_fn: Calla... | true | true |
1c2841870e0a80969710d699d8da6ed9cefadb8f | 497 | py | Python | fourbranches.py | umbrellagong/VHGPR | 859c135f8a18be0a7e679d44cf292c2825ccd09d | [
"MIT"
] | 3 | 2022-01-14T01:55:11.000Z | 2022-02-11T15:56:52.000Z | fourbranches.py | umbrellagong/VHGPR | 859c135f8a18be0a7e679d44cf292c2825ccd09d | [
"MIT"
] | null | null | null | fourbranches.py | umbrellagong/VHGPR | 859c135f8a18be0a7e679d44cf292c2825ccd09d | [
"MIT"
] | null | null | null | import numpy as np
def f(X):
return mean(X) + np.random.normal(0, std(X))
def mean(X, deviation=5):
X = np.array(X)
if X.ndim == 1:
X=np.atleast_2d(X)
X1 = 3 + 0.1*(X[:,0]-X[:,1])**2 - (X[:,0]+X[:,1])/np.sqrt(2)
X2 = 3 + 0.1*(X[:,0]-X[:,1])**2 + (X[:,0]+X[:,1])/np.sqrt(2)
X3 = (X[:,0]... | 27.611111 | 64 | 0.472837 | import numpy as np
def f(X):
return mean(X) + np.random.normal(0, std(X))
def mean(X, deviation=5):
X = np.array(X)
if X.ndim == 1:
X=np.atleast_2d(X)
X1 = 3 + 0.1*(X[:,0]-X[:,1])**2 - (X[:,0]+X[:,1])/np.sqrt(2)
X2 = 3 + 0.1*(X[:,0]-X[:,1])**2 + (X[:,0]+X[:,1])/np.sqrt(2)
X3 = (X[:,0]... | true | true |
1c2841b5688691194daf70dc0d57f686cc67ca3e | 8,550 | py | Python | electrum_sum/tests/test_revealer.py | jakesum/electrum-sum | f34ac3c042cf73e90acd0771b87f60b750b6c799 | [
"MIT"
] | 3 | 2020-09-02T08:49:37.000Z | 2021-11-05T12:31:47.000Z | electrum_sum/tests/test_revealer.py | jakesum/electrum-sum | f34ac3c042cf73e90acd0771b87f60b750b6c799 | [
"MIT"
] | 1 | 2021-05-04T13:47:57.000Z | 2021-05-04T13:47:57.000Z | electrum_sum/tests/test_revealer.py | jakesum/electrum-sum | f34ac3c042cf73e90acd0771b87f60b750b6c799 | [
"MIT"
] | 3 | 2020-09-21T02:55:02.000Z | 2021-04-07T06:05:13.000Z | from electrum_sum.plugins.revealer.revealer import RevealerPlugin
from . import SequentialTestCase
class TestRevealer(SequentialTestCase):
def test_version_0_noisemap(self):
versioned_seed = RevealerPlugin.get_versioned_seed_from_user_input('03b0c557d6d0d4308a3393851d78bd8c7861')
noise_map = Rev... | 231.081081 | 2,396 | 0.940819 | from electrum_sum.plugins.revealer.revealer import RevealerPlugin
from . import SequentialTestCase
class TestRevealer(SequentialTestCase):
def test_version_0_noisemap(self):
versioned_seed = RevealerPlugin.get_versioned_seed_from_user_input('03b0c557d6d0d4308a3393851d78bd8c7861')
noise_map = Rev... | true | true |
1c284278f87ec86b741b9d47daa3d79b9ab6345e | 838 | py | Python | python/53.maximum-subarray.py | kadaliao/leetcode | 32170b1c2ba24b3765d22f9379534651080bab26 | [
"MIT"
] | null | null | null | python/53.maximum-subarray.py | kadaliao/leetcode | 32170b1c2ba24b3765d22f9379534651080bab26 | [
"MIT"
] | null | null | null | python/53.maximum-subarray.py | kadaliao/leetcode | 32170b1c2ba24b3765d22f9379534651080bab26 | [
"MIT"
] | null | null | null | # [53] 最大子序和
# https://leetcode-cn.com/problems/maximum-subarray/description/
# * algorithms
# * Easy (52.58%)
# * Total Accepted: 349.6K
# * Total Submissions: 664.9K
# * Testcase Example: '[-2,1,-3,4,-1,2,1,-5,4]'
# 给定一个整数数组 nums ,找到一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和。
# 示例:
# 输入: [-2,1,-3,4,-1,2,1,-5,4]
# 输出:... | 20.95 | 64 | 0.526253 |
class Solution(object):
def maxSubArray(self, nums):
for i in range(1, len(nums)):
nums[i] = max(nums[i-1] + nums[i], nums[i])
return max(nums)
| true | true |
1c28436b3265ed2ddb8ee81f76e1f52cbdbb9e4a | 26,843 | py | Python | drutils/augmentation.py | lvxingvir/template | 089f5817e031a7c2b2d82e239158a6a5488b3b26 | [
"MIT"
] | null | null | null | drutils/augmentation.py | lvxingvir/template | 089f5817e031a7c2b2d82e239158a6a5488b3b26 | [
"MIT"
] | null | null | null | drutils/augmentation.py | lvxingvir/template | 089f5817e031a7c2b2d82e239158a6a5488b3b26 | [
"MIT"
] | null | null | null | """This file contains utility functions used for numpy-based input augmentation
TODO: make more general for 3D images
"""
import logging
import cv2
import random
import scipy.ndimage
from skimage.filters import threshold_otsu, gaussian
try:
import dicom
except:
import pydicom as dicom
import numpy as np
from ... | 36.72093 | 142 | 0.640577 |
import logging
import cv2
import random
import scipy.ndimage
from skimage.filters import threshold_otsu, gaussian
try:
import dicom
except:
import pydicom as dicom
import numpy as np
from io import BytesIO
from skimage.morphology import erosion, square, disk
from skimage import measure
logging.basicConfig(lev... | true | true |
1c2845b062e01961011e2df7760329783b76e2df | 2,920 | py | Python | api/app/decorators/paginate.py | HotMaps/Toolbox | ba1e287dbc63e34bf9feb80b65b02c1db93ce91c | [
"Apache-2.0"
] | 188 | 2015-01-01T08:54:26.000Z | 2022-03-25T17:50:07.000Z | api/app/decorators/paginate.py | HotMaps/Toolbox | ba1e287dbc63e34bf9feb80b65b02c1db93ce91c | [
"Apache-2.0"
] | 11 | 2017-11-09T22:23:50.000Z | 2017-11-30T16:40:22.000Z | api/app/decorators/paginate.py | HotMaps/Toolbox | ba1e287dbc63e34bf9feb80b65b02c1db93ce91c | [
"Apache-2.0"
] | 117 | 2015-01-11T23:49:04.000Z | 2022-03-01T16:20:57.000Z | import functools
from flask import url_for, request
def paginate(collection, max_per_page=25):
"""Generate a paginated response for a resource collection.
Routes that use this decorator must return a SQLAlchemy query as a
response.
The output of this decorator is a Python dictionary with the paginat... | 44.242424 | 78 | 0.521233 | import functools
from flask import url_for, request
def paginate(collection, max_per_page=25):
def decorator(f):
@functools.wraps(f)
def wrapped(*args, **kwargs):
query = f(*args, **kwargs)
page = request.args.get('page', 1, type=int)
... | true | true |
1c2845b97e576e52d3be063a9d78573fba0e0c2e | 3,310 | py | Python | samples/33 IJavaSourceUnit-IJavaCall.py | acbocai/jeb_script | 5d918a2abb7e50fbbb4c571122741d52b20959fd | [
"BSD-2-Clause"
] | 25 | 2020-10-27T11:26:02.000Z | 2022-03-31T01:40:20.000Z | samples/33 IJavaSourceUnit-IJavaCall.py | acbocai/jeb_script | 5d918a2abb7e50fbbb4c571122741d52b20959fd | [
"BSD-2-Clause"
] | null | null | null | samples/33 IJavaSourceUnit-IJavaCall.py | acbocai/jeb_script | 5d918a2abb7e50fbbb4c571122741d52b20959fd | [
"BSD-2-Clause"
] | 9 | 2020-12-10T20:13:23.000Z | 2022-03-04T07:09:14.000Z | # -*- coding: utf-8 -*-
from com.pnfsoftware.jeb.client.api import IClientContext
from com.pnfsoftware.jeb.core import IRuntimeProject
from com.pnfsoftware.jeb.core.units import IUnit
from com.pnfsoftware.jeb.core.units.code import IDecompilerUnit, DecompilationOptions, DecompilationContext
from com.pnfsoftware.jeb.cor... | 45.972222 | 123 | 0.626284 |
from com.pnfsoftware.jeb.client.api import IClientContext
from com.pnfsoftware.jeb.core import IRuntimeProject
from com.pnfsoftware.jeb.core.units import IUnit
from com.pnfsoftware.jeb.core.units.code import IDecompilerUnit, DecompilationOptions, DecompilationContext
from com.pnfsoftware.jeb.core.units.code.android im... | false | true |
1c2845e1066e678ed3816809a53de3d5727d87bd | 13,535 | py | Python | desktop/libs/hadoop/src/hadoop/job_tracker.py | mapr/hue | 84390cf8649feb34d74c574e771ea19410ecb970 | [
"Apache-2.0"
] | null | null | null | desktop/libs/hadoop/src/hadoop/job_tracker.py | mapr/hue | 84390cf8649feb34d74c574e771ea19410ecb970 | [
"Apache-2.0"
] | null | null | null | desktop/libs/hadoop/src/hadoop/job_tracker.py | mapr/hue | 84390cf8649feb34d74c574e771ea19410ecb970 | [
"Apache-2.0"
] | 4 | 2015-02-23T23:59:52.000Z | 2018-01-03T06:59:26.000Z | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | 33.09291 | 137 | 0.713557 |
from desktop.lib import thrift_util
from desktop.lib.conf import validate_port
from desktop.lib.exceptions import StructuredException
from desktop.lib.thrift_util import fixup_enums
from hadoop.api.jobtracker import Jobtracker
from hadoop.api.jobtracker.ttypes import ThriftJobID, ThriftTaskAttemptID... | false | true |
1c28468d3a7cb435118cb00c2d2ededf834bc12e | 1,123 | py | Python | rec/io/tests/coding_test.py | gergely-flamich/relative-entropy-coding | c99d90cabec4395de2d01d889bd2b7ed7b7453d7 | [
"MIT"
] | 14 | 2020-11-17T23:31:10.000Z | 2022-01-28T04:23:38.000Z | rec/io/tests/coding_test.py | gergely-flamich/relative-entropy-coding | c99d90cabec4395de2d01d889bd2b7ed7b7453d7 | [
"MIT"
] | null | null | null | rec/io/tests/coding_test.py | gergely-flamich/relative-entropy-coding | c99d90cabec4395de2d01d889bd2b7ed7b7453d7 | [
"MIT"
] | 1 | 2021-05-05T04:08:23.000Z | 2021-05-05T04:08:23.000Z | import time
import numpy as np
import tensorflow as tf
from rec.io.entropy_coding import ArithmeticCoder
num_symbols = 2**6
message_length = 2000
test_file_path = "scratch_compression_test.miracle"
P = np.ones(num_symbols + 1, dtype=np.int32)
P[1:] = np.random.choice(100, size=num_symbols) + 1
message = np.zeros(... | 23.893617 | 73 | 0.729297 | import time
import numpy as np
import tensorflow as tf
from rec.io.entropy_coding import ArithmeticCoder
num_symbols = 2**6
message_length = 2000
test_file_path = "scratch_compression_test.miracle"
P = np.ones(num_symbols + 1, dtype=np.int32)
P[1:] = np.random.choice(100, size=num_symbols) + 1
message = np.zeros(... | true | true |
1c28476b39a406b9ea6996a626c53d10048db537 | 1,129 | py | Python | src/c3nav/mapdata/utils/fields.py | johnjohndoe/c3nav | a17f863a3512e305595c16b0300796b6bae81241 | [
"Apache-2.0"
] | 132 | 2016-11-12T01:45:23.000Z | 2022-03-08T15:17:10.000Z | src/c3nav/mapdata/utils/fields.py | johnjohndoe/c3nav | a17f863a3512e305595c16b0300796b6bae81241 | [
"Apache-2.0"
] | 66 | 2016-09-29T09:46:19.000Z | 2022-03-11T23:26:18.000Z | src/c3nav/mapdata/utils/fields.py | johnjohndoe/c3nav | a17f863a3512e305595c16b0300796b6bae81241 | [
"Apache-2.0"
] | 42 | 2016-09-29T08:34:57.000Z | 2022-03-08T15:17:15.000Z | from django.core.exceptions import ObjectDoesNotExist
class LocationById():
def __init__(self):
super().__init__()
self.name = None
self.cached_id = None
self.cached_value = None
def __set_name__(self, owner, name):
self.name = name
def __get__(self, instance, own... | 30.513514 | 92 | 0.635961 | from django.core.exceptions import ObjectDoesNotExist
class LocationById():
def __init__(self):
super().__init__()
self.name = None
self.cached_id = None
self.cached_value = None
def __set_name__(self, owner, name):
self.name = name
def __get__(self, instance, own... | true | true |
1c2848f86652a64fa57a56293965d4425229b5a0 | 363 | py | Python | cfa.py | jmeyers314/astrophotoreduce | 814177f494bbe6bb7ef5cf1b09ab2083a119fa42 | [
"MIT"
] | 3 | 2018-06-14T19:11:05.000Z | 2021-05-04T09:52:27.000Z | cfa.py | jmeyers314/astrophotoreduce | 814177f494bbe6bb7ef5cf1b09ab2083a119fa42 | [
"MIT"
] | null | null | null | cfa.py | jmeyers314/astrophotoreduce | 814177f494bbe6bb7ef5cf1b09ab2083a119fa42 | [
"MIT"
] | null | null | null | import numpy as np
def make_cfa(img):
cfa = np.zeros_like(img[:,:,0])
y, x = np.mgrid[0:cfa.shape[0], 0:cfa.shape[1]]
Rloc = (np.mod(x, 2) == 0) & (np.mod(y, 2) == 0)
Gloc = np.mod(x+y, 2) == 1
Bloc = (np.mod(x, 2) == 1) & (np.mod(y, 2) == 1)
cfa[Rloc] = img[Rloc,0]
cfa[Gloc] = img[Gloc,1]
... | 27.923077 | 52 | 0.506887 | import numpy as np
def make_cfa(img):
cfa = np.zeros_like(img[:,:,0])
y, x = np.mgrid[0:cfa.shape[0], 0:cfa.shape[1]]
Rloc = (np.mod(x, 2) == 0) & (np.mod(y, 2) == 0)
Gloc = np.mod(x+y, 2) == 1
Bloc = (np.mod(x, 2) == 1) & (np.mod(y, 2) == 1)
cfa[Rloc] = img[Rloc,0]
cfa[Gloc] = img[Gloc,1]
... | true | true |
1c28493f1b86a940066892cf80f09d74b31f5a4f | 141 | py | Python | MCA/Machine Learning/mul_table.py | muhammadmuzzammil1998/CollegeStuff | 618cec9ebfbfd29a2d1e5a182b90cfb36b38a906 | [
"MIT"
] | 3 | 2018-03-13T12:34:51.000Z | 2018-10-02T18:54:22.000Z | MCA/Machine Learning/mul_table.py | muhammadmuzzammil1998/CollegeStuff | 618cec9ebfbfd29a2d1e5a182b90cfb36b38a906 | [
"MIT"
] | null | null | null | MCA/Machine Learning/mul_table.py | muhammadmuzzammil1998/CollegeStuff | 618cec9ebfbfd29a2d1e5a182b90cfb36b38a906 | [
"MIT"
] | null | null | null | import sys
x = int(sys.argv[1])
till = int(sys.argv[2])
for i in range(1, int(sys.argv[2])+1):
print("{} x {}\t= {}".format(x, i, x*i))
| 20.142857 | 44 | 0.546099 | import sys
x = int(sys.argv[1])
till = int(sys.argv[2])
for i in range(1, int(sys.argv[2])+1):
print("{} x {}\t= {}".format(x, i, x*i))
| true | true |
1c284a739bf3e96178dbfa87e383d32fe07a8522 | 4,088 | py | Python | app/models.py | geoffrey45/Movium | ef9067e3074da6656db6cc82616250d5f2f0ffbb | [
"MIT"
] | null | null | null | app/models.py | geoffrey45/Movium | ef9067e3074da6656db6cc82616250d5f2f0ffbb | [
"MIT"
] | null | null | null | app/models.py | geoffrey45/Movium | ef9067e3074da6656db6cc82616250d5f2f0ffbb | [
"MIT"
] | null | null | null | from . import db
from werkzeug.security import generate_password_hash,check_password_hash
from flask_login import UserMixin
from . import login_manager
from datetime import datetime
@login_manager.user_loader
def load_user(user_id):
return User.query.get(int(user_id))
class Movie:
def __init__(self,id,title,o... | 29.2 | 189 | 0.65093 | from . import db
from werkzeug.security import generate_password_hash,check_password_hash
from flask_login import UserMixin
from . import login_manager
from datetime import datetime
@login_manager.user_loader
def load_user(user_id):
return User.query.get(int(user_id))
class Movie:
def __init__(self,id,title,o... | true | true |
1c284b7a5dd76a02eb619b67d46de64032c4948c | 1,315 | py | Python | src/transformers/configuration_camembert.py | dom-s/transformers | 66ef8faf6ae805aeb4e71075d4da6eab7be3bc26 | [
"Apache-2.0"
] | 1 | 2020-03-06T02:41:33.000Z | 2020-03-06T02:41:33.000Z | src/transformers/configuration_camembert.py | BlueSkyBubble/transformers | 83446a88d902661fab12bf8c37a1aa2845cdca5f | [
"Apache-2.0"
] | null | null | null | src/transformers/configuration_camembert.py | BlueSkyBubble/transformers | 83446a88d902661fab12bf8c37a1aa2845cdca5f | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... | 33.717949 | 103 | 0.768821 |
import logging
from .configuration_roberta import RobertaConfig
logger = logging.getLogger(__name__)
CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP = {
"camembert-base": "https://s3.amazonaws.com/models.huggingface.co/bert/camembert-base-config.json",
}
class CamembertConfig(RobertaConfig):
pre... | true | true |
1c284b8e98df90d69167f643497a8f0231f1d211 | 11,202 | py | Python | sympy/combinatorics/graycode.py | lidavidm/sympy | 971aa94ee6d0774eacfb4aed6965195c4a59e104 | [
"BSD-3-Clause"
] | 26 | 2018-02-14T23:52:58.000Z | 2021-08-16T13:50:03.000Z | sympy/combinatorics/graycode.py | shashank-agg/sympy | ecf69893c0b9927ea7192113b2421d639aee6ffb | [
"BSD-3-Clause"
] | null | null | null | sympy/combinatorics/graycode.py | shashank-agg/sympy | ecf69893c0b9927ea7192113b2421d639aee6ffb | [
"BSD-3-Clause"
] | 10 | 2018-08-13T19:38:39.000Z | 2020-04-19T03:02:00.000Z | from __future__ import print_function, division
from sympy.core import Basic
from sympy.core.compatibility import xrange
import random
class GrayCode(Basic):
"""
A Gray code is essentially a Hamiltonian walk on
a n-dimensional cube with edge length of one.
The vertices of the cube are represented by... | 27.057971 | 80 | 0.524014 | from __future__ import print_function, division
from sympy.core import Basic
from sympy.core.compatibility import xrange
import random
class GrayCode(Basic):
_skip = False
_current = 0
_rank = None
def __new__(cls, n, *args, **kw_args):
if n < 1 or int(n) != n:
raise ValueError... | true | true |
1c284c52fd21b5c4de6ebdb7e124a1b239379caf | 1,488 | py | Python | tests/functional/markers/test_destructive_test.py | ScriptAutomate/pytest-salt-factories | 192e15a7e93eec694f59099021a4d4268a1ab1ea | [
"Apache-2.0"
] | null | null | null | tests/functional/markers/test_destructive_test.py | ScriptAutomate/pytest-salt-factories | 192e15a7e93eec694f59099021a4d4268a1ab1ea | [
"Apache-2.0"
] | null | null | null | tests/functional/markers/test_destructive_test.py | ScriptAutomate/pytest-salt-factories | 192e15a7e93eec694f59099021a4d4268a1ab1ea | [
"Apache-2.0"
] | null | null | null | """
tests.functional.markers.test_destructive_test
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test the ``@pytest.mark.destructive_test`` marker
"""
def test_run_destructive_skipped(pytester):
pytester.makepyfile(
"""
import pytest
@pytest.mark.destructive_test
def... | 24.393443 | 108 | 0.604839 |
def test_run_destructive_skipped(pytester):
pytester.makepyfile(
"""
import pytest
@pytest.mark.destructive_test
def test_one():
assert True
"""
)
res = pytester.runpytest()
res.assert_outcomes(skipped=1)
res.stdout.no_fnmatch_line("*PytestUnkno... | true | true |
1c284cb55710e8941a1089679746f89092c1f4cc | 896 | py | Python | examples/graph/atlas2.py | rakschahsa/networkx | 6cac55b1064c3c346665f9281680fa3b66442ad0 | [
"BSD-3-Clause"
] | 8 | 2019-05-29T09:38:30.000Z | 2021-01-20T03:36:59.000Z | examples/graph/atlas2.py | rakschahsa/networkx | 6cac55b1064c3c346665f9281680fa3b66442ad0 | [
"BSD-3-Clause"
] | 12 | 2021-03-09T03:01:16.000Z | 2022-03-11T23:59:36.000Z | examples/graph/atlas2.py | rakschahsa/networkx | 6cac55b1064c3c346665f9281680fa3b66442ad0 | [
"BSD-3-Clause"
] | 6 | 2019-01-30T07:12:55.000Z | 2020-02-22T23:21:04.000Z | #!/usr/bin/env python
"""
======
Atlas2
======
Write first 20 graphs from the graph atlas as graphviz dot files
Gn.dot where n=0,19.
"""
# Author: Aric Hagberg (hagberg@lanl.gov)
# Date: 2005-05-19 14:23:02 -0600 (Thu, 19 May 2005)
# Copyright (C) 2006-2018 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <... | 25.6 | 67 | 0.649554 |
import networkx as nx
from networkx.generators.atlas import graph_atlas_g
atlas = graph_atlas_g()[0:20]
for G in atlas:
print("graph %s has %d nodes with %d edges"
% (G.name, nx.number_of_nodes(G), nx.number_of_edges(G)))
A = nx.nx_agraph.to_agraph(G)
A.graph_attr['label'] = G.name
... | true | true |
1c284d953b2e929d35ab14f1c01c2b5e2d95d96a | 344 | py | Python | EDA/SRC/utils_/apis_tb.py | PabloEduardoMartinezPicazo/Bootcamp-DataScience-2021 | 0fa5288aec5fb14e3796877882e4f1ddc5ad4aea | [
"MIT"
] | null | null | null | EDA/SRC/utils_/apis_tb.py | PabloEduardoMartinezPicazo/Bootcamp-DataScience-2021 | 0fa5288aec5fb14e3796877882e4f1ddc5ad4aea | [
"MIT"
] | null | null | null | EDA/SRC/utils_/apis_tb.py | PabloEduardoMartinezPicazo/Bootcamp-DataScience-2021 | 0fa5288aec5fb14e3796877882e4f1ddc5ad4aea | [
"MIT"
] | null | null | null | #funciones para flasks para la lectura y el return del json
import pandas as pd
import numpy as np
import json
def read_json(fullpath):
with open(fullpath, "r") as json_file_readed:
json_readed = json.load(json_file_readed)
return json_readed
def return_json(filepath):
df = pd.read_csv(filepath)... | 24.571429 | 59 | 0.735465 |
import pandas as pd
import numpy as np
import json
def read_json(fullpath):
with open(fullpath, "r") as json_file_readed:
json_readed = json.load(json_file_readed)
return json_readed
def return_json(filepath):
df = pd.read_csv(filepath)
return df.to_json() | true | true |
1c284db8892ad7fe40d54e3b1fafa0d8ea0ff369 | 29,572 | py | Python | metadeploy/api/models.py | shibinkunnath/MetaDeploy | 0e1bfa1460279f6ab30b1e56b67a4ad78b1e7c94 | [
"BSD-3-Clause"
] | null | null | null | metadeploy/api/models.py | shibinkunnath/MetaDeploy | 0e1bfa1460279f6ab30b1e56b67a4ad78b1e7c94 | [
"BSD-3-Clause"
] | null | null | null | metadeploy/api/models.py | shibinkunnath/MetaDeploy | 0e1bfa1460279f6ab30b1e56b67a4ad78b1e7c94 | [
"BSD-3-Clause"
] | null | null | null | import logging
from statistics import median
from typing import Union
from asgiref.sync import async_to_sync
from colorfield.fields import ColorField
from cumulusci.core.config import FlowConfig
from cumulusci.core.flowrunner import (
FlowCoordinator,
PreflightFlowCoordinator,
StepSpec,
)
from cumulusci.co... | 33.264342 | 88 | 0.668808 | import logging
from statistics import median
from typing import Union
from asgiref.sync import async_to_sync
from colorfield.fields import ColorField
from cumulusci.core.config import FlowConfig
from cumulusci.core.flowrunner import (
FlowCoordinator,
PreflightFlowCoordinator,
StepSpec,
)
from cumulusci.co... | true | true |
1c284ed86e4f6aeadbfca54d7b5a4e3d3ce3d909 | 1,593 | py | Python | u24_lymphocyte/third_party/treeano/sandbox/nodes/guided_backprop.py | ALSM-PhD/quip_classification | 7347bfaa5cf11ae2d7a528fbcc43322a12c795d3 | [
"BSD-3-Clause"
] | 45 | 2015-04-26T04:45:51.000Z | 2022-01-24T15:03:55.000Z | u24_lymphocyte/third_party/treeano/sandbox/nodes/guided_backprop.py | ALSM-PhD/quip_classification | 7347bfaa5cf11ae2d7a528fbcc43322a12c795d3 | [
"BSD-3-Clause"
] | 8 | 2018-07-20T20:54:51.000Z | 2020-06-12T05:36:04.000Z | u24_lymphocyte/third_party/treeano/sandbox/nodes/guided_backprop.py | ALSM-PhD/quip_classification | 7347bfaa5cf11ae2d7a528fbcc43322a12c795d3 | [
"BSD-3-Clause"
] | 22 | 2018-05-21T23:57:20.000Z | 2022-02-21T00:48:32.000Z | """
from "Striving for Simplicity - The All Convolutional Net"
http://arxiv.org/abs/1412.6806
"""
import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn
import treeano.sandbox.utils
import canopy
class _GuidedBackprop(treeano.sandbox.utils.OverwriteGrad):
"""
based on Lasagne Rec... | 26.114754 | 79 | 0.679849 |
import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn
import treeano.sandbox.utils
import canopy
class _GuidedBackprop(treeano.sandbox.utils.OverwriteGrad):
def grad(self, inputs, out_grads):
(inp,) = inputs
(grd,) = out_grads
dtype = inp.dtype
retur... | true | true |
1c284f8a117908ba6abe13fbd7c6a5552a17a17b | 635 | py | Python | atlassian_connect_django/rest_framework/migrations/0002_auto_securitycontexttoken.py | gerasev-kirill/atlassian-connect-django | cd44232df512691d9ec14722c38785cf802862e9 | [
"MIT"
] | null | null | null | atlassian_connect_django/rest_framework/migrations/0002_auto_securitycontexttoken.py | gerasev-kirill/atlassian-connect-django | cd44232df512691d9ec14722c38785cf802862e9 | [
"MIT"
] | null | null | null | atlassian_connect_django/rest_framework/migrations/0002_auto_securitycontexttoken.py | gerasev-kirill/atlassian-connect-django | cd44232df512691d9ec14722c38785cf802862e9 | [
"MIT"
] | null | null | null | # Generated by Django 3.1.2 on 2020-11-08 05:52
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('atlassian_connect_django', '0001_initial'),
('atlassian_connect_django_rest_framework', '0001_initial'),
]
... | 30.238095 | 167 | 0.696063 |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('atlassian_connect_django', '0001_initial'),
('atlassian_connect_django_rest_framework', '0001_initial'),
]
operations = [
migrations.AlterField(
... | true | true |
1c28501fa755155da0613b7b179976bc8f69a8c9 | 256 | py | Python | mvp/mvp/views/base_view.py | 2110521-2563-1-Software-Architecture/four-guys-one-cup-assignment3 | fb771f7521a15aea5c5b563ff87dbcd83edbec77 | [
"MIT"
] | null | null | null | mvp/mvp/views/base_view.py | 2110521-2563-1-Software-Architecture/four-guys-one-cup-assignment3 | fb771f7521a15aea5c5b563ff87dbcd83edbec77 | [
"MIT"
] | null | null | null | mvp/mvp/views/base_view.py | 2110521-2563-1-Software-Architecture/four-guys-one-cup-assignment3 | fb771f7521a15aea5c5b563ff87dbcd83edbec77 | [
"MIT"
] | null | null | null | import wx
class BaseView(wx.Frame):
def __init__(self, title):
wx.Frame.__init__(self, None, wx.ID_ANY, title, size=(500, 400))
def init_ui(self):
pass
def set_presenter(self, presenter):
self.presenter = presenter
| 18.285714 | 72 | 0.636719 | import wx
class BaseView(wx.Frame):
def __init__(self, title):
wx.Frame.__init__(self, None, wx.ID_ANY, title, size=(500, 400))
def init_ui(self):
pass
def set_presenter(self, presenter):
self.presenter = presenter
| true | true |
1c2850260437806ed0b91404df3e38769d2785e5 | 7,879 | py | Python | airflow/contrib/hooks/sftp_hook.py | ganeshsrirams/airflow | b8c02632136320b8379956411134246cd2f6eb47 | [
"Apache-2.0"
] | 1 | 2019-10-12T09:40:06.000Z | 2019-10-12T09:40:06.000Z | airflow/contrib/hooks/sftp_hook.py | ganeshsrirams/airflow | b8c02632136320b8379956411134246cd2f6eb47 | [
"Apache-2.0"
] | null | null | null | airflow/contrib/hooks/sftp_hook.py | ganeshsrirams/airflow | b8c02632136320b8379956411134246cd2f6eb47 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
#
# 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
#... | 36.308756 | 87 | 0.593984 |
import datetime
import stat
import pysftp
from airflow.contrib.hooks.ssh_hook import SSHHook
class SFTPHook(SSHHook):
def __init__(self, ftp_conn_id='sftp_default', *args, **kwargs):
kwargs['ssh_conn_id'] = ftp_conn_id
super().__init__(*args, **kwargs)
self.conn = No... | true | true |
1c2850cb0613041302455d674487343bc12d648c | 20,108 | py | Python | sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificates_operations.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 8 | 2021-01-13T23:44:08.000Z | 2021-03-17T10:13:36.000Z | sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificates_operations.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 226 | 2019-07-24T07:57:21.000Z | 2019-10-15T01:07:24.000Z | sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificates_operations.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 5 | 2020-05-09T17:47:09.000Z | 2020-10-01T19:52:06.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 ... | 45.7 | 174 | 0.661926 |
import uuid
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
from .. import models
class CertificatesOperations(object):
models = models
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._ser... | true | true |
1c2850df4f9ce764ce3104fbbe8ccf8fed35d1b3 | 910 | py | Python | src/zope/app/error/tests.py | zopefoundation/zope.app.error | 913db8992c7ab0b3f6a396058c88b752699909db | [
"ZPL-2.1"
] | null | null | null | src/zope/app/error/tests.py | zopefoundation/zope.app.error | 913db8992c7ab0b3f6a396058c88b752699909db | [
"ZPL-2.1"
] | 2 | 2017-05-15T15:58:10.000Z | 2018-11-08T07:37:02.000Z | src/zope/app/error/tests.py | zopefoundation/zope.app.error | 913db8992c7ab0b3f6a396058c88b752699909db | [
"ZPL-2.1"
] | 1 | 2015-04-03T07:38:12.000Z | 2015-04-03T07:38:12.000Z | ##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# TH... | 32.5 | 78 | 0.594505 | true | true | |
1c28511422146801ff4948980ae7b935e4d9cfcb | 1,481 | py | Python | KRIS/kris1/Poll.py | indah45/KRIS3 | d8dbd281f410bef4bc22231ad899149fa0f8e617 | [
"MIT"
] | null | null | null | KRIS/kris1/Poll.py | indah45/KRIS3 | d8dbd281f410bef4bc22231ad899149fa0f8e617 | [
"MIT"
] | null | null | null | KRIS/kris1/Poll.py | indah45/KRIS3 | d8dbd281f410bef4bc22231ad899149fa0f8e617 | [
"MIT"
] | null | null | null | import os, sys, time
path = os.path.join(os.path.dirname(__file__), '../lib/')
sys.path.insert(0, path)
from thrift.transport import THttpClient
from thrift.protocol import TCompactProtocol
from curve import LineService
from curve.ttypes import *
class Poll:
client = None
auth_query_path = "/api/v4/TalkService... | 27.425926 | 99 | 0.659689 | import os, sys, time
path = os.path.join(os.path.dirname(__file__), '../lib/')
sys.path.insert(0, path)
from thrift.transport import THttpClient
from thrift.protocol import TCompactProtocol
from curve import LineService
from curve.ttypes import *
class Poll:
client = None
auth_query_path = "/api/v4/TalkService... | true | true |
1c28511f355b84b38aeec6e89c55d105f0c11ab1 | 1,447 | py | Python | src/external_api/endpoints/proxy_endpoint.py | hvuhsg/OpenAPIGateway | 76413c69e2f35a2febf899f161ddc4da4b0ea354 | [
"MIT"
] | 1 | 2022-01-29T17:50:38.000Z | 2022-01-29T17:50:38.000Z | src/external_api/endpoints/proxy_endpoint.py | hvuhsg/OpenAPIGateway | 76413c69e2f35a2febf899f161ddc4da4b0ea354 | [
"MIT"
] | null | null | null | src/external_api/endpoints/proxy_endpoint.py | hvuhsg/OpenAPIGateway | 76413c69e2f35a2febf899f161ddc4da4b0ea354 | [
"MIT"
] | null | null | null | from functools import lru_cache
from fastapi import APIRouter, Request as FastAPIRequest, HTTPException, status
from context import get_services
from models.request import Request
from middleware_core import middleware_chain_builder
from middlewares.proxy_middleware import ProxyMiddleware
from middlewares.openapi_val... | 30.787234 | 98 | 0.775397 | from functools import lru_cache
from fastapi import APIRouter, Request as FastAPIRequest, HTTPException, status
from context import get_services
from models.request import Request
from middleware_core import middleware_chain_builder
from middlewares.proxy_middleware import ProxyMiddleware
from middlewares.openapi_val... | true | true |
1c285174355acac1e6a32eeff004b5c0b12e2dbf | 12,260 | py | Python | e2e_tests/tests/model_hub/test_transformers.py | RehanSD/determined | 693ded3b09602f0682f95e5e6ca0aa8650dbfdeb | [
"Apache-2.0"
] | null | null | null | e2e_tests/tests/model_hub/test_transformers.py | RehanSD/determined | 693ded3b09602f0682f95e5e6ca0aa8650dbfdeb | [
"Apache-2.0"
] | null | null | null | e2e_tests/tests/model_hub/test_transformers.py | RehanSD/determined | 693ded3b09602f0682f95e5e6ca0aa8650dbfdeb | [
"Apache-2.0"
] | null | null | null | import os
import subprocess
from typing import Dict
import pytest
from tests import config as conf
from tests import experiment as exp
def set_docker_image(config: Dict) -> Dict:
git_short_hash = subprocess.check_output(["git", "rev-parse", "--short", "HEAD"]).strip()
git_short_hash = git_short_hash.decode(... | 42.71777 | 93 | 0.759462 | import os
import subprocess
from typing import Dict
import pytest
from tests import config as conf
from tests import experiment as exp
def set_docker_image(config: Dict) -> Dict:
git_short_hash = subprocess.check_output(["git", "rev-parse", "--short", "HEAD"]).strip()
git_short_hash = git_short_hash.decode(... | true | true |
1c2852486f25f931d1915cb667eaa077edde1872 | 8,576 | py | Python | usmqe_carbon_mock_data_generator.py | dahorak/usmqe-carbon-mock-data-generator | 462d508a07daf5fe68d56ab1aa5348b19a20db88 | [
"Apache-2.0"
] | 1 | 2018-07-24T12:12:04.000Z | 2018-07-24T12:12:04.000Z | usmqe_carbon_mock_data_generator.py | dahorak/usmqe-carbon-mock-data-generator | 462d508a07daf5fe68d56ab1aa5348b19a20db88 | [
"Apache-2.0"
] | null | null | null | usmqe_carbon_mock_data_generator.py | dahorak/usmqe-carbon-mock-data-generator | 462d508a07daf5fe68d56ab1aa5348b19a20db88 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
"""
Scripts for creating mock data for carbon/grafana for Tendrl.
based on: https://github.com/cloudbehl/carbon-random
"""
import argparse
import datetime
import logging
import sys
from pprint import pformat
import yaml
import usmqe_cmdg.carbon_client
# configure logging
logging.basicConfig... | 38.285714 | 107 | 0.597598 |
import argparse
import datetime
import logging
import sys
from pprint import pformat
import yaml
import usmqe_cmdg.carbon_client
logging.basicConfig(level=logging.DEBUG, \
format='#%(levelname)-7s: %(message)s')
logging.getLogger().setLevel(logging.WARNING)
LOGGER = logging.getLogger("usmqe_cmdg")
LOGGER... | true | true |
1c28524c16029429efbae68449561a951712ce2f | 8,463 | py | Python | CondCore/ESSources/test/python/load_record_empty_source_cfg.py | pasmuss/cmssw | 566f40c323beef46134485a45ea53349f59ae534 | [
"Apache-2.0"
] | null | null | null | CondCore/ESSources/test/python/load_record_empty_source_cfg.py | pasmuss/cmssw | 566f40c323beef46134485a45ea53349f59ae534 | [
"Apache-2.0"
] | null | null | null | CondCore/ESSources/test/python/load_record_empty_source_cfg.py | pasmuss/cmssw | 566f40c323beef46134485a45ea53349f59ae534 | [
"Apache-2.0"
] | null | null | null | import time
import FWCore.ParameterSet.Config as cms
import FWCore.ParameterSet.VarParsing as VarParsing
options = VarParsing.VarParsing()
options.register('connectionString',
'frontier://FrontierProd/CMS_CONDITIONS', #default value
VarParsing.VarParsing.multiplicity.singleton,
... | 50.981928 | 177 | 0.569302 | import time
import FWCore.ParameterSet.Config as cms
import FWCore.ParameterSet.VarParsing as VarParsing
options = VarParsing.VarParsing()
options.register('connectionString',
'frontier://FrontierProd/CMS_CONDITIONS',
VarParsing.VarParsing.multiplicity.singleton,
Va... | false | true |
1c285286a29365934faf56882b76eaed4f587c6e | 531 | py | Python | Python/WebRecon/Util/Utilities.py | gb21oc/Projetos_Basicos | b88106b070039372865bf0ec3d0a00d95a41200b | [
"MIT"
] | 3 | 2022-01-03T11:02:47.000Z | 2022-01-10T23:50:12.000Z | Python/WebRecon/Util/Utilities.py | desecsecurity/Projetos_Basicos | b12ecbc637f6fba991ca2995ae479fa41b84131d | [
"MIT"
] | 1 | 2022-03-20T08:03:34.000Z | 2022-03-20T08:03:34.000Z | Python/WebRecon/Util/Utilities.py | desecsecurity/Projetos_Basicos | b12ecbc637f6fba991ca2995ae479fa41b84131d | [
"MIT"
] | 2 | 2022-01-03T11:02:36.000Z | 2022-01-08T22:25:00.000Z | from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
class Utilities:
def __init__(self, driver=None):
self.driver = driver
def checkExistsXpath(self): # Consulta Invalida / Invalid Query
try:
text = self.driver.find_element... | 31.235294 | 113 | 0.647834 | from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
class Utilities:
def __init__(self, driver=None):
self.driver = driver
def checkExistsXpath(self):
try:
text = self.driver.find_element(By.XPATH, "//html/body/div/main/se... | true | true |
1c285306884bf2f0310d8b4f94a4ae2f772fe04f | 3,692 | py | Python | lib/spack/external/py/_process/forkedfunc.py | kkauder/spack | 6ae8d5c380c1f42094b05d38be26b03650aafb39 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 6,989 | 2017-07-18T06:23:18.000Z | 2022-03-31T15:58:36.000Z | lib/spack/external/py/_process/forkedfunc.py | kkauder/spack | 6ae8d5c380c1f42094b05d38be26b03650aafb39 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 13,838 | 2017-11-04T07:49:45.000Z | 2022-03-31T23:38:39.000Z | lib/spack/external/py/_process/forkedfunc.py | kkauder/spack | 6ae8d5c380c1f42094b05d38be26b03650aafb39 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 1,793 | 2017-11-04T07:45:50.000Z | 2022-03-30T14:31:53.000Z |
"""
ForkedFunc provides a way to run a function in a forked process
and get at its return value, stdout and stderr output as well
as signals and exitstatusus.
"""
import py
import os
import sys
import marshal
def get_unbuffered_io(fd, filename):
f = open(str(filename), "w")
if fd != f.fileno():
... | 30.512397 | 68 | 0.560672 |
import py
import os
import sys
import marshal
def get_unbuffered_io(fd, filename):
f = open(str(filename), "w")
if fd != f.fileno():
os.dup2(f.fileno(), fd)
class AutoFlush:
def write(self, data):
f.write(data)
f.flush()
def __getattr__(self, name):
... | true | true |
1c285373296a46c0ebf67ba14a3edc71edcd1913 | 689 | py | Python | mmaction/models/losses/nll_loss.py | HypnosXC/mmaction2 | a26d5f981449445a5e22a0a60d8b285e06c3dd6e | [
"Apache-2.0"
] | 549 | 2020-01-02T05:14:57.000Z | 2022-03-29T18:34:12.000Z | mmaction/models/losses/nll_loss.py | xumingze0308/mmaction2 | 777546f27f8f5a3c83e10d966e2149be2fc9fa31 | [
"Apache-2.0"
] | 98 | 2020-01-21T09:41:30.000Z | 2022-03-12T00:53:06.000Z | mmaction/models/losses/nll_loss.py | xumingze0308/mmaction2 | 777546f27f8f5a3c83e10d966e2149be2fc9fa31 | [
"Apache-2.0"
] | 233 | 2020-01-18T03:46:27.000Z | 2022-03-19T03:17:47.000Z | import torch.nn.functional as F
from ..registry import LOSSES
from .base import BaseWeightedLoss
@LOSSES.register_module()
class NLLLoss(BaseWeightedLoss):
"""NLL Loss.
It will calculate NLL loss given cls_score and label.
"""
def _forward(self, cls_score, label, **kwargs):
"""Forward funct... | 25.518519 | 74 | 0.637155 | import torch.nn.functional as F
from ..registry import LOSSES
from .base import BaseWeightedLoss
@LOSSES.register_module()
class NLLLoss(BaseWeightedLoss):
def _forward(self, cls_score, label, **kwargs):
loss_cls = F.nll_loss(cls_score, label, **kwargs)
return loss_cls
| true | true |
1c2853bf558268a087b9f02f45931ef1c539c9b1 | 4,822 | py | Python | floodsystem/geo.py | oscarliu666/partia-flood-warning-system | 51b9e35266ab9f45f5b32593b93f0c90a3ec55b0 | [
"MIT"
] | null | null | null | floodsystem/geo.py | oscarliu666/partia-flood-warning-system | 51b9e35266ab9f45f5b32593b93f0c90a3ec55b0 | [
"MIT"
] | null | null | null | floodsystem/geo.py | oscarliu666/partia-flood-warning-system | 51b9e35266ab9f45f5b32593b93f0c90a3ec55b0 | [
"MIT"
] | null | null | null | # Copyright (C) 2018 Garth N. Wells
#
# SPDX-License-Identifier: MIT
"""This module contains a collection of functions related to
geographical data.
"""
from .utils import sorted_by_key # noqa
from floodsystem.stationdata import build_station_list
from math import radians, cos, sin, asin, sqrt
def haversine(point... | 37.671875 | 161 | 0.67192 |
from .utils import sorted_by_key
from floodsystem.stationdata import build_station_list
from math import radians, cos, sin, asin, sqrt
def haversine(point1, point2, unit='km'):
TH_RADIUS_KM = 6371.0088
conversions = {'km': 1,
'm': 1000,
'mi': 0.621371192,
... | true | true |
1c2855e17188fe18b8839a52116c4d74d820e98b | 4,101 | py | Python | src/core/command.py | SecureThemAll/cb-repair | 3d1d4422e9a9ab459641e1ca759e3b73887d2950 | [
"MIT"
] | null | null | null | src/core/command.py | SecureThemAll/cb-repair | 3d1d4422e9a9ab459641e1ca759e3b73887d2950 | [
"MIT"
] | null | null | null | src/core/command.py | SecureThemAll/cb-repair | 3d1d4422e9a9ab459641e1ca759e3b73887d2950 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import subprocess
import psutil
from os import environ
from sys import stderr
from typing import Union, AnyStr, Tuple, List
from pathlib import Path
from threading import Timer
from .kernel import Kernel
from utils.ui.terminal import TermPrint
class Command:
def __init__(self, name: str, ... | 28.282759 | 111 | 0.539624 |
import subprocess
import psutil
from os import environ
from sys import stderr
from typing import Union, AnyStr, Tuple, List
from pathlib import Path
from threading import Timer
from .kernel import Kernel
from utils.ui.terminal import TermPrint
class Command:
def __init__(self, name: str, kernel: Kernel, log_fi... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.