hexsha stringlengths 40 40 | size int64 4 996k | ext stringclasses 8
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 4 996k | avg_line_length float64 1.33 58.2k | max_line_length int64 2 323k | alphanum_fraction float64 0 0.97 | content_no_comment stringlengths 0 946k | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f7f5323c0ecb93023af8ca06a7ed9f607268d682 | 7,924 | py | Python | assignment2/q1_classifier.py | junteudjio/stanford_NLP_CS224n_assigment2 | 69c579b211293cdafe5ba07551448b42a28f34c5 | [
"MIT"
] | null | null | null | assignment2/q1_classifier.py | junteudjio/stanford_NLP_CS224n_assigment2 | 69c579b211293cdafe5ba07551448b42a28f34c5 | [
"MIT"
] | null | null | null | assignment2/q1_classifier.py | junteudjio/stanford_NLP_CS224n_assigment2 | 69c579b211293cdafe5ba07551448b42a28f34c5 | [
"MIT"
] | null | null | null | import time
import numpy as np
import tensorflow as tf
from q1_softmax import softmax
from q1_softmax import cross_entropy_loss
from model import Model
from utils.general_utils import get_minibatches
class Config(object):
"""Holds model hyperparams and data information.
The config class is used to store va... | 35.533632 | 121 | 0.627839 | import time
import numpy as np
import tensorflow as tf
from q1_softmax import softmax
from q1_softmax import cross_entropy_loss
from model import Model
from utils.general_utils import get_minibatches
class Config(object):
"""Holds model hyperparams and data information.
The config class is used to store va... | false | true |
f7f5338453578b70b526478111e0bcf82e38c627 | 2,215 | py | Python | datasets/columns.py | math-sasso/datasets | 07a5a87ba8f40e49c8ff5d3590b163461bf7779f | [
"Apache-2.0"
] | null | null | null | datasets/columns.py | math-sasso/datasets | 07a5a87ba8f40e49c8ff5d3590b163461bf7779f | [
"Apache-2.0"
] | null | null | null | datasets/columns.py | math-sasso/datasets | 07a5a87ba8f40e49c8ff5d3590b163461bf7779f | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from typing import Dict, List
from platiagro import load_dataset, save_dataset, stat_dataset
from platiagro.featuretypes import validate_featuretypes
from werkzeug.exceptions import BadRequest, NotFound
def list_columns(dataset: str) -> List[Dict[str, str]]:
"""Lists all columns from a da... | 29.533333 | 100 | 0.654628 |
from typing import Dict, List
from platiagro import load_dataset, save_dataset, stat_dataset
from platiagro.featuretypes import validate_featuretypes
from werkzeug.exceptions import BadRequest, NotFound
def list_columns(dataset: str) -> List[Dict[str, str]]:
try:
metadata = stat_dataset(dataset)
... | true | true |
f7f5338f6024957a5790b9d27c48e6729fecf1a0 | 1,361 | py | Python | src/schemathesis/service/handler.py | gluhar2006/schemathesis | 3cb6b0b4f5d93242da1f2e79575b6b7b3b7a63d1 | [
"MIT"
] | 659 | 2020-09-03T13:27:50.000Z | 2022-03-31T17:07:16.000Z | src/schemathesis/service/handler.py | gluhar2006/schemathesis | 3cb6b0b4f5d93242da1f2e79575b6b7b3b7a63d1 | [
"MIT"
] | 570 | 2020-09-03T15:57:43.000Z | 2022-03-31T17:13:52.000Z | src/schemathesis/service/handler.py | gluhar2006/schemathesis | 3cb6b0b4f5d93242da1f2e79575b6b7b3b7a63d1 | [
"MIT"
] | 66 | 2020-09-05T07:09:03.000Z | 2022-03-17T08:17:55.000Z | import threading
from queue import Queue
import attr
from ..cli.context import ExecutionContext
from ..cli.handlers import EventHandler
from ..runner import events
from . import worker
from .constants import DEFAULT_URL, STOP_MARKER, WORKER_JOIN_TIMEOUT
@attr.s(slots=True) # pragma: no mutate
class ServiceReporter... | 34.025 | 114 | 0.689199 | import threading
from queue import Queue
import attr
from ..cli.context import ExecutionContext
from ..cli.handlers import EventHandler
from ..runner import events
from . import worker
from .constants import DEFAULT_URL, STOP_MARKER, WORKER_JOIN_TIMEOUT
@attr.s(slots=True)
class ServiceReporter(EventHandler):
... | true | true |
f7f533b85a402cb7b0d8f610041f458d8977cf7f | 3,734 | py | Python | src/the_tale/the_tale/game/bills/tests/test_place_description.py | al-arz/the-tale | 542770257eb6ebd56a5ac44ea1ef93ff4ab19eb5 | [
"BSD-3-Clause"
] | 1 | 2020-04-02T11:51:20.000Z | 2020-04-02T11:51:20.000Z | src/the_tale/the_tale/game/bills/tests/test_place_description.py | devapromix/the-tale | 2a10efd3270734f8cf482b4cfbc5353ef8f0494c | [
"BSD-3-Clause"
] | null | null | null | src/the_tale/the_tale/game/bills/tests/test_place_description.py | devapromix/the-tale | 2a10efd3270734f8cf482b4cfbc5353ef8f0494c | [
"BSD-3-Clause"
] | null | null | null |
import smart_imports
smart_imports.all()
class PlaceDescriptionTests(helpers.BaseTestPrototypes):
def setUp(self):
super(PlaceDescriptionTests, self).setUp()
self.place = places_storage.places.all()[0]
self.place.description = 'old description'
places_logic.save_place(self.plac... | 43.418605 | 147 | 0.663364 |
import smart_imports
smart_imports.all()
class PlaceDescriptionTests(helpers.BaseTestPrototypes):
def setUp(self):
super(PlaceDescriptionTests, self).setUp()
self.place = places_storage.places.all()[0]
self.place.description = 'old description'
places_logic.save_place(self.plac... | true | true |
f7f533c6e7e3733c5d4d3fe653d525a07fd8c8e1 | 1,407 | py | Python | slp/modules/norm.py | PansoK/slp | e2c478b00f8f054b24eebb257e18a57451471c79 | [
"MIT"
] | 21 | 2018-11-22T00:43:02.000Z | 2021-12-07T21:19:13.000Z | slp/modules/norm.py | baby636/slp | ac55154f063245e0e4ed584c59f16370d228d8a7 | [
"MIT"
] | 5 | 2018-12-11T16:00:52.000Z | 2021-06-02T04:09:37.000Z | slp/modules/norm.py | baby636/slp | ac55154f063245e0e4ed584c59f16370d228d8a7 | [
"MIT"
] | 10 | 2019-09-14T11:10:38.000Z | 2021-11-11T17:47:21.000Z | import torch
import torch.nn as nn
def safe_norm(x, eps=1e-5, dim=-1, keepdim=True):
return torch.sqrt(torch.sum(torch.square(x), dim=dim, keepdim=keepdim) + eps)
class LayerNormTf(nn.Module):
def __init__(self, hidden_size: int, eps: float = 1e-12):
"""Construct a layernorm module in the TF style (... | 33.5 | 121 | 0.651741 | import torch
import torch.nn as nn
def safe_norm(x, eps=1e-5, dim=-1, keepdim=True):
return torch.sqrt(torch.sum(torch.square(x), dim=dim, keepdim=keepdim) + eps)
class LayerNormTf(nn.Module):
def __init__(self, hidden_size: int, eps: float = 1e-12):
super(LayerNormTf, self).__init__()
self.... | true | true |
f7f534141ef469afed6c4923a10957ff776e25f5 | 2,520 | py | Python | src/slap/configuration.py | NiklasRosenstein/slap | 7932ae6c0da9614f47491fe389a7951abb9966b6 | [
"MIT"
] | 1 | 2022-03-23T10:52:33.000Z | 2022-03-23T10:52:33.000Z | src/slap/configuration.py | NiklasRosenstein/slam | 7932ae6c0da9614f47491fe389a7951abb9966b6 | [
"MIT"
] | 17 | 2022-02-13T03:19:03.000Z | 2022-03-02T18:13:05.000Z | src/slap/configuration.py | NiklasRosenstein/slam | 7932ae6c0da9614f47491fe389a7951abb9966b6 | [
"MIT"
] | null | null | null | from __future__ import annotations
import logging
import typing as t
from pathlib import Path
from slap.util.toml_file import TomlFile
if t.TYPE_CHECKING:
from nr.util.functional import Once
logger = logging.getLogger(__name__)
class Configuration:
"""Represents the configuration stored in a directory, wh... | 43.448276 | 120 | 0.697222 | from __future__ import annotations
import logging
import typing as t
from pathlib import Path
from slap.util.toml_file import TomlFile
if t.TYPE_CHECKING:
from nr.util.functional import Once
logger = logging.getLogger(__name__)
class Configuration:
directory: Path
pyproject_toml:... | true | true |
f7f5344290af26c3d7dc28024993d3e08b27be12 | 3,201 | py | Python | 1-99/20-29/29.py | dcragusa/LeetCode | 01c30de0832b378a1b054d80d1ea1d3f09a2abd3 | [
"MIT"
] | null | null | null | 1-99/20-29/29.py | dcragusa/LeetCode | 01c30de0832b378a1b054d80d1ea1d3f09a2abd3 | [
"MIT"
] | null | null | null | 1-99/20-29/29.py | dcragusa/LeetCode | 01c30de0832b378a1b054d80d1ea1d3f09a2abd3 | [
"MIT"
] | null | null | null | """
Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator.
Return the quotient after dividing dividend by divisor. The integer division should truncate toward zero, which means
losing its fractional part. For example, truncate(8.345) = 8 and truncate(-2.733... | 32.01 | 117 | 0.678538 |
MIN_INT = -2**31
MAX_INT = 2**31 - 1
def divide_positive_simple(dividend, divisor):
quotient = 0
while dividend >= divisor:
quotient += 1
dividend -= divisor
return quotient, dividend
def multiply_positive_simple(multiplicand, multiplier):
result = 0
for _ in ran... | true | true |
f7f534b949f53b0d0accf4f171701864247d36d4 | 6,676 | py | Python | arcade/experimental/lights.py | janscas/arcade | d83dda946563429c8ee7d1a036bc0407758c638f | [
"MIT"
] | 824 | 2016-01-07T19:27:57.000Z | 2020-08-01T03:15:47.000Z | arcade/experimental/lights.py | janscas/arcade | d83dda946563429c8ee7d1a036bc0407758c638f | [
"MIT"
] | 646 | 2016-01-08T02:42:31.000Z | 2020-08-03T14:13:27.000Z | arcade/experimental/lights.py | janscas/arcade | d83dda946563429c8ee7d1a036bc0407758c638f | [
"MIT"
] | 221 | 2016-01-07T22:36:33.000Z | 2020-07-24T23:30:08.000Z | from array import array
from typing import Iterable, Tuple, Sequence, List, Optional
from arcade import Color
from arcade import gl
from arcade.experimental.texture_render_target import RenderTargetTexture
class Light:
HARD = 1.0
SOFT = 0.0
def __init__(self, center_x: float, center_y: float,
... | 34.770833 | 118 | 0.617436 | from array import array
from typing import Iterable, Tuple, Sequence, List, Optional
from arcade import Color
from arcade import gl
from arcade.experimental.texture_render_target import RenderTargetTexture
class Light:
HARD = 1.0
SOFT = 0.0
def __init__(self, center_x: float, center_y: float,
... | true | true |
f7f53509cf22349c11fc7794e4e12162c1415979 | 1,322 | py | Python | aliyun-python-sdk-cdn/aliyunsdkcdn/request/v20141111/DescribeDomainCustomLogConfigRequest.py | sdk-team/aliyun-openapi-python-sdk | 384730d707e6720d1676ccb8f552e6a7b330ec86 | [
"Apache-2.0"
] | null | null | null | aliyun-python-sdk-cdn/aliyunsdkcdn/request/v20141111/DescribeDomainCustomLogConfigRequest.py | sdk-team/aliyun-openapi-python-sdk | 384730d707e6720d1676ccb8f552e6a7b330ec86 | [
"Apache-2.0"
] | null | null | null | aliyun-python-sdk-cdn/aliyunsdkcdn/request/v20141111/DescribeDomainCustomLogConfigRequest.py | sdk-team/aliyun-openapi-python-sdk | 384730d707e6720d1676ccb8f552e6a7b330ec86 | [
"Apache-2.0"
] | null | null | null | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 36.722222 | 82 | 0.769289 |
from aliyunsdkcore.request import RpcRequest
class DescribeDomainCustomLogConfigRequest(RpcRequest):
def __init__(self):
RpcRequest.__init__(self, 'Cdn', '2014-11-11', 'DescribeDomainCustomLogConfig')
def get_DomainName(self):
return self.get_query_params().get('DomainName')
def set_Do... | true | true |
f7f53522f0e0ed669affbf35242cc86852027221 | 1,593 | py | Python | tests/test_callback.py | unfoldingWord-dev/door43-job-handler | d26424810706875dd6eef33288900ea486de2e03 | [
"MIT"
] | null | null | null | tests/test_callback.py | unfoldingWord-dev/door43-job-handler | d26424810706875dd6eef33288900ea486de2e03 | [
"MIT"
] | 66 | 2018-10-16T19:14:36.000Z | 2020-10-23T03:17:48.000Z | tests/test_callback.py | unfoldingWord-dev/door43-job-handler | d26424810706875dd6eef33288900ea486de2e03 | [
"MIT"
] | null | null | null | from unittest import TestCase, skip
from unittest.mock import Mock, patch
import json
import sqlalchemy
from rq import get_current_job
from rq_settings import prefix, callback_queue_name
from app_settings.app_settings import AppSettings
from callback import job
def my_get_current_job():
class Result:
id... | 34.630435 | 124 | 0.721908 | from unittest import TestCase, skip
from unittest.mock import Mock, patch
import json
import sqlalchemy
from rq import get_current_job
from rq_settings import prefix, callback_queue_name
from app_settings.app_settings import AppSettings
from callback import job
def my_get_current_job():
class Result:
id... | true | true |
f7f535b0326923fd5b6dca53b71446bb5f5c50b4 | 4,169 | py | Python | blueoil/datasets/pascalvoc_2007_2012.py | ruimashita/blueoil | e65d64dc0604193e2658d8e0cd6ece09260b806e | [
"Apache-2.0"
] | null | null | null | blueoil/datasets/pascalvoc_2007_2012.py | ruimashita/blueoil | e65d64dc0604193e2658d8e0cd6ece09260b806e | [
"Apache-2.0"
] | null | null | null | blueoil/datasets/pascalvoc_2007_2012.py | ruimashita/blueoil | e65d64dc0604193e2658d8e0cd6ece09260b806e | [
"Apache-2.0"
] | 1 | 2018-12-21T05:21:04.000Z | 2018-12-21T05:21:04.000Z | # -*- coding: utf-8 -*-
# Copyright 2018 The Blueoil 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
#
# Unles... | 31.583333 | 110 | 0.617174 |
import functools
import numpy as np
from blueoil.utils.image import load_image
from blueoil.datasets.base import ObjectDetectionBase
from blueoil.datasets.pascalvoc_2007 import Pascalvoc2007
from blueoil.datasets.pascalvoc_2012 import Pascalvoc2012
class Pascalvoc20072012(ObjectDetectionBase):
cl... | true | true |
f7f535b2aec21c2cb25b2cddbe7a0b802c586313 | 9,644 | py | Python | Python/Client/remote_click_control.py | henrymidles/LidarBot | f67b5ed77671abad7267a86f425192fc6d5aad42 | [
"MIT"
] | null | null | null | Python/Client/remote_click_control.py | henrymidles/LidarBot | f67b5ed77671abad7267a86f425192fc6d5aad42 | [
"MIT"
] | null | null | null | Python/Client/remote_click_control.py | henrymidles/LidarBot | f67b5ed77671abad7267a86f425192fc6d5aad42 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import socket
import time
import math
import threading
import numpy as np
from util import point_direction, point_distance
from queue import Queue
#from PythonRobotics.SLAM.ICP.iterative_closest_point import icp_matching
from RasPi_coms import RasPi_coms
from Turtle_UI import UI
import sys
HOST... | 35.19708 | 141 | 0.507466 |
import socket
import time
import math
import threading
import numpy as np
from util import point_direction, point_distance
from queue import Queue
from RasPi_coms import RasPi_coms
from Turtle_UI import UI
import sys
HOST = 'raspberrypi'
PORT = 65432 # The port used by the server
class LidarBot():
... | true | true |
f7f535db764119819379354f631faeed54108bd0 | 906 | py | Python | resize.py | PainYo170/CS7323-CVproject | 284dbd0facd569be6b35e027d87446545ea1f491 | [
"Apache-2.0"
] | null | null | null | resize.py | PainYo170/CS7323-CVproject | 284dbd0facd569be6b35e027d87446545ea1f491 | [
"Apache-2.0"
] | null | null | null | resize.py | PainYo170/CS7323-CVproject | 284dbd0facd569be6b35e027d87446545ea1f491 | [
"Apache-2.0"
] | null | null | null | from PIL import Image
import os, sys
# path = "/home/lixm/Desktop/srgan/data2017/DIV2K_train_LR_bicubic_X4/DIV2K_train_LR_bicubic/X4/"
path = '/home/lixm/Desktop/ESRGAN/LR/'
dirs = os.listdir( path )
final_size = 128;
def resize_aspect_fit():
for item in dirs:
if item == '.DS_Store':
contin... | 36.24 | 101 | 0.609272 | from PIL import Image
import os, sys
path = '/home/lixm/Desktop/ESRGAN/LR/'
dirs = os.listdir( path )
final_size = 128;
def resize_aspect_fit():
for item in dirs:
if item == '.DS_Store':
continue
if os.path.isfile(path+item):
im = Image.open(path+item)
f,... | true | true |
f7f53621237bbe4139cef15e1a9cc4264af8807a | 1,235 | py | Python | __init__.py | lsx137946009/wearableio | 4fd137ace0c0203b4c97dc39e4e4a08c7afc08d5 | [
"MIT"
] | null | null | null | __init__.py | lsx137946009/wearableio | 4fd137ace0c0203b4c97dc39e4e4a08c7afc08d5 | [
"MIT"
] | null | null | null | __init__.py | lsx137946009/wearableio | 4fd137ace0c0203b4c97dc39e4e4a08c7afc08d5 | [
"MIT"
] | null | null | null | #
__docformat__ = 'resreucturedtext'
hard_dependencies = ('numpy', 'pandas')
missing_dependencies = []
for dependency in hard_dependencies:
try:
__import__(dependency)
except ImportError as e:
missing_dependencies.append(dependency)
if missing_dependencies:
raise ImportErro... | 28.068182 | 74 | 0.641296 |
__docformat__ = 'resreucturedtext'
hard_dependencies = ('numpy', 'pandas')
missing_dependencies = []
for dependency in hard_dependencies:
try:
__import__(dependency)
except ImportError as e:
missing_dependencies.append(dependency)
if missing_dependencies:
raise ImportError(... | true | true |
f7f53670bebd1a0ac4fca46a744d73173a1bd4e9 | 4,291 | py | Python | torchtext/experimental/transforms.py | guyang3532/text | e2fc987ff6a002018040cffac5e0d61c3d0b06c6 | [
"BSD-3-Clause"
] | null | null | null | torchtext/experimental/transforms.py | guyang3532/text | e2fc987ff6a002018040cffac5e0d61c3d0b06c6 | [
"BSD-3-Clause"
] | 1 | 2020-12-15T01:12:34.000Z | 2020-12-15T01:12:34.000Z | torchtext/experimental/transforms.py | guyang3532/text | e2fc987ff6a002018040cffac5e0d61c3d0b06c6 | [
"BSD-3-Clause"
] | 1 | 2020-12-14T21:46:18.000Z | 2020-12-14T21:46:18.000Z | import torch
import torch.nn as nn
from typing import List, Tuple
__all__ = [
'BasicEnglishNormalize',
'RegexTokenizer'
]
class BasicEnglishNormalize(nn.Module):
r"""Basic normalization for a string sentence.
Normalization includes
- lowercasing
- complete some basic text normalizat... | 37.313043 | 118 | 0.60522 | import torch
import torch.nn as nn
from typing import List, Tuple
__all__ = [
'BasicEnglishNormalize',
'RegexTokenizer'
]
class BasicEnglishNormalize(nn.Module):
regex_and_replacement_string_pairs: List[Tuple[torch.classes.torchtext.Regex, str]]
def __init__(self):
super(BasicEnglishNormal... | true | true |
f7f53743ad2791ee628fc064bf32971196b1acd8 | 3,276 | py | Python | transwarp/utils.py | michaelliao/transwarp | d4f308ebe9c6698b013a946cb33b9cc9a6076321 | [
"Apache-2.0"
] | 26 | 2015-01-04T02:04:07.000Z | 2021-11-03T08:54:26.000Z | transwarp/utils.py | michaelliao/transwarp | d4f308ebe9c6698b013a946cb33b9cc9a6076321 | [
"Apache-2.0"
] | 1 | 2015-01-25T04:34:04.000Z | 2015-01-30T02:23:42.000Z | transwarp/utils.py | michaelliao/transwarp | d4f308ebe9c6698b013a946cb33b9cc9a6076321 | [
"Apache-2.0"
] | 35 | 2015-01-02T07:26:34.000Z | 2021-11-11T16:04:33.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Michael Liao'
'''
Utils
'''
import re, datetime
class Dict(dict):
'''
Simple dict but support access as x.y style.
>>> d1 = Dict()
>>> d1['x'] = 100
>>> d1.x
100
>>> d1.y = 200
>>> d1['y']
200
>>> d2 = Dict(a=1, b=2... | 22.135135 | 78 | 0.510073 |
__author__ = 'Michael Liao'
import re, datetime
class Dict(dict):
def __init__(self, names=(), values=(), **kw):
super(Dict, self).__init__(**kw)
for k, v in zip(names, values):
self[k] = v
def __getattr__(self, key):
try:
return self[key]
except Ke... | true | true |
f7f5390a4be37e465e2d42d1b4947568efc50c54 | 397 | py | Python | src/api_v1/viewsets/openaccess.py | iplweb/django-bpp | 85f183a99d8d5027ae4772efac1e4a9f21675849 | [
"BSD-3-Clause"
] | 1 | 2017-04-27T19:50:02.000Z | 2017-04-27T19:50:02.000Z | src/api_v1/viewsets/openaccess.py | mpasternak/django-bpp | 434338821d5ad1aaee598f6327151aba0af66f5e | [
"BSD-3-Clause"
] | 41 | 2019-11-07T00:07:02.000Z | 2022-02-27T22:09:39.000Z | src/api_v1/viewsets/openaccess.py | iplweb/bpp | f027415cc3faf1ca79082bf7bacd4be35b1a6fdf | [
"BSD-3-Clause"
] | null | null | null | import django_filters
from rest_framework import viewsets
from api_v1.serializers.openaccess import Czas_Udostepnienia_OpenAccess_Serializer
from bpp.models import Czas_Udostepnienia_OpenAccess
class Czas_Udostepnienia_OpenAccess_ViewSet(viewsets.ReadOnlyModelViewSet):
queryset = Czas_Udostepnienia_OpenAccess.o... | 33.083333 | 82 | 0.881612 | import django_filters
from rest_framework import viewsets
from api_v1.serializers.openaccess import Czas_Udostepnienia_OpenAccess_Serializer
from bpp.models import Czas_Udostepnienia_OpenAccess
class Czas_Udostepnienia_OpenAccess_ViewSet(viewsets.ReadOnlyModelViewSet):
queryset = Czas_Udostepnienia_OpenAccess.o... | true | true |
f7f539a7e7d7c3e8bcaa3cdde2e7e3363c5d7a65 | 10,553 | py | Python | q_learning/train_arg.py | jakejhansen/minesweeper_solver | 5eaba3f3242f08cbbb69db56e7fde4d2cd104aec | [
"MIT"
] | 32 | 2018-01-09T16:47:57.000Z | 2022-03-13T13:07:15.000Z | q_learning/train_arg.py | jakejhansen/minesweeper_solver | 5eaba3f3242f08cbbb69db56e7fde4d2cd104aec | [
"MIT"
] | null | null | null | q_learning/train_arg.py | jakejhansen/minesweeper_solver | 5eaba3f3242f08cbbb69db56e7fde4d2cd104aec | [
"MIT"
] | 8 | 2018-05-12T06:39:08.000Z | 2021-06-06T17:30:12.000Z | """
This module contains class definitions for open ai gym environments.
"""
import argparse
import random
import numpy as np
import tensorflow as tf
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
from agent import QAgent
def setup_model(mode = 0):
parser = argparse.ArgumentParser(prog="train.py", descripti... | 60.302857 | 205 | 0.719795 |
import argparse
import random
import numpy as np
import tensorflow as tf
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
from agent import QAgent
def setup_model(mode = 0):
parser = argparse.ArgumentParser(prog="train.py", description="Train Deep Q-Network for Minesweeper game")
parser.add_argument... | true | true |
f7f539e59dab61b4502c869063b1a80807789293 | 845 | py | Python | danish.py | danish123gupta/assignment10.1 | ba87192ee7c9ff7cdf70f2eed192157a81deee70 | [
"MIT"
] | null | null | null | danish.py | danish123gupta/assignment10.1 | ba87192ee7c9ff7cdf70f2eed192157a81deee70 | [
"MIT"
] | null | null | null | danish.py | danish123gupta/assignment10.1 | ba87192ee7c9ff7cdf70f2eed192157a81deee70 | [
"MIT"
] | null | null | null | #q.no.1
f=open(r"danish.txt","r")
f1=f.readlines()
for i in f1:
print(i)
f.close()
#q.no.2
f=open(r"danish.txt","r")
f1=f.read()
s=input("enter a word to count its occurence: ")
c=0
for i in f1:
if i==s:
c+=1
f.close()
print(s,"occurs",c,"times.")
#q.no.3
f=open(r"danish.txt","r")
... | 15.363636 | 49 | 0.543195 |
f=open(r"danish.txt","r")
f1=f.readlines()
for i in f1:
print(i)
f.close()
f=open(r"danish.txt","r")
f1=f.read()
s=input("enter a word to count its occurence: ")
c=0
for i in f1:
if i==s:
c+=1
f.close()
print(s,"occurs",c,"times.")
f=open(r"danish.txt","r")
f1=f.read()
f.close()
... | true | true |
f7f539efef8cdfab11f19a9f5c164febfc944e77 | 11,553 | py | Python | tests/loops/test_training_loop_flow_scalar.py | rhjohnstone/pytorch-lightning | 4cd7e77ad2471379eaf768c20d8a3284aeb8b0b5 | [
"Apache-2.0"
] | 2 | 2021-11-11T12:34:18.000Z | 2021-11-17T08:34:14.000Z | tests/loops/test_training_loop_flow_scalar.py | rhjohnstone/pytorch-lightning | 4cd7e77ad2471379eaf768c20d8a3284aeb8b0b5 | [
"Apache-2.0"
] | null | null | null | tests/loops/test_training_loop_flow_scalar.py | rhjohnstone/pytorch-lightning | 4cd7e77ad2471379eaf768c20d8a3284aeb8b0b5 | [
"Apache-2.0"
] | 1 | 2021-11-07T12:34:34.000Z | 2021-11-07T12:34:34.000Z | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 33.008571 | 110 | 0.674284 |
import pytest
import torch
from torch.utils.data import DataLoader
from torch.utils.data._utils.collate import default_collate
from pytorch_lightning import Trainer
from pytorch_lightning.core.lightning import LightningModule
from pytorch_lightning.loops.optimization.optimizer_loop import Closure
from pyt... | true | true |
f7f53c9b431c38939880386dfe84de00452510eb | 17,710 | py | Python | oauth_provider/tests/protocol.py | ELSUru/ADL_LRS | aabeb9cf3e56795b148f37d07e1bb2b41e61e470 | [
"Apache-2.0"
] | null | null | null | oauth_provider/tests/protocol.py | ELSUru/ADL_LRS | aabeb9cf3e56795b148f37d07e1bb2b41e61e470 | [
"Apache-2.0"
] | null | null | null | oauth_provider/tests/protocol.py | ELSUru/ADL_LRS | aabeb9cf3e56795b148f37d07e1bb2b41e61e470 | [
"Apache-2.0"
] | 3 | 2021-01-14T12:51:24.000Z | 2022-03-15T17:11:11.000Z | import time
import cgi
import oauth2 as oauth
from django.test import Client
from oauth_provider.tests.auth import BaseOAuthTestCase
from oauth_provider.models import Token, Consumer, Scope
from oauth_provider.compat import get_user_model
User = get_user_model()
class ProtocolExample(BaseOAuthTestCa... | 43.945409 | 132 | 0.666064 | import time
import cgi
import oauth2 as oauth
from django.test import Client
from oauth_provider.tests.auth import BaseOAuthTestCase
from oauth_provider.models import Token, Consumer, Scope
from oauth_provider.compat import get_user_model
User = get_user_model()
class ProtocolExample(BaseOAuthTestCa... | true | true |
f7f53cf8e09154955a709d43ceaab987a1984569 | 3,858 | py | Python | u1_2d/s_nthmc_l64_b4_t2_lr5e-4.py | nftqcd/nthmc | 010c70e297c904219e9d8a04cc20b9c75a4b61e5 | [
"MIT"
] | 2 | 2021-07-29T19:09:30.000Z | 2022-01-17T21:13:40.000Z | u1_2d/s_nthmc_l64_b4_t2_lr5e-4.py | nftqcd/nthmc | 010c70e297c904219e9d8a04cc20b9c75a4b61e5 | [
"MIT"
] | null | null | null | u1_2d/s_nthmc_l64_b4_t2_lr5e-4.py | nftqcd/nthmc | 010c70e297c904219e9d8a04cc20b9c75a4b61e5 | [
"MIT"
] | null | null | null | import tensorflow as tf
import tensorflow.keras as tk
import numpy
import nthmc, ftr, evolve, forcetrain
trajLength = 4.0
nstep = 8
conf = nthmc.Conf(nbatch=32, nepoch=4, nstepEpoch=1024, nstepMixing=128, initDt=trajLength/nstep, stepPerTraj=nstep, trainDt=False, nthr=10, nthrIop=1, seed=7*11*13*7)
op0 = (((1,2,-1,-2... | 65.389831 | 167 | 0.637377 | import tensorflow as tf
import tensorflow.keras as tk
import numpy
import nthmc, ftr, evolve, forcetrain
trajLength = 4.0
nstep = 8
conf = nthmc.Conf(nbatch=32, nepoch=4, nstepEpoch=1024, nstepMixing=128, initDt=trajLength/nstep, stepPerTraj=nstep, trainDt=False, nthr=10, nthrIop=1, seed=7*11*13*7)
op0 = (((1,2,-1,-2... | true | true |
f7f53e9a0a79079c0eeda880ae01e5cdba350c47 | 5,134 | py | Python | django/forms/utils.py | Bashar/django | e520a73eeea6b185b719901ab9985ecef00e5664 | [
"BSD-3-Clause"
] | 1 | 2015-01-07T10:29:03.000Z | 2015-01-07T10:29:03.000Z | django/forms/utils.py | Bashar/django | e520a73eeea6b185b719901ab9985ecef00e5664 | [
"BSD-3-Clause"
] | null | null | null | django/forms/utils.py | Bashar/django | e520a73eeea6b185b719901ab9985ecef00e5664 | [
"BSD-3-Clause"
] | null | null | null | from __future__ import unicode_literals
import json
import sys
try:
from collections import UserList
except ImportError: # Python 2
from UserList import UserList
from django.conf import settings
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.html import format_ht... | 30.742515 | 98 | 0.626412 | from __future__ import unicode_literals
import json
import sys
try:
from collections import UserList
except ImportError:
from UserList import UserList
from django.conf import settings
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.html import format_html, format... | true | true |
f7f53f2e2e060c6aaeb272c81acbd4d562ea3e78 | 10,147 | py | Python | tests/cases/py_client/additional_properties/client.py | Parquery/swagger-to | 95cde991ea2602ef625630e69ac9f8501bd89f4d | [
"MIT"
] | 38 | 2018-08-06T15:11:10.000Z | 2022-02-13T22:43:00.000Z | tests/cases/py_client/additional_properties/client.py | Parquery/swagger-to | 95cde991ea2602ef625630e69ac9f8501bd89f4d | [
"MIT"
] | 42 | 2018-08-07T08:25:07.000Z | 2021-11-28T19:32:48.000Z | tests/cases/py_client/additional_properties/client.py | Parquery/swagger-to | 95cde991ea2602ef625630e69ac9f8501bd89f4d | [
"MIT"
] | 16 | 2019-02-26T12:39:43.000Z | 2022-01-29T06:38:41.000Z | #!/usr/bin/env python3
# Automatically generated file by swagger_to. DO NOT EDIT OR APPEND ANYTHING!
"""Implements the client for test."""
# pylint: skip-file
# pydocstyle: add-ignore=D105,D107,D401
import contextlib
import json
from typing import Any, BinaryIO, Dict, List, MutableMapping, Optional, cast
import requ... | 28.502809 | 113 | 0.587169 |
import contextlib
import json
from typing import Any, BinaryIO, Dict, List, MutableMapping, Optional, cast
import requests
import requests.auth
def from_obj(obj: Any, expected: List[type], path: str = '') -> Any:
if not expected:
raise ValueError("`expected` is empty, but at least one type needs to... | true | true |
f7f53f650dcfbc710ba362ad11e333adcde0e4e9 | 2,061 | py | Python | src/property_app/database/types.py | almostprod/property-app | 2e9dc6c64e7fd91d287fc95e513fa3ab1079fa54 | [
"Apache-2.0"
] | 2 | 2020-03-03T16:52:31.000Z | 2020-03-17T21:35:30.000Z | src/property_app/database/types.py | amcclosky/property-app | 9afb0210739955ff19bfcb477acdbd07521ce851 | [
"Apache-2.0"
] | 1 | 2021-05-11T16:54:56.000Z | 2021-05-11T16:54:56.000Z | src/property_app/database/types.py | amcclosky/property-app | 9afb0210739955ff19bfcb477acdbd07521ce851 | [
"Apache-2.0"
] | 1 | 2020-05-04T06:39:35.000Z | 2020-05-04T06:39:35.000Z | __all__ = ["JSON", "Enum", "PendulumType"]
from datetime import datetime
import pendulum
import sqlalchemy as sa
from sqlalchemy import Enum as _Enum
from sqlalchemy.types import TypeDecorator as _TypeDecorator
from sqlalchemy.dialects.postgresql import JSONB as _JSONB
from sqlalchemy_utils.types.scalar_coercible i... | 25.444444 | 87 | 0.644833 | __all__ = ["JSON", "Enum", "PendulumType"]
from datetime import datetime
import pendulum
import sqlalchemy as sa
from sqlalchemy import Enum as _Enum
from sqlalchemy.types import TypeDecorator as _TypeDecorator
from sqlalchemy.dialects.postgresql import JSONB as _JSONB
from sqlalchemy_utils.types.scalar_coercible i... | true | true |
f7f53f6b03374d1e9d565a2959e40987c1c55cf8 | 9,980 | py | Python | core/argParser.py | AmberLJC/FedScale | 45dfda70820e071ea36b0741837419311d9bddaf | [
"Apache-2.0"
] | 1 | 2022-03-28T22:05:31.000Z | 2022-03-28T22:05:31.000Z | core/argParser.py | AmberLJC/FedScale | 45dfda70820e071ea36b0741837419311d9bddaf | [
"Apache-2.0"
] | null | null | null | core/argParser.py | AmberLJC/FedScale | 45dfda70820e071ea36b0741837419311d9bddaf | [
"Apache-2.0"
] | null | null | null | import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--job_name', type=str, default='kuiper_job')
parser.add_argument('--log_path', type=str, default='../', help="default path is ../log")
# The basic configuration of the cluster
parser.add_argument('--ps_ip', type=str, default='127.0.0.1')
parser.a... | 50.659898 | 118 | 0.734369 | import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--job_name', type=str, default='kuiper_job')
parser.add_argument('--log_path', type=str, default='../', help="default path is ../log")
parser.add_argument('--ps_ip', type=str, default='127.0.0.1')
parser.add_argument('--ps_port', type=str, defau... | true | true |
f7f540737ee2ab40548a794d026d0f314441b9f0 | 443 | py | Python | day05/python/util.py | jaredkwright/AdventOfCode2018 | fe27e994d5241d723971cdfbb99b0d59fe0d8736 | [
"Apache-2.0"
] | null | null | null | day05/python/util.py | jaredkwright/AdventOfCode2018 | fe27e994d5241d723971cdfbb99b0d59fe0d8736 | [
"Apache-2.0"
] | null | null | null | day05/python/util.py | jaredkwright/AdventOfCode2018 | fe27e994d5241d723971cdfbb99b0d59fe0d8736 | [
"Apache-2.0"
] | null | null | null | def is_uppercase_letter(c):
return ord(c) >= 65 or ord(c) <= 90
def is_lowercase_letter(c):
return ord(c) >= 65 or ord(c) <= 90
def is_polarized(a, b):
if not (is_lowercase_letter(a) or is_uppercase_letter(a)) and \
(is_lowercase_letter(b) or is_uppercase_letter(b)):
return False
... | 23.315789 | 67 | 0.61851 | def is_uppercase_letter(c):
return ord(c) >= 65 or ord(c) <= 90
def is_lowercase_letter(c):
return ord(c) >= 65 or ord(c) <= 90
def is_polarized(a, b):
if not (is_lowercase_letter(a) or is_uppercase_letter(a)) and \
(is_lowercase_letter(b) or is_uppercase_letter(b)):
return False
... | true | true |
f7f542233e1bd5f2f48a70af256ceebab1295dae | 2,094 | py | Python | examples/adspygoogle/dfp/v201306/get_custom_targeting_keys_by_statement.py | cherry-wb/googleads-python-lib | 24a1ecb7c1cca5af3624a3b03ebaa7f5147b4a04 | [
"Apache-2.0"
] | null | null | null | examples/adspygoogle/dfp/v201306/get_custom_targeting_keys_by_statement.py | cherry-wb/googleads-python-lib | 24a1ecb7c1cca5af3624a3b03ebaa7f5147b4a04 | [
"Apache-2.0"
] | null | null | null | examples/adspygoogle/dfp/v201306/get_custom_targeting_keys_by_statement.py | cherry-wb/googleads-python-lib | 24a1ecb7c1cca5af3624a3b03ebaa7f5147b4a04 | [
"Apache-2.0"
] | 2 | 2020-04-02T19:00:31.000Z | 2020-08-06T03:28:38.000Z | #!/usr/bin/python
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | 32.215385 | 80 | 0.69341 |
"""This example gets all predefined custom targeting keys. The statement
retrieves up to the maximum page size limit of 500. To create custom
targeting keys, run create_custom_targeting_keys_and_values.py."""
__author__ = 'api.shamjeff@gmail.com (Jeff Sham)'
import os
import sys
sys.path.insert(0, o... | false | true |
f7f5423260697bd9a94eb7c0636a3d89f592027e | 1,065 | py | Python | tests/basic/for_in.py | nanobowers/py2cr | b7deb8c227cf43ce0e1bf7d638d5b4c00b7e9bdb | [
"MIT"
] | 61 | 2021-10-06T03:29:45.000Z | 2022-02-11T20:42:16.000Z | tests/basic/for_in.py | nanobowers/py2cr | b7deb8c227cf43ce0e1bf7d638d5b4c00b7e9bdb | [
"MIT"
] | 2 | 2021-12-27T03:05:30.000Z | 2021-12-27T18:10:33.000Z | tests/basic/for_in.py | nanobowers/py2cr | b7deb8c227cf43ce0e1bf7d638d5b4c00b7e9bdb | [
"MIT"
] | 2 | 2021-12-27T16:35:46.000Z | 2021-12-28T10:41:49.000Z | from typing import List, Dict
# iterating over a list
print('-- list --')
a = [1,2,3,4,5]
for x in a:
print(x)
# iterating over a tuple
print('-- tuple else case --')
t = ('cats','dogs','squirrels')
for x1 in t:
print(x1)
else:
print('ok')
print('-- tuple else break case --')
for x2 in t:
print(x2)
... | 16.640625 | 64 | 0.598122 | from typing import List, Dict
print('-- list --')
a = [1,2,3,4,5]
for x in a:
print(x)
print('-- tuple else case --')
t = ('cats','dogs','squirrels')
for x1 in t:
print(x1)
else:
print('ok')
print('-- tuple else break case --')
for x2 in t:
print(x2)
if x2 == 'squirrels':
break
else:
... | true | true |
f7f5441d878fdc6a64f1efc370d539c613bcae2b | 1,652 | py | Python | irekua_database/admin/models.py | CONABIO-audio/irekua-database | abaf3eb3c5273cdb973c7ac1b921ab2f9759042c | [
"BSD-4-Clause"
] | null | null | null | irekua_database/admin/models.py | CONABIO-audio/irekua-database | abaf3eb3c5273cdb973c7ac1b921ab2f9759042c | [
"BSD-4-Clause"
] | 18 | 2019-10-31T21:41:42.000Z | 2022-03-12T00:03:54.000Z | selia_admin/admin/models.py | CONABIO-audio/selia-admin | 0fe3326d63de7904f86f3040cb613801737880f7 | [
"BSD-4-Clause"
] | 1 | 2021-05-06T19:38:21.000Z | 2021-05-06T19:38:21.000Z | from django.contrib import admin
class CustomModelAdmin(admin.ModelAdmin):
date_hierarchy = 'created_on'
def save_model(self, request, instance, form, change):
user = request.user
instance = form.save(commit=False)
if not change or not instance.created_by:
instance.created... | 22.944444 | 58 | 0.556295 | from django.contrib import admin
class CustomModelAdmin(admin.ModelAdmin):
date_hierarchy = 'created_on'
def save_model(self, request, instance, form, change):
user = request.user
instance = form.save(commit=False)
if not change or not instance.created_by:
instance.created... | true | true |
f7f544decaa6c54e8d88a2dd1c8c1db481c1336b | 2,951 | py | Python | test/cl/func/conv/testcase.py | pulp-platform/q-eegnet_wolf | f028a727d4ae346b81539ed78ecba5f059c9029f | [
"Apache-2.0"
] | null | null | null | test/cl/func/conv/testcase.py | pulp-platform/q-eegnet_wolf | f028a727d4ae346b81539ed78ecba5f059c9029f | [
"Apache-2.0"
] | null | null | null | test/cl/func/conv/testcase.py | pulp-platform/q-eegnet_wolf | f028a727d4ae346b81539ed78ecba5f059c9029f | [
"Apache-2.0"
] | null | null | null | """
This file will test the convolution implementation
"""
__author__ = "Tibor Schneider"
__email__ = "sctibor@student.ethz.ch"
__version__ = "1.0"
__license__ = "Apache 2.0"
__copyright__ = """
Copyright (C) 2020 ETH Zurich. All rights reserved.
Author: Tibor Schneider, ETH Zurich
SPDX-License-Identifie... | 30.739583 | 75 | 0.645883 |
__author__ = "Tibor Schneider"
__email__ = "sctibor@student.ethz.ch"
__version__ = "1.0"
__license__ = "Apache 2.0"
__copyright__ = """
Copyright (C) 2020 ETH Zurich. All rights reserved.
Author: Tibor Schneider, ETH Zurich
SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Versi... | true | true |
f7f54521315129e0072a7002d1400b31a711e849 | 2,486 | py | Python | test.py | hoangdzung/DGI | 12203ec30bd3e09770e79da2d967b613b8c8e79d | [
"MIT"
] | null | null | null | test.py | hoangdzung/DGI | 12203ec30bd3e09770e79da2d967b613b8c8e79d | [
"MIT"
] | null | null | null | test.py | hoangdzung/DGI | 12203ec30bd3e09770e79da2d967b613b8c8e79d | [
"MIT"
] | null | null | null | import torch
import torch.nn.functional as F
from torch.autograd import Variable
from torch import nn
from torch_geometric.nn import GCNConv
from sklearn.linear_model import LogisticRegression
import numpy as np
from tqdm import tqdm
from gumbel import gumbel_softmax
from utils import process
num_epochs = 100000
l... | 29.595238 | 118 | 0.720032 | import torch
import torch.nn.functional as F
from torch.autograd import Variable
from torch import nn
from torch_geometric.nn import GCNConv
from sklearn.linear_model import LogisticRegression
import numpy as np
from tqdm import tqdm
from gumbel import gumbel_softmax
from utils import process
num_epochs = 100000
l... | true | true |
f7f5463b9e9178777682c4a8a5359d269a6d4668 | 1,893 | py | Python | mypyc/test/test_external.py | jag426/mypy | 62d3bdf1f5114a669c7499258d7e766c1a6fa640 | [
"PSF-2.0"
] | 35 | 2016-03-30T09:25:14.000Z | 2022-03-12T10:53:11.000Z | mypyc/test/test_external.py | jag426/mypy | 62d3bdf1f5114a669c7499258d7e766c1a6fa640 | [
"PSF-2.0"
] | 36 | 2020-07-27T23:26:53.000Z | 2021-08-02T23:22:37.000Z | mypyc/test/test_external.py | jag426/mypy | 62d3bdf1f5114a669c7499258d7e766c1a6fa640 | [
"PSF-2.0"
] | 6 | 2016-01-29T04:33:27.000Z | 2019-11-03T19:19:43.000Z | """Test cases that run tests as subprocesses."""
from typing import List
import os
import subprocess
import sys
import unittest
base_dir = os.path.join(os.path.dirname(__file__), '..', '..')
class TestExternal(unittest.TestCase):
# TODO: Get this to work on Windows.
# (Or don't. It is probably not a good ... | 39.4375 | 92 | 0.566825 |
from typing import List
import os
import subprocess
import sys
import unittest
base_dir = os.path.join(os.path.dirname(__file__), '..', '..')
class TestExternal(unittest.TestCase):
@unittest.skipIf(sys.platform.startswith("win"), "rt tests don't work on windows")
def test_c_unit_test(self) -> No... | true | true |
f7f5469b19b55eac52f8ed4a007ccd58991e077d | 4,634 | py | Python | opencv_utilities/bounding_rect.py | satinder147/opencv-utilities | ec2d0469949924dd89f8159e9c49191f3c43f720 | [
"MIT"
] | 1 | 2020-06-27T10:40:12.000Z | 2020-06-27T10:40:12.000Z | opencv_utilities/bounding_rect.py | satinder147/opencv-utilities | ec2d0469949924dd89f8159e9c49191f3c43f720 | [
"MIT"
] | null | null | null | opencv_utilities/bounding_rect.py | satinder147/opencv-utilities | ec2d0469949924dd89f8159e9c49191f3c43f720 | [
"MIT"
] | null | null | null | import cv2
import numpy as np
import time
def check(scale, text, font, line_width, box_width, box_height, offset, p=1):
"""
:param scale: parameter binary search is optimising
:return: A boolean, whether this scale is ok or if p==2 sends back the string of words in each line.
"""
last_word = 0
... | 39.271186 | 120 | 0.632715 | import cv2
import numpy as np
import time
def check(scale, text, font, line_width, box_width, box_height, offset, p=1):
last_word = 0
prev_line_break = 0
strings = []
word_height = None
for i in range(len(text)):
if text[i] == ' ':
last_word = i
word_width, word_height ... | true | true |
f7f5475d10b337d14bc0306cff41c388917bc77d | 2,091 | py | Python | tests/models/linear/test_lasso.py | harmsm/epistasis | 741b25b3e28015aeeba8d4efc94af1e1d811cd63 | [
"Unlicense"
] | null | null | null | tests/models/linear/test_lasso.py | harmsm/epistasis | 741b25b3e28015aeeba8d4efc94af1e1d811cd63 | [
"Unlicense"
] | null | null | null | tests/models/linear/test_lasso.py | harmsm/epistasis | 741b25b3e28015aeeba8d4efc94af1e1d811cd63 | [
"Unlicense"
] | 2 | 2020-04-02T00:58:24.000Z | 2021-11-16T13:30:30.000Z | # External imports
import unittest
import pytest
import numpy as np
from gpmap import GenotypePhenotypeMap
# Module to test
import epistasis
from epistasis.models.linear import EpistasisLasso
@pytest.fixture
def gpm(test_data):
"""
Create a genotype-phenotype map
"""
d = test_data[0]
return Ge... | 24.313953 | 80 | 0.601626 |
import unittest
import pytest
import numpy as np
from gpmap import GenotypePhenotypeMap
import epistasis
from epistasis.models.linear import EpistasisLasso
@pytest.fixture
def gpm(test_data):
d = test_data[0]
return GenotypePhenotypeMap(genotype=d["genotype"],
phenotype=d... | true | true |
f7f547cc651c3cf1a292f0663e6d4052c3ff7ed9 | 6,922 | py | Python | src/flask/views.py | jlshix/flask-cn | 1e0dc9181ae626e7069c4020f62b0355cd82f5d2 | [
"BSD-3-Clause"
] | 1 | 2021-11-20T08:05:38.000Z | 2021-11-20T08:05:38.000Z | src/flask/views.py | jlshix/flask-cn | 1e0dc9181ae626e7069c4020f62b0355cd82f5d2 | [
"BSD-3-Clause"
] | null | null | null | src/flask/views.py | jlshix/flask-cn | 1e0dc9181ae626e7069c4020f62b0355cd82f5d2 | [
"BSD-3-Clause"
] | 1 | 2021-05-12T13:06:34.000Z | 2021-05-12T13:06:34.000Z | # -*- coding: utf-8 -*-
"""
flask.views
~~~~~~~~~~~
This module provides class-based views inspired by the ones in Django.
此模块提供基于类的视图, 灵感来自 Django.
:copyright: 2010 Pallets
:license: BSD-3-Clause
"""
from ._compat import with_metaclass
from .globals import request
http_method_funcs = froze... | 33.765854 | 79 | 0.635077 |
from ._compat import with_metaclass
from .globals import request
http_method_funcs = frozenset(
["get", "post", "head", "options", "delete", "put", "trace", "patch"]
)
class View(object):
methods = None
provide_automatic_options = None
#: into the routing syste... | true | true |
f7f547fb4f073d0d0e07223c847a08a58893bbcd | 2,353 | py | Python | bin/split_dataset.py | FirstHandScientist/genhmm | 95954794a48c40486c9df4644a654c541866df4c | [
"MIT"
] | 8 | 2020-04-27T07:14:09.000Z | 2022-01-09T11:10:06.000Z | bin/split_dataset.py | FirstHandScientist/genhmm | 95954794a48c40486c9df4644a654c541866df4c | [
"MIT"
] | 1 | 2021-10-20T11:23:06.000Z | 2021-10-20T11:23:06.000Z | bin/split_dataset.py | FirstHandScientist/genhmm | 95954794a48c40486c9df4644a654c541866df4c | [
"MIT"
] | 2 | 2020-02-13T13:47:16.000Z | 2020-12-16T23:56:06.000Z | from parse import parse
import sys
import argparse
import os
import pickle as pkl
from gm_hmm.src.utils import read_classmap,to_phoneme_level,flip, phn61_to_phn39,remove_label, getsubset, normalize
from functools import partial
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Split a test d... | 40.568966 | 115 | 0.693158 | from parse import parse
import sys
import argparse
import os
import pickle as pkl
from gm_hmm.src.utils import read_classmap,to_phoneme_level,flip, phn61_to_phn39,remove_label, getsubset, normalize
from functools import partial
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Split a test d... | true | true |
f7f5490bab7300b2279beff1b1bf6b3c33cfce6e | 1,750 | py | Python | ccdb/projects/models.py | thermokarst/ccdb-api | 01d76d75ffaaa9949991cdc3ac43b9ae388ad2a6 | [
"MIT"
] | null | null | null | ccdb/projects/models.py | thermokarst/ccdb-api | 01d76d75ffaaa9949991cdc3ac43b9ae388ad2a6 | [
"MIT"
] | 24 | 2017-01-09T12:51:13.000Z | 2018-04-30T17:40:27.000Z | ccdb/projects/models.py | thermokarst/ccdb-api | 01d76d75ffaaa9949991cdc3ac43b9ae388ad2a6 | [
"MIT"
] | null | null | null | from django.db import models
class Project(models.Model):
name = models.CharField(max_length=100)
code = models.CharField(max_length=10, blank=True)
iacuc_number = models.CharField(max_length=25, blank=True)
description = models.CharField(max_length=255, blank=True)
sort_order = models.IntegerFiel... | 33.018868 | 70 | 0.681714 | from django.db import models
class Project(models.Model):
name = models.CharField(max_length=100)
code = models.CharField(max_length=10, blank=True)
iacuc_number = models.CharField(max_length=25, blank=True)
description = models.CharField(max_length=255, blank=True)
sort_order = models.IntegerFiel... | true | true |
f7f5492934185b0b9704408a6dcd8f22add22710 | 3,306 | py | Python | pokemon/convert.py | RichieBzzzt/pokemon | 2028d12efb5036adf617cef5a1db920f629ade8a | [
"MIT"
] | 52 | 2018-02-09T08:05:22.000Z | 2022-02-22T15:41:24.000Z | pokemon/convert.py | RichieBzzzt/pokemon | 2028d12efb5036adf617cef5a1db920f629ade8a | [
"MIT"
] | 7 | 2018-01-21T17:29:19.000Z | 2021-02-21T05:18:27.000Z | pokemon/convert.py | RichieBzzzt/pokemon | 2028d12efb5036adf617cef5a1db920f629ade8a | [
"MIT"
] | 12 | 2019-02-20T21:29:21.000Z | 2022-01-28T15:31:27.000Z | """
Copyright (c) 2016-2020 Vanessa Sochat
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distr... | 34.082474 | 114 | 0.722021 |
from PIL import Image
ASCII_CHARS = ["#", "?", "%", ".", "S", "+", ".", "*", ":", ",", "@"]
def scale_image(image, new_width):
(original_width, original_height) = image.size
aspect_ratio = original_height / float(original_width)
new_height = int(aspect_ratio * new_width)
new_image = image.resiz... | true | true |
f7f549b6a2122e7fab50819ef7f19f90ca772c47 | 33,744 | py | Python | tests/unit/task/processing/test_plot.py | lolwww/rally | fcb1fb6c608e29dd62549cf6b3cec2e90529932f | [
"Apache-2.0"
] | 263 | 2015-04-26T16:05:34.000Z | 2022-02-28T11:17:07.000Z | tests/unit/task/processing/test_plot.py | lolwww/rally | fcb1fb6c608e29dd62549cf6b3cec2e90529932f | [
"Apache-2.0"
] | 19 | 2015-04-23T11:53:10.000Z | 2019-02-20T11:23:09.000Z | tests/unit/task/processing/test_plot.py | lolwww/rally | fcb1fb6c608e29dd62549cf6b3cec2e90529932f | [
"Apache-2.0"
] | 287 | 2015-04-23T11:28:03.000Z | 2021-09-16T13:05:53.000Z | # Copyright 2014: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | 47.459916 | 79 | 0.401701 |
import collections
import json
from unittest import mock
import ddt
from rally.task.processing import plot
from tests.unit import test
PLOT = "rally.task.processing.plot."
@ddt.ddt
class PlotTestCase(test.TestCase):
@mock.patch(PLOT + "charts")
def test__process_workload(self, mock_charts):... | true | true |
f7f549d9195f317ecf74b3cbd4aae7621a639cda | 3,715 | py | Python | code/pdf_split.py | solicia-xu/pbpython | 87a825a6a4b0aa25ef644498a781b222aa11369d | [
"BSD-3-Clause"
] | 1,846 | 2015-05-18T02:04:30.000Z | 2022-03-31T09:49:16.000Z | code/pdf_split.py | solicia-xu/pbpython | 87a825a6a4b0aa25ef644498a781b222aa11369d | [
"BSD-3-Clause"
] | 28 | 2015-12-07T01:57:08.000Z | 2021-08-24T01:21:02.000Z | code/pdf_split.py | solicia-xu/pbpython | 87a825a6a4b0aa25ef644498a781b222aa11369d | [
"BSD-3-Clause"
] | 1,054 | 2015-05-18T06:19:11.000Z | 2022-03-16T06:13:37.000Z | from appJar import gui
from PyPDF2 import PdfFileWriter, PdfFileReader
from pathlib import Path
# Define all the functions needed to process the files
def split_pages(input_file, page_range, out_file):
""" Take a pdf file and copy a range of pages into a new pdf file
Args:
input_file: The source PDF... | 30.45082 | 102 | 0.662988 | from appJar import gui
from PyPDF2 import PdfFileWriter, PdfFileReader
from pathlib import Path
def split_pages(input_file, page_range, out_file):
output = PdfFileWriter()
input_pdf = PdfFileReader(open(input_file, "rb"))
output_file = open(out_file, "wb")
page_ranges = (x.split("-") for x in ... | true | true |
f7f54a2c1fa5e2ba3408fe227f1878224556afd3 | 34,493 | py | Python | fcs_api_py/main.py | JoaquinChartier/fcs_api_python | 530da72d7fb26a569eb7106dfcb5ad6d320b171f | [
"MIT"
] | null | null | null | fcs_api_py/main.py | JoaquinChartier/fcs_api_python | 530da72d7fb26a569eb7106dfcb5ad6d320b171f | [
"MIT"
] | null | null | null | fcs_api_py/main.py | JoaquinChartier/fcs_api_python | 530da72d7fb26a569eb7106dfcb5ad6d320b171f | [
"MIT"
] | null | null | null | import requests
import json
from . import response_data_types as rdt
class Forex():
def __init__(self, access_key):
"""Initializes with the access key.
access_key string Access key generated in https://fcsapi.com/
"""
self.access_key = access_key
#OK
def currenc... | 35.413758 | 158 | 0.449396 | import requests
import json
from . import response_data_types as rdt
class Forex():
def __init__(self, access_key):
self.access_key = access_key
def currency_latest_price(self, symbols):
self.symbols = symbols
symbols = symbols.upper()
url = "https://fcsapi.com/api-v2/forex... | true | true |
f7f54a31739a081a42746b6d728dd60789687c76 | 4,869 | py | Python | debugging/debug_validation.py | dangpzanco/dcase-task1 | 72867cc5b8969d7ec55c5acfd30ebbc3a7246666 | [
"MIT"
] | 1 | 2019-05-23T08:10:59.000Z | 2019-05-23T08:10:59.000Z | debugging/debug_validation.py | dangpzanco/dcase-task1 | 72867cc5b8969d7ec55c5acfd30ebbc3a7246666 | [
"MIT"
] | null | null | null | debugging/debug_validation.py | dangpzanco/dcase-task1 | 72867cc5b8969d7ec55c5acfd30ebbc3a7246666 | [
"MIT"
] | 2 | 2019-07-12T05:26:15.000Z | 2019-11-22T09:15:00.000Z | # Standard libraries
import pathlib
import glob
import platform
import pickle
from datetime import datetime
from pprint import pprint
# Scientific stack
import numpy as np
import numpy.random as rnd
import pandas as pd
# Chunked data
import zarr
# Audio processing
import dcase_util as du
# Pretty progress bar
impor... | 30.816456 | 102 | 0.659478 |
import pathlib
import glob
import platform
import pickle
from datetime import datetime
from pprint import pprint
import numpy as np
import numpy.random as rnd
import pandas as pd
import zarr
import dcase_util as du
import tqdm
import preprocessing as prep
n_feats = 100
dataset_name = f'numfeats{n_feats}'
d... | true | true |
f7f54b7970b7e59172a8dbcd2ed502d803503f38 | 539 | py | Python | educate/manage.py | fndos/Control-de-Visitas-Web | a5b7d954e327e4e1a2979f3cf539a2f70fd325d6 | [
"MIT"
] | null | null | null | educate/manage.py | fndos/Control-de-Visitas-Web | a5b7d954e327e4e1a2979f3cf539a2f70fd325d6 | [
"MIT"
] | null | null | null | educate/manage.py | fndos/Control-de-Visitas-Web | a5b7d954e327e4e1a2979f3cf539a2f70fd325d6 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "educate.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are ... | 33.6875 | 73 | 0.686456 |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "educate.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's install... | true | true |
f7f54bf093d7ebf6362729e7f1fb476789684de0 | 2,156 | py | Python | Data_Science/src/model.py | robovish/Python-Projects | 1cdfa18c093af32cfc02ac7d08e2bdf682670470 | [
"MIT"
] | null | null | null | Data_Science/src/model.py | robovish/Python-Projects | 1cdfa18c093af32cfc02ac7d08e2bdf682670470 | [
"MIT"
] | null | null | null | Data_Science/src/model.py | robovish/Python-Projects | 1cdfa18c093af32cfc02ac7d08e2bdf682670470 | [
"MIT"
] | 1 | 2022-03-03T09:21:37.000Z | 2022-03-03T09:21:37.000Z |
#load the libraries
import pandas as pd
import numpy as np
from pandas_profiling import ProfileReport
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import classification_report
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from joblib i... | 31.246377 | 151 | 0.74397 |
import pandas as pd
import numpy as np
from pandas_profiling import ProfileReport
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import classification_report
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from joblib import dump, load
im... | true | true |
f7f54d9d31f7537e0668e9b9c814c31d9fb15902 | 2,806 | py | Python | frappe/utils/identicon.py | lukptr/frappe-v7.2.23 | 494f39de78ad9f3ea7b3ff1239a34df35e6f3727 | [
"MIT"
] | 2 | 2021-08-28T06:08:17.000Z | 2021-09-06T10:41:43.000Z | frappe/utils/identicon.py | lukptr/frappe-v7.2.23 | 494f39de78ad9f3ea7b3ff1239a34df35e6f3727 | [
"MIT"
] | 7 | 2016-05-30T04:03:38.000Z | 2019-02-03T03:10:03.000Z | frappe/utils/identicon.py | lukptr/frappe-v7.2.23 | 494f39de78ad9f3ea7b3ff1239a34df35e6f3727 | [
"MIT"
] | 5 | 2016-06-20T08:48:11.000Z | 2018-12-12T09:42:31.000Z | from PIL import Image, ImageDraw
from hashlib import md5
import base64
import StringIO
import random
GRID_SIZE = 5
BORDER_SIZE = 20
SQUARE_SIZE = 40
class Identicon(object):
def __init__(self, str_, background='#fafbfc'):
"""
`str_` is the string used to generate the identicon.
`background` is the background ... | 24.831858 | 77 | 0.626515 | from PIL import Image, ImageDraw
from hashlib import md5
import base64
import StringIO
import random
GRID_SIZE = 5
BORDER_SIZE = 20
SQUARE_SIZE = 40
class Identicon(object):
def __init__(self, str_, background='#fafbfc'):
w = h = BORDER_SIZE * 2 + SQUARE_SIZE * GRID_SIZE
self.image = Image.new('RGB', (w, h), ba... | true | true |
f7f54dd0af83637bf8e929ec8c35a3c31393073c | 1,079 | py | Python | install.py | sbsrouteur/weewx-PiSenseHat | 70bcc9b31f8e914e773b762dc345f28d849f54a6 | [
"MIT"
] | null | null | null | install.py | sbsrouteur/weewx-PiSenseHat | 70bcc9b31f8e914e773b762dc345f28d849f54a6 | [
"MIT"
] | null | null | null | install.py | sbsrouteur/weewx-PiSenseHat | 70bcc9b31f8e914e773b762dc345f28d849f54a6 | [
"MIT"
] | null | null | null | # installer for PiSenseHat data acquisition service
# Copyright 2021-
# Distributed under the terms of the MIT License
from bin.user.PiSense import PiSensewx
from weecfg.extension import ExtensionInstaller
def loader():
return PiSenseHatInstaller()
class PiSenseHatInstaller(ExtensionInstaller):
def __init__... | 34.806452 | 80 | 0.564411 |
from bin.user.PiSense import PiSensewx
from weecfg.extension import ExtensionInstaller
def loader():
return PiSenseHatInstaller()
class PiSenseHatInstaller(ExtensionInstaller):
def __init__(self):
super(PiSenseHatInstaller, self).__init__(
version="0.1",
name='Pi Sense Hat ... | true | true |
f7f54e8a9a9a6f6cac23d7bfc41dbc4d7f726f49 | 1,170 | py | Python | code/gits_commit.py | ianyehwork/GITS | ee88aea547dca93b91e54c8efd9ffd9112841bc0 | [
"MIT"
] | null | null | null | code/gits_commit.py | ianyehwork/GITS | ee88aea547dca93b91e54c8efd9ffd9112841bc0 | [
"MIT"
] | 17 | 2020-10-08T21:01:08.000Z | 2020-10-28T18:18:35.000Z | code/gits_commit.py | ianyehwork/GITS | ee88aea547dca93b91e54c8efd9ffd9112841bc0 | [
"MIT"
] | 8 | 2020-10-29T20:28:09.000Z | 2021-09-27T13:25:19.000Z | #!/usr/bin/python3
from subprocess import Popen, PIPE
def gits_commit_func(args):
"""
Function that commit files as staged in the git command line internface
Performs operation as similar to git commit command.
Future additions : user can specify if the commit should be rejected , if the unit test f... | 30.789474 | 98 | 0.639316 |
from subprocess import Popen, PIPE
def gits_commit_func(args):
try:
subprocess_command = list()
subprocess_command.append("git")
subprocess_command.append("commit")
commit_message = args.m
if not commit_message:
print("ERROR: gits commit message not present, a... | true | true |
f7f5506e23a2005a1f241f22a204c42251737148 | 7,026 | py | Python | face_sdk/core/model_handler/face_detection/FaceDetModelHandler.py | XJX777/FaceX-Zoo | 9d083ed58d77dca077bbdae3e8bbdc73f46d287f | [
"Apache-2.0"
] | null | null | null | face_sdk/core/model_handler/face_detection/FaceDetModelHandler.py | XJX777/FaceX-Zoo | 9d083ed58d77dca077bbdae3e8bbdc73f46d287f | [
"Apache-2.0"
] | null | null | null | face_sdk/core/model_handler/face_detection/FaceDetModelHandler.py | XJX777/FaceX-Zoo | 9d083ed58d77dca077bbdae3e8bbdc73f46d287f | [
"Apache-2.0"
] | null | null | null | """
@author: JiXuan Xu, Jun Wang
@date: 20201019
@contact: jun21wangustc@gmail.com
"""
import logging.config
logging.config.fileConfig("config/logging.conf")
logger = logging.getLogger('sdk')
import torch
import numpy as np
from math import ceil
from itertools import product as product
import torch.backends.cudnn as... | 36.216495 | 115 | 0.568887 |
import logging.config
logging.config.fileConfig("config/logging.conf")
logger = logging.getLogger('sdk')
import torch
import numpy as np
from math import ceil
from itertools import product as product
import torch.backends.cudnn as cudnn
from core.model_handler.BaseModelHandler import BaseModelHandler
from utils.BuzE... | true | true |
f7f55197df03df7d78e36b62a77172709bb13cc0 | 4,617 | py | Python | src/python/fsqio/pants/node/tasks/webpack.py | stuhood/fsqio | 5f133d74e88649da336c362f1af71ca1a42a41d7 | [
"Apache-2.0"
] | null | null | null | src/python/fsqio/pants/node/tasks/webpack.py | stuhood/fsqio | 5f133d74e88649da336c362f1af71ca1a42a41d7 | [
"Apache-2.0"
] | null | null | null | src/python/fsqio/pants/node/tasks/webpack.py | stuhood/fsqio | 5f133d74e88649da336c362f1af71ca1a42a41d7 | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# Copyright 2016 Foursquare Labs Inc. All Rights Reserved.
from __future__ import (
absolute_import,
division,
generators,
nested_scopes,
print_function,
unicode_literals,
with_statement,
)
import os.path
from textwrap import dedent
from pants.base.exceptions import TaskError
from pants.... | 37.844262 | 120 | 0.730778 |
from __future__ import (
absolute_import,
division,
generators,
nested_scopes,
print_function,
unicode_literals,
with_statement,
)
import os.path
from textwrap import dedent
from pants.base.exceptions import TaskError
from pants.base.workunit import WorkUnitLabel
from pants.build_graph.resources impo... | true | true |
f7f551aaac7161bf78ae3706e254660f1a55999d | 6,170 | py | Python | unsupervised_training.py | Steven20210/cell_death_ML | c1a380bb2f9f3e0279403cf76cb5f5193e771b5b | [
"MIT"
] | null | null | null | unsupervised_training.py | Steven20210/cell_death_ML | c1a380bb2f9f3e0279403cf76cb5f5193e771b5b | [
"MIT"
] | null | null | null | unsupervised_training.py | Steven20210/cell_death_ML | c1a380bb2f9f3e0279403cf76cb5f5193e771b5b | [
"MIT"
] | null | null | null | import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
import cv2
from matplotlib import style
# from sci_utilities import is_outlier
import pandas as pd
style.use("ggplot")
from sklearn.cluster import MiniBatchKMeans
from keras.models import Model
from tensorflow.keras.layers import Input, Conv2D,... | 30.85 | 120 | 0.609562 | import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
import cv2
from matplotlib import style
import pandas as pd
style.use("ggplot")
from sklearn.cluster import MiniBatchKMeans
from keras.models import Model
from tensorflow.keras.layers import Input, Conv2D, MaxPooling2D, UpSampling2D
import pic... | true | true |
f7f551f3c1564167744221c32674338402e2a694 | 3,011 | py | Python | nets.py | TomaszGolan/q-learning-maze | 2540acf09d939c1686060c58cbe52775e94304ed | [
"MIT"
] | null | null | null | nets.py | TomaszGolan/q-learning-maze | 2540acf09d939c1686060c58cbe52775e94304ed | [
"MIT"
] | null | null | null | nets.py | TomaszGolan/q-learning-maze | 2540acf09d939c1686060c58cbe52775e94304ed | [
"MIT"
] | null | null | null | """Quality functions"""
import tensorflow as tf
import numpy as np
from settings import Moves, Settings
class Net01:
"""My first attempt to approximate Q with NN"""
def __init__(self, session, in_size, snapshot=None):
"""Create a graph for NN
session -- tensorflow session
input_si... | 33.831461 | 78 | 0.616739 | import tensorflow as tf
import numpy as np
from settings import Moves, Settings
class Net01:
def __init__(self, session, in_size, snapshot=None):
self.sess = session
self.in_size = in_size
self.out_size = len(Moves.ALL)
h01_size = Settings.NOF_HIDDEN_NEURONS
h02_... | true | true |
f7f552e0ae64779722621f26163da8d176c85822 | 12,356 | py | Python | tests/test_index.py | eukaryote/knowhow | 276439680e4075300d8001cae4f03d199f473991 | [
"MIT"
] | null | null | null | tests/test_index.py | eukaryote/knowhow | 276439680e4075300d8001cae4f03d199f473991 | [
"MIT"
] | null | null | null | tests/test_index.py | eukaryote/knowhow | 276439680e4075300d8001cae4f03d199f473991 | [
"MIT"
] | null | null | null | # coding=utf8
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
import datetime
import hashlib
import json
from os.path import abspath, dirname, exists, join
import pickle
try:
from unittest.mock import patch
excep... | 29.773494 | 86 | 0.645435 |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
import datetime
import hashlib
import json
from os.path import abspath, dirname, exists, join
import pickle
try:
from unittest.mock import patch
except ImportError... | true | true |
f7f553ba17540df38791774f2fb3554f781b9016 | 10,451 | py | Python | src/pilot/rm-instanceHA-node.py | tahir696/JetPack-1 | 9bd5b04d1d5997693a52eb16a91e9f4f60d98b33 | [
"Apache-2.0"
] | null | null | null | src/pilot/rm-instanceHA-node.py | tahir696/JetPack-1 | 9bd5b04d1d5997693a52eb16a91e9f4f60d98b33 | [
"Apache-2.0"
] | null | null | null | src/pilot/rm-instanceHA-node.py | tahir696/JetPack-1 | 9bd5b04d1d5997693a52eb16a91e9f4f60d98b33 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python
# Copyright (c) 2016-2018 Dell Inc. or its subsidiaries.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 38.707407 | 79 | 0.604153 |
m_node -n")
crm_node_name = out.strip()
nova_compute_name = awk_it(crm_node_name, 1, ".")
LOG.info("Delete compute node resources {}."
.format(compute_node_ip))
ssh_cmd(compute_node_ip, "heat-admin",
"sudo systemctl stop pacemaker_remote")
ssh_cmd(compute_... | true | true |
f7f554e435082648fb1440f17ece05aabf7278ce | 1,282 | py | Python | tests/test_dict_compatibility.py | kdheepak/carsons | 6919cd5be416a58f14c1d5d933a52905a6d5f6a6 | [
"MIT"
] | null | null | null | tests/test_dict_compatibility.py | kdheepak/carsons | 6919cd5be416a58f14c1d5d933a52905a6d5f6a6 | [
"MIT"
] | null | null | null | tests/test_dict_compatibility.py | kdheepak/carsons | 6919cd5be416a58f14c1d5d933a52905a6d5f6a6 | [
"MIT"
] | null | null | null | from numpy.testing import assert_array_almost_equal
from .test_carsons import ABCN_line_z_primitive
from carsons.carsons import CarsonsEquations
def test_compatibility_with_dict_of_phases():
class BackwardsCompatibleModel():
def __init__(self):
self.resistance = {
"A": 0.00011... | 27.276596 | 61 | 0.473479 | from numpy.testing import assert_array_almost_equal
from .test_carsons import ABCN_line_z_primitive
from carsons.carsons import CarsonsEquations
def test_compatibility_with_dict_of_phases():
class BackwardsCompatibleModel():
def __init__(self):
self.resistance = {
"A": 0.00011... | true | true |
f7f5551dd0a2595ba739618bc36ced97cc0c05e3 | 10,439 | py | Python | TestMaster/libs/ddt.py | allblue2025/learn_git | 8ed884d0e0cb0dac14e26856be19a9a341bef0c0 | [
"MIT"
] | null | null | null | TestMaster/libs/ddt.py | allblue2025/learn_git | 8ed884d0e0cb0dac14e26856be19a9a341bef0c0 | [
"MIT"
] | null | null | null | TestMaster/libs/ddt.py | allblue2025/learn_git | 8ed884d0e0cb0dac14e26856be19a9a341bef0c0 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# This file is a part of DDT (https://github.com/txels/ddt)
# Copyright 2012-2015 Carles Barrobés and DDT contributors
# For the exact contribution history, see the git revision log.
# DDT is licensed under the MIT License, included in
# https://github.com/txels/ddt/blob/master/LICENSE.md
impor... | 31.633333 | 80 | 0.618929 |
import inspect
import json
import os
import re
import codecs
from functools import wraps
try:
import yaml
except ImportError:
_have_yaml = False
else:
_have_yaml = True
__version__ = '1.2.1'
DATA_ATTR = '%values'
FILE_ATTR = '%file_path'
UNPACK_ATTR = '%unpack'
index_len = 5 ... | true | true |
f7f5560ed27c2b1ebb59b52d01c5db3a89eb6169 | 7,613 | py | Python | clarisse/var/lib/windows/export_alembic.py | GuillaumeVFX/pipel | a1bd726239e6887745396723c3aad5d61e88ce44 | [
"MIT"
] | 2 | 2020-05-12T11:38:44.000Z | 2022-03-07T04:13:50.000Z | clarisse/var/lib/windows/export_alembic.py | GuillaumeVFX/pipel | a1bd726239e6887745396723c3aad5d61e88ce44 | [
"MIT"
] | null | null | null | clarisse/var/lib/windows/export_alembic.py | GuillaumeVFX/pipel | a1bd726239e6887745396723c3aad5d61e88ce44 | [
"MIT"
] | null | null | null | # Copyright (C) 2009 - 2019 Isotropix SAS. All rights reserved.
#
# The information in this file is provided for the exclusive use of
# the software licensees of Isotropix. Contents of this file may not
# be distributed, copied or duplicated in any form, in whole or in
# part, without the prior written permission of Is... | 46.139394 | 428 | 0.704059 |
abc_export_options_ui_cid = '''
attribute_group "output" {
filename_save "filename" {
extension "abc"
}
}
attribute_group "animation" {
long[2] "frame_range" {
value 0 0
doc "Specify the start/end frames to export."
... | true | true |
f7f5561f7f7ad3d26e016f026638abb1a6d1c89d | 3,092 | py | Python | tests/test_rfc7914.py | pysnmp/pyasn1-modules | 93f5699988fbb090be13aaa339498c128ba7dedb | [
"BSD-2-Clause"
] | null | null | null | tests/test_rfc7914.py | pysnmp/pyasn1-modules | 93f5699988fbb090be13aaa339498c128ba7dedb | [
"BSD-2-Clause"
] | null | null | null | tests/test_rfc7914.py | pysnmp/pyasn1-modules | 93f5699988fbb090be13aaa339498c128ba7dedb | [
"BSD-2-Clause"
] | null | null | null | #
# This file is part of pyasn1-modules software.
#
# Created by Russ Housley
# Copyright (c) 2019, Vigil Security, LLC
# License: http://snmplabs.com/pyasn1/license.html
#
import sys
import unittest
from pyasn1.codec.der.decoder import decode as der_decoder
from pyasn1.codec.der.encoder import encode as der_encoder
... | 32.893617 | 88 | 0.719599 |
import sys
import unittest
from pyasn1.codec.der.decoder import decode as der_decoder
from pyasn1.codec.der.encoder import encode as der_encoder
from pyasn1_modules import pem, rfc5280, rfc5958, rfc7914, rfc8018
class MultiprimeRSAPrivateKeyTestCase(unittest.TestCase):
pem_text = """\
MIHiME0GCSqGSIb3D... | true | true |
f7f557f2e715aee0f29b40a8196c67caff51cb68 | 1,573 | py | Python | bookbar/orders/migrations/0001_initial.py | trenev/bookbar | bccfdf52293f7cf105d6768bb2a1a643c9a58bb7 | [
"MIT"
] | null | null | null | bookbar/orders/migrations/0001_initial.py | trenev/bookbar | bccfdf52293f7cf105d6768bb2a1a643c9a58bb7 | [
"MIT"
] | null | null | null | bookbar/orders/migrations/0001_initial.py | trenev/bookbar | bccfdf52293f7cf105d6768bb2a1a643c9a58bb7 | [
"MIT"
] | null | null | null | # Generated by Django 4.0.3 on 2022-03-23 21:44
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('books', '0012_rename_description_book_annotation'),
migrations.... | 40.333333 | 122 | 0.626192 |
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('books', '0012_rename_description_book_annotation'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),... | true | true |
f7f558fab50ed3fac7b3810faa3194d0589dc83c | 755 | py | Python | algorithms/FASTdetector.py | chandniagarwal/image_analyser | 2732df649646ada0a209eabae113ab9488d166a3 | [
"MIT"
] | null | null | null | algorithms/FASTdetector.py | chandniagarwal/image_analyser | 2732df649646ada0a209eabae113ab9488d166a3 | [
"MIT"
] | null | null | null | algorithms/FASTdetector.py | chandniagarwal/image_analyser | 2732df649646ada0a209eabae113ab9488d166a3 | [
"MIT"
] | null | null | null | import cv2 as cv
def fast_true(img):
# Initiate FAST object with default values
fast = cv.FastFeatureDetector_create()
return fast_analyser(img, fast)
def fast_false(img):
fast = cv.FastFeatureDetector_create()
# Disable nonmaxSuppression
fast.setNonmaxSuppression(0)
return fast_analyser... | 29.038462 | 71 | 0.699338 | import cv2 as cv
def fast_true(img):
fast = cv.FastFeatureDetector_create()
return fast_analyser(img, fast)
def fast_false(img):
fast = cv.FastFeatureDetector_create()
fast.setNonmaxSuppression(0)
return fast_analyser(img, fast)
def fast_analyser(img, fast):
kp = fast.detect(img,... | true | true |
f7f5599e1e33310bf0cda3f5e34f3cfa498ed92b | 55,514 | py | Python | src/olympia/addons/tests/test_serializers.py | NeilRashbrook/addons-server | ba8842473b0fbda0ad97eeed690c6704462d97af | [
"BSD-3-Clause"
] | null | null | null | src/olympia/addons/tests/test_serializers.py | NeilRashbrook/addons-server | ba8842473b0fbda0ad97eeed690c6704462d97af | [
"BSD-3-Clause"
] | null | null | null | src/olympia/addons/tests/test_serializers.py | NeilRashbrook/addons-server | ba8842473b0fbda0ad97eeed690c6704462d97af | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from django.utils.translation import override
from rest_framework.test import APIRequestFactory
from olympia import amo
from olympia.accounts.tests.test_serializers import TestBaseUserSerializer
from olympia.addons.models import (
Addon, AddonCategory, AddonUser, Category, CompatOverride,
... | 41.121481 | 79 | 0.617304 |
from django.utils.translation import override
from rest_framework.test import APIRequestFactory
from olympia import amo
from olympia.accounts.tests.test_serializers import TestBaseUserSerializer
from olympia.addons.models import (
Addon, AddonCategory, AddonUser, Category, CompatOverride,
CompatOverrideRange... | true | true |
f7f55aa87cdbd866f9fd82c3b26476625521f82b | 735 | py | Python | pr1081m/smallest_subsequence.py | l33tdaima/l33tdaima | 0a7a9573dc6b79e22dcb54357493ebaaf5e0aa90 | [
"MIT"
] | 1 | 2020-02-20T12:04:46.000Z | 2020-02-20T12:04:46.000Z | pr1081m/smallest_subsequence.py | l33tdaima/l33tdaima | 0a7a9573dc6b79e22dcb54357493ebaaf5e0aa90 | [
"MIT"
] | null | null | null | pr1081m/smallest_subsequence.py | l33tdaima/l33tdaima | 0a7a9573dc6b79e22dcb54357493ebaaf5e0aa90 | [
"MIT"
] | null | null | null | from collections import Counter
class Solution:
def smallestSubsequence(self, s: str) -> str:
if s == "":
return ""
counter = Counter(s)
pos = 0
for i, c in enumerate(s):
if c < s[pos]:
pos = i
counter[c] -= 1
if count... | 22.96875 | 82 | 0.491156 | from collections import Counter
class Solution:
def smallestSubsequence(self, s: str) -> str:
if s == "":
return ""
counter = Counter(s)
pos = 0
for i, c in enumerate(s):
if c < s[pos]:
pos = i
counter[c] -= 1
if count... | true | true |
f7f55c219086eb02779b767c8218ad18348f5b41 | 1,239 | py | Python | 2020/day07-handy-haversacks/bags.py | rajitbanerjee/advent-of-code | 9eb68d59a593433b972af7002893ff3c631b34f9 | [
"CC0-1.0"
] | null | null | null | 2020/day07-handy-haversacks/bags.py | rajitbanerjee/advent-of-code | 9eb68d59a593433b972af7002893ff3c631b34f9 | [
"CC0-1.0"
] | null | null | null | 2020/day07-handy-haversacks/bags.py | rajitbanerjee/advent-of-code | 9eb68d59a593433b972af7002893ff3c631b34f9 | [
"CC0-1.0"
] | null | null | null | #!/usr/bin/env python
def parseBags(lines: list) -> dict:
lines = [l.split(' contain ') for l in lines]
bags = {}
for line in lines:
outer = line[0][:line[0].index('bags') - 1]
inner = {}
if 'no other' not in line[1]:
for each in line[1].split(','):
each... | 28.813953 | 79 | 0.557708 |
def parseBags(lines: list) -> dict:
lines = [l.split(' contain ') for l in lines]
bags = {}
for line in lines:
outer = line[0][:line[0].index('bags') - 1]
inner = {}
if 'no other' not in line[1]:
for each in line[1].split(','):
each = each.strip()
... | true | true |
f7f55d2d0dcbcebe5e5202565cd95ffe342d1afd | 198 | py | Python | designkit_test/test_example.py | DavidErzmann/designkit_test | 4756c0812c1a881ae506845dcc8b5ef2eee62468 | [
"Apache-2.0"
] | null | null | null | designkit_test/test_example.py | DavidErzmann/designkit_test | 4756c0812c1a881ae506845dcc8b5ef2eee62468 | [
"Apache-2.0"
] | null | null | null | designkit_test/test_example.py | DavidErzmann/designkit_test | 4756c0812c1a881ae506845dcc8b5ef2eee62468 | [
"Apache-2.0"
] | null | null | null | # AUTOGENERATED! DO NOT EDIT! File to edit: test_example.ipynb (unless otherwise specified).
__all__ = ['say_hello']
# Cell
def say_hello(to):
"Say hello to somebody"
return f'Hello {to}!' | 24.75 | 92 | 0.70202 |
__all__ = ['say_hello']
def say_hello(to):
return f'Hello {to}!' | true | true |
f7f55d9333a27cbbdb4479ed9582b215f8d298a0 | 1,857 | py | Python | setup.py | linewalks/flask-sqlacodegen | 4429732fca6e2a78f78c6946dcebfe4554c47ef1 | [
"MIT"
] | 1 | 2021-01-24T12:12:10.000Z | 2021-01-24T12:12:10.000Z | setup.py | linewalks/flask-sqlacodegen | 4429732fca6e2a78f78c6946dcebfe4554c47ef1 | [
"MIT"
] | null | null | null | setup.py | linewalks/flask-sqlacodegen | 4429732fca6e2a78f78c6946dcebfe4554c47ef1 | [
"MIT"
] | 1 | 2019-11-07T20:07:45.000Z | 2019-11-07T20:07:45.000Z | import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import sqlacodegen
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):... | 29.47619 | 83 | 0.620894 | import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import sqlacodegen
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):... | true | true |
f7f55e00c3e17e76b13448703d6dac67cae6ca4f | 23 | py | Python | trafficgenerator/__init__.py | p-sherratt/PyTrafficGenerator | 61ddd0465b9ecdd72134e18668756d2a6ccbf646 | [
"Apache-2.0"
] | null | null | null | trafficgenerator/__init__.py | p-sherratt/PyTrafficGenerator | 61ddd0465b9ecdd72134e18668756d2a6ccbf646 | [
"Apache-2.0"
] | null | null | null | trafficgenerator/__init__.py | p-sherratt/PyTrafficGenerator | 61ddd0465b9ecdd72134e18668756d2a6ccbf646 | [
"Apache-2.0"
] | null | null | null |
__version__ = '1.6.3'
| 7.666667 | 21 | 0.608696 |
__version__ = '1.6.3'
| true | true |
f7f55e99303f127d316ea6a2fd21c514ee669cd9 | 215 | py | Python | food_reference_listing/users/tests/test_models.py | bfssi-forest-dussault/food_reference_listing | 85372a81a9201dda02797ab0c11b1bd710f9b70d | [
"MIT"
] | null | null | null | food_reference_listing/users/tests/test_models.py | bfssi-forest-dussault/food_reference_listing | 85372a81a9201dda02797ab0c11b1bd710f9b70d | [
"MIT"
] | null | null | null | food_reference_listing/users/tests/test_models.py | bfssi-forest-dussault/food_reference_listing | 85372a81a9201dda02797ab0c11b1bd710f9b70d | [
"MIT"
] | null | null | null | import pytest
from food_reference_listing.users.models import User
pytestmark = pytest.mark.django_db
def test_user_get_absolute_url(user: User):
assert user.get_absolute_url() == f"/users/{user.username}/"
| 21.5 | 64 | 0.786047 | import pytest
from food_reference_listing.users.models import User
pytestmark = pytest.mark.django_db
def test_user_get_absolute_url(user: User):
assert user.get_absolute_url() == f"/users/{user.username}/"
| true | true |
f7f55eeb2efdd9d503782a38ce90a064128fcdb5 | 7,403 | py | Python | testes/testes_fase.py | lgcarvalhoDEV/pythonbirds | 580d95a0ecb5dcc625c53b13196edf9e1803344c | [
"MIT"
] | null | null | null | testes/testes_fase.py | lgcarvalhoDEV/pythonbirds | 580d95a0ecb5dcc625c53b13196edf9e1803344c | [
"MIT"
] | null | null | null | testes/testes_fase.py | lgcarvalhoDEV/pythonbirds | 580d95a0ecb5dcc625c53b13196edf9e1803344c | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import os
import sys
from os import path
from unittest.case import TestCase
project_dir = path.dirname(__file__)
project_dir = path.join('..')
sys.path.append(project_dir)
from placa_grafica_tkinter import rodar_fase
project_dir = os.path.join(os.path.dirname(__file__), '..')
project_dir = os... | 34.755869 | 147 | 0.635688 |
import os
import sys
from os import path
from unittest.case import TestCase
project_dir = path.dirname(__file__)
project_dir = path.join('..')
sys.path.append(project_dir)
from placa_grafica_tkinter import rodar_fase
project_dir = os.path.join(os.path.dirname(__file__), '..')
project_dir = os.path.normpath(project_... | true | true |
f7f55f48d058423058b5a93edf2e41ae0f0f7055 | 610 | py | Python | md2pdf/renderer.py | billweasley/md2pdf | 161bba679f947758e6436e47ce078b4d0e1943d9 | [
"BSD-3-Clause"
] | 7 | 2015-01-20T14:17:55.000Z | 2018-07-10T13:46:24.000Z | md2pdf/renderer.py | billweasley/md2pdf | 161bba679f947758e6436e47ce078b4d0e1943d9 | [
"BSD-3-Clause"
] | 3 | 2015-01-20T11:49:45.000Z | 2017-12-18T07:41:49.000Z | md2pdf/renderer.py | billweasley/md2pdf | 161bba679f947758e6436e47ce078b4d0e1943d9 | [
"BSD-3-Clause"
] | 5 | 2015-01-20T10:09:03.000Z | 2019-01-17T18:41:00.000Z | # coding=utf8
"""
md2pdf.renderer
~~~~~~~~~~~~~~~
Usage::
>>> from md2pdf.renderer import renderer
>>> renderer(**kwargs)
"""
from jinja2 import Environment, FileSystemLoader
from . import template
from .utils import path_to
class Renderer(object):
def __init__(self, pdf_template... | 20.333333 | 73 | 0.672131 |
from jinja2 import Environment, FileSystemLoader
from . import template
from .utils import path_to
class Renderer(object):
def __init__(self, pdf_template, templates_folder):
self.env = Environment(loader=FileSystemLoader(templates_folder))
self.pdf_template = pdf_template
def render(sel... | true | true |
f7f55f6ca19ee957793245d136155fa6385a468e | 1,170 | py | Python | python/sb_cardToCamera.py | simonbjork/sb-nuke-tools | b8ec375199700e77bff7cc50b489a3ac755a6b6a | [
"MIT"
] | null | null | null | python/sb_cardToCamera.py | simonbjork/sb-nuke-tools | b8ec375199700e77bff7cc50b489a3ac755a6b6a | [
"MIT"
] | null | null | null | python/sb_cardToCamera.py | simonbjork/sb-nuke-tools | b8ec375199700e77bff7cc50b489a3ac755a6b6a | [
"MIT"
] | null | null | null | ################
"""
sb_cardToCamera
Simon Bjork
March 2014
bjork.simon@gmail.com
To install the script:
- Add the script to your Nuke pluginPath.
- Add the following to your menu.py:
import sb_cardToCamera
sb_tools = nuke.toolbar("Nodes").addMenu( "sb_Tools", icon = "sb_tools.pn... | 23.877551 | 90 | 0.632479 | .setValue(i["xpos"].value())
card["ypos"].setValue(i["ypos"].value() + 100)
card["translate"].fromScript(i["translate"].toScript())
card["rotate"].fromScript(i["rotate"].toScript())
card["lens_in_focal"].fromScript(i["focal"].toScript())
card["lens_in_haperture"].fromScript(i["haperture"].toScript())
... | true | true |
f7f55f95dfc881a7f41f33855f1c5508367323a0 | 14,253 | py | Python | angr/simos/linux.py | zeroSteiner/angr | 90dc141c424a2c4dba5551baf0beac7ce7bc8837 | [
"BSD-2-Clause"
] | 2 | 2018-12-03T23:14:56.000Z | 2018-12-03T23:15:57.000Z | angr/simos/linux.py | zeroSteiner/angr | 90dc141c424a2c4dba5551baf0beac7ce7bc8837 | [
"BSD-2-Clause"
] | null | null | null | angr/simos/linux.py | zeroSteiner/angr | 90dc141c424a2c4dba5551baf0beac7ce7bc8837 | [
"BSD-2-Clause"
] | null | null | null | import os
import logging
import claripy
from cle import MetaELF
from cle.address_translator import AT
from archinfo import ArchX86, ArchAMD64, ArchARM, ArchAArch64, ArchMIPS32, ArchMIPS64, ArchPPC32, ArchPPC64
from ..tablespecs import StringTableSpec
from ..procedures import SIM_PROCEDURES as P, SIM_LIBRARIES as L
fr... | 45.977419 | 119 | 0.604434 | import os
import logging
import claripy
from cle import MetaELF
from cle.address_translator import AT
from archinfo import ArchX86, ArchAMD64, ArchARM, ArchAArch64, ArchMIPS32, ArchMIPS64, ArchPPC32, ArchPPC64
from ..tablespecs import StringTableSpec
from ..procedures import SIM_PROCEDURES as P, SIM_LIBRARIES as L
fr... | true | true |
f7f55fb14b1e7b6bcf5f26d2c969912641e7deeb | 289 | py | Python | wagtailcommerce/stores/middleware.py | theplusagency/wagtail-commerce | 6047170f29199ccaf2778534976ab0970c2877e7 | [
"BSD-3-Clause"
] | 3 | 2019-04-12T15:38:43.000Z | 2019-09-22T10:23:20.000Z | wagtailcommerce/stores/middleware.py | wagtailcommerce/wagtailcommerce | 308ed8348483806c16062d09a7e69ec44d9a2e73 | [
"BSD-3-Clause"
] | null | null | null | wagtailcommerce/stores/middleware.py | wagtailcommerce/wagtailcommerce | 308ed8348483806c16062d09a7e69ec44d9a2e73 | [
"BSD-3-Clause"
] | null | null | null | from .utils import get_store
class StoreMiddleware(object):
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
request.store = get_store(request)
response = self.get_response(request)
return response
| 22.230769 | 45 | 0.692042 | from .utils import get_store
class StoreMiddleware(object):
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
request.store = get_store(request)
response = self.get_response(request)
return response
| true | true |
f7f560d95fea1e072301e9cf6f2d400ad15c09a6 | 5,859 | py | Python | src/cleanShpNet.py | ashish-code/gps-denied-geospatial-positioning | 5006b963e0b8fe50b0cabd5e3a9deb6aeb2416f2 | [
"MIT"
] | 2 | 2021-09-07T14:15:50.000Z | 2021-12-27T06:04:54.000Z | src/cleanShpNet.py | ashish-code/gps-denied-geospatial-positioning | 5006b963e0b8fe50b0cabd5e3a9deb6aeb2416f2 | [
"MIT"
] | null | null | null | src/cleanShpNet.py | ashish-code/gps-denied-geospatial-positioning | 5006b963e0b8fe50b0cabd5e3a9deb6aeb2416f2 | [
"MIT"
] | null | null | null | '''
Created on Aug 31, 2015
@author: ash
'''
"""
cleanNetShp -- Tools to clean spatial Network Shapefiles.
"""
import pysal
import numpy
__author__ = "Charles R. Schmidt <schmidtc@gmail.com>"
__all__ = ['snap_verts', 'find_nodes', 'split_at_nodes']
# urlShpFile = "/home/ash/Data/tl_2014_39049_roads/tl_2014_39049_r... | 32.370166 | 116 | 0.624509 | '''
Created on Aug 31, 2015
@author: ash
'''
"""
cleanNetShp -- Tools to clean spatial Network Shapefiles.
"""
import pysal
import numpy
__author__ = "Charles R. Schmidt <schmidtc@gmail.com>"
__all__ = ['snap_verts', 'find_nodes', 'split_at_nodes']
urlShpFile = "/home/ash/Data/haiti_all_roads/Haiti_all_road... | false | true |
f7f561d0dcdf8be2fa2cc5ae7fe2885f40fc763d | 1,248 | py | Python | triggerflow/libs/cloudevents/sdk/converters/base.py | Dahk/triggerflow-examples | c492942ab911615d144a1375f4bc7933831203bd | [
"Apache-2.0"
] | 38 | 2020-06-11T08:05:21.000Z | 2022-03-17T10:21:18.000Z | triggerflow/libs/cloudevents/sdk/converters/base.py | Dahk/triggerflow-examples | c492942ab911615d144a1375f4bc7933831203bd | [
"Apache-2.0"
] | 1 | 2020-07-07T15:47:56.000Z | 2020-07-07T15:47:56.000Z | triggerflow/libs/cloudevents/sdk/converters/base.py | Dahk/triggerflow-examples | c492942ab911615d144a1375f4bc7933831203bd | [
"Apache-2.0"
] | 7 | 2020-05-18T16:32:06.000Z | 2021-11-30T17:11:12.000Z | # All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | 27.733333 | 78 | 0.66266 |
import typing
from ..event import base
class Converter(object):
TYPE = None
def read(
self,
event,
headers: dict,
body: typing.IO,
data_unmarshaller: typing.Callable
) -> base.BaseEvent:
raise Exception("not implemented")
def event_supp... | true | true |
f7f563231b83c189e52431f80f627683fd215e19 | 4,443 | py | Python | sdk/python/pulumi_azure_native/dbforpostgresql/v20171201preview/get_firewall_rule.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/dbforpostgresql/v20171201preview/get_firewall_rule.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/dbforpostgresql/v20171201preview/get_firewall_rule.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
__a... | 36.719008 | 193 | 0.66284 |
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
__all__ = [
'GetFirewallRuleResult',
'AwaitableGetFirewallRuleResult',
'get_firewall_rule',
]
@pulumi.output_type
class GetFirewallRuleResult:
def __in... | true | true |
f7f563c54c87bf8b7c7ccebdcb8840be30d1a427 | 135,605 | py | Python | lib/galaxy/model/mapping.py | globusgenomics/galaxy | 7caf74d9700057587b3e3434c64e82c5b16540f1 | [
"CC-BY-3.0"
] | 1 | 2021-02-05T13:19:58.000Z | 2021-02-05T13:19:58.000Z | lib/galaxy/model/mapping.py | globusgenomics/galaxy | 7caf74d9700057587b3e3434c64e82c5b16540f1 | [
"CC-BY-3.0"
] | null | null | null | lib/galaxy/model/mapping.py | globusgenomics/galaxy | 7caf74d9700057587b3e3434c64e82c5b16540f1 | [
"CC-BY-3.0"
] | null | null | null | """
Details of how the data model objects are mapped onto the relational database
are encapsulated here.
"""
import logging
from sqlalchemy import (
and_,
asc,
Boolean,
Column,
DateTime,
desc,
false,
ForeignKey,
func,
Integer,
MetaData,
not_,
Numeric,
select,
... | 48.569126 | 188 | 0.731883 |
import logging
from sqlalchemy import (
and_,
asc,
Boolean,
Column,
DateTime,
desc,
false,
ForeignKey,
func,
Integer,
MetaData,
not_,
Numeric,
select,
String, Table,
TEXT,
Text,
true,
Unicode,
UniqueConstraint,
VARCHAR
)
from sqlalche... | true | true |
f7f5647cf696e534c739ef11c362c02c1fab180d | 817 | py | Python | tests/test_decline.py | Kitingu/restplus | f9f5d36f376b08bed4305020259f2be7d689705a | [
"MIT"
] | null | null | null | tests/test_decline.py | Kitingu/restplus | f9f5d36f376b08bed4305020259f2be7d689705a | [
"MIT"
] | 5 | 2019-10-21T17:05:46.000Z | 2021-06-01T22:35:47.000Z | tests/test_decline.py | Kitingu/restplus | f9f5d36f376b08bed4305020259f2be7d689705a | [
"MIT"
] | 1 | 2018-09-04T14:17:43.000Z | 2018-09-04T14:17:43.000Z | import json
from .Base_test import BaseTest
class DeclineApproval(BaseTest):
def test_decline(self):
response = self.client().post('/api/v1/rides', data=json.dumps(self.test_ride),
content_type='application/json',headers=self.user_header)
self.assertEqual(resp... | 32.68 | 97 | 0.629131 | import json
from .Base_test import BaseTest
class DeclineApproval(BaseTest):
def test_decline(self):
response = self.client().post('/api/v1/rides', data=json.dumps(self.test_ride),
content_type='application/json',headers=self.user_header)
self.assertEqual(resp... | true | true |
f7f56499daace7690f4862ef71e523c801553b8c | 3,490 | py | Python | app.py files/app_stroke.py | imsanjoykb/Health-AI | 2c033899fce81089f9fc8e4d79e453dc94742576 | [
"MIT"
] | 5 | 2022-02-07T04:47:37.000Z | 2022-03-20T12:28:39.000Z | app.py files/app_stroke.py | imsanjoykb/Health-AI | 2c033899fce81089f9fc8e4d79e453dc94742576 | [
"MIT"
] | null | null | null | app.py files/app_stroke.py | imsanjoykb/Health-AI | 2c033899fce81089f9fc8e4d79e453dc94742576 | [
"MIT"
] | null | null | null | from flask import Flask, render_template, request
import numpy as np
import pickle
app = Flask(__name__)
model = pickle.load(open('Stroke.pkl', 'rb'))
@app.route('/',methods=['GET'])
def Home():
return render_template('index.html')
@app.route("/predict", methods=['POST'])
def predict():
if request.method ==... | 31.727273 | 114 | 0.606304 | from flask import Flask, render_template, request
import numpy as np
import pickle
app = Flask(__name__)
model = pickle.load(open('Stroke.pkl', 'rb'))
@app.route('/',methods=['GET'])
def Home():
return render_template('index.html')
@app.route("/predict", methods=['POST'])
def predict():
if request.method ==... | true | true |
f7f564e680ba4f84304bb6e45f5f2936034ebe4c | 4,963 | py | Python | Predict.py | Sam-Chanow/Bitcoin-IGASS | c3babac66d6a0594c4d83479393c50a54af9572a | [
"Unlicense"
] | 1 | 2021-12-10T12:58:35.000Z | 2021-12-10T12:58:35.000Z | Predict.py | Sam-Chanow/Bitcoin-IGASS | c3babac66d6a0594c4d83479393c50a54af9572a | [
"Unlicense"
] | 1 | 2021-12-16T16:48:53.000Z | 2021-12-16T16:49:34.000Z | Predict.py | Sam-Chanow/Bitcoin-IGASS | c3babac66d6a0594c4d83479393c50a54af9572a | [
"Unlicense"
] | null | null | null | import torch
import sys
from tqdm import tqdm
from dataset import Dataset
import numpy as np
import tensorflow as tf
#adding the model folder path
sys.path.append('../model/')
sys.path.append('../tensorflow_model/')
import model
import tf_model
if __name__ == "__main__":
if (len(sys.argv) > 1) and (sys.argv[1] =... | 30.447853 | 127 | 0.505742 | import torch
import sys
from tqdm import tqdm
from dataset import Dataset
import numpy as np
import tensorflow as tf
sys.path.append('../model/')
sys.path.append('../tensorflow_model/')
import model
import tf_model
if __name__ == "__main__":
if (len(sys.argv) > 1) and (sys.argv[1] == '-train'):
... | true | true |
f7f564f9f9b9a76b5676ddd4c2245f69159fbff4 | 745 | py | Python | var/spack/repos/builtin/packages/minizip/package.py | RemoteConnectionManager/spack | f2967b6c16effd26ce007cf86cadbb645c574f50 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 2 | 2020-10-15T01:08:42.000Z | 2021-10-18T01:28:18.000Z | var/spack/repos/builtin/packages/minizip/package.py | RemoteConnectionManager/spack | f2967b6c16effd26ce007cf86cadbb645c574f50 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 2 | 2019-07-30T10:12:28.000Z | 2019-12-17T09:02:27.000Z | var/spack/repos/builtin/packages/minizip/package.py | RemoteConnectionManager/spack | f2967b6c16effd26ce007cf86cadbb645c574f50 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 5 | 2019-07-30T09:42:14.000Z | 2021-01-25T05:39:20.000Z | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Minizip(AutotoolsPackage):
"""C library for zip/unzip via zLib."""
homepage = "http:/... | 31.041667 | 96 | 0.712752 |
from spack import *
class Minizip(AutotoolsPackage):
homepage = "http://www.winimage.com/zLibDll/minizip.html"
url = "https://zlib.net/fossils/zlib-1.2.11.tar.gz"
version('1.2.11', sha256='c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1')
configure_directory = 'contrib/mi... | true | true |
f7f565c390622a84c75ca7cd2b7ef4fd3c4acc77 | 2,225 | py | Python | menpo/transform/test/test_h_translation.py | apapaion/menpo | 9834f0437ca3cbe6a972c2a62f7c970ae950cf32 | [
"BSD-3-Clause"
] | 311 | 2015-01-01T17:16:18.000Z | 2021-12-20T11:25:23.000Z | menpo/transform/test/test_h_translation.py | apapaion/menpo | 9834f0437ca3cbe6a972c2a62f7c970ae950cf32 | [
"BSD-3-Clause"
] | 298 | 2015-01-02T17:30:22.000Z | 2022-01-02T22:12:17.000Z | menpo/transform/test/test_h_translation.py | apapaion/menpo | 9834f0437ca3cbe6a972c2a62f7c970ae950cf32 | [
"BSD-3-Clause"
] | 80 | 2015-02-02T14:17:36.000Z | 2021-12-22T10:09:28.000Z | import numpy as np
from numpy.testing import assert_allclose, assert_almost_equal
from pytest import raises
from menpo.transform import Translation
def test_1d_translation():
t_vec = np.array([1])
with raises(ValueError):
Translation(t_vec)
def test_5d_translation():
t_vec = np.ones(5)
with... | 24.722222 | 88 | 0.684944 | import numpy as np
from numpy.testing import assert_allclose, assert_almost_equal
from pytest import raises
from menpo.transform import Translation
def test_1d_translation():
t_vec = np.array([1])
with raises(ValueError):
Translation(t_vec)
def test_5d_translation():
t_vec = np.ones(5)
with... | true | true |
f7f56721bd15163bfcbd8f7d5f6e289678cad3e1 | 76 | py | Python | enthought/pyface/ui/qt4/code_editor/pygments_highlighter.py | enthought/etsproxy | 4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347 | [
"BSD-3-Clause"
] | 3 | 2016-12-09T06:05:18.000Z | 2018-03-01T13:00:29.000Z | enthought/pyface/ui/qt4/code_editor/pygments_highlighter.py | enthought/etsproxy | 4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347 | [
"BSD-3-Clause"
] | 1 | 2020-12-02T00:51:32.000Z | 2020-12-02T08:48:55.000Z | enthought/pyface/ui/qt4/code_editor/pygments_highlighter.py | enthought/etsproxy | 4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347 | [
"BSD-3-Clause"
] | null | null | null | # proxy module
from pyface.ui.qt4.code_editor.pygments_highlighter import *
| 25.333333 | 60 | 0.828947 |
from pyface.ui.qt4.code_editor.pygments_highlighter import *
| true | true |
f7f5675c5392bfc113f2e39284bea19adbaa5bc7 | 659 | py | Python | final_project/server.py | jalsop24/xzceb-flask_eng_fr | 6d956b09fdc2e657764529b7183bc32334d9dd3f | [
"Apache-2.0"
] | null | null | null | final_project/server.py | jalsop24/xzceb-flask_eng_fr | 6d956b09fdc2e657764529b7183bc32334d9dd3f | [
"Apache-2.0"
] | null | null | null | final_project/server.py | jalsop24/xzceb-flask_eng_fr | 6d956b09fdc2e657764529b7183bc32334d9dd3f | [
"Apache-2.0"
] | null | null | null | from machinetranslation import translator
from flask import Flask, render_template, request
import json
app = Flask("Web Translator")
@app.route("/englishToFrench")
def englishToFrench():
textToTranslate = request.args.get('textToTranslate')
return translator.englishToFrench(textToTranslate)
@app.route("/fre... | 27.458333 | 57 | 0.754173 | from machinetranslation import translator
from flask import Flask, render_template, request
import json
app = Flask("Web Translator")
@app.route("/englishToFrench")
def englishToFrench():
textToTranslate = request.args.get('textToTranslate')
return translator.englishToFrench(textToTranslate)
@app.route("/fre... | true | true |
f7f5676ced5c70ec5871951c67b0b300b0ad4e21 | 29,683 | py | Python | sdk/python/tests/test_client.py | anderseriksson/feast | 4f01f17dc63260b8565ec66ed3806dfa068e5543 | [
"Apache-2.0"
] | null | null | null | sdk/python/tests/test_client.py | anderseriksson/feast | 4f01f17dc63260b8565ec66ed3806dfa068e5543 | [
"Apache-2.0"
] | null | null | null | sdk/python/tests/test_client.py | anderseriksson/feast | 4f01f17dc63260b8565ec66ed3806dfa068e5543 | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 The Feast 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | 38.852094 | 117 | 0.593842 |
import pkgutil
from concurrent import futures
from unittest import mock
import grpc
import pytest
from google.protobuf.duration_pb2 import Duration
from mock import MagicMock, patch
import dataframes
import feast.core.CoreService_pb2_grpc as Core
import feast.serving.ServingService_pb2_grpc as Serving
... | true | true |
f7f567c58571279038ec52ec7ed0bfaace7f0fb9 | 3,802 | py | Python | code/experiments/baseline_ptbdb.py | nkdnnlr/ECG-Heartbeat-Classification | d75012794b17d0b3b8dd9026874c026445cf05c3 | [
"MIT"
] | null | null | null | code/experiments/baseline_ptbdb.py | nkdnnlr/ECG-Heartbeat-Classification | d75012794b17d0b3b8dd9026874c026445cf05c3 | [
"MIT"
] | null | null | null | code/experiments/baseline_ptbdb.py | nkdnnlr/ECG-Heartbeat-Classification | d75012794b17d0b3b8dd9026874c026445cf05c3 | [
"MIT"
] | null | null | null | import pandas as pd
import numpy as np
from keras import optimizers, losses, activations, models
from keras.callbacks import (
ModelCheckpoint,
EarlyStopping,
LearningRateScheduler,
ReduceLROnPlateau,
)
from keras.layers import (
Dense,
Input,
Dropout,
Convolution1D,
MaxPool1D,
... | 31.683333 | 93 | 0.702262 | import pandas as pd
import numpy as np
from keras import optimizers, losses, activations, models
from keras.callbacks import (
ModelCheckpoint,
EarlyStopping,
LearningRateScheduler,
ReduceLROnPlateau,
)
from keras.layers import (
Dense,
Input,
Dropout,
Convolution1D,
MaxPool1D,
... | true | true |
f7f5685ce14e3d724e7c28cd1d370749677e9c42 | 23,661 | py | Python | Improvements/gnnimprove.py | Harshitha-Nagapudi/NN_Project | f0df170a33b6b35a00929a0104dc6ee04c5062a9 | [
"MIT"
] | null | null | null | Improvements/gnnimprove.py | Harshitha-Nagapudi/NN_Project | f0df170a33b6b35a00929a0104dc6ee04c5062a9 | [
"MIT"
] | null | null | null | Improvements/gnnimprove.py | Harshitha-Nagapudi/NN_Project | f0df170a33b6b35a00929a0104dc6ee04c5062a9 | [
"MIT"
] | null | null | null | import torch.nn as nn
import torch.nn.functional as F
import math
import torch
import torch.optim as optim
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
from deeprobust.graph import utils
from copy import deepcopy
import sys
from scipy import stats
import tensorly as tl
tl.set_bac... | 37.261417 | 131 | 0.571489 | import torch.nn as nn
import torch.nn.functional as F
import math
import torch
import torch.optim as optim
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
from deeprobust.graph import utils
from copy import deepcopy
import sys
from scipy import stats
import tensorly as tl
tl.set_bac... | true | true |
f7f568821e38bfb8baf20e3d3953ebea040ae2d4 | 3,346 | py | Python | attack.py | LiYingwei/Regional-Homogeneity | 6b0b521ff6e9d1f4c3f25cb25518968047b5cca0 | [
"MIT"
] | 44 | 2019-04-02T01:56:43.000Z | 2022-03-29T08:48:22.000Z | attack.py | Sunshine352/Regional-Homogeneity | 6b0b521ff6e9d1f4c3f25cb25518968047b5cca0 | [
"MIT"
] | 1 | 2020-02-05T03:43:05.000Z | 2020-03-17T20:06:59.000Z | attack.py | Sunshine352/Regional-Homogeneity | 6b0b521ff6e9d1f4c3f25cb25518968047b5cca0 | [
"MIT"
] | 10 | 2019-04-02T08:39:34.000Z | 2021-04-10T13:56:16.000Z | from config import config as FLAGS
import tensorflow as tf
from tensorpack import (BatchData)
from tqdm import tqdm
import numpy as np
from RHP_ops import conv_with_rn
from data import PNGDataFlow, save_images
from networks import network
from tensorpack.tfutils.tower import TowerContext
class Attacker:
def __i... | 41.308642 | 97 | 0.652122 | from config import config as FLAGS
import tensorflow as tf
from tensorpack import (BatchData)
from tqdm import tqdm
import numpy as np
from RHP_ops import conv_with_rn
from data import PNGDataFlow, save_images
from networks import network
from tensorpack.tfutils.tower import TowerContext
class Attacker:
def __i... | true | true |
f7f56930f7f0bd97fe1f8c96b85ebd9a317a525e | 15,122 | py | Python | neo3/storage/implementations/leveldb.py | CityOfZion/neo3-python | db4cd53041ce7a2c1d32bee18214fb31bb9f52be | [
"MIT"
] | null | null | null | neo3/storage/implementations/leveldb.py | CityOfZion/neo3-python | db4cd53041ce7a2c1d32bee18214fb31bb9f52be | [
"MIT"
] | 23 | 2020-05-12T15:01:12.000Z | 2020-07-15T09:26:05.000Z | neo3/storage/implementations/leveldb.py | CityOfZion/neo3-python | db4cd53041ce7a2c1d32bee18214fb31bb9f52be | [
"MIT"
] | 1 | 2020-07-01T09:32:46.000Z | 2020-07-01T09:32:46.000Z | from __future__ import annotations
from neo3 import storage
from neo3 import storage_logger as logger
from neo3.core import types, serialization
from neo3.network import payloads
from contextlib import suppress
from copy import deepcopy
level_db_supported = False
with suppress(ModuleNotFoundError):
import plyvel ... | 39.483029 | 120 | 0.661156 | from __future__ import annotations
from neo3 import storage
from neo3 import storage_logger as logger
from neo3.core import types, serialization
from neo3.network import payloads
from contextlib import suppress
from copy import deepcopy
level_db_supported = False
with suppress(ModuleNotFoundError):
import plyvel ... | true | true |
f7f56a0c755ea0ebc5e458d374bfd1d15e2715e8 | 2,783 | py | Python | examples/flow_routing/simple_sp_driver_wlakes.py | cctrunz/landlab | 4e4ef12f4bae82bc5194f1dcc9af8ff1a7c20939 | [
"MIT"
] | null | null | null | examples/flow_routing/simple_sp_driver_wlakes.py | cctrunz/landlab | 4e4ef12f4bae82bc5194f1dcc9af8ff1a7c20939 | [
"MIT"
] | 1 | 2016-03-16T02:34:08.000Z | 2016-04-20T19:31:30.000Z | examples/flow_routing/simple_sp_driver_wlakes.py | cctrunz/landlab | 4e4ef12f4bae82bc5194f1dcc9af8ff1a7c20939 | [
"MIT"
] | null | null | null | """
simple_sp_driver.py
A simple driver implementing Braun-Willett flow routing and then a
(non-fastscape) stream power component.
DEJH, 09/15/14
"""
from __future__ import print_function
import time
import numpy
import pylab
from landlab import ModelParameterDictionary, RasterModelGrid
from landlab.components.flow... | 28.111111 | 86 | 0.722961 | from __future__ import print_function
import time
import numpy
import pylab
from landlab import ModelParameterDictionary, RasterModelGrid
from landlab.components.flow_routing import DepressionFinderAndRouter, FlowAccumulator
from landlab.components.stream_power import FastscapeEroder, StreamPowerEroder
from landlab.... | true | true |
f7f56a289e503d16b10223c8580fb77729b270d6 | 990 | py | Python | app/db_manager/tests/test_utils.py | PragmaticCoder/Linkedin-Analytics | a990b5cae02f0d758bc3123bde643d13a439efa3 | [
"MIT"
] | null | null | null | app/db_manager/tests/test_utils.py | PragmaticCoder/Linkedin-Analytics | a990b5cae02f0d758bc3123bde643d13a439efa3 | [
"MIT"
] | null | null | null | app/db_manager/tests/test_utils.py | PragmaticCoder/Linkedin-Analytics | a990b5cae02f0d758bc3123bde643d13a439efa3 | [
"MIT"
] | null | null | null | from django.test import TestCase
from core.models import Company
from db_manager.utils import database_upload
class DatabaseUploadTests(TestCase):
def setUp(self):
self.company = Company.objects.create(
name="Test",
companyType="test",
employeeCountRange="12",
... | 30 | 79 | 0.620202 | from django.test import TestCase
from core.models import Company
from db_manager.utils import database_upload
class DatabaseUploadTests(TestCase):
def setUp(self):
self.company = Company.objects.create(
name="Test",
companyType="test",
employeeCountRange="12",
... | true | true |
f7f56c8c79c97d94f4af07571b6af1adae4f2e57 | 7,206 | py | Python | robustRL-master/robustRL/samplers.py | kyuhoJeong11/GrewRL | a514698df8d38df34de0bd1667d99927f0aa3885 | [
"MIT"
] | null | null | null | robustRL-master/robustRL/samplers.py | kyuhoJeong11/GrewRL | a514698df8d38df34de0bd1667d99927f0aa3885 | [
"MIT"
] | null | null | null | robustRL-master/robustRL/samplers.py | kyuhoJeong11/GrewRL | a514698df8d38df34de0bd1667d99927f0aa3885 | [
"MIT"
] | null | null | null | """
Sampler functions to be used with the policy search algorithms
Aravind Rajeswaran, 08/04/16
"""
import numpy as np
import copy
import multiprocessing as mp
from rllab.misc import tensor_utils
from MDP_funcs import *
# above MDP_funs is local copy
# ======================================================... | 30.66383 | 101 | 0.592978 |
import numpy as np
import copy
import multiprocessing as mp
from rllab.misc import tensor_utils
from MDP_funcs import *
def sample_paths(N,
policy,
baseline,
env_mode='train',
T=1e6,
gamma=1,
mujoco_env=True,
normalized_env=False,
env=None):
np.random.seed()
... | true | true |
f7f56dd149c048edb1a9a8025869171f526daf81 | 49 | py | Python | allpoetryapi/__init__.py | jmbhughes/allpoetryapi | aee522addb154711325bc8f5f90fc54170aeec66 | [
"MIT"
] | null | null | null | allpoetryapi/__init__.py | jmbhughes/allpoetryapi | aee522addb154711325bc8f5f90fc54170aeec66 | [
"MIT"
] | 2 | 2018-08-19T22:26:38.000Z | 2018-08-22T19:11:19.000Z | allpoetryapi/__init__.py | jmbhughes/allpoetryapi | aee522addb154711325bc8f5f90fc54170aeec66 | [
"MIT"
] | null | null | null | from .api import Poem
from .api import AllPoetry
| 16.333333 | 26 | 0.795918 | from .api import Poem
from .api import AllPoetry
| true | true |
f7f56e06634521e6d705dd886d50b6fea1796ccd | 2,733 | py | Python | config.py | mwiemarc/lightpack-audio-reactive | 331a1ff408d885da9a85d0bdfa06f2f370139fea | [
"MIT"
] | 1 | 2019-01-25T23:11:11.000Z | 2019-01-25T23:11:11.000Z | config.py | mwiemarc/lightpack-audio-reactive | 331a1ff408d885da9a85d0bdfa06f2f370139fea | [
"MIT"
] | null | null | null | config.py | mwiemarc/lightpack-audio-reactive | 331a1ff408d885da9a85d0bdfa06f2f370139fea | [
"MIT"
] | null | null | null | """Settings for audio reactive LED strip"""
from __future__ import print_function
from __future__ import division
import os
LIGHTPACK_HOST = '127.0.0.1'
"""Lightpack server host"""
LIGHTPACK_PORT = 3636
"""Lightpack server port"""
LIGHTPACK_APIKEY = ''
"""API Key for authentication"""
NUM_LEDS = 45
"""Number of l... | 30.707865 | 79 | 0.76985 | from __future__ import print_function
from __future__ import division
import os
LIGHTPACK_HOST = '127.0.0.1'
LIGHTPACK_PORT = 3636
LIGHTPACK_APIKEY = ''
NUM_LEDS = 45
CENTER_OFFSET = 16
USE_GUI = True
DISPLAY_FPS = False
MIC_RATE = 44100
SOFTWARE_GAMMA_CORRECTION = False
GAMMA_TABLE_PATH = os.path.join(os.... | true | true |
f7f56e690d673f4161e70656c83d2a143dfed68d | 145 | py | Python | BOJ/21000~21999/21300~21399/21360.py | shinkeonkim/today-ps | f3e5e38c5215f19579bb0422f303a9c18c626afa | [
"Apache-2.0"
] | 2 | 2020-01-29T06:54:41.000Z | 2021-11-07T13:23:27.000Z | BOJ/21000~21999/21300~21399/21360.py | shinkeonkim/Today_PS | bb0cda0ee1b9c57e1cfa38355e29d0f1c6167a44 | [
"Apache-2.0"
] | null | null | null | BOJ/21000~21999/21300~21399/21360.py | shinkeonkim/Today_PS | bb0cda0ee1b9c57e1cfa38355e29d0f1c6167a44 | [
"Apache-2.0"
] | null | null | null | input()
l = [i for i,j in enumerate(input()) if j =='.']
ans = 11111111
for i in range(len(l)-1):
ans = min(ans, l[i+1] - l[i])
print(ans - 1) | 20.714286 | 48 | 0.558621 | input()
l = [i for i,j in enumerate(input()) if j =='.']
ans = 11111111
for i in range(len(l)-1):
ans = min(ans, l[i+1] - l[i])
print(ans - 1) | true | true |
f7f56f16a4888d35d64d917bb917686bb9558bbd | 2,212 | py | Python | tracker/migrations/0004_auto_20160806_2353.py | giantas/elibrary | b1abe74dcae036051764d5ad8bdf74673c8a2861 | [
"MIT"
] | null | null | null | tracker/migrations/0004_auto_20160806_2353.py | giantas/elibrary | b1abe74dcae036051764d5ad8bdf74673c8a2861 | [
"MIT"
] | null | null | null | tracker/migrations/0004_auto_20160806_2353.py | giantas/elibrary | b1abe74dcae036051764d5ad8bdf74673c8a2861 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-08-06 20:53
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
... | 40.962963 | 162 | 0.606239 |
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('t... | true | true |
f7f56f3a1c2b881cfc3efb61992d50e0592a6bbd | 409 | bzl | Python | cmd/image.bzl | ShotaKitazawa/pipe | 690a390e4364fc7d51c3a31e9921bda0300f6528 | [
"Apache-2.0"
] | null | null | null | cmd/image.bzl | ShotaKitazawa/pipe | 690a390e4364fc7d51c3a31e9921bda0300f6528 | [
"Apache-2.0"
] | null | null | null | cmd/image.bzl | ShotaKitazawa/pipe | 690a390e4364fc7d51c3a31e9921bda0300f6528 | [
"Apache-2.0"
] | null | null | null | def all_images():
cmds = {
"piped": "piped",
"pipecd": "pipecd",
"pipectl": "pipectl",
"helloworld": "helloworld",
}
images = {}
for cmd, repo in cmds.items():
images["$(DOCKER_REGISTRY)/%s:{STABLE_VERSION}" % repo] = "//cmd/%s:image" % cmd
images["$(DOCK... | 27.266667 | 91 | 0.535452 | def all_images():
cmds = {
"piped": "piped",
"pipecd": "pipecd",
"pipectl": "pipectl",
"helloworld": "helloworld",
}
images = {}
for cmd, repo in cmds.items():
images["$(DOCKER_REGISTRY)/%s:{STABLE_VERSION}" % repo] = "//cmd/%s:image" % cmd
images["$(DOCK... | true | true |
f7f5701d28225fe3218193f9f16fd161bac9bc89 | 755 | py | Python | MITx/6.00.1x/Week 2/Lecture_4/charSearchRecursive.py | dvpramodkumar/edX_moocs | 6e006cea8db9ac0784716a6f6143aeb3519e64c1 | [
"MIT"
] | null | null | null | MITx/6.00.1x/Week 2/Lecture_4/charSearchRecursive.py | dvpramodkumar/edX_moocs | 6e006cea8db9ac0784716a6f6143aeb3519e64c1 | [
"MIT"
] | null | null | null | MITx/6.00.1x/Week 2/Lecture_4/charSearchRecursive.py | dvpramodkumar/edX_moocs | 6e006cea8db9ac0784716a6f6143aeb3519e64c1 | [
"MIT"
] | null | null | null |
def isIn(char, aStr):
'''
char: a single character
aStr: an alphabetized string
returns: True if char is in aStr; False otherwise
'''
# Your code here
if(len(aStr) == 0):
return False
elif(len(aStr) == 1):
if(aStr[0] == char):
return True
else:
... | 18.875 | 53 | 0.491391 |
def isIn(char, aStr):
if(len(aStr) == 0):
return False
elif(len(aStr) == 1):
if(aStr[0] == char):
return True
else:
return False
else:
l = len(aStr)
low = 0
high = l - 1
value = int((low + high) / 2)
if(char <... | true | true |
f7f570c0d6d3315584a7819683cca2dc8657a8a0 | 1,504 | py | Python | recursion/104. Maximum Depth of Binary Tree_easy.py | JunzhongLin/leetcode_practice | 47b2f5cc3c87de004ae21a94024e751b40b8f559 | [
"MIT"
] | null | null | null | recursion/104. Maximum Depth of Binary Tree_easy.py | JunzhongLin/leetcode_practice | 47b2f5cc3c87de004ae21a94024e751b40b8f559 | [
"MIT"
] | null | null | null | recursion/104. Maximum Depth of Binary Tree_easy.py | JunzhongLin/leetcode_practice | 47b2f5cc3c87de004ae21a94024e751b40b8f559 | [
"MIT"
] | null | null | null | '''
Given the root of a binary tree, return its maximum depth.
A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
'''
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# se... | 23.5 | 126 | 0.525931 |
class Solution:
def maxDepth_iter(self, root: Optional[TreeNode]) -> int:
if root is None:
return 0
ans = 0
que = []
que.append(root)
while que:
ans += 1
length = len(que)
for i in range(length):
root... | true | true |
f7f570fffa8abab0de8cd0d8ed935490299d1194 | 189 | py | Python | project_euler/#1/Python/index.py | bored-user/b7web | 80785303d0e6a9e28b7ae5bdcf7fa20b90774a85 | [
"MIT"
] | null | null | null | project_euler/#1/Python/index.py | bored-user/b7web | 80785303d0e6a9e28b7ae5bdcf7fa20b90774a85 | [
"MIT"
] | 1 | 2021-04-29T10:29:05.000Z | 2021-04-29T10:29:05.000Z | project_euler/#1/Python/index.py | bored-user/exercises | 80785303d0e6a9e28b7ae5bdcf7fa20b90774a85 | [
"MIT"
] | null | null | null | def main():
total = 0
for i in range(1, 1000):
if i % 3 == 0 or i % 5 == 0:
total += i
return total
if (__name__ == '__main__'):
print(main()) | 17.181818 | 36 | 0.439153 | def main():
total = 0
for i in range(1, 1000):
if i % 3 == 0 or i % 5 == 0:
total += i
return total
if (__name__ == '__main__'):
print(main()) | true | true |
f7f5719b934e772adc8f4dc7311c47585c1c45f2 | 3,499 | py | Python | itchatmp/server.py | yf-ftd/itchatmp | 3c554f4f3e175a66f51edf4b8ff7982d0af378a0 | [
"MIT"
] | 1,504 | 2016-10-06T05:40:59.000Z | 2022-03-18T02:46:48.000Z | itchatmp/server.py | yf-ftd/itchatmp | 3c554f4f3e175a66f51edf4b8ff7982d0af378a0 | [
"MIT"
] | 51 | 2016-12-11T14:21:33.000Z | 2020-01-16T09:00:40.000Z | itchatmp/server.py | yf-ftd/itchatmp | 3c554f4f3e175a66f51edf4b8ff7982d0af378a0 | [
"MIT"
] | 370 | 2016-10-15T02:22:58.000Z | 2022-03-14T08:50:13.000Z | import os, logging
from base64 import b64decode
import tornado
from .content import NORMAL
from .controllers import (
Application, Chat, Common, CustomerService,
Menu, Messages, Oauth2, Statistics,
TemplateMsgs, Users, Utils, Wrapped)
from .components import load_register
from .exceptions impor... | 38.032609 | 82 | 0.627894 | import os, logging
from base64 import b64decode
import tornado
from .content import NORMAL
from .controllers import (
Application, Chat, Common, CustomerService,
Menu, Messages, Oauth2, Statistics,
TemplateMsgs, Users, Utils, Wrapped)
from .components import load_register
from .exceptions impor... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.