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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f757e3a3ecd49790a18aa937c628db10addf534d | 671 | py | Python | 00/92.py | shuowangphd/lcpy | 18e11bf7ca77acacadeeef93bf6b7f1667eae2cd | [
"MIT"
] | null | null | null | 00/92.py | shuowangphd/lcpy | 18e11bf7ca77acacadeeef93bf6b7f1667eae2cd | [
"MIT"
] | null | null | null | 00/92.py | shuowangphd/lcpy | 18e11bf7ca77acacadeeef93bf6b7f1667eae2cd | [
"MIT"
] | null | null | null | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def reverseBetween(self, head: Optional[ListNode], left: int, right: int) -> Optional[ListNode]:
if left == right: return head
fh = L... | 30.5 | 100 | 0.536513 | class Solution:
def reverseBetween(self, head: Optional[ListNode], left: int, right: int) -> Optional[ListNode]:
if left == right: return head
fh = ListNode(next = head)
nd = fh
for _ in range(left-1):
nd = nd.next
n1 = nd
n2 = nd.next
nd = nd.next... | true | true |
f757e487548d730609a2e5c6b3944b2cc3ad1623 | 2,155 | py | Python | nbs/utils/args.py | coyotevz/nobix-app | 9523d150e0299b851779f42927992810184e862d | [
"MIT"
] | null | null | null | nbs/utils/args.py | coyotevz/nobix-app | 9523d150e0299b851779f42927992810184e862d | [
"MIT"
] | null | null | null | nbs/utils/args.py | coyotevz/nobix-app | 9523d150e0299b851779f42927992810184e862d | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from flask import request
from marshmallow import Schema, fields
from marshmallow.compat import text_type as _text_type
from webargs.flaskparser import FlaskParser, abort as _abort
import warnings
FIELD_MAPPING = {
# type, [use_function] (preprocessing)
fields.Integer: (int, None),
... | 28.355263 | 77 | 0.654756 |
from flask import request
from marshmallow import Schema, fields
from marshmallow.compat import text_type as _text_type
from webargs.flaskparser import FlaskParser, abort as _abort
import warnings
FIELD_MAPPING = {
fields.Integer: (int, None),
fields.Number: (int, None),
fields.Float: (float, None),
... | true | true |
f757e54c56242d7bc9d5d7a5411ac4157d348204 | 214 | py | Python | tests/data/importer/pkg_like_ansible/module_utils/sys_distro/__init__.py | webcoast-dk/mitogen | a5fe4a9fac5561511b676fe61ed127b732be5b12 | [
"BSD-3-Clause"
] | 1,526 | 2017-09-15T18:49:40.000Z | 2021-01-17T16:04:12.000Z | tests/data/importer/pkg_like_ansible/module_utils/sys_distro/__init__.py | webcoast-dk/mitogen | a5fe4a9fac5561511b676fe61ed127b732be5b12 | [
"BSD-3-Clause"
] | 682 | 2017-09-11T17:43:12.000Z | 2021-01-17T05:26:26.000Z | tests/data/importer/pkg_like_ansible/module_utils/sys_distro/__init__.py | webcoast-dk/mitogen | a5fe4a9fac5561511b676fe61ed127b732be5b12 | [
"BSD-3-Clause"
] | 111 | 2017-09-15T23:21:37.000Z | 2021-01-01T14:45:35.000Z | # #590: a subpackage that turns itself into a module from elsewhere on sys.path.
I_AM = "the subpackage that was replaced with a system module"
import sys
import system_distro
sys.modules[__name__] = system_distro
| 35.666667 | 80 | 0.794393 | I_AM = "the subpackage that was replaced with a system module"
import sys
import system_distro
sys.modules[__name__] = system_distro
| true | true |
f757e57697e197e86174c1b3ca8df5279c84f8f1 | 20,260 | py | Python | datadog_checks_dev/datadog_checks/dev/tooling/utils.py | abraham-leal/integrations-core | 5062702ddae5314f504e6161c7720a1fcde777ea | [
"BSD-3-Clause"
] | 663 | 2016-08-23T05:23:45.000Z | 2022-03-29T00:37:23.000Z | datadog_checks_dev/datadog_checks/dev/tooling/utils.py | abraham-leal/integrations-core | 5062702ddae5314f504e6161c7720a1fcde777ea | [
"BSD-3-Clause"
] | 6,642 | 2016-06-09T16:29:20.000Z | 2022-03-31T22:24:09.000Z | datadog_checks_dev/datadog_checks/dev/tooling/utils.py | abraham-leal/integrations-core | 5062702ddae5314f504e6161c7720a1fcde777ea | [
"BSD-3-Clause"
] | 1,222 | 2017-01-27T15:51:38.000Z | 2022-03-31T18:17:51.000Z | # (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import csv
import io
import json
import os
import re
from ast import literal_eval
from datetime import datetime, timezone
from json.decoder import JSONDecodeError
import requests
import semver
import yaml... | 30.466165 | 119 | 0.669497 | import csv
import io
import json
import os
import re
from ast import literal_eval
from datetime import datetime, timezone
from json.decoder import JSONDecodeError
import requests
import semver
import yaml
from datadog_checks.dev.tooling.catalog_const import (
DOGWEB_JSON_DASHBOARDS,
INTEGRATION_LOGS_NOT_POSSI... | true | true |
f757e586adff2b4d08b1da0d4c5473e9607c79a5 | 703 | py | Python | lib/tool/table_ddl/split_to_words.py | auho/python-ETL | 761589814b04e076ba6fa1c0e64b83ce62ce8556 | [
"Apache-2.0"
] | null | null | null | lib/tool/table_ddl/split_to_words.py | auho/python-ETL | 761589814b04e076ba6fa1c0e64b83ce62ce8556 | [
"Apache-2.0"
] | null | null | null | lib/tool/table_ddl/split_to_words.py | auho/python-ETL | 761589814b04e076ba6fa1c0e64b83ce62ce8556 | [
"Apache-2.0"
] | null | null | null | from .interface import TableDDl
from lib.db.ddl import mysql
class Table(TableDDl):
def __init__(self, table_name, content_name, keyid, suffix='words'):
self._tableName = table_name + '_' + content_name + '_' + suffix
self._keyid = keyid
self.DDLTable = None # type: mysql.DDLBuild
... | 28.12 | 72 | 0.661451 | from .interface import TableDDl
from lib.db.ddl import mysql
class Table(TableDDl):
def __init__(self, table_name, content_name, keyid, suffix='words'):
self._tableName = table_name + '_' + content_name + '_' + suffix
self._keyid = keyid
self.DDLTable = None
self._init()
def... | true | true |
f757e5914daed30701a40ef1bf074e2481036d72 | 1,601 | py | Python | setup.py | lhoenig/yolk | 51da3672831e7781aeb39ccd95f6369597e97b0a | [
"BSD-3-Clause"
] | 62 | 2015-01-02T19:58:48.000Z | 2022-01-12T14:20:12.000Z | setup.py | lhoenig/yolk | 51da3672831e7781aeb39ccd95f6369597e97b0a | [
"BSD-3-Clause"
] | 22 | 2015-03-16T17:27:54.000Z | 2021-05-29T16:53:51.000Z | setup.py | lhoenig/yolk | 51da3672831e7781aeb39ccd95f6369597e97b0a | [
"BSD-3-Clause"
] | 11 | 2015-05-26T14:23:16.000Z | 2022-01-21T13:19:10.000Z | #!/usr/bin/env python
"""Installer for yolk."""
import ast
from setuptools import setup
def version():
"""Return version string."""
with open('yolk/__init__.py') as input_file:
for line in input_file:
if line.startswith('__version__'):
return ast.parse(line).body[0].valu... | 33.354167 | 78 | 0.56777 |
import ast
from setuptools import setup
def version():
with open('yolk/__init__.py') as input_file:
for line in input_file:
if line.startswith('__version__'):
return ast.parse(line).body[0].value.s
with open('README.rst') as readme:
setup(
name='yolk3k',
... | true | true |
f757e5f8c73ab74b56ad9c1904009499df30bb03 | 699 | py | Python | shapemodel.py | elecun/pyface | 47d7d4b6b163492c5c4dfc1ec45b05391dd98a64 | [
"MIT"
] | null | null | null | shapemodel.py | elecun/pyface | 47d7d4b6b163492c5c4dfc1ec45b05391dd98a64 | [
"MIT"
] | null | null | null | shapemodel.py | elecun/pyface | 47d7d4b6b163492c5c4dfc1ec45b05391dd98a64 | [
"MIT"
] | null | null | null | # -*- coding:utf-8 -*-
from pyFaceAlign.filereader import ptsReader
import pyFaceAlign.plot as plot
from pyFaceAlign.normalization import kabsch2D
import numpy as np
if __name__ == "__main__":
# 1. read all pts file to create shape model
filereader = ptsReader("./dataset")
landmarks = filereader.read()
... | 30.391304 | 73 | 0.736767 |
from pyFaceAlign.filereader import ptsReader
import pyFaceAlign.plot as plot
from pyFaceAlign.normalization import kabsch2D
import numpy as np
if __name__ == "__main__":
filereader = ptsReader("./dataset")
landmarks = filereader.read()
print("Read ", landmarks.shape, " dimension of landmark data files... | true | true |
f757e5fb9fbb2d3a6a605238d7f555aac1e1672d | 7,165 | py | Python | napari/plugins/_npe2.py | MosGeo/napari | 83e63fb628c5d52887a54324bf6745d63750752b | [
"BSD-3-Clause"
] | 1,345 | 2019-03-03T21:14:14.000Z | 2022-03-31T19:46:39.000Z | napari/plugins/_npe2.py | MosGeo/napari | 83e63fb628c5d52887a54324bf6745d63750752b | [
"BSD-3-Clause"
] | 3,904 | 2019-03-02T01:30:24.000Z | 2022-03-31T20:17:27.000Z | napari/plugins/_npe2.py | MosGeo/napari | 83e63fb628c5d52887a54324bf6745d63750752b | [
"BSD-3-Clause"
] | 306 | 2019-03-29T17:09:10.000Z | 2022-03-30T09:54:11.000Z | from __future__ import annotations
from contextlib import suppress
from typing import (
TYPE_CHECKING,
Callable,
DefaultDict,
Dict,
Iterable,
Iterator,
List,
Optional,
Sequence,
Tuple,
Union,
)
try:
import npe2
from npe2.io_utils import read_get_reader
from npe2... | 29.854167 | 79 | 0.641033 | from __future__ import annotations
from contextlib import suppress
from typing import (
TYPE_CHECKING,
Callable,
DefaultDict,
Dict,
Iterable,
Iterator,
List,
Optional,
Sequence,
Tuple,
Union,
)
try:
import npe2
from npe2.io_utils import read_get_reader
from npe2... | true | true |
f757e6b449fa2a8aa8c6a8b646a1b642c6f94cdc | 21,007 | py | Python | art/classifiers/classifier.py | dohmatob/adversarial-robustness-toolbox | 7d3ba7d2d6690be69c08754fbc632947c2d10a97 | [
"MIT"
] | 1 | 2020-03-09T05:55:46.000Z | 2020-03-09T05:55:46.000Z | art/classifiers/classifier.py | dohmatob/adversarial-robustness-toolbox | 7d3ba7d2d6690be69c08754fbc632947c2d10a97 | [
"MIT"
] | 1 | 2020-03-09T07:04:39.000Z | 2020-03-09T07:04:39.000Z | art/classifiers/classifier.py | dohmatob/adversarial-robustness-toolbox | 7d3ba7d2d6690be69c08754fbc632947c2d10a97 | [
"MIT"
] | null | null | null | # MIT License
#
# Copyright (C) IBM Corporation 2018
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge... | 42.014 | 120 | 0.638882 | from __future__ import absolute_import, division, print_function, unicode_literals
import abc
import sys
import numpy as np
from art.utils import check_and_transform_label_format
if sys.version_info >= (3, 4):
ABC = abc.ABC
else:
ABC = abc.ABCMeta(str('ABC'), (), {})
class Classifier(ABC):
def __init... | true | true |
f757e6c6e1e5907da887c34ef41e7ab20c4b4387 | 2,216 | py | Python | aliyun-python-sdk-vod/aliyunsdkvod/request/v20170321/SubmitPreprocessJobsRequest.py | jia-jerry/aliyun-openapi-python-sdk | e90f3683a250cfec5b681b5f1d73a68f0dc9970d | [
"Apache-2.0"
] | 1 | 2021-03-08T02:59:17.000Z | 2021-03-08T02:59:17.000Z | aliyun-python-sdk-vod/aliyunsdkvod/request/v20170321/SubmitPreprocessJobsRequest.py | jia-jerry/aliyun-openapi-python-sdk | e90f3683a250cfec5b681b5f1d73a68f0dc9970d | [
"Apache-2.0"
] | 1 | 2020-05-31T14:51:47.000Z | 2020-05-31T14:51:47.000Z | aliyun-python-sdk-vod/aliyunsdkvod/request/v20170321/SubmitPreprocessJobsRequest.py | jia-jerry/aliyun-openapi-python-sdk | e90f3683a250cfec5b681b5f1d73a68f0dc9970d | [
"Apache-2.0"
] | null | null | null | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 35.741935 | 79 | 0.773466 |
from aliyunsdkcore.request import RpcRequest
from aliyunsdkvod.endpoint import endpoint_data
class SubmitPreprocessJobsRequest(RpcRequest):
def __init__(self):
RpcRequest.__init__(self, 'vod', '2017-03-21', 'SubmitPreprocessJobs','vod')
self.set_method('POST')
if hasattr(self, "endpoint_map"):
setattr(sel... | true | true |
f757e79e9cf218671a42e6be11da974d2e2b0be7 | 4,423 | py | Python | dynamodb-streams-lambda-filter/lambda_filters/lambda_filters_stack.py | MauriceBrg/snippets | 7fb3a5fa553fc72e4327eeac26521b63fc2dbcd5 | [
"Unlicense"
] | 2 | 2022-01-10T16:07:27.000Z | 2022-02-23T03:41:21.000Z | dynamodb-streams-lambda-filter/lambda_filters/lambda_filters_stack.py | MauriceBrg/snippets | 7fb3a5fa553fc72e4327eeac26521b63fc2dbcd5 | [
"Unlicense"
] | null | null | null | dynamodb-streams-lambda-filter/lambda_filters/lambda_filters_stack.py | MauriceBrg/snippets | 7fb3a5fa553fc72e4327eeac26521b63fc2dbcd5 | [
"Unlicense"
] | null | null | null | import json
import os
from aws_cdk import (
# Duration,
Stack,
RemovalPolicy,
aws_dynamodb as dynamodb,
aws_lambda as _lambda,
aws_lambda_event_sources as lambda_events,
# aws_sqs as sqs,
)
from constructs import Construct
import constants
class LambdaFiltersStack(Stack):
def __init_... | 35.95935 | 113 | 0.567036 | import json
import os
from aws_cdk import (
Stack,
RemovalPolicy,
aws_dynamodb as dynamodb,
aws_lambda as _lambda,
aws_lambda_event_sources as lambda_events,
)
from constructs import Construct
import constants
class LambdaFiltersStack(Stack):
def __init__(self, scope: Construct, cons... | true | true |
f757e839f17d52e5b0e2d26b13657705b167fc54 | 15,343 | py | Python | Providers/Scripts/2.6x-2.7x/Scripts/nxOMSAgentNPMConfig.py | shkhisti/PowerShell-DSC-for-Linux | 8651e113a085fae9ef6dcbea3fb78a0892091975 | [
"MIT"
] | 1 | 2019-04-17T14:45:48.000Z | 2019-04-17T14:45:48.000Z | Providers/Scripts/2.6x-2.7x/Scripts/nxOMSAgentNPMConfig.py | shkhisti/PowerShell-DSC-for-Linux | 8651e113a085fae9ef6dcbea3fb78a0892091975 | [
"MIT"
] | null | null | null | Providers/Scripts/2.6x-2.7x/Scripts/nxOMSAgentNPMConfig.py | shkhisti/PowerShell-DSC-for-Linux | 8651e113a085fae9ef6dcbea3fb78a0892091975 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# ===================================
# Copyright (c) Microsoft Corporation. All rights reserved.
# See license.txt for license information.
# ===================================
import socket
import os
import sys
import imp
import hashlib
import codecs
import base64
import platform
import shutil... | 35.681395 | 154 | 0.666623 |
import socket
import os
import sys
import imp
import hashlib
import codecs
import base64
import platform
import shutil
protocol = imp.load_source('protocol', '../protocol.py')
nxDSCLog = imp.load_source('nxDSCLog', '../nxDSCLog.py')
LG = nxDSCLog.DSCLog
CONFIG_PATH = '/etc/opt/microsoft/omsagent/conf/'
SERVER_ADDRESS... | false | true |
f757e972533d6c87bc341a8afec91fa69a89fb1f | 534 | py | Python | leetcode/MinimumPathSum.py | vry560/CompetativeCoding | 58053531d00cc9a709223274b2909b9f52ab166b | [
"MIT"
] | null | null | null | leetcode/MinimumPathSum.py | vry560/CompetativeCoding | 58053531d00cc9a709223274b2909b9f52ab166b | [
"MIT"
] | null | null | null | leetcode/MinimumPathSum.py | vry560/CompetativeCoding | 58053531d00cc9a709223274b2909b9f52ab166b | [
"MIT"
] | null | null | null | class Solution(object):
def minPathSum(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
slider = [0]*len(grid[0])
slider[0]=grid[0][0]
for i in range(1, len(grid[0])):
slider[i]=slider[i-1]+grid[0][i]
for i in range... | 29.666667 | 66 | 0.447566 | class Solution(object):
def minPathSum(self, grid):
slider = [0]*len(grid[0])
slider[0]=grid[0][0]
for i in range(1, len(grid[0])):
slider[i]=slider[i-1]+grid[0][i]
for i in range(1, len(grid)):
slider[0]=slider[0]+grid[i][0]
for j in ... | true | true |
f757e9b5369ef35c8e599bc682e65c7c5e3b7fa4 | 2,261 | py | Python | remme/genesis/__main__.py | FerrySchuller/remme-core | ca58bfcc5ff0ce6d15c2871a4e03e39f1268d789 | [
"Apache-2.0"
] | 129 | 2018-02-13T21:37:13.000Z | 2020-11-01T23:33:52.000Z | remme/genesis/__main__.py | FerrySchuller/remme-core | ca58bfcc5ff0ce6d15c2871a4e03e39f1268d789 | [
"Apache-2.0"
] | 95 | 2018-03-27T15:57:36.000Z | 2019-08-26T07:35:23.000Z | remme/genesis/__main__.py | FerrySchuller/remme-core | ca58bfcc5ff0ce6d15c2871a4e03e39f1268d789 | [
"Apache-2.0"
] | 30 | 2018-02-24T15:17:37.000Z | 2020-11-14T11:35:25.000Z | # Copyright 2018 REMME
#
# 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, softwa... | 40.375 | 119 | 0.731535 |
import argparse
from remme.protos.account_pb2 import AccountMethod
from remme.protos.transaction_pb2 import TransactionPayload
from remme.clients.account import AccountClient
from remme.tp.account import AccountHandler
from remme.settings import GENESIS_ADDRESS
from remme.settings.default import load_toml_with_defau... | true | true |
f757eabf5819ef4c7e17775d295b191a6a1785fd | 11,507 | py | Python | fireup/algos/ddpg/ddpg.py | kashif/spinningup-pytorch | 8f3389c239c94b3ff46453f359061ae30d851ce8 | [
"MIT"
] | 18 | 2018-11-26T07:10:50.000Z | 2019-01-18T17:28:59.000Z | fireup/algos/ddpg/ddpg.py | kashif/spinningup-pytorch | 8f3389c239c94b3ff46453f359061ae30d851ce8 | [
"MIT"
] | 1 | 2019-01-18T08:59:13.000Z | 2019-01-18T09:14:12.000Z | fireup/algos/ddpg/ddpg.py | kashif/spinningup-pytorch | 8f3389c239c94b3ff46453f359061ae30d851ce8 | [
"MIT"
] | null | null | null | import time
import gym
import numpy as np
import torch
import torch.nn.functional as F
from fireup.algos.ddpg import core
from fireup.utils.logx import EpochLogger
class ReplayBuffer:
"""
A simple FIFO experience replay buffer for DDPG agents.
"""
def __init__(self, obs_dim, act_dim, size):
... | 35.297546 | 89 | 0.570522 | import time
import gym
import numpy as np
import torch
import torch.nn.functional as F
from fireup.algos.ddpg import core
from fireup.utils.logx import EpochLogger
class ReplayBuffer:
def __init__(self, obs_dim, act_dim, size):
self.obs1_buf = np.zeros([size, obs_dim], dtype=np.float32)
self.ob... | true | true |
f757eb03ec4c72e6ae541f3f3848f4084356b47e | 816 | py | Python | tools/showfields.py | gbroiles/si100 | 16c24e409ab29038c39d4e04876ddb27ec65f2a9 | [
"MIT"
] | 1 | 2020-03-06T17:07:11.000Z | 2020-03-06T17:07:11.000Z | tools/showfields.py | gbroiles/si100 | 16c24e409ab29038c39d4e04876ddb27ec65f2a9 | [
"MIT"
] | 2 | 2020-03-06T04:15:20.000Z | 2020-03-07T21:05:30.000Z | tools/showfields.py | gbroiles/si100 | 16c24e409ab29038c39d4e04876ddb27ec65f2a9 | [
"MIT"
] | null | null | null | #! /usr/bin/env python3
""" dumps name/value pairs for form fields in PDF """
import pdfrw
ANNOT_KEY = "/Annots"
ANNOT_FIELD_KEY = "/T"
ANNOT_VAL_KEY = "/V"
SUBTYPE_KEY = "/Subtype"
WIDGET_SUBTYPE_KEY = "/Widget"
PDF_NAME = "test.pdf"
template_pdf = pdfrw.PdfReader(PDF_NAME)
for page in range(0, len(template_pdf.pag... | 31.384615 | 57 | 0.606618 | import pdfrw
ANNOT_KEY = "/Annots"
ANNOT_FIELD_KEY = "/T"
ANNOT_VAL_KEY = "/V"
SUBTYPE_KEY = "/Subtype"
WIDGET_SUBTYPE_KEY = "/Widget"
PDF_NAME = "test.pdf"
template_pdf = pdfrw.PdfReader(PDF_NAME)
for page in range(0, len(template_pdf.pages)):
annotations = template_pdf.pages[page][ANNOT_KEY]
for annotation... | true | true |
f757eb381bde9853d47d941cd57631d3099bc217 | 6,260 | py | Python | purity_fb/purity_fb_1dot10/models/snmp_manager_post.py | mabdelhafez/purity_fb_python_client | a9856875b3df43b4302a2e4addd1a6b71f51f5ce | [
"Apache-2.0"
] | null | null | null | purity_fb/purity_fb_1dot10/models/snmp_manager_post.py | mabdelhafez/purity_fb_python_client | a9856875b3df43b4302a2e4addd1a6b71f51f5ce | [
"Apache-2.0"
] | null | null | null | purity_fb/purity_fb_1dot10/models/snmp_manager_post.py | mabdelhafez/purity_fb_python_client | a9856875b3df43b4302a2e4addd1a6b71f51f5ce | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
"""
Pure Storage FlashBlade REST 1.10 Python SDK
Pure Storage FlashBlade REST 1.10 Python SDK, developed by [Pure Storage, Inc](http://www.purestorage.com/). Documentations can be found at [purity-fb.readthedocs.io](http://purity-fb.readthedocs.io/).
OpenAPI spec version: 1.10
Contact... | 26.752137 | 205 | 0.564377 |
from pprint import pformat
from six import iteritems
import re
class SnmpManagerPost(object):
swagger_types = {
'host': 'str',
'notification': 'str',
'version': 'str',
'v2c': 'SnmpV2c',
'v3': 'SnmpV3'
}
attribute_map = {
'host': 'host',
'notifi... | true | true |
f757ebd43fa0fbde3713b84624b2a152ab442c8c | 2,915 | py | Python | daily_programmer/364.py | davidlowryduda/pythonMiniProjects | e74c18720d9fe33fb97019d26a68f3e4c70f2bb6 | [
"MIT"
] | null | null | null | daily_programmer/364.py | davidlowryduda/pythonMiniProjects | e74c18720d9fe33fb97019d26a68f3e4c70f2bb6 | [
"MIT"
] | null | null | null | daily_programmer/364.py | davidlowryduda/pythonMiniProjects | e74c18720d9fe33fb97019d26a68f3e4c70f2bb6 | [
"MIT"
] | null | null | null | """
Description
===========
A Ducci sequence is a sequence of n-tuples of integers, sometimes known as "the
Diffy game", because it is based on sequences. Given an n-tuple of integers
(a_1, a_2, ... a_n) the next n-tuple in the sequence is formed by taking the
absolute differences of neighboring integers. Ducci sequen... | 26.743119 | 79 | 0.611321 | import sys
def ducci_step(seq):
seq = tuple(abs(seq[i] - seq[i-1]) for i in range(len(seq)))
seq = seq[1:] + seq[0:1]
return seq
def count_iters(seq, verbose=False):
seen = set()
while seq not in seen and set(seq) != {0} and len(seen) < 1000:
seen.add(seq)
if verbose:
p... | true | true |
f757ebe75a4a4c928d628e9e59c9dd20e1ccdf02 | 15,643 | py | Python | tools/challenge_validation.py | marinarierav-uab/foveabox | 1f313fd14aaf018aadb0c6b3de163eb0a3b1fbd5 | [
"Apache-2.0"
] | 1 | 2021-01-14T12:04:34.000Z | 2021-01-14T12:04:34.000Z | tools/challenge_validation.py | marinarierav-uab/foveabox | 1f313fd14aaf018aadb0c6b3de163eb0a3b1fbd5 | [
"Apache-2.0"
] | null | null | null | tools/challenge_validation.py | marinarierav-uab/foveabox | 1f313fd14aaf018aadb0c6b3de163eb0a3b1fbd5 | [
"Apache-2.0"
] | null | null | null | import os
import numpy as np
import pandas as pd
from PIL import Image
from matplotlib import pyplot as plt
from scipy.ndimage.measurements import label
def calculate_average_classif_results(results_dict: dict, thresholds, output_file):
avg = pd.DataFrame(columns=["Thr", "TP", "FP", "TN", "FN", "Accuracy", "Conf... | 37.423445 | 145 | 0.585949 | import os
import numpy as np
import pandas as pd
from PIL import Image
from matplotlib import pyplot as plt
from scipy.ndimage.measurements import label
def calculate_average_classif_results(results_dict: dict, thresholds, output_file):
avg = pd.DataFrame(columns=["Thr", "TP", "FP", "TN", "FN", "Accuracy", "Conf... | true | true |
f757ec2ea456ef701213a4fabc591a9a2e62ac38 | 2,669 | py | Python | python/facial_expression.py | peara/cortex-v2-example | c885a0fd57d5fa9234b504c7a412674d291fd852 | [
"MIT"
] | 1 | 2021-01-13T22:03:06.000Z | 2021-01-13T22:03:06.000Z | python/facial_expression.py | peara/cortex-v2-example | c885a0fd57d5fa9234b504c7a412674d291fd852 | [
"MIT"
] | 1 | 2020-07-15T05:26:09.000Z | 2020-07-15T05:26:09.000Z | python/facial_expression.py | peara/cortex-v2-example | c885a0fd57d5fa9234b504c7a412674d291fd852 | [
"MIT"
] | 1 | 2020-07-15T05:12:08.000Z | 2020-07-15T05:12:08.000Z | from cortex import Cortex
class Train():
def __init__(self):
self.c = Cortex(user, debug_mode=True)
self.c.do_prepare_steps()
def train(self,
profile_name,
training_action,
number_of_train):
stream = ['sys']
self.c.sub_request(stream)
profiles = self.c.query_profile()
if profile_name not i... | 23.619469 | 90 | 0.624953 | from cortex import Cortex
class Train():
def __init__(self):
self.c = Cortex(user, debug_mode=True)
self.c.do_prepare_steps()
def train(self,
profile_name,
training_action,
number_of_train):
stream = ['sys']
self.c.sub_request(stream)
profiles = self.c.query_profile()
if profile_name not i... | true | true |
f757ec69046614cb1a3b6eebacd02cc90d78e47e | 1,008 | py | Python | Pacman/processor.py | dorlivne/PoPS | 088425d1a40a4c2e6856b07744281cd8ab9bce3b | [
"Unlicense"
] | 12 | 2020-01-18T11:23:13.000Z | 2022-01-24T22:59:59.000Z | Pacman/processor.py | dorlivne/PoPS | 088425d1a40a4c2e6856b07744281cd8ab9bce3b | [
"Unlicense"
] | 12 | 2019-12-02T08:34:10.000Z | 2022-02-09T23:35:32.000Z | Pacman/processor.py | dorlivne/PoPS | 088425d1a40a4c2e6856b07744281cd8ab9bce3b | [
"Unlicense"
] | 7 | 2020-01-21T07:23:30.000Z | 2021-12-27T08:00:51.000Z | import numpy as np
from PIL import Image
from copy import deepcopy
INPUT_SHAPE = (84, 84)
def init_state():
# return np.zeros((84, 84, 4))
return np.zeros((4, 84, 84))
def append_frame(state, frame):
# new_state = deepcopy(state)
# new_state[:, :, :-1] = state[:, :, 1:]
# new_state[:, :, -1] = fr... | 27.243243 | 95 | 0.659722 | import numpy as np
from PIL import Image
from copy import deepcopy
INPUT_SHAPE = (84, 84)
def init_state():
return np.zeros((4, 84, 84))
def append_frame(state, frame):
new_state = deepcopy(state)
new_state[:-1, :, :, ] = state[1:, :, :]
new_state[-1, :, :] = frame
del state
r... | true | true |
f757edc73292f04076b852f29785c59c14e71578 | 531 | py | Python | django_comments_tree/conf/__init__.py | sharpertool/django-comments-tree | 2f86f694d127b1722baf7d025eb5fd22b184b88f | [
"BSD-2-Clause"
] | 13 | 2019-06-03T07:39:34.000Z | 2021-11-10T06:55:35.000Z | django_comments_tree/conf/__init__.py | sharpertool/django-comments-tree | 2f86f694d127b1722baf7d025eb5fd22b184b88f | [
"BSD-2-Clause"
] | 2 | 2019-08-08T05:24:28.000Z | 2019-12-23T23:34:58.000Z | django_comments_tree/conf/__init__.py | sharpertool/django-comments-tree | 2f86f694d127b1722baf7d025eb5fd22b184b88f | [
"BSD-2-Clause"
] | 5 | 2019-12-20T14:57:14.000Z | 2021-03-22T18:52:40.000Z | from django.conf import settings as django_settings
from django.utils.functional import LazyObject
from django_comments_tree.conf import defaults as app_settings
class LazySettings(LazyObject):
def _setup(self):
self._wrapped = Settings(app_settings, django_settings)
class Settings(object):
def __i... | 25.285714 | 63 | 0.679849 | from django.conf import settings as django_settings
from django.utils.functional import LazyObject
from django_comments_tree.conf import defaults as app_settings
class LazySettings(LazyObject):
def _setup(self):
self._wrapped = Settings(app_settings, django_settings)
class Settings(object):
def __i... | true | true |
f757ef59c196f39b498ccaccfb0e24d31e99a25a | 150 | py | Python | ifitwala_ed/ifitwala_integration/doctype/plaid_settings/test_plaid_settings.py | mohsinalimat/ifitwala_ed | 8927695ed9dee36e56571c442ebbe6e6431c7d46 | [
"MIT"
] | 13 | 2020-09-02T10:27:57.000Z | 2022-03-11T15:28:46.000Z | ifitwala_ed/ifitwala_integration/doctype/plaid_settings/test_plaid_settings.py | mohsinalimat/ifitwala_ed | 8927695ed9dee36e56571c442ebbe6e6431c7d46 | [
"MIT"
] | 43 | 2020-09-02T07:00:42.000Z | 2021-07-05T13:22:58.000Z | ifitwala_ed/ifitwala_integration/doctype/plaid_settings/test_plaid_settings.py | mohsinalimat/ifitwala_ed | 8927695ed9dee36e56571c442ebbe6e6431c7d46 | [
"MIT"
] | 6 | 2020-10-19T01:02:18.000Z | 2022-03-11T15:28:47.000Z | # Copyright (c) 2021, ifitwala and Contributors
# See license.txt
# import frappe
import unittest
class TestPlaidSettings(unittest.TestCase):
pass
| 16.666667 | 47 | 0.786667 |
import unittest
class TestPlaidSettings(unittest.TestCase):
pass
| true | true |
f757efe44cb20726543f9df1526381a323c49ccb | 8,511 | py | Python | harness/tests/cli/test_cli.py | gh-determined-ai/determined | 9a1ab33a3a356b69681b3351629fef4ab98ddb56 | [
"Apache-2.0"
] | null | null | null | harness/tests/cli/test_cli.py | gh-determined-ai/determined | 9a1ab33a3a356b69681b3351629fef4ab98ddb56 | [
"Apache-2.0"
] | null | null | null | harness/tests/cli/test_cli.py | gh-determined-ai/determined | 9a1ab33a3a356b69681b3351629fef4ab98ddb56 | [
"Apache-2.0"
] | null | null | null | import os
import tempfile
import uuid
from pathlib import Path
import pytest
import requests
import requests_mock
import determined.cli.cli as cli
import determined.cli.command as command
from determined.common import constants, context
from tests.filetree import FileTree
MINIMAL_CONFIG = '{"description": "test"}'
... | 30.180851 | 100 | 0.541769 | import os
import tempfile
import uuid
from pathlib import Path
import pytest
import requests
import requests_mock
import determined.cli.cli as cli
import determined.cli.command as command
from determined.common import constants, context
from tests.filetree import FileTree
MINIMAL_CONFIG = '{"description": "test"}'
... | true | true |
f757f02640e7889486128f6a2f202845a6387efa | 16,696 | py | Python | dns/rdtypes/svcbbase.py | Ashiq5/dnspython | 5449af5318d88bada34f661247f3bcb16f58f057 | [
"ISC"
] | 250 | 2016-12-29T02:43:04.000Z | 2022-03-31T05:51:23.000Z | dns/rdtypes/svcbbase.py | Ashiq5/dnspython | 5449af5318d88bada34f661247f3bcb16f58f057 | [
"ISC"
] | 29 | 2021-08-17T19:09:23.000Z | 2022-03-29T19:08:23.000Z | dns/rdtypes/svcbbase.py | Ashiq5/dnspython | 5449af5318d88bada34f661247f3bcb16f58f057 | [
"ISC"
] | 86 | 2016-12-29T06:39:34.000Z | 2021-12-12T20:07:39.000Z | # Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
import base64
import enum
import io
import struct
import dns.enum
import dns.exception
import dns.immutable
import dns.ipv4
import dns.ipv6
import dns.name
import dns.rdata
import dns.tokenizer
import dns.wire
# Until there is an RFC, this m... | 30.691176 | 79 | 0.580798 |
import base64
import enum
import io
import struct
import dns.enum
import dns.exception
import dns.immutable
import dns.ipv4
import dns.ipv6
import dns.name
import dns.rdata
import dns.tokenizer
import dns.wire
class UnknownParamKey(dns.exception.DNSException):
class ParamKey(dns.enum.IntEnum):
MANDATORY = 0... | true | true |
f757f093137632af54b1137cbe072f8ea3bb37b1 | 524 | py | Python | genetic/recombination/_recombination.py | skoblov-lab/genetic | 98255cbaf7b697c6f3f00dd2618fc1ee02ddf0c0 | [
"MIT"
] | 3 | 2019-06-22T15:34:56.000Z | 2021-12-18T01:22:26.000Z | genetic/recombination/_recombination.py | skoblov-lab/genetic | 98255cbaf7b697c6f3f00dd2618fc1ee02ddf0c0 | [
"MIT"
] | null | null | null | genetic/recombination/_recombination.py | skoblov-lab/genetic | 98255cbaf7b697c6f3f00dd2618fc1ee02ddf0c0 | [
"MIT"
] | 1 | 2020-12-12T12:47:19.000Z | 2020-12-12T12:47:19.000Z | import numpy as np
__all__ = ["binomial"]
def binomial(chr1, chr2):
"""
Picks one allele or the other with 50% success
:type chr1: Sequence
:type chr2: Sequence
"""
if len(chr1) != len(chr2):
raise ValueError("Incompatible chromosome lengths")
choice_mask = np.random.binomial(1, ... | 20.96 | 74 | 0.650763 | import numpy as np
__all__ = ["binomial"]
def binomial(chr1, chr2):
if len(chr1) != len(chr2):
raise ValueError("Incompatible chromosome lengths")
choice_mask = np.random.binomial(1, 0.5, len(chr1))
return [a if ch else b for (ch, a, b) in zip(choice_mask, chr1, chr2)]
def breakpoint(chr1, chr... | true | true |
f757f1148f81bdbbc52d89d3089077795d7d798f | 6,063 | py | Python | riko/modules/subelement.py | sottom/riko | 7898b850b45451420feab33380d252be18e77714 | [
"MIT"
] | null | null | null | riko/modules/subelement.py | sottom/riko | 7898b850b45451420feab33380d252be18e77714 | [
"MIT"
] | null | null | null | riko/modules/subelement.py | sottom/riko | 7898b850b45451420feab33380d252be18e77714 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
riko.modules.subelement
~~~~~~~~~~~~~~~~~~~~~~~
Provides functions for extracting sub-elements from an item
Sometimes the data you need from a stream is buried deep in its hierarchy. You
need to extract just those select sub-elements from the stream. This is what ... | 32.25 | 80 | 0.541316 |
from . import processor
from riko.utils import gen_items
import pygogo as gogo
OPTS = {'emit': True}
DEFAULTS = {'token_key': 'content'}
logger = gogo.Gogo(__name__, monolog=True).logger
def parser(item, objconf, skip=False, **kwargs):
if skip:
stream = kwargs['stream']
else:
element = item.... | true | true |
f757f5f9c4a985b68fbadf6387397a7a4394cec7 | 53 | py | Python | selenium/deleteS3Images.py | InfiniteRandomVariable/hello-world | 6ca4e2f4319c45d5d05b5719f0390f7cb16cca6e | [
"Apache-2.0"
] | null | null | null | selenium/deleteS3Images.py | InfiniteRandomVariable/hello-world | 6ca4e2f4319c45d5d05b5719f0390f7cb16cca6e | [
"Apache-2.0"
] | null | null | null | selenium/deleteS3Images.py | InfiniteRandomVariable/hello-world | 6ca4e2f4319c45d5d05b5719f0390f7cb16cca6e | [
"Apache-2.0"
] | null | null | null | import s3Interface
s3Interface.deleteProcedure()
| 8.833333 | 29 | 0.811321 | import s3Interface
s3Interface.deleteProcedure()
| true | true |
f757f7a17fda99050a4427638352650e01ec68f1 | 5,629 | py | Python | readme/migrations/0012_save_safe_article.py | audax/pypo | 58ce116bf76d50faa34977a80075d488736ffcc8 | [
"Apache-2.0"
] | 25 | 2015-02-12T06:45:24.000Z | 2021-12-30T18:03:10.000Z | readme/migrations/0012_save_safe_article.py | audax/pypo | 58ce116bf76d50faa34977a80075d488736ffcc8 | [
"Apache-2.0"
] | 4 | 2015-01-19T13:38:04.000Z | 2016-04-17T16:06:46.000Z | readme/migrations/0012_save_safe_article.py | audax/pypo | 58ce116bf76d50faa34977a80075d488736ffcc8 | [
"Apache-2.0"
] | 1 | 2016-08-15T01:27:41.000Z | 2016-08-15T01:27:41.000Z | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from readme.models import Item
class Migration(DataMigration):
def forwards(self, orm):
for item in orm.Item.objects.all():
item.s... | 63.965909 | 193 | 0.56049 | from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from readme.models import Item
class Migration(DataMigration):
def forwards(self, orm):
for item in orm.Item.objects.all():
item.safe_article = Item.get_s... | true | true |
f757f7e7395931c2b5b8c1b7d554637202ea7803 | 823 | py | Python | migrations/versions/58556190cb24_initial_migration.py | samwel-chege/Pitches | 06e8ad720e123958b64d8fef24a6eea3bee22715 | [
"MIT"
] | null | null | null | migrations/versions/58556190cb24_initial_migration.py | samwel-chege/Pitches | 06e8ad720e123958b64d8fef24a6eea3bee22715 | [
"MIT"
] | null | null | null | migrations/versions/58556190cb24_initial_migration.py | samwel-chege/Pitches | 06e8ad720e123958b64d8fef24a6eea3bee22715 | [
"MIT"
] | null | null | null | """Initial Migration
Revision ID: 58556190cb24
Revises: 4a167476d5f7
Create Date: 2021-08-20 12:30:57.334610
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '58556190cb24'
down_revision = '4a167476d5f7'
branch_labels = None
depends_on = None
def upgrade():
... | 26.548387 | 112 | 0.701094 | from alembic import op
import sqlalchemy as sa
revision = '58556190cb24'
down_revision = '4a167476d5f7'
branch_labels = None
depends_on = None
def upgrade():
op.add_column('users', sa.Column('password', sa.String(length=255), nullable=True))
op.drop_column('users', 'pass_secure')
def downgrade():
... | true | true |
f757f9468e06f193ec94fa84d6aed912d1508a2c | 1,395 | py | Python | swagger_client/__init__.py | ScsApiTribe/payments-api-python-sdk | 24c784dd2278d80ec741de6fde53d68038de8087 | [
"Apache-2.0"
] | null | null | null | swagger_client/__init__.py | ScsApiTribe/payments-api-python-sdk | 24c784dd2278d80ec741de6fde53d68038de8087 | [
"Apache-2.0"
] | null | null | null | swagger_client/__init__.py | ScsApiTribe/payments-api-python-sdk | 24c784dd2278d80ec741de6fde53d68038de8087 | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
"""
Payments
No descripton provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: 5.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
yo... | 31.704545 | 104 | 0.779928 |
from __future__ import absolute_import
from .models.error import Error
from .models.payment_details import PaymentDetails
from .models.payment_request import PaymentRequest
from .models.payment_request_payer_id import PaymentRequestPayerId
from .models.payment_status import PaymentStatus
from .models.payments_collec... | true | true |
f757fa727071b71abb431669fc2c610eb978109e | 956 | py | Python | algorithmic-toolbox/2_greedy_algorithms_starter_files/covering_segments.py | richardson-souza/coursera-dsa | 0b77c5420b40efb80cded4405960baf75d6a334b | [
"MIT"
] | null | null | null | algorithmic-toolbox/2_greedy_algorithms_starter_files/covering_segments.py | richardson-souza/coursera-dsa | 0b77c5420b40efb80cded4405960baf75d6a334b | [
"MIT"
] | null | null | null | algorithmic-toolbox/2_greedy_algorithms_starter_files/covering_segments.py | richardson-souza/coursera-dsa | 0b77c5420b40efb80cded4405960baf75d6a334b | [
"MIT"
] | null | null | null | # Uses python3
import sys
from collections import namedtuple
Segment = namedtuple('Segment', 'start end')
def optimal_points(segments):
points = []
segments = list(map(list, segments))
segments.sort(key=lambda s: s[1], reverse=False)
for i in range(len(segments)):
if (i == 0) or (segments[i]... | 27.314286 | 69 | 0.526151 | import sys
from collections import namedtuple
Segment = namedtuple('Segment', 'start end')
def optimal_points(segments):
points = []
segments = list(map(list, segments))
segments.sort(key=lambda s: s[1], reverse=False)
for i in range(len(segments)):
if (i == 0) or (segments[i][0] != 0 and se... | true | true |
f757fc7349474db8c1c93e51f28501ad18eba87e | 1,774 | py | Python | test/projects/test_maximum_array_rotation.py | jrg94/sample-programs-in-every-language | 507fea4e11ba83b470c31f7bb50234a1a608c8a5 | [
"MIT"
] | 51 | 2018-05-02T07:28:21.000Z | 2018-08-09T08:26:37.000Z | test/projects/test_maximum_array_rotation.py | jrg94/sample-programs-in-every-language | 507fea4e11ba83b470c31f7bb50234a1a608c8a5 | [
"MIT"
] | 252 | 2018-04-11T01:52:37.000Z | 2018-08-10T18:50:30.000Z | test/projects/test_maximum_array_rotation.py | jrg94/sample-programs-in-every-language | 507fea4e11ba83b470c31f7bb50234a1a608c8a5 | [
"MIT"
] | 27 | 2018-04-29T19:50:59.000Z | 2018-07-27T14:36:14.000Z | import pytest
from runner import ProjectType
from glotter import project_test, project_fixture
from test.utilities import clean_list
invalid_permutations = (
'description,in_params,expected', [
(
'no input',
None,
'Usage: please provide a list of integers (e.g. "8, 3, 1... | 29.081967 | 91 | 0.611048 | import pytest
from runner import ProjectType
from glotter import project_test, project_fixture
from test.utilities import clean_list
invalid_permutations = (
'description,in_params,expected', [
(
'no input',
None,
'Usage: please provide a list of integers (e.g. "8, 3, 1... | true | true |
f757fc9860856b83d447855b772cf4d3e4f88e24 | 1,753 | py | Python | tests/test_refund.py | jayvdb/django-restframework-stripe | fe5f75c24b944e5e05c4fd96583e871d111ec47b | [
"BSD-2-Clause"
] | 1 | 2017-07-14T22:41:41.000Z | 2017-07-14T22:41:41.000Z | tests/test_refund.py | jayvdb/django-restframework-stripe | fe5f75c24b944e5e05c4fd96583e871d111ec47b | [
"BSD-2-Clause"
] | 2 | 2016-02-18T23:31:58.000Z | 2020-06-30T15:49:32.000Z | tests/test_refund.py | jayvdb/django-restframework-stripe | fe5f75c24b944e5e05c4fd96583e871d111ec47b | [
"BSD-2-Clause"
] | 3 | 2016-02-05T20:17:23.000Z | 2020-05-15T13:26:09.000Z | from unittest import mock
from django.core.exceptions import ValidationError
import pytest
from model_mommy import mommy
import stripe
from rest_framework.reverse import reverse
from restframework_stripe.test import get_mock_resource
from restframework_stripe import models
@mock.patch("stripe.Refund.create")
@pyt... | 28.274194 | 88 | 0.73474 | from unittest import mock
from django.core.exceptions import ValidationError
import pytest
from model_mommy import mommy
import stripe
from rest_framework.reverse import reverse
from restframework_stripe.test import get_mock_resource
from restframework_stripe import models
@mock.patch("stripe.Refund.create")
@pyt... | true | true |
f757fe3088e5d8b92ca5c0e3d366e6b602d2d4b3 | 2,927 | py | Python | vnpy/app/algo_trading/algos/twap_algo.py | dennislwm/pyalgotrader | 8a58d146d05033fe1699d0711d243f10c710ad13 | [
"MIT"
] | 102 | 2019-09-30T10:45:05.000Z | 2022-03-16T05:39:41.000Z | vnpy/app/algo_trading/algos/twap_algo.py | day0market/vnpy_eng | 8a58d146d05033fe1699d0711d243f10c710ad13 | [
"MIT"
] | 6 | 2019-10-07T07:49:54.000Z | 2020-05-23T02:11:21.000Z | vnpy/app/algo_trading/algos/twap_algo.py | dennislwm/pyalgotrader | 8a58d146d05033fe1699d0711d243f10c710ad13 | [
"MIT"
] | 43 | 2019-09-30T15:04:46.000Z | 2022-01-26T02:09:57.000Z | from vnpy.trader.constant import Offset, Direction
from vnpy.trader.object import TradeData
from vnpy.trader.engine import BaseEngine
from vnpy.app.algo_trading import AlgoTemplate
class TwapAlgo(AlgoTemplate):
""""""
display_name = "TWAP time weighted average "
default_setting = {
"vt_symbol"... | 27.613208 | 115 | 0.5644 | from vnpy.trader.constant import Offset, Direction
from vnpy.trader.object import TradeData
from vnpy.trader.engine import BaseEngine
from vnpy.app.algo_trading import AlgoTemplate
class TwapAlgo(AlgoTemplate):
display_name = "TWAP time weighted average "
default_setting = {
"vt_symbol": "",
... | true | true |
f757fe9021acc2ce7fa0f131432e8c65c0d907d3 | 20,121 | py | Python | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/lms/djangoapps/courseware/tests/test_about.py | osoco/better-ways-of-thinking-about-software | 83e70d23c873509e22362a09a10d3510e10f6992 | [
"MIT"
] | 3 | 2021-12-15T04:58:18.000Z | 2022-02-06T12:15:37.000Z | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/lms/djangoapps/courseware/tests/test_about.py | osoco/better-ways-of-thinking-about-software | 83e70d23c873509e22362a09a10d3510e10f6992 | [
"MIT"
] | null | null | null | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/lms/djangoapps/courseware/tests/test_about.py | osoco/better-ways-of-thinking-about-software | 83e70d23c873509e22362a09a10d3510e10f6992 | [
"MIT"
] | 1 | 2019-01-02T14:38:50.000Z | 2019-01-02T14:38:50.000Z | """
Test the about xblock
"""
import datetime
from unittest import mock
from unittest.mock import patch
import ddt
import pytz
from ccx_keys.locator import CCXLocator
from django.conf import settings
from django.test.utils import override_settings
from django.urls import reverse
from milestones.tests.utils import Mi... | 40.648485 | 255 | 0.676905 |
import datetime
from unittest import mock
from unittest.mock import patch
import ddt
import pytz
from ccx_keys.locator import CCXLocator
from django.conf import settings
from django.test.utils import override_settings
from django.urls import reverse
from milestones.tests.utils import MilestonesTestCaseMixin
from waf... | true | true |
f757fec92af94fbcd9fa8ac43fcb658da0479ba2 | 7,598 | py | Python | cryptoauthlib/python/setup.py | pjaos/atca | 1a6d04468706235c2c8c3b97f6ce3df5f1fba4ec | [
"Apache-2.0"
] | 8 | 2018-01-30T16:24:37.000Z | 2022-02-25T12:50:22.000Z | cryptoauthlib/python/setup.py | pjaos/atca | 1a6d04468706235c2c8c3b97f6ce3df5f1fba4ec | [
"Apache-2.0"
] | 6 | 2018-03-29T15:07:39.000Z | 2022-02-25T11:36:06.000Z | cryptoauthlib/python/setup.py | pjaos/atca | 1a6d04468706235c2c8c3b97f6ce3df5f1fba4ec | [
"Apache-2.0"
] | 3 | 2018-04-10T11:17:10.000Z | 2021-11-01T23:43:59.000Z | from setuptools import setup, Distribution
from setuptools.command.install import install
from setuptools.command.build_ext import build_ext
from setuptools.extension import Extension
import sys
import subprocess
import os
import glob
import shutil
from ctypes import cdll
_NAME = 'cryptoauthlib'
_DESCRIPTION = 'Pytho... | 35.504673 | 158 | 0.632272 | from setuptools import setup, Distribution
from setuptools.command.install import install
from setuptools.command.build_ext import build_ext
from setuptools.extension import Extension
import sys
import subprocess
import os
import glob
import shutil
from ctypes import cdll
_NAME = 'cryptoauthlib'
_DESCRIPTION = 'Pytho... | true | true |
f757ff4a3ebd44dc759440302f4a3e9ab88e2409 | 11,895 | py | Python | tensorflow/python/eager/function_cache.py | kim-com/tensorflow | 4301e3f34b8da528c58bdafe05cd66c8a55fce9e | [
"Apache-2.0"
] | 1 | 2022-03-20T04:34:49.000Z | 2022-03-20T04:34:49.000Z | tensorflow/python/eager/function_cache.py | kim-com/tensorflow | 4301e3f34b8da528c58bdafe05cd66c8a55fce9e | [
"Apache-2.0"
] | null | null | null | tensorflow/python/eager/function_cache.py | kim-com/tensorflow | 4301e3f34b8da528c58bdafe05cd66c8a55fce9e | [
"Apache-2.0"
] | null | null | null | # Copyright 2021 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.056075 | 111 | 0.731484 |
import collections
from typing import Optional, Sequence, Tuple
from tensorflow.core.function import trace_type
from tensorflow.core.function.polymorphism import type_dispatch
from tensorflow.python.eager import context
from tensorflow.python.framework import device as pydev
from tensorflow.python.framework import fu... | true | true |
f7580000d041ab30f4cdf66c28ca1b2afc5c0c1b | 17,176 | py | Python | examples/lm1b/train.py | skye/flax | 23a91dbc27dd182e26f196546468d33238ca5735 | [
"Apache-2.0"
] | 1 | 2020-10-29T14:21:48.000Z | 2020-10-29T14:21:48.000Z | examples/lm1b/train.py | skye/flax | 23a91dbc27dd182e26f196546468d33238ca5735 | [
"Apache-2.0"
] | null | null | null | examples/lm1b/train.py | skye/flax | 23a91dbc27dd182e26f196546468d33238ca5735 | [
"Apache-2.0"
] | 1 | 2020-07-28T12:14:45.000Z | 2020-07-28T12:14:45.000Z | # Copyright 2020 The Flax Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | 35.196721 | 109 | 0.701677 |
import functools
import itertools
import os
import time
from absl import app
from absl import flags
from absl import logging
from flax import jax_utils
from flax import nn
from flax import optim
import decode
import input_pipeline
import models
from flax.metrics import tensorboard
from flax.training import checkpoint... | true | true |
f7580008149e4c96e78a5fe1ba58c3bfd83be6ba | 894 | py | Python | isi_sdk_8_1_0/test/test_event_eventlist.py | mohitjain97/isilon_sdk_python | a371f438f542568edb8cda35e929e6b300b1177c | [
"Unlicense"
] | 24 | 2018-06-22T14:13:23.000Z | 2022-03-23T01:21:26.000Z | isi_sdk_8_1_0/test/test_event_eventlist.py | mohitjain97/isilon_sdk_python | a371f438f542568edb8cda35e929e6b300b1177c | [
"Unlicense"
] | 46 | 2018-04-30T13:28:22.000Z | 2022-03-21T21:11:07.000Z | isi_sdk_8_1_0/test/test_event_eventlist.py | mohitjain97/isilon_sdk_python | a371f438f542568edb8cda35e929e6b300b1177c | [
"Unlicense"
] | 29 | 2018-06-19T00:14:04.000Z | 2022-02-08T17:51:19.000Z | # coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 5
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_1_0
from i... | 21.804878 | 85 | 0.702461 |
from __future__ import absolute_import
import unittest
import isi_sdk_8_1_0
from isi_sdk_8_1_0.models.event_eventlist import EventEventlist from isi_sdk_8_1_0.rest import ApiException
class TestEventEventlist(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def t... | true | true |
f75800a851ebd4b78b538ddbf6b853d1514ff8b2 | 8,374 | py | Python | flexget/utils/simple_persistence.py | metaMMA/Flexget | a38986422461d7935ead1e2b4ed4c88bcd0a90f5 | [
"MIT"
] | null | null | null | flexget/utils/simple_persistence.py | metaMMA/Flexget | a38986422461d7935ead1e2b4ed4c88bcd0a90f5 | [
"MIT"
] | 1 | 2017-10-09T23:06:44.000Z | 2017-10-09T23:06:44.000Z | flexget/utils/simple_persistence.py | metaMMA/Flexget | a38986422461d7935ead1e2b4ed4c88bcd0a90f5 | [
"MIT"
] | null | null | null | """
NOTE:
Avoid using this module on your own or in plugins, this was originally made for 0.9 -> 1.0 transition.
You can safely use task.simple_persistence and manager.persist, if we implement something better we
can replace underlying mechanism in single point (and provide transparent switch).
"""
from __future__ im... | 35.184874 | 115 | 0.615238 | from __future__ import unicode_literals, division, absolute_import
from builtins import * from future.types.newstr import newstr
import logging
import pickle
from collections import MutableMapping, defaultdict
from datetime import datetime
from sqlalchemy import Column, Integer, String, DateTime, Unicode, select, In... | true | true |
f75801d70e00181fac27ef03101b127c9dcff0dc | 11,899 | py | Python | elliot/run.py | albertomancino/elliot | 339c6421b86646c7a5a1f5001b08a16550ed1d37 | [
"Apache-2.0"
] | null | null | null | elliot/run.py | albertomancino/elliot | 339c6421b86646c7a5a1f5001b08a16550ed1d37 | [
"Apache-2.0"
] | null | null | null | elliot/run.py | albertomancino/elliot | 339c6421b86646c7a5a1f5001b08a16550ed1d37 | [
"Apache-2.0"
] | null | null | null | """
Module description:
"""
__version__ = '0.3.1'
__author__ = 'Vito Walter Anelli, Claudio Pomo'
__email__ = 'vitowalter.anelli@poliba.it, claudio.pomo@poliba.it'
import importlib
import sys
from os import path
import numpy as np
from hyperopt import Trials, fmin
import elliot.hyperoptimization as ho
from elliot.... | 53.120536 | 140 | 0.575763 |
__version__ = '0.3.1'
__author__ = 'Vito Walter Anelli, Claudio Pomo'
__email__ = 'vitowalter.anelli@poliba.it, claudio.pomo@poliba.it'
import importlib
import sys
from os import path
import numpy as np
from hyperopt import Trials, fmin
import elliot.hyperoptimization as ho
from elliot.namespace.namespace_model_bui... | true | true |
f758024555b41ada391e08a9ab3d856e3a3dfe19 | 139 | py | Python | Udemy/GeekUniversity/secao_4/ex19_conversor_litros_p_metroscubicos.py | SandboxGTASA/Python-1 | bbb5f8bdf7d5110528e457b2a9ebdb2d67e40805 | [
"MIT"
] | null | null | null | Udemy/GeekUniversity/secao_4/ex19_conversor_litros_p_metroscubicos.py | SandboxGTASA/Python-1 | bbb5f8bdf7d5110528e457b2a9ebdb2d67e40805 | [
"MIT"
] | null | null | null | Udemy/GeekUniversity/secao_4/ex19_conversor_litros_p_metroscubicos.py | SandboxGTASA/Python-1 | bbb5f8bdf7d5110528e457b2a9ebdb2d67e40805 | [
"MIT"
] | null | null | null | # Convertendo litros para metro cubico
litros = float(input('Entre com um volume em litros: '))
m_cubicos = litros / 1000
print(m_cubicos) | 27.8 | 56 | 0.755396 |
litros = float(input('Entre com um volume em litros: '))
m_cubicos = litros / 1000
print(m_cubicos) | true | true |
f75802a8e5c23a79cb50a740e4eb1654569f2c46 | 1,326 | py | Python | test/test_access_policy_rule_dto.py | httpsgithu/python-client | f85a530367cdabe458a11919ad35609b9bc0606b | [
"Apache-2.0"
] | 11 | 2016-05-30T17:16:45.000Z | 2021-06-11T19:32:59.000Z | test/test_access_policy_rule_dto.py | httpsgithu/python-client | f85a530367cdabe458a11919ad35609b9bc0606b | [
"Apache-2.0"
] | 25 | 2016-05-02T23:05:19.000Z | 2020-11-18T22:43:20.000Z | test/test_access_policy_rule_dto.py | httpsgithu/python-client | f85a530367cdabe458a11919ad35609b9bc0606b | [
"Apache-2.0"
] | 30 | 2016-04-29T17:17:11.000Z | 2022-02-11T04:58:37.000Z | # coding: utf-8
"""
Wavefront REST API
<p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the Wavefront REST ... | 32.341463 | 409 | 0.744344 |
from __future__ import absolute_import
import unittest
import wavefront_api_client
from wavefront_api_client.models.access_policy_rule_dto import AccessPolicyRuleDTO from wavefront_api_client.rest import ApiException
class TestAccessPolicyRuleDTO(unittest.TestCase):
def setUp(self):
pass
def t... | true | true |
f75802df7430e0c7d84f3d665e1c65dfb5e5cc4e | 7,753 | py | Python | Combine/models.py | DigitalPhonetics/SpeechRepresentationFinetuning | 11d7130919888d0a27de61f5075e72f4a024673b | [
"Apache-2.0"
] | 1 | 2022-03-24T19:48:58.000Z | 2022-03-24T19:48:58.000Z | Combine/models.py | DigitalPhonetics/SpeechRepresentationFinetuning | 11d7130919888d0a27de61f5075e72f4a024673b | [
"Apache-2.0"
] | null | null | null | Combine/models.py | DigitalPhonetics/SpeechRepresentationFinetuning | 11d7130919888d0a27de61f5075e72f4a024673b | [
"Apache-2.0"
] | null | null | null | """
Adapt from:
https://github.com/facebookresearch/barlowtwins/blob/main/main.py
"""
import torch
import torch.nn as nn
from transformers import Wav2Vec2Model
from transformers.models.wav2vec2.modeling_wav2vec2 import _compute_mask_indices
def off_diagonal(x):
"""
For the purpose of calculation:
return f... | 38.572139 | 87 | 0.641429 | import torch
import torch.nn as nn
from transformers import Wav2Vec2Model
from transformers.models.wav2vec2.modeling_wav2vec2 import _compute_mask_indices
def off_diagonal(x):
n, m = x.shape
assert n == m
return x.flatten()[:-1].view(n - 1, n + 1)[:, 1:].flatten()
class BarlowTwins(nn.Module):
d... | true | true |
f75802f3a3b19466b31184b6de53961aeb9cd318 | 45 | py | Python | tests/__init__.py | carverdo/scrap | d431095cadc1bc3f60aa0a3f473e726ecace9078 | [
"MIT"
] | null | null | null | tests/__init__.py | carverdo/scrap | d431095cadc1bc3f60aa0a3f473e726ecace9078 | [
"MIT"
] | null | null | null | tests/__init__.py | carverdo/scrap | d431095cadc1bc3f60aa0a3f473e726ecace9078 | [
"MIT"
] | null | null | null | __author__ = 'donal'
__project__ = 'ribcage'
| 15 | 23 | 0.733333 | __author__ = 'donal'
__project__ = 'ribcage'
| true | true |
f75806163e103395b483f9826a7477f29607f683 | 1,621 | py | Python | server_side/interfaces/database.py | yagorezende/TCC00314-Streaming | e2de185292582253106899f38540f6e523271875 | [
"Apache-2.0"
] | null | null | null | server_side/interfaces/database.py | yagorezende/TCC00314-Streaming | e2de185292582253106899f38540f6e523271875 | [
"Apache-2.0"
] | null | null | null | server_side/interfaces/database.py | yagorezende/TCC00314-Streaming | e2de185292582253106899f38540f6e523271875 | [
"Apache-2.0"
] | null | null | null | import sqlite3
from util.constants import DATABASE
class DBManager:
def __init__(self):
self.connection = None
self.cursor = None
def connect(self):
self.connection = sqlite3.connect(DATABASE["path"])
self.cursor = self.connection.cursor()
return self
def create_t... | 29.472727 | 102 | 0.636644 | import sqlite3
from util.constants import DATABASE
class DBManager:
def __init__(self):
self.connection = None
self.cursor = None
def connect(self):
self.connection = sqlite3.connect(DATABASE["path"])
self.cursor = self.connection.cursor()
return self
def create_t... | true | true |
f75806b2a456eaf32574808ca1cb89f88e997306 | 1,174 | py | Python | multinherit.py | robbroadhead/PythonCertificationSeries | 15a9907b6bd05d6419e9472b56666dacf7dc8333 | [
"CC0-1.0"
] | null | null | null | multinherit.py | robbroadhead/PythonCertificationSeries | 15a9907b6bd05d6419e9472b56666dacf7dc8333 | [
"CC0-1.0"
] | 1 | 2021-08-21T15:20:56.000Z | 2021-08-21T15:20:56.000Z | multinherit.py | robbroadhead/PythonCertificationSeries | 15a9907b6bd05d6419e9472b56666dacf7dc8333 | [
"CC0-1.0"
] | null | null | null | # Python multiple inheritance examples
class Base1:
# class properties
value = "I am base 1"
# class methods
def __init__(self,val1="I am base 1"):
print("Base 1 Constructor called")
self.value = val1
def display(self):
print("Base 1 display called")
class Base2:
# c... | 19.566667 | 42 | 0.609029 |
class Base1:
value = "I am base 1"
def __init__(self,val1="I am base 1"):
print("Base 1 Constructor called")
self.value = val1
def display(self):
print("Base 1 display called")
class Base2:
value = "I am base 2"
def __init__(self,val2="I am base 2"):
... | true | true |
f758077e4bdd541042768d7c9e0dc04a34aeeac5 | 2,995 | py | Python | src/intranet3/intranet3/testing/factory.py | tmodrzynski/intranet-open | 0255227e7133d1c34ab265e1418f9a409370ea3a | [
"MIT"
] | null | null | null | src/intranet3/intranet3/testing/factory.py | tmodrzynski/intranet-open | 0255227e7133d1c34ab265e1418f9a409370ea3a | [
"MIT"
] | null | null | null | src/intranet3/intranet3/testing/factory.py | tmodrzynski/intranet-open | 0255227e7133d1c34ab265e1418f9a409370ea3a | [
"MIT"
] | null | null | null | from intranet3 import models
class FactoryMixin(object):
# Current state of counter
cid = 1 # Client
uid = 1 # User
pid = 1 # Project
tid = 1 # Tracker
def create_user(
self,
name="",
domain="stxnext.pl",
groups=[],
**kwargs
):
username ... | 25.818966 | 68 | 0.49783 | from intranet3 import models
class FactoryMixin(object):
cid = 1 uid = 1 pid = 1 tid = 1
def create_user(
self,
name="",
domain="stxnext.pl",
groups=[],
**kwargs
):
username = name or "user_%s" % self.uid
user = models.User(
... | true | true |
f758088a3541de401feac151c80f6da19c1e6ee0 | 2,917 | py | Python | e2e-tests/src/test_spike.py | admariner/prestige | 25ba4a9bd197671db7506bcf996be08a9bac29bd | [
"Apache-2.0"
] | null | null | null | e2e-tests/src/test_spike.py | admariner/prestige | 25ba4a9bd197671db7506bcf996be08a9bac29bd | [
"Apache-2.0"
] | 1 | 2021-11-07T06:25:37.000Z | 2021-11-07T06:25:37.000Z | e2e-tests/src/test_spike.py | admariner/prestige | 25ba4a9bd197671db7506bcf996be08a9bac29bd | [
"Apache-2.0"
] | null | null | null | from collections import defaultdict
import inspect
import os
import os.path
import unittest
from typing import Dict
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.expected_conditions import presence_of_element_l... | 30.385417 | 88 | 0.744601 | from collections import defaultdict
import inspect
import os
import os.path
import unittest
from typing import Dict
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.expected_conditions import presence_of_element_l... | true | true |
f75808f9abc52931dcbf63471d240bd6dddddced | 7,066 | py | Python | python/ray/tune/registry.py | jianoaix/ray | 1701b923bc83905f8961c06a6a173e3eba46a936 | [
"Apache-2.0"
] | null | null | null | python/ray/tune/registry.py | jianoaix/ray | 1701b923bc83905f8961c06a6a173e3eba46a936 | [
"Apache-2.0"
] | 12 | 2022-03-05T05:37:28.000Z | 2022-03-19T07:14:43.000Z | python/ray/tune/registry.py | jianoaix/ray | 1701b923bc83905f8961c06a6a173e3eba46a936 | [
"Apache-2.0"
] | null | null | null | import logging
import uuid
from functools import partial
from types import FunctionType
from typing import Optional, Type, Union
import ray
import ray.cloudpickle as pickle
from ray.experimental.internal_kv import (
_internal_kv_initialized,
_internal_kv_get,
_internal_kv_put,
)
from ray.tune.error import... | 29.940678 | 87 | 0.668271 | import logging
import uuid
from functools import partial
from types import FunctionType
from typing import Optional, Type, Union
import ray
import ray.cloudpickle as pickle
from ray.experimental.internal_kv import (
_internal_kv_initialized,
_internal_kv_get,
_internal_kv_put,
)
from ray.tune.error import... | true | true |
f758095a95ee0f402dec85211ce42e42d6b529cf | 66,393 | py | Python | build/lib.linux-x86_64-2.7/cyberweb/controllers/postjob.py | sumukh210991/Cyberweb | 297bd54c9e223d38818b802087055e397c403f1c | [
"Apache-2.0"
] | null | null | null | build/lib.linux-x86_64-2.7/cyberweb/controllers/postjob.py | sumukh210991/Cyberweb | 297bd54c9e223d38818b802087055e397c403f1c | [
"Apache-2.0"
] | null | null | null | build/lib.linux-x86_64-2.7/cyberweb/controllers/postjob.py | sumukh210991/Cyberweb | 297bd54c9e223d38818b802087055e397c403f1c | [
"Apache-2.0"
] | null | null | null | import logging
import numpy as np
import os, sys, time, re, getopt, getpass, math, tempfile
import traceback,commands
import string, json
from time import strftime
import pexpect
import urlparse
from pylons import request, response, session, app_globals, tmpl_context as c, config, url
from pylons.decorators import jso... | 43.593565 | 215 | 0.538867 | import logging
import numpy as np
import os, sys, time, re, getopt, getpass, math, tempfile
import traceback,commands
import string, json
from time import strftime
import pexpect
import urlparse
from pylons import request, response, session, app_globals, tmpl_context as c, config, url
from pylons.decorators import jso... | false | true |
f75809cb6c7a2fad51b142c4ef8a6de72ffb1351 | 1,257 | py | Python | trigger.py | itsme180/YangBot | 30b514ca83be04c391c6fd6adaa78b2235fcd5e9 | [
"MIT"
] | null | null | null | trigger.py | itsme180/YangBot | 30b514ca83be04c391c6fd6adaa78b2235fcd5e9 | [
"MIT"
] | null | null | null | trigger.py | itsme180/YangBot | 30b514ca83be04c391c6fd6adaa78b2235fcd5e9 | [
"MIT"
] | null | null | null | #YangBot's responses
choiced_responses = {
"dank": "I sure hope you're talking about dank memes and not that dank green!",
"blaze": "I sure hope you're talking about the pizza!",
"alcohol": "Reminder that underage drinking is prohibited at UCSB.", #should only be triggered by gauchito
"mj": "Despite the passin... | 44.892857 | 121 | 0.667462 | choiced_responses = {
"dank": "I sure hope you're talking about dank memes and not that dank green!",
"blaze": "I sure hope you're talking about the pizza!",
"alcohol": "Reminder that underage drinking is prohibited at UCSB.", #should only be triggered by gauchito
"mj": "Despite the passing of Prop 64, marijuan... | true | true |
f7580a9344062f756c81c1cf703504388e2ef763 | 32,087 | py | Python | src/ClusterBootstrap/params.py | leigaoms/DLWorkspace | f8bdf5bb5b6c372eae60f6e52f072b4d7e46babc | [
"MIT"
] | null | null | null | src/ClusterBootstrap/params.py | leigaoms/DLWorkspace | f8bdf5bb5b6c372eae60f6e52f072b4d7e46babc | [
"MIT"
] | null | null | null | src/ClusterBootstrap/params.py | leigaoms/DLWorkspace | f8bdf5bb5b6c372eae60f6e52f072b4d7e46babc | [
"MIT"
] | null | null | null | # These are the default configuration parameter
default_config_parameters = {
"allroles": {"infra", "infrastructure", "worker", "nfs", "sql", "dev"},
# Kubernetes setting
"service_cluster_ip_range": "10.3.0.0/16",
"pod_ip_range": "10.2.0.0/16",
# Home in server, to aide Kubernete setup
"homeinse... | 38.612515 | 210 | 0.557827 | default_config_parameters = {
"allroles": {"infra", "infrastructure", "worker", "nfs", "sql", "dev"},
"service_cluster_ip_range": "10.3.0.0/16",
"pod_ip_range": "10.2.0.0/16",
"homeinserver": "http://dlws-clusterportal.westus.cloudapp.azure.com:5000",
"cloud_influxdb_node": "dlws-influxdb.we... | true | true |
f7580b00bc3786e8b8713b9222431d5469f10a9d | 24,477 | py | Python | selfdrive/car/toyota/values.py | lulflr/openpilot_arne | 403277b1bb2cf6c387ac961b59fddbc48dc36fd4 | [
"MIT"
] | null | null | null | selfdrive/car/toyota/values.py | lulflr/openpilot_arne | 403277b1bb2cf6c387ac961b59fddbc48dc36fd4 | [
"MIT"
] | null | null | null | selfdrive/car/toyota/values.py | lulflr/openpilot_arne | 403277b1bb2cf6c387ac961b59fddbc48dc36fd4 | [
"MIT"
] | null | null | null | from selfdrive.car import dbc_dict
class CAR:
PRIUS = "TOYOTA PRIUS 2017"
RAV4H = "TOYOTA RAV4 HYBRID 2017"
RAV4 = "TOYOTA RAV4 2017"
COROLLA = "TOYOTA COROLLA 2017"
LEXUS_RXH = "LEXUS RX HYBRID 2017"
CHR = "TOYOTA C-HR 2018"
CHRH = "TOYOTA C-HR HYBRID 2018"
CAMRY = "TOYOTA CAMRY 2018"
CAMRYH = "TOYO... | 143.982353 | 1,124 | 0.570372 | from selfdrive.car import dbc_dict
class CAR:
PRIUS = "TOYOTA PRIUS 2017"
RAV4H = "TOYOTA RAV4 HYBRID 2017"
RAV4 = "TOYOTA RAV4 2017"
COROLLA = "TOYOTA COROLLA 2017"
LEXUS_RXH = "LEXUS RX HYBRID 2017"
CHR = "TOYOTA C-HR 2018"
CHRH = "TOYOTA C-HR HYBRID 2018"
CAMRY = "TOYOTA CAMRY 2018"
CAMRYH = "TOYO... | true | true |
f7580d05d35d71dfa3af6814208eba400f22a8fa | 97 | py | Python | code/__init__.py | alejandropages/KernelPheno | 5a8d1fc8892b5cbc1309d42261596d12402c545c | [
"MIT"
] | null | null | null | code/__init__.py | alejandropages/KernelPheno | 5a8d1fc8892b5cbc1309d42261596d12402c545c | [
"MIT"
] | 1 | 2020-12-04T02:34:43.000Z | 2020-12-04T02:34:43.000Z | code/__init__.py | alejandropages/KernelPheno | 5a8d1fc8892b5cbc1309d42261596d12402c545c | [
"MIT"
] | null | null | null | # from os import path
#
# os.environ['KERNEL_PHENO_PATH'] = path.dirname(path.dirname(__file__))
| 24.25 | 72 | 0.742268 | true | true | |
f7580d83bd3da94d9f79c58a4cd115c036ca04d0 | 479 | py | Python | omdb/migrations/0004_alter_video_year.py | Kyle1297/fetchtv-imdb | da6e0a05d51f91111f161372399f8078bd119571 | [
"MIT"
] | 1 | 2021-07-02T04:39:13.000Z | 2021-07-02T04:39:13.000Z | omdb/migrations/0004_alter_video_year.py | Kyle1297/fetchtv-omdb | da6e0a05d51f91111f161372399f8078bd119571 | [
"MIT"
] | null | null | null | omdb/migrations/0004_alter_video_year.py | Kyle1297/fetchtv-omdb | da6e0a05d51f91111f161372399f8078bd119571 | [
"MIT"
] | null | null | null | # Generated by Django 3.2.4 on 2021-06-28 11:05
from django.db import migrations, models
import omdb.models
class Migration(migrations.Migration):
dependencies = [
('omdb', '0003_alter_video_year'),
]
operations = [
migrations.AlterField(
model_name='video',
name... | 23.95 | 132 | 0.638831 |
from django.db import migrations, models
import omdb.models
class Migration(migrations.Migration):
dependencies = [
('omdb', '0003_alter_video_year'),
]
operations = [
migrations.AlterField(
model_name='video',
name='year',
field=models.CharField(db_i... | true | true |
f7580dc7742ac4f132ac99a0fe9bd02396a03344 | 6,702 | py | Python | bindings/python/ensmallen_graph/datasets/string/bartonellaclarridgeiae.py | caufieldjh/ensmallen_graph | 14e98b1cdbc73193a84a913d7d4f2b2b3eb2c43a | [
"MIT"
] | null | null | null | bindings/python/ensmallen_graph/datasets/string/bartonellaclarridgeiae.py | caufieldjh/ensmallen_graph | 14e98b1cdbc73193a84a913d7d4f2b2b3eb2c43a | [
"MIT"
] | null | null | null | bindings/python/ensmallen_graph/datasets/string/bartonellaclarridgeiae.py | caufieldjh/ensmallen_graph | 14e98b1cdbc73193a84a913d7d4f2b2b3eb2c43a | [
"MIT"
] | null | null | null | """
This file offers the methods to automatically retrieve the graph Bartonella clarridgeiae.
The graph is automatically retrieved from the STRING repository.
Report
---------------------
At the time of rendering these methods (please see datetime below), the graph
had the following characteristics:
Datetime: 202... | 35.460317 | 223 | 0.704417 | from typing import Dict
from ..automatic_graph_retrieval import AutomaticallyRetrievedGraph
from ...ensmallen_graph import EnsmallenGraph
def BartonellaClarridgeiae(
directed: bool = False,
verbose: int = 2,
cache_path: str = "graphs/string",
**additional_graph_kwargs: Dict
) -> EnsmallenGraph:
... | true | true |
f7580ef8e7f8c073c89f211af94a37d5e210ecf4 | 547 | py | Python | backend/migrations/0004_rule_service.py | guhuajun/grafana-awssns | 6f1f8e33e86b97ed83575d8b1c2b601ebd3f8b38 | [
"MIT"
] | 6 | 2018-08-30T16:29:04.000Z | 2020-09-22T04:08:44.000Z | backend/migrations/0004_rule_service.py | guhuajun/grafana-awssns | 6f1f8e33e86b97ed83575d8b1c2b601ebd3f8b38 | [
"MIT"
] | 1 | 2018-05-23T02:13:42.000Z | 2018-05-31T14:56:23.000Z | backend/migrations/0004_rule_service.py | guhuajun/grafana-awssns | 6f1f8e33e86b97ed83575d8b1c2b601ebd3f8b38 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2017-12-24 05:15
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('backend', '0003_awscredential'),
]
operations = [
... | 24.863636 | 121 | 0.650823 | from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('backend', '0003_awscredential'),
]
operations = [
migrations.AddField(
model_name='rule',
n... | true | true |
f7580f1f000dc280b7957408ed316744fd17b49d | 775 | py | Python | 007er_pyserver/db_repository/versions/019_migration.py | Lidagou007er/lidagou007er.github.io | 25ffb8d84ad6ef9ece8ee9f458c299d06f1742f9 | [
"MIT"
] | null | null | null | 007er_pyserver/db_repository/versions/019_migration.py | Lidagou007er/lidagou007er.github.io | 25ffb8d84ad6ef9ece8ee9f458c299d06f1742f9 | [
"MIT"
] | null | null | null | 007er_pyserver/db_repository/versions/019_migration.py | Lidagou007er/lidagou007er.github.io | 25ffb8d84ad6ef9ece8ee9f458c299d06f1742f9 | [
"MIT"
] | null | null | null | from sqlalchemy import *
from migrate import *
from migrate.changeset import schema
pre_meta = MetaData()
post_meta = MetaData()
the__writer = Table('the__writer', post_meta,
Column('id', Integer, primary_key=True, nullable=False),
Column('id007', String(length=25)),
Column('name', String(length=25)),
)
... | 27.678571 | 68 | 0.730323 | from sqlalchemy import *
from migrate import *
from migrate.changeset import schema
pre_meta = MetaData()
post_meta = MetaData()
the__writer = Table('the__writer', post_meta,
Column('id', Integer, primary_key=True, nullable=False),
Column('id007', String(length=25)),
Column('name', String(length=25)),
)
... | true | true |
f7580ff7e085d091ec89013da51a73492f3525a6 | 16,995 | py | Python | code/model/archive/model4.py | ito-takuya/sr_enn | 85e105779dc9d4a0c4ddf8b7ff9f3f751b05bfdf | [
"MIT"
] | 3 | 2022-02-24T20:30:31.000Z | 2022-03-25T06:45:58.000Z | code/model/archive/model4.py | ito-takuya/sr_enn | 85e105779dc9d4a0c4ddf8b7ff9f3f751b05bfdf | [
"MIT"
] | null | null | null | code/model/archive/model4.py | ito-takuya/sr_enn | 85e105779dc9d4a0c4ddf8b7ff9f3f751b05bfdf | [
"MIT"
] | 1 | 2022-02-17T03:39:44.000Z | 2022-02-17T03:39:44.000Z | # Taku Ito
# 03/28/2019
# RNN model training with trial dynamics
import pandas as pd
import torch
import numpy as np
from torch.autograd import Variable
import torch.nn.functional as F
import task
import multiprocessing as mp
import h5py
task = reload(task)
np.set_printoptions(suppress=True)
import time
class RNN(t... | 39.615385 | 154 | 0.631715 | import pandas as pd
import torch
import numpy as np
from torch.autograd import Variable
import torch.nn.functional as F
import task
import multiprocessing as mp
import h5py
task = reload(task)
np.set_printoptions(suppress=True)
import time
class RNN(torch.nn.RNN):
"""
Neural network object
"""
def _... | false | true |
f75810e63ee1da347550cf37a4904e6e183cd014 | 528 | py | Python | search/migrations/0008_auto_20161031_0540.py | lfaraone/sal | d0dff90cebcbc87f18c2c6957264f21566d52000 | [
"Apache-2.0"
] | 1 | 2019-11-01T20:54:47.000Z | 2019-11-01T20:54:47.000Z | search/migrations/0008_auto_20161031_0540.py | grahamgilbert/sal | d247ec1ea8855e65e5855b0dd63eae93b40f86ca | [
"Apache-2.0"
] | null | null | null | search/migrations/0008_auto_20161031_0540.py | grahamgilbert/sal | d247ec1ea8855e65e5855b0dd63eae93b40f86ca | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-10-31 12:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('search', '0007_auto_20161031_0405'),
]
operations = [
migrations.AlterField(
... | 24 | 91 | 0.613636 | from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('search', '0007_auto_20161031_0405'),
]
operations = [
migrations.AlterField(
model_name='savedsearch',
name='name',
... | true | true |
f75811a07314d014269c56461afe96260f07b99e | 495 | py | Python | MeArmValetSystem/test/password testing (1).py | Thoybur-Rohman/MeArm-keyValet-storageSystem | 6863ce4c0deaeea195bc99b0931ecbb6a562a077 | [
"Apache-2.0"
] | null | null | null | MeArmValetSystem/test/password testing (1).py | Thoybur-Rohman/MeArm-keyValet-storageSystem | 6863ce4c0deaeea195bc99b0931ecbb6a562a077 | [
"Apache-2.0"
] | null | null | null | MeArmValetSystem/test/password testing (1).py | Thoybur-Rohman/MeArm-keyValet-storageSystem | 6863ce4c0deaeea195bc99b0931ecbb6a562a077 | [
"Apache-2.0"
] | null | null | null | import serial # Allows you to talk to the Arduino board
# Select port, yours may be different so check the port for your board
usbport = 'COM4'
# create a serial object
ser = serial.Serial(usbport, 9600, timeout=1)
while True:
servo = raw_input("enter servo Nbr (0-3)")
position = raw_input("ent... | 21.521739 | 73 | 0.6 | import serial
usbport = 'COM4'
ser = serial.Serial(usbport, 9600, timeout=1)
while True:
servo = raw_input("enter servo Nbr (0-3)")
position = raw_input("enter angle between 10 and 170:")
cmd = servo + "," + position + "\n"
ser.write(cmd)
def move(s,p):
cmd = s + "," + p + ... | true | true |
f75811b0c3651dc50b0a01a9e47bf55e8a7de5df | 22,625 | py | Python | kubernetes/client/models/v1_service_spec.py | iamneha/python | 5b208a1a49a8d6f8bbab28bcc226b9ef793bcbd0 | [
"Apache-2.0"
] | 1 | 2019-02-17T15:28:39.000Z | 2019-02-17T15:28:39.000Z | kubernetes/client/models/v1_service_spec.py | iamneha/python | 5b208a1a49a8d6f8bbab28bcc226b9ef793bcbd0 | [
"Apache-2.0"
] | null | null | null | kubernetes/client/models/v1_service_spec.py | iamneha/python | 5b208a1a49a8d6f8bbab28bcc226b9ef793bcbd0 | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re... | 48.866091 | 886 | 0.70232 |
from pprint import pformat
from six import iteritems
import re
class V1ServiceSpec(object):
swagger_types = {
'cluster_ip': 'str',
'external_i_ps': 'list[str]',
'external_name': 'str',
'external_traffic_policy': 'str',
'health_check_node_port': 'int',
'load_bal... | true | true |
f758121ed7b3a4d04e9654526ca5de728c4a2602 | 123 | py | Python | api/admin.py | Uttam-Singhh/Movie-Rater | 3c604a1d7554643a3edd0d11b07231679ae4695b | [
"MIT"
] | 1 | 2020-04-11T04:23:06.000Z | 2020-04-11T04:23:06.000Z | api/admin.py | Uttam-Singhh/Movie-Rater | 3c604a1d7554643a3edd0d11b07231679ae4695b | [
"MIT"
] | 11 | 2020-02-12T03:16:23.000Z | 2022-02-26T21:41:31.000Z | api/admin.py | Uttam-Singhh/Movie-Rater | 3c604a1d7554643a3edd0d11b07231679ae4695b | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import Movie, Rating
admin.site.register(Movie)
admin.site.register(Rating)
| 20.5 | 33 | 0.813008 | from django.contrib import admin
from .models import Movie, Rating
admin.site.register(Movie)
admin.site.register(Rating)
| true | true |
f75812fb05cd197c4968dd572a41caf727fb05fa | 12,206 | py | Python | hub_module/modules/image/text_recognition/chinese_text_detection_db_server/module.py | HawChang/PaddleHub | 7faf09eb423b7c844392e6fa19b9b8db49928835 | [
"Apache-2.0"
] | 2 | 2020-11-30T08:54:01.000Z | 2021-04-07T10:11:36.000Z | hub_module/modules/image/text_recognition/chinese_text_detection_db_server/module.py | haoyuying/PaddleHub | 9894fbb1dc8575ae1fa74f32a23cc1363467461b | [
"Apache-2.0"
] | null | null | null | hub_module/modules/image/text_recognition/chinese_text_detection_db_server/module.py | haoyuying/PaddleHub | 9894fbb1dc8575ae1fa74f32a23cc1363467461b | [
"Apache-2.0"
] | null | null | null | # -*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import ast
import math
import os
import time
from paddle.fluid.core import AnalysisConfig, create_paddle_predictor, PaddleTensor
from paddlehub.common.logger import logge... | 36.54491 | 187 | 0.587744 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import ast
import math
import os
import time
from paddle.fluid.core import AnalysisConfig, create_paddle_predictor, PaddleTensor
from paddlehub.common.logger import logger
from paddlehub.module... | true | true |
f758136d72f620051c37a60491babd4e806e6b19 | 3,561 | py | Python | src/data/fetch_database.py | SoulaimenTheGreat/Wine-Prediction | 0e692ee430c09f90e7b49a3d3fb6450b6e25b663 | [
"MIT"
] | null | null | null | src/data/fetch_database.py | SoulaimenTheGreat/Wine-Prediction | 0e692ee430c09f90e7b49a3d3fb6450b6e25b663 | [
"MIT"
] | null | null | null | src/data/fetch_database.py | SoulaimenTheGreat/Wine-Prediction | 0e692ee430c09f90e7b49a3d3fb6450b6e25b663 | [
"MIT"
] | null | null | null | # import motor.motor_asyncio
from pymongo import MongoClient
from dotenv import load_dotenv
import os
import pandas as pd
from dagster import solid
def load_env_variables():
"""
Function to load environment variables from .env file
:return: database password and database name
"""
load_dotenv()
... | 40.011236 | 122 | 0.679584 | from pymongo import MongoClient
from dotenv import load_dotenv
import os
import pandas as pd
from dagster import solid
def load_env_variables():
load_dotenv()
database_password = os.environ.get('PASSWORD')
database_name = os.environ.get('DATABASE')
return database_password, database_name
def configu... | true | true |
f75813d6e7fab2d7ca05675b345cd90340b7c22e | 2,487 | py | Python | docs/conf.py | yukkun007/mmbooks | 4a05951ee30e33295b1b4c0b578f02ad6a4a20a5 | [
"MIT"
] | null | null | null | docs/conf.py | yukkun007/mmbooks | 4a05951ee30e33295b1b4c0b578f02ad6a4a20a5 | [
"MIT"
] | 41 | 2021-10-08T05:55:21.000Z | 2022-03-28T23:14:22.000Z | docs/conf.py | mozkzki/moz-books | 75fd44041ea8cb4cfe283fa5452443dbaaa4d732 | [
"MIT"
] | null | null | null | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | 34.068493 | 79 | 0.652191 |
import sys
sys.path.insert(0, "../src/moz_books")
project = "moz_books"
copyright = "2021, Author"
author = "Author"
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.viewcode",
"sphinx.ext.todo",
]
templates_path = ["_templates"]
language = "en"
exclude_patterns = ["_build", "Thumbs.db", ".DS_St... | true | true |
f75813ee1cd91d75187d16fced55c6146c03a419 | 6,418 | py | Python | pykey/__init__.py | jpconstantineau/CircuitPython_pykey | 3b0c6ca52e4e693f7c4d0a4c25797dd05a301b24 | [
"Unlicense",
"MIT-0",
"MIT"
] | null | null | null | pykey/__init__.py | jpconstantineau/CircuitPython_pykey | 3b0c6ca52e4e693f7c4d0a4c25797dd05a301b24 | [
"Unlicense",
"MIT-0",
"MIT"
] | null | null | null | pykey/__init__.py | jpconstantineau/CircuitPython_pykey | 3b0c6ca52e4e693f7c4d0a4c25797dd05a301b24 | [
"Unlicense",
"MIT-0",
"MIT"
] | null | null | null | # SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
# SPDX-FileCopyrightText: Copyright (c) 2021 Pierre Constantineau for jpconstantineau.com
#
# SPDX-License-Identifier: MIT
"""
`pykey`
================================================================================
keyboard hardware drive... | 36.05618 | 100 | 0.630259 |
__version__ = "0.0.0-auto.0"
__repo__ = "https://github.com/jpconstantineau/CircuitPython_pykey.git"
import os
import usb_hid
from adafruit_hid.keyboard import Keyboard
from BitmapKeyboard import BitmapKeyboard
class KB_Hardware:
def __init__(self, nkro: bool = False):
self._board_type = os.uname().ma... | true | true |
f758151c3a284214e61a109d6c60138ce2b4d38c | 2,920 | py | Python | algorithms/miniumum_edit_distance.py | josephedradan/algorithms | 6caa107b0df245653eab81143ebf0d9c7e5515fb | [
"MIT"
] | null | null | null | algorithms/miniumum_edit_distance.py | josephedradan/algorithms | 6caa107b0df245653eab81143ebf0d9c7e5515fb | [
"MIT"
] | null | null | null | algorithms/miniumum_edit_distance.py | josephedradan/algorithms | 6caa107b0df245653eab81143ebf0d9c7e5515fb | [
"MIT"
] | null | null | null | """
Created by Joseph Edradan
Github: https://github.com/josephedradan
Date created: 2/15/2021
Purpose:
Details:
Description:
Notes:
IMPORTANT NOTES:
Explanation:
Reference:
Minimum Edit Distance Algorithm in Python in 2020 (EXPLAINED)
Notes:
Using Rylan Fowers' minimum edit distance alg... | 28.349515 | 115 | 0.59726 |
import numpy as np
import pandas as pd
def min_edit_distance_fowers(source, target):
list_source_char = [c for c in source]
list_target_char = [c for c in target]
np_array = np.zeros((len(source), len(target)))
np_array[0] = [c for c in range(len(target))]
np_array[:, 0] = [c for c... | true | true |
f75815ee384de002b0fe9e06fe785367b505c291 | 927 | py | Python | src/utils.py | MahdiSajedei/Searching-for-activation-functions | 031ef131df7fe84fa2cafadc946b5a33df8925ec | [
"MIT"
] | 32 | 2018-01-29T07:31:41.000Z | 2022-03-19T11:02:00.000Z | src/utils.py | MahdiSajedei/Searching-for-activation-functions | 031ef131df7fe84fa2cafadc946b5a33df8925ec | [
"MIT"
] | 1 | 2020-01-21T17:23:18.000Z | 2020-01-21T17:23:18.000Z | src/utils.py | MahdiSajedei/Searching-for-activation-functions | 031ef131df7fe84fa2cafadc946b5a33df8925ec | [
"MIT"
] | 15 | 2018-03-30T02:14:42.000Z | 2021-07-21T08:20:57.000Z | import os
import shutil
import numpy as np
import tensorflow as tf
def path_exists(path, overwrite=False):
if not os.path.isdir(path):
os.mkdir(path)
elif overwrite == True :
shutil.rmtree(path)
return path
def remove_dir(path):
os.rmdir(path)
return True
def relu_init(shape, dtyp... | 25.75 | 87 | 0.699029 | import os
import shutil
import numpy as np
import tensorflow as tf
def path_exists(path, overwrite=False):
if not os.path.isdir(path):
os.mkdir(path)
elif overwrite == True :
shutil.rmtree(path)
return path
def remove_dir(path):
os.rmdir(path)
return True
def relu_init(shape, dtyp... | true | true |
f75815f4413cde337fb466fe129fed8e96bf58da | 4,804 | py | Python | newscrawler/record.py | gem763/crawly | df41e5fc67a4e5092120a1bfe459d57e201849b8 | [
"MIT"
] | null | null | null | newscrawler/record.py | gem763/crawly | df41e5fc67a4e5092120a1bfe459d57e201849b8 | [
"MIT"
] | 8 | 2021-03-31T19:21:03.000Z | 2022-03-12T00:04:28.000Z | newscrawler/record.py | gem763/crawly | df41e5fc67a4e5092120a1bfe459d57e201849b8 | [
"MIT"
] | null | null | null | import pandas as pd
import pandas_gbq as gbq
import json
from google.oauth2 import service_account
from IPython.core.debugger import set_trace
from pathlib import Path
import time
from . import accounts
'''
Configuration
'''
proj = 'global-news-crawl'
table_downloaded = 'news_dataset.downloaded'
table_trashed = 'news_... | 35.585185 | 134 | 0.614072 | import pandas as pd
import pandas_gbq as gbq
import json
from google.oauth2 import service_account
from IPython.core.debugger import set_trace
from pathlib import Path
import time
from . import accounts
proj = 'global-news-crawl'
table_downloaded = 'news_dataset.downloaded'
table_trashed = 'news_dataset.trashed'
crede... | true | true |
f75816ccc85e7dd6ca1b9a6dcb68a3b4d9dcfe2c | 8,780 | py | Python | ConcodeDecoder.py | sriniiyer/concode | 864e30807f6988731ac3b4b98af6562c18bb42ff | [
"MIT"
] | 48 | 2018-09-13T15:42:30.000Z | 2022-03-14T06:45:48.000Z | ConcodeDecoder.py | sriniiyer/concode | 864e30807f6988731ac3b4b98af6562c18bb42ff | [
"MIT"
] | 5 | 2021-01-25T13:58:32.000Z | 2022-01-29T19:02:36.000Z | ConcodeDecoder.py | sriniiyer/concode | 864e30807f6988731ac3b4b98af6562c18bb42ff | [
"MIT"
] | 12 | 2018-10-05T20:12:38.000Z | 2021-12-13T13:50:25.000Z | import torch
from torch import nn
from GlobalAttention import GlobalAttention
from torch.autograd import Variable
from Beam import TreeBeam
from UtilClass import bottle, unbottle
from preprocess import rhs, CDDataset
from decoders import DecoderState, Prediction
import torch.nn.functional as F
class ConcodeDecoder(nn.... | 36.736402 | 145 | 0.667995 | import torch
from torch import nn
from GlobalAttention import GlobalAttention
from torch.autograd import Variable
from Beam import TreeBeam
from UtilClass import bottle, unbottle
from preprocess import rhs, CDDataset
from decoders import DecoderState, Prediction
import torch.nn.functional as F
class ConcodeDecoder(nn.... | true | true |
f75816f7c496d58a2a1a60b4b6053935a0896a2c | 5,564 | py | Python | fastai/text/learner.py | bhoomit/fastai | 45c8e42bffd8d6cb4c9dc709136be566666f21b3 | [
"Apache-2.0"
] | 2 | 2019-03-06T23:19:16.000Z | 2020-08-12T23:44:31.000Z | fastai/text/learner.py | bhoomit/fastai | 45c8e42bffd8d6cb4c9dc709136be566666f21b3 | [
"Apache-2.0"
] | null | null | null | fastai/text/learner.py | bhoomit/fastai | 45c8e42bffd8d6cb4c9dc709136be566666f21b3 | [
"Apache-2.0"
] | 1 | 2019-04-03T03:05:21.000Z | 2019-04-03T03:05:21.000Z | 'Model training for NLP'
from ..torch_core import *
from ..basic_train import *
from ..callbacks import *
from ..basic_data import *
from ..datasets import untar_data
from ..metrics import accuracy
from ..train import GradientClipping
from .models import get_language_model, get_rnn_classifier
__all__ = ['RNNLearner', ... | 51.518519 | 121 | 0.65115 | from ..torch_core import *
from ..basic_train import *
from ..callbacks import *
from ..basic_data import *
from ..datasets import untar_data
from ..metrics import accuracy
from ..train import GradientClipping
from .models import get_language_model, get_rnn_classifier
__all__ = ['RNNLearner', 'convert_weights', 'lm_sp... | true | true |
f7581702a8ac66acacb236779e5e1be9b774027c | 2,488 | py | Python | penaltymodel_maxgap/penaltymodel/maxgap/interface.py | hhtong/penaltymodel | 95ba784392b688be0456676e2ecfa78aa041504f | [
"Apache-2.0"
] | 15 | 2018-01-03T18:48:56.000Z | 2021-11-05T08:24:22.000Z | penaltymodel_maxgap/penaltymodel/maxgap/interface.py | hhtong/penaltymodel | 95ba784392b688be0456676e2ecfa78aa041504f | [
"Apache-2.0"
] | 77 | 2017-12-15T01:23:35.000Z | 2022-01-07T23:41:58.000Z | penaltymodel_maxgap/penaltymodel/maxgap/interface.py | hhtong/penaltymodel | 95ba784392b688be0456676e2ecfa78aa041504f | [
"Apache-2.0"
] | 17 | 2017-12-15T00:47:34.000Z | 2022-01-26T06:07:13.000Z | # Copyright 2019 D-Wave 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 applicable law or... | 37.134328 | 99 | 0.657154 | import penaltymodel.core as pm
import dimod
from penaltymodel.maxgap.generation import generate
__all__ = 'get_penalty_model',
@pm.penaltymodel_factory(-100) def get_penalty_model(specification):
feasible_configurations = specification.feasible_configurations
if specification.vartype is dimod.BINARY:
... | true | true |
f7581756a639473fcc030ce428c5f9572dbd8f46 | 463 | py | Python | users/forms.py | pauloaugusto-dmf/blog_django | 7374e85dd4f0622aefbbb99d27ceb85f19fd1cd8 | [
"MIT"
] | 2 | 2021-12-31T22:14:31.000Z | 2021-12-31T22:14:34.000Z | users/forms.py | pauloaugusto-dmf/blog_django | 7374e85dd4f0622aefbbb99d27ceb85f19fd1cd8 | [
"MIT"
] | null | null | null | users/forms.py | pauloaugusto-dmf/blog_django | 7374e85dd4f0622aefbbb99d27ceb85f19fd1cd8 | [
"MIT"
] | null | null | null | from django.contrib.auth import forms
from django.forms import ModelForm
from .models import User
class UserChangeForm(forms.UserChangeForm):
class Meta(forms.UserChangeForm.Meta):
model = User
class UserCreationForm(forms.UserCreationForm):
class Meta(forms.UserCreationForm.Meta):
model = ... | 22.047619 | 65 | 0.712743 | from django.contrib.auth import forms
from django.forms import ModelForm
from .models import User
class UserChangeForm(forms.UserChangeForm):
class Meta(forms.UserChangeForm.Meta):
model = User
class UserCreationForm(forms.UserCreationForm):
class Meta(forms.UserCreationForm.Meta):
model = ... | true | true |
f758176ad2c5da0914a6ec7dc1d5061e8e166bfa | 6,537 | py | Python | moto/ecr/responses.py | harveywi/moto | 3a5d857a60c3a2d140ed2c8adfe8dcaf71a4cac8 | [
"Apache-2.0"
] | 2 | 2018-01-29T14:50:38.000Z | 2018-05-12T10:45:31.000Z | moto/ecr/responses.py | harveywi/moto | 3a5d857a60c3a2d140ed2c8adfe8dcaf71a4cac8 | [
"Apache-2.0"
] | 2 | 2021-03-31T20:15:51.000Z | 2021-12-13T20:50:52.000Z | moto/ecr/responses.py | harveywi/moto | 3a5d857a60c3a2d140ed2c8adfe8dcaf71a4cac8 | [
"Apache-2.0"
] | 12 | 2017-09-06T22:11:15.000Z | 2021-05-28T17:22:31.000Z | from __future__ import unicode_literals
import json
from base64 import b64encode
from datetime import datetime
import time
from moto.core.responses import BaseResponse
from .models import ecr_backends, DEFAULT_REGISTRY_ID
class ECRResponse(BaseResponse):
@property
def ecr_backend(self):
return ecr_ba... | 38.005814 | 113 | 0.666667 | from __future__ import unicode_literals
import json
from base64 import b64encode
from datetime import datetime
import time
from moto.core.responses import BaseResponse
from .models import ecr_backends, DEFAULT_REGISTRY_ID
class ECRResponse(BaseResponse):
@property
def ecr_backend(self):
return ecr_ba... | true | true |
f758186667be75f302ba0b1628b0621e1c28205f | 818 | py | Python | cloudify_types/cloudify_types/component/constants.py | cloudify-cosmo/cloudify-manager | 4a3f44ceb49d449bc5ebc8766b1c7b9c174ff972 | [
"Apache-2.0"
] | 124 | 2015-01-22T22:28:37.000Z | 2022-02-26T23:12:06.000Z | cloudify_types/cloudify_types/component/constants.py | cloudify-cosmo/cloudify-manager | 4a3f44ceb49d449bc5ebc8766b1c7b9c174ff972 | [
"Apache-2.0"
] | 345 | 2015-01-08T15:49:40.000Z | 2022-03-29T08:33:00.000Z | cloudify_types/cloudify_types/component/constants.py | cloudify-cosmo/cloudify-manager | 4a3f44ceb49d449bc5ebc8766b1c7b9c174ff972 | [
"Apache-2.0"
] | 77 | 2015-01-07T14:04:35.000Z | 2022-03-07T22:46:00.000Z | # Copyright (c) 2017-2019 Cloudify Platform Ltd. 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 ... | 35.565217 | 74 | 0.777506 |
DEPLOYMENTS_TIMEOUT = 120
EXECUTIONS_TIMEOUT = 1800
POLLING_INTERVAL = 1
PAGINATION_SIZE = 1000
DEPLOYMENTS_CREATE_RETRIES = 10
EXTERNAL_RESOURCE = 'external_resource'
CAPABILITIES = 'capabilities'
| true | true |
f75818a308758a092e5fd60625f2e765ffbcb636 | 18,665 | py | Python | v0.7.1/autopilotrpc/autopilot_pb2.py | lncm/lnd-proto | 8caa6558efe043413560f807ef44b11699901d76 | [
"MIT"
] | 2 | 2020-02-10T09:46:06.000Z | 2020-04-09T19:30:30.000Z | v0.7.1/autopilotrpc/autopilot_pb2.py | lncm/lnd-rpc | 8caa6558efe043413560f807ef44b11699901d76 | [
"MIT"
] | 1 | 2020-02-04T16:34:35.000Z | 2020-02-04T16:34:35.000Z | v0.7.1/autopilotrpc/autopilot_pb2.py | lncm/lnd-proto | 8caa6558efe043413560f807ef44b11699901d76 | [
"MIT"
] | null | null | null | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: autopilotrpc/autopilot.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import refle... | 35.150659 | 1,656 | 0.769569 |
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
_sym_db = _s... | true | true |
f7581b0ec4544d6a4d8882b78f87009eb79f1a99 | 1,674 | py | Python | stonehenge_ascii_art.py | RachaelAva1024/stonehenge_ascii_art_py | 263e9e56ccbeeea7e624a288f608c1d2fbd30ad2 | [
"MIT"
] | null | null | null | stonehenge_ascii_art.py | RachaelAva1024/stonehenge_ascii_art_py | 263e9e56ccbeeea7e624a288f608c1d2fbd30ad2 | [
"MIT"
] | null | null | null | stonehenge_ascii_art.py | RachaelAva1024/stonehenge_ascii_art_py | 263e9e56ccbeeea7e624a288f608c1d2fbd30ad2 | [
"MIT"
] | null | null | null | # MARK: - Licensing Information
# MIT License
# Copyright © 2022 Wolftail Software, Rachael Ava
# MARK: - Acknowledgements
# Stonehenge ASCII Artwork by lgbeard.
# MARK: - Print Command
print(" .-----------. .------------.\n :`.__________` :`.____________` .-----.._\n ... | 139.5 | 1,474 | 0.207288 |
print(" .-----------. .------------.\n :`.__________` :`.____________` .-----.._\n '.'_.------._.' `.|__.-------..' |`-..___.'|\n | ||__..| | |-._ __ | | |.... || |-._`--..__ |.'---.\n .::/ / | | | | ___ `-| | | _ || | | | | | | \\ `.\... | true | true |
f7581c3c8cad484f92ece87f8f1b92a2d3e3315c | 1,954 | py | Python | Ejemplos/NotasFunciones/app/__init__.py | ampotty/uip-pc3 | 8362680226df6629791e7a4c6cdf1b738eadc5de | [
"MIT"
] | 10 | 2015-10-27T18:29:06.000Z | 2019-04-03T04:05:31.000Z | Ejemplos/NotasFunciones/app/__init__.py | abdelgmartinezl/uip-pc3 | 8362680226df6629791e7a4c6cdf1b738eadc5de | [
"MIT"
] | 5 | 2015-10-13T01:12:51.000Z | 2016-10-08T18:01:17.000Z | Ejemplos/NotasFunciones/app/__init__.py | ampotty/uip-pc3 | 8362680226df6629791e7a4c6cdf1b738eadc5de | [
"MIT"
] | 25 | 2015-09-19T00:40:17.000Z | 2018-02-08T02:54:55.000Z | notas = []
def menu():
print("\nSISTEMA DE NOTAS\n")
print("1. Ingresar nota")
print("2. Cambiar nota")
print("3. Ver notas")
print("4. Estado final")
print("5. Salir")
while True:
try:
opcion = int(input("\nOPCION > "))
except:
opcion = -1
i... | 19.156863 | 68 | 0.452405 | notas = []
def menu():
print("\nSISTEMA DE NOTAS\n")
print("1. Ingresar nota")
print("2. Cambiar nota")
print("3. Ver notas")
print("4. Estado final")
print("5. Salir")
while True:
try:
opcion = int(input("\nOPCION > "))
except:
opcion = -1
i... | true | true |
f7581c8b846fd9de9dcdd1e8c19cb593ed1e4f94 | 1,509 | py | Python | test/test_api.py | frodo19/script.module.inputstreamhelper | 123e3f4050a888adb864d5e46ca7bdaa63da1a5f | [
"MIT"
] | null | null | null | test/test_api.py | frodo19/script.module.inputstreamhelper | 123e3f4050a888adb864d5e46ca7bdaa63da1a5f | [
"MIT"
] | null | null | null | test/test_api.py | frodo19/script.module.inputstreamhelper | 123e3f4050a888adb864d5e46ca7bdaa63da1a5f | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright: (c) 2019, Dag Wieers (@dagwieers) <dag@wieers.com>
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# pylint: disable=invalid-name,missing-docstring
from __future__ import absolute_import, division, print_function, unicode_literals
import... | 30.795918 | 103 | 0.670643 |
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import unittest
import default
xbmc = __import__('xbmc')
xbmcaddon = __import__('xbmcaddon')
xbmcgui = __import__('xbmcgui')
xbmcvfs = __import__('xbmcvfs')
class TestApi(unittest.TestCase):
@staticmethod
def test... | true | true |
f7581e010f3ff7f2eeacc2ecbeeb13ecfccd7975 | 2,129 | py | Python | Data Structures/Heap/heap.py | DiAshish/HacktoberFestContribute | 92e6da7736fc53af135e09c5e144293c244dc427 | [
"MIT"
] | null | null | null | Data Structures/Heap/heap.py | DiAshish/HacktoberFestContribute | 92e6da7736fc53af135e09c5e144293c244dc427 | [
"MIT"
] | null | null | null | Data Structures/Heap/heap.py | DiAshish/HacktoberFestContribute | 92e6da7736fc53af135e09c5e144293c244dc427 | [
"MIT"
] | null | null | null | class BinaryHeap(object):
def __init__(self):
self.heap = [0]
self.currentSize = 0
def __repr__(self):
heap = self.heap[1:]
return ' '.join(str(i) for i in heap)
# for shifting the node up
def shiftUp(self, index):
while (index // 2) > 0:
if self.hea... | 29.985915 | 95 | 0.537341 | class BinaryHeap(object):
def __init__(self):
self.heap = [0]
self.currentSize = 0
def __repr__(self):
heap = self.heap[1:]
return ' '.join(str(i) for i in heap)
def shiftUp(self, index):
while (index // 2) > 0:
if self.heap[index] < self.heap[index ... | true | true |
f7581e57e08880651f6ffda9080d5a651d105149 | 3,491 | py | Python | el737.py | michele-brambilla/sinq-amorsim-control | a83e491f932ae8bbd53f296c0b9bcd9d2dd4bcdb | [
"BSD-2-Clause"
] | null | null | null | el737.py | michele-brambilla/sinq-amorsim-control | a83e491f932ae8bbd53f296c0b9bcd9d2dd4bcdb | [
"BSD-2-Clause"
] | null | null | null | el737.py | michele-brambilla/sinq-amorsim-control | a83e491f932ae8bbd53f296c0b9bcd9d2dd4bcdb | [
"BSD-2-Clause"
] | null | null | null | import Tkinter, tkFileDialog
import socket
import sys
class Connector:
def __init__(self):
self.connected = False
def connect(self,host,port):
if not self.connected:
try:
self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
... | 29.584746 | 79 | 0.539673 | import Tkinter, tkFileDialog
import socket
import sys
class Connector:
def __init__(self):
self.connected = False
def connect(self,host,port):
if not self.connected:
try:
self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
... | true | true |
f7581e6700f4c1a7343043e32689136a34260cdf | 4,178 | py | Python | configs/body/2d_kpt_sview_rgb_img/topdown_heatmap/ochuman/res152_ochuman_256x192.py | pallgeuer/mmpose | d3c17d5e6bdb9dbaca19f3bf53aa2802105355fd | [
"Apache-2.0"
] | null | null | null | configs/body/2d_kpt_sview_rgb_img/topdown_heatmap/ochuman/res152_ochuman_256x192.py | pallgeuer/mmpose | d3c17d5e6bdb9dbaca19f3bf53aa2802105355fd | [
"Apache-2.0"
] | null | null | null | configs/body/2d_kpt_sview_rgb_img/topdown_heatmap/ochuman/res152_ochuman_256x192.py | pallgeuer/mmpose | d3c17d5e6bdb9dbaca19f3bf53aa2802105355fd | [
"Apache-2.0"
] | null | null | null | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/ochuman.py'
]
evaluation = dict(interval=10, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup... | 29.631206 | 79 | 0.631642 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/ochuman.py'
]
evaluation = dict(interval=10, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
lr_config = dict(
policy='step',
warmup='linear',
war... | true | true |
f7581eb2605e1ecc9b9e375771a3f8def4533ca5 | 986 | py | Python | fdrtd/handle.py | UNakade/server | f659524242d01fe67f9801ab41fabf46640ad590 | [
"MIT"
] | null | null | null | fdrtd/handle.py | UNakade/server | f659524242d01fe67f9801ab41fabf46640ad590 | [
"MIT"
] | null | null | null | fdrtd/handle.py | UNakade/server | f659524242d01fe67f9801ab41fabf46640ad590 | [
"MIT"
] | null | null | null | class Handle(dict):
def __init__(self, api, handle, callback):
# derive from dict so instances get auto serialized to JSON when passed as a parameter to an API call
super().__init__(handle=handle, callback=callback)
# however, api is a client-side instance and should not get serialized, s... | 44.818182 | 109 | 0.547667 | class Handle(dict):
def __init__(self, api, handle, callback):
super().__init__(handle=handle, callback=callback)
self.api = api
def __getattr__(self, attr):
if attr in self.__dict__:
return super().__getattr__(attr)
... | true | true |
f7581eb7df7f5228cd668dd1ea3531a824de33c8 | 24,737 | py | Python | geopandas/tests/test_geom_methods.py | ngohaily/geopandas | 2725f346e430edb6a5164c21dd707de328329f31 | [
"BSD-3-Clause"
] | null | null | null | geopandas/tests/test_geom_methods.py | ngohaily/geopandas | 2725f346e430edb6a5164c21dd707de328329f31 | [
"BSD-3-Clause"
] | null | null | null | geopandas/tests/test_geom_methods.py | ngohaily/geopandas | 2725f346e430edb6a5164c21dd707de328329f31 | [
"BSD-3-Clause"
] | null | null | null | from __future__ import absolute_import
import string
import numpy as np
from pandas import Series, DataFrame, MultiIndex
from shapely.geometry import (
Point, LinearRing, LineString, Polygon, MultiPoint)
from shapely.geometry.collection import GeometryCollection
from shapely.ops import unary_union
from geopandas... | 39.390127 | 79 | 0.585964 | from __future__ import absolute_import
import string
import numpy as np
from pandas import Series, DataFrame, MultiIndex
from shapely.geometry import (
Point, LinearRing, LineString, Polygon, MultiPoint)
from shapely.geometry.collection import GeometryCollection
from shapely.ops import unary_union
from geopandas... | true | true |
f7582034686c4b6c71a489b1ad89f5f66882dd4b | 9,023 | py | Python | src/config/schema-transformer/test/test_route_table.py | kaweue/contrail-controller | 66a8f1d13e2c28ddae6b5a5be6f068a03bea94e3 | [
"Apache-2.0"
] | null | null | null | src/config/schema-transformer/test/test_route_table.py | kaweue/contrail-controller | 66a8f1d13e2c28ddae6b5a5be6f068a03bea94e3 | [
"Apache-2.0"
] | 2 | 2018-12-04T02:20:52.000Z | 2018-12-22T06:16:30.000Z | src/config/schema-transformer/test/test_route_table.py | kaweue/contrail-controller | 66a8f1d13e2c28ddae6b5a5be6f068a03bea94e3 | [
"Apache-2.0"
] | 1 | 2018-12-04T02:07:47.000Z | 2018-12-04T02:07:47.000Z | #
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
import gevent
try:
import to_bgp
except ImportError:
from schema_transformer import to_bgp
from vnc_api.vnc_api import (RouteTargetList, RouteTable, RouteTableType,
VirtualNetwork, VirtualMachineInterface, NetworkIpam, VnSubnetsType,... | 38.07173 | 93 | 0.624183 |
import gevent
try:
import to_bgp
except ImportError:
from schema_transformer import to_bgp
from vnc_api.vnc_api import (RouteTargetList, RouteTable, RouteTableType,
VirtualNetwork, VirtualMachineInterface, NetworkIpam, VnSubnetsType, IpamSubnetType,
LogicalRouter, SubnetType, RouteType, Commun... | true | true |
f7582093ca3801b029c3766207d2b8ce25dc8d9e | 1,590 | py | Python | bbutil/__init__.py | TheUncleKai/bbutils | 62a1258849c284de5e33fe85fb10a50e5b9f034e | [
"Apache-2.0"
] | null | null | null | bbutil/__init__.py | TheUncleKai/bbutils | 62a1258849c284de5e33fe85fb10a50e5b9f034e | [
"Apache-2.0"
] | 9 | 2020-01-11T23:23:39.000Z | 2021-12-10T15:08:30.000Z | bbutil/__init__.py | TheUncleKai/bbutils | 62a1258849c284de5e33fe85fb10a50e5b9f034e | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# 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 ... | 23.043478 | 99 | 0.703774 |
__all__ = [
"logging",
"lang",
"data",
"utils"
]
__name__ = "bbutils"
__author__ = "Kai Raphahn"
__email__ = "kai.raphahn@laburec.de"
__year__ = 2020
__copyright__ = "Copyright (C) {0:d}, {1:s} <{2:s}>".format(__year__, __author__, __email__)
__description__ = "Small collection of stuff for all... | true | true |
f7582232e4939500cc9dda6160bc230ad3cd207f | 20,190 | py | Python | xbee/backend/base.py | PowerFlex/python-xbee-intercept | 0c07f3a5f16f479ad7c925cd31638598030cf5a7 | [
"MIT"
] | null | null | null | xbee/backend/base.py | PowerFlex/python-xbee-intercept | 0c07f3a5f16f479ad7c925cd31638598030cf5a7 | [
"MIT"
] | null | null | null | xbee/backend/base.py | PowerFlex/python-xbee-intercept | 0c07f3a5f16f479ad7c925cd31638598030cf5a7 | [
"MIT"
] | null | null | null | """
base.py
By Paul Malmsten, 2010
Inspired by code written by Amit Synderman and Marco Sangalli
pmalmsten@gmail.com
XBee superclass module
This class defines data and methods common to all XBee modules.
This class should be subclassed in order to provide
series-specific functionality.
"""
from xbee.frame import API... | 39.433594 | 81 | 0.520505 | from xbee.frame import APIFrame
from xbee.python2to3 import byteToInt, stringToBytes
class CommandFrameException(KeyError):
pass
class XBeeBase(object):
def __init__(self, ser, shorthand=True, callback=None,
escaped=False, error_callback=None):
self.serial = ser
self.shorth... | true | true |
f758228473fea79024639644c2e98a41e67b5bb2 | 3,306 | py | Python | funfact/legacy/rbf/_base.py | terryjx/FunFact | 595c3b68bac7cc92c802969f207f060c1242a88b | [
"BSD-3-Clause-LBNL"
] | 1 | 2021-12-13T07:55:16.000Z | 2021-12-13T07:55:16.000Z | funfact/legacy/rbf/_base.py | terryjx/FunFact | 595c3b68bac7cc92c802969f207f060c1242a88b | [
"BSD-3-Clause-LBNL"
] | null | null | null | funfact/legacy/rbf/_base.py | terryjx/FunFact | 595c3b68bac7cc92c802969f207f060c1242a88b | [
"BSD-3-Clause-LBNL"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import namedtuple
import dill
import numpy as np
import pycuda.driver as cuda
from funfact.cuda import context_manager, ManagedArray
class RBFExpansionBasePyCUDA:
def __init__(self):
context_manager.autoinit()
@staticmethod
def as_na... | 28.25641 | 80 | 0.54386 | from collections import namedtuple
import dill
import numpy as np
import pycuda.driver as cuda
from funfact.cuda import context_manager, ManagedArray
class RBFExpansionBasePyCUDA:
def __init__(self):
context_manager.autoinit()
@staticmethod
def as_namedtuple(name, **kwargs):
return named... | true | true |
f75822b965b71024cf9925ed8c3b693ec4c8e7dc | 994 | py | Python | shamrock/types/mempool_item.py | zcomputerwiz/shamrock-blockchain | 2e2d8a134f0147379812085543ac98f37ce28c2b | [
"Apache-2.0"
] | 3 | 2022-02-10T09:46:23.000Z | 2022-03-22T17:10:50.000Z | shamrock/types/mempool_item.py | zcomputerwiz/shamrock-blockchain | 2e2d8a134f0147379812085543ac98f37ce28c2b | [
"Apache-2.0"
] | null | null | null | shamrock/types/mempool_item.py | zcomputerwiz/shamrock-blockchain | 2e2d8a134f0147379812085543ac98f37ce28c2b | [
"Apache-2.0"
] | null | null | null | from dataclasses import dataclass
from typing import List
from shamrock.consensus.cost_calculator import NPCResult
from shamrock.types.blockchain_format.coin import Coin
from shamrock.types.blockchain_format.program import SerializedProgram
from shamrock.types.blockchain_format.sized_bytes import bytes32
from shamrock... | 28.4 | 70 | 0.77163 | from dataclasses import dataclass
from typing import List
from shamrock.consensus.cost_calculator import NPCResult
from shamrock.types.blockchain_format.coin import Coin
from shamrock.types.blockchain_format.program import SerializedProgram
from shamrock.types.blockchain_format.sized_bytes import bytes32
from shamrock... | true | true |
f75822d3ca52fb284810c4c74466a25b0732a6a4 | 2,649 | py | Python | Libraries/Python.framework/Versions/2.7/lib/python2.7/site-packages/pydicom-0.9.8-py2.7.egg/dicom/test/test_multival.py | mlewis1973/pyosirix | 77757744f250ea1e3be083f50dce70f7aa094c5d | [
"BSD-3-Clause"
] | 20 | 2016-02-02T10:31:41.000Z | 2021-11-08T08:35:25.000Z | Libraries/Python.framework/Versions/2.7/lib/python2.7/site-packages/pydicom-0.9.8-py2.7.egg/dicom/test/test_multival.py | mlewis1973/pyosirix | 77757744f250ea1e3be083f50dce70f7aa094c5d | [
"BSD-3-Clause"
] | 7 | 2016-10-21T04:15:22.000Z | 2020-02-15T04:06:19.000Z | Libraries/Python.framework/Versions/2.7/lib/python2.7/site-packages/pydicom-0.9.8-py2.7.egg/dicom/test/test_multival.py | mlewis1973/pyosirix | 77757744f250ea1e3be083f50dce70f7aa094c5d | [
"BSD-3-Clause"
] | 9 | 2018-01-24T21:46:10.000Z | 2022-03-08T09:42:42.000Z | # test_multival.py
"""Test suite for MultiValue class"""
# Copyright (c) 2012 Darcy Mason
# This file is part of pydicom, relased under an MIT-style license.
# See the file license.txt included with this distribution, also
# available at http://pydicom.googlecode.com
import unittest
from dicom.multival import Mu... | 40.753846 | 136 | 0.653832 |
import unittest
from dicom.multival import MultiValue
from dicom.valuerep import DS, DSfloat, DSdecimal, IS
import dicom.config
import sys
python_version = sys.version_info
class MultiValuetests(unittest.TestCase):
def testMultiDS(self):
multival = MultiValue(DS, ['11.1', '22.2', '33.3'])
for va... | true | true |
f75823411ab9c6a8b01e8c136a3bc04017872768 | 3,385 | py | Python | HW/2/script/download.py | houzeyu2683/IRRHW | c44298ad14c468eff36bc75ebc63abdc9ba24d55 | [
"Apache-2.0"
] | null | null | null | HW/2/script/download.py | houzeyu2683/IRRHW | c44298ad14c468eff36bc75ebc63abdc9ba24d55 | [
"Apache-2.0"
] | null | null | null | HW/2/script/download.py | houzeyu2683/IRRHW | c44298ad14c468eff36bc75ebc63abdc9ba24d55 | [
"Apache-2.0"
] | 1 | 2022-01-16T03:40:34.000Z | 2022-01-16T03:40:34.000Z |
##
## The packages.
from selenium import webdriver
import pandas, os, tqdm, time
##
## The arguments.
# keyword = ["Covid-19", "Stroke", "Myocardial Infarction", "influenza", "asthma", "chest cavity"]
keyword = ["chest cavity"]
for k in keyword:
platform = "pubmed"
site = "https://pubmed.ncbi.nlm.nih.... | 21.83871 | 117 | 0.512851 |
from selenium import webdriver
import pandas, os, tqdm, time
keyword = ["chest cavity"]
for k in keyword:
platform = "pubmed"
site = "https://pubmed.ncbi.nlm.nih.gov/"
number = 100
folder = "resource/csv/{}".format(k)
os.makedirs(folder) if not os.path.isdir(folder) else None
op... | true | true |
f75823cb0417aa7ef243589110dc60789a16927f | 3,669 | py | Python | pvrcnn/inference.py | eraofelix/PV-RCNN | 6361ec99cc1c92120263ef56b2c2b003c2cd7264 | [
"MIT"
] | 1 | 2020-03-01T19:47:14.000Z | 2020-03-01T19:47:14.000Z | pvrcnn/inference.py | eraofelix/PV-RCNN | 6361ec99cc1c92120263ef56b2c2b003c2cd7264 | [
"MIT"
] | null | null | null | pvrcnn/inference.py | eraofelix/PV-RCNN | 6361ec99cc1c92120263ef56b2c2b003c2cd7264 | [
"MIT"
] | null | null | null | import copy
import os
import os.path as osp
import numpy as np
import torch
import sys
sys.path.remove('/opt/ros/kinetic/lib/python2.7/dist-packages')
sys.path.append('/opt/ros/kinetic/lib/python2.7/dist-packages')
import cv2
from tqdm import tqdm
import time
from pvrcnn.core import cfg, Preprocessor
from pvrcnn.detect... | 36.326733 | 92 | 0.669392 | import copy
import os
import os.path as osp
import numpy as np
import torch
import sys
sys.path.remove('/opt/ros/kinetic/lib/python2.7/dist-packages')
sys.path.append('/opt/ros/kinetic/lib/python2.7/dist-packages')
import cv2
from tqdm import tqdm
import time
from pvrcnn.core import cfg, Preprocessor
from pvrcnn.detect... | true | true |
f758243fa477c542c1218633114993f0c127f9a8 | 6,130 | py | Python | rip.py | jiomvk/dash-widevine-rip | aec41bca7f7c7f4568d2134490584c05e30603ca | [
"MIT"
] | 1 | 2021-12-24T22:20:00.000Z | 2021-12-24T22:20:00.000Z | rip.py | jiomvk/dash-widevine-rip | aec41bca7f7c7f4568d2134490584c05e30603ca | [
"MIT"
] | null | null | null | rip.py | jiomvk/dash-widevine-rip | aec41bca7f7c7f4568d2134490584c05e30603ca | [
"MIT"
] | null | null | null | """
Given a TOML playlist configuration, rips a Widevine DRM-encrypted DASH stream by parsing
the MPD configuration, decrypting audio and video parts individually, then
combining them into a single video file.
"""
import os
import sys
from enum import Enum
from typing import Dict, List, Optional, Union
import requests... | 31.761658 | 89 | 0.640457 | import os
import sys
from enum import Enum
from typing import Dict, List, Optional, Union
import requests
import toml
import xmltodict
import ffmpeg
from pydantic import BaseModel, Field
class ContentType(str, Enum):
video = "video"
audio = "audio"
class Source(BaseModel):
base: str = Field(...)
mp... | true | true |
f75824648fb036d40497b5b70bc5deb62bff905c | 1,713 | py | Python | audio/python/synthesize_stream.py | oleges1/tinkoff_bot | fba35d03c3bd8b39caf7b1af978874ec27f7f27f | [
"MIT"
] | null | null | null | audio/python/synthesize_stream.py | oleges1/tinkoff_bot | fba35d03c3bd8b39caf7b1af978874ec27f7f27f | [
"MIT"
] | null | null | null | audio/python/synthesize_stream.py | oleges1/tinkoff_bot | fba35d03c3bd8b39caf7b1af978874ec27f7f27f | [
"MIT"
] | null | null | null | #! /usr/bin/env python3
from tinkoff.cloud.tts.v1 import tts_pb2_grpc, tts_pb2
from auth import authorization_metadata
from audio import audio_open_write
from common import (
BaseSynthesisParser,
make_channel,
build_synthesis_request,
)
def synthesize():
args = BaseSynthesisParser().parse_args()
if... | 40.785714 | 93 | 0.7338 | from tinkoff.cloud.tts.v1 import tts_pb2_grpc, tts_pb2
from auth import authorization_metadata
from audio import audio_open_write
from common import (
BaseSynthesisParser,
make_channel,
build_synthesis_request,
)
def synthesize():
args = BaseSynthesisParser().parse_args()
if args.encoding == tts_pb... | true | true |
f7582465af717ebc8cb4ef2e50cb43a5d0f86912 | 1,109 | py | Python | terraform/nginx/shared/tls-function/tls.py | cicdenv/cicdenv | 5b72fd9ef000bf07c2052471b59edaa91af18778 | [
"MIT"
] | 8 | 2020-08-10T20:57:24.000Z | 2021-08-08T10:46:20.000Z | terraform/nginx/shared/tls-function/tls.py | cicdenv/cicdenv | 5b72fd9ef000bf07c2052471b59edaa91af18778 | [
"MIT"
] | null | null | null | terraform/nginx/shared/tls-function/tls.py | cicdenv/cicdenv | 5b72fd9ef000bf07c2052471b59edaa91af18778 | [
"MIT"
] | 1 | 2020-08-10T20:42:09.000Z | 2020-08-10T20:42:09.000Z | from sys import stdout, stderr
from subprocess import check_call
from os import path, remove
from base64 import b64encode
from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat, PrivateFormat, NoEncryption
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.back... | 29.184211 | 132 | 0.770965 | from sys import stdout, stderr
from subprocess import check_call
from os import path, remove
from base64 import b64encode
from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat, PrivateFormat, NoEncryption
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.back... | true | true |
f75824f31839707f9c3d79c319dd78554532922e | 2,424 | py | Python | sark/encodings/hex_bytes.py | yannayl/Sark | 30abd3fbba67389c9b1a30ede724e2fd96c7534f | [
"MIT"
] | 5 | 2016-05-27T01:47:00.000Z | 2022-03-05T02:29:27.000Z | sark/encodings/hex_bytes.py | shemesh999/Sark | 421f22124006567d79443135046519f0487c7261 | [
"MIT"
] | null | null | null | sark/encodings/hex_bytes.py | shemesh999/Sark | 421f22124006567d79443135046519f0487c7261 | [
"MIT"
] | 2 | 2016-05-27T08:57:43.000Z | 2022-03-05T02:29:34.000Z | """ Python 'hex_bytes' Codec - 2-digit hex codec with spaces between bytes.
Unlike most of the other codecs which target Unicode, this codec
will return Python string objects for both encode and decode.
"""
import codecs, binascii
from string import hexdigits
### Codec APIs
def hex_encode(input, errors='stri... | 28.857143 | 83 | 0.686056 | import codecs, binascii
from string import hexdigits
def hex_encode(input, errors='strict'):
assert errors == 'strict'
temp = binascii.b2a_hex(input)
output = " ".join(temp[i:i + 2] for i in xrange(0, len(temp), 2))
return (output, len(input))
def hex_decode(input, errors='strict'):
assert error... | true | true |
f75825331bc88387482825963835c59f21daa975 | 423 | py | Python | Mundo 1/ex006.py | judigunkel/judi-exercicios-python | c61bb75b1ae6141defcf42214194e141a70af15d | [
"MIT"
] | null | null | null | Mundo 1/ex006.py | judigunkel/judi-exercicios-python | c61bb75b1ae6141defcf42214194e141a70af15d | [
"MIT"
] | null | null | null | Mundo 1/ex006.py | judigunkel/judi-exercicios-python | c61bb75b1ae6141defcf42214194e141a70af15d | [
"MIT"
] | 1 | 2021-03-06T02:41:36.000Z | 2021-03-06T02:41:36.000Z | """
Crie um algoritmo que leia um número e mostre seu dobro, triplo e raíz quadrada
"""
# importando a função sqrt (raíz quadrada) da biblioteca math
from math import sqrt
n = int(input('Digite um número inteiro: '))
print(f'O dobro de \033[35m{n}\033[m é \033[31m{n * 2}\033[m')
print(f'O triplo de \033[35m{n}\033[m ... | 35.25 | 79 | 0.680851 |
from math import sqrt
n = int(input('Digite um número inteiro: '))
print(f'O dobro de \033[35m{n}\033[m é \033[31m{n * 2}\033[m')
print(f'O triplo de \033[35m{n}\033[m é \033[33m{n * 3}\033[m')
print(f'A raíz quadrada de \033[35m{n}\033[m é \033[34m{sqrt(n):.1f}\033[m')
| true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.