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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c212ed3f29ff981ee89359bfec154c7e9ec8fd2 | 6,896 | py | Python | tensorflow-cnn/python/cnn_example_cpu.py | meghanaravikumar/sigopt-examples | e2d938928384f340d77efb52b226f678b6008fb9 | [
"MIT"
] | 213 | 2015-02-24T22:26:46.000Z | 2021-11-29T14:17:52.000Z | tensorflow-cnn/python/cnn_example_cpu.py | meghanaravikumar/sigopt-examples | e2d938928384f340d77efb52b226f678b6008fb9 | [
"MIT"
] | 73 | 2015-11-12T03:11:55.000Z | 2022-03-11T23:43:18.000Z | tensorflow-cnn/python/cnn_example_cpu.py | meghanaravikumar/sigopt-examples | e2d938928384f340d77efb52b226f678b6008fb9 | [
"MIT"
] | 66 | 2016-01-01T18:25:11.000Z | 2020-10-27T03:07:07.000Z | import argparse
import datetime
import numpy
import time
import scipy
import sigopt
import scipy.io
import tensorflow as tf
import math
from skimage.color import rgb2gray
from sklearn import preprocessing
from sklearn.cross_validation import train_test_split
# load SVHN dataset
extra_X = scipy.io.loadmat("extra_32x32.... | 38.960452 | 162 | 0.681265 | import argparse
import datetime
import numpy
import time
import scipy
import sigopt
import scipy.io
import tensorflow as tf
import math
from skimage.color import rgb2gray
from sklearn import preprocessing
from sklearn.cross_validation import train_test_split
extra_X = scipy.io.loadmat("extra_32x32.mat")['X'].astype('... | true | true |
1c212eee1715150be946deae6a9effdc565cc6d4 | 389 | py | Python | Other Basic Stuff/degreeToRadianConverter.py | egmnklc/Sabanci | 31eaeedb01010879b5d62dee84130bd88e7e5bdf | [
"MIT"
] | null | null | null | Other Basic Stuff/degreeToRadianConverter.py | egmnklc/Sabanci | 31eaeedb01010879b5d62dee84130bd88e7e5bdf | [
"MIT"
] | null | null | null | Other Basic Stuff/degreeToRadianConverter.py | egmnklc/Sabanci | 31eaeedb01010879b5d62dee84130bd88e7e5bdf | [
"MIT"
] | null | null | null | # This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
import math
def degreeToRadianConverter():
degree = int(input("Degree: "))
degreeToRadian = degree * math... | 25.933333 | 99 | 0.712082 |
import math
def degreeToRadianConverter():
degree = int(input("Degree: "))
degreeToRadian = degree * math.pi / 180
print(degreeToRadian)
degreeToRadianConverter()
| true | true |
1c212fa0cc0762ba70010ed3aa272651d261bb98 | 1,841 | py | Python | examples/tsp/tsp.py | jrk/opentuner | 0e99e07665e50650bc382c83af3583903f868a6d | [
"MIT"
] | 1 | 2019-06-27T11:32:38.000Z | 2019-06-27T11:32:38.000Z | examples/tsp/tsp.py | jrk/opentuner | 0e99e07665e50650bc382c83af3583903f868a6d | [
"MIT"
] | null | null | null | examples/tsp/tsp.py | jrk/opentuner | 0e99e07665e50650bc382c83af3583903f868a6d | [
"MIT"
] | null | null | null | #!/usr/bin/env python
#
# This is a simple testcase purely for testing the autotuner on permutations
#
# http://en.wikipedia.org/wiki/Travelling_salesman_problem
#
import adddeps #fix sys.path
import argparse
import logging
import opentuner
from opentuner.search.manipulator import (ConfigurationManipulator,
... | 30.683333 | 85 | 0.677349 |
import adddeps
import argparse
import logging
import opentuner
from opentuner.search.manipulator import (ConfigurationManipulator,
PermutationParameter)
from opentuner.search.objective import MinimizeTime
from opentuner.measurement import MeasurementInterface
from ope... | true | true |
1c21308a8be1d7e25a72e8c566b78b9accf30407 | 4,801 | py | Python | test-yourself.py | raysr/Deep-Reinforcement-Learning-Notebooks | a7e988205bb21a2bf6972cf51bbd46d624ecf9ef | [
"MIT"
] | 2 | 2019-02-08T14:39:17.000Z | 2019-03-22T01:03:25.000Z | test-yourself.py | raysr/Gym-Deep-Q-Agents | a7e988205bb21a2bf6972cf51bbd46d624ecf9ef | [
"MIT"
] | null | null | null | test-yourself.py | raysr/Gym-Deep-Q-Agents | a7e988205bb21a2bf6972cf51bbd46d624ecf9ef | [
"MIT"
] | 1 | 2021-03-04T14:48:55.000Z | 2021-03-04T14:48:55.000Z | # INITIALIZATION: libraries, parameters, network...
from keras.models import Sequential # One layer after the other
from keras.layers import Dense, Flatten # Dense layers are fully connected layers, Flatten layers flatten out multidimensional inputs
from collections import deque # For storing moves
i... | 40.686441 | 138 | 0.64924 |
from keras.models import Sequential
from keras.layers import Dense, Flatten
from collections import deque
import os
import numpy as np
import gym
env = gym.make('MountainCar-v0')
import random
model = Sequential()
model.add(Dense(20, input_shape=(... | true | true |
1c213093912c63c36001288cfd99a5d2b13bd8e3 | 518 | py | Python | opm/apps/cmdb/models/cmdb_env.py | leonlm/opm | e5f295230bbe30f645d260e12b890236859dd601 | [
"MIT"
] | null | null | null | opm/apps/cmdb/models/cmdb_env.py | leonlm/opm | e5f295230bbe30f645d260e12b890236859dd601 | [
"MIT"
] | null | null | null | opm/apps/cmdb/models/cmdb_env.py | leonlm/opm | e5f295230bbe30f645d260e12b890236859dd601 | [
"MIT"
] | null | null | null | from django.db import models
from common.models import ModelBaseCreate
from common.config import IS_USED
class CmdbEnv(ModelBaseCreate):
name = models.CharField(unique=True, max_length=32)
description = models.CharField(max_length=128)
is_used = models.CharField(choices=IS_USED["choices"], default=IS_USED... | 27.263158 | 101 | 0.716216 | from django.db import models
from common.models import ModelBaseCreate
from common.config import IS_USED
class CmdbEnv(ModelBaseCreate):
name = models.CharField(unique=True, max_length=32)
description = models.CharField(max_length=128)
is_used = models.CharField(choices=IS_USED["choices"], default=IS_USED... | true | true |
1c21311ed8528ba320fd2368119922307a8904e4 | 1,270 | py | Python | github-es.py | marshyski/pydatadc-2016 | 752c8f547909bac6e20d7dcdacd1b0892afd3914 | [
"Apache-2.0"
] | 15 | 2016-10-09T14:51:37.000Z | 2019-05-21T15:04:58.000Z | github-es.py | marshyski/pydatadc-2016 | 752c8f547909bac6e20d7dcdacd1b0892afd3914 | [
"Apache-2.0"
] | 1 | 2017-07-17T16:18:20.000Z | 2019-01-18T11:37:18.000Z | github-es.py | marshyski/pydatadc-2016 | 752c8f547909bac6e20d7dcdacd1b0892afd3914 | [
"Apache-2.0"
] | 7 | 2016-10-09T14:51:43.000Z | 2022-01-28T20:23:46.000Z | import requests
import elasticsearch
import json
import os
from requests.auth import HTTPBasicAuth
# Connect to ElasticSearch
es = elasticsearch.Elasticsearch("127.0.0.1", port=9200)
# Delete & Create index
es.indices.delete(index="github", ignore=[400, 404])
es.indices.create(index="github", ignore=400)
token = os.... | 27.021277 | 80 | 0.670079 | import requests
import elasticsearch
import json
import os
from requests.auth import HTTPBasicAuth
es = elasticsearch.Elasticsearch("127.0.0.1", port=9200)
es.indices.delete(index="github", ignore=[400, 404])
es.indices.create(index="github", ignore=400)
token = os.environ['TOKEN']
url = "https://api.github.com/s... | false | true |
1c21312f3de971bfa008254c6035cebc09f05e4c | 1,141 | py | Python | encoder/config.py | mgerhards/Real-Time-Voice-Cloning | c7defceed16fc7c3e0798331c740d121e2a76129 | [
"MIT"
] | 35,818 | 2019-06-12T17:16:29.000Z | 2022-03-31T21:02:16.000Z | encoder/config.py | mgerhards/Real-Time-Voice-Cloning | c7defceed16fc7c3e0798331c740d121e2a76129 | [
"MIT"
] | 973 | 2019-06-12T17:16:35.000Z | 2022-03-31T10:35:41.000Z | encoder/config.py | mgerhards/Real-Time-Voice-Cloning | c7defceed16fc7c3e0798331c740d121e2a76129 | [
"MIT"
] | 6,583 | 2019-06-12T21:14:18.000Z | 2022-03-31T03:54:10.000Z | librispeech_datasets = {
"train": {
"clean": ["LibriSpeech/train-clean-100", "LibriSpeech/train-clean-360"],
"other": ["LibriSpeech/train-other-500"]
},
"test": {
"clean": ["LibriSpeech/test-clean"],
"other": ["LibriSpeech/test-other"]
},
"dev": {
"clean": ["L... | 24.804348 | 80 | 0.528484 | librispeech_datasets = {
"train": {
"clean": ["LibriSpeech/train-clean-100", "LibriSpeech/train-clean-360"],
"other": ["LibriSpeech/train-other-500"]
},
"test": {
"clean": ["LibriSpeech/test-clean"],
"other": ["LibriSpeech/test-other"]
},
"dev": {
"clean": ["L... | true | true |
1c2132be5bebc6cf4c966925207244daf921c851 | 354 | py | Python | Python Fundamentals/4. Functions/Lab/02. Calculations.py | a-shiro/SoftUni-Courses | 7d0ca6401017a28b5ff7e7fa3e5df8bba8ddbe77 | [
"MIT"
] | null | null | null | Python Fundamentals/4. Functions/Lab/02. Calculations.py | a-shiro/SoftUni-Courses | 7d0ca6401017a28b5ff7e7fa3e5df8bba8ddbe77 | [
"MIT"
] | null | null | null | Python Fundamentals/4. Functions/Lab/02. Calculations.py | a-shiro/SoftUni-Courses | 7d0ca6401017a28b5ff7e7fa3e5df8bba8ddbe77 | [
"MIT"
] | null | null | null | def calculation(operator,n_1,n_2):
if operator == "multiply":
return n_1 * n_2
elif operator == "divide":
return n_1 // n_2
elif operator == "add":
return n_1 + n_2
elif operator == "subtract":
return n_1 - n_2
operator = input()
n_1 = int(input())
n_2 = int(input())
pr... | 23.6 | 36 | 0.59887 | def calculation(operator,n_1,n_2):
if operator == "multiply":
return n_1 * n_2
elif operator == "divide":
return n_1 // n_2
elif operator == "add":
return n_1 + n_2
elif operator == "subtract":
return n_1 - n_2
operator = input()
n_1 = int(input())
n_2 = int(input())
pr... | true | true |
1c2132dd07dd235afce57629281dc965fd76ea45 | 1,047 | py | Python | axonius_api_client/cli/grp_assets/cmd_get.py | geransmith/axonius_api_client | 09fd564d62f0ddf7aa44db14a509eaafaf0c930f | [
"MIT"
] | null | null | null | axonius_api_client/cli/grp_assets/cmd_get.py | geransmith/axonius_api_client | 09fd564d62f0ddf7aa44db14a509eaafaf0c930f | [
"MIT"
] | null | null | null | axonius_api_client/cli/grp_assets/cmd_get.py | geransmith/axonius_api_client | 09fd564d62f0ddf7aa44db14a509eaafaf0c930f | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""Command line interface for Axonius API Client."""
from ..context import CONTEXT_SETTINGS, click
from ..options import (
AUTH,
EXPORT,
FIELDS_SELECT,
PAGING,
QUERY,
add_options,
get_option_fields_default,
get_option_help,
)
from .grp_common import GET_EXPORT
OP... | 24.348837 | 78 | 0.676218 |
from ..context import CONTEXT_SETTINGS, click
from ..options import (
AUTH,
EXPORT,
FIELDS_SELECT,
PAGING,
QUERY,
add_options,
get_option_fields_default,
get_option_help,
)
from .grp_common import GET_EXPORT
OPTIONS = [
*AUTH,
*PAGING,
*EXPORT,
*GET_EXPORT,
*FIELDS_... | true | true |
1c213303d23997fed95160770473fdcd00e0a576 | 9,132 | py | Python | workflow_scripts/generate_onnx_hub_manifest.py | AK391/models | 6ab1414db8b2895174c921b7c42ee8371e93d882 | [
"Apache-2.0"
] | 4,678 | 2017-10-06T18:49:08.000Z | 2022-03-31T21:55:47.000Z | workflow_scripts/generate_onnx_hub_manifest.py | AK391/models | 6ab1414db8b2895174c921b7c42ee8371e93d882 | [
"Apache-2.0"
] | 400 | 2017-10-09T18:02:12.000Z | 2022-03-30T13:18:41.000Z | workflow_scripts/generate_onnx_hub_manifest.py | AK391/models | 6ab1414db8b2895174c921b7c42ee8371e93d882 | [
"Apache-2.0"
] | 1,040 | 2017-10-15T16:52:53.000Z | 2022-03-30T05:25:27.000Z | import hashlib
import json
import os
import re
import bs4
import markdown
import pandas as pd
import typepy
from os.path import join, split
import onnxruntime as ort
from onnxruntime.capi.onnxruntime_pybind11_state import NotImplemented
import onnx
from onnx import shape_inference
# Acknowledgments to ... | 38.05 | 121 | 0.613228 | import hashlib
import json
import os
import re
import bs4
import markdown
import pandas as pd
import typepy
from os.path import join, split
import onnxruntime as ort
from onnxruntime.capi.onnxruntime_pybind11_state import NotImplemented
import onnx
from onnx import shape_inference
def parse_html(table... | true | true |
1c21344ca1afdabb0141fceb716e8e146c86dc08 | 644 | py | Python | gnn_lib/nn/pool/pool.py | auroua/NPENASv1 | 1a293e50779ccc49456dc905fa989e4778c027a2 | [
"MIT"
] | 4 | 2020-09-30T04:38:45.000Z | 2022-03-18T10:57:54.000Z | gnn_lib/nn/pool/pool.py | auroua/SSNENAS | 65bdece174f0da2f9a3c716b86859abba077d279 | [
"MIT"
] | null | null | null | gnn_lib/nn/pool/pool.py | auroua/SSNENAS | 65bdece174f0da2f9a3c716b86859abba077d279 | [
"MIT"
] | 1 | 2021-01-27T09:27:21.000Z | 2021-01-27T09:27:21.000Z | from torch_sparse import coalesce
from torch_scatter import scatter_mean
from ..utils import remove_self_loops
def pool_edge(cluster, edge_index, edge_attr=None):
num_nodes = cluster.size(0)
edge_index = cluster[edge_index.view(-1)].view(2, -1)
edge_index, edge_attr = remove_self_loops(edge_index, edge_at... | 29.272727 | 74 | 0.698758 | from torch_sparse import coalesce
from torch_scatter import scatter_mean
from ..utils import remove_self_loops
def pool_edge(cluster, edge_index, edge_attr=None):
num_nodes = cluster.size(0)
edge_index = cluster[edge_index.view(-1)].view(2, -1)
edge_index, edge_attr = remove_self_loops(edge_index, edge_at... | true | true |
1c2134d1210e6f85899ea26d8a261b5ca32dbf57 | 2,955 | py | Python | azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/outbound_nat_rule_py3.py | JonathanGailliez/azure-sdk-for-python | f0f051bfd27f8ea512aea6fc0c3212ee9ee0029b | [
"MIT"
] | 1 | 2021-09-07T18:36:04.000Z | 2021-09-07T18:36:04.000Z | azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/outbound_nat_rule_py3.py | JonathanGailliez/azure-sdk-for-python | f0f051bfd27f8ea512aea6fc0c3212ee9ee0029b | [
"MIT"
] | 2 | 2019-10-02T23:37:38.000Z | 2020-10-02T01:17:31.000Z | azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/outbound_nat_rule_py3.py | JonathanGailliez/azure-sdk-for-python | f0f051bfd27f8ea512aea6fc0c3212ee9ee0029b | [
"MIT"
] | 1 | 2018-08-28T14:36:47.000Z | 2018-08-28T14:36:47.000Z | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 44.772727 | 211 | 0.66802 |
from .sub_resource_py3 import SubResource
class OutboundNatRule(SubResource):
_validation = {
'backend_address_pool': {'required': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'allocated_outbound_ports': {'key': 'properties.allocatedOutboundPorts', '... | true | true |
1c21352f3c6fe0cf149172b49536c25f7ce9f207 | 3,686 | py | Python | game/get_data.py | ColliaryNarshe/Visual-Novel-Engine | 03962715c117ad25cf49a156cb340fb93a228bd2 | [
"CC-BY-4.0"
] | null | null | null | game/get_data.py | ColliaryNarshe/Visual-Novel-Engine | 03962715c117ad25cf49a156cb340fb93a228bd2 | [
"CC-BY-4.0"
] | 3 | 2021-11-04T18:46:13.000Z | 2021-11-07T13:44:54.000Z | game/get_data.py | ColliaryNarshe/Visual-Novel-Engine | 03962715c117ad25cf49a156cb340fb93a228bd2 | [
"CC-BY-4.0"
] | null | null | null | import pygame
from glob import glob
from os.path import basename, exists
import json
from configuration import map_coordinates, sound_effects, dialog_image_sheets
from display.maps import Map
from display.portraits import Portrait_Image
def get_data(game):
"""Gets assets and adds them to game"""
get_saves(g... | 30.716667 | 119 | 0.608247 | import pygame
from glob import glob
from os.path import basename, exists
import json
from configuration import map_coordinates, sound_effects, dialog_image_sheets
from display.maps import Map
from display.portraits import Portrait_Image
def get_data(game):
get_saves(game)
get_maps(game)
get_sound_effect... | true | true |
1c2135b6901298041ef0cd311d377344014aad5e | 45,656 | py | Python | salt/modules/opkg.py | juliogonzalez/salt-opensuse | feeaad3b7ede61183f3923ee529314f88727da78 | [
"Apache-2.0",
"MIT"
] | null | null | null | salt/modules/opkg.py | juliogonzalez/salt-opensuse | feeaad3b7ede61183f3923ee529314f88727da78 | [
"Apache-2.0",
"MIT"
] | null | null | null | salt/modules/opkg.py | juliogonzalez/salt-opensuse | feeaad3b7ede61183f3923ee529314f88727da78 | [
"Apache-2.0",
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
'''
Support for Opkg
.. important::
If you feel that Salt should be using this module to manage packages on a
minion, and it is using a different module (or gives an error similar to
*'pkg.install' is not available*), see :ref:`here
<module-provider-override>`.
.. versionadded:... | 31.400275 | 105 | 0.568797 |
from __future__ import absolute_import, print_function, unicode_literals
import copy
import os
import re
import logging
import errno
import salt.utils.args
import salt.utils.data
import salt.utils.files
import salt.utils.itertools
import salt.utils.path
import salt.utils.pkg
import salt.utils.stringutils
import sal... | true | true |
1c21364c4bf32fc3a45021ce4aed251a764c1161 | 11,821 | py | Python | lib/aetycoon/__init__.py | motord/Motorcycle-Diaries | bb5e5e2d4d79573b4231e760d7662db26c03a55e | [
"BSD-3-Clause"
] | 1 | 2022-01-10T03:07:22.000Z | 2022-01-10T03:07:22.000Z | lib/aetycoon/__init__.py | motord/Motorcycle-Diaries | bb5e5e2d4d79573b4231e760d7662db26c03a55e | [
"BSD-3-Clause"
] | null | null | null | lib/aetycoon/__init__.py | motord/Motorcycle-Diaries | bb5e5e2d4d79573b4231e760d7662db26c03a55e | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
import copy
import hashlib
import logging
import pickle
from google.appengine.ext import db
def DerivedProperty(func=None, *args, **kwargs):
"""Implements a 'derived' datastore property.
Derived properties are not set directly, but are instead generated by a
function when required. They... | 30.310256 | 81 | 0.692073 |
import copy
import hashlib
import logging
import pickle
from google.appengine.ext import db
def DerivedProperty(func=None, *args, **kwargs):
if func:
return _DerivedProperty(func, *args, **kwargs)
else:
def decorate(decorated_func):
return _DerivedProperty(decorated_func, *args, **kwargs)... | true | true |
1c213697dfaca19e3b1ff18c0760da22fcb0c010 | 8,775 | py | Python | submitit/auto/auto.py | lematt1991/submitit | d6ff12aee11cd6dfeeff85f0b935165a00691d8e | [
"MIT"
] | null | null | null | submitit/auto/auto.py | lematt1991/submitit | d6ff12aee11cd6dfeeff85f0b935165a00691d8e | [
"MIT"
] | null | null | null | submitit/auto/auto.py | lematt1991/submitit | d6ff12aee11cd6dfeeff85f0b935165a00691d8e | [
"MIT"
] | null | null | null | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import typing as tp
import warnings
from pathlib import Path
from typing import Any, List, Optional, Type, Union
from ..core import plugins... | 42.1875 | 109 | 0.62792 |
import typing as tp
import warnings
from pathlib import Path
from typing import Any, List, Optional, Type, Union
from ..core import plugins
from ..core.core import Executor, Job
from ..core.utils import DelayedSubmission
def _convert_deprecated_args(kwargs: tp.Dict[str, Any], deprecated_args: tp.Mapping[str, s... | true | true |
1c2137021372b25dddec5f68e18914f8e6eec55c | 5,127 | py | Python | py/pygments_reach/__init__.py | mattaudesse/reach-lang | 24787a60ca16295abc47d60adce03dbbe0782c10 | [
"Apache-2.0"
] | 1 | 2021-01-30T05:17:19.000Z | 2021-01-30T05:17:19.000Z | py/pygments_reach/__init__.py | mattaudesse/reach-lang | 24787a60ca16295abc47d60adce03dbbe0782c10 | [
"Apache-2.0"
] | null | null | null | py/pygments_reach/__init__.py | mattaudesse/reach-lang | 24787a60ca16295abc47d60adce03dbbe0782c10 | [
"Apache-2.0"
] | null | null | null | """
pygments_reach
~~~~~~~~~~~~~~
Lexer for Reach.
https://reach.sh
https://github.com/reachsh/reach-lang
"""
# Note: Heavily copied from JavascriptLexer
# https://github.com/pygments/pygments/blob/master/pygments/lexers/javascript.py
import re
from pygments.lexer import RegexLexer, include, by... | 41.346774 | 154 | 0.517457 |
import re
from pygments.lexer import RegexLexer, include, bygroups, default, using, \
this, words, combined
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
Number, Punctuation, Other
import pygments.unistring as uni
__all__ = ['ReachLexer']
JS_IDENT_START = ('(?:[$_' + uni.co... | true | true |
1c2137cac7567a39abbee9438278215fe34ec2c6 | 3,446 | py | Python | tests/test_maintainence.py | piyushg9794/lux | f5be470f5a4837db2746c950bebe2694665c25dc | [
"Apache-2.0"
] | null | null | null | tests/test_maintainence.py | piyushg9794/lux | f5be470f5a4837db2746c950bebe2694665c25dc | [
"Apache-2.0"
] | null | null | null | tests/test_maintainence.py | piyushg9794/lux | f5be470f5a4837db2746c950bebe2694665c25dc | [
"Apache-2.0"
] | null | null | null | # Copyright 2019-2020 The Lux Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | 41.02381 | 145 | 0.724608 |
from .context import lux
import pytest
import pandas as pd
from lux.vis.Vis import Vis
def test_metadata_subsequent_display():
df = pd.read_csv("lux/data/car.csv")
df._repr_html_()
assert df._metadata_fresh == True, "Failed to maintain metadata after display df"
df._repr_html_()
ass... | true | true |
1c213b8bafbc1666cf205354189a49108753664f | 856 | py | Python | setup.py | MattAshman/pvi | 74322ac23efd2674e46c953e5573d19d8d6bce4c | [
"MIT"
] | 1 | 2022-03-17T00:41:27.000Z | 2022-03-17T00:41:27.000Z | setup.py | MattAshman/pvi | 74322ac23efd2674e46c953e5573d19d8d6bce4c | [
"MIT"
] | null | null | null | setup.py | MattAshman/pvi | 74322ac23efd2674e46c953e5573d19d8d6bce4c | [
"MIT"
] | 1 | 2022-03-17T10:53:03.000Z | 2022-03-17T10:53:03.000Z | import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="pvi",
version="0.0.1",
author="Matt Ashman",
author_email="mca39@cam.ac.uk",
description="Partitioned variational inference",
long_description... | 31.703704 | 70 | 0.584112 | import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="pvi",
version="0.0.1",
author="Matt Ashman",
author_email="mca39@cam.ac.uk",
description="Partitioned variational inference",
long_description... | true | true |
1c213d7c0e04f75f2296e4944c475b0add687a47 | 365 | py | Python | instalacion/urls.py | Cecilis/control_aforo | 9301ffe6b571d408e17ea3a5e73a607289c3a189 | [
"MIT"
] | null | null | null | instalacion/urls.py | Cecilis/control_aforo | 9301ffe6b571d408e17ea3a5e73a607289c3a189 | [
"MIT"
] | 6 | 2021-04-08T21:53:32.000Z | 2022-02-10T09:42:06.000Z | instalacion/urls.py | Cecilis/control_aforo | 9301ffe6b571d408e17ea3a5e73a607289c3a189 | [
"MIT"
] | null | null | null | # -*- encoding: utf-8 -*-
from django.urls import path
from django.conf.urls import url
from instalacion import views
urlpatterns = [
path('', views.instalacion, name='instalacion'),
path('todos', views.todos),
path('editar/<str:id>/', views.editar),
path('actualizar/<str:id>/', views.actualizar),
... | 30.416667 | 52 | 0.668493 |
from django.urls import path
from django.conf.urls import url
from instalacion import views
urlpatterns = [
path('', views.instalacion, name='instalacion'),
path('todos', views.todos),
path('editar/<str:id>/', views.editar),
path('actualizar/<str:id>/', views.actualizar),
path('eliminar/<str:id>/'... | true | true |
1c213d9252983529b9d82e6fb7771d1a3ddc5d89 | 3,467 | py | Python | refreshbooks/adapters.py | fgregg/refreshbooks | cfd65ecd38cb6be3b61dbf6a01f93800603f34b1 | [
"MIT"
] | null | null | null | refreshbooks/adapters.py | fgregg/refreshbooks | cfd65ecd38cb6be3b61dbf6a01f93800603f34b1 | [
"MIT"
] | null | null | null | refreshbooks/adapters.py | fgregg/refreshbooks | cfd65ecd38cb6be3b61dbf6a01f93800603f34b1 | [
"MIT"
] | null | null | null | from lxml import etree, objectify
import decimal
import sys
from refreshbooks import elements, client
# To make life nicer for clients, allow built-in numeric-alike types
# in API parameters.
if sys.version_info.major >= 3:
_stringable_types = frozenset([float, int, decimal.Decimal])
else:
_stringable_types =... | 33.990196 | 78 | 0.654456 | from lxml import etree, objectify
import decimal
import sys
from refreshbooks import elements, client
if sys.version_info.major >= 3:
_stringable_types = frozenset([float, int, decimal.Decimal])
else:
_stringable_types = frozenset([float, int, long, decimal.Decimal])
def encode_as_simple_from_element(name,... | true | true |
1c213e676c54227f5b14fbc28a6353e4b9a3796e | 1,794 | py | Python | account/views.py | djwesleyborges/AlugueTools | 0dc4a7d761d7d48de8dab333c1b3ac9037d68680 | [
"Apache-2.0"
] | null | null | null | account/views.py | djwesleyborges/AlugueTools | 0dc4a7d761d7d48de8dab333c1b3ac9037d68680 | [
"Apache-2.0"
] | null | null | null | account/views.py | djwesleyborges/AlugueTools | 0dc4a7d761d7d48de8dab333c1b3ac9037d68680 | [
"Apache-2.0"
] | null | null | null | from django.contrib.auth import authenticate, login, logout
from django.shortcuts import redirect, render
from django.urls import reverse_lazy
from account.forms import RegisterUserForm
from django.utils.decorators import method_decorator
from django.views.generic import TemplateView
from django.contrib.auth.de... | 35.176471 | 98 | 0.676143 | from django.contrib.auth import authenticate, login, logout
from django.shortcuts import redirect, render
from django.urls import reverse_lazy
from account.forms import RegisterUserForm
from django.utils.decorators import method_decorator
from django.views.generic import TemplateView
from django.contrib.auth.de... | true | true |
1c213f07d06ee6f0989aa77a7a3a2b7fda7ed1d4 | 58,535 | py | Python | koku/api/report/test/gcp/tests_gcp_query_handler.py | cgoodfred/koku | f1de8bc90d6a818c4f77af710cafe50dc1274700 | [
"Apache-2.0"
] | null | null | null | koku/api/report/test/gcp/tests_gcp_query_handler.py | cgoodfred/koku | f1de8bc90d6a818c4f77af710cafe50dc1274700 | [
"Apache-2.0"
] | null | null | null | koku/api/report/test/gcp/tests_gcp_query_handler.py | cgoodfred/koku | f1de8bc90d6a818c4f77af710cafe50dc1274700 | [
"Apache-2.0"
] | null | null | null | #
# Copyright 2021 Red Hat Inc.
# SPDX-License-Identifier: Apache-2.0
#
"""Test GCP Report Queries."""
import logging
from datetime import timedelta
from decimal import Decimal
from decimal import ROUND_HALF_UP
from unittest import skip
from unittest.mock import patch
from unittest.mock import PropertyMock
from django... | 51.436731 | 169 | 0.649253 |
import logging
from datetime import timedelta
from decimal import Decimal
from decimal import ROUND_HALF_UP
from unittest import skip
from unittest.mock import patch
from unittest.mock import PropertyMock
from django.db.models import F
from django.db.models import Sum
from django.urls import reverse
from rest_fram... | true | true |
1c213f6a377f0259872e18da4f1e8364344c171d | 16,500 | py | Python | spark_cluster/04_4_HV_stepwise_balanced/HV_v3_stepwise_NYT_sim1_and_sim2_to_sim3/6200_ML2_HV_v3_stepwise_NYT_sim1_and_sim2_to_sim3_round1_human_validation.py | poltextlab/nyt_hybrid_classification_workflow | 3f676938b08f4373be3a83e975ee51dfa5ce6bf5 | [
"MIT"
] | null | null | null | spark_cluster/04_4_HV_stepwise_balanced/HV_v3_stepwise_NYT_sim1_and_sim2_to_sim3/6200_ML2_HV_v3_stepwise_NYT_sim1_and_sim2_to_sim3_round1_human_validation.py | poltextlab/nyt_hybrid_classification_workflow | 3f676938b08f4373be3a83e975ee51dfa5ce6bf5 | [
"MIT"
] | null | null | null | spark_cluster/04_4_HV_stepwise_balanced/HV_v3_stepwise_NYT_sim1_and_sim2_to_sim3/6200_ML2_HV_v3_stepwise_NYT_sim1_and_sim2_to_sim3_round1_human_validation.py | poltextlab/nyt_hybrid_classification_workflow | 3f676938b08f4373be3a83e975ee51dfa5ce6bf5 | [
"MIT"
] | null | null | null | # import libraries
from pyspark.sql import SparkSession
from pyspark import SparkConf
from pyspark.sql.types import *
from pyspark.sql.functions import col, count, lit, rand, when
import pandas as pd
from math import ceil
#################################################
# spark config
##############################... | 44.959128 | 151 | 0.675758 |
from pyspark.sql import SparkSession
from pyspark import SparkConf
from pyspark.sql.types import *
from pyspark.sql.functions import col, count, lit, rand, when
import pandas as pd
from math import ceil
| true | true |
1c213f6a78921ff7710917504c6070877570764d | 1,927 | py | Python | Google_stonehead/stonehead_config.py | sunhanaix/wechat_iot | 912fd2e307cfc4a369f404beafa4159a42fcafaf | [
"Apache-2.0"
] | 18 | 2022-02-22T06:12:50.000Z | 2022-03-13T17:26:14.000Z | Google_stonehead/stonehead_config.py | sunhanaix/wechat_iot | 912fd2e307cfc4a369f404beafa4159a42fcafaf | [
"Apache-2.0"
] | null | null | null | Google_stonehead/stonehead_config.py | sunhanaix/wechat_iot | 912fd2e307cfc4a369f404beafa4159a42fcafaf | [
"Apache-2.0"
] | 7 | 2022-02-22T07:39:12.000Z | 2022-03-20T05:02:54.000Z | import os,sys,re,json,random,logging
debug=True
wechat_port=8001 #werobot监听的端口,需要apache反向代理映射下
#对接微信公众号的相关参数设置
WechatAppID='wxf02565d1b6123456'
WechatAppSecret='f04b29ee7ef5242f9928194baa123456'
WechatToken='wechatTokenPassword'
WechatEncodingAESKey='AhWkQssrZflDg8ARx9WMKXBdaMxOCteW12345678'
ssh_start_port=45001 ... | 30.587302 | 104 | 0.802283 | import os,sys,re,json,random,logging
debug=True
wechat_port=8001
WechatAppID='wxf02565d1b6123456'
WechatAppSecret='f04b29ee7ef5242f9928194baa123456'
WechatToken='wechatTokenPassword'
WechatEncodingAESKey='AhWkQssrZflDg8ARx9WMKXBdaMxOCteW12345678'
ssh_start_port=45001
ssh_end_port=45999
broker = 'localhost'... | true | true |
1c213fb958f9a722cf89ae8c9fa8427248e09296 | 8,839 | py | Python | tools/visual_utils/visualize_utils.py | syigzaw/OpenPCDet | 829d99c8698c305fe2e1a08d49b2603f79599887 | [
"Apache-2.0"
] | null | null | null | tools/visual_utils/visualize_utils.py | syigzaw/OpenPCDet | 829d99c8698c305fe2e1a08d49b2603f79599887 | [
"Apache-2.0"
] | null | null | null | tools/visual_utils/visualize_utils.py | syigzaw/OpenPCDet | 829d99c8698c305fe2e1a08d49b2603f79599887 | [
"Apache-2.0"
] | null | null | null | import mayavi.mlab as mlab
import numpy as np
import torch
box_colormap = [
[1, 1, 1],
[0, 1, 0],
[0, 1, 1],
[1, 1, 0],
]
def check_numpy_to_torch(x):
if isinstance(x, np.ndarray):
return torch.from_numpy(x).float(), True
return x, False
def rotate_points_along_z(points, angle):
... | 40.545872 | 125 | 0.563638 | import mayavi.mlab as mlab
import numpy as np
import torch
box_colormap = [
[1, 1, 1],
[0, 1, 0],
[0, 1, 1],
[1, 1, 0],
]
def check_numpy_to_torch(x):
if isinstance(x, np.ndarray):
return torch.from_numpy(x).float(), True
return x, False
def rotate_points_along_z(points, angle):
... | true | true |
1c214033ea9b8bf8e932e73b08eb58b0d15c9bf8 | 9,351 | py | Python | train.py | ananyaganesh/ftmp | 9ee23939f0c1da854846b8ce1a9abe4e9b377031 | [
"MIT"
] | 1 | 2021-06-17T08:18:41.000Z | 2021-06-17T08:18:41.000Z | train.py | ananyaganesh/ftmp | 9ee23939f0c1da854846b8ce1a9abe4e9b377031 | [
"MIT"
] | 1 | 2021-06-17T08:21:42.000Z | 2021-06-22T04:33:18.000Z | train.py | ananyaganesh/ftmp | 9ee23939f0c1da854846b8ce1a9abe4e9b377031 | [
"MIT"
] | 1 | 2021-08-06T13:43:08.000Z | 2021-08-06T13:43:08.000Z | import time
import os
import pyhocon
import torch
from torch import nn
from torch import optim
from models import *
from utils import *
from nn_blocks import *
from sklearn.metrics import accuracy_score, classification_report
from transformers import *
import argparse
import random
import numpy as np
device = torch.de... | 44.741627 | 194 | 0.608277 | import time
import os
import pyhocon
import torch
from torch import nn
from torch import optim
from models import *
from utils import *
from nn_blocks import *
from sklearn.metrics import accuracy_score, classification_report
from transformers import *
import argparse
import random
import numpy as np
device = torch.de... | true | true |
1c2141c98bf1e3fcf54b428f63cee4418e54e4a8 | 16,189 | py | Python | numpy/numarray/functions.py | walshb/numpy | 073bc39c58a6788ffda6aaa7549955cc3d4fdc93 | [
"BSD-3-Clause"
] | 343 | 2015-01-07T05:58:44.000Z | 2022-03-15T14:55:21.000Z | numpy/numarray/functions.py | walshb/numpy | 073bc39c58a6788ffda6aaa7549955cc3d4fdc93 | [
"BSD-3-Clause"
] | 61 | 2015-03-19T18:20:21.000Z | 2019-10-23T12:58:23.000Z | numpy/numarray/functions.py | walshb/numpy | 073bc39c58a6788ffda6aaa7549955cc3d4fdc93 | [
"BSD-3-Clause"
] | 66 | 2015-01-20T15:35:05.000Z | 2021-11-25T16:49:41.000Z | # missing Numarray defined names (in from numarray import *)
##__all__ = ['ClassicUnpickler', 'Complex32_fromtype',
## 'Complex64_fromtype', 'ComplexArray', 'Error',
## 'MAX_ALIGN', 'MAX_INT_SIZE', 'MAX_LINE_WIDTH',
## 'NDArray', 'NewArray', 'NumArray',
## 'NumError', 'PRECISION'... | 32.442886 | 90 | 0.608129 |
g', 'FileSeekWarning', 'fromstring',
'fromfunction', 'fromlist', 'getShape', 'getTypeObject',
'identity', 'info', 'innerproduct', 'inputarray',
'isBigEndian', 'kroneckerproduct', 'lexsort', 'math',
'operator', 'outerproduct', 'put', 'putmask', 'rank',
'repeat... | true | true |
1c214292f51d916a78601df6235ff74f54ab2060 | 1,028 | py | Python | app/util/pre_run/check_for_updates.py | RaimisJ/dc-app-performance-toolkit | 492a4dd163fddecf1a277ce3f6460060018eedc8 | [
"Apache-2.0"
] | 48 | 2019-09-09T23:09:23.000Z | 2022-01-14T16:01:48.000Z | app/util/pre_run/check_for_updates.py | RaimisJ/dc-app-performance-toolkit | 492a4dd163fddecf1a277ce3f6460060018eedc8 | [
"Apache-2.0"
] | 101 | 2019-09-11T06:03:52.000Z | 2022-03-14T14:32:45.000Z | app/util/pre_run/check_for_updates.py | RaimisJ/dc-app-performance-toolkit | 492a4dd163fddecf1a277ce3f6460060018eedc8 | [
"Apache-2.0"
] | 395 | 2019-09-09T12:14:46.000Z | 2022-03-31T23:03:32.000Z | from util.common_util import get_latest_version, get_current_version, get_unsupported_version
latest_version = get_latest_version()
current_version = get_current_version()
unsupported_version = get_unsupported_version()
if latest_version is None:
print('Warning: failed to get the latest version')
elif current_ver... | 46.727273 | 93 | 0.758755 | from util.common_util import get_latest_version, get_current_version, get_unsupported_version
latest_version = get_latest_version()
current_version = get_current_version()
unsupported_version = get_unsupported_version()
if latest_version is None:
print('Warning: failed to get the latest version')
elif current_ver... | true | true |
1c214314de862e7fe2fccf3b231731ecb7f7d4a1 | 40,421 | py | Python | dask/bag/tests/test_bag.py | migueltorrescosta/dask | 60f488cf7358d14c523f84de9afbb10022818367 | [
"BSD-3-Clause"
] | 2 | 2018-12-29T13:47:40.000Z | 2018-12-29T13:47:49.000Z | dask/bag/tests/test_bag.py | migueltorrescosta/dask | 60f488cf7358d14c523f84de9afbb10022818367 | [
"BSD-3-Clause"
] | null | null | null | dask/bag/tests/test_bag.py | migueltorrescosta/dask | 60f488cf7358d14c523f84de9afbb10022818367 | [
"BSD-3-Clause"
] | null | null | null | # coding=utf-8
from __future__ import absolute_import, division, print_function
from itertools import repeat
import math
import os
import random
import partd
import pytest
from toolz import merge, join, filter, identity, valmap, groupby, pluck
import dask
import dask.bag as db
from dask.bag.core import (Bag, lazify,... | 31.213127 | 101 | 0.586304 |
from __future__ import absolute_import, division, print_function
from itertools import repeat
import math
import os
import random
import partd
import pytest
from toolz import merge, join, filter, identity, valmap, groupby, pluck
import dask
import dask.bag as db
from dask.bag.core import (Bag, lazify, lazify_task, ... | true | true |
1c214423d780f49bee6949f873e8a51f6007488f | 524 | py | Python | packages/python/plotly/plotly/validators/layout/ternary/caxis/_showtickprefix.py | mastermind88/plotly.py | efa70710df1af22958e1be080e105130042f1839 | [
"MIT"
] | null | null | null | packages/python/plotly/plotly/validators/layout/ternary/caxis/_showtickprefix.py | mastermind88/plotly.py | efa70710df1af22958e1be080e105130042f1839 | [
"MIT"
] | null | null | null | packages/python/plotly/plotly/validators/layout/ternary/caxis/_showtickprefix.py | mastermind88/plotly.py | efa70710df1af22958e1be080e105130042f1839 | [
"MIT"
] | null | null | null | import _plotly_utils.basevalidators
class ShowtickprefixValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="showtickprefix", parent_name="layout.ternary.caxis", **kwargs
):
super(ShowtickprefixValidator, self).__init__(
plotly_name=plotly_n... | 34.933333 | 88 | 0.648855 | import _plotly_utils.basevalidators
class ShowtickprefixValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="showtickprefix", parent_name="layout.ternary.caxis", **kwargs
):
super(ShowtickprefixValidator, self).__init__(
plotly_name=plotly_n... | true | true |
1c2144379b1fc17995795b25640fbfcfe79148f6 | 1,015 | py | Python | tests/test_pipelines.py | hemantdwave/pipelines | 50b30be96c22eb883cc36c598e3a9a679300b9f2 | [
"Apache-2.0"
] | null | null | null | tests/test_pipelines.py | hemantdwave/pipelines | 50b30be96c22eb883cc36c598e3a9a679300b9f2 | [
"Apache-2.0"
] | null | null | null | tests/test_pipelines.py | hemantdwave/pipelines | 50b30be96c22eb883cc36c598e3a9a679300b9f2 | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 D-Wave Systems Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | 32.741935 | 74 | 0.749754 |
import os
import subprocess
import sys
import unittest
project_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
class TestDemo(unittest.TestCase):
def test_smoke(self):
demo_file = os.path.join(project_dir, 'pipelines.py')
subprocess.check_output([sys.executable, ... | true | true |
1c214586396cf76521b9540edffb4748910f7c23 | 21,159 | py | Python | detectron2/data/datasets/crowdhuman.py | megvii-research/Iter-E2EDET | c649a0b29be48e7253048a2c8efd6b28a2e3197b | [
"MIT"
] | 9 | 2022-03-25T04:57:22.000Z | 2022-03-31T10:49:03.000Z | detectron2/data/datasets/crowdhuman.py | megvii-model/Iter-E2EDET | c649a0b29be48e7253048a2c8efd6b28a2e3197b | [
"MIT"
] | 4 | 2022-03-23T07:40:07.000Z | 2022-03-29T14:43:19.000Z | detectron2/data/datasets/crowdhuman.py | megvii-model/Iter-E2EDET | c649a0b29be48e7253048a2c8efd6b28a2e3197b | [
"MIT"
] | 2 | 2022-03-28T00:21:07.000Z | 2022-03-28T15:02:46.000Z | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import logging
import numpy as np
import os, io, json
from PIL import Image
import contextlib, datetime
import pycocotools.mask as mask_util
from fvcore.common.file_io import PathManager, file_lock
from fvcore.common.timer import Timer
from detectro... | 42.918864 | 104 | 0.634624 |
import logging
import numpy as np
import os, io, json
from PIL import Image
import contextlib, datetime
import pycocotools.mask as mask_util
from fvcore.common.file_io import PathManager, file_lock
from fvcore.common.timer import Timer
from detectron2.structures import Boxes, BoxMode, PolygonMasks
from detectron2.data... | true | true |
1c21460e6dda52bb9feff5931773752171629ccb | 1,166 | py | Python | tools/leetcode.173.Binary Search Tree Iterator/leetcode.173.Binary Search Tree Iterator.submission2.py | tedye/leetcode | 975d7e3b8cb9b6be9e80e07febf4bcf6414acd46 | [
"MIT"
] | 4 | 2015-10-10T00:30:55.000Z | 2020-07-27T19:45:54.000Z | tools/leetcode.173.Binary Search Tree Iterator/leetcode.173.Binary Search Tree Iterator.submission2.py | tedye/leetcode | 975d7e3b8cb9b6be9e80e07febf4bcf6414acd46 | [
"MIT"
] | null | null | null | tools/leetcode.173.Binary Search Tree Iterator/leetcode.173.Binary Search Tree Iterator.submission2.py | tedye/leetcode | 975d7e3b8cb9b6be9e80e07febf4bcf6414acd46 | [
"MIT"
] | null | null | null | # Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class BSTIterator:
# @param root, a binary search tree's root node
def __init__(self, root):
self.index = 0
self.inorder = []
... | 1,166 | 1,166 | 0.509434 | true | true | |
1c214727476b1787385469cb7dcfcd86d1caa4b6 | 2,887 | py | Python | yatube/posts/tests/test_forms.py | KiRerSmith/YaTube | 5a9be47106ab121b47fc6c7aa983eb481e175216 | [
"BSD-3-Clause"
] | null | null | null | yatube/posts/tests/test_forms.py | KiRerSmith/YaTube | 5a9be47106ab121b47fc6c7aa983eb481e175216 | [
"BSD-3-Clause"
] | null | null | null | yatube/posts/tests/test_forms.py | KiRerSmith/YaTube | 5a9be47106ab121b47fc6c7aa983eb481e175216 | [
"BSD-3-Clause"
] | null | null | null | import shutil
import tempfile
from django.conf import settings
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import Client, TestCase
from django.urls import reverse
from posts.forms import PostForm
from posts.models import Group, Post, User
class PostFormTests(TestCase):
@classme... | 31.043011 | 72 | 0.566678 | import shutil
import tempfile
from django.conf import settings
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import Client, TestCase
from django.urls import reverse
from posts.forms import PostForm
from posts.models import Group, Post, User
class PostFormTests(TestCase):
@classme... | true | true |
1c214743c3cd15d5581a52001b8cd917da174396 | 15,628 | py | Python | models/run_models.py | katsu1110/DataScienceComp | 86edf7cab0af372624bba7f3026a3db32e7cd1d6 | [
"MIT"
] | null | null | null | models/run_models.py | katsu1110/DataScienceComp | 86edf7cab0af372624bba7f3026a3db32e7cd1d6 | [
"MIT"
] | null | null | null | models/run_models.py | katsu1110/DataScienceComp | 86edf7cab0af372624bba7f3026a3db32e7cd1d6 | [
"MIT"
] | null | null | null | import numpy as np
import pandas as pd
import os
import sys
import gc
import re
from typing import List, NoReturn, Union, Tuple, Optional, Text, Generic, Callable, Dict
from sklearn.preprocessing import StandardScaler, MinMaxScaler, OneHotEncoder, QuantileTransformer
from sklearn.model_selection import KFold, Stratifie... | 44.271955 | 169 | 0.608011 | import numpy as np
import pandas as pd
import os
import sys
import gc
import re
from typing import List, NoReturn, Union, Tuple, Optional, Text, Generic, Callable, Dict
from sklearn.preprocessing import StandardScaler, MinMaxScaler, OneHotEncoder, QuantileTransformer
from sklearn.model_selection import KFold, Stratifie... | true | true |
1c214836ff5335fa1bcbe58733e54048a4dbcd46 | 875 | py | Python | packages/imdisk.py | zpcc/mpkg-pkgs | 6f919c7ef0ce0dbee298bcb8328be0e9e65fc833 | [
"Apache-2.0"
] | 1 | 2020-12-16T14:15:12.000Z | 2020-12-16T14:15:12.000Z | packages/imdisk.py | zpcc/mpkg-pkgs | 6f919c7ef0ce0dbee298bcb8328be0e9e65fc833 | [
"Apache-2.0"
] | null | null | null | packages/imdisk.py | zpcc/mpkg-pkgs | 6f919c7ef0ce0dbee298bcb8328be0e9e65fc833 | [
"Apache-2.0"
] | null | null | null | from mpkg.common import Soft
from mpkg.load import Load
class Package(Soft):
ID = 'imdisk'
def _prepare(self):
data = self.data
data.bin = ['MPKG-PORTABLE']
data.cmd = {
'end': '"{root}\\install.bat"\necho please execute rmdir /s /q "{root}" after installtion'}
par... | 33.653846 | 103 | 0.534857 | from mpkg.common import Soft
from mpkg.load import Load
class Package(Soft):
ID = 'imdisk'
def _prepare(self):
data = self.data
data.bin = ['MPKG-PORTABLE']
data.cmd = {
'end': '"{root}\\install.bat"\necho please execute rmdir /s /q "{root}" after installtion'}
par... | true | true |
1c214839bbc4587fa65137cb0a96b4f9753a3ed6 | 37,226 | py | Python | nova/tests/cells/test_cells_manager.py | SnabbCo/nova | d156d7fdf241569da2c27ae02ec88e6ef448f7e2 | [
"Apache-2.0"
] | 2 | 2016-04-19T08:20:39.000Z | 2021-10-03T16:00:37.000Z | nova/tests/cells/test_cells_manager.py | SnabbCo/nova | d156d7fdf241569da2c27ae02ec88e6ef448f7e2 | [
"Apache-2.0"
] | null | null | null | nova/tests/cells/test_cells_manager.py | SnabbCo/nova | d156d7fdf241569da2c27ae02ec88e6ef448f7e2 | [
"Apache-2.0"
] | 1 | 2020-07-24T06:47:54.000Z | 2020-07-24T06:47:54.000Z | # Copyright (c) 2012 Rackspace Hosting
# 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 req... | 46.474407 | 79 | 0.605088 |
import copy
import datetime
import mock
from oslo.config import cfg
from nova.cells import messaging
from nova.cells import utils as cells_utils
from nova import context
from nova.openstack.common import timeutils
from nova import test
from nova.tests.cells import fakes
from nova.tests import fake_serve... | true | true |
1c2148b9b4c248414e090f12eba88b288502b5a8 | 5,398 | py | Python | torchmetrics/audio/stoi.py | bibinwils/metrics | e1c3fda24f90367803c2b04315ad7c8bced719db | [
"Apache-2.0"
] | 1 | 2021-10-15T10:49:25.000Z | 2021-10-15T10:49:25.000Z | torchmetrics/audio/stoi.py | bibinwils/metrics | e1c3fda24f90367803c2b04315ad7c8bced719db | [
"Apache-2.0"
] | null | null | null | torchmetrics/audio/stoi.py | bibinwils/metrics | e1c3fda24f90367803c2b04315ad7c8bced719db | [
"Apache-2.0"
] | null | null | null | # 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... | 40.283582 | 120 | 0.665987 |
from typing import Any, Callable, Optional
from torch import Tensor, tensor
from torchmetrics.functional.audio.stoi import stoi
from torchmetrics.metric import Metric
from torchmetrics.utilities.imports import _PYSTOI_AVAILABLE
class STOI(Metric):
sum_stoi: Tensor
total: Tensor
is_different... | true | true |
1c21496c9a14cf8468c52057bbade1d63c569b7e | 698 | py | Python | 03_Unit_3/Sprint3/Module1-web-application-development-with-flask/app/class-2/teams_oop.py | mark-morelos/my_DataScience_notes | 2e05a3d77949cb8ccd9aac7c04cf7758d7b73d1c | [
"MIT"
] | null | null | null | 03_Unit_3/Sprint3/Module1-web-application-development-with-flask/app/class-2/teams_oop.py | mark-morelos/my_DataScience_notes | 2e05a3d77949cb8ccd9aac7c04cf7758d7b73d1c | [
"MIT"
] | null | null | null | 03_Unit_3/Sprint3/Module1-web-application-development-with-flask/app/class-2/teams_oop.py | mark-morelos/my_DataScience_notes | 2e05a3d77949cb8ccd9aac7c04cf7758d7b73d1c | [
"MIT"
] | null | null | null |
class Team():
def __init__(self, name, city):
self.name = name
self.city = city
def __str__(self):
return f"<Team {self.city} {self.name}>"
def __repr__(self):
return f"<Team {self.city} {self.name}>"
@property
def full_name(self):
return f"{self.city} {... | 21.8125 | 76 | 0.600287 |
class Team():
def __init__(self, name, city):
self.name = name
self.city = city
def __str__(self):
return f"<Team {self.city} {self.name}>"
def __repr__(self):
return f"<Team {self.city} {self.name}>"
@property
def full_name(self):
return f"{self.city} {... | true | true |
1c214a915261366c06671fc25b1e24eca4d80cb0 | 3,059 | py | Python | slowfast/utils/weight_init_helper.py | coldmanck/VidHOI | 523e9297202e869cfff70736336dabb35faf8d00 | [
"Apache-2.0"
] | 26 | 2021-05-26T12:17:46.000Z | 2022-03-24T10:30:22.000Z | slowfast/utils/weight_init_helper.py | coldmanck/VidHOI | 523e9297202e869cfff70736336dabb35faf8d00 | [
"Apache-2.0"
] | 4 | 2021-06-24T07:14:37.000Z | 2022-03-31T07:51:20.000Z | slowfast/utils/weight_init_helper.py | coldmanck/VidHOI | 523e9297202e869cfff70736336dabb35faf8d00 | [
"Apache-2.0"
] | 7 | 2021-05-31T14:43:13.000Z | 2022-03-03T13:32:18.000Z | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""Utility function for weight initialization"""
import torch.nn as nn
from fvcore.nn.weight_init import c2_msra_fill
def init_weights(model, fc_init_std=0.01, zero_init_final_bn=True, cfg=None):
"""
Performs ResN... | 36.855422 | 86 | 0.579601 |
import torch.nn as nn
from fvcore.nn.weight_init import c2_msra_fill
def init_weights(model, fc_init_std=0.01, zero_init_final_bn=True, cfg=None):
for m in model.modules():
if isinstance(m, nn.Conv3d):
c2_msra_fill(m)
elif isinstance(m, nn.BatchNorm3d):
if (
... | true | true |
1c214aca77b4d634c2141e3fa9517dd1e07446eb | 2,143 | py | Python | source/services/lex-bot/shared/helpers.py | kevinschwarz/serverless-bot-framework | 4b063418ed60a7d3ea7d8f81ed8cd040c43123c7 | [
"Apache-2.0"
] | 82 | 2018-07-24T18:37:07.000Z | 2021-08-23T14:46:07.000Z | source/services/lex-bot/shared/helpers.py | kevinschwarz/serverless-bot-framework | 4b063418ed60a7d3ea7d8f81ed8cd040c43123c7 | [
"Apache-2.0"
] | 17 | 2018-08-14T16:16:47.000Z | 2021-08-31T21:19:21.000Z | source/services/lex-bot/shared/helpers.py | aassadza/serverless-bot-framework | 29115adf763603ca6174a0dbaa79792ab0ae8f19 | [
"Apache-2.0"
] | 42 | 2018-07-25T19:21:18.000Z | 2021-09-19T11:19:21.000Z | ######################################################################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... | 61.228571 | 118 | 0.40364 | true | true | |
1c214b79253b09c1106c399d1ffb281e4e9b5b03 | 313 | py | Python | Location/Location.py | y701311/Othello | f8a46ebc0dbc4e9fcac237482aaf8e54babffcef | [
"MIT"
] | 2 | 2022-02-04T15:52:50.000Z | 2022-02-09T01:26:24.000Z | Location/Location.py | y701311/Othello | f8a46ebc0dbc4e9fcac237482aaf8e54babffcef | [
"MIT"
] | 1 | 2022-02-04T16:05:17.000Z | 2022-02-04T16:30:33.000Z | Location/Location.py | y701311/Othello | f8a46ebc0dbc4e9fcac237482aaf8e54babffcef | [
"MIT"
] | null | null | null |
# 盤上の場所を表すクラス
class Location:
def __init__(self, row:int=-1, column:int=-1) -> None:
self.row = row
self.column = column
# 範囲の検証
def checkRange(self) -> bool:
if (1 <= self.row <= 8) and (1 <= self.column <= 8):
return True
else:
return False
| 22.357143 | 60 | 0.520767 |
class Location:
def __init__(self, row:int=-1, column:int=-1) -> None:
self.row = row
self.column = column
def checkRange(self) -> bool:
if (1 <= self.row <= 8) and (1 <= self.column <= 8):
return True
else:
return False
| true | true |
1c214bb0efacdae1b88a106e7a6778d480b7ecf6 | 26,580 | py | Python | src/run.py | gzpbbd/DDQ | 44f4d2bf27c4299d349339de7bc85d1b9b640c50 | [
"MIT"
] | null | null | null | src/run.py | gzpbbd/DDQ | 44f4d2bf27c4299d349339de7bc85d1b9b640c50 | [
"MIT"
] | null | null | null | src/run.py | gzpbbd/DDQ | 44f4d2bf27c4299d349339de7bc85d1b9b640c50 | [
"MIT"
] | null | null | null | # encoding:utf-8
"""
Created on May 22, 2016
This should be a simple minimalist run file. It's only responsibility should be to parse the arguments (which agent, user simulator to use) and launch a dialog simulation.
@author: xiul, t-zalipt, baolin
"""
import argparse, json, copy, os
import cPickle as pickle
import ... | 42.528 | 171 | 0.621934 |
"""
Created on May 22, 2016
This should be a simple minimalist run file. It's only responsibility should be to parse the arguments (which agent, user simulator to use) and launch a dialog simulation.
@author: xiul, t-zalipt, baolin
"""
import argparse, json, copy, os
import cPickle as pickle
import cPickle
from de... | false | true |
1c214c5ed2f267539310618685d48b3769f89acf | 3,984 | py | Python | main_informer.py | VincentRoest/Informer2020 | d954f36d5dc8b482091d83c15d2cbbd4e1762b66 | [
"Apache-2.0"
] | null | null | null | main_informer.py | VincentRoest/Informer2020 | d954f36d5dc8b482091d83c15d2cbbd4e1762b66 | [
"Apache-2.0"
] | null | null | null | main_informer.py | VincentRoest/Informer2020 | d954f36d5dc8b482091d83c15d2cbbd4e1762b66 | [
"Apache-2.0"
] | null | null | null | import argparse
import os
from exp.exp_informer import Exp_Informer
parser = argparse.ArgumentParser(description='[Informer] Long Sequences Forecasting')
parser.add_argument('--model', type=str, required=True, default='informer',help='model of the experiment')
parser.add_argument('--data', type=str, required=True, ... | 54.575342 | 127 | 0.691767 | import argparse
import os
from exp.exp_informer import Exp_Informer
parser = argparse.ArgumentParser(description='[Informer] Long Sequences Forecasting')
parser.add_argument('--model', type=str, required=True, default='informer',help='model of the experiment')
parser.add_argument('--data', type=str, required=True, ... | true | true |
1c214db07a3ced45f807cb138187385a0319959b | 5,251 | py | Python | catkin_ws/src/10-lane-control/lane_control/scripts/lane_controller_node.py | himarsmty/duckiebot | fe95943f29716908cef09a5054f4efcf5a1de33e | [
"CC-BY-2.0"
] | null | null | null | catkin_ws/src/10-lane-control/lane_control/scripts/lane_controller_node.py | himarsmty/duckiebot | fe95943f29716908cef09a5054f4efcf5a1de33e | [
"CC-BY-2.0"
] | null | null | null | catkin_ws/src/10-lane-control/lane_control/scripts/lane_controller_node.py | himarsmty/duckiebot | fe95943f29716908cef09a5054f4efcf5a1de33e | [
"CC-BY-2.0"
] | null | null | null | #!/usr/bin/env python
import rospy
import math
from duckietown_msgs.msg import Twist2DStamped, LanePose
class lane_controller(object):
def __init__(self):
self.node_name = rospy.get_name()
self.lane_reading = None
self.pub_counter = 0
# Setup parameters
self.setGains()
... | 39.186567 | 145 | 0.648067 |
import rospy
import math
from duckietown_msgs.msg import Twist2DStamped, LanePose
class lane_controller(object):
def __init__(self):
self.node_name = rospy.get_name()
self.lane_reading = None
self.pub_counter = 0
self.setGains()
self.pub_car_cmd = rospy... | true | true |
1c214dcc7baa31c51c5e3a4b7932e9b6e82e0dd8 | 910 | py | Python | electronicparsers/octopus/metainfo/__init__.py | nomad-coe/electronic-parsers | defb47be6ac22b2e48d4fb9204c85390a3c2f328 | [
"Apache-2.0"
] | null | null | null | electronicparsers/octopus/metainfo/__init__.py | nomad-coe/electronic-parsers | defb47be6ac22b2e48d4fb9204c85390a3c2f328 | [
"Apache-2.0"
] | null | null | null | electronicparsers/octopus/metainfo/__init__.py | nomad-coe/electronic-parsers | defb47be6ac22b2e48d4fb9204c85390a3c2f328 | [
"Apache-2.0"
] | null | null | null | #
# Copyright The NOMAD Authors.
#
# This file is part of NOMAD.
# See https://nomad-lab.eu for further info.
#
# 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/lic... | 35 | 78 | 0.779121 |
from nomad.metainfo import Environment
from . import octopus, octopus_autogenerated
m_env = Environment()
m_env.m_add_sub_section(Environment.packages, octopus.m_package)
m_env.m_add_sub_section(Environment.packages, octopus_autogenerated.m_package)
| true | true |
1c214e55ec927bf0445aa28d401eabb347d8e66c | 3,313 | py | Python | scripts/evaluate.py | abugler/SMLFinalProject | d89bbe959ca35ecee53660ac3b88fedb1d1df4d9 | [
"MIT"
] | 5 | 2019-11-26T19:26:44.000Z | 2020-12-05T18:08:27.000Z | scripts/evaluate.py | abugler/SMLFinalProject | d89bbe959ca35ecee53660ac3b88fedb1d1df4d9 | [
"MIT"
] | 9 | 2020-01-12T19:15:08.000Z | 2021-06-02T00:53:26.000Z | scripts/evaluate.py | abugler/SMLFinalProject | d89bbe959ca35ecee53660ac3b88fedb1d1df4d9 | [
"MIT"
] | 1 | 2020-01-12T19:54:48.000Z | 2020-01-12T19:54:48.000Z | from runners.experiment_utils import load_experiment, save_experiment
from src import dataset, test, model
from src.utils import loaders, seed
import logging
from runners.utils import load_yaml
from . import cmd, document_parser
from argparse import ArgumentParser
import os
def evaluate(path_to_yml_file, eval_keys=['t... | 34.873684 | 91 | 0.638394 | from runners.experiment_utils import load_experiment, save_experiment
from src import dataset, test, model
from src.utils import loaders, seed
import logging
from runners.utils import load_yaml
from . import cmd, document_parser
from argparse import ArgumentParser
import os
def evaluate(path_to_yml_file, eval_keys=['t... | true | true |
1c214f94f5f5bc19c86f42cfc794a5f1bd2d4e70 | 26,297 | py | Python | mapchete/_processing.py | ashutoshkumarjha/mapchete | 2eb37a886c09563eb17b1102d78d9de5e8d1141c | [
"MIT"
] | null | null | null | mapchete/_processing.py | ashutoshkumarjha/mapchete | 2eb37a886c09563eb17b1102d78d9de5e8d1141c | [
"MIT"
] | null | null | null | mapchete/_processing.py | ashutoshkumarjha/mapchete | 2eb37a886c09563eb17b1102d78d9de5e8d1141c | [
"MIT"
] | null | null | null | from collections import namedtuple
from concurrent.futures._base import CancelledError
from itertools import chain
import logging
import multiprocessing
import os
from traceback import format_exc
from typing import Generator
from mapchete.commons import clip as commons_clip
from mapchete.commons import contours as com... | 34.646904 | 100 | 0.567859 | from collections import namedtuple
from concurrent.futures._base import CancelledError
from itertools import chain
import logging
import multiprocessing
import os
from traceback import format_exc
from typing import Generator
from mapchete.commons import clip as commons_clip
from mapchete.commons import contours as com... | true | true |
1c215059d54bd43d471d8c519092eb6660bcf3eb | 3,726 | py | Python | Source/pytorch/system.py | marcortiz11/FastComposedModels | 9fed869298746c3ed78b57737c0d0392599711e9 | [
"MIT"
] | null | null | null | Source/pytorch/system.py | marcortiz11/FastComposedModels | 9fed869298746c3ed78b57737c0d0392599711e9 | [
"MIT"
] | null | null | null | Source/pytorch/system.py | marcortiz11/FastComposedModels | 9fed869298746c3ed78b57737c0d0392599711e9 | [
"MIT"
] | null | null | null | from torch.nn import Module
from torch import arange
from typing import List
from Source.pytorch.component import Component
from Source.pytorch.trigger import Trigger
from Source.pytorch.classifier_metadata import ClassifierMetadata, Split
from Source.pytorch.merger import Merger
from Source.pytorch.chain import Chain
... | 32.4 | 98 | 0.617284 | from torch.nn import Module
from torch import arange
from typing import List
from Source.pytorch.component import Component
from Source.pytorch.trigger import Trigger
from Source.pytorch.classifier_metadata import ClassifierMetadata, Split
from Source.pytorch.merger import Merger
from Source.pytorch.chain import Chain
... | true | true |
1c2150fe40ab1d4d9a710ac17bec42189fec9e91 | 13,982 | py | Python | test/functional/p2p_unrequested_blocks.py | bitcoinbam/btcbam | b6d6784c3865ab660c5e99a2d1402b0dada77e70 | [
"MIT"
] | 8 | 2020-10-05T14:13:16.000Z | 2021-11-17T20:16:53.000Z | test/functional/p2p_unrequested_blocks.py | bitcoinbam/btcbam | b6d6784c3865ab660c5e99a2d1402b0dada77e70 | [
"MIT"
] | 1 | 2021-08-11T21:34:17.000Z | 2021-08-11T21:34:17.000Z | test/functional/p2p_unrequested_blocks.py | bitcoinbam/btcbam | b6d6784c3865ab660c5e99a2d1402b0dada77e70 | [
"MIT"
] | 3 | 2020-10-24T22:10:59.000Z | 2022-01-11T14:16:03.000Z | #!/usr/bin/env python3
# Copyright (c) 2015-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test processing of unrequested blocks.
Setup: two nodes, node0+node1, not connected to each other. Nod... | 44.670927 | 113 | 0.682306 |
import time
from test_framework.blocktools import create_block, create_coinbase, create_tx_with_script
from test_framework.messages import CBlockHeader, CInv, msg_block, msg_headers, msg_inv
from test_framework.mininode import mininode_lock, P2PInterface
from test_framework.test_framework import BitcoinBamTestFra... | true | true |
1c2152d26ac596c2eab761211b0c1c9053928708 | 15 | py | Python | taboo/__init__.py | haoxizhong/taboo | 62ff4bd172dcdd9ea7be68b6c63a639dcbf2b49d | [
"MIT"
] | null | null | null | taboo/__init__.py | haoxizhong/taboo | 62ff4bd172dcdd9ea7be68b6c63a639dcbf2b49d | [
"MIT"
] | null | null | null | taboo/__init__.py | haoxizhong/taboo | 62ff4bd172dcdd9ea7be68b6c63a639dcbf2b49d | [
"MIT"
] | null | null | null | name = "taboo"
| 7.5 | 14 | 0.6 | name = "taboo"
| true | true |
1c21534448e730a3732425063f14df4c50192417 | 6,892 | py | Python | qiskit/circuit/library/standard_gates/y.py | romainfd/qiskit-terra | b5285ccc5cb1d17b7c73402833f2750b93652426 | [
"Apache-2.0"
] | null | null | null | qiskit/circuit/library/standard_gates/y.py | romainfd/qiskit-terra | b5285ccc5cb1d17b7c73402833f2750b93652426 | [
"Apache-2.0"
] | null | null | null | qiskit/circuit/library/standard_gates/y.py | romainfd/qiskit-terra | b5285ccc5cb1d17b7c73402833f2750b93652426 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 modif... | 29.706897 | 99 | 0.525392 |
import numpy
from qiskit.qasm import pi
from qiskit.circuit.controlledgate import ControlledGate
from qiskit.circuit.gate import Gate
from qiskit.circuit.quantumregister import QuantumRegister
class YGate(Gate):
def __init__(self, label=None):
super().__init__('y', 1, [], label=label)
... | true | true |
1c2153e4a6c3ab194d5d4ef0fc5e9c186368f7ae | 8,788 | py | Python | tests/attr/test_targets.py | min-tang-hash/captum | 1168bc5f57f38d169a02a97553edbdf192be0134 | [
"BSD-3-Clause"
] | 1 | 2020-12-23T14:00:26.000Z | 2020-12-23T14:00:26.000Z | tests/attr/test_targets.py | min-tang-hash/captum | 1168bc5f57f38d169a02a97553edbdf192be0134 | [
"BSD-3-Clause"
] | 4 | 2020-11-20T21:05:39.000Z | 2022-03-18T15:28:01.000Z | tests/attr/test_targets.py | min-tang-hash/captum | 1168bc5f57f38d169a02a97553edbdf192be0134 | [
"BSD-3-Clause"
] | 3 | 2020-05-27T18:26:11.000Z | 2020-10-15T10:52:24.000Z | #!/usr/bin/env python3
from typing import Any, Callable, Dict, Optional, Tuple, Type, cast
import torch
from torch import Tensor
from torch.nn import Module
from captum._utils.common import _format_additional_forward_args
from captum.attr._core.feature_permutation import FeaturePermutation
from captum.attr._core.in... | 39.232143 | 88 | 0.560423 |
from typing import Any, Callable, Dict, Optional, Tuple, Type, cast
import torch
from torch import Tensor
from torch.nn import Module
from captum._utils.common import _format_additional_forward_args
from captum.attr._core.feature_permutation import FeaturePermutation
from captum.attr._core.integrated_gradients imp... | true | true |
1c2154f69f332a6faf27657ffb338b973127d43b | 23,975 | py | Python | pymysqlreplication/binlogstream.py | dongwook-chan/python-mysql-replication | f70f05bc143bbf50dad5461dcb3a2a47a7f67202 | [
"Apache-2.0"
] | null | null | null | pymysqlreplication/binlogstream.py | dongwook-chan/python-mysql-replication | f70f05bc143bbf50dad5461dcb3a2a47a7f67202 | [
"Apache-2.0"
] | null | null | null | pymysqlreplication/binlogstream.py | dongwook-chan/python-mysql-replication | f70f05bc143bbf50dad5461dcb3a2a47a7f67202 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
import pymysql
import struct
from distutils.version import LooseVersion
from pymysql.constants.COMMAND import COM_BINLOG_DUMP, COM_REGISTER_SLAVE
from pymysql.cursors import DictCursor
from .packet import BinLogPacketWrapper
from .constants.BINLOG import TABLE_MAP_EVENT, ROTATE_EVENT
from .gt... | 41.914336 | 111 | 0.565047 |
import pymysql
import struct
from distutils.version import LooseVersion
from pymysql.constants.COMMAND import COM_BINLOG_DUMP, COM_REGISTER_SLAVE
from pymysql.cursors import DictCursor
from .packet import BinLogPacketWrapper
from .constants.BINLOG import TABLE_MAP_EVENT, ROTATE_EVENT
from .gtid import GtidSet
from ... | true | true |
1c215561ee87fd6f0ac29d4af349ac0ee880de52 | 1,819 | py | Python | myproject/pronto_utils.py | charleyjoo/myproject | e0b04156e0148cf8c86768c73f66fa6b5795c0d4 | [
"BSD-2-Clause"
] | null | null | null | myproject/pronto_utils.py | charleyjoo/myproject | e0b04156e0148cf8c86768c73f66fa6b5795c0d4 | [
"BSD-2-Clause"
] | null | null | null | myproject/pronto_utils.py | charleyjoo/myproject | e0b04156e0148cf8c86768c73f66fa6b5795c0d4 | [
"BSD-2-Clause"
] | null | null | null | import wget
import os
import zipfile
import pandas as pd
import matplotlib.pyplot as plt
import seaborn; seaborn.set()
def download_if_needed(URL, filename):
"""
Download from URL TO FILENAME UNLESS FILENAME ALREADY EXISTS
"""
if os.path.exists(filename):
print(filename, "already exists.")
... | 28.873016 | 110 | 0.68939 | import wget
import os
import zipfile
import pandas as pd
import matplotlib.pyplot as plt
import seaborn; seaborn.set()
def download_if_needed(URL, filename):
if os.path.exists(filename):
print(filename, "already exists.")
return
else:
print("Downloading...")
wget.download(URL)... | true | true |
1c2156cc099aa10225372b548a02060a3ba4097a | 5,286 | py | Python | docs/conf.py | ufcg-lsd/saps-catalog | 2595279efa6d69bcb21634d3a924a2bb46d1f66c | [
"MIT"
] | null | null | null | docs/conf.py | ufcg-lsd/saps-catalog | 2595279efa6d69bcb21634d3a924a2bb46d1f66c | [
"MIT"
] | 3 | 2020-11-24T14:05:14.000Z | 2021-07-07T21:02:59.000Z | docs/conf.py | ufcg-lsd/saps-catalog | 2595279efa6d69bcb21634d3a924a2bb46d1f66c | [
"MIT"
] | 3 | 2020-12-16T10:20:20.000Z | 2021-06-07T13:30:50.000Z | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | 29.530726 | 79 | 0.648127 |
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
project = u'Saps Catalog'
copyright = u'2021, UFCG LSD'
author = u'UFCG LSD'
version = u''
release = u''
extensions = [
'sphinx.ext.autodoc',
'javasphinx'
]
templates_path = ['_templates']
source_suffix = '.rst... | true | true |
1c215747092f8a31abd36eebea8b62b4517193b3 | 3,163 | py | Python | modules/tools/common/proto_utils.py | qimchen/Apollo_Jimmy | 75478acf597f77bfc8305e1ea4a2d5a80590e3ec | [
"Apache-2.0"
] | 2 | 2018-01-13T12:53:27.000Z | 2019-04-19T09:24:01.000Z | modules/tools/common/proto_utils.py | fxbupt/apollo | 65bda57aa2f01b045ecf9cff95d9e6fd80ed091f | [
"Apache-2.0"
] | null | null | null | modules/tools/common/proto_utils.py | fxbupt/apollo | 65bda57aa2f01b045ecf9cff95d9e6fd80ed091f | [
"Apache-2.0"
] | 2 | 2018-06-01T03:09:40.000Z | 2020-10-27T07:21:42.000Z | #!/usr/bin/env python
###############################################################################
# Copyright 2017 The Apollo 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 ... | 34.758242 | 79 | 0.624091 | false | true | |
1c2157e0e7735df427b9942ec3ca96182155c6ba | 5,184 | py | Python | pokesearch.py | Riguis/Pokalert | 6f82c2e277a1a512376770043484186eb8c97898 | [
"MIT"
] | null | null | null | pokesearch.py | Riguis/Pokalert | 6f82c2e277a1a512376770043484186eb8c97898 | [
"MIT"
] | null | null | null | pokesearch.py | Riguis/Pokalert | 6f82c2e277a1a512376770043484186eb8c97898 | [
"MIT"
] | null | null | null | import json
import logging
import random
import time
from datetime import datetime
from pgoapi.utilities import f2i
from s2sphere import CellId, LatLng
from pokedata import Pokedata, parse_map
logger = logging.getLogger(__name__)
REQ_SLEEP = 1
TIMESTAMP = '\000\000\000\000\000\000\000\000\000\000\000\000\000\000\00... | 37.565217 | 142 | 0.576775 | import json
import logging
import random
import time
from datetime import datetime
from pgoapi.utilities import f2i
from s2sphere import CellId, LatLng
from pokedata import Pokedata, parse_map
logger = logging.getLogger(__name__)
REQ_SLEEP = 1
TIMESTAMP = '\000\000\000\000\000\000\000\000\000\000\000\000\000\000\00... | true | true |
1c2158aaee3c7bcbc601671bcb58509ea0dc0d88 | 4,021 | py | Python | dojo/tools/blackduck/parser.py | M-Rod101/django-DefectDojo | 7b09a00b1a526abaf40455c2ddec16aaa06b16e2 | [
"BSD-3-Clause"
] | 249 | 2016-09-06T21:04:40.000Z | 2018-01-19T15:59:44.000Z | dojo/tools/blackduck/parser.py | OWASP/django-DefectDojo | c101e47b294863877cd68a82d0cc60f8017b45b1 | [
"BSD-3-Clause"
] | 255 | 2016-09-06T21:36:37.000Z | 2018-01-19T19:57:57.000Z | dojo/tools/blackduck/parser.py | M-Rod101/django-DefectDojo | 7b09a00b1a526abaf40455c2ddec16aaa06b16e2 | [
"BSD-3-Clause"
] | 152 | 2016-09-06T21:04:54.000Z | 2018-01-18T08:52:24.000Z | import hashlib
from dojo.models import Finding
from .importer import BlackduckImporter
class BlackduckParser(object):
"""
Can import as exported from Blackduck:
- from a zip file containing a security.csv and files.csv
- a single security.csv file
"""
def get_scan_types(self):
return... | 36.554545 | 115 | 0.59438 | import hashlib
from dojo.models import Finding
from .importer import BlackduckImporter
class BlackduckParser(object):
def get_scan_types(self):
return ["Blackduck Hub Scan"]
def get_label_for_scan_types(self, scan_type):
return "Blackduck Hub Scan"
def get_description_for_scan_types(se... | true | true |
1c2159c9de9b33216a8e1a10318e37e121ee57d3 | 2,004 | py | Python | tests/test_py35/test_multipart_35.py | mind1master/aiohttp | d59b0ef166e140dfffa1b4d30430c07a052f8086 | [
"Apache-2.0"
] | 1 | 2019-09-18T19:40:30.000Z | 2019-09-18T19:40:30.000Z | tests/test_py35/test_multipart_35.py | mind1master/aiohttp | d59b0ef166e140dfffa1b4d30430c07a052f8086 | [
"Apache-2.0"
] | 3 | 2019-09-19T19:00:38.000Z | 2019-09-20T09:56:49.000Z | tests/test_py35/test_multipart_35.py | traff/aiohttp | fb2b9829480a64d94bf13b799d92e36a804556e1 | [
"Apache-2.0"
] | null | null | null | import io
import json
import pytest
import aiohttp
import aiohttp.hdrs as h
class Stream(object):
def __init__(self, content):
self.content = io.BytesIO(content)
async def read(self, size=None):
return self.content.read(size)
async def readline(self):
return self.content.readl... | 28.225352 | 71 | 0.530439 | import io
import json
import pytest
import aiohttp
import aiohttp.hdrs as h
class Stream(object):
def __init__(self, content):
self.content = io.BytesIO(content)
async def read(self, size=None):
return self.content.read(size)
async def readline(self):
return self.content.readl... | true | true |
1c2159d57639a93d03857e517e9d94c4622f8dfc | 914 | py | Python | src/model/model.py | UMass-Rescue/MLMicroserviceTemplate | 23fb31225c273a5284f27dbe95efc31a10a3b1e2 | [
"MIT"
] | 1 | 2020-11-30T18:56:31.000Z | 2020-11-30T18:56:31.000Z | src/model/model.py | UMass-Rescue/MLMicroserviceTemplate | 23fb31225c273a5284f27dbe95efc31a10a3b1e2 | [
"MIT"
] | 4 | 2021-01-04T15:06:51.000Z | 2021-02-08T21:39:45.000Z | src/model/model.py | UMass-Rescue/MLMicroserviceTemplate | 23fb31225c273a5284f27dbe95efc31a10a3b1e2 | [
"MIT"
] | null | null | null | from PIL import Image
from fastapi import File, UploadFile
import time
def init():
"""
This method will be run once on startup. You should check if the supporting files your
model needs have been created, and if not then you should create/fetch them.
"""
# Placeholder init code. Replace the sleep... | 28.5625 | 90 | 0.652079 | from PIL import Image
from fastapi import File, UploadFile
import time
def init():
time.sleep(1)
def predict(image_file: UploadFile = File(...)):
image = Image.open(image_file.file)
return {
'classes': ['isGreen', 'isRed'],
'result': {
'isGreen': 0,
'i... | true | true |
1c215a3bf2b8793d614a3559ef96f97eb54f018d | 9,602 | py | Python | packages/python/plotly/plotly/graph_objs/scattermapbox/marker/colorbar/_tickformatstop.py | labaran1/plotly.py | 7ec751e8fed4a570c11ea4bea2231806389d62eb | [
"MIT"
] | null | null | null | packages/python/plotly/plotly/graph_objs/scattermapbox/marker/colorbar/_tickformatstop.py | labaran1/plotly.py | 7ec751e8fed4a570c11ea4bea2231806389d62eb | [
"MIT"
] | null | null | null | packages/python/plotly/plotly/graph_objs/scattermapbox/marker/colorbar/_tickformatstop.py | labaran1/plotly.py | 7ec751e8fed4a570c11ea4bea2231806389d62eb | [
"MIT"
] | null | null | null | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Tickformatstop(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scattermapbox.marker.colorbar"
_path_str = "scattermapbox.marker.colorbar.tickformatstop... | 33.809859 | 89 | 0.571964 | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Tickformatstop(_BaseTraceHierarchyType):
_parent_path_str = "scattermapbox.marker.colorbar"
_path_str = "scattermapbox.marker.colorbar.tickformatstop"
_valid_props = {"dtickrange", "ena... | true | true |
1c215e6abc728426942239e6cc11642f26c5d883 | 1,968 | py | Python | vas/gemfire/test/TestAgentLiveConfigurations.py | spring-operator/vas-python-api | ce7148a2044863e078e78b47abbaafc426f732ee | [
"Apache-2.0"
] | null | null | null | vas/gemfire/test/TestAgentLiveConfigurations.py | spring-operator/vas-python-api | ce7148a2044863e078e78b47abbaafc426f732ee | [
"Apache-2.0"
] | null | null | null | vas/gemfire/test/TestAgentLiveConfigurations.py | spring-operator/vas-python-api | ce7148a2044863e078e78b47abbaafc426f732ee | [
"Apache-2.0"
] | null | null | null | # vFabric Administration Server API
# Copyright (c) 2012 VMware, 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
... | 49.2 | 107 | 0.720528 |
from vas.gemfire.AgentInstances import AgentInstance
from vas.gemfire.AgentLiveConfigurations import AgentLiveConfigurations, AgentLiveConfiguration
from vas.gemfire.AgentNodeLiveConfigurations import AgentNodeLiveConfiguration
from vas.test.VasTestCase import VasTestCase
class TestAgentLiveConfigurati... | true | true |
1c215eb6e1aa92252615b5771a5bfc55444a2696 | 4,911 | py | Python | frappe/core/page/permission_manager/permission_manager.py | alijasim/frappe | 17803d5408d0a0257ab6968acb1a847a582b07ce | [
"MIT"
] | 2 | 2021-04-11T11:00:12.000Z | 2021-06-15T09:50:09.000Z | frappe/core/page/permission_manager/permission_manager.py | alijasim/frappe | 17803d5408d0a0257ab6968acb1a847a582b07ce | [
"MIT"
] | 17 | 2021-03-22T18:47:14.000Z | 2022-03-15T12:21:00.000Z | frappe/core/page/permission_manager/permission_manager.py | alijasim/frappe | 17803d5408d0a0257ab6968acb1a847a582b07ce | [
"MIT"
] | 2 | 2021-05-06T06:14:40.000Z | 2021-05-06T10:05:29.000Z | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
import frappe.defaults
from frappe.modules.import_file import get_file_path, read_doc_from_file
from frappe.translate import send_translations
f... | 34.104167 | 101 | 0.738546 |
from __future__ import unicode_literals
import frappe
from frappe import _
import frappe.defaults
from frappe.modules.import_file import get_file_path, read_doc_from_file
from frappe.translate import send_translations
from frappe.core.doctype.doctype.doctype import (clear_permissions_cache,
validate_permissions_for... | true | true |
1c215f128658f3a6b00af2b877e4b3f07f996488 | 9,488 | py | Python | orchid_DiseasePredict/datasets/Attention_in_several_test/LSTM128_LSTM128_LSTM128_LSTM128_A.py | chengzee/disease_predict | d7a3c57b710ab2e93d56c8d73aeaa21120d3e98c | [
"MIT"
] | null | null | null | orchid_DiseasePredict/datasets/Attention_in_several_test/LSTM128_LSTM128_LSTM128_LSTM128_A.py | chengzee/disease_predict | d7a3c57b710ab2e93d56c8d73aeaa21120d3e98c | [
"MIT"
] | null | null | null | orchid_DiseasePredict/datasets/Attention_in_several_test/LSTM128_LSTM128_LSTM128_LSTM128_A.py | chengzee/disease_predict | d7a3c57b710ab2e93d56c8d73aeaa21120d3e98c | [
"MIT"
] | null | null | null | import pandas as pd
import numpy as np
import csv
from keras.layers import Dense, Lambda, dot, Activation, concatenate
from keras.layers import Layer
import keras.backend as K
# Parameters
# -------------------------------------------------------------------------------------------------------------------
bed = [631, ... | 46.509804 | 283 | 0.572091 | import pandas as pd
import numpy as np
import csv
from keras.layers import Dense, Lambda, dot, Activation, concatenate
from keras.layers import Layer
import keras.backend as K
bed = [631, 742, 701, 759, 765, 698]
lookback_days = 3
datasInADay = 288
input_dim = 3
secondsInADay = 60*60*24
er):
def __init__(self,... | true | true |
1c21614af7a22ed945648cbaf4b227ae5805d6b6 | 3,363 | py | Python | test/test-content_negotation.py | Maocx/habanero | da9ef659b8a7e582b3c7b6f2b3011a150eccf41e | [
"MIT"
] | null | null | null | test/test-content_negotation.py | Maocx/habanero | da9ef659b8a7e582b3c7b6f2b3011a150eccf41e | [
"MIT"
] | null | null | null | test/test-content_negotation.py | Maocx/habanero | da9ef659b8a7e582b3c7b6f2b3011a150eccf41e | [
"MIT"
] | null | null | null | """Tests for content_negotation"""
import os
import vcr
from habanero import cn
from nose.tools import raises
from requests.exceptions import HTTPError
bibtex = '@article{Frank_1970,\n\tdoi = {10.1126/science.169.3946.635},\n\turl = {http://dx.doi.org/10.1126/science.169.3946.635},\n\tyear = 1970,\n\tmonth = {aug},\n... | 70.0625 | 1,028 | 0.721974 | import os
import vcr
from habanero import cn
from nose.tools import raises
from requests.exceptions import HTTPError
bibtex = '@article{Frank_1970,\n\tdoi = {10.1126/science.169.3946.635},\n\turl = {http://dx.doi.org/10.1126/science.169.3946.635},\n\tyear = 1970,\n\tmonth = {aug},\n\tpublisher = {American Association... | true | true |
1c2161feaaf992debd5e6255482545e7aa6e05df | 1,265 | py | Python | configuration.py | linhthi/pipgcn | a835106e31165123f4dcc19fbbdde23770682a3c | [
"MIT"
] | 81 | 2018-02-20T02:41:38.000Z | 2022-03-07T11:14:36.000Z | configuration.py | linhthi/pipgcn | a835106e31165123f4dcc19fbbdde23770682a3c | [
"MIT"
] | 17 | 2018-01-20T20:34:56.000Z | 2022-03-16T16:41:41.000Z | configuration.py | linhthi/pipgcn | a835106e31165123f4dcc19fbbdde23770682a3c | [
"MIT"
] | 24 | 2018-04-16T03:13:16.000Z | 2022-02-28T20:25:33.000Z | import os
import datetime
import numpy as np
import tensorflow as tf
## These lines ensure any existing tf sessions are closed.
try:
tf.Session().close()
except:
pass
## Numpy print options
np.set_printoptions(precision=3)
## Directories
experiment_directory = os.environ["PL_EXPERIMENTS"] # contains experi... | 30.119048 | 85 | 0.685375 | import os
import datetime
import numpy as np
import tensorflow as tf
n=3)
rectory = os.environ["PL_EXPERIMENTS"]
data_directory = os.environ["PL_DATA"]
output_directory = os.environ["PL_OUT"]
{"tf_seed": 649737, "np_seed": 29820},
{"tf_seed": 395408, "np_seed": 185228},
{"tf_seed": 252356, "np_seed... | true | true |
1c21623fb9a1919480af0781b535e92ee13a8936 | 1,307 | py | Python | src/additions/test_pass.py | bboychencan/learn-python | 717edfaaf6ebfd6a4b4017d8e0c6618c29abaee5 | [
"MIT"
] | null | null | null | src/additions/test_pass.py | bboychencan/learn-python | 717edfaaf6ebfd6a4b4017d8e0c6618c29abaee5 | [
"MIT"
] | null | null | null | src/additions/test_pass.py | bboychencan/learn-python | 717edfaaf6ebfd6a4b4017d8e0c6618c29abaee5 | [
"MIT"
] | null | null | null | """PASS statement
@see: https://docs.python.org/3/tutorial/controlflow.html
The pass statement does nothing. It can be used when a statement is required syntactically but
the program requires no action.
"""
def test_pass_in_function():
"""PASS statement in function
"Pass" can be used as a place-holder for ... | 26.673469 | 99 | 0.694721 |
def test_pass_in_function():
print('test')
def test_pass_in_loop():
for number in range(100):
pass
# Example above is quite useless but it was given just for illustration of the idea.
# The more useful example might be:
#
# while True:
# pass # Busy-wait ... | true | true |
1c216298fc91a140e92c6da7e24d174d0454a73e | 19,579 | py | Python | lj_system/lj.py | rotskoff-group/dissipative-design | 8335a4e23ccc0eba1771d4b78f5102ee6113664c | [
"MIT"
] | 1 | 2021-08-19T02:20:50.000Z | 2021-08-19T02:20:50.000Z | lj_system/lj.py | rotskoff-group/dissipative-design | 8335a4e23ccc0eba1771d4b78f5102ee6113664c | [
"MIT"
] | null | null | null | lj_system/lj.py | rotskoff-group/dissipative-design | 8335a4e23ccc0eba1771d4b78f5102ee6113664c | [
"MIT"
] | null | null | null | from simtk.openmm.app import *
from simtk.openmm import *
from simtk.unit import *
from sys import stdout
from scipy.stats import gamma
import PIL
import freud
import fresnel
import matplotlib.pyplot as plt
import numpy as np
from mdtraj.reporters import HDF5Reporter
import time
class LJ:
def __init__(self, filen... | 40.704782 | 107 | 0.591961 | from simtk.openmm.app import *
from simtk.openmm import *
from simtk.unit import *
from sys import stdout
from scipy.stats import gamma
import PIL
import freud
import fresnel
import matplotlib.pyplot as plt
import numpy as np
from mdtraj.reporters import HDF5Reporter
import time
class LJ:
def __init__(self, filen... | true | true |
1c2162dcfd90b5af4a08b6e40efee572aa98a9cd | 494 | py | Python | ocs_ci/ocs/tests/test_defaults.py | annagitel/ocs-ci | 284fe04aeb6e3d6cb70c99e65fec8ff1b1ea1dd5 | [
"MIT"
] | 130 | 2019-04-08T06:22:53.000Z | 2022-03-23T06:11:19.000Z | ocs_ci/ocs/tests/test_defaults.py | annagitel/ocs-ci | 284fe04aeb6e3d6cb70c99e65fec8ff1b1ea1dd5 | [
"MIT"
] | 4,359 | 2019-04-09T18:48:47.000Z | 2022-03-31T20:04:55.000Z | ocs_ci/ocs/tests/test_defaults.py | annagitel/ocs-ci | 284fe04aeb6e3d6cb70c99e65fec8ff1b1ea1dd5 | [
"MIT"
] | 183 | 2019-04-18T15:55:30.000Z | 2022-03-11T06:16:50.000Z | from ocs_ci.ocs import constants
from ocs_ci.utility import templating
def test_yaml_to_dict():
assert (
templating.load_yaml(constants.CEPHFILESYSTEM_YAML)["apiVersion"]
== "ceph.rook.io/v1"
)
assert (
templating.load_yaml(constants.CEPHFILESYSTEM_YAML)["spec"]["metadataPool"][
... | 26 | 84 | 0.635628 | from ocs_ci.ocs import constants
from ocs_ci.utility import templating
def test_yaml_to_dict():
assert (
templating.load_yaml(constants.CEPHFILESYSTEM_YAML)["apiVersion"]
== "ceph.rook.io/v1"
)
assert (
templating.load_yaml(constants.CEPHFILESYSTEM_YAML)["spec"]["metadataPool"][
... | true | true |
1c2163d08194a89b5ad2685517c84e8be69b3576 | 1,846 | py | Python | wallet/models/account.py | kapeed2091/tdd_practice | df8def8f91e528232d1a86b363523b99f6d2a818 | [
"Apache-2.0"
] | null | null | null | wallet/models/account.py | kapeed2091/tdd_practice | df8def8f91e528232d1a86b363523b99f6d2a818 | [
"Apache-2.0"
] | null | null | null | wallet/models/account.py | kapeed2091/tdd_practice | df8def8f91e528232d1a86b363523b99f6d2a818 | [
"Apache-2.0"
] | null | null | null | from django.db import models
class Account(models.Model):
CUSTOMER_ID_LENGTH = 20
ACCOUNT_ID_LENGTH = 20
DEFAULT_BALANCE = 0
customer_id = models.CharField(max_length=CUSTOMER_ID_LENGTH, unique=True)
account_id = models.CharField(max_length=ACCOUNT_ID_LENGTH, unique=True)
balance = models.Int... | 30.262295 | 78 | 0.691766 | from django.db import models
class Account(models.Model):
CUSTOMER_ID_LENGTH = 20
ACCOUNT_ID_LENGTH = 20
DEFAULT_BALANCE = 0
customer_id = models.CharField(max_length=CUSTOMER_ID_LENGTH, unique=True)
account_id = models.CharField(max_length=ACCOUNT_ID_LENGTH, unique=True)
balance = models.Int... | true | true |
1c21653dfee367fd4f51b4ad72435ecc00ecb18c | 95 | py | Python | json_parser_utils/utils.py | shashankkr9/json-parser-utils | 98e7df324ca848acc1d98a6c6167204ba0a65cca | [
"MIT"
] | 1 | 2021-02-13T06:50:27.000Z | 2021-02-13T06:50:27.000Z | json_parser_utils/utils.py | shashankkr9/json-parser-utils | 98e7df324ca848acc1d98a6c6167204ba0a65cca | [
"MIT"
] | null | null | null | json_parser_utils/utils.py | shashankkr9/json-parser-utils | 98e7df324ca848acc1d98a6c6167204ba0a65cca | [
"MIT"
] | null | null | null | def safe_int(value):
try:
return int(float(value))
except:
return None
| 15.833333 | 32 | 0.568421 | def safe_int(value):
try:
return int(float(value))
except:
return None
| true | true |
1c21656277b9a58d69b6e6d18c7d7eb45f626e0c | 223 | py | Python | wesay/sikuli/examples/test_and_log/yattag_templates/type1.py | rrmhearts/sikuli | 63151fe306a0a86d24b5f4c1845ccbeee5c53939 | [
"MIT"
] | null | null | null | wesay/sikuli/examples/test_and_log/yattag_templates/type1.py | rrmhearts/sikuli | 63151fe306a0a86d24b5f4c1845ccbeee5c53939 | [
"MIT"
] | null | null | null | wesay/sikuli/examples/test_and_log/yattag_templates/type1.py | rrmhearts/sikuli | 63151fe306a0a86d24b5f4c1845ccbeee5c53939 | [
"MIT"
] | null | null | null | from __future__ import with_statement
from yattag import Doc
def template(fail):
doc, tag, text = Doc().tagtext()
with tag("li"):
text(str(fail.thing1) + " and also " + str(fail.thing2))
return doc.getvalue()
| 24.777778 | 59 | 0.67713 | from __future__ import with_statement
from yattag import Doc
def template(fail):
doc, tag, text = Doc().tagtext()
with tag("li"):
text(str(fail.thing1) + " and also " + str(fail.thing2))
return doc.getvalue()
| true | true |
1c2165bec82823874463d225802f0d5843c9cd57 | 3,493 | py | Python | tests/unittests/comparators/test_number.py | buddwm/hubble | b384ee48556ca144ae6f09dd0b45db29288e5293 | [
"Apache-2.0"
] | 363 | 2017-01-10T22:02:47.000Z | 2022-03-21T10:44:40.000Z | tests/unittests/comparators/test_number.py | buddwm/hubble | b384ee48556ca144ae6f09dd0b45db29288e5293 | [
"Apache-2.0"
] | 439 | 2017-01-12T22:39:42.000Z | 2021-10-11T18:43:28.000Z | tests/unittests/comparators/test_number.py | buddwm/hubble | b384ee48556ca144ae6f09dd0b45db29288e5293 | [
"Apache-2.0"
] | 138 | 2017-01-05T22:10:59.000Z | 2021-09-01T14:35:00.000Z | from unittest import TestCase
import pytest
from hubblestack.comparators import number as number_comparator
from hubblestack.exceptions import HubbleCheckValidationError
class TestNumberMatch(TestCase):
"""
Unit tests for number::match comparator
"""
def test_match1(self):
"""
Match ... | 32.045872 | 87 | 0.594618 | from unittest import TestCase
import pytest
from hubblestack.comparators import number as number_comparator
from hubblestack.exceptions import HubbleCheckValidationError
class TestNumberMatch(TestCase):
def test_match1(self):
result_to_compare = 10
args = {
"type": "number",
... | true | true |
1c2165efcabe5d83e639dabe00842a1dd6029325 | 241 | py | Python | src/kgmk/ruijianime/scrape/comic_tags.py | kagemeka/python | 486ce39d97360b61029527bacf00a87fdbcf552c | [
"MIT"
] | null | null | null | src/kgmk/ruijianime/scrape/comic_tags.py | kagemeka/python | 486ce39d97360b61029527bacf00a87fdbcf552c | [
"MIT"
] | null | null | null | src/kgmk/ruijianime/scrape/comic_tags.py | kagemeka/python | 486ce39d97360b61029527bacf00a87fdbcf552c | [
"MIT"
] | null | null | null | from .tags import (
ScrapeTags,
)
import typing
class ScrapeComicTags(
ScrapeTags,
):
def _set_url(
self,
) -> typing.NoReturn:
self._url = (
'http://ruijianime.com/'
'comic/keyword/'
'keyword.php'
)
| 12.684211 | 30 | 0.589212 | from .tags import (
ScrapeTags,
)
import typing
class ScrapeComicTags(
ScrapeTags,
):
def _set_url(
self,
) -> typing.NoReturn:
self._url = (
'http://ruijianime.com/'
'comic/keyword/'
'keyword.php'
)
| true | true |
1c216673741b54d43530401d9a42ad8e709390a2 | 33,190 | py | Python | Emotif/motif_discovery.py | YichaoOU/Emotif_Alpha | 1b98f82fe359ab5f16056b288b6a39694962992c | [
"MIT"
] | null | null | null | Emotif/motif_discovery.py | YichaoOU/Emotif_Alpha | 1b98f82fe359ab5f16056b288b6a39694962992c | [
"MIT"
] | null | null | null | Emotif/motif_discovery.py | YichaoOU/Emotif_Alpha | 1b98f82fe359ab5f16056b288b6a39694962992c | [
"MIT"
] | null | null | null |
'''
output pwm files
9-29-2015
Yichao combines Rami's code
3-30-2016
added gkm-SVM
motif_discovery is coded all within this script.
'''
from __future__ import division
import re
from utils import motif_utils
import os
import shutil
#from Bio import motifs
# from Bio.Motif import Motif as mot... | 34.572917 | 314 | 0.677312 |
'''
output pwm files
9-29-2015
Yichao combines Rami's code
3-30-2016
added gkm-SVM
motif_discovery is coded all within this script.
'''
from __future__ import division
import re
from utils import motif_utils
import os
import shutil
#from Bio import motifs
# from Bio.Motif import Motif as mot... | false | true |
1c2166e3914aeb60d1169846869223394b779a1b | 1,514 | py | Python | browser/migrations/0001_initial.py | deniskolokol/moon2_www | e91d3f86f077f3917f91203b3d2368ffc12164b0 | [
"Apache-2.0"
] | null | null | null | browser/migrations/0001_initial.py | deniskolokol/moon2_www | e91d3f86f077f3917f91203b3d2368ffc12164b0 | [
"Apache-2.0"
] | 7 | 2016-09-17T18:50:15.000Z | 2018-01-10T13:22:55.000Z | browser/migrations/0001_initial.py | deniskolokol/moon2_www | e91d3f86f077f3917f91203b3d2368ffc12164b0 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-12-08 11:13
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Create... | 38.820513 | 162 | 0.597754 |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='MenuItem',
fields=[
... | true | true |
1c2167cca27b6960ee08e18d0eb01b85263702c3 | 2,039 | py | Python | app/models.py | jiangzhuoyan1984/myflasky | f6422b83720cc0f11b54ccf11b4cc098c4771472 | [
"MIT"
] | null | null | null | app/models.py | jiangzhuoyan1984/myflasky | f6422b83720cc0f11b54ccf11b4cc098c4771472 | [
"MIT"
] | null | null | null | app/models.py | jiangzhuoyan1984/myflasky | f6422b83720cc0f11b54ccf11b4cc098c4771472 | [
"MIT"
] | null | null | null | from . import db
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import UserMixin
from . import login_manager
# 模型这个术语表示程序使用的持久化实体。在 ORM 中,模型一般是一个 Python 类,类中
# 的属性对应数据库表中的列。
#
# Flask-SQLAlchemy 创建的数据库实例为模型提供了一个基类以及一系列辅助类和辅助函数,
# 可用于定义模型的结构。roles 表和 users 表可定义为模型 Role 和 Use... | 34.559322 | 73 | 0.71898 | from . import db
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import UserMixin
from . import login_manager
class Role(db.Model):
__tablename__ = 'roles'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(64), unique=True)
... | true | true |
1c21690b8fca7c61a4167a7bff0a933b341faad7 | 306 | py | Python | drug_shortage/apps/upload_and_clean_excel/models.py | duqian91/drug_shortage | 70cd1692ceb01098335cb3ee7c59a221ff6d6390 | [
"MIT"
] | null | null | null | drug_shortage/apps/upload_and_clean_excel/models.py | duqian91/drug_shortage | 70cd1692ceb01098335cb3ee7c59a221ff6d6390 | [
"MIT"
] | null | null | null | drug_shortage/apps/upload_and_clean_excel/models.py | duqian91/drug_shortage | 70cd1692ceb01098335cb3ee7c59a221ff6d6390 | [
"MIT"
] | null | null | null | from django.db import models
# Create your models here.
class Medication(models.Model):
gespharx_id = models.IntegerField()
din = models.CharField(max_length=30)
generic_name = models.CharField(max_length=30)
def __str__(self):
return self.generic_name + ' ' + str(self.din)
| 25.5 | 54 | 0.699346 | from django.db import models
class Medication(models.Model):
gespharx_id = models.IntegerField()
din = models.CharField(max_length=30)
generic_name = models.CharField(max_length=30)
def __str__(self):
return self.generic_name + ' ' + str(self.din)
| true | true |
1c2169dd73dbb492baa8dd2d55bad981850ddc84 | 1,185 | py | Python | run.py | BubblegumDiscord/LoLTrivia | 70070dc2e8c59d7210d8b30ad2525bafaee4bba7 | [
"MIT"
] | null | null | null | run.py | BubblegumDiscord/LoLTrivia | 70070dc2e8c59d7210d8b30ad2525bafaee4bba7 | [
"MIT"
] | null | null | null | run.py | BubblegumDiscord/LoLTrivia | 70070dc2e8c59d7210d8b30ad2525bafaee4bba7 | [
"MIT"
] | 1 | 2018-05-06T15:49:33.000Z | 2018-05-06T15:49:33.000Z | #!python3
import json
import logging
from discord.ext import commands
import plugins
with open("config.json", "r") as f:
config: dict = json.load(f)
client = commands.Bot(command_prefix=commands.when_mentioned_or('!'), description="League of Legends Trivia",
pm_help=True)
client.owner_id: ... | 30.384615 | 109 | 0.695359 |
import json
import logging
from discord.ext import commands
import plugins
with open("config.json", "r") as f:
config: dict = json.load(f)
client = commands.Bot(command_prefix=commands.when_mentioned_or('!'), description="League of Legends Trivia",
pm_help=True)
client.owner_id: str = con... | true | true |
1c216a22835a310f861d9ddcca7ddd3495783d5b | 37,262 | py | Python | scenarios/taskspace-torquecontrol-test.py | domingoesteban/robolearn | 0d20125425c352b80ef2eeed1c0b11ab6497b11a | [
"BSD-3-Clause"
] | 1 | 2020-01-13T09:44:22.000Z | 2020-01-13T09:44:22.000Z | scenarios/taskspace-torquecontrol-test.py | domingoesteban/robolearn | 0d20125425c352b80ef2eeed1c0b11ab6497b11a | [
"BSD-3-Clause"
] | null | null | null | scenarios/taskspace-torquecontrol-test.py | domingoesteban/robolearn | 0d20125425c352b80ef2eeed1c0b11ab6497b11a | [
"BSD-3-Clause"
] | 1 | 2021-12-22T00:41:20.000Z | 2021-12-22T00:41:20.000Z | import os
import sys
import rbdl
import rospy
from XCM.msg import CommandAdvr
from XCM.msg import JointStateAdvr
from robolearn.old_utils.tasks.lift_box_utils import create_box_relative_pose
from robolearn.old_utils.tasks.lift_box_utils import reset_bigman_box_gazebo
from robolearn.old_utils.trajectory_interpolators i... | 51.609418 | 136 | 0.677688 | import os
import sys
import rbdl
import rospy
from XCM.msg import CommandAdvr
from XCM.msg import JointStateAdvr
from robolearn.old_utils.tasks.lift_box_utils import create_box_relative_pose
from robolearn.old_utils.tasks.lift_box_utils import reset_bigman_box_gazebo
from robolearn.old_utils.trajectory_interpolators i... | true | true |
1c216a999c930ded4bfadff9d99aa909206b71a0 | 3,422 | py | Python | examples/rough_translated1/osgwidgetaddremove.py | JaneliaSciComp/osgpyplusplus | a5ae3f69c7e9101a32d8cc95fe680dab292f75ac | [
"BSD-3-Clause"
] | 17 | 2015-06-01T12:19:46.000Z | 2022-02-12T02:37:48.000Z | examples/rough_translated1/osgwidgetaddremove.py | cmbruns/osgpyplusplus | f8bfca2cf841e15f6ddb41c958f3ad0d0b9e4b75 | [
"BSD-3-Clause"
] | 7 | 2015-07-04T14:36:49.000Z | 2015-07-23T18:09:49.000Z | examples/rough_translated1/osgwidgetaddremove.py | cmbruns/osgpyplusplus | f8bfca2cf841e15f6ddb41c958f3ad0d0b9e4b75 | [
"BSD-3-Clause"
] | 7 | 2015-11-28T17:00:31.000Z | 2020-01-08T07:00:59.000Z | #!/bin/env python
# Automatically translated python version of
# OpenSceneGraph example program "osgwidgetaddremove"
# !!! This program will need manual tuning before it will work. !!!
import sys
from osgpypp import osgWidget
# Translated from file 'osgwidgetaddremove.cpp'
# -*-c++-*- osgWidget - Code by: Jeremy... | 23.6 | 83 | 0.619229 |
import sys
from osgpypp import osgWidget
MASK_2D = 0xF0000000
class ABCWidget (osgWidget.Label) :
ABCWidget( str label):
osgWidget.Label("", label)
setFont("fonts/Vera.ttf")
setFontSize(20)
setCanFill(True)
setShadow(0.08)
addSize(10.0, 10.0)
class... | false | true |
1c216aba61f78c62a3a646d6bf5b944ab8b4193f | 18,794 | py | Python | sodasql/scan/scan_yml_parser.py | udemy/soda-sql | 53dd2218770c74367787f1d85ee0d48d498b51eb | [
"Apache-2.0"
] | null | null | null | sodasql/scan/scan_yml_parser.py | udemy/soda-sql | 53dd2218770c74367787f1d85ee0d48d498b51eb | [
"Apache-2.0"
] | null | null | null | sodasql/scan/scan_yml_parser.py | udemy/soda-sql | 53dd2218770c74367787f1d85ee0d48d498b51eb | [
"Apache-2.0"
] | null | null | null | # Copyright 2020 Soda
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
#... | 44.014052 | 137 | 0.629935 |
import re
from typing import Set, List, Optional
from jinja2 import Template
from sodasql.scan.file_system import FileSystemSingleton
from sodasql.scan.metric import Metric
from sodasql.scan.missing import Missing
from sodasql.scan.parser import Parser
from sodasql.scan.samples_yml import SamplesYml
from so... | true | true |
1c216b0ee036a3302eb56995c788008c00dc348a | 1,179 | py | Python | stack/stack_with_array_tests.py | informramiz/data-structures-and-algorithms | 7038c8becc4cbad82867c9c8bca42637ca27c8d7 | [
"Apache-2.0"
] | null | null | null | stack/stack_with_array_tests.py | informramiz/data-structures-and-algorithms | 7038c8becc4cbad82867c9c8bca42637ca27c8d7 | [
"Apache-2.0"
] | null | null | null | stack/stack_with_array_tests.py | informramiz/data-structures-and-algorithms | 7038c8becc4cbad82867c9c8bca42637ca27c8d7 | [
"Apache-2.0"
] | 1 | 2020-09-24T22:54:52.000Z | 2020-09-24T22:54:52.000Z | from stack_with_array import Stack
def test_stack_push():
foo_stack = Stack()
foo_stack.push(1)
foo_stack.push(2)
foo_stack.push(3)
foo_stack.push(4)
foo_stack.push(5)
foo_stack.push(6)
foo_stack.push(7)
foo_stack.push(8)
foo_stack.push(9)
foo_stack.push(10) # The array is... | 20.684211 | 78 | 0.660729 | from stack_with_array import Stack
def test_stack_push():
foo_stack = Stack()
foo_stack.push(1)
foo_stack.push(2)
foo_stack.push(3)
foo_stack.push(4)
foo_stack.push(5)
foo_stack.push(6)
foo_stack.push(7)
foo_stack.push(8)
foo_stack.push(9)
foo_stack.push(10)
foo_stack... | true | true |
1c216b426548a32edfe94d8415526b8a0bc2785c | 1,473 | py | Python | demos/differentiate_pressure.py | eliasdjo/PhiFlow | dc88dca696d25a5ea5793aa48fae390469f0d829 | [
"MIT"
] | null | null | null | demos/differentiate_pressure.py | eliasdjo/PhiFlow | dc88dca696d25a5ea5793aa48fae390469f0d829 | [
"MIT"
] | null | null | null | demos/differentiate_pressure.py | eliasdjo/PhiFlow | dc88dca696d25a5ea5793aa48fae390469f0d829 | [
"MIT"
] | null | null | null | """ Differentiate through Pressure Solve
This application demonstrates the backpropagation through the pressure solve operation used in simulating incompressible fluids.
The demo Optimizes the velocity of an incompressible fluid in the left half of a closed space to match the TARGET in the right half.
"""
from phi.to... | 44.636364 | 146 | 0.735234 | from phi.torch.flow import *
DOMAIN = dict(x=80, y=64)
LEFT = StaggeredGrid(HardGeometryMask(Box(x=(-INF, 40), y=None)), 0, **DOMAIN)
RIGHT = StaggeredGrid(HardGeometryMask(Box(x=(40, INF), y=None)), extrapolation.ZERO, **DOMAIN)
TARGET = RIGHT * StaggeredGrid(lambda x: math.exp(-0.5 * math.vec_squared(x - (50, 10)... | true | true |
1c216b64834eb32597c00fb140d076af7ef4d4c0 | 10,042 | py | Python | novaclient/tests/unit/v2/test_hypervisors.py | klmitch/python-novaclient | 1322199845a095bafd0a16900f4899283fd0fabe | [
"Apache-1.1"
] | null | null | null | novaclient/tests/unit/v2/test_hypervisors.py | klmitch/python-novaclient | 1322199845a095bafd0a16900f4899283fd0fabe | [
"Apache-1.1"
] | null | null | null | novaclient/tests/unit/v2/test_hypervisors.py | klmitch/python-novaclient | 1322199845a095bafd0a16900f4899283fd0fabe | [
"Apache-1.1"
] | null | null | null | # Copyright 2012 OpenStack Foundation
# 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 requ... | 38.623077 | 78 | 0.601972 |
from novaclient import api_versions
from novaclient import exceptions
from novaclient.tests.unit.fixture_data import client
from novaclient.tests.unit.fixture_data import hypervisors as data
from novaclient.tests.unit import utils
from novaclient.tests.unit.v2 import fakes
class HypervisorsTest(utils.F... | true | true |
1c216da64a53990b1c8e78ddc682e517a99bd33f | 25,573 | py | Python | python/ccxt/async/liqui.py | August-Ghost/ccxt | 886c596ffde611b5a92cb5b6e3788ff010324c74 | [
"MIT"
] | 2 | 2018-03-08T20:17:22.000Z | 2021-06-01T23:36:26.000Z | python/ccxt/async/liqui.py | August-Ghost/ccxt | 886c596ffde611b5a92cb5b6e3788ff010324c74 | [
"MIT"
] | null | null | null | python/ccxt/async/liqui.py | August-Ghost/ccxt | 886c596ffde611b5a92cb5b6e3788ff010324c74 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from ccxt.async.base.exchange import Exchange
# -----------------------------------------------------------------------------
try:
basestring # Python 3
except NameError:
basestring = str # Python 2
import hashlib
import json
from ccxt.base.errors import ExchangeError
from ccxt.base... | 39.525502 | 191 | 0.506863 |
from ccxt.async.base.exchange import Exchange
try:
basestring
except NameError:
basestring = str
import hashlib
import json
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import AuthenticationError
from ccxt.base.errors import InsufficientFunds
from ccxt.base.errors import InvalidOrde... | false | true |
1c216e5ec1492700a727e483ac9657c4cd7d47ff | 6,373 | py | Python | imagepy/menus/Process/Filters/classic_plgs.py | jimpassmore/imagepy | a814bf8a763f9ce427569f3ef5e5188746cc50eb | [
"BSD-4-Clause"
] | null | null | null | imagepy/menus/Process/Filters/classic_plgs.py | jimpassmore/imagepy | a814bf8a763f9ce427569f3ef5e5188746cc50eb | [
"BSD-4-Clause"
] | null | null | null | imagepy/menus/Process/Filters/classic_plgs.py | jimpassmore/imagepy | a814bf8a763f9ce427569f3ef5e5188746cc50eb | [
"BSD-4-Clause"
] | null | null | null | # -*- coding: utf-8 -*
import scipy.ndimage as nimg
from imagepy.core.engine import Filter, Simple
import numpy as np
class Uniform(Filter):
title = 'Uniform'
note = ['all', 'auto_msk', 'auto_snap','preview']
#parameter
para = {'size':2}
view = [(float, (0,30), 1, 'size', 'size', 'pix')]
... | 32.850515 | 92 | 0.55029 |
import scipy.ndimage as nimg
from imagepy.core.engine import Filter, Simple
import numpy as np
class Uniform(Filter):
title = 'Uniform'
note = ['all', 'auto_msk', 'auto_snap','preview']
para = {'size':2}
view = [(float, (0,30), 1, 'size', 'size', 'pix')]
def run(self, ips, snap, i... | true | true |
1c216e8b191b9802080f811caa3e4b1dec0e9ca6 | 768 | py | Python | python/ray/tune/tests/test_soft_imports.py | mgelbart/ray | 4cec2286572e368a4bd64aae467751a384eff62d | [
"Apache-2.0"
] | 22 | 2018-05-08T05:52:34.000Z | 2020-04-01T10:09:55.000Z | python/ray/tune/tests/test_soft_imports.py | mgelbart/ray | 4cec2286572e368a4bd64aae467751a384eff62d | [
"Apache-2.0"
] | 73 | 2021-09-25T07:11:39.000Z | 2022-03-26T07:10:59.000Z | python/ray/tune/tests/test_soft_imports.py | mgelbart/ray | 4cec2286572e368a4bd64aae467751a384eff62d | [
"Apache-2.0"
] | 10 | 2018-04-27T10:50:59.000Z | 2020-02-24T02:41:43.000Z | import sys
import unittest
class TestSoftImports(unittest.TestCase):
"""Tests whether it's possible to use Ray Tune without soft dependencies"""
def testSoftImports(self):
import ray.tune.schedulers # noqa: F401
from ray.tune.suggest import SEARCH_ALG_IMPORT
for name, import_func in... | 29.538462 | 79 | 0.648438 | import sys
import unittest
class TestSoftImports(unittest.TestCase):
def testSoftImports(self):
import ray.tune.schedulers
from ray.tune.suggest import SEARCH_ALG_IMPORT
for name, import_func in SEARCH_ALG_IMPORT.items():
print(f"testing searcher {name}")
search... | true | true |
1c216e94a22e7ef55f6f5c6391cc022a1f886d58 | 15,488 | py | Python | tests/dataloader_test.py | NunoEdgarGFlowHub/poptorch | 2e69b81c7c94b522d9f57cc53d31be562f5e3749 | [
"MIT"
] | null | null | null | tests/dataloader_test.py | NunoEdgarGFlowHub/poptorch | 2e69b81c7c94b522d9f57cc53d31be562f5e3749 | [
"MIT"
] | null | null | null | tests/dataloader_test.py | NunoEdgarGFlowHub/poptorch | 2e69b81c7c94b522d9f57cc53d31be562f5e3749 | [
"MIT"
] | null | null | null | # Copyright (c) 2020 Graphcore Ltd. All rights reserved.
import subprocess
import time
import numpy
import poptorch
import pytest
import torch
class BrokenDataset(torch.utils.data.Dataset):
def __init__(self, length):
self._length = length
def __len__(self):
return self._length
def __get... | 30.85259 | 87 | 0.573928 |
import subprocess
import time
import numpy
import poptorch
import pytest
import torch
class BrokenDataset(torch.utils.data.Dataset):
def __init__(self, length):
self._length = length
def __len__(self):
return self._length
def __getitem__(self, index):
assert False, "Broken datas... | true | true |
1c216f9a910306d7a1fcde4c348ee57013d96282 | 15,139 | py | Python | lib/wsl_roi_data_layer/minibatch_old.py | shenyunhang/CSC | 2902272a369d4eef1bb37474f0e1f98f6e2e6e2f | [
"MIT"
] | 14 | 2018-07-08T14:36:08.000Z | 2021-01-17T10:27:52.000Z | lib/wsl_roi_data_layer/minibatch_old.py | shenyunhang/CSC | 2902272a369d4eef1bb37474f0e1f98f6e2e6e2f | [
"MIT"
] | null | null | null | lib/wsl_roi_data_layer/minibatch_old.py | shenyunhang/CSC | 2902272a369d4eef1bb37474f0e1f98f6e2e6e2f | [
"MIT"
] | 4 | 2019-07-02T02:54:56.000Z | 2020-07-03T01:07:22.000Z | # -*- coding: utf-8 -*-
import numpy as np
import numpy.random as npr
import cv2
import os
from configure import cfg
from utils.blob import prep_im_for_blob, im_list_to_blob
import datasets.ds_utils
def get_minibatch(roidb, num_classes):
"""Given a roidb, construct a minibatch sampled from it."""
num_images ... | 35.454333 | 113 | 0.56153 |
import numpy as np
import numpy.random as npr
import cv2
import os
from configure import cfg
from utils.blob import prep_im_for_blob, im_list_to_blob
import datasets.ds_utils
def get_minibatch(roidb, num_classes):
"""Given a roidb, construct a minibatch sampled from it."""
num_images = len(roidb)
r... | false | true |
1c21701f56d0f9a56608a49b56d1c439a8b1e8d9 | 438 | py | Python | Chapter07/programs/prog02.py | gits00/raspberry-pi-computer-vision-programming | dfd5588c5d3e410945f862427c0f987536b04d9f | [
"MIT"
] | 17 | 2020-08-08T20:47:29.000Z | 2022-03-12T03:08:21.000Z | Chapter07/programs/prog02.py | gits00/raspberry-pi-computer-vision-programming | dfd5588c5d3e410945f862427c0f987536b04d9f | [
"MIT"
] | 1 | 2020-07-27T09:57:19.000Z | 2020-08-18T10:57:31.000Z | Chapter07/programs/prog02.py | gits00/raspberry-pi-computer-vision-programming | dfd5588c5d3e410945f862427c0f987536b04d9f | [
"MIT"
] | 15 | 2020-06-30T01:52:06.000Z | 2022-02-08T08:28:48.000Z | import numpy as np
import cv2
import matplotlib.pyplot as plt
img = cv2.imread('/home/pi/book/dataset/4.1.03.tiff', 0)
row, col = img.shape
img = img.astype(np.float32)
mean = 0
var = 0.1
sigma = var**0.5
gauss = np.random.normal(mean, sigma, (row, col))
gauss = gauss.reshape(row, col)
noisy = img + gauss
print(abs(noi... | 24.333333 | 56 | 0.705479 | import numpy as np
import cv2
import matplotlib.pyplot as plt
img = cv2.imread('/home/pi/book/dataset/4.1.03.tiff', 0)
row, col = img.shape
img = img.astype(np.float32)
mean = 0
var = 0.1
sigma = var**0.5
gauss = np.random.normal(mean, sigma, (row, col))
gauss = gauss.reshape(row, col)
noisy = img + gauss
print(abs(noi... | true | true |
1c217396a3f7c2a5e1749c5344246c889240466e | 1,822 | py | Python | e3sm_to_cmip/cmor_handlers/cesm_drybc.py | JGCRI/e3sm_to_cmip | 3d3bc7dd7e3a46a97dba4f13a888758e01ef4797 | [
"MIT"
] | null | null | null | e3sm_to_cmip/cmor_handlers/cesm_drybc.py | JGCRI/e3sm_to_cmip | 3d3bc7dd7e3a46a97dba4f13a888758e01ef4797 | [
"MIT"
] | null | null | null | e3sm_to_cmip/cmor_handlers/cesm_drybc.py | JGCRI/e3sm_to_cmip | 3d3bc7dd7e3a46a97dba4f13a888758e01ef4797 | [
"MIT"
] | null | null | null | """
bc_a1DDF, bc_a4DDF, bc_c1DDF, bc_c4DDF to drybc converter
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import cmor
from e3sm_to_cmip.lib import handle_variables
# list of raw variable names needed
RAW_VARIABLES = [str('bc_a1DDF'), str('bc_a4DDF'), str('bc_c1DDF'), str('bc... | 31.413793 | 87 | 0.590011 | from __future__ import absolute_import, division, print_function, unicode_literals
import cmor
from e3sm_to_cmip.lib import handle_variables
RAW_VARIABLES = [str('bc_a1DDF'), str('bc_a4DDF'), str('bc_c1DDF'), str('bc_c4DDF')]
VAR_NAME = str('drybc')
VAR_UNITS = str('kg m-2 s-1')
TABLE = str('CMIP6_AERmon.json')
de... | true | true |
1c2174bc9b764072db0e65978c82af74a646d8c1 | 1,109 | py | Python | Lesson9/table.py | shinkai-tester/python_beginner | a934328c9a50241cc3f02a423060e16aab53b425 | [
"Apache-2.0"
] | 2 | 2021-06-01T13:24:04.000Z | 2021-06-01T13:27:47.000Z | Lesson9/table.py | shinkai-tester/python_beginner | a934328c9a50241cc3f02a423060e16aab53b425 | [
"Apache-2.0"
] | null | null | null | Lesson9/table.py | shinkai-tester/python_beginner | a934328c9a50241cc3f02a423060e16aab53b425 | [
"Apache-2.0"
] | null | null | null | locs = sorted(set(input().split()))
roads = set(map(frozenset, map(lambda x: x.replace(' ', ''), input().split(','))))
directions = [i for i in roads if len(i) > 1]
coordinates_x = []
coordinates_y = []
data = [['0' for i in range(len(locs))] for k in range(len(locs))]
def Red(skk): return "\033[91m {}\033[00m".forma... | 29.972973 | 82 | 0.526601 | locs = sorted(set(input().split()))
roads = set(map(frozenset, map(lambda x: x.replace(' ', ''), input().split(','))))
directions = [i for i in roads if len(i) > 1]
coordinates_x = []
coordinates_y = []
data = [['0' for i in range(len(locs))] for k in range(len(locs))]
def Red(skk): return "\033[91m {}\033[00m".forma... | true | true |
1c217628017d9de100f0740cec9e1947556d4db9 | 1,599 | py | Python | examples/closeable_app.py | smurfix/remi | 879f48048c3d753a07667a9b239358d104692788 | [
"Apache-2.0"
] | 3,224 | 2015-10-30T15:35:05.000Z | 2022-03-08T19:31:46.000Z | examples/closeable_app.py | smurfix/remi | 879f48048c3d753a07667a9b239358d104692788 | [
"Apache-2.0"
] | 453 | 2015-10-26T17:39:01.000Z | 2022-03-07T13:57:18.000Z | examples/closeable_app.py | smurfix/remi | 879f48048c3d753a07667a9b239358d104692788 | [
"Apache-2.0"
] | 458 | 2015-11-03T12:08:01.000Z | 2022-03-09T00:17:19.000Z | """
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed ... | 30.75 | 80 | 0.670419 |
import remi.gui as gui
from remi import start, App
class MyApp(App):
def main(self, name='world'):
wid = gui.VBox(width=300, height=200, margin='0px auto')
bt = gui.Button('Close App', width=200, height=30)
bt.style['margin'] = 'auto 50px'
bt.style['background-color'] =... | true | true |
1c21764861ef33181d43cafc8f6d3dbb18bab961 | 2,779 | py | Python | heat/graph/tests/test_laplacian.py | shssf/heat | 9db0a936c92491fa5aa862f558cb385c9916216b | [
"MIT"
] | 105 | 2018-05-18T11:34:03.000Z | 2022-03-29T06:37:23.000Z | heat/graph/tests/test_laplacian.py | shssf/heat | 9db0a936c92491fa5aa862f558cb385c9916216b | [
"MIT"
] | 909 | 2018-05-18T07:50:26.000Z | 2022-03-31T20:16:30.000Z | heat/graph/tests/test_laplacian.py | shssf/heat | 9db0a936c92491fa5aa862f558cb385c9916216b | [
"MIT"
] | 28 | 2018-05-24T14:39:18.000Z | 2022-03-31T19:18:47.000Z | import os
import unittest
import heat as ht
from heat.core.tests.test_suites.basic_test import TestCase
class TestLaplacian(TestCase):
def test_laplacian(self):
size = ht.communication.MPI_WORLD.size
rank = ht.communication.MPI_WORLD.rank
X = ht.ones((size * 2, 4), split=0)
X.lar... | 36.565789 | 96 | 0.601655 | import os
import unittest
import heat as ht
from heat.core.tests.test_suites.basic_test import TestCase
class TestLaplacian(TestCase):
def test_laplacian(self):
size = ht.communication.MPI_WORLD.size
rank = ht.communication.MPI_WORLD.rank
X = ht.ones((size * 2, 4), split=0)
X.lar... | true | true |
1c217650f2995ca2e227e4629c474748f195005e | 429 | py | Python | archive/scripts/impala.py | bionicles/neuromax | a53a17a1c033c11ac607a9e28f43b1f906e58aad | [
"MIT"
] | null | null | null | archive/scripts/impala.py | bionicles/neuromax | a53a17a1c033c11ac607a9e28f43b1f906e58aad | [
"MIT"
] | null | null | null | archive/scripts/impala.py | bionicles/neuromax | a53a17a1c033c11ac607a9e28f43b1f906e58aad | [
"MIT"
] | null | null | null | import ray
from ray.tune import run
from ray.tune.schedulers import AsyncHyperBandScheduler
from ray.tune.suggest.bayesopt import BayesOptSearch
if __name__ == "__main__":
ray.init()
pbounds = {
'GAIN': (1e-4, 0.1),
'UNITS': (17, 2000),
'LR': (1e-4, 1e-1),
'EPSILON': (1e-4, 1),... | 22.578947 | 55 | 0.522145 | import ray
from ray.tune import run
from ray.tune.schedulers import AsyncHyperBandScheduler
from ray.tune.suggest.bayesopt import BayesOptSearch
if __name__ == "__main__":
ray.init()
pbounds = {
'GAIN': (1e-4, 0.1),
'UNITS': (17, 2000),
'LR': (1e-4, 1e-1),
'EPSILON': (1e-4, 1),... | true | true |
1c2176a5a2d94db86718996c04640ea081834fbc | 2,943 | py | Python | dataloader.py | doansangg/CGAN-PyTorch | 941f5bd75102bed7f2eccd7feb9af8e6134af0e4 | [
"Apache-2.0"
] | 1 | 2021-12-30T21:19:41.000Z | 2021-12-30T21:19:41.000Z | dataloader.py | doansangg/CGAN-PyTorch | 941f5bd75102bed7f2eccd7feb9af8e6134af0e4 | [
"Apache-2.0"
] | null | null | null | dataloader.py | doansangg/CGAN-PyTorch | 941f5bd75102bed7f2eccd7feb9af8e6134af0e4 | [
"Apache-2.0"
] | null | null | null | import os
from PIL import Image
import torch.utils.data as data
import torchvision.transforms as transforms
import numpy as np
import random
import torch
from torch import Tensor, int32
class Dataset(data.Dataset):
"""
dataloader for polyp segmentation tasks
"""
def __init__(self, path_data, trainsize,... | 34.22093 | 114 | 0.610941 | import os
from PIL import Image
import torch.utils.data as data
import torchvision.transforms as transforms
import numpy as np
import random
import torch
from torch import Tensor, int32
class Dataset(data.Dataset):
def __init__(self, path_data, trainsize, augmentations):
self.trainsize = trainsize
... | true | true |
1c21773926e022c32dfdc77f102a7c78880e6397 | 3,975 | py | Python | modules/runtime/scenario/scenario_generation/deterministic.py | Lizhu-Chen/bark | fad029f658e462eb1772c28c2c0971faf5176dc1 | [
"MIT"
] | null | null | null | modules/runtime/scenario/scenario_generation/deterministic.py | Lizhu-Chen/bark | fad029f658e462eb1772c28c2c0971faf5176dc1 | [
"MIT"
] | null | null | null | modules/runtime/scenario/scenario_generation/deterministic.py | Lizhu-Chen/bark | fad029f658e462eb1772c28c2c0971faf5176dc1 | [
"MIT"
] | 1 | 2020-08-12T17:09:05.000Z | 2020-08-12T17:09:05.000Z | # Copyright (c) 2020 Julian Bernhard, Klemens Esterle, Patrick Hart and
# Tobias Kessler
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
from modules.runtime.scenario.scenario import Scenario
from modules.runtime.scenario.scenario_generation.scenar... | 42.287234 | 129 | 0.68 |
from modules.runtime.scenario.scenario import Scenario
from modules.runtime.scenario.scenario_generation.scenario_generation\
import ScenarioGeneration
from modules.runtime.commons.model_json_conversion import ModelJsonConversion
from bark.world.agent import *
from bark.models.behavior import *
from bark.world ... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.