hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 958k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c01c5567cfb8ed131323731cf10a704fdad7e3e | 3,190 | py | Python | python_modules/dagster/dagster_tests/execution_tests/test_custom_reconstructable.py | rpatil524/dagster | 6f918d94cbd543ab752ab484a65e3a40fd441716 | [
"Apache-2.0"
] | null | null | null | python_modules/dagster/dagster_tests/execution_tests/test_custom_reconstructable.py | rpatil524/dagster | 6f918d94cbd543ab752ab484a65e3a40fd441716 | [
"Apache-2.0"
] | null | null | null | python_modules/dagster/dagster_tests/execution_tests/test_custom_reconstructable.py | rpatil524/dagster | 6f918d94cbd543ab752ab484a65e3a40fd441716 | [
"Apache-2.0"
] | 1 | 2019-09-11T03:02:27.000Z | 2019-09-11T03:02:27.000Z | import os
import sys
import pytest
from dagster import pipeline, reconstructable, solid
from dagster.core.definitions import ReconstructablePipeline, build_reconstructable_pipeline
from dagster.core.errors import DagsterInvariantViolationError
@solid
def top_scope_solid(_context):
pass
class PipelineFactory:
... | 32.222222 | 92 | 0.70721 | import os
import sys
import pytest
from dagster import pipeline, reconstructable, solid
from dagster.core.definitions import ReconstructablePipeline, build_reconstructable_pipeline
from dagster.core.errors import DagsterInvariantViolationError
@solid
def top_scope_solid(_context):
pass
class PipelineFactory:
... | true | true |
1c01c63d87f7d9701e181413e2c9982ed12b6efd | 13,309 | py | Python | hummingbot/client/hummingbot_application.py | knivek/HB | bd67654d8b1f727012ba29378b6958035260be4c | [
"Apache-2.0"
] | null | null | null | hummingbot/client/hummingbot_application.py | knivek/HB | bd67654d8b1f727012ba29378b6958035260be4c | [
"Apache-2.0"
] | null | null | null | hummingbot/client/hummingbot_application.py | knivek/HB | bd67654d8b1f727012ba29378b6958035260be4c | [
"Apache-2.0"
] | 1 | 2022-03-31T19:46:20.000Z | 2022-03-31T19:46:20.000Z | #!/usr/bin/env python
import asyncio
import logging
import time
from collections import deque
from typing import List, Dict, Optional, Tuple, Deque
from hummingbot.client.command import __all__ as commands
from hummingbot.client.tab import __all__ as tab_classes
from hummingbot.core.clock import Clock
from hummingbot... | 44.811448 | 120 | 0.648133 |
import asyncio
import logging
import time
from collections import deque
from typing import List, Dict, Optional, Tuple, Deque
from hummingbot.client.command import __all__ as commands
from hummingbot.client.tab import __all__ as tab_classes
from hummingbot.core.clock import Clock
from hummingbot.exceptions import Arg... | true | true |
1c01c7146912d02f4c2e368ca45a078960351e14 | 1,854 | py | Python | customSDK/servicefabric/models/paged_update_partition_load_result_list.py | mrdakj/service-fabric-cli | 3ab1503b9cb6559bbfbdfbe2ce23a95a1b9709ca | [
"MIT"
] | null | null | null | customSDK/servicefabric/models/paged_update_partition_load_result_list.py | mrdakj/service-fabric-cli | 3ab1503b9cb6559bbfbdfbe2ce23a95a1b9709ca | [
"MIT"
] | null | null | null | customSDK/servicefabric/models/paged_update_partition_load_result_list.py | mrdakj/service-fabric-cli | 3ab1503b9cb6559bbfbdfbe2ce23a95a1b9709ca | [
"MIT"
] | null | null | null | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 45.219512 | 82 | 0.669903 |
from msrest.serialization import Model
class PagedUpdatePartitionLoadResultList(Model):
_attribute_map = {
'continuation_token': {'key': 'ContinuationToken', 'type': 'str'},
'items': {'key': 'Items', 'type': '[UpdatePartitionLoadResult]'},
}
def __init__(self, **kwargs):
super(P... | true | true |
1c01c8c85957f501ab5e52b2738fb5fcd957a667 | 526 | py | Python | tests/some_module/test_some_class.py | FBernuy/pytest-github-action | 1a9a447da4efdce7b6bc928b6364f158b4e28c2f | [
"MIT"
] | 1 | 2020-02-21T14:45:18.000Z | 2020-02-21T14:45:18.000Z | tests/some_module/test_some_class.py | FBernuy/test-github-action | 1a9a447da4efdce7b6bc928b6364f158b4e28c2f | [
"MIT"
] | 2 | 2019-12-12T22:25:32.000Z | 2019-12-12T22:48:50.000Z | tests/some_module/test_some_class.py | FBernuy/test-github-action | 1a9a447da4efdce7b6bc928b6364f158b4e28c2f | [
"MIT"
] | null | null | null | from some_code.some_module import SomeClass
def test_some_class():
"""Tests SomeClass methods and usage"""
some_instance = SomeClass()
assert some_instance._some_att == 0, "Error on default initial value"
some_instance.set_att(7)
assert some_instance._some_att == 7, "Error on setter method"
... | 30.941176 | 73 | 0.730038 | from some_code.some_module import SomeClass
def test_some_class():
some_instance = SomeClass()
assert some_instance._some_att == 0, "Error on default initial value"
some_instance.set_att(7)
assert some_instance._some_att == 7, "Error on setter method"
value = some_instance.get_att()
assert v... | true | true |
1c01c946e74f9b2ab8eb54539be8b47c64676310 | 10,373 | py | Python | packages/w3af/w3af/core/ui/gui/tabs/exploit/vuln_list.py | ZooAtmosphereGroup/HelloPackages | 0ccffd33bf927b13d28c8f715ed35004c33465d9 | [
"Apache-2.0"
] | 3 | 2019-04-09T22:59:33.000Z | 2019-06-14T09:23:24.000Z | tools/w3af/w3af/core/ui/gui/tabs/exploit/vuln_list.py | sravani-m/Web-Application-Security-Framework | d9f71538f5cba6fe1d8eabcb26c557565472f6a6 | [
"MIT"
] | null | null | null | tools/w3af/w3af/core/ui/gui/tabs/exploit/vuln_list.py | sravani-m/Web-Application-Security-Framework | d9f71538f5cba6fe1d8eabcb26c557565472f6a6 | [
"MIT"
] | null | null | null | """
vuln_list.py
Copyright 2007 Andres Riancho
This file is part of w3af, http://w3af.org/ .
w3af is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the License.
w3af is distributed in the hope that i... | 34.234323 | 94 | 0.611781 | """
vuln_list.py
Copyright 2007 Andres Riancho
This file is part of w3af, http://w3af.org/ .
w3af is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the License.
w3af is distributed in the hope that i... | false | true |
1c01ca121bd75bde4e14805fe9388d3a349e5e77 | 1,923 | gyp | Python | device/hid/hid.gyp | Fusion-Rom/android_external_chromium_org | d8b126911c6ea9753e9f526bee5654419e1d0ebd | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 1 | 2020-01-25T09:58:49.000Z | 2020-01-25T09:58:49.000Z | device/hid/hid.gyp | Fusion-Rom/android_external_chromium_org | d8b126911c6ea9753e9f526bee5654419e1d0ebd | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | device/hid/hid.gyp | Fusion-Rom/android_external_chromium_org | d8b126911c6ea9753e9f526bee5654419e1d0ebd | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 1 | 2020-11-04T06:35:07.000Z | 2020-11-04T06:35:07.000Z | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
},
'targets': [
{
'target_name': 'device_hid',
'type': 'static_library',
'include_dirs':... | 27.471429 | 72 | 0.549662 |
{
'variables': {
'chromium_code': 1,
},
'targets': [
{
'target_name': 'device_hid',
'type': 'static_library',
'include_dirs': [
'../..',
],
'sources': [
'device_monitor_linux.cc',
'device_monitor_linux.h',
'hid_collection_info.cc',
'hi... | true | true |
1c01ca8a6c343ecee88207edf899e1c49badc780 | 3,495 | py | Python | stellar_sdk/call_builder/trades_aggregation_call_builder.py | bantalon/py-stellar-base | b452f0f92be0387c3e78c8149103978788d7ec0f | [
"Apache-2.0"
] | 1 | 2020-03-04T20:37:17.000Z | 2020-03-04T20:37:17.000Z | stellar_sdk/call_builder/trades_aggregation_call_builder.py | bantalon/py-stellar-base | b452f0f92be0387c3e78c8149103978788d7ec0f | [
"Apache-2.0"
] | 1 | 2020-04-26T12:08:54.000Z | 2020-04-26T12:08:54.000Z | stellar_sdk/call_builder/trades_aggregation_call_builder.py | bantalon/py-stellar-base | b452f0f92be0387c3e78c8149103978788d7ec0f | [
"Apache-2.0"
] | null | null | null | from typing import Union
from ..asset import Asset
from ..call_builder.base_call_builder import BaseCallBuilder
from ..client.base_async_client import BaseAsyncClient
from ..client.base_sync_client import BaseSyncClient
from ..exceptions import ValueError
class TradeAggregationsCallBuilder(BaseCallBuilder):
""" ... | 41.117647 | 118 | 0.671817 | from typing import Union
from ..asset import Asset
from ..call_builder.base_call_builder import BaseCallBuilder
from ..client.base_async_client import BaseAsyncClient
from ..client.base_sync_client import BaseSyncClient
from ..exceptions import ValueError
class TradeAggregationsCallBuilder(BaseCallBuilder):
def... | true | true |
1c01cbb134a94e50eb71ca4075882e80f516aabf | 6,119 | py | Python | wifipumpkin3/core/servers/rest/blueprints/restapi/logger.py | Commaders/wifipumpkin3-1 | 47d79c3c21cd63eb2deedaf7a25e8e219abec48b | [
"Apache-2.0"
] | 911 | 2020-04-18T21:02:10.000Z | 2022-03-31T16:11:31.000Z | wifipumpkin3/core/servers/rest/blueprints/restapi/logger.py | Commaders/wifipumpkin3-1 | 47d79c3c21cd63eb2deedaf7a25e8e219abec48b | [
"Apache-2.0"
] | 161 | 2020-04-18T20:42:03.000Z | 2022-03-27T08:14:33.000Z | wifipumpkin3/core/servers/rest/blueprints/restapi/logger.py | Commaders/wifipumpkin3-1 | 47d79c3c21cd63eb2deedaf7a25e8e219abec48b | [
"Apache-2.0"
] | 174 | 2020-04-20T04:01:15.000Z | 2022-03-28T05:08:07.000Z | from wifipumpkin3.core.utility.collection import SettingsINI
import wifipumpkin3.core.utility.constants as C
from flask_restful import Resource
from flask import jsonify, request
import os, json
from itertools import islice
from wifipumpkin3.core.servers.rest.ext.auth import token_required
from wifipumpkin3.core.server... | 35.369942 | 88 | 0.528191 | from wifipumpkin3.core.utility.collection import SettingsINI
import wifipumpkin3.core.utility.constants as C
from flask_restful import Resource
from flask import jsonify, request
import os, json
from itertools import islice
from wifipumpkin3.core.servers.rest.ext.auth import token_required
from wifipumpkin3.core.server... | true | true |
1c01cd5736a4683cd78c88bb6b662deb4b239350 | 1,025 | py | Python | st2common/st2common/exceptions/actionalias.py | kkkanil/st2 | 07cd195d7a6e177a37dd019e5c9ab8329259d0fa | [
"Apache-2.0"
] | null | null | null | st2common/st2common/exceptions/actionalias.py | kkkanil/st2 | 07cd195d7a6e177a37dd019e5c9ab8329259d0fa | [
"Apache-2.0"
] | 15 | 2021-02-11T22:58:54.000Z | 2021-08-06T18:03:47.000Z | st2common/st2common/exceptions/actionalias.py | kkkanil/st2 | 07cd195d7a6e177a37dd019e5c9ab8329259d0fa | [
"Apache-2.0"
] | 1 | 2021-07-10T15:02:29.000Z | 2021-07-10T15:02:29.000Z | # Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | 35.344828 | 74 | 0.767805 |
from __future__ import absolute_import
from st2common.exceptions import StackStormBaseException
__all__ = [
'ActionAliasAmbiguityException'
]
class ActionAliasAmbiguityException(ValueError, StackStormBaseException):
def __init__(self, msg, command, matches):
self.matches = matches
self.comma... | true | true |
1c01cddf7d5da5af44fe4da65cb20bd7768c42cb | 1,880 | py | Python | scrapymu/middlewares.py | sbrisard/scrapymu | ba5a68da17614278e39b1a807d650cd6037d2f64 | [
"BSD-3-Clause"
] | 1 | 2021-07-26T15:47:32.000Z | 2021-07-26T15:47:32.000Z | scrapymu/middlewares.py | sbrisard/scrapymu | ba5a68da17614278e39b1a807d650cd6037d2f64 | [
"BSD-3-Clause"
] | null | null | null | scrapymu/middlewares.py | sbrisard/scrapymu | ba5a68da17614278e39b1a807d650cd6037d2f64 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
# Define here the models for your spider middleware
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/spider-middleware.html
from scrapy import signals
class ScrapymuSpiderMiddleware(object):
# Not all methods need to be defined. If a method is not defined,
# scrapy ... | 32.982456 | 78 | 0.673404 |
from scrapy import signals
class ScrapymuSpiderMiddleware(object):
@classmethod
def from_crawler(cls, crawler):
s = cls()
crawler.signals.connect(s.spider_opened, signal=signals.spider_opened)
return s
def process_spider_input(response, spider):
... | true | true |
1c01ce8f1d8b1c63ac0e9f1c7fc94761f0b2f455 | 3,339 | py | Python | slotting/plots.py | pipete40/warehousing-tools | 58cd057af8d0ccd3af32001b8b0dfdb0ab6b9620 | [
"MIT"
] | null | null | null | slotting/plots.py | pipete40/warehousing-tools | 58cd057af8d0ccd3af32001b8b0dfdb0ab6b9620 | [
"MIT"
] | 3 | 2020-02-11T23:17:07.000Z | 2021-06-10T20:53:04.000Z | slotting/plots.py | pipete40/warehousing-tools | 58cd057af8d0ccd3af32001b8b0dfdb0ab6b9620 | [
"MIT"
] | null | null | null |
import numpy as np
from . import aux_funcs as af
from bokeh.resources import CDN
from bokeh.embed import components
from bokeh.palettes import Spectral11
from bokeh.plotting import figure
from bokeh.models import Label
from bokeh.models.tickers import FixedTicker
def graph_groups_inventory(x, N, hs, invs):
invs_... | 37.943182 | 118 | 0.67086 |
import numpy as np
from . import aux_funcs as af
from bokeh.resources import CDN
from bokeh.embed import components
from bokeh.palettes import Spectral11
from bokeh.plotting import figure
from bokeh.models import Label
from bokeh.models.tickers import FixedTicker
def graph_groups_inventory(x, N, hs, invs):
invs_... | true | true |
1c01cfcc07b3b4b53eb122ac6c1a5c0e68099ed1 | 7,169 | py | Python | scalarFlow_camera_calibration.py | tum-pbs/Global-Flow-Transport | bae04d4deb8636417f1d1ed6caa41d27be7060cb | [
"MIT"
] | 12 | 2021-04-14T06:40:36.000Z | 2022-03-30T03:38:13.000Z | scalarFlow_camera_calibration.py | tum-pbs/Global-Flow-Transport | bae04d4deb8636417f1d1ed6caa41d27be7060cb | [
"MIT"
] | null | null | null | scalarFlow_camera_calibration.py | tum-pbs/Global-Flow-Transport | bae04d4deb8636417f1d1ed6caa41d27be7060cb | [
"MIT"
] | 1 | 2021-04-15T17:49:31.000Z | 2021-04-15T17:49:31.000Z | import numpy as np
from scipy.optimize import least_squares
import pandas as pd
from lib.logger import Logger
import json, math
logger = Logger('./calibration', clear_log=True)
# y,x,z
#pixel ray directions [center-center][left-center][right-center][center-bottom][center-top]
# width, height
# 539 959, 0 959... | 39.607735 | 179 | 0.623099 | import numpy as np
from scipy.optimize import least_squares
import pandas as pd
from lib.logger import Logger
import json, math
logger = Logger('./calibration', clear_log=True)
indices = {
'center': [(539, 959), (539, 960), (540, 959), (540, 960)],
'left': [(0, 959), (0, 960)],
'left_half': [(269, 959), (... | true | true |
1c01d0773e48845cbe9a73c8e7dc2e373ab2ec5b | 23,283 | py | Python | layer_models/deployment/model_deploy.py | iitmcvg/detection-pipeline | 1c99d829603c82f31924605f5435d6de7043927f | [
"Apache-2.0"
] | 2 | 2019-06-20T14:57:05.000Z | 2021-02-27T10:07:00.000Z | layer_models/deployment/model_deploy.py | iitmcvg/detection-pipeline | 1c99d829603c82f31924605f5435d6de7043927f | [
"Apache-2.0"
] | null | null | null | layer_models/deployment/model_deploy.py | iitmcvg/detection-pipeline | 1c99d829603c82f31924605f5435d6de7043927f | [
"Apache-2.0"
] | 1 | 2018-09-20T00:42:58.000Z | 2018-09-20T00:42:58.000Z | """Deploy Layers models across multiple clones and replicas.
# TODO(sguada) docstring paragraph by (a) motivating the need for the file and
# (b) defining clones.
# TODO(sguada) describe the high-level components of model deployment.
# E.g. "each model deployment is composed of several parts: a DeploymentConfig,
# wh... | 34.750746 | 83 | 0.675171 | """Deploy Layers models across multiple clones and replicas.
# TODO(sguada) docstring paragraph by (a) motivating the need for the file and
# (b) defining clones.
# TODO(sguada) describe the high-level components of model deployment.
# E.g. "each model deployment is composed of several parts: a DeploymentConfig,
# wh... | false | true |
1c01d1b537f2fb8c8f98e2f9bd30e93b12c0ade5 | 15,307 | py | Python | python-threatexchange/threatexchange/api.py | eriksendc/ThreatExchange | 9273da087af2efe89091be0582f285bafb95da79 | [
"BSD-3-Clause"
] | null | null | null | python-threatexchange/threatexchange/api.py | eriksendc/ThreatExchange | 9273da087af2efe89091be0582f285bafb95da79 | [
"BSD-3-Clause"
] | null | null | null | python-threatexchange/threatexchange/api.py | eriksendc/ThreatExchange | 9273da087af2efe89091be0582f285bafb95da79 | [
"BSD-3-Clause"
] | null | null | null | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
This is an entire copy of a file from ThreatExchange/hashing
TODO: Slim down to only what we need
"""
import copy
import datetime
import json
import os
import re
import typing as t
import urllib.parse
import requests
from requests.adapters i... | 34.631222 | 176 | 0.580976 |
import copy
import datetime
import json
import os
import re
import typing as t
import urllib.parse
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
class TimeoutHTTPAdapter(HTTPAdapter):
def __init__(self, *args, timeout=5, **kwargs):
sel... | true | true |
1c01d2af747ed0bd3d8a0cb97760c3d8c9dfef88 | 1,530 | py | Python | netforce/netforce/model/fields/__init__.py | nfco/netforce | 35252eecd0a6633ab9d82162e9e3ff57d4da029a | [
"MIT"
] | 27 | 2015-09-30T23:53:30.000Z | 2021-06-07T04:56:25.000Z | netforce/netforce/model/fields/__init__.py | nfco/netforce | 35252eecd0a6633ab9d82162e9e3ff57d4da029a | [
"MIT"
] | 191 | 2015-10-08T11:46:30.000Z | 2019-11-14T02:24:36.000Z | netforce/netforce/model/fields/__init__.py | nfco/netforce | 35252eecd0a6633ab9d82162e9e3ff57d4da029a | [
"MIT"
] | 32 | 2015-10-01T03:59:43.000Z | 2022-01-13T07:31:05.000Z | # Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# 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, publ... | 38.25 | 80 | 0.763399 |
from .field import *
from .char import *
from .float import *
from .integer import *
from .boolean import *
from .text import *
from .selection import *
from .date import *
from .datetime import *
from .time import *
from .binary import *
from .many2one import *
from .one2many import *
from .many2many import *
from .r... | true | true |
1c01d2ea71039b8a3339431f7c58939870329af5 | 53,319 | py | Python | clients/python-experimental/generated/openapi_client/api_client.py | cliffano/jenkins-api-clients-generator | 522d02b3a130a29471df5ec1d3d22c822b3d0813 | [
"MIT"
] | null | null | null | clients/python-experimental/generated/openapi_client/api_client.py | cliffano/jenkins-api-clients-generator | 522d02b3a130a29471df5ec1d3d22c822b3d0813 | [
"MIT"
] | null | null | null | clients/python-experimental/generated/openapi_client/api_client.py | cliffano/jenkins-api-clients-generator | 522d02b3a130a29471df5ec1d3d22c822b3d0813 | [
"MIT"
] | null | null | null | # coding: utf-8
"""
Swaggy Jenkins
Jenkins API clients generated from Swagger / Open API specification # noqa: E501
The version of the OpenAPI document: 1.1.2-pre.0
Contact: blah@cliffano.com
Generated by: https://openapi-generator.tech
"""
from dataclasses import dataclass
from decimal import D... | 38.862245 | 120 | 0.591403 |
from dataclasses import dataclass
from decimal import Decimal
import enum
import json
import os
import io
import atexit
from multiprocessing.pool import ThreadPool
import re
import tempfile
import typing
import urllib3
from urllib3._collections import HTTPHeaderDict
from urllib.parse import quote
from urllib3.fields i... | true | true |
1c01d32dd957f260106e7ebcf3a2cda2dee3e8a1 | 908 | py | Python | tests/unit/test_sailfish.py | arvados/bcbio-nextgen | 2a5cfa8c3a1d540bb2f2e66f51835042195cbc87 | [
"MIT"
] | 3 | 2015-11-18T07:17:54.000Z | 2021-04-28T13:58:37.000Z | tests/unit/test_sailfish.py | yong27/bcbio-nextgen | 9320479d8f21677b61ed1274b4da23d569c686ae | [
"MIT"
] | null | null | null | tests/unit/test_sailfish.py | yong27/bcbio-nextgen | 9320479d8f21677b61ed1274b4da23d569c686ae | [
"MIT"
] | null | null | null | from bcbio.rnaseq import sailfish
from bcbio.utils import file_exists
import os
TEST_RESOURCES = {"fq1": "../data/110907_ERP000591/1_110907_ERP000591_1_fastq.txt",
"fq2": "../data/110907_ERP000591/1_110907_ERP000591_2_fastq.txt",
"gtf": "../data/genomes/mm9/rnaseq/ref-transcripts.gt... | 37.833333 | 85 | 0.650881 | from bcbio.rnaseq import sailfish
from bcbio.utils import file_exists
import os
TEST_RESOURCES = {"fq1": "../data/110907_ERP000591/1_110907_ERP000591_1_fastq.txt",
"fq2": "../data/110907_ERP000591/1_110907_ERP000591_2_fastq.txt",
"gtf": "../data/genomes/mm9/rnaseq/ref-transcripts.gt... | true | true |
1c01d3df3d9169fee87ffeaa4e0fb60ac3f07b66 | 366 | py | Python | projects/configs/_base_/schedules/schedule_1x.py | jshilong/Group-R-CNN | 31ec3eb32c0c1004138a4457b52a4ce822d99248 | [
"Apache-2.0"
] | 106 | 2022-02-14T13:04:46.000Z | 2022-03-30T03:19:45.000Z | projects/configs/_base_/schedules/schedule_1x.py | jshilong/Group-R-CNN | 31ec3eb32c0c1004138a4457b52a4ce822d99248 | [
"Apache-2.0"
] | 2 | 2022-03-08T07:19:18.000Z | 2022-03-29T15:45:09.000Z | projects/configs/_base_/schedules/schedule_1x.py | jshilong/Group-R-CNN | 31ec3eb32c0c1004138a4457b52a4ce822d99248 | [
"Apache-2.0"
] | 2 | 2022-03-15T05:40:29.000Z | 2022-03-17T11:50:35.000Z | # optimizer
optimizer = dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(policy='step',
warmup='linear',
warmup_iters=500,
warmup_ratio=0.001,
step=[8, 11])
runner =... | 33.272727 | 72 | 0.60929 | optimizer = dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001)
optimizer_config = dict(grad_clip=None)
lr_config = dict(policy='step',
warmup='linear',
warmup_iters=500,
warmup_ratio=0.001,
step=[8, 11])
runner = dict(type='EpochBasedRunner',... | true | true |
1c01d3fb49b01fe819ea72cce1afaacfca1efb33 | 1,340 | py | Python | tests/issue_000004/httpbin_utils.py | Xowap/typefit | a1beedcc4b05be6d22063719e7e2aa8c3f2c35b3 | [
"WTFPL"
] | 5 | 2019-10-28T15:40:03.000Z | 2021-03-16T21:07:25.000Z | tests/issue_000004/httpbin_utils.py | Xowap/typefit | a1beedcc4b05be6d22063719e7e2aa8c3f2c35b3 | [
"WTFPL"
] | 32 | 2019-10-19T08:40:12.000Z | 2022-01-21T19:07:09.000Z | tests/issue_000004/httpbin_utils.py | Xowap/typefit | a1beedcc4b05be6d22063719e7e2aa8c3f2c35b3 | [
"WTFPL"
] | 3 | 2019-10-28T15:42:49.000Z | 2022-01-18T19:18:06.000Z | import socket
import time
from multiprocessing import Process
from typing import Text
from httpbin.core import app as httpbin
def wait_for_port(port: int, host: Text = "127.0.0.1", timeout: float = 5.0):
"""
Wait until a port starts accepting TCP connections.
"""
start_time = time.perf_counter()
... | 24.363636 | 84 | 0.584328 | import socket
import time
from multiprocessing import Process
from typing import Text
from httpbin.core import app as httpbin
def wait_for_port(port: int, host: Text = "127.0.0.1", timeout: float = 5.0):
start_time = time.perf_counter()
while True:
try:
with socket.create_connection((ho... | true | true |
1c01d64c61073c4ef42b1d968c5dd114edeb029d | 167 | py | Python | Python/Basic Data Types/Tuples.py | ArchieR7/HackerRank | 53fa5f7006fb368ba6e948866d018fff11c13b90 | [
"MIT"
] | 2 | 2017-03-11T03:32:07.000Z | 2019-05-18T09:40:45.000Z | Python/Basic Data Types/Tuples.py | ArchieR7/HackerRank | 53fa5f7006fb368ba6e948866d018fff11c13b90 | [
"MIT"
] | null | null | null | Python/Basic Data Types/Tuples.py | ArchieR7/HackerRank | 53fa5f7006fb368ba6e948866d018fff11c13b90 | [
"MIT"
] | null | null | null | if __name__ == '__main__':
n = int(input())
t = ()
integer_list = map(int, input().split())
for i in integer_list:
t += (i,)
print(hash(t)) | 23.857143 | 44 | 0.51497 | if __name__ == '__main__':
n = int(input())
t = ()
integer_list = map(int, input().split())
for i in integer_list:
t += (i,)
print(hash(t)) | true | true |
1c01d665fa3c3154ddc80fc43e2169448cadd98a | 591 | py | Python | __main__.py | pythonistabr/hycomDownloader1.1 | 88a739266f542403832980a4b76929246106da71 | [
"MIT"
] | null | null | null | __main__.py | pythonistabr/hycomDownloader1.1 | 88a739266f542403832980a4b76929246106da71 | [
"MIT"
] | null | null | null | __main__.py | pythonistabr/hycomDownloader1.1 | 88a739266f542403832980a4b76929246106da71 | [
"MIT"
] | null | null | null |
"""
Author: @pythonistabr
contact: gustavo.oceanografia@gmail.com
"""
#import urllib3
import wget
from links_generator import Hycom_Link_Creator
with open('hycom-url.txt','r') as file:
file = file.readlines()
url = ''.join(file)
mylist = Hycom_Link_Creator(url, '2016-12-01', '2017-01-31', 7)
mylist.creat... | 14.071429 | 67 | 0.651438 |
import wget
from links_generator import Hycom_Link_Creator
with open('hycom-url.txt','r') as file:
file = file.readlines()
url = ''.join(file)
mylist = Hycom_Link_Creator(url, '2016-12-01', '2017-01-31', 7)
mylist.create_dates()
mylist.generate_urls()
counter = 1
for ii in mylist:
print()
print... | true | true |
1c01d720ca47d79f8a769f49fe93bcea6648a38f | 3,490 | py | Python | venv/lib/python3.8/site-packages/vsts/service_hooks/v4_1/models/consumer.py | amcclead7336/Enterprise_Data_Science_Final | ccdc0aa08d4726bf82d71c11a1cc0c63eb301a28 | [
"Unlicense",
"MIT"
] | null | null | null | venv/lib/python3.8/site-packages/vsts/service_hooks/v4_1/models/consumer.py | amcclead7336/Enterprise_Data_Science_Final | ccdc0aa08d4726bf82d71c11a1cc0c63eb301a28 | [
"Unlicense",
"MIT"
] | null | null | null | venv/lib/python3.8/site-packages/vsts/service_hooks/v4_1/models/consumer.py | amcclead7336/Enterprise_Data_Science_Final | ccdc0aa08d4726bf82d71c11a1cc0c63eb301a28 | [
"Unlicense",
"MIT"
] | 2 | 2021-05-23T16:46:31.000Z | 2021-05-26T23:51:09.000Z | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------------------... | 52.878788 | 216 | 0.622636 |
from msrest.serialization import Model
class Consumer(Model):
_attribute_map = {
'_links': {'key': '_links', 'type': 'ReferenceLinks'},
'actions': {'key': 'actions', 'type': '[ConsumerAction]'},
'authentication_type': {'key': 'authenticationType', 'type': 'object'},
'de... | true | true |
1c01d7b01c3414dd1e8082af7310a0d4ed47a0f5 | 1,653 | py | Python | environment.py | AntoniosHadji/pylox | 906338bf44de92e66c4e7805059ad060dfd52ff3 | [
"MIT"
] | null | null | null | environment.py | AntoniosHadji/pylox | 906338bf44de92e66c4e7805059ad060dfd52ff3 | [
"MIT"
] | null | null | null | environment.py | AntoniosHadji/pylox | 906338bf44de92e66c4e7805059ad060dfd52ff3 | [
"MIT"
] | null | null | null | # http://craftinginterpreters.com/statements-and-state.html#environments
from __future__ import annotations
from typing import Any, Dict, Optional
from errors import LoxRuntimeError
from token_class import Token
class Environment:
def __init__(self, enclosing=None):
self.enclosing = enclosing
se... | 33.06 | 84 | 0.650938 | from __future__ import annotations
from typing import Any, Dict, Optional
from errors import LoxRuntimeError
from token_class import Token
class Environment:
def __init__(self, enclosing=None):
self.enclosing = enclosing
self.values: Dict[str, object] = dict()
def get(self, name: Token) -> ... | true | true |
1c01d8ae7b4eefa92dfb996ab6e596d9f5c4fce7 | 6,168 | py | Python | tests/config/config_utils_test.py | Yelp/Tron | d60b015163418bf66f638e4c12337289ad8c040a | [
"Apache-2.0"
] | 190 | 2015-01-01T17:40:46.000Z | 2022-02-02T09:32:03.000Z | tests/config/config_utils_test.py | Yelp/Tron | d60b015163418bf66f638e4c12337289ad8c040a | [
"Apache-2.0"
] | 237 | 2015-01-14T19:25:01.000Z | 2022-03-15T18:33:29.000Z | tests/config/config_utils_test.py | Yelp/Tron | d60b015163418bf66f638e4c12337289ad8c040a | [
"Apache-2.0"
] | 40 | 2015-01-22T07:54:15.000Z | 2022-03-03T08:01:29.000Z | import datetime
from unittest import mock
from testifycompat import assert_equal
from testifycompat import assert_in
from testifycompat import run
from testifycompat import setup
from testifycompat import TestCase
from tests.assertions import assert_raises
from tron.config import config_utils
from tron.config import C... | 35.245714 | 110 | 0.692931 | import datetime
from unittest import mock
from testifycompat import assert_equal
from testifycompat import assert_in
from testifycompat import run
from testifycompat import setup
from testifycompat import TestCase
from tests.assertions import assert_raises
from tron.config import config_utils
from tron.config import C... | true | true |
1c01d9d7853de1b10636bf0fb7868a96191fd4c3 | 1,687 | py | Python | d22/recursive.py | RuedigerLudwig/advent2020 | 0817484fb99daf9548352ee02012c739bfafc1e6 | [
"Unlicense"
] | 2 | 2020-12-25T09:26:46.000Z | 2021-04-01T12:34:21.000Z | d22/recursive.py | RuedigerLudwig/advent2020 | 0817484fb99daf9548352ee02012c739bfafc1e6 | [
"Unlicense"
] | null | null | null | d22/recursive.py | RuedigerLudwig/advent2020 | 0817484fb99daf9548352ee02012c739bfafc1e6 | [
"Unlicense"
] | null | null | null | from collections import deque
from typing import Sequence
CardHand = tuple[int, ...]
HandTuple = tuple[CardHand, CardHand]
class AdvancedGame:
def __init__(self, p1: Sequence[int], p2: Sequence[int]):
self._p1 = tuple(p1)
self._p2 = tuple(p2)
def single_game(
self, known_games: d... | 31.240741 | 73 | 0.516301 | from collections import deque
from typing import Sequence
CardHand = tuple[int, ...]
HandTuple = tuple[CardHand, CardHand]
class AdvancedGame:
def __init__(self, p1: Sequence[int], p2: Sequence[int]):
self._p1 = tuple(p1)
self._p2 = tuple(p2)
def single_game(
self, known_games: d... | true | true |
1c01da62454f938c35b724389a7e2307f3ea68a4 | 504 | py | Python | dump-sprites.py | S-len/PokewalkerScripts | 4649f0a534ed008289706ba0b557f96e103a43a6 | [
"MIT"
] | null | null | null | dump-sprites.py | S-len/PokewalkerScripts | 4649f0a534ed008289706ba0b557f96e103a43a6 | [
"MIT"
] | null | null | null | dump-sprites.py | S-len/PokewalkerScripts | 4649f0a534ed008289706ba0b557f96e103a43a6 | [
"MIT"
] | null | null | null | import ndspy.narc
import ndspy.lz10
from bin_to_img import *
def dump(path):
narc = ndspy.narc.NARC.fromFile(path)
data = ndspy.lz10.decompress(narc.files[0])
for id in range(0, len(narc.files)):
unslice_image(bin_to_img(ndspy.lz10.decompress(narc.files[id]))).save("./out/"+str(id)+".png", "PNG")
... | 29.647059 | 109 | 0.634921 | import ndspy.narc
import ndspy.lz10
from bin_to_img import *
def dump(path):
narc = ndspy.narc.NARC.fromFile(path)
data = ndspy.lz10.decompress(narc.files[0])
for id in range(0, len(narc.files)):
unslice_image(bin_to_img(ndspy.lz10.decompress(narc.files[id]))).save("./out/"+str(id)+".png", "PNG")
... | true | true |
1c01da9505f29194a949dd68ff40024203ab1abe | 5,071 | py | Python | src/robot/variables/tablesetter.py | userzimmermann/robotframework | 7aa16338ce2120cb082605cf548c0794956ec901 | [
"Apache-2.0"
] | 7 | 2015-02-25T10:55:02.000Z | 2015-11-04T03:20:05.000Z | src/robot/variables/tablesetter.py | userzimmermann/robotframework | 7aa16338ce2120cb082605cf548c0794956ec901 | [
"Apache-2.0"
] | 12 | 2015-02-24T17:00:06.000Z | 2015-07-31T08:32:07.000Z | src/robot/variables/tablesetter.py | userzimmermann/robotframework | 7aa16338ce2120cb082605cf548c0794956ec901 | [
"Apache-2.0"
] | 2 | 2015-12-15T11:00:35.000Z | 2018-02-24T18:11:24.000Z | # Copyright 2008-2015 Nokia Solutions and Networks
#
# 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 l... | 33.361842 | 76 | 0.64228 |
from six import text_type as unicode
from contextlib import contextmanager
from robot.errors import DataError
from robot.utils import split_from_equals, unic, is_string, DotDict
from .isvar import validate_var
from .splitter import VariableSplitter
class VariableTableSetter(object):
def __init__(self, store)... | true | true |
1c01db2f600e6884e1e08df8b7f3eadcdfe7dcfb | 3,536 | py | Python | scripts/external_libs/scapy-2.3.1/python3/scapy/contrib/ubberlogger.py | klement/trex-core | b98e2e6d2b8c6caeb233ce36fcbc131ffc45e35e | [
"Apache-2.0"
] | 995 | 2016-01-13T21:54:46.000Z | 2022-03-31T09:29:17.000Z | scripts/external_libs/scapy-2.3.1/python3/scapy/contrib/ubberlogger.py | klement/trex-core | b98e2e6d2b8c6caeb233ce36fcbc131ffc45e35e | [
"Apache-2.0"
] | 29 | 2016-01-18T16:55:06.000Z | 2022-01-07T14:27:58.000Z | scripts/external_libs/scapy-2.3.1/python3/scapy/contrib/ubberlogger.py | klement/trex-core | b98e2e6d2b8c6caeb233ce36fcbc131ffc45e35e | [
"Apache-2.0"
] | 308 | 2016-01-13T16:52:05.000Z | 2022-03-29T08:27:44.000Z | # Author: Sylvain SARMEJEANNE
# http://trac.secdev.org/scapy/ticket/1
# scapy.contrib.description = Ubberlogger dissectors
# scapy.contrib.status = untested
from scapy.packet import *
from scapy.fields import *
# Syscalls known by Uberlogger
uberlogger_sys_calls = {0:"READ_ID",
1:"OPEN_ID",
... | 34.666667 | 74 | 0.640554 |
from scapy.packet import *
from scapy.fields import *
uberlogger_sys_calls = {0:"READ_ID",
1:"OPEN_ID",
2:"WRITE_ID",
3:"CHMOD_ID",
4:"CHOWN_ID",
5:"SETUID_ID",
6:"CHROOT_ID",
7:"CREATE_MODULE_ID",
8:"INIT_MODULE_... | true | true |
1c01dbe35d90be724f5fd6c10a14cb463a71f61b | 1,879 | py | Python | tools/harness-automation/cases_R140/router_5_1_11.py | AdityaHPatwardhan/openthread | a201e9d5d0273bb51fa20efc8758be20a725018e | [
"BSD-3-Clause"
] | 2,962 | 2016-05-11T15:06:06.000Z | 2022-03-27T20:06:16.000Z | tools/harness-automation/cases_R140/router_5_1_11.py | AdityaHPatwardhan/openthread | a201e9d5d0273bb51fa20efc8758be20a725018e | [
"BSD-3-Clause"
] | 5,899 | 2016-05-11T19:21:49.000Z | 2022-03-31T18:17:20.000Z | tools/harness-automation/cases_R140/router_5_1_11.py | AdityaHPatwardhan/openthread | a201e9d5d0273bb51fa20efc8758be20a725018e | [
"BSD-3-Clause"
] | 1,113 | 2016-05-11T15:37:42.000Z | 2022-03-31T09:37:04.000Z | #!/usr/bin/env python
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notic... | 40.847826 | 77 | 0.770623 |
import unittest
from autothreadharness.harness_case import HarnessCase
class Router_5_1_11(HarnessCase):
role = HarnessCase.ROLE_ROUTER
case = '5 1 11'
golden_devices_required = 3
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
| true | true |
1c01ddaa67da82994f10116da4868ad9851fbfa1 | 1,232 | py | Python | Udacity/UD032_Data_Wrangling_with_MongoDB/Lesson_6/03-Iterative_Parsing/mapparser.py | onyb/mooca | ec231e41fd061a96a268052e2362fbec5e2db373 | [
"MIT"
] | null | null | null | Udacity/UD032_Data_Wrangling_with_MongoDB/Lesson_6/03-Iterative_Parsing/mapparser.py | onyb/mooca | ec231e41fd061a96a268052e2362fbec5e2db373 | [
"MIT"
] | null | null | null | Udacity/UD032_Data_Wrangling_with_MongoDB/Lesson_6/03-Iterative_Parsing/mapparser.py | onyb/mooca | ec231e41fd061a96a268052e2362fbec5e2db373 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Your task is to use the iterative parsing to process the map file and
find out not only what tags are there, but also how many, to get the
feeling on how much of which data you can expect to have in the map.
Fill out the count_tags function. It should return a dictionar... | 26.212766 | 84 | 0.579545 | try:
import xml.etree.cElementTree as ET
except ImportError:
import xml.etree.ElementTree as ET
import pprint
def count_tags(filename):
data = {}
for event, elem in ET.iterparse(filename):
if elem.tag not in data.keys():
data[elem.tag] = 1
else:
data[elem.tag] +... | true | true |
1c01ddd6feb82d30ef48976176477114681606ce | 12,678 | py | Python | jira_agile_metrics/calculators/defects_test.py | arulvelkumar/jira-agile-metrics | 55c4a25cbaf487cf0a5faf57879c0a34473b59c9 | [
"MIT"
] | 206 | 2018-05-03T12:10:00.000Z | 2022-03-24T09:59:10.000Z | jira_agile_metrics/calculators/defects_test.py | arulvelkumar/jira-agile-metrics | 55c4a25cbaf487cf0a5faf57879c0a34473b59c9 | [
"MIT"
] | 42 | 2018-05-30T11:17:19.000Z | 2022-03-24T11:37:11.000Z | jira_agile_metrics/calculators/defects_test.py | arulvelkumar/jira-agile-metrics | 55c4a25cbaf487cf0a5faf57879c0a34473b59c9 | [
"MIT"
] | 81 | 2018-05-31T09:02:35.000Z | 2022-03-24T09:58:50.000Z | import pytest
from pandas import Timestamp, NaT
from ..conftest import (
FauxJIRA as JIRA,
FauxIssue as Issue,
FauxFieldValue as Value,
)
from ..utils import extend_dict
from ..querymanager import QueryManager
from .defects import DefectsCalculator
@pytest.fixture
def fields(minimal_fields):
return... | 30.697337 | 75 | 0.471525 | import pytest
from pandas import Timestamp, NaT
from ..conftest import (
FauxJIRA as JIRA,
FauxIssue as Issue,
FauxFieldValue as Value,
)
from ..utils import extend_dict
from ..querymanager import QueryManager
from .defects import DefectsCalculator
@pytest.fixture
def fields(minimal_fields):
return... | true | true |
1c01de2adedb208f12e03e8cb494dcc0f8e2902c | 273 | py | Python | modular/Demo04/Demo1/winday02.py | walkingtyphoon/Python-workspace | e872bce82b2bac3dd5d809f8576345ccc1c6afb7 | [
"Apache-2.0"
] | null | null | null | modular/Demo04/Demo1/winday02.py | walkingtyphoon/Python-workspace | e872bce82b2bac3dd5d809f8576345ccc1c6afb7 | [
"Apache-2.0"
] | null | null | null | modular/Demo04/Demo1/winday02.py | walkingtyphoon/Python-workspace | e872bce82b2bac3dd5d809f8576345ccc1c6afb7 | [
"Apache-2.0"
] | null | null | null | import csv
with open("../out/工作簿1.csv", newline='') as f:
value = csv.reader(f)
for row in value:
print(row)
print("读取完毕")
with open("../out/工作簿1.csv", "a", newline='') as f:
text = csv.writer(f)
text.writerow([6, 'xiao wang', 22])
print("写入完毕") | 19.5 | 51 | 0.575092 | import csv
with open("../out/工作簿1.csv", newline='') as f:
value = csv.reader(f)
for row in value:
print(row)
print("读取完毕")
with open("../out/工作簿1.csv", "a", newline='') as f:
text = csv.writer(f)
text.writerow([6, 'xiao wang', 22])
print("写入完毕") | true | true |
1c01de56ba76731dfe95ebaf35e09cb938c1f909 | 772 | py | Python | Qshop/Buyer/urls.py | bestwishfang/PersonWork | 2fce76763eee9a177ace466c43169e80d5c5b73c | [
"MIT"
] | null | null | null | Qshop/Buyer/urls.py | bestwishfang/PersonWork | 2fce76763eee9a177ace466c43169e80d5c5b73c | [
"MIT"
] | 3 | 2021-05-10T16:41:21.000Z | 2022-02-12T22:13:01.000Z | Qshop/Buyer/urls.py | bestwishfang/PersonWork | 2fce76763eee9a177ace466c43169e80d5c5b73c | [
"MIT"
] | null | null | null | from django.urls import path, re_path
from Buyer import views
urlpatterns = [
path('register/', views.register),
path('login/', views.login),
path('logout/', views.logout),
path('index/', views.index),
path('goodslist/', views.goods_list),
re_path(r'goodsdetail/(?P<idn>\d+)/', views.goods_detai... | 32.166667 | 72 | 0.680052 | from django.urls import path, re_path
from Buyer import views
urlpatterns = [
path('register/', views.register),
path('login/', views.login),
path('logout/', views.logout),
path('index/', views.index),
path('goodslist/', views.goods_list),
re_path(r'goodsdetail/(?P<idn>\d+)/', views.goods_detai... | true | true |
1c01deb6d3810bea1598059e916fa71b77d0b078 | 1,361 | py | Python | daiquiri/meetings/serializers.py | agy-why/daiquiri | 4d3e2ce51e202d5a8f1df404a0094a4e018dcb4d | [
"Apache-2.0"
] | 14 | 2018-12-23T18:35:02.000Z | 2021-12-15T04:55:12.000Z | daiquiri/meetings/serializers.py | agy-why/daiquiri | 4d3e2ce51e202d5a8f1df404a0094a4e018dcb4d | [
"Apache-2.0"
] | 40 | 2018-12-20T12:44:05.000Z | 2022-03-21T11:35:20.000Z | daiquiri/meetings/serializers.py | agy-why/daiquiri | 4d3e2ce51e202d5a8f1df404a0094a4e018dcb4d | [
"Apache-2.0"
] | 5 | 2019-05-16T08:03:35.000Z | 2021-08-23T20:03:11.000Z | from rest_framework import serializers
from daiquiri.core.serializers import JSONDictField
from .models import Meeting, Participant, Contribution
class MeetingSerializer(serializers.ModelSerializer):
class Meta:
model = Meeting
fields = (
'id',
'title',
'regi... | 23.067797 | 69 | 0.549596 | from rest_framework import serializers
from daiquiri.core.serializers import JSONDictField
from .models import Meeting, Participant, Contribution
class MeetingSerializer(serializers.ModelSerializer):
class Meta:
model = Meeting
fields = (
'id',
'title',
'regi... | true | true |
1c01decaaabee07469128b7beaef91227ff0ade3 | 1,684 | py | Python | tests/fly_test.py | ahmedsamir94/Fly365 | 745c96b73022acaf95f419f04e0db87852984f4d | [
"MIT"
] | null | null | null | tests/fly_test.py | ahmedsamir94/Fly365 | 745c96b73022acaf95f419f04e0db87852984f4d | [
"MIT"
] | null | null | null | tests/fly_test.py | ahmedsamir94/Fly365 | 745c96b73022acaf95f419f04e0db87852984f4d | [
"MIT"
] | null | null | null | from selenium import webdriver
import pytest
import time
from pages.Search_Page import SearchPage
from pages.SignUp_Page import SignUpPage
from pages.ContactUs_Page import ContactUsPage
from utils import utils as utils
@pytest.fixture()
def test_setup():
global driver
driver = webdriver.Chrome(executable_path=... | 27.606557 | 109 | 0.754157 | from selenium import webdriver
import pytest
import time
from pages.Search_Page import SearchPage
from pages.SignUp_Page import SignUpPage
from pages.ContactUs_Page import ContactUsPage
from utils import utils as utils
@pytest.fixture()
def test_setup():
global driver
driver = webdriver.Chrome(executable_path=... | true | true |
1c01df045f2ecadab70c162e42dbbc3c19ce92d9 | 4,167 | py | Python | ucsmsdk/mometa/ether/EtherServerIntFIoFsmStage.py | anoop1984/python_sdk | c4a226bad5e10ad233eda62bc8f6d66a5a82b651 | [
"Apache-2.0"
] | null | null | null | ucsmsdk/mometa/ether/EtherServerIntFIoFsmStage.py | anoop1984/python_sdk | c4a226bad5e10ad233eda62bc8f6d66a5a82b651 | [
"Apache-2.0"
] | null | null | null | ucsmsdk/mometa/ether/EtherServerIntFIoFsmStage.py | anoop1984/python_sdk | c4a226bad5e10ad233eda62bc8f6d66a5a82b651 | [
"Apache-2.0"
] | null | null | null | """This module contains the general information for EtherServerIntFIoFsmStage ManagedObject."""
import sys, os
from ...ucsmo import ManagedObject
from ...ucscoremeta import UcsVersion, MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class EtherServerIntFIoFsmStageConsts():
LAST_UPDATE_TIME_ = ""
NA... | 55.56 | 266 | 0.650588 | import sys, os
from ...ucsmo import ManagedObject
from ...ucscoremeta import UcsVersion, MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class EtherServerIntFIoFsmStageConsts():
LAST_UPDATE_TIME_ = ""
NAME_CONFIG_SPEED_BEGIN = "ConfigSpeedBegin"
NAME_CONFIG_SPEED_CONFIGURE = "ConfigSpeedConfigu... | true | true |
1c01df6e0bef83aeebdd2e0384a0e0b56116cdfb | 6,777 | py | Python | cluster/kmeans/k_means_cardio_stats.py | travisMichael/unsupervisedLearning | f01bd4e36833de4917811e51042e3937510e2701 | [
"MIT"
] | null | null | null | cluster/kmeans/k_means_cardio_stats.py | travisMichael/unsupervisedLearning | f01bd4e36833de4917811e51042e3937510e2701 | [
"MIT"
] | null | null | null | cluster/kmeans/k_means_cardio_stats.py | travisMichael/unsupervisedLearning | f01bd4e36833de4917811e51042e3937510e2701 | [
"MIT"
] | null | null | null | from time import time
from sklearn import metrics
from sklearn.cluster import KMeans
from utils import load_data
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics.cluster import homogeneity_score
from sklearn.decomposition import PCA, FastICA
from sklearn.random_projection import GaussianRandomPro... | 41.833333 | 85 | 0.655305 | from time import time
from sklearn import metrics
from sklearn.cluster import KMeans
from utils import load_data
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics.cluster import homogeneity_score
from sklearn.decomposition import PCA, FastICA
from sklearn.random_projection import GaussianRandomPro... | true | true |
1c01e0024b5d0f695b8b89a9432d51d7d4ca4eed | 15,726 | py | Python | services/ops/EmailerAgent/emailer/agent.py | craig8/volttron | 2a954311d323effa3b79c2a53f6e8c3bb9664e1c | [
"Apache-2.0",
"BSD-2-Clause"
] | 1 | 2020-06-08T16:54:28.000Z | 2020-06-08T16:54:28.000Z | services/ops/EmailerAgent/emailer/agent.py | craig8/volttron | 2a954311d323effa3b79c2a53f6e8c3bb9664e1c | [
"Apache-2.0",
"BSD-2-Clause"
] | 8 | 2016-10-07T22:49:28.000Z | 2022-02-23T00:57:58.000Z | services/ops/EmailerAgent/emailer/agent.py | craig8/volttron | 2a954311d323effa3b79c2a53f6e8c3bb9664e1c | [
"Apache-2.0",
"BSD-2-Clause"
] | null | null | null | # -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
#
# Copyright 2020, Battelle Memorial Institute.
#
# 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... | 39.712121 | 136 | 0.631629 |
from collections import defaultdict
from email.mime.text import MIMEText
import logging
import socket
# Import smtplib for the actual sending function
import smtplib
import sys
import gevent
from volttron.platform.agent.utils import get_utc_seconds_from_epoch
from volttron.platform.vip.agent import Agent, Core, P... | true | true |
1c01e150bf915422be88a5c7448aa0c7e471bd93 | 2,194 | py | Python | encode_faces.py | sorayutmild/Face-Recognition-and-Line-Notification-attending-system | 2746455cb619c9c7e0cb96fc3e4ecde3a1cafd0c | [
"MIT"
] | null | null | null | encode_faces.py | sorayutmild/Face-Recognition-and-Line-Notification-attending-system | 2746455cb619c9c7e0cb96fc3e4ecde3a1cafd0c | [
"MIT"
] | 3 | 2021-06-02T02:38:04.000Z | 2022-01-13T03:07:40.000Z | encode_faces.py | sorayutmild/Face-Recognition-and-Line-Notification-attending-system | 2746455cb619c9c7e0cb96fc3e4ecde3a1cafd0c | [
"MIT"
] | null | null | null | # USAGE
# python encode_faces.py --dataset dataset --encodings encodings.pickle
# import the necessary packages
from imutils import paths
import face_recognition
import argparse
import pickle
import cv2
import os
import timeit
# construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
ap.a... | 32.264706 | 71 | 0.743391 |
from imutils import paths
import face_recognition
import argparse
import pickle
import cv2
import os
import timeit
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--dataset", required=True,
help="path to input directory of faces + images")
ap.add_argument("-e", "--encodings", required=True,
help="path to seri... | true | true |
1c01e2b8c41d805c7cb260190923651bce814f7a | 9,978 | py | Python | OpenAttack/text_processors/default.py | zangy17/OpenAttack | 9114a8af12680f14684d2bf1bc6a5c5e34f8932c | [
"MIT"
] | 10 | 2021-12-01T15:35:05.000Z | 2022-03-16T16:10:24.000Z | OpenAttack/text_processors/default.py | zangy17/OpenAttack | 9114a8af12680f14684d2bf1bc6a5c5e34f8932c | [
"MIT"
] | null | null | null | OpenAttack/text_processors/default.py | zangy17/OpenAttack | 9114a8af12680f14684d2bf1bc6a5c5e34f8932c | [
"MIT"
] | null | null | null | from ..text_processor import TextProcessor
from ..data_manager import DataManager
class Tokenizer:
def __init__(self, sent_tokenizer, word_tokenizer):
self.sent_tokenizer = sent_tokenizer
self.word_tokenizer = word_tokenizer
def __call__(self, sent_):
sentences = self.sent_tokeniz... | 36.283636 | 112 | 0.475546 | from ..text_processor import TextProcessor
from ..data_manager import DataManager
class Tokenizer:
def __init__(self, sent_tokenizer, word_tokenizer):
self.sent_tokenizer = sent_tokenizer
self.word_tokenizer = word_tokenizer
def __call__(self, sent_):
sentences = self.sent_tokeniz... | true | true |
1c01e34db5f8aee1213151b0cd8446177168bab5 | 10,894 | py | Python | src/hic.py | haoyang-insitro/ABC-Enhancer-Gene-Prediction | 48038167b1bf746cca0716f6202f6a90e56bb273 | [
"MIT"
] | null | null | null | src/hic.py | haoyang-insitro/ABC-Enhancer-Gene-Prediction | 48038167b1bf746cca0716f6202f6a90e56bb273 | [
"MIT"
] | null | null | null | src/hic.py | haoyang-insitro/ABC-Enhancer-Gene-Prediction | 48038167b1bf746cca0716f6202f6a90e56bb273 | [
"MIT"
] | null | null | null | # from insitro_core.utils.storage import makedirs
import os
import time
from os.path import basename, join
import numpy as np
import pandas as pd
import scipy.sparse as ssp
from insitro_core.utils.cloud.bucket_utils import check_exists, download_file
def get_hic_file(chromosome, hic_dir, allow_vc=True, hic_type="ju... | 35.953795 | 161 | 0.63613 | import os
import time
from os.path import basename, join
import numpy as np
import pandas as pd
import scipy.sparse as ssp
from insitro_core.utils.cloud.bucket_utils import check_exists, download_file
def get_hic_file(chromosome, hic_dir, allow_vc=True, hic_type="juicebox"):
if hic_type == "juicebox":
h... | true | true |
1c01e43b1e5fa6e0ab9c9a41505f6c567cebf401 | 7,486 | py | Python | tests/layer_tests/tensorflow_tests/test_tf_BiasAdd.py | pfinashx/openvino | 1d417e888b508415510fb0a92e4a9264cf8bdef7 | [
"Apache-2.0"
] | 1 | 2022-02-26T17:33:44.000Z | 2022-02-26T17:33:44.000Z | tests/layer_tests/tensorflow_tests/test_tf_BiasAdd.py | pfinashx/openvino | 1d417e888b508415510fb0a92e4a9264cf8bdef7 | [
"Apache-2.0"
] | 18 | 2022-01-21T08:42:58.000Z | 2022-03-28T13:21:31.000Z | tests/layer_tests/tensorflow_tests/test_tf_BiasAdd.py | pfinashx/openvino | 1d417e888b508415510fb0a92e4a9264cf8bdef7 | [
"Apache-2.0"
] | null | null | null | # Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
from common.tf_layer_test_class import CommonTFLayerTest
from common.utils.tf_utils import permute_nchw_to_nhwc
class TestBiasAdd(CommonTFLayerTest):
def create_bias_add_placeholder_const_net(self, shape, ir_version,... | 41.131868 | 131 | 0.649212 |
import pytest
from common.tf_layer_test_class import CommonTFLayerTest
from common.utils.tf_utils import permute_nchw_to_nhwc
class TestBiasAdd(CommonTFLayerTest):
def create_bias_add_placeholder_const_net(self, shape, ir_version, use_new_frontend):
import tensorflow as tf
... | true | true |
1c01e4d966f704e7f5325cc01a5698e9fc801b45 | 1,844 | py | Python | leagues/league_scores.py | gorik333/guess_the_footballer | cf51d75212203efa38cb7fdd30ff3baa847a56ac | [
"MIT"
] | null | null | null | leagues/league_scores.py | gorik333/guess_the_footballer | cf51d75212203efa38cb7fdd30ff3baa847a56ac | [
"MIT"
] | null | null | null | leagues/league_scores.py | gorik333/guess_the_footballer | cf51d75212203efa38cb7fdd30ff3baa847a56ac | [
"MIT"
] | null | null | null | """ This module defines all of work with current scores of commands of specific league """
import requests
from bs4 import BeautifulSoup
from texttable import Texttable
from leagues.utils import shorten_name
class ChampionshipScores:
""" Class representing current scores of commands of specific League... | 40.086957 | 124 | 0.593818 |
import requests
from bs4 import BeautifulSoup
from texttable import Texttable
from leagues.utils import shorten_name
class ChampionshipScores:
def __init__(self, url):
self.url = url
def scrape_score(self):
page = requests.get(self.url)
parsed_markup = BeautifulSoup(... | true | true |
1c01e56d4229af74c830c434a4a0e3327b9dfef6 | 55,053 | py | Python | transitions/core.py | cekarius/transitions-1 | bf4eb11ba7f81e88de4437cfef9c72a4985e524b | [
"MIT"
] | null | null | null | transitions/core.py | cekarius/transitions-1 | bf4eb11ba7f81e88de4437cfef9c72a4985e524b | [
"MIT"
] | null | null | null | transitions/core.py | cekarius/transitions-1 | bf4eb11ba7f81e88de4437cfef9c72a4985e524b | [
"MIT"
] | 2 | 2021-04-06T07:14:00.000Z | 2021-04-19T04:47:11.000Z | """
transitions.core
----------------
This module contains the central parts of transitions which are the state machine logic, state
and transition concepts.
"""
try:
from builtins import object
except ImportError:
# python2
pass
try:
# Enums are supported for Python 3.4+ and Python ... | 46.030936 | 120 | 0.621256 |
try:
from builtins import object
except ImportError:
pass
try:
from enum import Enum, EnumMeta
except ImportError:
class Enum:
pass
class EnumMeta:
pass
import inspect
import itertools
import logging
from collections import OrderedDict, defaultdict, deque
from funct... | true | true |
1c01e5b530ac52e42e58cc10886916c36ec469d8 | 829 | py | Python | new_year_chaos.py | vkoprivica/Hacker_Rank | 0d94ae3f19bb2368371e5844a2fe3be193cf9f4d | [
"MIT"
] | null | null | null | new_year_chaos.py | vkoprivica/Hacker_Rank | 0d94ae3f19bb2368371e5844a2fe3be193cf9f4d | [
"MIT"
] | null | null | null | new_year_chaos.py | vkoprivica/Hacker_Rank | 0d94ae3f19bb2368371e5844a2fe3be193cf9f4d | [
"MIT"
] | null | null | null | import math
import os
import random
import re
import sys
def minimumBribes(q):
new_q = list(range(1, n + 1))
swap_count = 0
for i in range(len(q) - 1):
if q[i] - i > 3:
answer = "Too chaotic"
break
else:
while q[i] > new_q[i]:
if new_q[i... | 21.25641 | 75 | 0.448733 | import math
import os
import random
import re
import sys
def minimumBribes(q):
new_q = list(range(1, n + 1))
swap_count = 0
for i in range(len(q) - 1):
if q[i] - i > 3:
answer = "Too chaotic"
break
else:
while q[i] > new_q[i]:
if new_q[i... | true | true |
1c01e752d94a08cdf1306ce7dcb6b7975e4a2236 | 164 | py | Python | cash_register.py | nyaanity/BubbleTeaTycoon | be5cfbda0e1e5bcd6a210b8c04d7904586976d57 | [
"MIT"
] | null | null | null | cash_register.py | nyaanity/BubbleTeaTycoon | be5cfbda0e1e5bcd6a210b8c04d7904586976d57 | [
"MIT"
] | null | null | null | cash_register.py | nyaanity/BubbleTeaTycoon | be5cfbda0e1e5bcd6a210b8c04d7904586976d57 | [
"MIT"
] | null | null | null | class CashRegister:
"""The class storing all the money."""
def __init__(self):
"""Initialize."""
super().__init__()
self.money = 0
| 20.5 | 42 | 0.554878 | class CashRegister:
def __init__(self):
super().__init__()
self.money = 0
| true | true |
1c01e826d9794bb23f9e6372da18b4649736212d | 2,069 | py | Python | pandas/tests/tslibs/test_parse_iso8601.py | CJL89/pandas | 6210077d32a9e9675526ea896e6d1f9189629d4a | [
"BSD-3-Clause"
] | 28,899 | 2016-10-13T03:32:12.000Z | 2022-03-31T21:39:05.000Z | pandas/tests/tslibs/test_parse_iso8601.py | CJL89/pandas | 6210077d32a9e9675526ea896e6d1f9189629d4a | [
"BSD-3-Clause"
] | 31,004 | 2016-10-12T23:22:27.000Z | 2022-03-31T23:17:38.000Z | pandas/tests/tslibs/test_parse_iso8601.py | CJL89/pandas | 6210077d32a9e9675526ea896e6d1f9189629d4a | [
"BSD-3-Clause"
] | 15,149 | 2016-10-13T03:21:31.000Z | 2022-03-31T18:46:47.000Z | from datetime import datetime
import pytest
from pandas._libs import tslib
@pytest.mark.parametrize(
"date_str, exp",
[
("2011-01-02", datetime(2011, 1, 2)),
("2011-1-2", datetime(2011, 1, 2)),
("2011-01", datetime(2011, 1, 1)),
("2011-1", datetime(2011, 1, 1)),
("201... | 28.342466 | 79 | 0.60319 | from datetime import datetime
import pytest
from pandas._libs import tslib
@pytest.mark.parametrize(
"date_str, exp",
[
("2011-01-02", datetime(2011, 1, 2)),
("2011-1-2", datetime(2011, 1, 2)),
("2011-01", datetime(2011, 1, 1)),
("2011-1", datetime(2011, 1, 1)),
("201... | true | true |
1c01e8290e169a52fb16fd6bc9184d7473b62668 | 976 | py | Python | galleryapp/urls.py | Edwin-Karanu-Muiruri/django-gallery-karanu | 06f456189ce1a3a164df1d6ce0971b684159ccfb | [
"MIT"
] | null | null | null | galleryapp/urls.py | Edwin-Karanu-Muiruri/django-gallery-karanu | 06f456189ce1a3a164df1d6ce0971b684159ccfb | [
"MIT"
] | 8 | 2020-05-26T08:37:17.000Z | 2022-01-13T02:46:44.000Z | galleryapp/urls.py | Edwin-Karanu-Muiruri/django-gallery-karanu | 06f456189ce1a3a164df1d6ce0971b684159ccfb | [
"MIT"
] | null | null | null | """galleryapp URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-ba... | 37.538462 | 82 | 0.72541 | from django.contrib import admin
from django.urls import path,include
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('admin/', admin.site.urls),
path('',include("imageapp.urls")),
]
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root ... | true | true |
1c01e9510dfa2b89abc49ce90b7a3acbcc3ea02b | 755 | py | Python | PBO_19188/Tugas_9.1.py | Fazlur9/PBO | 357b739c0c20ed2aa0c3cc58d48bbae843e9e946 | [
"MIT"
] | null | null | null | PBO_19188/Tugas_9.1.py | Fazlur9/PBO | 357b739c0c20ed2aa0c3cc58d48bbae843e9e946 | [
"MIT"
] | null | null | null | PBO_19188/Tugas_9.1.py | Fazlur9/PBO | 357b739c0c20ed2aa0c3cc58d48bbae843e9e946 | [
"MIT"
] | null | null | null | class Polygon:
def __init__(self, no_of_sides):
self.__n = no_of_sides
self.sides = [0 for i in range(no_of_sides)]
def inputSides(self):
self.sides = [float(input("Enter side "+str(i+1)+" : ")) for i in range(self.__n)]
def dispSides(self):
for i in range(self.__n... | 26.034483 | 91 | 0.544371 | class Polygon:
def __init__(self, no_of_sides):
self.__n = no_of_sides
self.sides = [0 for i in range(no_of_sides)]
def inputSides(self):
self.sides = [float(input("Enter side "+str(i+1)+" : ")) for i in range(self.__n)]
def dispSides(self):
for i in range(self.__n... | true | true |
1c01e988056c547d807fc2c2fc73f41a1c9707fa | 1,293 | py | Python | group/migrations/0001_initial.py | mwibutsa/FundGroup | 7e06afa2f7c45b3910f1e50a7a0c2fe8a93f0eb6 | [
"MIT"
] | null | null | null | group/migrations/0001_initial.py | mwibutsa/FundGroup | 7e06afa2f7c45b3910f1e50a7a0c2fe8a93f0eb6 | [
"MIT"
] | null | null | null | group/migrations/0001_initial.py | mwibutsa/FundGroup | 7e06afa2f7c45b3910f1e50a7a0c2fe8a93f0eb6 | [
"MIT"
] | null | null | null | # Generated by Django 3.2 on 2021-12-29 09:04
import datetime
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Group',
... | 34.945946 | 144 | 0.596288 |
import datetime
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Group',
fields=[
('id', models... | true | true |
1c01ead2b34cefe9989e948e17eee0e5c71ad460 | 652 | py | Python | tools/traces/twitter.py | yelkarama/oltpbench | a4703251ee771efee32326cd4b23342e207273f7 | [
"Apache-2.0"
] | null | null | null | tools/traces/twitter.py | yelkarama/oltpbench | a4703251ee771efee32326cd4b23342e207273f7 | [
"Apache-2.0"
] | null | null | null | tools/traces/twitter.py | yelkarama/oltpbench | a4703251ee771efee32326cd4b23342e207273f7 | [
"Apache-2.0"
] | null | null | null | import bisect
import math
import random
import sys
class ZipfGenerator:
def __init__(self, n, alpha):
# Calculate Zeta values from 1 to n:
tmp = [1. / (math.pow(float(i), alpha)) for i in range(1, n+1)]
zeta = reduce(lambda sums, x: sums + [sums[-1] + x], tmp, [0])
# Store the tra... | 26.08 | 71 | 0.599693 | import bisect
import math
import random
import sys
class ZipfGenerator:
def __init__(self, n, alpha):
tmp = [1. / (math.pow(float(i), alpha)) for i in range(1, n+1)]
zeta = reduce(lambda sums, x: sums + [sums[-1] + x], tmp, [0])
self.distMap = [x / zeta[-1] for x in zeta]
... | false | true |
1c01ead968c85002970d1b5f3d738295be01be5b | 1,898 | py | Python | COMP9318/lab2/test.py | Spacider/UNSW_2021T1 | bc59ca2dc048ee695217e6da09f32e2a82961bb7 | [
"Apache-2.0"
] | null | null | null | COMP9318/lab2/test.py | Spacider/UNSW_2021T1 | bc59ca2dc048ee695217e6da09f32e2a82961bb7 | [
"Apache-2.0"
] | null | null | null | COMP9318/lab2/test.py | Spacider/UNSW_2021T1 | bc59ca2dc048ee695217e6da09f32e2a82961bb7 | [
"Apache-2.0"
] | null | null | null | ## import modules here
import pandas as pd
import numpy as np
import helper
################### Question 1 ###################
def buc_rec_optimized(df): # do not change the heading of the function
res = pd.DataFrame(columns=df.columns.values)
pre = []
my_buc_rec_optimized(df, pre, res)
return res
... | 28.328358 | 71 | 0.541096 | import pandas as pd
import numpy as np
import helper
def buc_rec_optimized(df): res = pd.DataFrame(columns=df.columns.values)
pre = []
my_buc_rec_optimized(df, pre, res)
return res
def my_buc_rec_optimized(df, pre, res): dims = df.shape[1]
if df.shape[0] == 1:
single_tuple(df, pre... | true | true |
1c01eb82d7f3c1b82615cbd78827ec4e9f7002c4 | 19,794 | py | Python | python/paddle/fluid/contrib/slim/graph/graph_wrapper.py | JesseyXujin/Paddle | 843bdbaae1253d6dc964e6beddce239a88add113 | [
"Apache-2.0"
] | 1 | 2018-06-23T10:46:40.000Z | 2018-06-23T10:46:40.000Z | python/paddle/fluid/contrib/slim/graph/graph_wrapper.py | JesseyXujin/Paddle | 843bdbaae1253d6dc964e6beddce239a88add113 | [
"Apache-2.0"
] | null | null | null | python/paddle/fluid/contrib/slim/graph/graph_wrapper.py | JesseyXujin/Paddle | 843bdbaae1253d6dc964e6beddce239a88add113 | [
"Apache-2.0"
] | 2 | 2017-08-10T02:35:12.000Z | 2018-06-23T10:46:01.000Z | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 33.893836 | 123 | 0.566535 |
from collections import OrderedDict
from .... import io
from .... import compiler
from ....framework import Program
from ....framework import program_guard
from ....framework import Parameter
from ....framework import Variable
from ....executor import Executor
import copy
from collections import Iterable
from ....io i... | true | true |
1c01ebfffec765bee999744e9626c210c0c554da | 3,399 | py | Python | src/run.py | davidgraymi/tetris-ai | e406ac13ecf2aae018478acc06e815b77f483d09 | [
"Apache-2.0"
] | null | null | null | src/run.py | davidgraymi/tetris-ai | e406ac13ecf2aae018478acc06e815b77f483d09 | [
"Apache-2.0"
] | null | null | null | src/run.py | davidgraymi/tetris-ai | e406ac13ecf2aae018478acc06e815b77f483d09 | [
"Apache-2.0"
] | null | null | null | from dqn_agent import DQNAgent
from tetris import Tetris
from datetime import datetime
from statistics import mean, median
import random
from tqdm import tqdm
import pandas as pd
# Run dqn with Tetris
def dqn():
env = Tetris()
episodes = 500
max_steps = None
epsilon_stop_episode = int(episodes... | 31.766355 | 164 | 0.555752 | from dqn_agent import DQNAgent
from tetris import Tetris
from datetime import datetime
from statistics import mean, median
import random
from tqdm import tqdm
import pandas as pd
def dqn():
env = Tetris()
episodes = 500
max_steps = None
epsilon_stop_episode = int(episodes*0.75)
mem_size = ... | true | true |
1c01ed6d48f1e72d9f705b47ad4703c6da0cf18d | 1,038 | py | Python | examples/pybullet/examples/deformable_anchor.py | arpit15/bullet3 | 004dcc34041d1e5a5d92f747296b0986922ebb96 | [
"Zlib"
] | null | null | null | examples/pybullet/examples/deformable_anchor.py | arpit15/bullet3 | 004dcc34041d1e5a5d92f747296b0986922ebb96 | [
"Zlib"
] | null | null | null | examples/pybullet/examples/deformable_anchor.py | arpit15/bullet3 | 004dcc34041d1e5a5d92f747296b0986922ebb96 | [
"Zlib"
] | null | null | null | import pybullet as p
from time import sleep
physicsClient = p.connect(p.GUI)
import pybullet_data
p.setAdditionalSearchPath(pybullet_data.getDataPath())
p.resetSimulation(p.RESET_USE_DEFORMABLE_WORLD)
gravZ=-10
p.setGravity(0, 0, gravZ)
planeOrn = [0,0,0,1]#p.getQuaternionFromEuler([0.3,0,0])
planeId = p.loadURDF("... | 31.454545 | 260 | 0.747592 | import pybullet as p
from time import sleep
physicsClient = p.connect(p.GUI)
import pybullet_data
p.setAdditionalSearchPath(pybullet_data.getDataPath())
p.resetSimulation(p.RESET_USE_DEFORMABLE_WORLD)
gravZ=-10
p.setGravity(0, 0, gravZ)
planeOrn = [0,0,0,1]planeId = p.loadURDF("plane.urdf", [0,0,-2],planeOrn)
boxI... | true | true |
1c01eedf12708f53d07312c178deecf53f4094cb | 1,385 | py | Python | main2.py | hdert/python-quiz | 09fc1833fcdebb54be71c8485db32565db4dce4f | [
"BSD-3-Clause"
] | 1 | 2020-08-24T23:58:46.000Z | 2020-08-24T23:58:46.000Z | main2.py | hdert/python-quiz | 09fc1833fcdebb54be71c8485db32565db4dce4f | [
"BSD-3-Clause"
] | 3 | 2020-09-09T22:31:34.000Z | 2020-09-09T22:31:34.000Z | main2.py | hdert/python-quiz | 09fc1833fcdebb54be71c8485db32565db4dce4f | [
"BSD-3-Clause"
] | null | null | null | """See main.__doc__."""
from db_create3 import db_create
from introduction import introduction
from navigate2 import navigate
from quiz_check3 import quiz_check
from quiz4 import quiz
from leaderboard_entry import leaderboard_entry
from show_leaderboard2 import show_leaderboard
from user_binary_choice import user_binar... | 33.780488 | 76 | 0.587726 | from db_create3 import db_create
from introduction import introduction
from navigate2 import navigate
from quiz_check3 import quiz_check
from quiz4 import quiz
from leaderboard_entry import leaderboard_entry
from show_leaderboard2 import show_leaderboard
from user_binary_choice import user_binary_choice
def main():
... | true | true |
1c01efe970e2d2a9dea728b866cf31c3870b0648 | 3,625 | py | Python | plugins/News/test.py | mogad0n/Limnoria | f31e5c4b9a77e30918d6b93f69d69f3b8f910e3c | [
"BSD-3-Clause"
] | 476 | 2015-01-04T17:42:59.000Z | 2021-08-13T07:40:54.000Z | plugins/News/test.py | mogad0n/Limnoria | f31e5c4b9a77e30918d6b93f69d69f3b8f910e3c | [
"BSD-3-Clause"
] | 491 | 2015-01-01T04:12:23.000Z | 2021-08-12T19:24:47.000Z | plugins/News/test.py | mogad0n/Limnoria | f31e5c4b9a77e30918d6b93f69d69f3b8f910e3c | [
"BSD-3-Clause"
] | 203 | 2015-01-02T18:29:43.000Z | 2021-08-15T12:52:22.000Z | ###
# Copyright (c) 2003-2005, Daniel DiPaolo
# Copyright (c) 2010-2021, The Limnoria Contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retai... | 42.647059 | 79 | 0.692414 |
from __future__ import print_function
import time
from supybot.test import *
class NewsTestCase(ChannelPluginTestCase):
plugins = ('News','User')
def setUp(self):
ChannelPluginTestCase.setUp(self)
self.prefix = 'news!bar@baz'
self.irc.feedMsg(ircmsgs.privmsg(self.nick, 'regis... | true | true |
1c01f0717e29b9d4a8f7e4c8e6cf22b8f64e4abe | 7,070 | py | Python | lab4/Bezier.py | wineee/LearnComputerGraphics | 9d959c26d0abc41deddb427e72a2c817e2eec043 | [
"Unlicense"
] | 3 | 2021-09-09T06:02:33.000Z | 2021-11-12T18:07:26.000Z | lab4/Bezier.py | wineee/LearnComputerGraphics | 9d959c26d0abc41deddb427e72a2c817e2eec043 | [
"Unlicense"
] | null | null | null | lab4/Bezier.py | wineee/LearnComputerGraphics | 9d959c26d0abc41deddb427e72a2c817e2eec043 | [
"Unlicense"
] | null | null | null | #!/usr/bin/env python
"""
Bezier 曲线绘制程序
author: rewine
last edited: 2021年10月
"""
import sys,random
from PyQt5.QtWidgets import QWidget, QApplication, QSplitter, QVBoxLayout, QPushButton, QButtonGroup, QSlider, QSizePolicy
from PyQt5.QtGui import QPainter, QPainterPath, QPen, QColor
from PyQt5.QtCore import Qt, QRect... | 30.73913 | 122 | 0.529986 |
import sys,random
from PyQt5.QtWidgets import QWidget, QApplication, QSplitter, QVBoxLayout, QPushButton, QButtonGroup, QSlider, QSizePolicy
from PyQt5.QtGui import QPainter, QPainterPath, QPen, QColor
from PyQt5.QtCore import Qt, QRect, QPointF
from enum import Enum,unique
from math import sqrt
from decimal import D... | true | true |
1c01f15f21d4f6f36c4638d0b8ad916e895aa0b2 | 10,967 | py | Python | research/ptn/nets/perspective_transform.py | 873040/Abhishek | 2ddd716e66bc5cc6e6f0787508dd07da0e02e75a | [
"Apache-2.0"
] | 3,326 | 2018-01-26T22:42:25.000Z | 2022-02-16T13:16:39.000Z | research/ptn/nets/perspective_transform.py | 873040/Abhishek | 2ddd716e66bc5cc6e6f0787508dd07da0e02e75a | [
"Apache-2.0"
] | 150 | 2017-08-28T14:59:36.000Z | 2022-03-11T23:21:35.000Z | research/ptn/nets/perspective_transform.py | 873040/Abhishek | 2ddd716e66bc5cc6e6f0787508dd07da0e02e75a | [
"Apache-2.0"
] | 1,474 | 2018-02-01T04:33:18.000Z | 2022-03-08T07:02:20.000Z | # Copyright 2017 The TensorFlow Authors All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | 39.308244 | 135 | 0.589222 |
import tensorflow as tf
def transformer(voxels,
theta,
out_size,
z_near,
z_far,
name='PerspectiveTransformer'):
def _repeat(x, n_repeats):
with tf.variable_scope('_repeat'):
rep = tf.transpose(
tf.expand_dims(tf.on... | true | true |
1c01f1654ea160663495b8af58660f18c14c0c31 | 479 | py | Python | recursion_dynamic/coin_change/test_coin_change.py | rubenparedes0796/interactive-coding-challenges | 4a942ff7a8b4a78052eae7e2b33d129683796570 | [
"Apache-2.0"
] | 27,173 | 2015-07-06T12:36:05.000Z | 2022-03-31T23:56:41.000Z | recursion_dynamic/coin_change/test_coin_change.py | govind527/interactive-coding-challenges | 358f2cc60426d5c4c3d7d580910eec9a7b393fa9 | [
"Apache-2.0"
] | 143 | 2015-07-07T05:13:11.000Z | 2021-12-07T17:05:54.000Z | recursion_dynamic/coin_change/test_coin_change.py | govind527/interactive-coding-challenges | 358f2cc60426d5c4c3d7d580910eec9a7b393fa9 | [
"Apache-2.0"
] | 4,657 | 2015-07-06T13:28:02.000Z | 2022-03-31T10:11:28.000Z | import unittest
class Challenge(unittest.TestCase):
def test_coin_change(self):
coin_changer = CoinChanger()
self.assertEqual(coin_changer.make_change([1, 2], 0), 0)
self.assertEqual(coin_changer.make_change([1, 2, 3], 5), 5)
self.assertEqual(coin_changer.make_change([1, 5, 25, 50... | 22.809524 | 73 | 0.651357 | import unittest
class Challenge(unittest.TestCase):
def test_coin_change(self):
coin_changer = CoinChanger()
self.assertEqual(coin_changer.make_change([1, 2], 0), 0)
self.assertEqual(coin_changer.make_change([1, 2, 3], 5), 5)
self.assertEqual(coin_changer.make_change([1, 5, 25, 50... | true | true |
1c01f1927697ca669ca3e0c8aa2b125628582075 | 884 | py | Python | app/api/sql/profile_provider.py | LifeLaboratory/asi_hardware | d6c4fa3c871fd5e4c09dcee1587c8f0a53a10c93 | [
"MIT"
] | null | null | null | app/api/sql/profile_provider.py | LifeLaboratory/asi_hardware | d6c4fa3c871fd5e4c09dcee1587c8f0a53a10c93 | [
"MIT"
] | null | null | null | app/api/sql/profile_provider.py | LifeLaboratory/asi_hardware | d6c4fa3c871fd5e4c09dcee1587c8f0a53a10c93 | [
"MIT"
] | null | null | null | # coding=utf-8
from app.api.base.base_sql import Sql
class Provider:
@staticmethod
def get_profile(args):
query = """
select *
from Person
where id = {user_id}
"""
print(query)
return Sql.exec(query=query, args=args)
@staticmethod
def set_profile(args):
... | 19.644444 | 48 | 0.514706 | from app.api.base.base_sql import Sql
class Provider:
@staticmethod
def get_profile(args):
query = """
select *
from Person
where id = {user_id}
"""
print(query)
return Sql.exec(query=query, args=args)
@staticmethod
def set_profile(args):
query = """
... | true | true |
1c01f1e02a462df05afa7d35a163bbf3477f38ce | 393 | py | Python | domain2/player.py | flo150194/info8003_project | b728a8e893f805e1a446cbe34da699d46131557d | [
"Apache-2.0"
] | null | null | null | domain2/player.py | flo150194/info8003_project | b728a8e893f805e1a446cbe34da699d46131557d | [
"Apache-2.0"
] | null | null | null | domain2/player.py | flo150194/info8003_project | b728a8e893f805e1a446cbe34da699d46131557d | [
"Apache-2.0"
] | null | null | null | class Player(object):
def __init__(self, position, resource):
self.position = position
self.resource = resource
def get_position(self):
return self.position
def get_resource(self):
return self.resource
def set_position(self, position):
self.position = position... | 21.833333 | 43 | 0.651399 | class Player(object):
def __init__(self, position, resource):
self.position = position
self.resource = resource
def get_position(self):
return self.position
def get_resource(self):
return self.resource
def set_position(self, position):
self.position = position... | true | true |
1c01f225d27253d8c07306e0e71a2bf482de02c7 | 9,870 | py | Python | src/sage/plot/plot3d/revolution_plot3d.py | saraedum/sage-renamed | d2da67b14da2ad766a5906425d60d43a3b3e1270 | [
"BSL-1.0"
] | null | null | null | src/sage/plot/plot3d/revolution_plot3d.py | saraedum/sage-renamed | d2da67b14da2ad766a5906425d60d43a3b3e1270 | [
"BSL-1.0"
] | null | null | null | src/sage/plot/plot3d/revolution_plot3d.py | saraedum/sage-renamed | d2da67b14da2ad766a5906425d60d43a3b3e1270 | [
"BSL-1.0"
] | null | null | null | """
Surfaces of revolution
AUTHORS:
- Oscar Gerardo Lazo Arjona (2010): initial version.
"""
#*****************************************************************************
# Copyright (C) 2010 Oscar Gerardo Lazo Arjona algebraicamente@gmail.com
#
# Distributed under the terms of the GNU General Public License... | 35.890909 | 154 | 0.582979 |
from __future__ import print_function
from sage.misc.decorators import rename_keyword
from sage.plot.plot3d.parametric_plot3d import parametric_plot3d
@rename_keyword(alpha='opacity')
def revolution_plot3d(curve,trange,phirange=None,parallel_axis='z',axis=(0,0),print_vector=False,show_curve=False,**kwds):
from s... | true | true |
1c01f4506b746ce024d5598829f0953426717e31 | 1,882 | py | Python | towhee/utils/yaml_utils.py | krishnakatyal/towhee | c5e043aa1509cf46644ca6b53f691d6ed2647212 | [
"Apache-2.0"
] | null | null | null | towhee/utils/yaml_utils.py | krishnakatyal/towhee | c5e043aa1509cf46644ca6b53f691d6ed2647212 | [
"Apache-2.0"
] | 1 | 2022-01-19T06:21:07.000Z | 2022-01-19T06:21:07.000Z | towhee/utils/yaml_utils.py | jennyli-z/towhee | 55c55fd961229575b75eae269b55090c839f8dcd | [
"Apache-2.0"
] | null | null | null | # Copyright 2021 Zilliz. 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 agree... | 29.40625 | 101 | 0.65356 | import io
from typing import Union, Dict, List
from ruamel.yaml import YAML
def load_yaml(stream, typ: str = 'safe'):
yaml = YAML(typ=typ)
data = yaml.load(stream=stream)
if not isinstance(data, dict):
raise ValueError(
'The loaded data should be a dict, please check your yaml source.... | true | true |
1c01f47d23fde390a2770331cf8d01d1a0b57cad | 794 | py | Python | python/simple/functionApp/Tests/test_unit.py | Ramananaidu/.net-pipeline | bb8fc1d7a6e8a88ff458e0875910a2bb77ba249f | [
"MIT"
] | 204 | 2019-05-16T11:18:03.000Z | 2022-03-30T03:14:39.000Z | python/simple/functionApp/Tests/test_unit.py | Ramananaidu/.net-pipeline | bb8fc1d7a6e8a88ff458e0875910a2bb77ba249f | [
"MIT"
] | 46 | 2019-05-10T10:42:46.000Z | 2022-03-30T22:32:35.000Z | python/simple/functionApp/Tests/test_unit.py | Ramananaidu/.net-pipeline | bb8fc1d7a6e8a88ff458e0875910a2bb77ba249f | [
"MIT"
] | 1,199 | 2019-05-08T06:34:24.000Z | 2022-03-29T10:19:26.000Z | import pytest
import sys
import os
import unittest
app_dir_path = os.path.join(os.getcwd(), 'Application/Function1')
sys.path.append(app_dir_path)
import __init__
class Request:
def __init__(self):
self.params = {}
def get_json(self):
return self.params... | 26.466667 | 78 | 0.632242 | import pytest
import sys
import os
import unittest
app_dir_path = os.path.join(os.getcwd(), 'Application/Function1')
sys.path.append(app_dir_path)
import __init__
class Request:
def __init__(self):
self.params = {}
def get_json(self):
return self.params... | true | true |
1c01f52a83ca333bd3daeec9a88e85f57e884418 | 2,497 | py | Python | geminidr/gsaoi/recipes/sq/recipes_IMAGE.py | astrochun/DRAGONS | 041cdeeaf3eca9751085f6e01222d48c8e63cd3c | [
"BSD-3-Clause"
] | null | null | null | geminidr/gsaoi/recipes/sq/recipes_IMAGE.py | astrochun/DRAGONS | 041cdeeaf3eca9751085f6e01222d48c8e63cd3c | [
"BSD-3-Clause"
] | null | null | null | geminidr/gsaoi/recipes/sq/recipes_IMAGE.py | astrochun/DRAGONS | 041cdeeaf3eca9751085f6e01222d48c8e63cd3c | [
"BSD-3-Clause"
] | null | null | null | """
Recipes available to data with tags ['GSAOI', 'IMAGE']
Default is "reduce".
"""
recipe_tags = {'GSAOI', 'IMAGE'}
def reduce(p):
"""
This recipe will fully reduce GSAOI data, including alignment and
stacking.
Parameters
----------
p : PrimitivesBASE object
A primitive set matching t... | 27.43956 | 78 | 0.678815 | recipe_tags = {'GSAOI', 'IMAGE'}
def reduce(p):
p.prepare()
p.addDQ()
p.nonlinearityCorrect()
p.ADUToElectrons()
p.addVAR(read_noise=True, poisson_noise=True)
p.flatCorrect()
p.flushPixels()
p.separateSky()
p.associateSky(stream='sky')
p.skyCorrect(instream='sky', mask_objects=F... | true | true |
1c01f547dbf0dd03d41b90296ab5aa739099daff | 2,427 | py | Python | students/k3342/laboratory_works/Salnikova_Nadezhda/laboratory_work_1/flights/views.py | TonikX/ITMO_ICT_-WebProgramming_2020 | ba566c1b3ab04585665c69860b713741906935a0 | [
"MIT"
] | 10 | 2020-03-20T09:06:12.000Z | 2021-07-27T13:06:02.000Z | students/k3342/laboratory_works/Salnikova_Nadezhda/laboratory_work_1/flights/views.py | TonikX/ITMO_ICT_-WebProgramming_2020 | ba566c1b3ab04585665c69860b713741906935a0 | [
"MIT"
] | 134 | 2020-03-23T09:47:48.000Z | 2022-03-12T01:05:19.000Z | students/k3342/laboratory_works/Salnikova_Nadezhda/laboratory_work_1/flights/views.py | TonikX/ITMO_ICT_-WebProgramming_2020 | ba566c1b3ab04585665c69860b713741906935a0 | [
"MIT"
] | 71 | 2020-03-20T12:45:56.000Z | 2021-10-31T19:22:25.000Z | from django.shortcuts import render
from django.http import Http404, HttpResponseRedirect
from django.urls import reverse_lazy
from django.views.generic.edit import CreateView
from flights.models import Client, Flight, Comment
from .forms import RegisterUserForm, ClientRegister, AddComment
from django.contrib.auth.deco... | 32.797297 | 79 | 0.690977 | from django.shortcuts import render
from django.http import Http404, HttpResponseRedirect
from django.urls import reverse_lazy
from django.views.generic.edit import CreateView
from flights.models import Client, Flight, Comment
from .forms import RegisterUserForm, ClientRegister, AddComment
from django.contrib.auth.deco... | true | true |
1c01f5760da1a994f26c8a27a6617302b047a033 | 136 | py | Python | ARC094/ARC094d.py | VolgaKurvar/AtCoder | 21acb489f1594bbb1cdc64fbf8421d876b5b476d | [
"Unlicense"
] | null | null | null | ARC094/ARC094d.py | VolgaKurvar/AtCoder | 21acb489f1594bbb1cdc64fbf8421d876b5b476d | [
"Unlicense"
] | null | null | null | ARC094/ARC094d.py | VolgaKurvar/AtCoder | 21acb489f1594bbb1cdc64fbf8421d876b5b476d | [
"Unlicense"
] | null | null | null | #ARC094d
def main():
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**6)
if __name__ == '__main__':
main() | 17 | 32 | 0.654412 | def main():
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**6)
if __name__ == '__main__':
main() | true | true |
1c01f73f3c39aa094bc5d5d091e5557fb5eb5ac9 | 5,340 | py | Python | test/test_ENV/test_TurbulenceModelling.py | henrystoldt/MAPLEAF | af970d3e8200832f5e70d537b15ad38dd74fa551 | [
"MIT"
] | 15 | 2020-09-11T19:25:07.000Z | 2022-03-12T16:34:53.000Z | test/test_ENV/test_TurbulenceModelling.py | henrystoldt/MAPLEAF | af970d3e8200832f5e70d537b15ad38dd74fa551 | [
"MIT"
] | null | null | null | test/test_ENV/test_TurbulenceModelling.py | henrystoldt/MAPLEAF | af970d3e8200832f5e70d537b15ad38dd74fa551 | [
"MIT"
] | 3 | 2021-12-24T19:39:53.000Z | 2022-03-29T01:06:28.000Z | #Created by: Henry Stoldt
#April 2020
#To run tests:
#In this file: [test_TurbulenceModelling.py]
#In all files in the current directory: [python -m unittest discover]
#Add [-v] for verbose output (displays names of all test functions)
import unittest
from test.testUtilities import assertVectorsAlmostEqual
from MAPL... | 49.906542 | 112 | 0.716667 |
import unittest
from test.testUtilities import assertVectorsAlmostEqual
from MAPLEAF.IO import SimDefinition
from MAPLEAF.IO import SubDictReader
from MAPLEAF.ENV import meanWindModelFactory
from MAPLEAF.Rocket import Rocket
from MAPLEAF.ENV import PinkNoiseGenerator, turbulenceModelFactory
from MAPLEAF.Motion impor... | true | true |
1c01f867d720227ef94b67e2d6f0a068930e51da | 1,734 | py | Python | drnalpha/navigation/templatetags/navigation_tags.py | UKGovernmentBEIS/BRE_DigitalRegulationNavigator_Alpha | bfa6d08212bc18034b20b9c922a554a6e1ddd0f1 | [
"MIT"
] | null | null | null | drnalpha/navigation/templatetags/navigation_tags.py | UKGovernmentBEIS/BRE_DigitalRegulationNavigator_Alpha | bfa6d08212bc18034b20b9c922a554a6e1ddd0f1 | [
"MIT"
] | null | null | null | drnalpha/navigation/templatetags/navigation_tags.py | UKGovernmentBEIS/BRE_DigitalRegulationNavigator_Alpha | bfa6d08212bc18034b20b9c922a554a6e1ddd0f1 | [
"MIT"
] | 1 | 2021-04-21T09:41:43.000Z | 2021-04-21T09:41:43.000Z | from django import template
register = template.Library()
# Primary nav snippets
@register.inclusion_tag(
"patterns/molecules/navigation/primarynav.html", takes_context=True
)
def primarynav(context):
request = context["request"]
return {
"primarynav": context["settings"]["navigation"][
... | 24.422535 | 77 | 0.66263 | from django import template
register = template.Library()
@register.inclusion_tag(
"patterns/molecules/navigation/primarynav.html", takes_context=True
)
def primarynav(context):
request = context["request"]
return {
"primarynav": context["settings"]["navigation"][
"NavigationSettings"... | true | true |
1c01f878fb90f7c8788ddcc97ad3709a1d92475c | 2,037 | py | Python | draft/pendulum/prod_extended/prod_extended.py | krystophny/profit | c6316c9df7cfaa7b30332fdbbf85ad27175eaf92 | [
"MIT"
] | 14 | 2019-12-03T14:11:28.000Z | 2022-03-15T13:44:06.000Z | draft/pendulum/prod_extended/prod_extended.py | krystophny/profit | c6316c9df7cfaa7b30332fdbbf85ad27175eaf92 | [
"MIT"
] | 118 | 2019-11-16T19:51:26.000Z | 2022-03-26T13:52:00.000Z | draft/pendulum/prod_extended/prod_extended.py | krystophny/profit | c6316c9df7cfaa7b30332fdbbf85ad27175eaf92 | [
"MIT"
] | 9 | 2020-06-08T07:22:56.000Z | 2021-03-21T14:12:21.000Z | import numpy as np
import GPy
k0 = GPy.kern.RBF(1, active_dims=0)
k1 = GPy.kern.RBF(1, active_dims=1)
k0_der = GPy.kern.DiffKern(k0, 0)
# Extended class for product kernel,
# can be merged with Prod class when finished
class ProdExtended(GPy.kern.Prod):
def dK_dX(self, X, X2, dimX):
# Product rule t... | 30.863636 | 69 | 0.47619 | import numpy as np
import GPy
k0 = GPy.kern.RBF(1, active_dims=0)
k1 = GPy.kern.RBF(1, active_dims=1)
k0_der = GPy.kern.DiffKern(k0, 0)
class ProdExtended(GPy.kern.Prod):
def dK_dX(self, X, X2, dimX):
other = self.parts[:]
All = other[:]
n = len(All)
... | true | true |
1c01f9fca8c35ba55ab918e64a64f88ae9af5cbe | 970 | py | Python | jrnl/plugins/util.py | TonyRoomZ/jrnl | 75459bb9fcd19107d56b9560094137924e88959f | [
"MIT"
] | null | null | null | jrnl/plugins/util.py | TonyRoomZ/jrnl | 75459bb9fcd19107d56b9560094137924e88959f | [
"MIT"
] | null | null | null | jrnl/plugins/util.py | TonyRoomZ/jrnl | 75459bb9fcd19107d56b9560094137924e88959f | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# encoding: utf-8
from __future__ import absolute_import, unicode_literals
def get_tags_count(journal):
"""Returns a set of tuples (count, tag) for all tags present in the journal."""
# Astute reader: should the following line leave you as puzzled as me the first time
# I came acros... | 34.642857 | 95 | 0.651546 |
from __future__ import absolute_import, unicode_literals
def get_tags_count(journal):
tags = [tag for entry in journal.entries for tag in set(entry.tags)]
tag_counts = {(tags.count(tag), tag) for tag in tags}
return tag_counts
def oxford_list(lst):
lst = sorted(lst)
if not lst:
... | true | true |
1c01fa387754f50d0be0d8f29466d841f8514eb0 | 1,959 | py | Python | saleor/order/migrations/0090_order_channel_listing.py | fairhopeweb/saleor | 9ac6c22652d46ba65a5b894da5f1ba5bec48c019 | [
"CC-BY-4.0"
] | 15,337 | 2015-01-12T02:11:52.000Z | 2021-10-05T19:19:29.000Z | saleor/order/migrations/0090_order_channel_listing.py | fairhopeweb/saleor | 9ac6c22652d46ba65a5b894da5f1ba5bec48c019 | [
"CC-BY-4.0"
] | 7,486 | 2015-02-11T10:52:13.000Z | 2021-10-06T09:37:15.000Z | saleor/order/migrations/0090_order_channel_listing.py | aminziadna/saleor | 2e78fb5bcf8b83a6278af02551a104cfa555a1fb | [
"CC-BY-4.0"
] | 5,864 | 2015-01-16T14:52:54.000Z | 2021-10-05T23:01:15.000Z | # Generated by Django 3.1 on 2020-08-19 07:58
import django.db.models.deletion
from django.db import migrations, models
from django.utils.text import slugify
def add_channel_slug(apps, schema_editor):
Channel = apps.get_model("channel", "Channel")
Order = apps.get_model("order", "Order")
channels_dict =... | 27.985714 | 63 | 0.559469 |
import django.db.models.deletion
from django.db import migrations, models
from django.utils.text import slugify
def add_channel_slug(apps, schema_editor):
Channel = apps.get_model("channel", "Channel")
Order = apps.get_model("order", "Order")
channels_dict = {}
for order in Order.objects.iterator()... | true | true |
1c01fbefaa046e428c56e7b8e0e0c8d3d45bf1e5 | 21,343 | py | Python | lib/galaxy/webapps/galaxy/api/library_contents.py | blankenberg/galaxy-data-resource | ca32a1aafd64948f489a4e5cf88096f32391b1d9 | [
"CC-BY-3.0"
] | null | null | null | lib/galaxy/webapps/galaxy/api/library_contents.py | blankenberg/galaxy-data-resource | ca32a1aafd64948f489a4e5cf88096f32391b1d9 | [
"CC-BY-3.0"
] | null | null | null | lib/galaxy/webapps/galaxy/api/library_contents.py | blankenberg/galaxy-data-resource | ca32a1aafd64948f489a4e5cf88096f32391b1d9 | [
"CC-BY-3.0"
] | null | null | null | """
API operations on the contents of a data library.
"""
from galaxy import util
from galaxy import web
from galaxy import exceptions
from galaxy.web import _future_expose_api as expose_api
from galaxy.web.base.controller import BaseAPIController, UsesLibraryMixin, UsesLibraryMixinItems
from galaxy.web.base.controller... | 49.866822 | 149 | 0.603289 | """
API operations on the contents of a data library.
"""
from galaxy import util
from galaxy import web
from galaxy import exceptions
from galaxy.web import _future_expose_api as expose_api
from galaxy.web.base.controller import BaseAPIController, UsesLibraryMixin, UsesLibraryMixinItems
from galaxy.web.base.controller... | false | true |
1c01fc8e00c26b70848c438c499133ff38bd3bb3 | 6,707 | py | Python | examples/pytorch_lightning_simple.py | yasuyuky/optuna | f9d7b65f4a5918ec717cfc70fa005975b6a23190 | [
"MIT"
] | null | null | null | examples/pytorch_lightning_simple.py | yasuyuky/optuna | f9d7b65f4a5918ec717cfc70fa005975b6a23190 | [
"MIT"
] | null | null | null | examples/pytorch_lightning_simple.py | yasuyuky/optuna | f9d7b65f4a5918ec717cfc70fa005975b6a23190 | [
"MIT"
] | null | null | null | """
Optuna example that optimizes multi-layer perceptrons using PyTorch Lightning.
In this example, we optimize the validation accuracy of hand-written digit recognition using
PyTorch Lightning, and MNIST. We optimize the neural network architecture. As it is too time
consuming to use the whole MNIST dataset, we here ... | 35.115183 | 95 | 0.679439 |
import argparse
import os
import shutil
import pytorch_lightning as pl
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.optim import Adam
import torch.utils.data
from torchvision import datasets
from torchvision import transforms
import optuna
from optuna.integration import PyTorchLightn... | true | true |
1c01fcd73897eca0208f1167e057adbce7a3cbb6 | 12,405 | py | Python | tests/test_text.py | iwschris/ezodf2 | 061c4aa3f26e9157ad46155d8ce92db7187b0574 | [
"MIT"
] | 4 | 2015-03-15T22:32:35.000Z | 2019-12-23T12:13:13.000Z | tests/test_text.py | iwschris/ezodf2 | 061c4aa3f26e9157ad46155d8ce92db7187b0574 | [
"MIT"
] | 3 | 2017-08-17T09:36:42.000Z | 2021-12-13T19:43:28.000Z | tests/test_text.py | iwschris/ezodf2 | 061c4aa3f26e9157ad46155d8ce92db7187b0574 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
#coding:utf-8
# Purpose: test text objects
# Created: 05.01.2011
# Copyright (C) 2011, Manfred Moitzi
# License: MIT
from __future__ import unicode_literals, print_function, division
__author__ = "mozman <mozman@gmx.at>"
# Standard Library
import unittest
# trusted or separately test... | 35.956522 | 90 | 0.626602 | from __future__ import unicode_literals, print_function, division
__author__ = "mozman <mozman@gmx.at>"
import unittest
from ezodf2.xmlns import etree, CN
from ezodf2.base import GenericWrapper
from ezodf2.text import Paragraph, Span, Heading, NumberedParagraph, Hyperlink
SPANDATA = '<text:span xmlns:te... | true | true |
1c01fd49867e87d2c01137877bba1870ab17e750 | 406 | py | Python | python/vsi/tools/file_util.py | NoahRJohnson/vsi_common | e19e14bc276b20b9dcfd62e3e38abfd6f3487502 | [
"MIT"
] | 7 | 2017-09-04T01:53:43.000Z | 2020-12-20T20:21:35.000Z | python/vsi/tools/file_util.py | NoahRJohnson/vsi_common | e19e14bc276b20b9dcfd62e3e38abfd6f3487502 | [
"MIT"
] | 165 | 2017-07-10T21:56:07.000Z | 2022-03-22T12:20:56.000Z | python/vsi/tools/file_util.py | NoahRJohnson/vsi_common | e19e14bc276b20b9dcfd62e3e38abfd6f3487502 | [
"MIT"
] | 8 | 2017-06-23T20:37:16.000Z | 2020-09-08T21:00:26.000Z | import os
import shutil
def lncp(source, dest):
''' Symlink or copy if that fails. Should work for Linux and Windows
Parameters
----------
source : str
The Source
dest : str
The Destination
'''
if os.path.isdir(dest):
dest = os.path.join(dest, os.path.basename(sou... | 18.454545 | 70 | 0.603448 | import os
import shutil
def lncp(source, dest):
if os.path.isdir(dest):
dest = os.path.join(dest, os.path.basename(source))
try:
os.symlink(source, dest)
except:
shutil.copyfile(source, dest) | true | true |
1c01fd8e970edb1952ad37e9d5e251be75d94983 | 985 | py | Python | languages/python/1.learn_py_the_hard_way/ex25.py | banminkyoz/learn | fde05b0e2f075ebffe77a9d085ed63412d8a9ff9 | [
"MIT"
] | 4 | 2022-01-18T00:57:20.000Z | 2022-03-31T02:41:54.000Z | languages/python/1.learn_py_the_hard_way/ex25.py | kyoz/learn | fde05b0e2f075ebffe77a9d085ed63412d8a9ff9 | [
"MIT"
] | null | null | null | languages/python/1.learn_py_the_hard_way/ex25.py | kyoz/learn | fde05b0e2f075ebffe77a9d085ed63412d8a9ff9 | [
"MIT"
] | 1 | 2018-06-25T20:42:25.000Z | 2018-06-25T20:42:25.000Z | def break_words(stuff):
"""This function will break up words for us."""
words = stuff.split(' ')
return words
def sort_words(words):
"""Sorts the words."""
return sorted(words)
def print_first_word(words):
"""Prints the first word after popping it off."""
word = words.pop(0)
print(word... | 27.361111 | 64 | 0.690355 | def break_words(stuff):
words = stuff.split(' ')
return words
def sort_words(words):
return sorted(words)
def print_first_word(words):
word = words.pop(0)
print(word)
def print_last_word(words):
word = words.pop(-1)
print(word)
def sort_sentence(sentence):
words = break_words(sentenc... | true | true |
1c01fdd2037ac958b0379ff8cf35019b8669a3a2 | 21,987 | py | Python | third_party/gtest/googletest/scripts/gen_gtest_pred_impl.py | torydebra/grt | 6c3fe9e5ab470d840b1c3e613ee0356d209eef7b | [
"MIT",
"Unlicense"
] | 818 | 2015-01-03T05:21:04.000Z | 2022-03-30T00:43:09.000Z | third_party/gtest/googletest/scripts/gen_gtest_pred_impl.py | torydebra/grt | 6c3fe9e5ab470d840b1c3e613ee0356d209eef7b | [
"MIT",
"Unlicense"
] | 131 | 2015-01-26T08:50:57.000Z | 2022-01-12T07:51:53.000Z | third_party/gtest/googletest/scripts/gen_gtest_pred_impl.py | torydebra/grt | 6c3fe9e5ab470d840b1c3e613ee0356d209eef7b | [
"MIT",
"Unlicense"
] | 301 | 2015-01-15T12:36:54.000Z | 2022-03-14T20:12:10.000Z | #!/usr/bin/env .python
#
# Copyright 2006, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this lis... | 30.077975 | 76 | 0.640879 |
"""gen_gtest_pred_impl.py v0.1
Generates the implementation of Google Test predicate assertions and
accompanying tests.
Usage:
gen_gtest_pred_impl.py MAX_ARITY
where MAX_ARITY is a positive integer.
The command generates the implementation of up-to MAX_ARITY-ary
predicate assertions, and writes it to file gtest... | false | true |
1c01fe9aa6d3fe9042c6e1483f28751e2ff601c0 | 6,714 | py | Python | graphs/multi_hueristic_astar.py | joeyzhou85/python | 9c0cbe33076a570a3c02825b7c6d9866a760e777 | [
"MIT"
] | 2 | 2019-04-29T02:36:34.000Z | 2019-06-27T01:32:34.000Z | graphs/multi_hueristic_astar.py | joeyzhou85/python | 9c0cbe33076a570a3c02825b7c6d9866a760e777 | [
"MIT"
] | null | null | null | graphs/multi_hueristic_astar.py | joeyzhou85/python | 9c0cbe33076a570a3c02825b7c6d9866a760e777 | [
"MIT"
] | 3 | 2019-04-29T02:36:37.000Z | 2019-10-05T12:17:59.000Z | from __future__ import print_function
import heapq
import numpy as np
try:
xrange # Python 2
except NameError:
xrange = range # Python 3
class PriorityQueue:
def __init__(self):
self.elements = []
self.set = set()
def minkey(self):
if not self.empty():
return self.elements[0][0]
else:... | 24.866667 | 165 | 0.624069 | from __future__ import print_function
import heapq
import numpy as np
try:
xrange except NameError:
xrange = range
class PriorityQueue:
def __init__(self):
self.elements = []
self.set = set()
def minkey(self):
if not self.empty():
return self.elements[0][0]
else:
return float('inf'... | true | true |
1c0200b251970f8f4ea0b65c9fd57172674a8fda | 3,163 | py | Python | rwrtrack/tablify.py | david-wm-sanders/rwrtrack | 32bd9bb2f697d2c1d99214bafc1cb2893dce6437 | [
"MIT"
] | 3 | 2018-03-11T09:26:40.000Z | 2020-05-24T08:53:04.000Z | rwrtrack/tablify.py | david-wm-sanders/rwrtrack | 32bd9bb2f697d2c1d99214bafc1cb2893dce6437 | [
"MIT"
] | 2 | 2018-03-28T01:27:42.000Z | 2020-01-01T23:38:18.000Z | rwrtrack/tablify.py | david-wm-sanders/rwrtrack | 32bd9bb2f697d2c1d99214bafc1cb2893dce6437 | [
"MIT"
] | null | null | null | """Provides functionality to print pretty tables."""
def render_analysis_table(data):
"""Print an analysis table."""
r = []
# Make a beautiful table with box-drawing characters
c0w = 20
c1w = 12
c2w = 10
# Make the table header.
r.append(f"┌{'':─<{c0w}}┬{'':─<{c1w}}┬{'':─<{c2w}}┐")
... | 45.84058 | 80 | 0.533038 |
def render_analysis_table(data):
r = []
c0w = 20
c1w = 12
c2w = 10
r.append(f"┌{'':─<{c0w}}┬{'':─<{c1w}}┬{'':─<{c2w}}┐")
r.append(f"│{'Statistic':>{c0w}}"
f"│{'Value':>{c1w}}│{'per hour':>{c2w}}│")
r.append(f"╞{'':═<{c0w}}╪{'':═<{c1w}}╪{'':═<{c2w}}╡")
tph ... | true | true |
1c020184b3964ec2e4a21e8a8646b071aafb00f3 | 8,059 | py | Python | src/connection-monitor-preview/azext_connection_monitor_preview/vendored_sdks/v2019_06_01/v2019_06_01/operations/_hub_virtual_network_connections_operations.py | Mannan2812/azure-cli-extensions | e2b34efe23795f6db9c59100534a40f0813c3d95 | [
"MIT"
] | 207 | 2017-11-29T06:59:41.000Z | 2022-03-31T10:00:53.000Z | src/connection-monitor-preview/azext_connection_monitor_preview/vendored_sdks/v2019_06_01/v2019_06_01/operations/_hub_virtual_network_connections_operations.py | Mannan2812/azure-cli-extensions | e2b34efe23795f6db9c59100534a40f0813c3d95 | [
"MIT"
] | 4,061 | 2017-10-27T23:19:56.000Z | 2022-03-31T23:18:30.000Z | src/connection-monitor-preview/azext_connection_monitor_preview/vendored_sdks/v2019_06_01/v2019_06_01/operations/_hub_virtual_network_connections_operations.py | Mannan2812/azure-cli-extensions | e2b34efe23795f6db9c59100534a40f0813c3d95 | [
"MIT"
] | 802 | 2017-10-11T17:36:26.000Z | 2022-03-31T22:24:32.000Z | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 46.051429 | 199 | 0.668569 |
import uuid
from msrest.pipeline import ClientRawResponse
from .. import models
class HubVirtualNetworkConnectionsOperations(object):
models = models
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize ... | true | true |
1c02034a107839b50918d2dd2441d7d6748a523e | 108 | py | Python | python_src/setup.py | fjpena/sword-of-ianna-zx | fdd6bdb5775933756e75402a7c6be80d5334702d | [
"Apache-2.0"
] | 67 | 2017-10-07T18:48:05.000Z | 2022-02-01T20:37:40.000Z | python_src/setup.py | fjpena/sword-of-ianna-zx | fdd6bdb5775933756e75402a7c6be80d5334702d | [
"Apache-2.0"
] | null | null | null | python_src/setup.py | fjpena/sword-of-ianna-zx | fdd6bdb5775933756e75402a7c6be80d5334702d | [
"Apache-2.0"
] | 9 | 2017-10-06T21:02:55.000Z | 2022-01-06T03:11:58.000Z | from distutils.core import setup
import py2exe
setup(
zipfile='lib/library.zip',
console=['ianna.py'],
)
| 13.5 | 32 | 0.731481 | from distutils.core import setup
import py2exe
setup(
zipfile='lib/library.zip',
console=['ianna.py'],
)
| true | true |
1c02037ea5a554699b89ee17af283a4d5dc95c51 | 1,135 | py | Python | bosonic/phi_dispatch.py | RobbeDePrins/bosonic | 036e537421255793a165742e9af678bc0f31f9b7 | [
"MIT"
] | null | null | null | bosonic/phi_dispatch.py | RobbeDePrins/bosonic | 036e537421255793a165742e9af678bc0f31f9b7 | [
"MIT"
] | null | null | null | bosonic/phi_dispatch.py | RobbeDePrins/bosonic | 036e537421255793a165742e9af678bc0f31f9b7 | [
"MIT"
] | 1 | 2021-02-20T13:47:47.000Z | 2021-02-20T13:47:47.000Z |
import sys
import numpy as np
from .aa_phi import aa_phi as aa_phi_cpu
from .aa_phi import binom
# Try to import cuda library & test
gpu_avail = True
try:
from .gpu_phi import GpuPhiDispatcher
from .util import haar_rand
aa_phi_gpu = GpuPhiDispatcher()
U = haar_rand(4)
phiU_GPU = aa_phi_gpu(U, ... | 21.826923 | 71 | 0.615859 |
import sys
import numpy as np
from .aa_phi import aa_phi as aa_phi_cpu
from .aa_phi import binom
gpu_avail = True
try:
from .gpu_phi import GpuPhiDispatcher
from .util import haar_rand
aa_phi_gpu = GpuPhiDispatcher()
U = haar_rand(4)
phiU_GPU = aa_phi_gpu(U, 2)
phiU_CPU = aa_phi_cpu(U, 2)
... | true | true |
1c0203d71ad57e234289efb6bf75f8f66a7d9bb9 | 6,824 | py | Python | neutronclient/tests/unit/lb/test_cli20_pool.py | asadoughi/python-neutronclient | 2026ffdc6c82135b64b3ccd569a4a442e170ca53 | [
"Apache-2.0"
] | 1 | 2016-07-16T09:36:02.000Z | 2016-07-16T09:36:02.000Z | neutronclient/tests/unit/lb/test_cli20_pool.py | ntt-sic/python-neutronclient | a8c5c650ea7d51461c6311fb477b733b2f7c36a0 | [
"Apache-2.0"
] | null | null | null | neutronclient/tests/unit/lb/test_cli20_pool.py | ntt-sic/python-neutronclient | a8c5c650ea7d51461c6311fb477b733b2f7c36a0 | [
"Apache-2.0"
] | null | null | null | # Copyright 2013 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 by ... | 39.218391 | 79 | 0.58939 |
import sys
import mox
from neutronclient.neutron.v2_0.lb import pool
from neutronclient.tests.unit import test_cli20
class CLITestV20LbPoolJSON(test_cli20.CLITestV20Base):
def test_create_pool_with_mandatory_params(self):
resource = 'pool'
cmd = pool.CreatePool(test_cli20.MyApp(sys.stdout), No... | true | true |
1c0203de838cd07bd798ab062be40868bef50766 | 2,900 | py | Python | smb-frames.py | Mortal/smb-frames | 5e6377a724e58c84ead9c95c1c5abf9e7c8eca2b | [
"Beerware"
] | 1 | 2020-03-10T15:41:51.000Z | 2020-03-10T15:41:51.000Z | smb-frames.py | Mortal/smb-frames | 5e6377a724e58c84ead9c95c1c5abf9e7c8eca2b | [
"Beerware"
] | null | null | null | smb-frames.py | Mortal/smb-frames | 5e6377a724e58c84ead9c95c1c5abf9e7c8eca2b | [
"Beerware"
] | null | null | null | #!/usr/bin/env python3
import json
import argparse
import datetime
import numpy as np
from smb_timer import timestamp, crop_string, find_levels_streaming
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--plot', '-p', action='store_true')
parser.add_argument('--from', '-f', dest='from_... | 32.954545 | 117 | 0.56069 | import json
import argparse
import datetime
import numpy as np
from smb_timer import timestamp, crop_string, find_levels_streaming
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--plot', '-p', action='store_true')
parser.add_argument('--from', '-f', dest='from_', type=timestamp)
... | true | true |
1c02047a59341ace4b3b5b8d6d03ff4296774f7c | 3,413 | py | Python | examples/vector_intro.py | DrewMQ/pygame_tutorials | a9c079544b6cc168d0dce3d927189183869709f7 | [
"MIT"
] | 544 | 2017-04-04T00:51:26.000Z | 2022-03-30T18:38:47.000Z | examples/vector_intro.py | torietyler/pygame_tutorials | dd5574788cfbfc4736d7d507b5b3d15eb5f1b115 | [
"MIT"
] | 9 | 2018-12-24T19:04:09.000Z | 2020-10-02T15:25:20.000Z | examples/vector_intro.py | torietyler/pygame_tutorials | dd5574788cfbfc4736d7d507b5b3d15eb5f1b115 | [
"MIT"
] | 685 | 2017-02-05T09:21:22.000Z | 2022-03-29T12:21:16.000Z | # pg template - skeleton for a new pg project
import pygame as pg
vec = pg.math.Vector2
WIDTH = 1000
HEIGHT = 800
FPS = 30
# define colors
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
YELLOW = (255, 255, 0)
# initialize pg and create window
pg.init()
pg.mixer.init()
screen = pg.dis... | 28.441667 | 78 | 0.571052 | import pygame as pg
vec = pg.math.Vector2
WIDTH = 1000
HEIGHT = 800
FPS = 30
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
YELLOW = (255, 255, 0)
pg.init()
pg.mixer.init()
screen = pg.display.set_mode((WIDTH, HEIGHT))
pg.display.set_caption("Vector Basics")
clock = pg.time.Clock()
v... | true | true |
1c0204aeb53966131af5115ab98eefd3a9c01363 | 3,311 | py | Python | TSP/tsp_with_improvement.py | sukritws40/TSP-GPwith2-OPT | cdc7b7b7c8088da7f4e8b940bc35454295d8551c | [
"MIT"
] | null | null | null | TSP/tsp_with_improvement.py | sukritws40/TSP-GPwith2-OPT | cdc7b7b7c8088da7f4e8b940bc35454295d8551c | [
"MIT"
] | null | null | null | TSP/tsp_with_improvement.py | sukritws40/TSP-GPwith2-OPT | cdc7b7b7c8088da7f4e8b940bc35454295d8551c | [
"MIT"
] | null | null | null | import numpy as np
import pandas as pd
import math
import matplotlib.pyplot as plt
from time import time
from random import shuffle, randrange, randint
#number of generation
n = 10
def main():
#Data preparation
df = pd.read_csv('test_200.csv', header = 0)
df = df.drop('city', 1)
df... | 29.04386 | 83 | 0.489882 | import numpy as np
import pandas as pd
import math
import matplotlib.pyplot as plt
from time import time
from random import shuffle, randrange, randint
n = 10
def main():
df = pd.read_csv('test_200.csv', header = 0)
df = df.drop('city', 1)
df_drop = df.drop_duplicates(subset = 'i', k... | true | true |
1c02057c51b62a208c03ed848c705e12241df0a9 | 541 | py | Python | CH02_String_match/2.16.Reformatting_Text_to_a_fixed_number_of_columns.py | Chang-Liu-TAMU/Python-Cookbook-reading | 7b974c32f77b4b3d7cfeed30d1671081057c566f | [
"MIT"
] | null | null | null | CH02_String_match/2.16.Reformatting_Text_to_a_fixed_number_of_columns.py | Chang-Liu-TAMU/Python-Cookbook-reading | 7b974c32f77b4b3d7cfeed30d1671081057c566f | [
"MIT"
] | null | null | null | CH02_String_match/2.16.Reformatting_Text_to_a_fixed_number_of_columns.py | Chang-Liu-TAMU/Python-Cookbook-reading | 7b974c32f77b4b3d7cfeed30d1671081057c566f | [
"MIT"
] | null | null | null | # @Time: 2022/3/31 9:04
# @Author: chang liu
# @Email: chang_liu_tamu@gmail.com
# @File:2.16.Reformatting_Text_to_a_fixed_number_of_columns.py
s = "Look into my eyes, look into my eyes, the eyes, the eyes, \
the eyes, not around the eyes, don't look around the eyes, \
look into my eyes, you're under."
import textwra... | 22.541667 | 74 | 0.713494 |
s = "Look into my eyes, look into my eyes, the eyes, the eyes, \
the eyes, not around the eyes, don't look around the eyes, \
look into my eyes, you're under."
import textwrap
print(s)
a = textwrap.fill(s, 70)
print(type(a))
print(a)
print(textwrap.fill(s, 40, initial_indent=" ", subsequent_indent="@@@"))
impo... | true | true |
1c0205d9eaf1a9f9ce6f630b6ec30f4ab0c865e5 | 1,768 | py | Python | mathgenerator/funcs/calculus/differentiation.py | ieshaan12/mathgenerator | d44a062c2c8f7af27355190432811f63fdd89568 | [
"MIT"
] | 1 | 2020-10-22T21:34:08.000Z | 2020-10-22T21:34:08.000Z | mathgenerator/funcs/calculus/differentiation.py | ieshaan12/mathgenerator | d44a062c2c8f7af27355190432811f63fdd89568 | [
"MIT"
] | null | null | null | mathgenerator/funcs/calculus/differentiation.py | ieshaan12/mathgenerator | d44a062c2c8f7af27355190432811f63fdd89568 | [
"MIT"
] | null | null | null | from .__init__ import *
def genDifferentiationProblem(diff_lvl):
problem = ''
types = {
'Logrithmic': ['ln'],
'Trigonometric': ['sin', 'cos', 'tan', 'cot', 'sec'],
'Exponentional': ['exp']
}
if diff_lvl == 1:
coeff = random.randrange(2, 10)
power = random.rand... | 32.145455 | 76 | 0.541855 | from .__init__ import *
def genDifferentiationProblem(diff_lvl):
problem = ''
types = {
'Logrithmic': ['ln'],
'Trigonometric': ['sin', 'cos', 'tan', 'cot', 'sec'],
'Exponentional': ['exp']
}
if diff_lvl == 1:
coeff = random.randrange(2, 10)
power = random.rand... | true | true |
1c02075f9fafb819b6b4727d2f459d04e615daa5 | 8,918 | py | Python | dependencies/generate maps/pythongis/vector/sql.py | karimbahgat/AutoMap | eae52f16b7ce71cb2b4b7ae67cf6e4680ea2194f | [
"MIT"
] | null | null | null | dependencies/generate maps/pythongis/vector/sql.py | karimbahgat/AutoMap | eae52f16b7ce71cb2b4b7ae67cf6e4680ea2194f | [
"MIT"
] | 1 | 2022-01-13T02:52:09.000Z | 2022-01-13T02:52:09.000Z | dependencies/generate maps/pythongis/vector/sql.py | karimbahgat/AutoMap | eae52f16b7ce71cb2b4b7ae67cf6e4680ea2194f | [
"MIT"
] | null | null | null |
import itertools, operator
from .data import *
import shapely, shapely.ops, shapely.geometry
from shapely.prepared import prep as supershapely
# TODO: when multiple input, uses all possible combinations, but need a way to use spatial indexes etc
# SQL components
def aggreg(iterable, aggregfuncs, geomfunc=None):
... | 32.311594 | 209 | 0.593631 |
import itertools, operator
from .data import *
import shapely, shapely.ops, shapely.geometry
from shapely.prepared import prep as supershapely
def aggreg(iterable, aggregfuncs, geomfunc=None):
"""Each func must be able to take an iterable and return a single item.
Aggregfuncs is a series of 3-tuples: an ... | false | true |
1c020905714f0f14ae6ea0ac08e8343be8d2495e | 10,597 | py | Python | tests/test_workflows.py | parallelworks/jetstream | ce2c0857a0b3201c739476be47de7570d267b877 | [
"MIT"
] | 3 | 2020-09-28T16:43:52.000Z | 2021-11-27T23:42:11.000Z | tests/test_workflows.py | parallelworks/jetstream | ce2c0857a0b3201c739476be47de7570d267b877 | [
"MIT"
] | 42 | 2019-10-28T17:25:55.000Z | 2022-03-05T21:53:10.000Z | tests/test_workflows.py | parallelworks/jetstream | ce2c0857a0b3201c739476be47de7570d267b877 | [
"MIT"
] | 4 | 2020-05-03T06:46:02.000Z | 2022-03-01T20:33:18.000Z | import os
import tempfile
import jetstream
from random import Random
from jetstream.tasks import Task
from unittest import TestCase
jetstream.settings.clear()
jetstream.settings.read(user=False)
# Seed the rng because otherwise there's a small chance
# of generating a negative control string that matches
# the id patt... | 31.918675 | 76 | 0.607625 | import os
import tempfile
import jetstream
from random import Random
from jetstream.tasks import Task
from unittest import TestCase
jetstream.settings.clear()
jetstream.settings.read(user=False)
# of generating a negative control string that matches
# the id pattern.
random = Random(42)
class WorkflowBasics(TestCase... | true | true |
1c02091e027ae1050bfec2131c685af148b990b2 | 1,286 | py | Python | algorithms/312. Burst Balloons.py | vuzway9132/leetcode | e51a9ce7a6bb3e35c0fcb8c8f4f6cd5763708dbf | [
"MIT"
] | 1 | 2020-12-02T13:54:30.000Z | 2020-12-02T13:54:30.000Z | algorithms/312. Burst Balloons.py | vuzway9132/leetcode | e51a9ce7a6bb3e35c0fcb8c8f4f6cd5763708dbf | [
"MIT"
] | null | null | null | algorithms/312. Burst Balloons.py | vuzway9132/leetcode | e51a9ce7a6bb3e35c0fcb8c8f4f6cd5763708dbf | [
"MIT"
] | null | null | null | """
1. Clarification
2. Possible solutions
- Memoization
- Dynamic programming
3. Coding
4. Tests
"""
# # T=O(n^3), S=O(n^2), Time Limit Exceeded
# class Solution:
# def maxCoins(self, nums: List[int]) -> int:
# n = len(nums)
# val = [1] + nums + [1]
# @functools.lru_cache(None)
#... | 28.577778 | 66 | 0.442457 |
class Solution:
def maxCoins(self, nums: List[int]) -> int:
n = len(nums)
dp = [[0] * (n + 2) for _ in range(n + 2)]
val = [1] + nums + [1]
for i in range(n - 1, -1, -1):
for j in range(i + 2, n + 2):
for k in range(i + 1, j):
tot... | true | true |
1c02094383cdae687aaefdb8276ae034eda047b8 | 3,958 | py | Python | cirq/contrib/qasm_import/_lexer_test.py | joshp112358/Cirq | c4fac27a9849e589ee05b4f702f2d7c9049aaeea | [
"Apache-2.0"
] | 15 | 2020-06-29T08:33:39.000Z | 2022-02-12T00:28:51.000Z | cirq/contrib/qasm_import/_lexer_test.py | joshp112358/Cirq | c4fac27a9849e589ee05b4f702f2d7c9049aaeea | [
"Apache-2.0"
] | 4 | 2020-11-27T09:34:13.000Z | 2021-04-30T21:13:41.000Z | cirq/contrib/qasm_import/_lexer_test.py | joshp112358/Cirq | c4fac27a9849e589ee05b4f702f2d7c9049aaeea | [
"Apache-2.0"
] | 11 | 2020-06-29T08:40:24.000Z | 2022-02-24T17:39:16.000Z | # https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing p... | 23.282353 | 79 | 0.623547 |
import pytest
import numpy as np
from cirq.contrib.qasm_import import QasmException
from cirq.contrib.qasm_import._lexer import QasmLexer
def test_empty_circuit():
lexer = QasmLexer()
lexer.input("")
assert lexer.token() is None
@pytest.mark.parametrize('number', ["00000", "03", "3", "0045", "21"])
def... | true | true |
1c020944ad00ab18f12dfebb23ec227750fd60b5 | 6,626 | py | Python | src/mlpack/bindings/python/mlpack/matrix_utils.py | oblanchet/mlpack | e02ab3be544694294d2f73bd12a98d0d162ef3af | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 4,216 | 2015-01-01T02:06:12.000Z | 2022-03-31T19:12:06.000Z | src/mlpack/bindings/python/mlpack/matrix_utils.py | oblanchet/mlpack | e02ab3be544694294d2f73bd12a98d0d162ef3af | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 2,621 | 2015-01-01T01:41:47.000Z | 2022-03-31T19:01:26.000Z | src/mlpack/bindings/python/mlpack/matrix_utils.py | oblanchet/mlpack | e02ab3be544694294d2f73bd12a98d0d162ef3af | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 1,972 | 2015-01-01T23:37:13.000Z | 2022-03-28T06:03:41.000Z | #!/usr/bin/env python
"""
matrix_utils.py: utilities for matrix conversion
This file defines the to_matrix() function, which can be used to convert Pandas
dataframes or other types of array-like objects to numpy ndarrays for use in
mlpack bindings.
mlpack is free software; you may redistribute it and/or modify it und... | 37.01676 | 81 | 0.659976 | import numpy as np
import pandas as pd
if int(pd.__version__.split('.')[0]) > 0 or \
int(pd.__version__.split('.')[1]) >= 20:
from pandas.api.types import CategoricalDtype
elif int(pd.__version__.split('.')[1]) >= 18:
from pandas.types.dtypes import CategoricalDtype
elif int(pd.__version__.split('.')[1]) == 17:
... | true | true |
1c0209466faedb6d39469de122c74332d8b49941 | 762 | py | Python | server/cephdissectionserver/processing.py | martinslabber/ceph-dissection | 74788f77112e2bfd587bf6d1e4c92f1169763543 | [
"MIT"
] | null | null | null | server/cephdissectionserver/processing.py | martinslabber/ceph-dissection | 74788f77112e2bfd587bf6d1e4c92f1169763543 | [
"MIT"
] | null | null | null | server/cephdissectionserver/processing.py | martinslabber/ceph-dissection | 74788f77112e2bfd587bf6d1e4c92f1169763543 | [
"MIT"
] | null | null | null | import logging
import asyncio
def fsid_time_fromfilename(filename):
fparts = filename.stem.split("-")
fsid = "-".join(fparts[1:6])
timestamp = fparts[6]
return fsid, timestamp
async def process_uploaded_file(config, filename):
await asyncio.sleep(1)
logging.info("Processing %s", filename)
... | 29.307692 | 58 | 0.713911 | import logging
import asyncio
def fsid_time_fromfilename(filename):
fparts = filename.stem.split("-")
fsid = "-".join(fparts[1:6])
timestamp = fparts[6]
return fsid, timestamp
async def process_uploaded_file(config, filename):
await asyncio.sleep(1)
logging.info("Processing %s", filename)
... | true | true |
1c020953da170998b327fc2d1ff16798ba0ffb28 | 22,980 | py | Python | sdk/python/pulumi_google_native/dialogflow/v3/page.py | AaronFriel/pulumi-google-native | 75d1cda425e33d4610348972cd70bddf35f1770d | [
"Apache-2.0"
] | 44 | 2021-04-18T23:00:48.000Z | 2022-02-14T17:43:15.000Z | sdk/python/pulumi_google_native/dialogflow/v3/page.py | AaronFriel/pulumi-google-native | 75d1cda425e33d4610348972cd70bddf35f1770d | [
"Apache-2.0"
] | 354 | 2021-04-16T16:48:39.000Z | 2022-03-31T17:16:39.000Z | sdk/python/pulumi_google_native/dialogflow/v3/page.py | AaronFriel/pulumi-google-native | 75d1cda425e33d4610348972cd70bddf35f1770d | [
"Apache-2.0"
] | 8 | 2021-04-24T17:46:51.000Z | 2022-01-05T10:40:21.000Z | # 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, overload
from ... import _utilities
fro... | 61.117021 | 807 | 0.69913 |
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
from . import outputs
from ._inputs import *
__all__ = ['PageArgs', 'Page']
@pulumi.input_type
class PageArgs:
def __init__(__self__, *,
agent_id: p... | true | true |
1c020ab05773ede21e21ad1a2cea69427c6e0eb5 | 10,605 | py | Python | CMPE487/Project4/package/TCPSocket.py | oztasoi/bachelor-projects | a3e3a39efc9fed09db7290227848552f9604befa | [
"MIT"
] | null | null | null | CMPE487/Project4/package/TCPSocket.py | oztasoi/bachelor-projects | a3e3a39efc9fed09db7290227848552f9604befa | [
"MIT"
] | null | null | null | CMPE487/Project4/package/TCPSocket.py | oztasoi/bachelor-projects | a3e3a39efc9fed09db7290227848552f9604befa | [
"MIT"
] | null | null | null | import json
import socket
import asyncio as aio
from collections import defaultdict
import sys
from .TCPLayer import TCPLayer
from .TCPPacket import TCPPacket
from .utils import chunker, sock_sendto
from .constants import BYTE_ORDER, FAKE_UDP_PORT, MAX_BUFFER_SIZE, MIN_WINDOW
port_map = dict()
class TCPSocket():
... | 37.740214 | 133 | 0.591231 | import json
import socket
import asyncio as aio
from collections import defaultdict
import sys
from .TCPLayer import TCPLayer
from .TCPPacket import TCPPacket
from .utils import chunker, sock_sendto
from .constants import BYTE_ORDER, FAKE_UDP_PORT, MAX_BUFFER_SIZE, MIN_WINDOW
port_map = dict()
class TCPSocket():
... | true | true |
1c020aba25b9e27ee564a5a9077c70686f3ff7e1 | 1,599 | py | Python | tests/python-gpu/test_gpu_basic_models.py | jborchma/xgboost | 7a99f8f27f7dd7fadd7e7729952eaa2e4424f6c9 | [
"Apache-2.0"
] | 1 | 2021-04-17T07:21:30.000Z | 2021-04-17T07:21:30.000Z | tests/python-gpu/test_gpu_basic_models.py | jborchma/xgboost | 7a99f8f27f7dd7fadd7e7729952eaa2e4424f6c9 | [
"Apache-2.0"
] | null | null | null | tests/python-gpu/test_gpu_basic_models.py | jborchma/xgboost | 7a99f8f27f7dd7fadd7e7729952eaa2e4424f6c9 | [
"Apache-2.0"
] | null | null | null | import sys
import os
import unittest
import numpy as np
import xgboost as xgb
sys.path.append("tests/python")
# Don't import the test class, otherwise they will run twice.
import test_basic_models as test_bm # noqa
rng = np.random.RandomState(1994)
class TestGPUBasicModels(unittest.TestCase):
cputest = test_bm.T... | 34.021277 | 74 | 0.635397 | import sys
import os
import unittest
import numpy as np
import xgboost as xgb
sys.path.append("tests/python")
import test_basic_models as test_bm # noqa
rng = np.random.RandomState(1994)
class TestGPUBasicModels(unittest.TestCase):
cputest = test_bm.TestModels()
def test_eta_decay_gpu_hist(self):
se... | true | true |
1c020b7d3674adccdc8fac233c3c674b5503eece | 1,860 | py | Python | practica3/12c.py | danipozo/practicas-mnii | f4afe725316c694a4cd06e2ce3c0019f4f68652f | [
"MIT"
] | 1 | 2018-03-13T18:10:38.000Z | 2018-03-13T18:10:38.000Z | practica3/12c.py | danipozo/practicas-mnii | f4afe725316c694a4cd06e2ce3c0019f4f68652f | [
"MIT"
] | null | null | null | practica3/12c.py | danipozo/practicas-mnii | f4afe725316c694a4cd06e2ce3c0019f4f68652f | [
"MIT"
] | 1 | 2018-03-13T22:35:02.000Z | 2018-03-13T22:35:02.000Z | # PROGRAMA 8
# -*- coding: utf-8 -*-
from math import fabs, exp
from scipy.interpolate import lagrange
from scipy.integrate import quad
from decimal import *
a = 0.0
b = 1.0
n = 10
k = 4
# Función f de dos variables
def f(t,y):
return (2-2*t*y)/(1+pow(t,2))
# Solución exacta
sol_exacta = False
def y(t):
return (... | 20.898876 | 80 | 0.573118 |
from math import fabs, exp
from scipy.interpolate import lagrange
from scipy.integrate import quad
from decimal import *
a = 0.0
b = 1.0
n = 10
k = 4
def f(t,y):
return (2-2*t*y)/(1+pow(t,2))
sol_exacta = False
def y(t):
return (2*t+1)/(pow(t,2)+1)
y_0 = 1.0
inicial = []
h = (b - a) / n
t = [a + j * h for j in... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.