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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f76be0e6906338eac28e65aabedbb628b70d4001 | 89 | py | Python | bluelog/blueprints/admin.py | MiracleWong/bluelog | 3412eea9e8cf99b90ead038e853980d2b8320498 | [
"MIT"
] | null | null | null | bluelog/blueprints/admin.py | MiracleWong/bluelog | 3412eea9e8cf99b90ead038e853980d2b8320498 | [
"MIT"
] | null | null | null | bluelog/blueprints/admin.py | MiracleWong/bluelog | 3412eea9e8cf99b90ead038e853980d2b8320498 | [
"MIT"
] | null | null | null | # -*- coding:utf-8 -*-
from flask import Blueprint
admin_bp= Blueprint('admin', __name__) | 29.666667 | 38 | 0.719101 | from flask import Blueprint
admin_bp= Blueprint('admin', __name__) | true | true |
f76be302e883e9c77a2704e4f6e350157aa438a9 | 471 | py | Python | app/core/migrations/0003_user_date_of_birth.py | neomodular/recipe-app-api | 43ffa6258f08e3685f3921d1314fdd90a946bb40 | [
"MIT"
] | null | null | null | app/core/migrations/0003_user_date_of_birth.py | neomodular/recipe-app-api | 43ffa6258f08e3685f3921d1314fdd90a946bb40 | [
"MIT"
] | null | null | null | app/core/migrations/0003_user_date_of_birth.py | neomodular/recipe-app-api | 43ffa6258f08e3685f3921d1314fdd90a946bb40 | [
"MIT"
] | null | null | null | # Generated by Django 3.0.5 on 2020-05-03 03:55
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('core', '0002_user_last_name'),
]
operations = [
migrations.AddField(
model_name='user',
... | 22.428571 | 74 | 0.624204 |
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('core', '0002_user_last_name'),
]
operations = [
migrations.AddField(
model_name='user',
name='date_of_birth',
field=models.... | true | true |
f76be36951e120e2dec925bbece618b1596c0a8c | 7,808 | py | Python | classification/eval_main.py | alcunha/iwildcam2021ufam | 243c3e4b91d5756d1e7fcdf8ae75344a373d3b84 | [
"Apache-2.0"
] | 5 | 2021-06-11T14:36:29.000Z | 2021-07-19T20:32:49.000Z | classification/eval_main.py | alcunha/iwildcam2021ufam | 243c3e4b91d5756d1e7fcdf8ae75344a373d3b84 | [
"Apache-2.0"
] | null | null | null | classification/eval_main.py | alcunha/iwildcam2021ufam | 243c3e4b91d5756d1e7fcdf8ae75344a373d3b84 | [
"Apache-2.0"
] | 2 | 2021-07-19T20:32:53.000Z | 2021-08-08T12:50:08.000Z | # Copyright 2021 Fagner Cunha
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 30.740157 | 76 | 0.730789 |
import json
import os
import random
from absl import app
from absl import flags
import numpy as np
from sklearn.metrics import accuracy_score
import tensorflow as tf
from iwildcamlib import CategoryMap
import bags
import dataloader
import geoprior
import model_builder
os.environ['TF_DETERMINISTIC_OPS'] = '1'
FLAGS... | true | true |
f76be3aa719afb568f47819761838ecd284f3611 | 1,101 | py | Python | package_bootstrap/sublime/commands.py | ginanjarn/SublimeScraps | 003952db5e6f08018693a13a95bdb6d7dbf5e516 | [
"MIT"
] | 61 | 2017-10-10T22:41:51.000Z | 2022-03-26T16:55:43.000Z | package_bootstrap/sublime/commands.py | OdatNurd/SublimeScraps | e9f97d2abc2a182ccec4a7ac8fa56e0911ef4c5c | [
"MIT"
] | 13 | 2017-09-23T23:09:55.000Z | 2021-11-13T07:20:23.000Z | package_bootstrap/sublime/commands.py | OdatNurd/SublimeScraps | e9f97d2abc2a182ccec4a7ac8fa56e0911ef4c5c | [
"MIT"
] | 14 | 2017-10-23T17:15:21.000Z | 2022-03-11T06:04:51.000Z | """
This file is an example of some Sublime specific plugin code that is contained
within the dependency but later exposed via the bootstrapped system package.
In use this could be one or more files with a variety of commands and event
listeners. The examples here do nothing but generate log messages.
Note that this ... | 28.230769 | 79 | 0.590372 |
import sublime
import sublime_plugin
__all__ = [
"BootstrapTestCommand",
]
class BootstrapTestCommand(sublime_plugin.TextCommand):
def run(self, edit):
print("I appear to be some sort of example command")
| true | true |
f76be3cdc3d303d7e320564d80af37fa950056f9 | 3,995 | py | Python | tests/test_utils.py | gisce/rq27 | c181d84c94afaa5d8fd395e85392475333fac214 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | tests/test_utils.py | gisce/rq27 | c181d84c94afaa5d8fd395e85392475333fac214 | [
"BSD-2-Clause-FreeBSD"
] | 10 | 2019-10-19T04:33:46.000Z | 2019-12-09T02:11:51.000Z | tests/test_utils.py | thomasmatecki/rq | a31d37f1ea32c001da6d7c6c57a3a3e16290450c | [
"BSD-2-Clause-FreeBSD"
] | 2 | 2021-01-29T10:10:31.000Z | 2021-08-14T13:51:15.000Z | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import re
import datetime
import mock
from distutils.version import StrictVersion
from redis import Redis
from tests import RQTestCase, fixtures
from rq.utils import backend_class, ens... | 43.901099 | 115 | 0.660826 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import re
import datetime
import mock
from distutils.version import StrictVersion
from redis import Redis
from tests import RQTestCase, fixtures
from rq.utils import backend_class, ensure_list, first, get_ver... | true | true |
f76be3d8c1c242d178f613ab18491047efc07f56 | 5,269 | py | Python | author_code_base/ResNet-CIFAR10/main.py | MichaelKonobeev/adashift | bf86b021d42e922078a39246770f0f875300a6f3 | [
"MIT"
] | 14 | 2018-11-23T08:07:07.000Z | 2022-03-23T11:40:25.000Z | author_code_base/ResNet-CIFAR10/main.py | MichaelKonobeev/adashift | bf86b021d42e922078a39246770f0f875300a6f3 | [
"MIT"
] | 1 | 2019-06-02T13:31:44.000Z | 2019-06-02T13:31:44.000Z | author_code_base/ResNet-CIFAR10/main.py | MichaelKonobeev/adashift | bf86b021d42e922078a39246770f0f875300a6f3 | [
"MIT"
] | 3 | 2019-05-30T02:34:36.000Z | 2020-04-27T18:59:32.000Z | import os
# os.environ["CUDA_VISIBLE_DEVICES"] = "0"
from ResNet import ResNet
import argparse
from utils import *
import time
from common.utils import allocate_gpu
def find_next_time(path_list, default=-1):
if default > -1:
return default
run_times = [int(path.split('_')[0]) for path in path_list]
... | 35.601351 | 197 | 0.653065 | import os
from ResNet import ResNet
import argparse
from utils import *
import time
from common.utils import allocate_gpu
def find_next_time(path_list, default=-1):
if default > -1:
return default
run_times = [int(path.split('_')[0]) for path in path_list]
if default == -1:
next_time =... | true | true |
f76be49fcf03c158a665564a825e0e86e50c9b1b | 7,158 | py | Python | hw1.py | spencerturkel/usf2018_reasoning_project1 | 91225a0850b63f4b6fe52d3b701a18f2f6626444 | [
"MIT"
] | null | null | null | hw1.py | spencerturkel/usf2018_reasoning_project1 | 91225a0850b63f4b6fe52d3b701a18f2f6626444 | [
"MIT"
] | null | null | null | hw1.py | spencerturkel/usf2018_reasoning_project1 | 91225a0850b63f4b6fe52d3b701a18f2f6626444 | [
"MIT"
] | null | null | null | import string
from enum import Enum, auto
from itertools import combinations
from string import ascii_lowercase, digits
from typing import Union
# Formula Grammar
###########################################################
# F = V | (L)
# V = aV' | bV' | ... | zV' | 0V' | 1V' | ... | 9V'
# V' = aV' | bV' | ... | zV' ... | 27.530769 | 110 | 0.516345 | import string
from enum import Enum, auto
from itertools import combinations
from string import ascii_lowercase, digits
from typing import Union
# L = O F F | 'NOT' F
# O = 'IF' | 'AND' | 'OR'
###########################################################
class Op(Enum):
AND = auto()
IF = auto()
NOT = auto(... | true | true |
f76be5651fbcc62fd852894d317c5fdf579ec20c | 8,265 | py | Python | airbyte-cdk/python/airbyte_cdk/models/airbyte_protocol.py | emilycogsdill/airbyte | 802bb41a02b85eb9f3935cc57c01b0f387dbe303 | [
"MIT"
] | null | null | null | airbyte-cdk/python/airbyte_cdk/models/airbyte_protocol.py | emilycogsdill/airbyte | 802bb41a02b85eb9f3935cc57c01b0f387dbe303 | [
"MIT"
] | null | null | null | airbyte-cdk/python/airbyte_cdk/models/airbyte_protocol.py | emilycogsdill/airbyte | 802bb41a02b85eb9f3935cc57c01b0f387dbe303 | [
"MIT"
] | null | null | null | #
# MIT License
#
# Copyright (c) 2020 Airbyte
#
# 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, pu... | 36.733333 | 637 | 0.713491 |
from __future__ import annotations
from enum import Enum
from typing import Any, Dict, List, Optional
from pydantic import AnyUrl, BaseModel, Extra, Field
class Type(Enum):
RECORD = "RECORD"
STATE = "STATE"
LOG = "LOG"
SPEC = "SPEC"
CONNECTION_STATUS = "CONNECTION_STATUS"
CATALOG = "CATALO... | true | true |
f76be56eb99d1bf8b95e5fedbdae76ebe0cc9658 | 6,669 | py | Python | bindings/python/ensmallen_graph/datasets/string/thermusaquaticus.py | caufieldjh/ensmallen_graph | 14e98b1cdbc73193a84a913d7d4f2b2b3eb2c43a | [
"MIT"
] | null | null | null | bindings/python/ensmallen_graph/datasets/string/thermusaquaticus.py | caufieldjh/ensmallen_graph | 14e98b1cdbc73193a84a913d7d4f2b2b3eb2c43a | [
"MIT"
] | null | null | null | bindings/python/ensmallen_graph/datasets/string/thermusaquaticus.py | caufieldjh/ensmallen_graph | 14e98b1cdbc73193a84a913d7d4f2b2b3eb2c43a | [
"MIT"
] | null | null | null | """
This file offers the methods to automatically retrieve the graph Thermus aquaticus.
The graph is automatically retrieved from the STRING repository.
Report
---------------------
At the time of rendering these methods (please see datetime below), the graph
had the following characteristics:
Datetime: 2021-02-0... | 34.91623 | 223 | 0.702804 | from typing import Dict
from ..automatic_graph_retrieval import AutomaticallyRetrievedGraph
from ...ensmallen_graph import EnsmallenGraph
def ThermusAquaticus(
directed: bool = False,
verbose: int = 2,
cache_path: str = "graphs/string",
**additional_graph_kwargs: Dict
) -> EnsmallenGraph:
return... | true | true |
f76be69158a72221390cac056406c92f7bd08a4d | 922 | py | Python | tests/terraform/checks/resource/linode/test_user_username_set.py | pmalkki/checkov | b6cdf386dd976fe27c16fed6d550756a678a5d7b | [
"Apache-2.0"
] | 4,013 | 2019-12-09T13:16:54.000Z | 2022-03-31T14:31:01.000Z | tests/terraform/checks/resource/linode/test_user_username_set.py | pmalkki/checkov | b6cdf386dd976fe27c16fed6d550756a678a5d7b | [
"Apache-2.0"
] | 1,258 | 2019-12-17T09:55:51.000Z | 2022-03-31T19:17:17.000Z | tests/terraform/checks/resource/linode/test_user_username_set.py | pmalkki/checkov | b6cdf386dd976fe27c16fed6d550756a678a5d7b | [
"Apache-2.0"
] | 638 | 2019-12-19T08:57:38.000Z | 2022-03-30T21:38:37.000Z | import unittest
import hcl2
from checkov.terraform.checks.resource.linode.user_username_set import check
from checkov.common.models.enums import CheckResult
class Testuser_username_set(unittest.TestCase):
def test_success(self):
hcl_res = hcl2.loads("""
resource "linode_user" "test" {
us... | 29.741935 | 76 | 0.667028 | import unittest
import hcl2
from checkov.terraform.checks.resource.linode.user_username_set import check
from checkov.common.models.enums import CheckResult
class Testuser_username_set(unittest.TestCase):
def test_success(self):
hcl_res = hcl2.loads("""
resource "linode_user" "test" {
us... | true | true |
f76be778a0891bf065e8a1a1a946044395e285c8 | 8,211 | py | Python | flora/cmds/configure.py | fugginoob/flora-blockchain | e57733fdc5ca3627ac5c4aa9a4a5707fb91267be | [
"Apache-2.0"
] | null | null | null | flora/cmds/configure.py | fugginoob/flora-blockchain | e57733fdc5ca3627ac5c4aa9a4a5707fb91267be | [
"Apache-2.0"
] | null | null | null | flora/cmds/configure.py | fugginoob/flora-blockchain | e57733fdc5ca3627ac5c4aa9a4a5707fb91267be | [
"Apache-2.0"
] | null | null | null | from pathlib import Path
from typing import Dict
import click
from flora.util.config import load_config, save_config, str2bool
from flora.util.default_root import DEFAULT_ROOT_PATH
def configure(
root_path: Path,
set_farmer_peer: str,
set_node_introducer: str,
set_fullnode_port: str,
set_log_lev... | 40.850746 | 100 | 0.602484 | from pathlib import Path
from typing import Dict
import click
from flora.util.config import load_config, save_config, str2bool
from flora.util.default_root import DEFAULT_ROOT_PATH
def configure(
root_path: Path,
set_farmer_peer: str,
set_node_introducer: str,
set_fullnode_port: str,
set_log_lev... | true | true |
f76be7a875ce65d96ba00087a05faef2fb3396db | 138 | py | Python | random_word/__init__.py | nkstonks/random-word | c850b4f59a65dc98dde10f2c9f139d4cf5ef6347 | [
"MIT"
] | 109 | 2018-06-21T17:06:38.000Z | 2022-03-18T02:53:45.000Z | random_word/__init__.py | nkstonks/random-word | c850b4f59a65dc98dde10f2c9f139d4cf5ef6347 | [
"MIT"
] | 57 | 2018-07-03T14:35:34.000Z | 2022-03-25T11:54:45.000Z | random_word/__init__.py | nkstonks/random-word | c850b4f59a65dc98dde10f2c9f139d4cf5ef6347 | [
"MIT"
] | 28 | 2018-06-14T05:08:17.000Z | 2022-03-25T11:22:50.000Z | from .random_word import RandomWords
__name__ = "Random Word"
__author__ = "Vaibhav Singh <hi@vaibhavsingh97.com>"
__version__ = "1.0.7"
| 23 | 52 | 0.76087 | from .random_word import RandomWords
__name__ = "Random Word"
__author__ = "Vaibhav Singh <hi@vaibhavsingh97.com>"
__version__ = "1.0.7"
| true | true |
f76be7fa1a9fc5e3e849cef42304fa5967741f6c | 60,742 | py | Python | tensorflow_estimator/python/estimator/hooks/basic_session_run_hooks_test.py | wsuchy/estimator | b22a912de2693322622d6f50e3a19e98fecac441 | [
"Apache-2.0"
] | 1 | 2019-10-10T06:22:03.000Z | 2019-10-10T06:22:03.000Z | tensorflow_estimator/python/estimator/hooks/basic_session_run_hooks_test.py | wsuchy/estimator | b22a912de2693322622d6f50e3a19e98fecac441 | [
"Apache-2.0"
] | 1 | 2020-01-31T21:04:31.000Z | 2020-01-31T21:04:31.000Z | tensorflow_estimator/python/estimator/hooks/basic_session_run_hooks_test.py | wsuchy/estimator | b22a912de2693322622d6f50e3a19e98fecac441 | [
"Apache-2.0"
] | 1 | 2019-10-10T06:21:55.000Z | 2019-10-10T06:21:55.000Z | # pylint: disable=g-bad-file-header
# Copyright 2016 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/LICENS... | 38.517438 | 80 | 0.670936 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os.path
import shutil
import tempfile
import time
from tensorflow.python.training import checkpoint_utils
from tensorflow.python.client import session as session_lib
from tensorflow.python.data.ops imp... | true | true |
f76be8548edca32cf0c63d775de32ad5bdb95be1 | 4,307 | py | Python | ml_toolkit/args.py | mmcdermott/ml_toolkit | 79ac65e2fbdbf5b4d5673bcaf96251c661e2f246 | [
"MIT"
] | 1 | 2017-09-06T16:49:28.000Z | 2017-09-06T16:49:28.000Z | ml_toolkit/args.py | mmcdermott/ml_toolkit | 79ac65e2fbdbf5b4d5673bcaf96251c661e2f246 | [
"MIT"
] | null | null | null | ml_toolkit/args.py | mmcdermott/ml_toolkit | 79ac65e2fbdbf5b4d5673bcaf96251c661e2f246 | [
"MIT"
] | null | null | null | import argparse, json, pickle
from abc import ABC, abstractmethod
from typing import Sequence
from dataclasses import dataclass, asdict
from ..constants import *
def intlt(bounds):
start, end = bounds if type(bounds) is tuple else (0, bounds)
def fntr(x):
x = int(x)
if x < start or x >= end: r... | 43.505051 | 111 | 0.641049 | import argparse, json, pickle
from abc import ABC, abstractmethod
from typing import Sequence
from dataclasses import dataclass, asdict
from ..constants import *
def intlt(bounds):
start, end = bounds if type(bounds) is tuple else (0, bounds)
def fntr(x):
x = int(x)
if x < start or x >= end: r... | true | true |
f76be9938311dda7086b96f65f49c7bdcfbc5ffb | 1,940 | py | Python | tests/sparseml/pytorch/models/classification/test_mobilenet.py | clementpoiret/sparseml | 8442a6ef8ba11fb02f5e51472dd68b72438539b9 | [
"Apache-2.0"
] | 922 | 2021-02-04T17:51:54.000Z | 2022-03-31T20:49:26.000Z | tests/sparseml/pytorch/models/classification/test_mobilenet.py | clementpoiret/sparseml | 8442a6ef8ba11fb02f5e51472dd68b72438539b9 | [
"Apache-2.0"
] | 197 | 2021-02-04T22:17:21.000Z | 2022-03-31T13:58:55.000Z | tests/sparseml/pytorch/models/classification/test_mobilenet.py | clementpoiret/sparseml | 8442a6ef8ba11fb02f5e51472dd68b72438539b9 | [
"Apache-2.0"
] | 80 | 2021-02-04T22:20:14.000Z | 2022-03-30T19:36:15.000Z | # Copyright (c) 2021 - present / Neuralmagic, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | 32.333333 | 78 | 0.69433 |
import os
from typing import Union
import pytest
import torch
from sparseml.pytorch.models import ModelRegistry, mobilenet
from tests.sparseml.pytorch.models.utils import compare_model
@pytest.mark.skipif(
os.getenv("NM_ML_SKIP_PYTORCH_TESTS", False),
reason="Skipping pytorch tests",
)
@pytest.mark.skipif(... | true | true |
f76be99592a580036191da69a6900fb1619c8b91 | 4,043 | py | Python | models/SC_V2.py | Totoketchup/Adaptive-MultiSpeaker-Separation | 8e7e869b8050643a777e315d1ddac577a8dc85ff | [
"MIT"
] | 43 | 2018-02-01T06:27:06.000Z | 2021-11-28T17:03:03.000Z | models/SC_V2.py | jhuiac/Adaptive-MultiSpeaker-Separation | 8e7e869b8050643a777e315d1ddac577a8dc85ff | [
"MIT"
] | 1 | 2018-05-08T03:37:10.000Z | 2018-06-18T04:39:51.000Z | models/SC_V2.py | jhuiac/Adaptive-MultiSpeaker-Separation | 8e7e869b8050643a777e315d1ddac577a8dc85ff | [
"MIT"
] | 15 | 2018-03-06T11:02:41.000Z | 2020-11-29T04:49:11.000Z | # -*- coding: utf-8 -*-
import tensorflow as tf
from utils.ops import BLSTM, Conv1D, Reshape, Normalize, f_props, scope, log10
from models.network import Separator
class L41ModelV2(Separator):
def __init__(self, graph=None, **kwargs):
kwargs['mask_a'] = 1.0
kwargs['mask_b'] = -1.0
super(L41ModelV2, self).__in... | 31.834646 | 129 | 0.679941 | import tensorflow as tf
from utils.ops import BLSTM, Conv1D, Reshape, Normalize, f_props, scope, log10
from models.network import Separator
class L41ModelV2(Separator):
def __init__(self, graph=None, **kwargs):
kwargs['mask_a'] = 1.0
kwargs['mask_b'] = -1.0
super(L41ModelV2, self).__init__(graph, **kwargs)
... | true | true |
f76be9b01901972b5d07ad2969ec384f5a4cb893 | 5,706 | py | Python | pyalgotrade/twitter/feed.py | ygs1985ygs/pyalgotrade3 | 5481c214891b7bd8ca76fee4e3f5cfcbb9f9de4e | [
"Apache-2.0"
] | 23 | 2017-06-07T04:36:38.000Z | 2021-11-09T10:39:54.000Z | pyalgotrade/twitter/feed.py | ygs1985ygs/pyalgotrade3 | 5481c214891b7bd8ca76fee4e3f5cfcbb9f9de4e | [
"Apache-2.0"
] | 1 | 2018-03-29T16:25:54.000Z | 2018-03-29T16:25:54.000Z | pyalgotrade/twitter/feed.py | ygs1985ygs/pyalgotrade3 | 5481c214891b7bd8ca76fee4e3f5cfcbb9f9de4e | [
"Apache-2.0"
] | 12 | 2017-03-29T08:35:32.000Z | 2020-02-08T04:01:03.000Z | # PyAlgoTrade
#
# Copyright 2011-2015 Gabriel Martin Becedillas Ruiz
#
# 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 ap... | 34.167665 | 123 | 0.669471 |
import queue
import threading
import json
from pyalgotrade import observer
import pyalgotrade.logger
import tweepy
from tweepy import streaming
logger = pyalgotrade.logger.getLogger("twitter")
class Listener(streaming.StreamListener):
def __init__(self, queue):
super(Listener, self).__init__()
... | true | true |
f76bea3c13dcc6d7c93a42ea5e85170a35748abb | 651 | py | Python | fusion_tables/app_settings.py | bsvetchine/django-fusion-tables | 785461c670cc54e0509d230adc82f4c6c804f7e3 | [
"MIT"
] | 1 | 2017-08-09T19:11:05.000Z | 2017-08-09T19:11:05.000Z | fusion_tables/app_settings.py | bsvetchine/django-fusion-tables | 785461c670cc54e0509d230adc82f4c6c804f7e3 | [
"MIT"
] | null | null | null | fusion_tables/app_settings.py | bsvetchine/django-fusion-tables | 785461c670cc54e0509d230adc82f4c6c804f7e3 | [
"MIT"
] | null | null | null | from django.conf import settings
MODELS_TO_SYNC = getattr(settings, "MODELS_TO_SYNC")
CLIENT_SECRET_JSON_FILEPATH = getattr(settings, "CLIENT_SECRET_JSON_FILEPATH")
DELEGATED_CREDENTIALS = getattr(settings, "DELEGATED_CREDENTIALS", "")
DATETIME_FIELDS = getattr(settings, "DATETIME_FIELDS", (
"DateField", "Datetim... | 46.5 | 78 | 0.771121 | from django.conf import settings
MODELS_TO_SYNC = getattr(settings, "MODELS_TO_SYNC")
CLIENT_SECRET_JSON_FILEPATH = getattr(settings, "CLIENT_SECRET_JSON_FILEPATH")
DELEGATED_CREDENTIALS = getattr(settings, "DELEGATED_CREDENTIALS", "")
DATETIME_FIELDS = getattr(settings, "DATETIME_FIELDS", (
"DateField", "Datetim... | true | true |
f76bea4a2cd81e54cbb23906381f15c5a532fa02 | 33,836 | py | Python | netapp/santricity/api/v2/drive_firmware_api.py | NetApp/santricity-webapi-pythonsdk | 1d3df4a00561192f4cdcdd1890f4d27547ed2de2 | [
"BSD-3-Clause-Clear"
] | 5 | 2016-08-23T17:52:22.000Z | 2019-05-16T08:45:30.000Z | netapp/santricity/api/v2/drive_firmware_api.py | NetApp/santricity-webapi-pythonsdk | 1d3df4a00561192f4cdcdd1890f4d27547ed2de2 | [
"BSD-3-Clause-Clear"
] | 2 | 2016-11-10T05:30:21.000Z | 2019-04-05T15:03:37.000Z | netapp/santricity/api/v2/drive_firmware_api.py | NetApp/santricity-webapi-pythonsdk | 1d3df4a00561192f4cdcdd1890f4d27547ed2de2 | [
"BSD-3-Clause-Clear"
] | 7 | 2016-08-25T16:11:44.000Z | 2021-02-22T05:31:25.000Z | #!/usr/bin/env python
# coding: utf-8
"""
DriveFirmwareApi.py
The Clear BSD License
Copyright (c) – 2016, NetApp, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the foll... | 39.344186 | 845 | 0.523437 |
from __future__ import absolute_import
import sys
import os
from six import iteritems
from ....santricity.configuration import Configuration
from ....santricity.api_client import ApiClient
class DriveFirmwareApi(object):
def __init__(self, api_client=None):
config = Configuration()
if api_cli... | true | true |
f76beb82056878b30f100275177d3cb8ebf76ac8 | 8,503 | py | Python | env.clearblockd/lib/python2.7/site-packages/PIL/PyAccess.py | Organizational-Proof-Of-Work/clearinghoused_build | 7bab4ccb516015913bad41cfdc9eb15d3fbfcaf4 | [
"MIT"
] | 30 | 2015-02-18T14:07:00.000Z | 2021-12-11T15:19:01.000Z | env.clearblockd/lib/python2.7/site-packages/PIL/PyAccess.py | Organizational-Proof-Of-Work/clearinghoused_build | 7bab4ccb516015913bad41cfdc9eb15d3fbfcaf4 | [
"MIT"
] | 16 | 2015-01-01T23:17:24.000Z | 2015-04-18T23:49:27.000Z | lib/python2.7/site-packages/PIL/PyAccess.py | keithhamilton/blackmaas | 2ed2a8f0451c92a98cae99adee95b6b3411019d0 | [
"BSD-3-Clause"
] | 31 | 2015-03-11T20:04:07.000Z | 2020-11-02T13:56:59.000Z | #
# The Python Imaging Library
# Pillow fork
#
# Python implementation of the PixelAccess Object
#
# Copyright (c) 1997-2009 by Secret Labs AB. All rights reserved.
# Copyright (c) 1995-2009 by Fredrik Lundh.
# Copyright (c) 2013 Eric Soroos
#
# See the README file for information on usage and redistribution
#
# Note... | 28.533557 | 97 | 0.572739 |
# * Taking only the tuple form, which is used from python.
# * Fill.c uses the integer form, but it's still going to use the old Access.c implementation.
from __future__ import print_function
from cffi import FFI
import sys
DEBUG = 0
defs = """
struct Pixel_RGBA {
unsigned char r,g,b,a;
};
struct Pixel... | true | true |
f76bedc025eb7d436e5deb16b7ca829b175ae902 | 5,274 | py | Python | huaweicloud-sdk-iotda/huaweicloudsdkiotda/v5/model/mqs_forwarding.py | wuchen-huawei/huaweicloud-sdk-python-v3 | 3683d703f4320edb2b8516f36f16d485cff08fc2 | [
"Apache-2.0"
] | 1 | 2021-04-16T07:59:28.000Z | 2021-04-16T07:59:28.000Z | huaweicloud-sdk-iotda/huaweicloudsdkiotda/v5/model/mqs_forwarding.py | wuchen-huawei/huaweicloud-sdk-python-v3 | 3683d703f4320edb2b8516f36f16d485cff08fc2 | [
"Apache-2.0"
] | null | null | null | huaweicloud-sdk-iotda/huaweicloudsdkiotda/v5/model/mqs_forwarding.py | wuchen-huawei/huaweicloud-sdk-python-v3 | 3683d703f4320edb2b8516f36f16d485cff08fc2 | [
"Apache-2.0"
] | 1 | 2022-01-17T02:24:18.000Z | 2022-01-17T02:24:18.000Z | # coding: utf-8
import pprint
import re
import six
class MqsForwarding:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is j... | 24.416667 | 100 | 0.556314 |
import pprint
import re
import six
class MqsForwarding:
sensitive_list = []
sensitive_list.append('password')
openapi_types = {
'url': 'str',
'user_name': 'str',
'password': 'str',
'topic': 'str',
'encrypt_transport': 'bool'
}
attribute_map = {
... | true | true |
f76bee7c80ea8c4a4cb87f4dd4bc4cf6545124a4 | 388 | py | Python | books/masteringPython/cp10/source_test/mock_delete.py | Bingwen-Hu/hackaway | 69727d76fd652390d9660e9ea4354ba5cc76dd5c | [
"BSD-2-Clause"
] | null | null | null | books/masteringPython/cp10/source_test/mock_delete.py | Bingwen-Hu/hackaway | 69727d76fd652390d9660e9ea4354ba5cc76dd5c | [
"BSD-2-Clause"
] | null | null | null | books/masteringPython/cp10/source_test/mock_delete.py | Bingwen-Hu/hackaway | 69727d76fd652390d9660e9ea4354ba5cc76dd5c | [
"BSD-2-Clause"
] | null | null | null | import os
from unittest import mock
def delete_file(filename):
while os.path.exists(filename):
os.unlink(filename)
@mock.patch('os.path.exists', side_effect=(True, False, False))
@mock.patch('os.unlink')
def test_delete_file(mock_exists, mock_unlink):
# first try:
delete_file('some non-existing ... | 21.555556 | 63 | 0.706186 | import os
from unittest import mock
def delete_file(filename):
while os.path.exists(filename):
os.unlink(filename)
@mock.patch('os.path.exists', side_effect=(True, False, False))
@mock.patch('os.unlink')
def test_delete_file(mock_exists, mock_unlink):
delete_file('some non-existing file')
... | true | true |
f76bef6257016e930071b7bb32f707d84c3d9b39 | 2,192 | py | Python | tests/config_test.py | mediaonegroup/WPWatcher | a8289af766e604e1c8f7d538513bf69dd74bfb50 | [
"Apache-2.0"
] | 27 | 2020-03-22T08:15:19.000Z | 2022-02-09T14:51:25.000Z | tests/config_test.py | mediaonegroup/WPWatcher | a8289af766e604e1c8f7d538513bf69dd74bfb50 | [
"Apache-2.0"
] | 38 | 2020-04-09T14:59:36.000Z | 2021-04-25T20:10:19.000Z | tests/config_test.py | mediaonegroup/WPWatcher | a8289af766e604e1c8f7d538513bf69dd74bfb50 | [
"Apache-2.0"
] | 11 | 2020-04-17T01:07:19.000Z | 2021-11-12T00:08:34.000Z | import unittest
import os
from . import DEFAULT_CONFIG
from wpwatcher.config import Config
class T(unittest.TestCase):
def test_init_config_from_string(self):
# Test minimal config
config_dict=Config.fromstring(DEFAULT_CONFIG)
self.assertEqual(config_dict['email_to'], ["test@mail.com"... | 38.45614 | 141 | 0.679745 | import unittest
import os
from . import DEFAULT_CONFIG
from wpwatcher.config import Config
class T(unittest.TestCase):
def test_init_config_from_string(self):
config_dict=Config.fromstring(DEFAULT_CONFIG)
self.assertEqual(config_dict['email_to'], ["test@mail.com"])
self.assert... | true | true |
f76befb8f1ec575ec8cb39fc17fa44e406135eda | 1,985 | py | Python | tests/stats_logger_tests.py | Manikantan22/incubator-superset | ec325c871e60ae2a050aae595b430d6fc2888d1a | [
"Apache-2.0"
] | 16 | 2017-01-22T19:24:02.000Z | 2021-04-29T05:34:33.000Z | tests/stats_logger_tests.py | Odirlei-Stein/incubator-superset | 52afc33b31475536b287b56d262b9eaa32f479ab | [
"Apache-2.0"
] | 339 | 2017-03-09T00:02:21.000Z | 2022-03-29T22:28:50.000Z | tests/stats_logger_tests.py | Odirlei-Stein/incubator-superset | 52afc33b31475536b287b56d262b9eaa32f479ab | [
"Apache-2.0"
] | 14 | 2019-05-31T11:32:40.000Z | 2021-01-28T11:18:16.000Z | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 39.7 | 76 | 0.730479 | from unittest import TestCase
from unittest.mock import Mock, patch
from superset.stats_logger import StatsdStatsLogger
class StatsdStatsLoggerTest(TestCase):
def verify_client_calls(self, logger, client):
logger.incr("foo1")
client.incr.assert_called_once()
client.incr.assert_called_with... | true | true |
f76befc8b1ab1d3d25865e3bd89f1df6fbeb08d5 | 2,755 | py | Python | setup.py | nicoddemus/yappi | f1a8e9bc9d37f167768cbfbfd67b0267c5983723 | [
"MIT"
] | null | null | null | setup.py | nicoddemus/yappi | f1a8e9bc9d37f167768cbfbfd67b0267c5983723 | [
"MIT"
] | null | null | null | setup.py | nicoddemus/yappi | f1a8e9bc9d37f167768cbfbfd67b0267c5983723 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import os
import sys
from setuptools import setup
from distutils.core import Extension
from distutils.ccompiler import new_compiler
f = open('README.md')
long_description = f.read()
HOMEPAGE = "https://github.com/sumerc/yappi"
NAME = "yappi"
VERSION = "0.99"
_DEBUG = False # compile/link code f... | 30.955056 | 98 | 0.650817 |
import os
import sys
from setuptools import setup
from distutils.core import Extension
from distutils.ccompiler import new_compiler
f = open('README.md')
long_description = f.read()
HOMEPAGE = "https://github.com/sumerc/yappi"
NAME = "yappi"
VERSION = "0.99"
_DEBUG = False _PROFILE = False
user_macros = []
user_lib... | true | true |
f76bf06c3967b94943ab7312e8491b8802239f45 | 831 | py | Python | mmdet3d/models/dense_heads/__init__.py | jhkim-spa/FVNet_v2 | 2f3ef6f00107fab4ce3566a8ff42b5c44ae346c2 | [
"Apache-2.0"
] | 2 | 2022-01-26T03:20:15.000Z | 2022-03-08T14:12:38.000Z | mmdet3d/models/dense_heads/__init__.py | jhkim-spa/FVNet_v2 | 2f3ef6f00107fab4ce3566a8ff42b5c44ae346c2 | [
"Apache-2.0"
] | null | null | null | mmdet3d/models/dense_heads/__init__.py | jhkim-spa/FVNet_v2 | 2f3ef6f00107fab4ce3566a8ff42b5c44ae346c2 | [
"Apache-2.0"
] | null | null | null | from .anchor3d_head import Anchor3DHead
from .anchor_free_mono3d_head import AnchorFreeMono3DHead
from .base_conv_bbox_head import BaseConvBboxHead
from .base_mono3d_dense_head import BaseMono3DDenseHead
from .centerpoint_head import CenterHead
from .fcos_mono3d_head import FCOSMono3DHead
from .free_anchor3d_head impor... | 39.571429 | 68 | 0.831528 | from .anchor3d_head import Anchor3DHead
from .anchor_free_mono3d_head import AnchorFreeMono3DHead
from .base_conv_bbox_head import BaseConvBboxHead
from .base_mono3d_dense_head import BaseMono3DDenseHead
from .centerpoint_head import CenterHead
from .fcos_mono3d_head import FCOSMono3DHead
from .free_anchor3d_head impor... | true | true |
f76bf08ba5cc8fe1f8f11a80fc4cfa837b24bf68 | 718 | py | Python | ecommerce/checkout/models.py | starboi02/e-commerce-CMS | 9307854521a44d4277a0045541c0754201f3c1ff | [
"Apache-2.0"
] | 2 | 2020-04-21T19:49:48.000Z | 2022-03-26T10:24:15.000Z | ecommerce/checkout/models.py | starboi02/e-commerce-CMS | 9307854521a44d4277a0045541c0754201f3c1ff | [
"Apache-2.0"
] | 8 | 2020-02-02T05:45:39.000Z | 2021-06-10T19:43:24.000Z | ecommerce/checkout/models.py | starboi02/e-commerce-CMS | 9307854521a44d4277a0045541c0754201f3c1ff | [
"Apache-2.0"
] | 6 | 2020-02-02T13:50:58.000Z | 2021-10-04T17:43:41.000Z | from django.db import models
from django.forms import ModelForm
from django.contrib.auth import get_user_model
# Create your models here.
# Get the user model
User = get_user_model()
class BillingAddress(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
address = models.CharField(max_length=1... | 24.758621 | 57 | 0.766017 | from django.db import models
from django.forms import ModelForm
from django.contrib.auth import get_user_model
User = get_user_model()
class BillingAddress(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
address = models.CharField(max_length=100)
zipcode = models.CharField(max_length=50)
... | true | true |
f76bf09b60be3cf1f9a211d0ad0dc6a8e6310632 | 1,966 | py | Python | jesse/indicators/damiani_volatmeter.py | noenfugler/jesse | 217a3168620a755c1a9576d9deb27105db7dccf8 | [
"MIT"
] | 5 | 2021-05-21T07:39:16.000Z | 2021-11-17T11:08:41.000Z | jesse/indicators/damiani_volatmeter.py | noenfugler/jesse | 217a3168620a755c1a9576d9deb27105db7dccf8 | [
"MIT"
] | null | null | null | jesse/indicators/damiani_volatmeter.py | noenfugler/jesse | 217a3168620a755c1a9576d9deb27105db7dccf8 | [
"MIT"
] | 2 | 2021-05-21T10:14:53.000Z | 2021-05-27T04:39:51.000Z | from collections import namedtuple
import numpy as np
import talib
from numba import njit
from jesse.helpers import get_candle_source
from jesse.helpers import slice_candles
DamianiVolatmeter = namedtuple('DamianiVolatmeter', ['vol', 'anti'])
def damiani_volatmeter(candles: np.ndarray, vis_atr: int = 13, vis_std: ... | 33.322034 | 120 | 0.642421 | from collections import namedtuple
import numpy as np
import talib
from numba import njit
from jesse.helpers import get_candle_source
from jesse.helpers import slice_candles
DamianiVolatmeter = namedtuple('DamianiVolatmeter', ['vol', 'anti'])
def damiani_volatmeter(candles: np.ndarray, vis_atr: int = 13, vis_std: ... | true | true |
f76bf1921f31bd19e5fdbb57b97f7f95c9440bfd | 6,584 | py | Python | create_bg.py | Cury30/Anomaly_detection | fad172f6d9cc8dad73a79bc89290c578d67e2b35 | [
"MIT"
] | 1 | 2021-10-13T03:49:24.000Z | 2021-10-13T03:49:24.000Z | create_bg.py | Cury30/Anomaly_detection | fad172f6d9cc8dad73a79bc89290c578d67e2b35 | [
"MIT"
] | null | null | null | create_bg.py | Cury30/Anomaly_detection | fad172f6d9cc8dad73a79bc89290c578d67e2b35 | [
"MIT"
] | 2 | 2021-05-25T17:45:23.000Z | 2021-05-25T23:21:26.000Z | import cv2
import os
import numpy as np
import argparse
import uuid
import sys
import scipy.spatial
import matplotlib.pyplot as plt
model_path = str(sys.argv[1])
ROADMASKDIR = model_path + "/RoadMask/"
MINUTEMASKDIR = model_path + "/MinuteMask/"
#INPUTVIDEOPATH = os.environ['AICITYVIDEOPATH'] + "/test-data/"
INPUTVID... | 38.057803 | 117 | 0.574575 | import cv2
import os
import numpy as np
import argparse
import uuid
import sys
import scipy.spatial
import matplotlib.pyplot as plt
model_path = str(sys.argv[1])
ROADMASKDIR = model_path + "/RoadMask/"
MINUTEMASKDIR = model_path + "/MinuteMask/"
INPUTVIDEOPATH = model_path + "/Dataset/"
darktexfile=open("dark.txt","w... | true | true |
f76bf215b059f317c9ad61f90d151ac3137850cc | 3,349 | py | Python | txstatsd/server/protocol.py | drawks/txstatsd | da674d7a86e0e5ec40eaa53fe81310ef19d1ed9e | [
"MIT"
] | null | null | null | txstatsd/server/protocol.py | drawks/txstatsd | da674d7a86e0e5ec40eaa53fe81310ef19d1ed9e | [
"MIT"
] | 1 | 2020-07-10T23:35:49.000Z | 2020-07-10T23:35:49.000Z | txstatsd/server/protocol.py | drawks/txstatsd | da674d7a86e0e5ec40eaa53fe81310ef19d1ed9e | [
"MIT"
] | 1 | 2020-07-13T05:31:58.000Z | 2020-07-13T05:31:58.000Z | # Copyright (C) 2011-2012 Canonical Services 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, ... | 38.94186 | 78 | 0.707973 |
from twisted.internet.protocol import (
DatagramProtocol, Factory)
from twisted.protocols.basic import LineReceiver
class StatsDServerProtocol(DatagramProtocol):
"""A Twisted-based implementation of the StatsD server.
Data is received via UDP for local aggregation and then sent to a Graphite
server ... | false | true |
f76bf285bbbab52faad7b4a5b8a82c739eceffcb | 1,328 | py | Python | tests/numpy_random_test.py | vrserpa/pandas-dev-flaker | 8be2d085171053511c1440f2dc29fbe5fc022c25 | [
"MIT",
"BSD-3-Clause"
] | 3 | 2021-05-03T21:51:02.000Z | 2022-02-15T13:23:18.000Z | tests/numpy_random_test.py | Pydare/pandas-dev-flaker | 4bd7b6e05d569063f37f9532a2ab8996b9b5cc54 | [
"MIT",
"BSD-3-Clause"
] | 20 | 2021-04-09T20:29:33.000Z | 2021-04-12T17:10:23.000Z | tests/numpy_random_test.py | Pydare/pandas-dev-flaker | 4bd7b6e05d569063f37f9532a2ab8996b9b5cc54 | [
"MIT",
"BSD-3-Clause"
] | 4 | 2021-06-19T15:47:48.000Z | 2022-01-02T12:22:03.000Z | import ast
import tokenize
from io import StringIO
import pytest
from pandas_dev_flaker.__main__ import run
def results(s):
return {
"{}:{}: {}".format(*r)
for r in run(
ast.parse(s),
list(tokenize.generate_tokens(StringIO(s).readline)),
)
}
@pytest.mark.par... | 21.419355 | 65 | 0.53238 | import ast
import tokenize
from io import StringIO
import pytest
from pandas_dev_flaker.__main__ import run
def results(s):
return {
"{}:{}: {}".format(*r)
for r in run(
ast.parse(s),
list(tokenize.generate_tokens(StringIO(s).readline)),
)
}
@pytest.mark.par... | true | true |
f76bf2a7892f6f66e96bd5a457de93a10b1045e0 | 98,582 | py | Python | numpy/lib/function_base.py | qpython-android/QPypi-numpy | 4e5fa5c2e01bb6250537fe44f426f878a240bcc7 | [
"BSD-3-Clause"
] | 7 | 2016-11-29T18:01:53.000Z | 2018-08-21T09:45:15.000Z | numpy/lib/function_base.py | qpython-lab/QPypi-numpy | 4e5fa5c2e01bb6250537fe44f426f878a240bcc7 | [
"BSD-3-Clause"
] | 1 | 2016-06-28T14:03:59.000Z | 2016-06-28T14:03:59.000Z | numpy/lib/function_base.py | qpython-libs/QPypi-numpy | 4e5fa5c2e01bb6250537fe44f426f878a240bcc7 | [
"BSD-3-Clause"
] | 3 | 2016-10-19T00:41:31.000Z | 2020-03-01T04:57:36.000Z | __docformat__ = "restructuredtext en"
__all__ = ['logspace', 'linspace',
'select', 'piecewise', 'trim_zeros',
'copy', 'iterable',
'diff', 'gradient', 'angle', 'unwrap', 'sort_complex', 'disp',
'unique', 'extract', 'place', 'nansum', 'nanmax', 'nanargmax',
'nanargmi... | 30.47357 | 108 | 0.571616 | __docformat__ = "restructuredtext en"
__all__ = ['logspace', 'linspace',
'select', 'piecewise', 'trim_zeros',
'copy', 'iterable',
'diff', 'gradient', 'angle', 'unwrap', 'sort_complex', 'disp',
'unique', 'extract', 'place', 'nansum', 'nanmax', 'nanargmax',
'nanargmi... | false | true |
f76bf2bee7d447f9c8655330d23a59ae4c955ec8 | 329 | py | Python | topnav_capo2/scripts/driver/dummy/dummy_wheels_driver.py | kasptom/topnav_ros_kasptom | 9e7cd97ac0f5f22544880d71bcc91c9db4de528a | [
"Apache-2.0"
] | null | null | null | topnav_capo2/scripts/driver/dummy/dummy_wheels_driver.py | kasptom/topnav_ros_kasptom | 9e7cd97ac0f5f22544880d71bcc91c9db4de528a | [
"Apache-2.0"
] | null | null | null | topnav_capo2/scripts/driver/dummy/dummy_wheels_driver.py | kasptom/topnav_ros_kasptom | 9e7cd97ac0f5f22544880d71bcc91c9db4de528a | [
"Apache-2.0"
] | null | null | null | from driver.interface_wheels_driver import IWheelsDriver
class DummyWheelsDriver(IWheelsDriver):
def set_velocity(self, left_wheel, right_wheel):
print('setting velocity to %.2f, %.2f' % (left_wheel, right_wheel))
def stop_wheels(self):
self.set_velocity(0, 0)
def stop_driver(self):
... | 25.307692 | 75 | 0.705167 | from driver.interface_wheels_driver import IWheelsDriver
class DummyWheelsDriver(IWheelsDriver):
def set_velocity(self, left_wheel, right_wheel):
print('setting velocity to %.2f, %.2f' % (left_wheel, right_wheel))
def stop_wheels(self):
self.set_velocity(0, 0)
def stop_driver(self):
... | true | true |
f76bf3988f0971d6efe8082a5f37cf54f0df381d | 297 | py | Python | clipmanager/hotkey/__init__.py | scottwernervt/clipmanager | 34e9f45f7d9a3cef423d9d54df5d220aed5fd821 | [
"BSD-4-Clause"
] | 12 | 2016-02-11T04:14:35.000Z | 2021-12-16T08:13:05.000Z | clipmanager/hotkey/__init__.py | scottwernervt/clipmanager | 34e9f45f7d9a3cef423d9d54df5d220aed5fd821 | [
"BSD-4-Clause"
] | 11 | 2018-02-01T21:20:08.000Z | 2018-07-20T16:02:01.000Z | clipmanager/hotkey/__init__.py | scottwernervt/clipmanager | 34e9f45f7d9a3cef423d9d54df5d220aed5fd821 | [
"BSD-4-Clause"
] | null | null | null | import os
def initialize():
if os.name == 'nt':
from clipmanager.hotkey.win32 import GlobalHotkeyManagerWin
return GlobalHotkeyManagerWin()
elif os.name == 'posix':
from clipmanager.hotkey.x11 import GlobalHotkeyManagerX11
return GlobalHotkeyManagerX11()
| 27 | 67 | 0.700337 | import os
def initialize():
if os.name == 'nt':
from clipmanager.hotkey.win32 import GlobalHotkeyManagerWin
return GlobalHotkeyManagerWin()
elif os.name == 'posix':
from clipmanager.hotkey.x11 import GlobalHotkeyManagerX11
return GlobalHotkeyManagerX11()
| true | true |
f76bf44457b0e5907c8846a95231eaa319edc9f6 | 10,646 | py | Python | qiskit_experiments/library/quantum_volume/qv_analysis.py | spencerking/qiskit-experiments | 11a254b010afe35933aaabac70de12b5b5a244bf | [
"Apache-2.0"
] | 1 | 2022-03-31T06:56:04.000Z | 2022-03-31T06:56:04.000Z | qiskit_experiments/library/quantum_volume/qv_analysis.py | spencerking/qiskit-experiments | 11a254b010afe35933aaabac70de12b5b5a244bf | [
"Apache-2.0"
] | 1 | 2021-06-01T01:43:52.000Z | 2021-06-01T01:43:52.000Z | qiskit_experiments/library/quantum_volume/qv_analysis.py | spencerking/qiskit-experiments | 11a254b010afe35933aaabac70de12b5b5a244bf | [
"Apache-2.0"
] | 2 | 2021-05-17T10:13:20.000Z | 2021-06-01T01:34:34.000Z | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... | 34.677524 | 99 | 0.601728 |
import math
import warnings
from typing import Optional
import numpy as np
from qiskit_experiments.framework import BaseAnalysis, AnalysisResultData, FitVal
from qiskit_experiments.curve_analysis import plot_scatter, plot_errorbar
class QuantumVolumeAnalysis(BaseAnalysis):
def _run_analysis(
self,... | true | true |
f76bf5a7e02adcc4b91f04d4566ff5dc7e566a94 | 6,827 | py | Python | node_manager_fkie/src/node_manager_fkie/menu_rqt.py | ahoarau/multimaster_fkie | 82bf341423bd3c2a15005c85eca9de5747cb8069 | [
"BSD-3-Clause"
] | 1 | 2020-03-10T06:32:51.000Z | 2020-03-10T06:32:51.000Z | node_manager_fkie/src/node_manager_fkie/menu_rqt.py | ahoarau/multimaster_fkie | 82bf341423bd3c2a15005c85eca9de5747cb8069 | [
"BSD-3-Clause"
] | 1 | 2018-04-20T13:03:34.000Z | 2018-04-20T13:03:34.000Z | node_manager_fkie/src/node_manager_fkie/menu_rqt.py | ahoarau/multimaster_fkie | 82bf341423bd3c2a15005c85eca9de5747cb8069 | [
"BSD-3-Clause"
] | 1 | 2018-11-07T03:37:23.000Z | 2018-11-07T03:37:23.000Z | # Software License Agreement (BSD License)
#
# Copyright (c) 2012, Fraunhofer FKIE/US, Alexander Tiderko
# 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 mus... | 53.335938 | 132 | 0.603486 |
from python_qt_binding.QtCore import Signal
try:
from python_qt_binding.QtGui import QAction, QMenu
except:
from python_qt_binding.QtWidgets import QAction, QMenu
from python_qt_binding.QtGui import QIcon
import roslib
class MenuRqt(QMenu):
'''
This creates a menu to start a several rqt plugins.
... | false | true |
f76bf67c4de3b8554459967a938ae479374d17bb | 1,282 | py | Python | src/robusta/integrations/kubernetes/base_event.py | kandahk/robusta | 61a2001cb1c4e90e8a74b810463ec99e6cb80787 | [
"MIT"
] | null | null | null | src/robusta/integrations/kubernetes/base_event.py | kandahk/robusta | 61a2001cb1c4e90e8a74b810463ec99e6cb80787 | [
"MIT"
] | null | null | null | src/robusta/integrations/kubernetes/base_event.py | kandahk/robusta | 61a2001cb1c4e90e8a74b810463ec99e6cb80787 | [
"MIT"
] | 1 | 2022-02-20T01:49:36.000Z | 2022-02-20T01:49:36.000Z | from typing import Optional
from dataclasses import dataclass
from hikaru.meta import HikaruDocumentBase
from ...core.reporting import Finding
from ...core.model.k8s_operation_type import K8sOperationType
from ...core.model.events import ExecutionBaseEvent
@dataclass
class K8sBaseChangeEvent(ExecutionBaseEvent):
... | 33.736842 | 112 | 0.656786 | from typing import Optional
from dataclasses import dataclass
from hikaru.meta import HikaruDocumentBase
from ...core.reporting import Finding
from ...core.model.k8s_operation_type import K8sOperationType
from ...core.model.events import ExecutionBaseEvent
@dataclass
class K8sBaseChangeEvent(ExecutionBaseEvent):
... | true | true |
f76bf7fa198186e00d6299fdc04036b6f4af05c9 | 5,598 | py | Python | src/lib/Server/Plugins/Packages/Apt.py | pcmxgti/bcfg2 | 33aaf9c6bbeb0d20eef084b1347a0fce42086663 | [
"mpich2"
] | null | null | null | src/lib/Server/Plugins/Packages/Apt.py | pcmxgti/bcfg2 | 33aaf9c6bbeb0d20eef084b1347a0fce42086663 | [
"mpich2"
] | null | null | null | src/lib/Server/Plugins/Packages/Apt.py | pcmxgti/bcfg2 | 33aaf9c6bbeb0d20eef084b1347a0fce42086663 | [
"mpich2"
] | null | null | null | import re
import gzip
from Bcfg2.Server.Plugins.Packages.Collection import Collection
from Bcfg2.Server.Plugins.Packages.Source import Source
from Bcfg2.Bcfg2Py3k import cPickle, file
class AptCollection(Collection):
def get_group(self, group):
self.logger.warning("Packages: Package groups are not supporte... | 39.985714 | 80 | 0.469632 | import re
import gzip
from Bcfg2.Server.Plugins.Packages.Collection import Collection
from Bcfg2.Server.Plugins.Packages.Source import Source
from Bcfg2.Bcfg2Py3k import cPickle, file
class AptCollection(Collection):
def get_group(self, group):
self.logger.warning("Packages: Package groups are not supporte... | true | true |
f76bf815b5d277ad61b929b217e676b8951d4a3b | 89 | py | Python | memtkinter/messagebox.py | JamesGKent/memtkinter | c4e178b33f24e609c812b20bddfff7448782a192 | [
"MIT"
] | null | null | null | memtkinter/messagebox.py | JamesGKent/memtkinter | c4e178b33f24e609c812b20bddfff7448782a192 | [
"MIT"
] | 3 | 2018-06-04T09:32:20.000Z | 2018-06-07T15:27:56.000Z | memtkinter/messagebox.py | JamesGKent/memtkinter | c4e178b33f24e609c812b20bddfff7448782a192 | [
"MIT"
] | null | null | null | try:
from tkinter.messagebox import *
except ImportError:
from tkMessageBox import * | 22.25 | 34 | 0.775281 | try:
from tkinter.messagebox import *
except ImportError:
from tkMessageBox import * | true | true |
f76bf84383e1716dcd621bbc286c5e1854ff31f1 | 5,089 | py | Python | rx/concurrency/mainloopscheduler/asyncioscheduler.py | MichaelSchneeberger/RxPY | 994f974d37783f63c5d9e018a316fa9b06ba9337 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | rx/concurrency/mainloopscheduler/asyncioscheduler.py | MichaelSchneeberger/RxPY | 994f974d37783f63c5d9e018a316fa9b06ba9337 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | rx/concurrency/mainloopscheduler/asyncioscheduler.py | MichaelSchneeberger/RxPY | 994f974d37783f63c5d9e018a316fa9b06ba9337 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | import logging
import asyncio
from datetime import datetime
from concurrent.futures import Future
from rx.disposable import Disposable
from rx.core import typing
from rx.disposable import SingleAssignmentDisposable, CompositeDisposable
from rx.concurrency.schedulerbase import SchedulerBase
log = logging.getLogger("Rx... | 32.208861 | 106 | 0.627825 | import logging
import asyncio
from datetime import datetime
from concurrent.futures import Future
from rx.disposable import Disposable
from rx.core import typing
from rx.disposable import SingleAssignmentDisposable, CompositeDisposable
from rx.concurrency.schedulerbase import SchedulerBase
log = logging.getLogger("Rx... | true | true |
f76bf8b9680cd65547d06eea77dbf79836d85ae1 | 18,013 | py | Python | Packs/GreyNoise/Integrations/GreyNoise/test_data/input_data.py | cbrake1/content | 5b031129f98935c492056675eeee0fefcacbd87b | [
"MIT"
] | 2 | 2020-07-27T10:35:41.000Z | 2020-12-14T15:44:18.000Z | Packs/GreyNoise/Integrations/GreyNoise/test_data/input_data.py | cbrake1/content | 5b031129f98935c492056675eeee0fefcacbd87b | [
"MIT"
] | 30 | 2022-03-16T14:07:34.000Z | 2022-03-31T17:37:51.000Z | Packs/GreyNoise/Integrations/GreyNoise/test_data/input_data.py | cbrake1/content | 5b031129f98935c492056675eeee0fefcacbd87b | [
"MIT"
] | 1 | 2022-01-23T17:30:09.000Z | 2022-01-23T17:30:09.000Z | import copy
valid_ip_response = {
"ip": "71.6.135.131", # NOSONAR
"seen": True,
"classification": "malicious",
"first_seen": "2019-04-04",
"last_seen": "2019-08-21",
"actor": "unknown",
"tags": [
"MSSQL Bruteforcer",
"MSSQL Scanner",
"RDP Scanner"
],
"vpn": ... | 33.986792 | 120 | 0.496808 | import copy
valid_ip_response = {
"ip": "71.6.135.131", "seen": True,
"classification": "malicious",
"first_seen": "2019-04-04",
"last_seen": "2019-08-21",
"actor": "unknown",
"tags": [
"MSSQL Bruteforcer",
"MSSQL Scanner",
"RDP Scanner"
],
"vpn": True,
... | true | true |
f76bfb6a04250e47ecbd4dda4227a8ec3d28eaab | 31,631 | py | Python | tensorflow_federated/python/core/utils/encoding_utils_test.py | houcharlie/federated-legacy | cb10a9cdcea33288f8113e7445782d21c8c65f81 | [
"Apache-2.0"
] | null | null | null | tensorflow_federated/python/core/utils/encoding_utils_test.py | houcharlie/federated-legacy | cb10a9cdcea33288f8113e7445782d21c8c65f81 | [
"Apache-2.0"
] | null | null | null | tensorflow_federated/python/core/utils/encoding_utils_test.py | houcharlie/federated-legacy | cb10a9cdcea33288f8113e7445782d21c8c65f81 | [
"Apache-2.0"
] | 1 | 2022-02-27T18:31:12.000Z | 2022-02-27T18:31:12.000Z | # Copyright 2019, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 46.042213 | 88 | 0.732193 |
import warnings
from absl.testing import parameterized
import numpy as np
import tensorflow as tf
from tensorflow_federated.python.common_libs import test
from tensorflow_federated.python.core.api import computation_types
from tensorflow_federated.python.core.api import computations
from tensorflow_federated.python.... | true | true |
f76bfc24a52f132812815dcfb7ff92c28663b646 | 5,128 | py | Python | tests/file_io/ntfs_file_io.py | Acidburn0zzz/dfvfs | 3db8c4e520e3e7527faffeea8f52187c861fa3b6 | [
"Apache-2.0"
] | 1 | 2019-08-28T23:47:16.000Z | 2019-08-28T23:47:16.000Z | tests/file_io/ntfs_file_io.py | Acidburn0zzz/dfvfs | 3db8c4e520e3e7527faffeea8f52187c861fa3b6 | [
"Apache-2.0"
] | null | null | null | tests/file_io/ntfs_file_io.py | Acidburn0zzz/dfvfs | 3db8c4e520e3e7527faffeea8f52187c861fa3b6 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the file-like object implementation using pyfsntfs."""
from __future__ import unicode_literals
import os
import unittest
from dfvfs.file_io import ntfs_file_io
from dfvfs.lib import errors
from dfvfs.path import ntfs_path_spec
from dfvfs.path import os_path_... | 31.850932 | 77 | 0.725234 |
from __future__ import unicode_literals
import os
import unittest
from dfvfs.file_io import ntfs_file_io
from dfvfs.lib import errors
from dfvfs.path import ntfs_path_spec
from dfvfs.path import os_path_spec
from dfvfs.path import qcow_path_spec
from dfvfs.resolver import context
from tests.file_io import test_lib
... | true | true |
f76bfd315e59d711b9ec9004fde54244a51a2e67 | 3,419 | py | Python | migrations/versions/9e4bb9179aca_.py | pulkitsaxena14/agrofarm | 94d7176db4ad03ea0c3825c68739b8634d6db05e | [
"MIT"
] | 1 | 2020-10-07T19:28:36.000Z | 2020-10-07T19:28:36.000Z | migrations/versions/9e4bb9179aca_.py | pulkitsaxena14/agrofarm | 94d7176db4ad03ea0c3825c68739b8634d6db05e | [
"MIT"
] | 3 | 2020-10-07T17:48:30.000Z | 2020-10-07T19:24:45.000Z | migrations/versions/9e4bb9179aca_.py | pulkitsaxena14/agrofarm | 94d7176db4ad03ea0c3825c68739b8634d6db05e | [
"MIT"
] | 1 | 2020-10-07T11:30:00.000Z | 2020-10-07T11:30:00.000Z | """empty message
Revision ID: 9e4bb9179aca
Revises:
Create Date: 2020-10-08 00:14:42.284775
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '9e4bb9179aca'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... | 37.571429 | 90 | 0.648728 | from alembic import op
import sqlalchemy as sa
revision = '9e4bb9179aca'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
op.create_table('login',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=20), nullable=True),
sa.Column('email', s... | true | true |
f76bfddda1cc5aa7299521eda1cc317cd0c58aa6 | 17,204 | py | Python | caer/data/__init__.py | MalikMAlna/caer | 96c429ab41ea1c81a7ada8ad961196e649ccea42 | [
"MIT"
] | null | null | null | caer/data/__init__.py | MalikMAlna/caer | 96c429ab41ea1c81a7ada8ad961196e649ccea42 | [
"MIT"
] | null | null | null | caer/data/__init__.py | MalikMAlna/caer | 96c429ab41ea1c81a7ada8ad961196e649ccea42 | [
"MIT"
] | null | null | null | # _____ ______ _____
# / ____/ /\ | ____ | __ \
# | | / \ | |__ | |__) | Caer - Modern Computer Vision
# | | / /\ \ | __| | _ / Languages: Python, C, C++
# | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer
# \_____\/_/ \_ \______ |_| \_\
# Licensed ... | 26.797508 | 91 | 0.588177 |
from ..io import imread
from ..path import abspath, minijoin
from .._base import __curr__
import numpy as np
from ..adorad import Tensor
here = minijoin(__curr__, 'data').replace('\\', "/") + "/"
def _get_path_to_data(name) -> str:
return minijoin(here, name)
def audio_mixer(target_size=None, rgb=True, gr... | true | true |
f76bfe1a4ed0622533fb95d5936400e06db46ee0 | 2,854 | py | Python | inmembrane/plugins/lipop1.py | pansapiens/inmembrane | 382eee3b2bacc9c567f65d7c48f1ddf9a86c253c | [
"BSD-2-Clause"
] | 4 | 2015-03-09T02:08:34.000Z | 2021-02-06T13:52:21.000Z | inmembrane/plugins/lipop1.py | pansapiens/inmembrane | 382eee3b2bacc9c567f65d7c48f1ddf9a86c253c | [
"BSD-2-Clause"
] | 5 | 2015-01-29T03:36:04.000Z | 2021-12-08T07:20:42.000Z | inmembrane/plugins/lipop1.py | pansapiens/inmembrane | 382eee3b2bacc9c567f65d7c48f1ddf9a86c253c | [
"BSD-2-Clause"
] | 6 | 2015-03-09T02:08:43.000Z | 2021-06-07T17:33:16.000Z | # -*- coding: utf-8 -*-
import re
from inmembrane.helpers import run, parse_fasta_header, dict_get
citation = {'ref': u"Agnieszka S. Juncker, Hanni Willenbrock, "
u"Gunnar Von Heijne, Søren Brunak, Henrik Nielsen, "
u"And Anders Krogh. (2003) Prediction of lipoprotein "
... | 36.589744 | 75 | 0.614576 | import re
from inmembrane.helpers import run, parse_fasta_header, dict_get
citation = {'ref': u"Agnieszka S. Juncker, Hanni Willenbrock, "
u"Gunnar Von Heijne, Søren Brunak, Henrik Nielsen, "
u"And Anders Krogh. (2003) Prediction of lipoprotein "
u"signal peptid... | true | true |
f76bfe9c25b04ce79b1a8ed1d117c55648cb796a | 1,391 | py | Python | python-lib/dku_io_utils/dku_file_manager.py | dataiku/dss-plugin-timeseries-forecast | 56980fdab629b5eb27ce4c17e7ba2348c2b2cb28 | [
"Apache-2.0"
] | 11 | 2020-12-21T12:49:26.000Z | 2022-03-11T06:29:49.000Z | python-lib/dku_io_utils/dku_file_manager.py | dataiku/dss-plugin-timeseries-forecast | 56980fdab629b5eb27ce4c17e7ba2348c2b2cb28 | [
"Apache-2.0"
] | 30 | 2020-12-01T18:17:58.000Z | 2022-03-29T21:43:51.000Z | python-lib/dku_file_manager.py | dataiku/dss-plugin-recommendation-system | 6e9667f0991d73e5a9146108e7e7a972f9521c57 | [
"Apache-2.0"
] | 5 | 2021-02-13T12:18:15.000Z | 2021-09-28T15:55:03.000Z | from dataiku.customrecipe import get_input_names_for_role, get_output_names_for_role
import dataiku
from dku_config import DkuConfig
class DkuFileManager(DkuConfig):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def add_file(self, side, type_, role, **kwargs):
file = DkuFileManager... | 37.594595 | 93 | 0.703091 | from dataiku.customrecipe import get_input_names_for_role, get_output_names_for_role
import dataiku
from dku_config import DkuConfig
class DkuFileManager(DkuConfig):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def add_file(self, side, type_, role, **kwargs):
file = DkuFileManager... | true | true |
f76bff7b190ed8188bcfc880bfe65914ddf5d144 | 9,520 | py | Python | src/waveglow/core/inference.py | stefantaubert/waveglow | 5169ec751343a3e3008209a1a2f055e71a65908a | [
"MIT"
] | null | null | null | src/waveglow/core/inference.py | stefantaubert/waveglow | 5169ec751343a3e3008209a1a2f055e71a65908a | [
"MIT"
] | null | null | null | src/waveglow/core/inference.py | stefantaubert/waveglow | 5169ec751343a3e3008209a1a2f055e71a65908a | [
"MIT"
] | null | null | null | import datetime
from dataclasses import dataclass
from logging import Logger
from pathlib import Path
from typing import Callable, Dict, List, Optional, Tuple
import imageio
import numpy as np
import torch
from audio_utils import get_duration_s, normalize_wav
from audio_utils.audio import concatenate_audios
from audio... | 35.129151 | 362 | 0.760609 | import datetime
from dataclasses import dataclass
from logging import Logger
from pathlib import Path
from typing import Callable, Dict, List, Optional, Tuple
import imageio
import numpy as np
import torch
from audio_utils import get_duration_s, normalize_wav
from audio_utils.audio import concatenate_audios
from audio... | true | true |
f76bffc76d7033ae4b7e871e2e63337ed94d4ba0 | 467 | py | Python | packages/python/plotly/plotly/validators/histogram2dcontour/colorbar/_tickvals.py | mastermind88/plotly.py | efa70710df1af22958e1be080e105130042f1839 | [
"MIT"
] | null | null | null | packages/python/plotly/plotly/validators/histogram2dcontour/colorbar/_tickvals.py | mastermind88/plotly.py | efa70710df1af22958e1be080e105130042f1839 | [
"MIT"
] | null | null | null | packages/python/plotly/plotly/validators/histogram2dcontour/colorbar/_tickvals.py | mastermind88/plotly.py | efa70710df1af22958e1be080e105130042f1839 | [
"MIT"
] | null | null | null | import _plotly_utils.basevalidators
class TickvalsValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(
self,
plotly_name="tickvals",
parent_name="histogram2dcontour.colorbar",
**kwargs,
):
super(TickvalsValidator, self).__init__(
plotly_... | 27.470588 | 73 | 0.635974 | import _plotly_utils.basevalidators
class TickvalsValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(
self,
plotly_name="tickvals",
parent_name="histogram2dcontour.colorbar",
**kwargs,
):
super(TickvalsValidator, self).__init__(
plotly_... | true | true |
f76c0011bcc4bba7cd30754f444d555e1c8c3705 | 7,392 | py | Python | netmap/netmap.py | Salem249/vEPC | 7e7cbe6bb63a2f28e907a8ff5326b03aba343457 | [
"CC-BY-3.0"
] | null | null | null | netmap/netmap.py | Salem249/vEPC | 7e7cbe6bb63a2f28e907a8ff5326b03aba343457 | [
"CC-BY-3.0"
] | null | null | null | netmap/netmap.py | Salem249/vEPC | 7e7cbe6bb63a2f28e907a8ff5326b03aba343457 | [
"CC-BY-3.0"
] | null | null | null | import networkx as nx
from host import host
from ryu.topology.switches import Switch
from ryu.topology.switches import Port
class netmap:
def __init__(self):
self.dDummy = "Disconnected"
self.networkMap = nx.Graph()
self.networkMap.add_node(self.dDummy)
def getAllSwitches(self):
... | 39.956757 | 101 | 0.554248 | import networkx as nx
from host import host
from ryu.topology.switches import Switch
from ryu.topology.switches import Port
class netmap:
def __init__(self):
self.dDummy = "Disconnected"
self.networkMap = nx.Graph()
self.networkMap.add_node(self.dDummy)
def getAllSwitches(self):
... | false | true |
f76c0153f5ecf7295c2536586f87cc72d5e12342 | 14,509 | py | Python | Lib/test/multibytecodec_support.py | shawwn/cpython | 0ff8a3b374286d2218fc18f47556a5ace202dad3 | [
"0BSD"
] | 2,441 | 2020-07-31T06:45:53.000Z | 2022-03-30T15:56:49.000Z | Lib/test/multibytecodec_support.py | shawwn/cpython | 0ff8a3b374286d2218fc18f47556a5ace202dad3 | [
"0BSD"
] | 427 | 2017-09-29T22:54:36.000Z | 2022-02-15T19:26:50.000Z | Lib/test/multibytecodec_support.py | shawwn/cpython | 0ff8a3b374286d2218fc18f47556a5ace202dad3 | [
"0BSD"
] | 671 | 2017-09-21T08:04:01.000Z | 2022-03-29T14:30:07.000Z | #
# multibytecodec_support.py
# Common Unittest Routines for CJK codecs
#
import codecs
import os
import re
import sys
import unittest
from http.client import HTTPException
from test import support
from io import BytesIO
class TestBase:
encoding = '' # codec name
codec = None # codec tupl... | 37.783854 | 82 | 0.52974 |
import codecs
import os
import re
import sys
import unittest
from http.client import HTTPException
from test import support
from io import BytesIO
class TestBase:
encoding = '' codec = None tstring = None
codectests = None roundtriptest = 1 has_iso10646 ... | true | true |
f76c015992755439013e26301b1b65424823ba82 | 1,449 | py | Python | python/pe008.py | henxing/projecteulerslns | 72754d60abceef08490e1b25619791c8b680dfd2 | [
"MIT"
] | null | null | null | python/pe008.py | henxing/projecteulerslns | 72754d60abceef08490e1b25619791c8b680dfd2 | [
"MIT"
] | null | null | null | python/pe008.py | henxing/projecteulerslns | 72754d60abceef08490e1b25619791c8b680dfd2 | [
"MIT"
] | null | null | null | from operator import mul
numstr = '73167176531330624919225119674426574742355349194934\
96983520312774506326239578318016984801869478851843\
85861560789112949495459501737958331952853208805511\
12540698747158523863050715693290963295227443043557\
66896648950445244523161731856403098711121722383113\
622298934233803081353362... | 34.5 | 61 | 0.857143 | from operator import mul
numstr = '73167176531330624919225119674426574742355349194934\
96983520312774506326239578318016984801869478851843\
85861560789112949495459501737958331952853208805511\
12540698747158523863050715693290963295227443043557\
66896648950445244523161731856403098711121722383113\
622298934233803081353362... | true | true |
f76c0180a28570301856de24e74213e94b1cbc2d | 1,139 | py | Python | gatewayconfig/processors/led_processor.py | ganey/hm-config | b24dce9d9b10367010d163400b0a1bc8a482b252 | [
"MIT"
] | null | null | null | gatewayconfig/processors/led_processor.py | ganey/hm-config | b24dce9d9b10367010d163400b0a1bc8a482b252 | [
"MIT"
] | null | null | null | gatewayconfig/processors/led_processor.py | ganey/hm-config | b24dce9d9b10367010d163400b0a1bc8a482b252 | [
"MIT"
] | null | null | null | from time import sleep
from gpiozero import LED
from hm_pyhelper.hardware_definitions import is_rockpi, is_raspberry_pi
from gatewayconfig.gatewayconfig_shared_state import GatewayconfigSharedState
from gatewayconfig.logger import get_logger
LOGGER = get_logger(__name__)
LED_REFRESH_SECONDS = 2
class LEDProcessor:
... | 36.741935 | 80 | 0.660228 | from time import sleep
from gpiozero import LED
from hm_pyhelper.hardware_definitions import is_rockpi, is_raspberry_pi
from gatewayconfig.gatewayconfig_shared_state import GatewayconfigSharedState
from gatewayconfig.logger import get_logger
LOGGER = get_logger(__name__)
LED_REFRESH_SECONDS = 2
class LEDProcessor:
... | true | true |
f76c01aacf073c9d599eb5fc6ff3563f9adaf1c9 | 4,433 | py | Python | tools/paconn-cli/paconn/operations/upsert.py | ShowcaseSoftwareLtd/PowerPlatformConnectors | 2d47affad29b452455824df0bc5d418b94587b17 | [
"MIT"
] | 1 | 2020-03-02T06:12:26.000Z | 2020-03-02T06:12:26.000Z | tools/paconn-cli/paconn/operations/upsert.py | ShowcaseSoftwareLtd/PowerPlatformConnectors | 2d47affad29b452455824df0bc5d418b94587b17 | [
"MIT"
] | 1 | 2021-03-03T11:45:39.000Z | 2021-03-03T11:45:39.000Z | tools/paconn-cli/paconn/operations/upsert.py | ShowcaseSoftwareLtd/PowerPlatformConnectors | 2d47affad29b452455824df0bc5d418b94587b17 | [
"MIT"
] | 2 | 2021-06-07T14:59:24.000Z | 2022-02-11T09:19:28.000Z | # -----------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -----------------------------------------------------------------------------
""... | 29.952703 | 94 | 0.684638 |
import os
import json
import urllib.parse
from knack.util import CLIError
from paconn.common.util import ensure_file_exists
from paconn.settings.util import write_settings
from paconn.apimanager.iconuploader import upload_icon
from paconn.operations.json_keys import (
_PROPERTIES,
_ICON_URI,
_OPEN_API_D... | true | true |
f76c01b68041d69c6930fc0e584676ba2ecf3681 | 4,066 | py | Python | kubernetes/client/models/v1_resource_quota_status.py | jraby/kubernetes-client-python | e6e7b710d0b15fbde686bc9dccf00da5951bef84 | [
"Apache-2.0"
] | null | null | null | kubernetes/client/models/v1_resource_quota_status.py | jraby/kubernetes-client-python | e6e7b710d0b15fbde686bc9dccf00da5951bef84 | [
"Apache-2.0"
] | null | null | null | kubernetes/client/models/v1_resource_quota_status.py | jraby/kubernetes-client-python | e6e7b710d0b15fbde686bc9dccf00da5951bef84 | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
... | 28.236111 | 178 | 0.564437 |
from pprint import pformat
from six import iteritems
import re
class V1ResourceQuotaStatus(object):
def __init__(self, hard=None, used=None):
self.swagger_types = {
'hard': 'dict(str, str)',
'used': 'dict(str, str)'
}
self.attribute_map = {
'hard': '... | true | true |
f76c0283e0ecd315929230d155452e231e092874 | 10,109 | py | Python | AppVoor/resources/backend_scripts/parameter_search.py | Noczio/VoorSpelling | 51e30ab3f3b2e346c6eb56578818020e142a3adb | [
"BSD-3-Clause"
] | 3 | 2020-10-09T06:15:14.000Z | 2021-04-27T02:04:28.000Z | AppVoor/resources/backend_scripts/parameter_search.py | Noczio/VoorSpelling | 51e30ab3f3b2e346c6eb56578818020e142a3adb | [
"BSD-3-Clause"
] | 17 | 2020-09-10T20:22:01.000Z | 2020-12-21T04:57:03.000Z | AppVoor/resources/backend_scripts/parameter_search.py | Noczio/VoorSpelling | 51e30ab3f3b2e346c6eb56578818020e142a3adb | [
"BSD-3-Clause"
] | null | null | null | from abc import ABC, abstractmethod
from typing import Any
import numpy as np
import pandas as pd
from sklearn.model_selection import GridSearchCV
from skopt import BayesSearchCV
from skopt.space import Real, Integer, Categorical
from resources.backend_scripts.switcher import Switch
NpArray = np.ndarray
DataFrame = ... | 38.291667 | 119 | 0.547928 | from abc import ABC, abstractmethod
from typing import Any
import numpy as np
import pandas as pd
from sklearn.model_selection import GridSearchCV
from skopt import BayesSearchCV
from skopt.space import Real, Integer, Categorical
from resources.backend_scripts.switcher import Switch
NpArray = np.ndarray
DataFrame = ... | true | true |
f76c02e74aa9420e6d0b675afd5ac8e5011ec712 | 1,276 | py | Python | plugins/NetQuery/DNSQuery/__init__.py | madfordmac/pircons | 1eea5e46e7ea89984d69da2817a86e14f8155202 | [
"MIT"
] | null | null | null | plugins/NetQuery/DNSQuery/__init__.py | madfordmac/pircons | 1eea5e46e7ea89984d69da2817a86e14f8155202 | [
"MIT"
] | null | null | null | plugins/NetQuery/DNSQuery/__init__.py | madfordmac/pircons | 1eea5e46e7ea89984d69da2817a86e14f8155202 | [
"MIT"
] | null | null | null | from .. import NetQuery
import dns.resolver
import logging
import re
class DNSQuery(NetQuery):
"""Query configured or default DNS servers for a particular record."""
def __init__(self, cfg):
super(DNSQuery, self).__init__(cfg)
self.__logger = logging.getLogger('pircons.NetQuery.DNSQuery')
query, nameservers = ... | 38.666667 | 113 | 0.708464 | from .. import NetQuery
import dns.resolver
import logging
import re
class DNSQuery(NetQuery):
def __init__(self, cfg):
super(DNSQuery, self).__init__(cfg)
self.__logger = logging.getLogger('pircons.NetQuery.DNSQuery')
query, nameservers = None, None
if cfg.has_section('DNSQuery'):
if cfg.has_option('DNSQu... | true | true |
f76c03c2d499225fb5b4db185f99939b4793db7d | 2,583 | py | Python | waterbutler/providers/s3/metadata.py | alexschiller/waterbutler | 24014d7705aca3e99a6565fc3b9b4075ec6ec563 | [
"Apache-2.0"
] | null | null | null | waterbutler/providers/s3/metadata.py | alexschiller/waterbutler | 24014d7705aca3e99a6565fc3b9b4075ec6ec563 | [
"Apache-2.0"
] | null | null | null | waterbutler/providers/s3/metadata.py | alexschiller/waterbutler | 24014d7705aca3e99a6565fc3b9b4075ec6ec563 | [
"Apache-2.0"
] | null | null | null | import os
from waterbutler.core import metadata
class S3Metadata(metadata.BaseMetadata):
@property
def provider(self):
return 's3'
@property
def name(self):
return os.path.split(self.path)[1]
class S3FileMetadataHeaders(S3Metadata, metadata.BaseFileMetadata):
def __init__(sel... | 20.5 | 74 | 0.584979 | import os
from waterbutler.core import metadata
class S3Metadata(metadata.BaseMetadata):
@property
def provider(self):
return 's3'
@property
def name(self):
return os.path.split(self.path)[1]
class S3FileMetadataHeaders(S3Metadata, metadata.BaseFileMetadata):
def __init__(sel... | true | true |
f76c040a9d113b7f30c60e39ae1c875ed971bcc7 | 17,072 | py | Python | getsub/util.py | cztt/GetSubtitles | 3a786c7b9700fca7e6aa9437f1a5545c445a8c29 | [
"MIT"
] | null | null | null | getsub/util.py | cztt/GetSubtitles | 3a786c7b9700fca7e6aa9437f1a5545c445a8c29 | [
"MIT"
] | null | null | null | getsub/util.py | cztt/GetSubtitles | 3a786c7b9700fca7e6aa9437f1a5545c445a8c29 | [
"MIT"
] | null | null | null | # coding: utf-8
import os
import re
import zipfile
import tempfile
import subprocess
from os import path
from io import BytesIO
from shutil import get_terminal_size
import rarfile
from guessit import guessit
from getsub.constants import SUB_FORMATS, ARCHIVE_TYPES, VIDEO_FORMATS
class ProgressBar:
def __init__(... | 30.54025 | 86 | 0.584934 |
import os
import re
import zipfile
import tempfile
import subprocess
from os import path
from io import BytesIO
from shutil import get_terminal_size
import rarfile
from guessit import guessit
from getsub.constants import SUB_FORMATS, ARCHIVE_TYPES, VIDEO_FORMATS
class ProgressBar:
def __init__(self, prefix_inf... | true | true |
f76c04eaaf6e2c0f7c67e672b59f6b007e942bac | 1,370 | py | Python | app/user/serializers.py | storylife/recipe-app-api | d5a4fb76b1e47ff99c9ff0824eb78d76ee5fef65 | [
"MIT"
] | null | null | null | app/user/serializers.py | storylife/recipe-app-api | d5a4fb76b1e47ff99c9ff0824eb78d76ee5fef65 | [
"MIT"
] | null | null | null | app/user/serializers.py | storylife/recipe-app-api | d5a4fb76b1e47ff99c9ff0824eb78d76ee5fef65 | [
"MIT"
] | null | null | null | from django.contrib.auth import get_user_model, authenticate
from django.utils.translation import gettext as _
from rest_framework import serializers
class UserSerializer(serializers.ModelSerializer):
"""Serializer for the user objects"""
class Meta:
model = get_user_model()
fields = ('email... | 31.136364 | 74 | 0.650365 | from django.contrib.auth import get_user_model, authenticate
from django.utils.translation import gettext as _
from rest_framework import serializers
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = get_user_model()
fields = ('email', 'password', 'name')
extra_kwarg... | true | true |
f76c057e9c67b4420d081e95ac552b21c6596b0e | 1,593 | py | Python | django_linked_items/models/__init__.py | martinphellwig/django-linked-items | 3273ed563109f8c526ae5a279f220a1d076551be | [
"BSD-2-Clause"
] | null | null | null | django_linked_items/models/__init__.py | martinphellwig/django-linked-items | 3273ed563109f8c526ae5a279f220a1d076551be | [
"BSD-2-Clause"
] | null | null | null | django_linked_items/models/__init__.py | martinphellwig/django-linked-items | 3273ed563109f8c526ae5a279f220a1d076551be | [
"BSD-2-Clause"
] | null | null | null | """
Django Linked Items Models
"""
from django.db import models
from ..tools import relations
#pylint: disable=no-member
class Item(models.Model):
"The base item to be linked."
name = models.CharField(max_length=128)
def get_linked(self, upwards=False):
"Return relations."
# The return com... | 30.056604 | 75 | 0.64344 | from django.db import models
from ..tools import relations
class Item(models.Model):
name = models.CharField(max_length=128)
def get_linked(self, upwards=False):
return relations.get_nodes_recursive_from(self.id, upwards)
def add_link(self, item, relation=None):
return Link.object... | true | true |
f76c06419af513201c7f3f94923893b381d64510 | 2,462 | py | Python | fattie/belly/quadruple.py | EdgardoAcosta/Fattie | ff877cda0cd5351ba9ea6ecbac5aab34a149bbf2 | [
"MIT"
] | null | null | null | fattie/belly/quadruple.py | EdgardoAcosta/Fattie | ff877cda0cd5351ba9ea6ecbac5aab34a149bbf2 | [
"MIT"
] | 1 | 2018-11-13T05:31:48.000Z | 2018-11-26T16:39:29.000Z | fattie/belly/quadruple.py | EdgardoAcosta/Fattie | ff877cda0cd5351ba9ea6ecbac5aab34a149bbf2 | [
"MIT"
] | null | null | null | from enum import IntEnum
from fattie.belly.fluffyvariable import FluffyVariable
match_operators = {
"+": "PLUS",
"-": "MINUS",
"*": "TIMES",
"/": "DIVIDE",
"equals": "EQUALS",
"less": "LESS",
"greater": "GREATER",
"notequal": "NOTEQUAL",
"return": "RETURN"
}
class Operator(IntEnum... | 19.854839 | 100 | 0.559301 | from enum import IntEnum
from fattie.belly.fluffyvariable import FluffyVariable
match_operators = {
"+": "PLUS",
"-": "MINUS",
"*": "TIMES",
"/": "DIVIDE",
"equals": "EQUALS",
"less": "LESS",
"greater": "GREATER",
"notequal": "NOTEQUAL",
"return": "RETURN"
}
class Operator(IntEnum... | true | true |
f76c06812b9b0fac7b8bdee6e5952bfb5d05a06f | 3,823 | py | Python | examples/not_so_quickstart/steps/torch_steps.py | svenaoki/zenml | b94dff83f0e7c8ab29e99d6b42a0c906a3512b63 | [
"Apache-2.0"
] | 565 | 2021-08-14T14:00:32.000Z | 2022-03-31T12:58:08.000Z | examples/not_so_quickstart/steps/torch_steps.py | svenaoki/zenml | b94dff83f0e7c8ab29e99d6b42a0c906a3512b63 | [
"Apache-2.0"
] | 159 | 2021-08-16T08:27:10.000Z | 2022-03-31T14:07:30.000Z | examples/not_so_quickstart/steps/torch_steps.py | svenaoki/zenml | b94dff83f0e7c8ab29e99d6b42a0c906a3512b63 | [
"Apache-2.0"
] | 64 | 2021-08-31T02:33:01.000Z | 2022-03-31T12:58:12.000Z | # Copyright (c) ZenML GmbH 2021. 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:
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | 31.336066 | 79 | 0.646351 |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.optim.lr_scheduler import StepLR
from torch.utils.data import DataLoader, TensorDataset
from zenml.steps import step
from .params import TrainerConfig
DEVICE = torch.device("cuda" if torch.c... | true | true |
f76c06ea8ec73e947dba4e6f1f1a1110a5472336 | 19,937 | py | Python | workspace/ms/dbkeeper/forms.py | jawaad-ahmad/brata.masterserver | 9fea1aa369fbdc56f0d9b3133bac2f3861e25ae2 | [
"Apache-2.0"
] | 1 | 2015-12-05T05:13:16.000Z | 2015-12-05T05:13:16.000Z | workspace/ms/dbkeeper/forms.py | jawaad-ahmad/brata.masterserver | 9fea1aa369fbdc56f0d9b3133bac2f3861e25ae2 | [
"Apache-2.0"
] | 64 | 2015-08-27T06:04:38.000Z | 2016-05-04T04:16:53.000Z | workspace/ms/dbkeeper/forms.py | jawaad-ahmad/brata.masterserver | 9fea1aa369fbdc56f0d9b3133bac2f3861e25ae2 | [
"Apache-2.0"
] | 2 | 2015-08-26T00:59:59.000Z | 2015-08-26T15:20:08.000Z | """ms.dbkeeper Form definitions """
from django import forms
from django.core.validators import RegexValidator
import operator
from .models import Organization, Team
from .team_code import TeamPassCode
#----------------------------------------------------------------------------
class FilteredFileField(forms.FileFie... | 49.471464 | 143 | 0.567939 | """ms.dbkeeper Form definitions """
from django import forms
from django.core.validators import RegexValidator
import operator
from .models import Organization, Team
from .team_code import TeamPassCode
class FilteredFileField(forms.FileField):
""" A file input field for uploading files, that filters on extension... | false | true |
f76c071aaa70cb8d9495d2b47cf1d1c470029e7c | 833 | py | Python | Ransome.py | sad786/Python | 738198bbab5abfa1d521e83291eed7026a4f6f12 | [
"Apache-2.0"
] | null | null | null | Ransome.py | sad786/Python | 738198bbab5abfa1d521e83291eed7026a4f6f12 | [
"Apache-2.0"
] | null | null | null | Ransome.py | sad786/Python | 738198bbab5abfa1d521e83291eed7026a4f6f12 | [
"Apache-2.0"
] | null | null | null |
import math
import os
import random
import re
import sys
# Complete the checkMagazine function below.
def checkMagazine(magazine, note):
res = 'Yes'
start = 0
end = len(note)-1
while start<=end:
if start==end:
if note[start] not in magazine:
res ='No'
... | 17.723404 | 44 | 0.527011 |
import math
import os
import random
import re
import sys
def checkMagazine(magazine, note):
res = 'Yes'
start = 0
end = len(note)-1
while start<=end:
if start==end:
if note[start] not in magazine:
res ='No'
break
else:
if note[sta... | false | true |
f76c0af4b1760f4c26e0a423f87782a3f9194c4c | 2,241 | py | Python | dataset/waveform_dataset.py | alongwithyou/pytorch-kaldi | c4f949ced995afe40f8813a6a8225abe5132882a | [
"MIT"
] | 4 | 2020-04-09T01:04:47.000Z | 2020-08-20T12:31:10.000Z | dataset/waveform_dataset.py | dendisuhubdy/Wave-U-Net-for-Speech-Enhancement | ef16d0f44df65ee133c166fc51e150790d5ecd07 | [
"MIT"
] | null | null | null | dataset/waveform_dataset.py | dendisuhubdy/Wave-U-Net-for-Speech-Enhancement | ef16d0f44df65ee133c166fc51e150790d5ecd07 | [
"MIT"
] | null | null | null | import os
from torch.utils import data
import librosa
from util.utils import sample_fixed_length_data_aligned
class Dataset(data.Dataset):
def __init__(self, dataset, limit=None, offset=0, sample_length=16384, mode="train"):
"""
构建训练数据集
Args:
dataset (str): 语音数据集的路径,... | 36.145161 | 111 | 0.589915 | import os
from torch.utils import data
import librosa
from util.utils import sample_fixed_length_data_aligned
class Dataset(data.Dataset):
def __init__(self, dataset, limit=None, offset=0, sample_length=16384, mode="train"):
super(Dataset, self).__init__()
dataset_list = [line.rstrip('\n'... | true | true |
f76c0c585348d2501d981d8022526344e1968844 | 5,219 | py | Python | CpGHMMExample/gencpgdata.py | gotgenes/CpGHMMExample | d55e02ee930da040808e278bd1216ddc25116d0f | [
"MIT"
] | 2 | 2018-03-23T08:10:25.000Z | 2018-08-27T02:59:07.000Z | CpGHMMExample/gencpgdata.py | gotgenes/CpGHMMExample | d55e02ee930da040808e278bd1216ddc25116d0f | [
"MIT"
] | null | null | null | CpGHMMExample/gencpgdata.py | gotgenes/CpGHMMExample | d55e02ee930da040808e278bd1216ddc25116d0f | [
"MIT"
] | 1 | 2018-08-27T02:59:09.000Z | 2018-08-27T02:59:09.000Z | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright (c) 2012 Christopher D. Lasher
#
# This software is released under the MIT License. Please see
# LICENSE.txt for details.
"""Generates a random sequence with CpG islands.
This script produces three outfiles:
* a FASTA format sequence file
* a file containi... | 23.509009 | 75 | 0.636137 |
import argparse
import bisect
import random
import textwrap
import numpy as np
import logging
LOGGER = logging.getLogger()
LOGGER.setLevel(logging.INFO)
STREAM_HANDLER = logging.StreamHandler()
STREAM_HANDLER.setLevel(logging.INFO)
LOGGER.addHandler(STREAM_HANDLER)
FORMATTER = logging.Formatter('%(message)s')
STR... | true | true |
f76c0c65d25cede7a29cac2529843f271d703122 | 2,560 | py | Python | generate_STL.py | KitWallace/terrain | c9a1a7e11fbcc470e659c4b2c5b46d3e4e2c93cc | [
"CC0-1.0"
] | null | null | null | generate_STL.py | KitWallace/terrain | c9a1a7e11fbcc470e659c4b2c5b46d3e4e2c93cc | [
"CC0-1.0"
] | 21 | 2015-10-12T04:28:38.000Z | 2019-02-19T18:01:17.000Z | generate_STL.py | KitWallace/terrain | c9a1a7e11fbcc470e659c4b2c5b46d3e4e2c93cc | [
"CC0-1.0"
] | null | null | null | """
generate ASCII STL for a rectangular surface with heights spaced over a grid.
todo
facet direction is correct but that's not obvious from the code -needs clarification
Chris Wallace kitwallace.co.uk
March 2014
"""
from numpy import *
def vertex (p) :
return "vertex " + s... | 32.820513 | 127 | 0.514453 |
from numpy import *
def vertex (p) :
return "vertex " + str(p[0]) + " " + str(p[1]) + " " + str(p[2]) + "\n"
def tri (p0,p1,p2) :
return "outer loop\n" + vertex(p0) + vertex(p1) + vertex(p2) + "endloop\n"
def square(p0,p1,p2,p3) :
if abs(p0[2] - p2[2]) < abs(p1[2] - p3[2]) : return "f... | true | true |
f76c0cd34cf3f7dfe3754043186141d732211f6c | 28,019 | py | Python | pymatgen/symmetry/tests/test_analyzer.py | wangyusu/pymatgen | a90af2fe71eff15134ca33c6e58f07caba425ae9 | [
"MIT"
] | 921 | 2015-01-25T22:17:05.000Z | 2022-03-27T20:58:38.000Z | pymatgen/symmetry/tests/test_analyzer.py | wangyusu/pymatgen | a90af2fe71eff15134ca33c6e58f07caba425ae9 | [
"MIT"
] | 1,631 | 2015-01-05T21:05:04.000Z | 2022-03-31T18:40:17.000Z | pymatgen/symmetry/tests/test_analyzer.py | wangyusu/pymatgen | a90af2fe71eff15134ca33c6e58f07caba425ae9 | [
"MIT"
] | 851 | 2015-01-01T17:38:00.000Z | 2022-03-31T02:14:07.000Z | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import unittest
from pathlib import Path
import os
import numpy as np
from pymatgen.core.operations import SymmOp
from pymatgen.core.sites import PeriodicSite
from pymatgen.core.structure import Molecule, Str... | 43.643302 | 102 | 0.648596 |
import unittest
from pathlib import Path
import os
import numpy as np
from pymatgen.core.operations import SymmOp
from pymatgen.core.sites import PeriodicSite
from pymatgen.core.structure import Molecule, Structure
from pymatgen.io.cif import CifParser
from pymatgen.io.vasp.inputs import Poscar
from pymatgen.io.vasp... | true | true |
f76c0cda29fbaa0d9eea291bbc9e795321d38f81 | 6,634 | py | Python | bindings/python/ensmallen_graph/datasets/string/spiroplasmamirum.py | caufieldjh/ensmallen_graph | 14e98b1cdbc73193a84a913d7d4f2b2b3eb2c43a | [
"MIT"
] | null | null | null | bindings/python/ensmallen_graph/datasets/string/spiroplasmamirum.py | caufieldjh/ensmallen_graph | 14e98b1cdbc73193a84a913d7d4f2b2b3eb2c43a | [
"MIT"
] | null | null | null | bindings/python/ensmallen_graph/datasets/string/spiroplasmamirum.py | caufieldjh/ensmallen_graph | 14e98b1cdbc73193a84a913d7d4f2b2b3eb2c43a | [
"MIT"
] | null | null | null | """
This file offers the methods to automatically retrieve the graph Spiroplasma mirum.
The graph is automatically retrieved from the STRING repository.
Report
---------------------
At the time of rendering these methods (please see datetime below), the graph
had the following characteristics:
Datetime: 2021-02-0... | 35.100529 | 223 | 0.701387 | from typing import Dict
from ..automatic_graph_retrieval import AutomaticallyRetrievedGraph
from ...ensmallen_graph import EnsmallenGraph
def SpiroplasmaMirum(
directed: bool = False,
verbose: int = 2,
cache_path: str = "graphs/string",
**additional_graph_kwargs: Dict
) -> EnsmallenGraph:
return... | true | true |
f76c0d0e0c0ecfdece91a6698388352253e370cd | 37,767 | py | Python | Lib/site-packages/botocore-1.4.9-py2.7.egg/botocore/session.py | saranya515/python-api | 9870b064c1238845b3e6714c8116e3c949868c62 | [
"bzip2-1.0.6"
] | null | null | null | Lib/site-packages/botocore-1.4.9-py2.7.egg/botocore/session.py | saranya515/python-api | 9870b064c1238845b3e6714c8116e3c949868c62 | [
"bzip2-1.0.6"
] | null | null | null | Lib/site-packages/botocore-1.4.9-py2.7.egg/botocore/session.py | saranya515/python-api | 9870b064c1238845b3e6714c8116e3c949868c62 | [
"bzip2-1.0.6"
] | null | null | null | # Copyright (c) 2012-2013 Mitch Garnaat http://garnaat.org/
# Copyright 2012-2014 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http... | 42.056793 | 87 | 0.643339 |
import copy
import logging
import os
import platform
from botocore import __version__
import botocore.configloader
import botocore.credentials
import botocore.client
from botocore.exceptions import ConfigNotFound, ProfileNotFound
from botocore.exceptions import UnknownServiceError
from botocore import handlers
from b... | true | true |
f76c0dac142ff9b83555ca041af68cdd53f5aa81 | 2,891 | py | Python | multimodal_affinities/visualization/image_utils.py | QPC-database/multimodal-affinities | c3298e8db56a8b41110cc5681852f9f15d6deaa6 | [
"Apache-2.0"
] | 1 | 2021-07-10T08:09:25.000Z | 2021-07-10T08:09:25.000Z | multimodal_affinities/visualization/image_utils.py | QPC-database/multimodal-affinities | c3298e8db56a8b41110cc5681852f9f15d6deaa6 | [
"Apache-2.0"
] | null | null | null | multimodal_affinities/visualization/image_utils.py | QPC-database/multimodal-affinities | c3298e8db56a8b41110cc5681852f9f15d6deaa6 | [
"Apache-2.0"
] | null | null | null | import cv2
import numpy as np
from PIL import Image
import random
import string
import os
class ImageUtils(object):
@staticmethod
def read_image_for_bokeh(image_path, resize_height=None):
# Open image, and make sure it's RGB*A*
image = Image.open(image_path).convert('RGBA')
print("image... | 39.60274 | 104 | 0.661017 | import cv2
import numpy as np
from PIL import Image
import random
import string
import os
class ImageUtils(object):
@staticmethod
def read_image_for_bokeh(image_path, resize_height=None):
image = Image.open(image_path).convert('RGBA')
print("image: {}".format(image))
if resize_h... | true | true |
f76c0eed51ae051261ec7b5509b1f7e165c522d7 | 1,127 | py | Python | util/my_util.py | RegentLee/master_research | ee8e45abc890c7103c1c9917954c5958b48782f6 | [
"BSD-3-Clause"
] | null | null | null | util/my_util.py | RegentLee/master_research | ee8e45abc890c7103c1c9917954c5958b48782f6 | [
"BSD-3-Clause"
] | null | null | null | util/my_util.py | RegentLee/master_research | ee8e45abc890c7103c1c9917954c5958b48782f6 | [
"BSD-3-Clause"
] | null | null | null | import numpy as np
#############################################
# variable #
#############################################
val = False
x = 0
y = 0
#############################################
# function #
############################################... | 27.487805 | 124 | 0.393966 | import numpy as np
val = False
x = 0
y = 0
def RMSD(A, B):
mse = np.sum(np.power(A - B, 2)/B.size)
return np.sqrt(mse)
def MAE(A, B):
A = 59.2/2*(A + 1)
B = 59.2/2*(B + 1)
mae = np.sum(np.abs(A - B))/B.size
return mae
| true | true |
f76c0f49dc47223701b1733cf999bda445aa8f66 | 3,902 | py | Python | mindware/components/feature_engineering/parse.py | jhj0411jhj/soln-ml | 002ec06bf139b14bc059e0f0438501b31d9ed16a | [
"MIT"
] | 27 | 2021-07-19T09:03:34.000Z | 2022-03-31T06:19:23.000Z | mindware/components/feature_engineering/parse.py | jhj0411jhj/soln-ml | 002ec06bf139b14bc059e0f0438501b31d9ed16a | [
"MIT"
] | 4 | 2021-07-15T12:17:10.000Z | 2022-01-26T17:16:58.000Z | mindware/components/feature_engineering/parse.py | jhj0411jhj/soln-ml | 002ec06bf139b14bc059e0f0438501b31d9ed16a | [
"MIT"
] | 17 | 2020-05-12T20:24:50.000Z | 2021-07-11T03:31:38.000Z | from mindware.components.feature_engineering.transformations import _bal_balancer, _preprocessor, _rescaler, \
_image_preprocessor, _text_preprocessor, _bal_addons, _imb_balancer, _gen_addons, _res_addons, _sel_addons
from mindware.components.utils.class_loader import get_combined_fe_candidtates
from mindware.compo... | 38.633663 | 110 | 0.683752 | from mindware.components.feature_engineering.transformations import _bal_balancer, _preprocessor, _rescaler, \
_image_preprocessor, _text_preprocessor, _bal_addons, _imb_balancer, _gen_addons, _res_addons, _sel_addons
from mindware.components.utils.class_loader import get_combined_fe_candidtates
from mindware.compo... | true | true |
f76c0f8c76539114616965c916b52029d90c8313 | 824 | py | Python | dsmpy/component.py | seismobassoon/dsmpy | 4290269ff0998549a2eec25ed090417f8cf1bad7 | [
"MIT"
] | null | null | null | dsmpy/component.py | seismobassoon/dsmpy | 4290269ff0998549a2eec25ed090417f8cf1bad7 | [
"MIT"
] | null | null | null | dsmpy/component.py | seismobassoon/dsmpy | 4290269ff0998549a2eec25ed090417f8cf1bad7 | [
"MIT"
] | null | null | null | from enum import IntEnum
class Component(IntEnum):
'''Seismic record geographical components (R T Z).
'''
Z = 0
R = 1
T = 2
@staticmethod
def parse_component(str):
'''Parse component from a str.
Args:
str (str): str representation of a component
... | 22.888889 | 60 | 0.430825 | from enum import IntEnum
class Component(IntEnum):
Z = 0
R = 1
T = 2
@staticmethod
def parse_component(str):
if (
str == 'Z'
or str == 'vertical'
or str.endswith('Z')):
return Component.Z
elif (
str == 'R'
or s... | true | true |
f76c1264752a98a0f179a955278ef67982e1aba9 | 35,823 | py | Python | dynamite/operators.py | GregDMeyer/dynamite | 440f0c3674bf12a835b8ad4b3c10c303c2d28265 | [
"MIT"
] | 16 | 2017-10-11T22:53:30.000Z | 2021-12-23T01:17:07.000Z | dynamite/operators.py | GregDMeyer/dynamite | 440f0c3674bf12a835b8ad4b3c10c303c2d28265 | [
"MIT"
] | 8 | 2017-10-11T22:57:09.000Z | 2021-02-03T20:35:44.000Z | dynamite/operators.py | GregDMeyer/dynamite | 440f0c3674bf12a835b8ad4b3c10c303c2d28265 | [
"MIT"
] | 3 | 2018-02-21T19:36:47.000Z | 2022-01-26T21:38:18.000Z | """
This module provides the building blocks for Hamiltonians, and
defines their built-in behavior and operations.
"""
import numpy as np
from . import config, validate, msc_tools
from .computations import evolve, eigsolve
from .subspaces import Full
from .states import State
class Operator:
"""
A class repr... | 31.150435 | 110 | 0.577701 |
import numpy as np
from . import config, validate, msc_tools
from .computations import evolve, eigsolve
from .subspaces import Full
from .states import State
class Operator:
def __init__(self):
self._L = config.L
self._max_spin_idx = None
self._mats = {}
self._msc = None
... | true | true |
f76c13f2a1fae0a4fde309a0fcca931698354f94 | 3,554 | py | Python | clustering/aggOnFeatures.py | Virodroid/galaxy-cluster | 11c0b365ed94e1f141b55e905f93abcbf39b3657 | [
"MIT"
] | null | null | null | clustering/aggOnFeatures.py | Virodroid/galaxy-cluster | 11c0b365ed94e1f141b55e905f93abcbf39b3657 | [
"MIT"
] | null | null | null | clustering/aggOnFeatures.py | Virodroid/galaxy-cluster | 11c0b365ed94e1f141b55e905f93abcbf39b3657 | [
"MIT"
] | null | null | null | from sklearn.cluster import AgglomerativeClustering
import pandas as pd
import numpy as np
from zoobot import label_metadata, schemas
from sklearn.metrics import confusion_matrix, precision_recall_fscore_support
from scipy.optimize import linear_sum_assignment as linear_assignment
import time
def findChoice(frac):
... | 39.488889 | 136 | 0.713562 | from sklearn.cluster import AgglomerativeClustering
import pandas as pd
import numpy as np
from zoobot import label_metadata, schemas
from sklearn.metrics import confusion_matrix, precision_recall_fscore_support
from scipy.optimize import linear_sum_assignment as linear_assignment
import time
def findChoice(frac):
... | true | true |
f76c172643c7ab17ad218fbbb3a8f24ea360ffed | 5,730 | py | Python | pybind/slxos/v16r_1_00b/brocade_ras_ext_rpc/show_support_save_status/input/__init__.py | shivharis/pybind | 4e1c6d54b9fd722ccec25546ba2413d79ce337e6 | [
"Apache-2.0"
] | null | null | null | pybind/slxos/v16r_1_00b/brocade_ras_ext_rpc/show_support_save_status/input/__init__.py | shivharis/pybind | 4e1c6d54b9fd722ccec25546ba2413d79ce337e6 | [
"Apache-2.0"
] | null | null | null | pybind/slxos/v16r_1_00b/brocade_ras_ext_rpc/show_support_save_status/input/__init__.py | shivharis/pybind | 4e1c6d54b9fd722ccec25546ba2413d79ce337e6 | [
"Apache-2.0"
] | 1 | 2021-11-05T22:15:42.000Z | 2021-11-05T22:15:42.000Z |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from d... | 46.585366 | 417 | 0.716754 |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from d... | true | true |
f76c179a1160f91d5307ccf5508fb4fe3b386917 | 4,749 | py | Python | examples/mnist/pytorch-run.py | fatfatbear/tinynn | 8ef3e834e6af330c6809b1e09757bd95f91b0e3c | [
"MIT"
] | 1 | 2022-03-01T02:00:07.000Z | 2022-03-01T02:00:07.000Z | examples/mnist/pytorch-run.py | fatfatbear/tinynn | 8ef3e834e6af330c6809b1e09757bd95f91b0e3c | [
"MIT"
] | null | null | null | examples/mnist/pytorch-run.py | fatfatbear/tinynn | 8ef3e834e6af330c6809b1e09757bd95f91b0e3c | [
"MIT"
] | null | null | null | import argparse
import os
import time
import tinynn as tn
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
class Dense(nn.Module):
def __init__(self):
super(Dense, self).__init__()
self.fc1 = nn.Linear(784, 200)
self.fc2 = nn.Linear(200, 100... | 28.781818 | 83 | 0.581386 | import argparse
import os
import time
import tinynn as tn
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
class Dense(nn.Module):
def __init__(self):
super(Dense, self).__init__()
self.fc1 = nn.Linear(784, 200)
self.fc2 = nn.Linear(200, 100... | true | true |
f76c186b1989413187a6e6c5ebd12d07f40c7275 | 1,745 | py | Python | module_utils/drv.py | yonglingchen/stc-ansible | 6390af3b92d14d3da6ed32f082afe37075952375 | [
"Apache-2.0"
] | 4 | 2020-01-13T09:17:39.000Z | 2021-02-26T03:46:14.000Z | module_utils/drv.py | yonglingchen/stc-ansible | 6390af3b92d14d3da6ed32f082afe37075952375 | [
"Apache-2.0"
] | 4 | 2020-02-18T09:07:04.000Z | 2021-03-31T03:58:12.000Z | module_utils/drv.py | yonglingchen/stc-ansible | 6390af3b92d14d3da6ed32f082afe37075952375 | [
"Apache-2.0"
] | 22 | 2020-01-22T19:03:11.000Z | 2021-12-08T10:43:09.000Z | # -*- coding: utf-8 -*-
# @Author: ronanjs
# @Date: 2020-01-19 22:23:54
# @Last Modified by: ronanjs
# @Last Modified time: 2020-07-02 10:52:19
class DRV:
def __init__(self, objects, rest):
self.objects = objects
self.rest = rest
def subscribe(self):
drvHandles = self.objects.ha... | 27.698413 | 104 | 0.533524 |
class DRV:
def __init__(self, objects, rest):
self.objects = objects
self.rest = rest
def subscribe(self):
drvHandles = self.objects.handles()
self.rest.perform("SubscribeDynamicResultView", {"DynamicResultView": " ".join(drvHandles)})
return None
def fetch(self... | true | true |
f76c18b0e93301240f47f323719973bde08dc739 | 1,821 | py | Python | plyse/expressions/terms.py | arcodergh/plyse | bb44543f9c812401489ceba68b24b8618d263830 | [
"MIT"
] | 26 | 2016-05-31T14:45:24.000Z | 2021-04-27T01:54:52.000Z | plyse/expressions/terms.py | arcodergh/plyse | bb44543f9c812401489ceba68b24b8618d263830 | [
"MIT"
] | 11 | 2016-05-31T20:09:57.000Z | 2022-02-18T11:43:50.000Z | plyse/expressions/terms.py | arcodergh/plyse | bb44543f9c812401489ceba68b24b8618d263830 | [
"MIT"
] | 13 | 2016-05-31T19:41:36.000Z | 2021-03-01T15:22:38.000Z | # -*- coding: utf-8 -*-
from pyparsing import Optional, Group, Literal, CaselessKeyword, And, OneOrMore
from .primitives import SimpleWord, Field, PartialString, QuotedString, Integer, IntegerRange, concatenate
class TermFactory(object):
@staticmethod
def build_term(field, values, parse_method=None):
... | 35.019231 | 113 | 0.708402 | from pyparsing import Optional, Group, Literal, CaselessKeyword, And, OneOrMore
from .primitives import SimpleWord, Field, PartialString, QuotedString, Integer, IntegerRange, concatenate
class TermFactory(object):
@staticmethod
def build_term(field, values, parse_method=None):
ordered_values = [val ... | true | true |
f76c19399b84c79b4c131860354f720be98edd0f | 22,902 | py | Python | panel/pipeline.py | slamer59/panel | 963a63af57e786a8121f2f2bff1f6533fe7ddffe | [
"BSD-3-Clause"
] | 1 | 2020-10-17T17:00:14.000Z | 2020-10-17T17:00:14.000Z | panel/pipeline.py | alihussainia/panel | 39c2e1d28c715db4c63d8cc982d1303ce2278569 | [
"BSD-3-Clause"
] | null | null | null | panel/pipeline.py | alihussainia/panel | 39c2e1d28c715db4c63d8cc982d1303ce2278569 | [
"BSD-3-Clause"
] | null | null | null | from __future__ import absolute_import, division, unicode_literals
import os
import sys
import traceback as tb
from collections import OrderedDict, defaultdict
import param
from .layout import Row, Column, HSpacer, VSpacer
from .pane import HoloViews, Pane, Markdown
from .widgets import Button, Select
from .param i... | 36.468153 | 103 | 0.58008 | from __future__ import absolute_import, division, unicode_literals
import os
import sys
import traceback as tb
from collections import OrderedDict, defaultdict
import param
from .layout import Row, Column, HSpacer, VSpacer
from .pane import HoloViews, Pane, Markdown
from .widgets import Button, Select
from .param i... | true | true |
f76c1a9ab98ee9e8e7da748cc818b84703ef05d1 | 3,970 | py | Python | tests/test_example/tests/desc.py | Chise1/fastapi-cli | e8e1bb20279880ea4de9c3358e49412dc644c98a | [
"Apache-2.0"
] | 5 | 2021-01-23T06:43:01.000Z | 2022-02-22T06:40:03.000Z | tests/test_example/tests/desc.py | Chise1/fastapi-cli | e8e1bb20279880ea4de9c3358e49412dc644c98a | [
"Apache-2.0"
] | 4 | 2022-02-09T04:44:50.000Z | 2022-02-09T04:48:26.000Z | tests/test_example/tests/desc.py | Chise1/fastapi-cli | e8e1bb20279880ea4de9c3358e49412dc644c98a | [
"Apache-2.0"
] | 3 | 2021-01-13T09:40:42.000Z | 2021-01-14T03:18:26.000Z | a = {
"name": "None.Reporter",
"app": None,
"table": "re_port_er",
"abstract": False,
"description": "Whom is assigned as the reporter ",
"docstring": "Whom is assigned as the reporter ",
"unique_together": [],
"pk_field": {
"name": "id",
"field_type": "IntField",
... | 28.156028 | 64 | 0.440554 | a = {
"name": "None.Reporter",
"app": None,
"table": "re_port_er",
"abstract": False,
"description": "Whom is assigned as the reporter ",
"docstring": "Whom is assigned as the reporter ",
"unique_together": [],
"pk_field": {
"name": "id",
"field_type": "IntField",
... | true | true |
f76c1bf70cced0ed8a8df6f8aa232a991e755abb | 2,113 | py | Python | tests/utilities/test_apply_func_torchtext.py | krfricke/pytorch-lightning | fbd887df9d487da4c57d884e01b3401af140b1bc | [
"Apache-2.0"
] | 3,469 | 2019-03-31T03:09:16.000Z | 2020-01-13T15:06:31.000Z | tests/utilities/test_apply_func_torchtext.py | krfricke/pytorch-lightning | fbd887df9d487da4c57d884e01b3401af140b1bc | [
"Apache-2.0"
] | 524 | 2019-04-02T12:33:39.000Z | 2020-01-14T02:53:33.000Z | tests/utilities/test_apply_func_torchtext.py | krfricke/pytorch-lightning | fbd887df9d487da4c57d884e01b3401af140b1bc | [
"Apache-2.0"
] | 365 | 2019-04-02T22:14:04.000Z | 2020-01-13T17:21:54.000Z | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 44.020833 | 118 | 0.786086 | import pytest
import torch
from pytorch_lightning.utilities.apply_func import move_data_to_device
from pytorch_lightning.utilities.imports import _TORCHTEXT_LEGACY
from tests.helpers.runif import RunIf
from tests.helpers.torchtext_utils import get_dummy_torchtext_data_iterator
@pytest.mark.parametrize("include_lengt... | true | true |
f76c1c6576b14dd026324f7683c05bea780e6780 | 3,462 | py | Python | cherrypy/tutorial/tut09_files.py | abancu/core | e110a1df32ec8bf67f007960e61df55f0a926219 | [
"MIT"
] | null | null | null | cherrypy/tutorial/tut09_files.py | abancu/core | e110a1df32ec8bf67f007960e61df55f0a926219 | [
"MIT"
] | null | null | null | cherrypy/tutorial/tut09_files.py | abancu/core | e110a1df32ec8bf67f007960e61df55f0a926219 | [
"MIT"
] | null | null | null | """
Tutorial: File upload and download
Uploads
-------
When a client uploads a file to a CherryPy application, it's placed
on disk immediately. CherryPy will pass it to your exposed method
as an argument (see "myFile" below); that arg will have a "file"
attribute, which is a handle to the temporary uploaded file.
If... | 32.971429 | 78 | 0.661179 |
import os
localDir = os.path.dirname(__file__)
absDir = os.path.join(os.getcwd(), localDir)
import cherrypy
from cherrypy.lib import static
class FileDemo(object):
@cherrypy.expose
def index(self):
return """
<html><body>
<h2>Upload a file</h2>
<form action="upload" ... | true | true |
f76c1d4781e8bfabd7b951cd2a71c209ac73cd51 | 1,160 | py | Python | scripts/calculator.py | Coolxer/image_creator | fcb4a2abd46de5daecf0465bebbc38319a71ba8d | [
"MIT"
] | null | null | null | scripts/calculator.py | Coolxer/image_creator | fcb4a2abd46de5daecf0465bebbc38319a71ba8d | [
"MIT"
] | null | null | null | scripts/calculator.py | Coolxer/image_creator | fcb4a2abd46de5daecf0465bebbc38319a71ba8d | [
"MIT"
] | null | null | null | import math
import scene
class Calculator:
def __init__(self):
self.scene = scene.Scene()
def calculate(self, feathers, pictures_count, cutter_angle):
self.scene.set(feathers, cutter_angle)
self.pictures_count = pictures_count
self.angle = math.radians(360) / self.pictures_c... | 38.666667 | 164 | 0.626724 | import math
import scene
class Calculator:
def __init__(self):
self.scene = scene.Scene()
def calculate(self, feathers, pictures_count, cutter_angle):
self.scene.set(feathers, cutter_angle)
self.pictures_count = pictures_count
self.angle = math.radians(360) / self.pictures_c... | true | true |
f76c1e0c2b56c073630e1b8a9fcb986319db61f4 | 1,311 | py | Python | src/braket/device_schema/dwave/dwave_advantage_device_parameters_v1.py | kjacky/amazon-braket-schemas-python | 42bfd211747d2bc26831085df17e295c65a04f6a | [
"Apache-2.0"
] | 17 | 2020-09-10T00:40:35.000Z | 2022-03-02T23:22:50.000Z | src/braket/device_schema/dwave/dwave_advantage_device_parameters_v1.py | kjacky/amazon-braket-schemas-python | 42bfd211747d2bc26831085df17e295c65a04f6a | [
"Apache-2.0"
] | 60 | 2020-08-13T19:48:03.000Z | 2022-03-31T19:28:33.000Z | src/braket/device_schema/dwave/dwave_advantage_device_parameters_v1.py | kjacky/amazon-braket-schemas-python | 42bfd211747d2bc26831085df17e295c65a04f6a | [
"Apache-2.0"
] | 20 | 2020-08-14T23:10:44.000Z | 2022-01-31T07:32:48.000Z | # Copyright Amazon.com Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompany... | 37.457143 | 98 | 0.78032 |
from pydantic import Field
from braket.device_schema.dwave.dwave_advantage_device_level_parameters_v1 import (
DwaveAdvantageDeviceLevelParameters,
)
from braket.schema_common import BraketSchemaBase, BraketSchemaHeader
class DwaveAdvantageDeviceParameters(BraketSchemaBase):
_PROGRAM_HEADER = BraketSchemaH... | true | true |
f76c1e19d1e28231c9fbed1cee07082ed4be692c | 7,150 | py | Python | retrieval_mod/forward_process.py | bzohidov/TomoRain | a894249a666ff71289fbd878dbc31f6d2bd82701 | [
"MIT"
] | null | null | null | retrieval_mod/forward_process.py | bzohidov/TomoRain | a894249a666ff71289fbd878dbc31f6d2bd82701 | [
"MIT"
] | null | null | null | retrieval_mod/forward_process.py | bzohidov/TomoRain | a894249a666ff71289fbd878dbc31f6d2bd82701 | [
"MIT"
] | null | null | null | #-------------------------------------------------------------------------------
# Name: forward_process.py
# Purpose: To provide set of functions which serve as discretization of an
# area as well as used in retrieval process.
#------------------------------------------------------------------... | 36.111111 | 87 | 0.525455 |
import numpy as np
from itertools import chain
def flat_(x):
'''
Flattens [[seq1],..[seq2],..[seqn]] into [seq1, seq2,.., seq3].
Inputs:
x - sequence (array or list); e.g.: seq = [[...],[...],[...],[...]]
Outputs:
1D array;
'''
return np.array( list(chain.from_iterable(x)) )... | false | true |
f76c1e391bc800fb720f9a0ab97a52fc15d9d818 | 19,909 | py | Python | django/db/models/lookups.py | brownan/django | 8f6860863e34cb1cbe24161f1c4e7c79007e93dc | [
"PSF-2.0",
"BSD-3-Clause"
] | 2 | 2019-09-02T04:43:56.000Z | 2019-09-23T15:17:15.000Z | django/db/models/lookups.py | brownan/django | 8f6860863e34cb1cbe24161f1c4e7c79007e93dc | [
"PSF-2.0",
"BSD-3-Clause"
] | 1 | 2019-08-14T13:14:00.000Z | 2019-08-14T13:14:00.000Z | django/db/models/lookups.py | brownan/django | 8f6860863e34cb1cbe24161f1c4e7c79007e93dc | [
"PSF-2.0",
"BSD-3-Clause"
] | 1 | 2018-12-18T17:35:49.000Z | 2018-12-18T17:35:49.000Z | import itertools
import math
from copy import copy
from django.core.exceptions import EmptyResultSet
from django.db.models.expressions import Exists, Func, RawSQL, Value
from django.db.models.fields import DateTimeField, Field, IntegerField
from django.db.models.query_utils import RegisterLookupMixin
from django.utils... | 36.001808 | 112 | 0.657642 | import itertools
import math
from copy import copy
from django.core.exceptions import EmptyResultSet
from django.db.models.expressions import Exists, Func, RawSQL, Value
from django.db.models.fields import DateTimeField, Field, IntegerField
from django.db.models.query_utils import RegisterLookupMixin
from django.utils... | true | true |
f76c1e750714a75422470f44025a0d630e43a1b1 | 951 | py | Python | src/main/resources/dags/comet_watch.py | scala-steward/starlake | fdc2e133aa88c56c307b722513b92755c2413064 | [
"Apache-2.0"
] | 36 | 2019-02-28T18:24:52.000Z | 2021-10-01T18:44:49.000Z | src/main/resources/dags/comet_watch.py | scala-steward/starlake | fdc2e133aa88c56c307b722513b92755c2413064 | [
"Apache-2.0"
] | 348 | 2019-02-25T10:05:02.000Z | 2021-12-19T00:41:18.000Z | src/main/resources/dags/comet_watch.py | scala-steward/starlake | fdc2e133aa88c56c307b722513b92755c2413064 | [
"Apache-2.0"
] | 33 | 2019-02-19T18:04:35.000Z | 2021-09-17T08:08:46.000Z | import os
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from datetime import datetime, timedelta
default_args = {
'owner': 'airflow',
'depends_on_past': False,
'start_date': datetime(2018, 11, 2),
'email': ['airflow@example.com'],
'email_on_failure': False,
'e... | 32.793103 | 120 | 0.6898 | import os
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from datetime import datetime, timedelta
default_args = {
'owner': 'airflow',
'depends_on_past': False,
'start_date': datetime(2018, 11, 2),
'email': ['airflow@example.com'],
'email_on_failure': False,
'e... | true | true |
f76c1f4e80405a4422b1b209e99e213051a70346 | 706 | py | Python | application/services/jobs/order_stat.py | mutalisk999/bibi | 2e0043d207c83ef7fc55d20b9c0a1b7e493a551c | [
"Apache-2.0"
] | 1,037 | 2017-03-24T11:18:55.000Z | 2022-03-19T14:02:27.000Z | application/services/jobs/order_stat.py | spacecode-live/An-e-commerce-fullstack-solution-for-Flask- | 28130a18a73afbb99bf850e857dd1f14c08fbca1 | [
"Apache-2.0"
] | 8 | 2017-03-26T02:53:24.000Z | 2018-09-14T03:18:26.000Z | application/services/jobs/order_stat.py | spacecode-live/An-e-commerce-fullstack-solution-for-Flask- | 28130a18a73afbb99bf850e857dd1f14c08fbca1 | [
"Apache-2.0"
] | 365 | 2017-03-24T11:29:02.000Z | 2021-11-24T03:14:19.000Z | # -*- coding: utf-8 -*-
from itertools import chain
import application.models as Models
from application.cel import celery
@celery.task
def update_user_stats(user_id):
stat, created = Models.OrderStat.objects.get_or_create(user_id=user_id)
all_orders = Models.Order.objects(customer_id=user_id)
stat.num_... | 29.416667 | 79 | 0.752125 |
from itertools import chain
import application.models as Models
from application.cel import celery
@celery.task
def update_user_stats(user_id):
stat, created = Models.OrderStat.objects.get_or_create(user_id=user_id)
all_orders = Models.Order.objects(customer_id=user_id)
stat.num_orders = all_orders.coun... | true | true |
f76c213ce2f1510e11e2700119f62c4dd5909436 | 819 | py | Python | python/src/parrot.py | newwuhan5/code-peekers | a799b35f133a4c0906bf1aa6ae893cab3fabeed7 | [
"Unlicense"
] | null | null | null | python/src/parrot.py | newwuhan5/code-peekers | a799b35f133a4c0906bf1aa6ae893cab3fabeed7 | [
"Unlicense"
] | null | null | null | python/src/parrot.py | newwuhan5/code-peekers | a799b35f133a4c0906bf1aa6ae893cab3fabeed7 | [
"Unlicense"
] | null | null | null | class Parrot:
# class attribute
species = "bird"
# instance attribute
def __init__(self, name, age):
self.name = name
self.age = age
# instance method
def sing(self, song):
return "{} sings {}".format(self.name, song)
def dance(self):
return "{} is... | 23.4 | 55 | 0.615385 | class Parrot:
species = "bird"
def __init__(self, name, age):
self.name = name
self.age = age
def sing(self, song):
return "{} sings {}".format(self.name, song)
def dance(self):
return "{} is now dancing".format(self.name)
blu = Parrot("Blu", 10)... | true | true |
f76c21eb1b6770f4d1942e2d8109df0609711ce0 | 14,018 | py | Python | Lib/email/utils.py | deadsnakes/python3.3 | 4faaf44cd5478410ac3b977351c1965fa054b5e9 | [
"PSF-2.0"
] | 652 | 2015-07-26T00:00:17.000Z | 2022-02-24T18:30:04.000Z | Lib/email/utils.py | deadsnakes/python3.3 | 4faaf44cd5478410ac3b977351c1965fa054b5e9 | [
"PSF-2.0"
] | 8 | 2015-09-07T03:38:19.000Z | 2021-05-23T03:18:51.000Z | check-python33-manual/samples/standard_library_337/Lib/email/utils.py | DaveKaretnyk/parsing-utils2 | 40085bbd399fa605f2f2a4708d385a64ffc907de | [
"MIT"
] | 40 | 2015-07-24T19:45:08.000Z | 2021-11-01T14:54:56.000Z | # Copyright (C) 2001-2010 Python Software Foundation
# Author: Barry Warsaw
# Contact: email-sig@python.org
"""Miscellaneous utilities."""
__all__ = [
'collapse_rfc2231_value',
'decode_params',
'decode_rfc2231',
'encode_rfc2231',
'formataddr',
'formatdate',
'format_datetime',
'getaddre... | 35.39899 | 80 | 0.631759 |
__all__ = [
'collapse_rfc2231_value',
'decode_params',
'decode_rfc2231',
'encode_rfc2231',
'formataddr',
'formatdate',
'format_datetime',
'getaddresses',
'make_msgid',
'mktime_tz',
'parseaddr',
'parsedate',
'parsedate_tz',
'parsedate_to_datetime',
'unquote',... | true | true |
f76c2287d2afc25d524c4eb9aebe0d54b5a101fb | 162 | py | Python | src/social_auth/__init__.py | pierredup/sentry | 0145e4b3bc0e775bf3482fe65f5e1a689d0dbb80 | [
"BSD-3-Clause"
] | null | null | null | src/social_auth/__init__.py | pierredup/sentry | 0145e4b3bc0e775bf3482fe65f5e1a689d0dbb80 | [
"BSD-3-Clause"
] | null | null | null | src/social_auth/__init__.py | pierredup/sentry | 0145e4b3bc0e775bf3482fe65f5e1a689d0dbb80 | [
"BSD-3-Clause"
] | null | null | null | from __future__ import absolute_import
import six
from sentry.utils.compat import map
version = (0, 7, 28)
__version__ = ".".join(map(six.text_type, version))
| 18 | 51 | 0.753086 | from __future__ import absolute_import
import six
from sentry.utils.compat import map
version = (0, 7, 28)
__version__ = ".".join(map(six.text_type, version))
| true | true |
f76c22ca4f9ba0a987457849ba02e8756401bd29 | 3,504 | py | Python | hdvw/models/seresnet_mcdo_block.py | shaoshitong/hdvw | fbb39da9ad8a765f74225eec7e9614978c740dde | [
"Apache-2.0"
] | 2 | 2022-03-26T09:08:43.000Z | 2022-03-26T09:09:27.000Z | hdvw/models/seresnet_mcdo_block.py | shaoshitong/hdvw | fbb39da9ad8a765f74225eec7e9614978c740dde | [
"Apache-2.0"
] | null | null | null | hdvw/models/seresnet_mcdo_block.py | shaoshitong/hdvw | fbb39da9ad8a765f74225eec7e9614978c740dde | [
"Apache-2.0"
] | null | null | null | import torch
import torch.nn as nn
import torch.nn.functional as F
import hdvw.models.layers as layers
import hdvw.models.gates as gates
class BasicBlock(nn.Module):
expansion = 1
def __init__(self, in_channels, channels,
stride=1, groups=1, width_per_group=64, rate=0.3, sd=0.0,
... | 30.736842 | 103 | 0.580194 | import torch
import torch.nn as nn
import torch.nn.functional as F
import hdvw.models.layers as layers
import hdvw.models.gates as gates
class BasicBlock(nn.Module):
expansion = 1
def __init__(self, in_channels, channels,
stride=1, groups=1, width_per_group=64, rate=0.3, sd=0.0,
... | true | true |
f76c2330b17c5898fd3eb4a318d62545866cd267 | 133 | py | Python | test_function_AleCol.py | solerjuan/ALMAgalExperiments | 65d3adeb7e9b6609833c0e4f5fb1cdb43a298879 | [
"MIT"
] | null | null | null | test_function_AleCol.py | solerjuan/ALMAgalExperiments | 65d3adeb7e9b6609833c0e4f5fb1cdb43a298879 | [
"MIT"
] | null | null | null | test_function_AleCol.py | solerjuan/ALMAgalExperiments | 65d3adeb7e9b6609833c0e4f5fb1cdb43a298879 | [
"MIT"
] | null | null | null | import math
def truncate(number, digits) -> float:
stepper = 10.0 ** digits
return math.trunc(stepper * number) / stepper
| 16.625 | 49 | 0.669173 | import math
def truncate(number, digits) -> float:
stepper = 10.0 ** digits
return math.trunc(stepper * number) / stepper
| true | true |
f76c24ee3479b82a83e390245d0cbe79abaaeee6 | 785 | py | Python | ivy/functional/backends/torch/array_api/manipulation_functions.py | arxxv/ivy | 740881dfefbdf658f6e395f1b3bc17ed4a77f650 | [
"Apache-2.0"
] | null | null | null | ivy/functional/backends/torch/array_api/manipulation_functions.py | arxxv/ivy | 740881dfefbdf658f6e395f1b3bc17ed4a77f650 | [
"Apache-2.0"
] | null | null | null | ivy/functional/backends/torch/array_api/manipulation_functions.py | arxxv/ivy | 740881dfefbdf658f6e395f1b3bc17ed4a77f650 | [
"Apache-2.0"
] | null | null | null | # global
import torch
from typing import Union, Optional, Tuple, List
def roll(x: torch.Tensor, shift: Union[int, Tuple[int]], axis: Union[int, Tuple[int]]=None)\
-> torch.Tensor:
return torch.roll(x, shift, axis)
# noinspection PyShadowingBuiltins
def flip(x: torch.Tensor,
axis: Optional[Union[i... | 28.035714 | 92 | 0.633121 | import torch
from typing import Union, Optional, Tuple, List
def roll(x: torch.Tensor, shift: Union[int, Tuple[int]], axis: Union[int, Tuple[int]]=None)\
-> torch.Tensor:
return torch.roll(x, shift, axis)
def flip(x: torch.Tensor,
axis: Optional[Union[int, Tuple[int], List[int]]] = None)\
... | true | true |
f76c270eb631440946f27bed52d94d0974458799 | 8,819 | py | Python | tests/convertors/test_conversion.py | xalgorithm/superannotate-python-sdk | 8f28ff3fdfc7bbae41946c79847ad1f6cf8a9300 | [
"MIT"
] | 26 | 2020-09-25T06:25:06.000Z | 2022-01-30T16:44:07.000Z | tests/convertors/test_conversion.py | xalgorithm/superannotate-python-sdk | 8f28ff3fdfc7bbae41946c79847ad1f6cf8a9300 | [
"MIT"
] | 12 | 2020-12-21T19:59:48.000Z | 2022-01-21T10:32:07.000Z | tests/convertors/test_conversion.py | xalgorithm/superannotate-python-sdk | 8f28ff3fdfc7bbae41946c79847ad1f6cf8a9300 | [
"MIT"
] | 11 | 2020-09-17T13:39:19.000Z | 2022-03-02T18:12:29.000Z | import json
import os
import tempfile
from os.path import dirname
from pathlib import Path
from unittest import TestCase
import src.superannotate as sa
class TestCocoSplit(TestCase):
TEST_FOLDER_PATH = "data_set/converter_test/COCO/input/toSuperAnnotate"
TEST_BASE_FOLDER_PATH = "data_set/converter_test"
... | 33.660305 | 97 | 0.516385 | import json
import os
import tempfile
from os.path import dirname
from pathlib import Path
from unittest import TestCase
import src.superannotate as sa
class TestCocoSplit(TestCase):
TEST_FOLDER_PATH = "data_set/converter_test/COCO/input/toSuperAnnotate"
TEST_BASE_FOLDER_PATH = "data_set/converter_test"
... | true | true |
f76c28a377a84db62670bb1386d1893683324fb8 | 6,301 | py | Python | OIDN_def.py | xiadehu27/OIDDN | 29793c855831febcb09b60f8c4882b1e31faa28c | [
"MIT"
] | null | null | null | OIDN_def.py | xiadehu27/OIDDN | 29793c855831febcb09b60f8c4882b1e31faa28c | [
"MIT"
] | null | null | null | OIDN_def.py | xiadehu27/OIDDN | 29793c855831febcb09b60f8c4882b1e31faa28c | [
"MIT"
] | null | null | null | import torch
import torch.nn as nn
from torch.nn import init
import torch.nn.functional as F
import scipy.io as sio
import numpy as np
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
# Define Basic reconstruct block
class BasicBlock(torc... | 35.801136 | 115 | 0.597207 | import torch
import torch.nn as nn
from torch.nn import init
import torch.nn.functional as F
import scipy.io as sio
import numpy as np
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
class BasicBlock(torch.nn.Module):
def __init__(se... | true | true |
f76c29f5ec9e2b9a54a89ef3a18f032df1c179d6 | 28,688 | py | Python | modules/templates/SAFIRE/BT/config.py | nursix/eden | 61d5a947da20bbf4d6458c9be88ed37b1330518c | [
"MIT"
] | 4 | 2015-04-08T19:51:44.000Z | 2016-08-06T07:05:35.000Z | modules/templates/SAFIRE/BT/config.py | nursix/eden | 61d5a947da20bbf4d6458c9be88ed37b1330518c | [
"MIT"
] | 27 | 2015-02-18T23:38:23.000Z | 2020-04-27T13:53:23.000Z | modules/templates/SAFIRE/BT/config.py | nursix/eden | 61d5a947da20bbf4d6458c9be88ed37b1330518c | [
"MIT"
] | 5 | 2015-09-10T05:31:14.000Z | 2017-06-07T11:06:27.000Z | # -*- coding: utf-8 -*-
#from collections import OrderedDict
from gluon import current#, URL
from gluon.storage import Storage
def config(settings):
"""
Settings for Bhutan's extensions to the core SaFiRe template.
"""
T = current.T
settings.base.system_name = T("Disaster Management Informa... | 42.126285 | 118 | 0.459809 |
from gluon import currentfrom gluon.storage import Storage
def config(settings):
T = current.T
settings.base.system_name = T("Disaster Management Information System")
settings.base.system_name_short = T("DMIS")
settings.base.prepopulate_demo = ("default/users",
... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.