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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c2336a95ad868b3322888c0aa6d40c8d8cc41e6 | 2,325 | py | Python | CS3/0350_attack_optimization/draft01/main.py | nealholt/python_programming_curricula | eda4432dab97178b4a5712b160f5b1da74c068cb | [
"MIT"
] | 7 | 2020-10-14T03:23:12.000Z | 2022-03-09T23:16:13.000Z | CS3/0350_attack_optimization/draft01/main.py | nealholt/python_programming_curricula | eda4432dab97178b4a5712b160f5b1da74c068cb | [
"MIT"
] | null | null | null | CS3/0350_attack_optimization/draft01/main.py | nealholt/python_programming_curricula | eda4432dab97178b4a5712b160f5b1da74c068cb | [
"MIT"
] | 11 | 2021-02-21T20:50:56.000Z | 2022-01-29T07:01:28.000Z | import pygame, player, bullet, math
#Setup
pygame.init()
screen_width = 1100
screen_height = 650
screen = pygame.display.set_mode((screen_width,screen_height))
clock = pygame.time.Clock()
black = 0,0,0
def userInputToPlayer(p):
keys = pygame.key.get_pressed()
if keys[pygame.K_UP]:
p.accelerateForward... | 25.549451 | 66 | 0.626237 | import pygame, player, bullet, math
pygame.init()
screen_width = 1100
screen_height = 650
screen = pygame.display.set_mode((screen_width,screen_height))
clock = pygame.time.Clock()
black = 0,0,0
def userInputToPlayer(p):
keys = pygame.key.get_pressed()
if keys[pygame.K_UP]:
p.accelerateForward()
... | true | true |
1c23371e29fc8c50297cfec0279df0669b9cf73e | 4,485 | py | Python | homework_working/hw7-backprop/code/test_utils.py | kehannan/mlcourse | e51b16ac1feaeb732a211b837746b70fc2fcee7b | [
"CC-BY-4.0"
] | null | null | null | homework_working/hw7-backprop/code/test_utils.py | kehannan/mlcourse | e51b16ac1feaeb732a211b837746b70fc2fcee7b | [
"CC-BY-4.0"
] | null | null | null | homework_working/hw7-backprop/code/test_utils.py | kehannan/mlcourse | e51b16ac1feaeb732a211b837746b70fc2fcee7b | [
"CC-BY-4.0"
] | null | null | null | """Computation graph test utilities
Below are functions that can assist in testing the implementation of backward
for individual nodes, as well as the gradient computation in a
ComputationGraphFunction. The approach is to use the secant approximation to
compute the gradient numerically, and this is then compared to th... | 46.237113 | 133 | 0.70078 |
import logging
import graph
import numpy as np
logging.basicConfig(format='%(levelname)s: %(message)s',level=logging.DEBUG)
def relative_error(a,b):
if a==0.0 and b==0.0:
return 0.0
rel_err = np.abs(a-b) / max(np.abs(a), np.abs(b))
return rel_err
def test_node_backward(node, init_vals, delta... | true | true |
1c233726c1aca1b5e2b6bbcce679817fc0f6d259 | 3,721 | py | Python | portal.dsic/examples/python/KNN_Classifier.py | jonandergomez/teaa_lab | a5acf38b683b1d6feb1ff7e12dddfbc6352baf5e | [
"MIT"
] | null | null | null | portal.dsic/examples/python/KNN_Classifier.py | jonandergomez/teaa_lab | a5acf38b683b1d6feb1ff7e12dddfbc6352baf5e | [
"MIT"
] | null | null | null | portal.dsic/examples/python/KNN_Classifier.py | jonandergomez/teaa_lab | a5acf38b683b1d6feb1ff7e12dddfbc6352baf5e | [
"MIT"
] | 4 | 2021-09-22T13:35:24.000Z | 2021-09-29T13:41:15.000Z | """
Author: Jon Ander Gomez Adrian (jon@dsic.upv.es, http://personales.upv.es/jon)
Version: 1.0
Date: October 2021
Universitat Politecnica de Valencia
Technical University of Valencia TU.VLC
"""
import sys
import time
import math
import numpy
try:
from pyspark.rdd import RDD
except:
RDD =... | 36.126214 | 116 | 0.508734 |
import sys
import time
import math
import numpy
try:
from pyspark.rdd import RDD
except:
RDD = None
from BallTree import BallTree
class KNN_Classifier:
def __init__(self, K = 5, num_classes = 2):
self.num_classes = num_classes
self.K = K
self.balltree = None
def fi... | true | true |
1c2338d5e09251023122d657c0cf0dc549dc6bc5 | 3,584 | py | Python | tests/test_optimizer_with_nn.py | chihhao428/pytorch-optimizer | ba02c199e88ff5d8d48695351c776b66192a88d2 | [
"Apache-2.0"
] | 1 | 2021-02-09T09:41:41.000Z | 2021-02-09T09:41:41.000Z | tests/test_optimizer_with_nn.py | mhaut/pytorch-optimizer | e049b0526ccb70317faf0c6f8dd97ec02d04a5b2 | [
"Apache-2.0"
] | null | null | null | tests/test_optimizer_with_nn.py | mhaut/pytorch-optimizer | e049b0526ccb70317faf0c6f8dd97ec02d04a5b2 | [
"Apache-2.0"
] | null | null | null | import numpy as np
import pytest
import torch
from torch import nn
import torch_optimizer as optim
def make_dataset(seed=42):
rng = np.random.RandomState(seed)
N = 100
D = 2
X = rng.randn(N, D) * 2
# center the first N/2 points at (-2,-2)
mid = N // 2
X[:mid, :] = X[:mid, :] - 2 * np.on... | 34.461538 | 77 | 0.584263 | import numpy as np
import pytest
import torch
from torch import nn
import torch_optimizer as optim
def make_dataset(seed=42):
rng = np.random.RandomState(seed)
N = 100
D = 2
X = rng.randn(N, D) * 2
mid = N // 2
X[:mid, :] = X[:mid, :] - 2 * np.ones((mid, D))
X[mid:, :] = X[mi... | true | true |
1c2338f174d16169043963aa5d0c77da6d2b69ca | 64,965 | py | Python | xonsh/tools.py | caputomarcos/xonsh | 9ca29d8f2aad9f026af23b83fb7263d0fb702b1a | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | xonsh/tools.py | caputomarcos/xonsh | 9ca29d8f2aad9f026af23b83fb7263d0fb702b1a | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | xonsh/tools.py | caputomarcos/xonsh | 9ca29d8f2aad9f026af23b83fb7263d0fb702b1a | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | # -*- coding: utf-8 -*-
"""Misc. xonsh tools.
The following implementations were forked from the IPython project:
* Copyright (c) 2008-2014, IPython Development Team
* Copyright (C) 2001-2007 Fernando Perez <fperez@colorado.edu>
* Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
* Copyright (c) 2001, Nathaniel Gr... | 31.752199 | 130 | 0.604741 |
import builtins
import collections
import collections.abc as cabc
import contextlib
import ctypes
import datetime
from distutils.version import LooseVersion
import functools
import glob
import itertools
import os
import pathlib
import re
import subprocess
import sys
import threading
import traceback
import warnings
im... | true | true |
1c2339edc4f231a319a350b3d631d17589832ff8 | 2,222 | py | Python | src/ledger/command/delta.py | bhawkyard1/ledger | d0f9ef3e7735a4f493efa00f00133fd59b82a551 | [
"MIT"
] | null | null | null | src/ledger/command/delta.py | bhawkyard1/ledger | d0f9ef3e7735a4f493efa00f00133fd59b82a551 | [
"MIT"
] | null | null | null | src/ledger/command/delta.py | bhawkyard1/ledger | d0f9ef3e7735a4f493efa00f00133fd59b82a551 | [
"MIT"
] | null | null | null | import argparse
import sys
from collections import defaultdict
from ledger import pence_to_pounds, classproperty
from ledger.command import Command
from ledger.transaction import Transaction
class Delta(Command):
names = ("delta", "d")
def __call__(self, args):
args = self.parser.parse_ar... | 42.730769 | 136 | 0.620612 | import argparse
import sys
from collections import defaultdict
from ledger import pence_to_pounds, classproperty
from ledger.command import Command
from ledger.transaction import Transaction
class Delta(Command):
names = ("delta", "d")
def __call__(self, args):
args = self.parser.parse_ar... | true | true |
1c233b156ceff97b9b7bd08206499fea52f7ad44 | 3,996 | py | Python | tests/test_create_max_migration_files.py | UpliftAgency/django-linear-migrations | 7fc40365ef4e452eb99cf66bcdf74f4f5566eda9 | [
"MIT"
] | null | null | null | tests/test_create_max_migration_files.py | UpliftAgency/django-linear-migrations | 7fc40365ef4e452eb99cf66bcdf74f4f5566eda9 | [
"MIT"
] | null | null | null | tests/test_create_max_migration_files.py | UpliftAgency/django-linear-migrations | 7fc40365ef4e452eb99cf66bcdf74f4f5566eda9 | [
"MIT"
] | null | null | null | import sys
import time
from io import StringIO
import pytest
from django.core.management import call_command
from django.test import TestCase, override_settings
class MakeMigrationsTests(TestCase):
@pytest.fixture(autouse=True)
def tmp_path_fixture(self, tmp_path):
migrations_module_name = "migration... | 33.579832 | 85 | 0.631381 | import sys
import time
from io import StringIO
import pytest
from django.core.management import call_command
from django.test import TestCase, override_settings
class MakeMigrationsTests(TestCase):
@pytest.fixture(autouse=True)
def tmp_path_fixture(self, tmp_path):
migrations_module_name = "migration... | true | true |
1c233bf293270010c2829e3cf6a7769947b79bd7 | 842 | py | Python | SpartaCoding/week_2/homework/03_get_count_of_ways_to_target_by_doing_plus_or_minus.py | Haamseongho/KBDS_Algorithm | 6639970583ea6b59b54d045529f3b47b9dd1bebd | [
"Apache-2.0"
] | null | null | null | SpartaCoding/week_2/homework/03_get_count_of_ways_to_target_by_doing_plus_or_minus.py | Haamseongho/KBDS_Algorithm | 6639970583ea6b59b54d045529f3b47b9dd1bebd | [
"Apache-2.0"
] | null | null | null | SpartaCoding/week_2/homework/03_get_count_of_ways_to_target_by_doing_plus_or_minus.py | Haamseongho/KBDS_Algorithm | 6639970583ea6b59b54d045529f3b47b9dd1bebd | [
"Apache-2.0"
] | null | null | null | numbers = [1, 1, 1, 1, 1]
target_number = 3
result_count = 0
def get_count_of_ways_to_target_by_doing_plus_or_minus(array, target, current_index, current_sum):
# 구현해보세요!
# 종료조건: target_number를 찾은 경우
if current_index == len(array):
if current_sum == target:
global result_count
... | 40.095238 | 98 | 0.644893 | numbers = [1, 1, 1, 1, 1]
target_number = 3
result_count = 0
def get_count_of_ways_to_target_by_doing_plus_or_minus(array, target, current_index, current_sum):
if current_index == len(array):
if current_sum == target:
global result_count
result_count += 1
return
... | true | true |
1c233c0a1086c66a55f244dcf9faf92d78d048d1 | 3,314 | py | Python | api_env/app/app/settings.py | AnuragTimilsina/recipe-app-api | 77ed8c0aa490727dd4c54fcfb698426510c8a48d | [
"MIT"
] | null | null | null | api_env/app/app/settings.py | AnuragTimilsina/recipe-app-api | 77ed8c0aa490727dd4c54fcfb698426510c8a48d | [
"MIT"
] | null | null | null | api_env/app/app/settings.py | AnuragTimilsina/recipe-app-api | 77ed8c0aa490727dd4c54fcfb698426510c8a48d | [
"MIT"
] | null | null | null | """
Django settings for app project.
Generated by 'django-admin startproject' using Django 3.0.6.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import os
# Bui... | 25.106061 | 91 | 0.691008 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = '6*go781-^12h+!9h$7w%ck*sp)$^)(+biqj_&47!djw3@d+pa4'
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.content... | true | true |
1c233cad1d57d7d570d17a7e8b8df53170c473d9 | 15,378 | py | Python | Meta Learning/adaptive_lr/sigma_16_20way_1shot/maml.py | srikarym/FiLM-for-Meta-Learning | 1da58c09b685435f1dd17baa26b6f1f993de4689 | [
"MIT"
] | 4 | 2019-10-25T13:21:01.000Z | 2020-07-19T03:18:30.000Z | Meta Learning/adaptive_lr/sigma_8_5way_1shot/maml.py | KonkimallaChandraPrakash/FiLM-for-Meta-Learning-and-Reinforcement-Learning | 1da58c09b685435f1dd17baa26b6f1f993de4689 | [
"MIT"
] | null | null | null | Meta Learning/adaptive_lr/sigma_8_5way_1shot/maml.py | KonkimallaChandraPrakash/FiLM-for-Meta-Learning-and-Reinforcement-Learning | 1da58c09b685435f1dd17baa26b6f1f993de4689 | [
"MIT"
] | null | null | null | """ Code for the MAML algorithm and network definitions. """
from __future__ import print_function
import numpy as np
import sys
import tensorflow as tf
try:
import special_grads
except KeyError as e:
print('WARN: Cannot define MaxPoolGrad, likely already defined for this version of tensorflow: %s' % e,
... | 53.769231 | 183 | 0.620562 | from __future__ import print_function
import numpy as np
import sys
import tensorflow as tf
try:
import special_grads
except KeyError as e:
print('WARN: Cannot define MaxPoolGrad, likely already defined for this version of tensorflow: %s' % e,
file=sys.stderr)
from tensorflow.python.platform import f... | true | true |
1c233ce388d154c96c3f45e0f8c31b3b5eb569ad | 1,059 | py | Python | cs_131b/3_week/print_arguments.py | kimberleejohnson/python-study | 5dc08007a1bc18c91e32879a0e9d5cad1bd1cdd3 | [
"MIT"
] | null | null | null | cs_131b/3_week/print_arguments.py | kimberleejohnson/python-study | 5dc08007a1bc18c91e32879a0e9d5cad1bd1cdd3 | [
"MIT"
] | null | null | null | cs_131b/3_week/print_arguments.py | kimberleejohnson/python-study | 5dc08007a1bc18c91e32879a0e9d5cad1bd1cdd3 | [
"MIT"
] | null | null | null | """
This program prints out the unique command line arguments it receives, in alphabetical order and without duplicates.
"""
# Importing sys, library to get command line arguments
import sys
# Empty dict, to hold future values
# I'm choosing a dictionary because I want duplicates to be automatically taken care of ... | 37.821429 | 127 | 0.74882 |
import sys
dictionary = {}
# Variable to hold string of arguments passed to command line
arguments = sys.argv
# Loop through arguments passed
# Add each to the empty dictionary as a key
# Add n as the place of the argument as the value
for arg in arguments:
n = 1
dictionary[arg] = n
n = n + 1
... | true | true |
1c233d28793b27b254df5222edec5ae24736e085 | 10,439 | py | Python | api/authentication/models.py | sp-team-lutsk/docker_polls_group | e59aa4d9b0b703e31046460a87a8b14d9e3f3d1e | [
"MIT"
] | null | null | null | api/authentication/models.py | sp-team-lutsk/docker_polls_group | e59aa4d9b0b703e31046460a87a8b14d9e3f3d1e | [
"MIT"
] | 18 | 2019-06-25T14:37:52.000Z | 2019-10-25T21:18:44.000Z | api/authentication/models.py | sp-team-lutsk/cyber_security_web_portal | e59aa4d9b0b703e31046460a87a8b14d9e3f3d1e | [
"MIT"
] | 2 | 2019-06-25T12:43:44.000Z | 2019-08-21T08:36:44.000Z | import datetime
from django.template.loader import render_to_string
from django.db import models
from django.utils import timezone
from django.core.signing import (TimestampSigner,
b64_encode,
b64_decode,
BadSignature,
force_bytes)
from django.core.mail import EmailMessage
from djang... | 37.415771 | 117 | 0.621899 | import datetime
from django.template.loader import render_to_string
from django.db import models
from django.utils import timezone
from django.core.signing import (TimestampSigner,
b64_encode,
b64_decode,
BadSignature,
force_bytes)
from django.core.mail import EmailMessage
from djang... | true | true |
1c233f0109f362da4c7ed952768d6f47fe7b9fe6 | 2,328 | py | Python | chec.py | JADcooler/sunscreen | 3ce3b43354419a5544247a723c6f83c12d5f5a1f | [
"MIT"
] | 2 | 2021-08-10T09:24:21.000Z | 2021-08-10T09:24:24.000Z | chec.py | JADcooler/sunscreen | 3ce3b43354419a5544247a723c6f83c12d5f5a1f | [
"MIT"
] | null | null | null | chec.py | JADcooler/sunscreen | 3ce3b43354419a5544247a723c6f83c12d5f5a1f | [
"MIT"
] | null | null | null | import pytesseract
from PIL import Image
from selenium.webdriver import Chrome
from selenium.webdriver.common.by import By
from selenium.webdriver.support.relative_locator import with_tag_name
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.action_chains import ActionChains
from tab... | 24 | 93 | 0.664519 | import pytesseract
from PIL import Image
from selenium.webdriver import Chrome
from selenium.webdriver.common.by import By
from selenium.webdriver.support.relative_locator import with_tag_name
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.action_chains import ActionChains
from tab... | true | true |
1c233f038143bbdcda4630dc31c02faa0428bd6c | 108,761 | py | Python | youtube_dl/extractor/generic.py | tombloon/yt-dl | 013877298de439365331887903417deeac9d7ab0 | [
"Unlicense"
] | 1 | 2017-09-15T02:40:25.000Z | 2017-09-15T02:40:25.000Z | youtube_dl/extractor/generic.py | tombloon/yt-dl | 013877298de439365331887903417deeac9d7ab0 | [
"Unlicense"
] | null | null | null | youtube_dl/extractor/generic.py | tombloon/yt-dl | 013877298de439365331887903417deeac9d7ab0 | [
"Unlicense"
] | null | null | null | # coding: utf-8
from __future__ import unicode_literals
import os
import re
import sys
from .common import InfoExtractor
from .youtube import YoutubeIE
from ..compat import (
compat_etree_fromstring,
compat_urllib_parse_unquote,
compat_urlparse,
compat_xml_parse_error,
)
from ..utils import (
det... | 40.780277 | 432 | 0.512564 |
from __future__ import unicode_literals
import os
import re
import sys
from .common import InfoExtractor
from .youtube import YoutubeIE
from ..compat import (
compat_etree_fromstring,
compat_urllib_parse_unquote,
compat_urlparse,
compat_xml_parse_error,
)
from ..utils import (
determine_ext,
... | true | true |
1c233f592fdc5ecf1b4a91a5372758757d07c960 | 10,283 | py | Python | test/functional/qtum-sendtocontract.py | GoStartupsLtd/hydra-core | 293c20204be9eb04e491420aa4c94b6c2adf6757 | [
"MIT"
] | 18 | 2021-02-11T16:36:38.000Z | 2021-12-15T11:33:14.000Z | test/functional/qtum-sendtocontract.py | GoStartupsLtd/hydra-core | 293c20204be9eb04e491420aa4c94b6c2adf6757 | [
"MIT"
] | 10 | 2021-01-17T05:57:32.000Z | 2022-03-03T12:49:32.000Z | test/functional/qtum-sendtocontract.py | GoStartupsLtd/hydra-core | 293c20204be9eb04e491420aa4c94b6c2adf6757 | [
"MIT"
] | 3 | 2021-08-23T05:29:30.000Z | 2022-03-25T20:18:00.000Z | #!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from tes... | 82.927419 | 1,341 | 0.832442 |
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.script import *
from test_framework.mininode import *
from test_framework.qtum import *
import sys
import time
class SendToContractTest(BitcoinTestFramework):
def set_test_params(self):
... | true | true |
1c233f8ee01c2755e5a19ccfb6b34129af356f66 | 51,378 | py | Python | src/SSHLibrary/abstractclient.py | jsdobkin/SSHLibrary | c2a8fa7b949a58407db2fc132ca109155d87e3a7 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | src/SSHLibrary/abstractclient.py | jsdobkin/SSHLibrary | c2a8fa7b949a58407db2fc132ca109155d87e3a7 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | src/SSHLibrary/abstractclient.py | jsdobkin/SSHLibrary | c2a8fa7b949a58407db2fc132ca109155d87e3a7 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | # Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# 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
... | 39.612953 | 131 | 0.62591 |
from fnmatch import fnmatchcase
import os
import re
import stat
import time
import glob
import posixpath
import ntpath
from .config import (Configuration, IntegerEntry, NewlineEntry, StringEntry,
TimeEntry)
from .logger import logger
from .utils import is_bytes, is_string, unicode
... | true | true |
1c233ffa669935e1149ae9dabed5c56d52cc16af | 6,408 | py | Python | freeflow/core/deployment/base.py | enorha/freeflow | 5b655ce616d408e566b0b900f96b24804dc49578 | [
"Apache-2.0"
] | 1 | 2021-11-19T08:48:00.000Z | 2021-11-19T08:48:00.000Z | freeflow/core/deployment/base.py | enorha/freeflow | 5b655ce616d408e566b0b900f96b24804dc49578 | [
"Apache-2.0"
] | 1 | 2022-01-06T23:11:02.000Z | 2022-01-06T23:11:02.000Z | freeflow/core/deployment/base.py | enorha/freeflow | 5b655ce616d408e566b0b900f96b24804dc49578 | [
"Apache-2.0"
] | 2 | 2021-11-19T08:51:35.000Z | 2021-12-24T14:39:00.000Z | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
try:
import configparser
except Exception:
import ConfigParser as configparser
import fnmatch
import glob
import json
import os
from six import string_types
from freeflow.core.log import Logged
from freeflow.core.security import decrypt
class BaseDeploy(Logged):
... | 27.037975 | 71 | 0.620943 |
try:
import configparser
except Exception:
import ConfigParser as configparser
import fnmatch
import glob
import json
import os
from six import string_types
from freeflow.core.log import Logged
from freeflow.core.security import decrypt
class BaseDeploy(Logged):
def __init__(self, configuration):
... | true | true |
1c234093ab75b2430d6acae931794694d00e3b73 | 4,162 | py | Python | utils/hook.py | Christophe1997/pyramid | d135c86329b6527d54535d95c0db8b5d2da6cc8c | [
"Apache-2.0"
] | null | null | null | utils/hook.py | Christophe1997/pyramid | d135c86329b6527d54535d95c0db8b5d2da6cc8c | [
"Apache-2.0"
] | null | null | null | utils/hook.py | Christophe1997/pyramid | d135c86329b6527d54535d95c0db8b5d2da6cc8c | [
"Apache-2.0"
] | null | null | null | """A debug module using logging.
@author: Christophe
@email: sdl.office.1997@gmail.com
"""
import traceback
import logging
from functools import wraps
class Tracker:
"""A logging context manager.
Usage:
with Tracker() as tracker:
tracker.info("it's a example")
then you got the output... | 35.271186 | 97 | 0.582172 | import traceback
import logging
from functools import wraps
class Tracker:
_fmt = "Message type: %(levelname)s\nLocation: %(pathname)s:%(lineno)d\n" \
"Module: %(module)s\nFunction: %(funcName)s\n" \
"Time: %(asctime)s\n\nMessage:\n\n%(mes... | true | true |
1c2340ea9280617a6e47662925cd6085f49fa784 | 4,655 | py | Python | src/lava/lib/dl/slayer/block/rf_iz.py | PeaBrane/lava-dl | b205b4e0466788c5232ff20497ac0fc433cbccca | [
"BSD-3-Clause"
] | null | null | null | src/lava/lib/dl/slayer/block/rf_iz.py | PeaBrane/lava-dl | b205b4e0466788c5232ff20497ac0fc433cbccca | [
"BSD-3-Clause"
] | null | null | null | src/lava/lib/dl/slayer/block/rf_iz.py | PeaBrane/lava-dl | b205b4e0466788c5232ff20497ac0fc433cbccca | [
"BSD-3-Clause"
] | null | null | null | # Copyright (C) 2021 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
"""Resonate and Fire - Izhikevich layer blocks."""
import torch
from . import base
from ..neuron import rf_iz
from ..synapse import complex as synapse
from ..axon import Delay
class AbstractRFIz(torch.nn.Module):
"""Abstract Resona... | 31.883562 | 77 | 0.691944 |
import torch
from . import base
from ..neuron import rf_iz
from ..synapse import complex as synapse
from ..axon import Delay
class AbstractRFIz(torch.nn.Module):
def __init__(self, *args, **kwargs):
super(AbstractRFIz, self).__init__(*args, **kwargs)
if self.neuron_params is not None:
... | true | true |
1c234135edf56b5d340b4c6b42dceb01233ea265 | 4,326 | py | Python | dec_mining/print_sen_embedding.py | ishine/qa_match | f1ede11a3e799edfb5e90d5b4396b304d2365778 | [
"Apache-2.0"
] | 320 | 2020-03-09T03:49:52.000Z | 2022-03-18T10:59:54.000Z | dec_mining/print_sen_embedding.py | ishine/qa_match | f1ede11a3e799edfb5e90d5b4396b304d2365778 | [
"Apache-2.0"
] | 13 | 2020-03-12T02:37:24.000Z | 2021-05-19T03:34:52.000Z | dec_mining/print_sen_embedding.py | ishine/qa_match | f1ede11a3e799edfb5e90d5b4396b304d2365778 | [
"Apache-2.0"
] | 81 | 2020-03-11T10:05:09.000Z | 2022-03-01T14:08:00.000Z | # -*- coding: utf-8 -*-
"""
print sentence embedding
"""
import os
import sys
import argparse
import codecs
import tensorflow as tf
import numpy as np
import data_utils
# get graph output in different way: max mean concat
def get_output(g, embedding_way):
if embedding_way == "concat": # here may have problem, thi... | 35.752066 | 95 | 0.596856 |
import os
import sys
import argparse
import codecs
import tensorflow as tf
import numpy as np
import data_utils
def get_output(g, embedding_way):
if embedding_way == "concat":
t = g.get_tensor_by_name("concat_4:0")
elif embedding_way == "max":
t = g.get_tensor_by_name("Max:0")
elif embe... | true | true |
1c2341bd5aa107b14cfd196ce50f972f65f400d9 | 614 | py | Python | rin/modules/hourcall/hourcall.py | oralvi/rinyuuki | 2b55a5a9f0ebbecbdba815e242450b248c8e727a | [
"MIT"
] | null | null | null | rin/modules/hourcall/hourcall.py | oralvi/rinyuuki | 2b55a5a9f0ebbecbdba815e242450b248c8e727a | [
"MIT"
] | null | null | null | rin/modules/hourcall/hourcall.py | oralvi/rinyuuki | 2b55a5a9f0ebbecbdba815e242450b248c8e727a | [
"MIT"
] | null | null | null | import pytz
from datetime import datetime
import rin
from rin import Service
sv = Service('hourcall', enable_on_default=False, help_='时报')
tz = pytz.timezone('Asia/Shanghai')
def get_hour_call():
"""挑出一组时报,每日更换,一日之内保持相同"""
cfg = rin.config.hourcall
now = datetime.now(tz)
hc_groups = cfg.HOUR_CALLS_ON
... | 24.56 | 61 | 0.666124 | import pytz
from datetime import datetime
import rin
from rin import Service
sv = Service('hourcall', enable_on_default=False, help_='时报')
tz = pytz.timezone('Asia/Shanghai')
def get_hour_call():
cfg = rin.config.hourcall
now = datetime.now(tz)
hc_groups = cfg.HOUR_CALLS_ON
g = hc_groups[ now.day % le... | true | true |
1c2342f0c47b43333d284bee0f96c14ff6d85f5e | 99,637 | py | Python | venv/Lib/site-packages/sklearn/metrics/_classification.py | arnoyu-hub/COMP0016miemie | 59af664dcf190eab4f93cefb8471908717415fea | [
"MIT"
] | null | null | null | venv/Lib/site-packages/sklearn/metrics/_classification.py | arnoyu-hub/COMP0016miemie | 59af664dcf190eab4f93cefb8471908717415fea | [
"MIT"
] | null | null | null | venv/Lib/site-packages/sklearn/metrics/_classification.py | arnoyu-hub/COMP0016miemie | 59af664dcf190eab4f93cefb8471908717415fea | [
"MIT"
] | null | null | null | """Metrics to assess performance on classification task given class prediction.
Functions named as ``*_score`` return a scalar value to maximize: the higher
the better.
Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize:
the lower the better.
"""
# Authors: Alexandre Gramfort <ale... | 37.570513 | 103 | 0.604946 |
import warnings
import numpy as np
from scipy.sparse import coo_matrix
from scipy.sparse import csr_matrix
from ..preprocessing import LabelBinarizer
from ..preprocessing import LabelEncoder
from ..utils import assert_all_finite
from ..utils import check_array
from ..utils import check_c... | true | true |
1c23430b4ebd77f95bf11d7aef51841c10c945e2 | 220 | py | Python | display/display/handlers/forms/general.py | owlsn/h_crawl | c0431ee6484e61d9339553c3350962ea517749d6 | [
"MIT"
] | null | null | null | display/display/handlers/forms/general.py | owlsn/h_crawl | c0431ee6484e61d9339553c3350962ea517749d6 | [
"MIT"
] | 8 | 2021-03-18T20:33:29.000Z | 2022-03-11T23:21:04.000Z | display/display/handlers/forms/general.py | owlsn/h_crawl | c0431ee6484e61d9339553c3350962ea517749d6 | [
"MIT"
] | null | null | null | from display.handlers.base import BaseHandler
class FormsGeneralHandler(BaseHandler):
def get(self):
title = 'FormsGeneralHandler'
self.render('forms/general.html', title = title, **self.render_dict) | 36.666667 | 76 | 0.727273 | from display.handlers.base import BaseHandler
class FormsGeneralHandler(BaseHandler):
def get(self):
title = 'FormsGeneralHandler'
self.render('forms/general.html', title = title, **self.render_dict) | true | true |
1c234393da8336f25c3dc88dfeada669d2125eab | 1,113 | py | Python | python/codingbat/src/array123.py | christopher-burke/warmups | 140c96ada87ec5e9faa4622504ddee18840dce4a | [
"MIT"
] | null | null | null | python/codingbat/src/array123.py | christopher-burke/warmups | 140c96ada87ec5e9faa4622504ddee18840dce4a | [
"MIT"
] | 2 | 2022-03-10T03:49:14.000Z | 2022-03-14T00:49:54.000Z | python/codingbat/src/array123.py | christopher-burke/warmups | 140c96ada87ec5e9faa4622504ddee18840dce4a | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
"""Array 1 2 3.
Given an array of ints, return True if the sequence of numbers 1, 2, 3 appears in the array somewhere.
array123([1, 1, 2, 3, 1]) → True
array123([1, 1, 2, 4, 1]) → False
array123([1, 1, 2, 1, 2, 3]) → True
source: https://codingbat.com/prob/p193604
"""
from functools impo... | 22.714286 | 102 | 0.601977 |
from functools import partial
def array_find(nums: list, target=None) -> bool:
for i in range(len(nums)):
if target == nums[i:i+3]:
return True
return False
array123 = partial(array_find, target=[1, 2, 3])
def main():
assert array123([1, 1, 2, 3, 1]) is True
assert array123(... | true | true |
1c2344ce6b666ef236b49177ecf6518557b2d42e | 9,727 | py | Python | tests/test_api_render.py | ax3l/conda-build | 7bd26e032757f1fa90f8db5822f5378a133a0ae4 | [
"BSD-3-Clause"
] | 1 | 2019-01-15T10:51:38.000Z | 2019-01-15T10:51:38.000Z | tests/test_api_render.py | ax3l/conda-build | 7bd26e032757f1fa90f8db5822f5378a133a0ae4 | [
"BSD-3-Clause"
] | null | null | null | tests/test_api_render.py | ax3l/conda-build | 7bd26e032757f1fa90f8db5822f5378a133a0ae4 | [
"BSD-3-Clause"
] | null | null | null | """
This module tests the test API. These are high-level integration tests. Lower level unit tests
should go in test_render.py
"""
import os
import re
import mock
import pytest
import yaml
from conda_build import api, render
from conda_build.conda_interface import subdir, reset_context, cc_conda_build
from .utils... | 44.013575 | 119 | 0.692711 |
import os
import re
import mock
import pytest
import yaml
from conda_build import api, render
from conda_build.conda_interface import subdir, reset_context, cc_conda_build
from .utils import metadata_dir, thisdir
def test_render_need_download(testing_workdir, testing_config):
with pytest.raises((Va... | true | true |
1c2344e16e7cc1ef1e01dfaae53b3f28dc164ddd | 2,776 | py | Python | openprocurement/auction/tests/test_chronograph.py | OrysiaDrabych/openprocurement.auction | d68b4aca7313dd4c7c13bd22c772a32a1b70d79f | [
"Apache-2.0"
] | 23 | 2015-07-09T17:07:39.000Z | 2020-11-14T11:23:39.000Z | openprocurement/auction/tests/test_chronograph.py | OrysiaDrabych/openprocurement.auction | d68b4aca7313dd4c7c13bd22c772a32a1b70d79f | [
"Apache-2.0"
] | 23 | 2015-01-14T22:33:58.000Z | 2018-02-08T16:31:20.000Z | openprocurement/auction/tests/test_chronograph.py | OrysiaDrabych/openprocurement.auction | d68b4aca7313dd4c7c13bd22c772a32a1b70d79f | [
"Apache-2.0"
] | 27 | 2015-02-17T10:22:32.000Z | 2021-06-08T06:50:45.000Z | import pytest
from openprocurement.auction.helpers.chronograph \
import MAX_AUCTION_START_TIME_RESERV
import datetime
from openprocurement.auction.tests.utils import job_is_added, \
job_is_not_added, job_is_active, job_is_not_active
from time import sleep as blocking_sleep
class TestChronograph(object):
d... | 34.7 | 78 | 0.654539 | import pytest
from openprocurement.auction.helpers.chronograph \
import MAX_AUCTION_START_TIME_RESERV
import datetime
from openprocurement.auction.tests.utils import job_is_added, \
job_is_not_added, job_is_active, job_is_not_active
from time import sleep as blocking_sleep
class TestChronograph(object):
d... | true | true |
1c234616e5c2ac9939540433b3e666e4a2edf39d | 1,162 | py | Python | aliyun-python-sdk-linkwan/aliyunsdklinkwan/request/v20181230/DeleteLabNodeRequest.py | liumihust/aliyun-openapi-python-sdk | c7b5dd4befae4b9c59181654289f9272531207ef | [
"Apache-2.0"
] | 1 | 2021-03-08T02:59:17.000Z | 2021-03-08T02:59:17.000Z | aliyun-python-sdk-linkwan/aliyunsdklinkwan/request/v20181230/DeleteLabNodeRequest.py | liumihust/aliyun-openapi-python-sdk | c7b5dd4befae4b9c59181654289f9272531207ef | [
"Apache-2.0"
] | 1 | 2020-05-31T14:51:47.000Z | 2020-05-31T14:51:47.000Z | aliyun-python-sdk-linkwan/aliyunsdklinkwan/request/v20181230/DeleteLabNodeRequest.py | liumihust/aliyun-openapi-python-sdk | c7b5dd4befae4b9c59181654289f9272531207ef | [
"Apache-2.0"
] | null | null | null | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 37.483871 | 80 | 0.761618 |
from aliyunsdkcore.request import RpcRequest
class DeleteLabNodeRequest(RpcRequest):
def __init__(self):
RpcRequest.__init__(self, 'LinkWAN', '2018-12-30', 'DeleteLabNode','linkwan')
self.set_protocol_type('https');
def get_DevEui(self):
return self.get_body_params().get('DevEui')
d... | true | true |
1c234661efc0d21ada40a1d6bca78ee6c51f8529 | 1,733 | py | Python | src/Piece.py | FR13ndSDP/command-line-chess | 3a9e2739030064d2397e954240da1c5d7b47dc0a | [
"MIT"
] | null | null | null | src/Piece.py | FR13ndSDP/command-line-chess | 3a9e2739030064d2397e954240da1c5d7b47dc0a | [
"MIT"
] | null | null | null | src/Piece.py | FR13ndSDP/command-line-chess | 3a9e2739030064d2397e954240da1c5d7b47dc0a | [
"MIT"
] | null | null | null | from Coordinate import Coordinate as C
from Move import Move
WHITE = True
BLACK = False
X = 0
Y = 1
class Piece:
def __init__(self, board, side, position, movesMade=0):
self.board = board
self.side = side
self.position = position
self.movesMade = 0
def __str__(self):
... | 28.409836 | 78 | 0.515291 | from Coordinate import Coordinate as C
from Move import Move
WHITE = True
BLACK = False
X = 0
Y = 1
class Piece:
def __init__(self, board, side, position, movesMade=0):
self.board = board
self.side = side
self.position = position
self.movesMade = 0
def __str__(self):
... | true | true |
1c23482de263426417c86fb081b86f2b715b396e | 104 | py | Python | doctor/__version__.py | jhauberg/gitdoctor | 63074c885f246527dc1697d76e8ecf42616c187c | [
"MIT"
] | 1 | 2021-07-26T22:04:23.000Z | 2021-07-26T22:04:23.000Z | doctor/__version__.py | jhauberg/gitdoctor | 63074c885f246527dc1697d76e8ecf42616c187c | [
"MIT"
] | 5 | 2019-02-06T13:33:16.000Z | 2019-02-28T08:05:50.000Z | doctor/__version__.py | jhauberg/gitdoctor | 63074c885f246527dc1697d76e8ecf42616c187c | [
"MIT"
] | null | null | null | # coding=utf-8
"""
This script holds the version identifier for git-doctor.
"""
__version__ = '0.4.0'
| 13 | 56 | 0.682692 |
__version__ = '0.4.0'
| true | true |
1c23484865f3888cbb7ecd7a41bc1afc26f03d45 | 7,501 | py | Python | fusion/architecture/dcgan/dcgan_decoder.py | Mrinal18/fusion | 34e563f2e50139385577c3880c5de11f8a73f220 | [
"BSD-3-Clause"
] | 14 | 2021-04-05T01:25:12.000Z | 2022-02-17T19:44:28.000Z | fusion/architecture/dcgan/dcgan_decoder.py | Mrinal18/fusion | 34e563f2e50139385577c3880c5de11f8a73f220 | [
"BSD-3-Clause"
] | 1 | 2021-07-05T08:32:49.000Z | 2021-07-05T12:34:57.000Z | fusion/architecture/dcgan/dcgan_decoder.py | Mrinal18/fusion | 34e563f2e50139385577c3880c5de11f8a73f220 | [
"BSD-3-Clause"
] | 1 | 2022-02-01T21:56:11.000Z | 2022-02-01T21:56:11.000Z | from typing import Dict, Tuple, Type
from torch import Tensor
import torch.nn as nn
from fusion.architecture import ABaseArchitecture
from fusion.architecture.base_block import BaseConvLayer, Unflatten
class DcganDecoder(ABaseArchitecture):
def __init__(
self,
dim_in: int,
dim_h: int,
... | 41.905028 | 154 | 0.547927 | from typing import Dict, Tuple, Type
from torch import Tensor
import torch.nn as nn
from fusion.architecture import ABaseArchitecture
from fusion.architecture.base_block import BaseConvLayer, Unflatten
class DcganDecoder(ABaseArchitecture):
def __init__(
self,
dim_in: int,
dim_h: int,
... | true | true |
1c2349e20f1d31c8b7111c38d4b1026f9df73bc9 | 4,624 | py | Python | salt/modules/data.py | Rafflecopter/salt | 08bbfcd4d9b93351d7d5d25b097e892026b6f1cd | [
"Apache-2.0"
] | null | null | null | salt/modules/data.py | Rafflecopter/salt | 08bbfcd4d9b93351d7d5d25b097e892026b6f1cd | [
"Apache-2.0"
] | null | null | null | salt/modules/data.py | Rafflecopter/salt | 08bbfcd4d9b93351d7d5d25b097e892026b6f1cd | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
'''
Manage a local persistent data structure that can hold any arbitrary data
specific to the minion
'''
from __future__ import absolute_import
# Import python libs
import os
import ast
import logging
# Import salt libs
import salt.utils
import salt.payload
# Import 3rd-party lib
import salt.... | 17.716475 | 73 | 0.581964 |
from __future__ import absolute_import
import os
import ast
import logging
import salt.utils
import salt.payload
import salt.ext.six as six
log = logging.getLogger(__name__)
def clear():
try:
os.remove(os.path.join(__opts__['cachedir'], 'datastore'))
except (IOError, OSError):
pass
... | true | true |
1c234ace308a800ca378ea55b28e27ff233a78e0 | 1,275 | py | Python | cogs/utils/config.py | CodersClashS01/WhatZitTooya | 879182861be3931d440a5027053b7c17bb9bcc9c | [
"MIT"
] | 2 | 2018-07-22T15:46:31.000Z | 2020-09-03T22:06:53.000Z | cogs/utils/config.py | CodersClashS01/WhatZitTooya | 879182861be3931d440a5027053b7c17bb9bcc9c | [
"MIT"
] | null | null | null | cogs/utils/config.py | CodersClashS01/WhatZitTooya | 879182861be3931d440a5027053b7c17bb9bcc9c | [
"MIT"
] | null | null | null | import asyncio
import json
from os.path import dirname, realpath, join
def check_config():
join(dirname(realpath(dirname(__file__))), 'config.json')
with open('config.json', 'r') as f:
try:
settings = json.load(f)
except:
settings = {}
key_dict = {
'token'... | 39.84375 | 120 | 0.614902 | import asyncio
import json
from os.path import dirname, realpath, join
def check_config():
join(dirname(realpath(dirname(__file__))), 'config.json')
with open('config.json', 'r') as f:
try:
settings = json.load(f)
except:
settings = {}
key_dict = {
'token'... | true | true |
1c234bc623f62977497155c79e5025c90d716315 | 33,164 | py | Python | spawningtool/lotv_constants.py | amittleider/spawningtool | 4032318ddf9583d0bb8ad6117b3a47eaf17d1998 | [
"MIT"
] | null | null | null | spawningtool/lotv_constants.py | amittleider/spawningtool | 4032318ddf9583d0bb8ad6117b3a47eaf17d1998 | [
"MIT"
] | null | null | null | spawningtool/lotv_constants.py | amittleider/spawningtool | 4032318ddf9583d0bb8ad6117b3a47eaf17d1998 | [
"MIT"
] | null | null | null | """
spawningtool.constants
~~~~~~~~~~~~~~~~~~~~~~
"""
FRAMES_PER_SECOND = 22.4
BO_EXCLUDED = set([
'MULE',
'ReaperPlaceholder',
'Interceptor'
'AutoTurret',
'PointDefenseDrone',
'Locust',
'LocustMP',
'LocustMPFlyer', # LotV Alpha Mod
'Changeling',
'ChangelingMarine',
'Chang... | 28.964192 | 120 | 0.546707 |
FRAMES_PER_SECOND = 22.4
BO_EXCLUDED = set([
'MULE',
'ReaperPlaceholder',
'Interceptor'
'AutoTurret',
'PointDefenseDrone',
'Locust',
'LocustMP',
'LocustMPFlyer',
'Changeling',
'ChangelingMarine',
'ChangelingMarineShield',
'ChangelingZealot',
'ChangelingZergling',
... | true | true |
1c234ce8283c844cd60cb5760e7b8e156d4ade05 | 310 | py | Python | tests/helpers/examples/order/tasks.py | nicoddemus/dependencies | 74180e2c6098d8ad03bc53c5703bdf8dc61c3ed9 | [
"BSD-2-Clause"
] | null | null | null | tests/helpers/examples/order/tasks.py | nicoddemus/dependencies | 74180e2c6098d8ad03bc53c5703bdf8dc61c3ed9 | [
"BSD-2-Clause"
] | null | null | null | tests/helpers/examples/order/tasks.py | nicoddemus/dependencies | 74180e2c6098d8ad03bc53c5703bdf8dc61c3ed9 | [
"BSD-2-Clause"
] | null | null | null | from dependencies import Injector
from dependencies import this
from dependencies.contrib.celery import shared_task
from examples.order.commands import ProcessOrder
@shared_task
class ProcessOrderTask(Injector):
name = "process_order"
run = ProcessOrder
bind = True
retry = this.task.retry
| 20.666667 | 51 | 0.783871 | from dependencies import Injector
from dependencies import this
from dependencies.contrib.celery import shared_task
from examples.order.commands import ProcessOrder
@shared_task
class ProcessOrderTask(Injector):
name = "process_order"
run = ProcessOrder
bind = True
retry = this.task.retry
| true | true |
1c234cf6c8dd1366702fbd7c30133dd8b432e618 | 5,251 | py | Python | code/filesystem.py | tnbinh/efs | 02a86acab33705b0dac4dd7c5b4b787e1d8b3be6 | [
"MIT"
] | 1 | 2020-11-29T15:15:13.000Z | 2020-11-29T15:15:13.000Z | code/filesystem.py | tnbinh/efs | 02a86acab33705b0dac4dd7c5b4b787e1d8b3be6 | [
"MIT"
] | 4 | 2017-10-16T09:07:01.000Z | 2020-09-28T05:23:10.000Z | src/efs/filesystem.py | eatfirst/python-efs | b8836a375051042948ca21cbe6e8e70aae7f7c70 | [
"MIT"
] | 1 | 2020-09-21T00:17:07.000Z | 2020-09-21T00:17:07.000Z | """The file system abstraction."""
import urllib.parse
from io import BytesIO
from flask import current_app
from .eatfirst_osfs import EatFirstOSFS
from .eatfirst_s3 import EatFirstS3
class EFS:
"""The EatFirst File system."""
def __init__(self, *args, storage="local", **kwargs):
"""The constructor... | 39.481203 | 113 | 0.625405 | import urllib.parse
from io import BytesIO
from flask import current_app
from .eatfirst_osfs import EatFirstOSFS
from .eatfirst_s3 import EatFirstS3
class EFS:
def __init__(self, *args, storage="local", **kwargs):
self.separator = kwargs.get("separator", "/")
self.current_file = ""
if s... | true | true |
1c234d2c18eeacfe2b838d0b2ee89cb75aedc080 | 799 | py | Python | api/migrations/0001_initial.py | olaTechie/E-Health-Care | 05e0febe0d53c28f7adf843a3428fb987693b70a | [
"MIT"
] | null | null | null | api/migrations/0001_initial.py | olaTechie/E-Health-Care | 05e0febe0d53c28f7adf843a3428fb987693b70a | [
"MIT"
] | null | null | null | api/migrations/0001_initial.py | olaTechie/E-Health-Care | 05e0febe0d53c28f7adf843a3428fb987693b70a | [
"MIT"
] | null | null | null | # Generated by Django 2.1.5 on 2021-04-03 04:09
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Disease',
fields=[
('id', models.AutoField(... | 29.592593 | 114 | 0.565707 |
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Disease',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=... | true | true |
1c234e31a08f37936e16919ee40f7bb28de4d0db | 2,788 | py | Python | python/Pipeline/.ipynb_checkpoints/CLAMS_Plot_Embed-checkpoint.py | cardin-higley-lab/CBASS | 0d0b58497313027388351feffc79766f815b47b5 | [
"Apache-2.0"
] | null | null | null | python/Pipeline/.ipynb_checkpoints/CLAMS_Plot_Embed-checkpoint.py | cardin-higley-lab/CBASS | 0d0b58497313027388351feffc79766f815b47b5 | [
"Apache-2.0"
] | null | null | null | python/Pipeline/.ipynb_checkpoints/CLAMS_Plot_Embed-checkpoint.py | cardin-higley-lab/CBASS | 0d0b58497313027388351feffc79766f815b47b5 | [
"Apache-2.0"
] | null | null | null | import numpy as np
import phate
import scprep
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import umap
from sklearn.decomposition import PCA
from scipy import stats
import os
def PlotEmbed(sTROUGH, in1EmbedLabel, blLegend, blColorbar, chLegend, chLabel, chTitle, chMethod, blZScore, inN_Component, dbAlph... | 39.267606 | 151 | 0.631994 | import numpy as np
import phate
import scprep
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import umap
from sklearn.decomposition import PCA
from scipy import stats
import os
def PlotEmbed(sTROUGH, in1EmbedLabel, blLegend, blColorbar, chLegend, chLabel, chTitle, chMethod, blZScore, inN_Component, dbAlph... | true | true |
1c234ec03812d7db75e5ded841115307dc849e28 | 28,875 | py | Python | packages/syft/src/syft/core/tensor/autodp/single_entity_phi.py | eelcovdw/PySyft | 7eff8e9ad3fffe792ac85b9f38391b7ec0e51391 | [
"Apache-1.1"
] | 1 | 2019-02-10T13:22:14.000Z | 2019-02-10T13:22:14.000Z | packages/syft/src/syft/core/tensor/autodp/single_entity_phi.py | dylan-fan/PySyft | c10b0e70a4a7f06eb9e01e6b98f0ff8856d7d62c | [
"Apache-1.1"
] | null | null | null | packages/syft/src/syft/core/tensor/autodp/single_entity_phi.py | dylan-fan/PySyft | c10b0e70a4a7f06eb9e01e6b98f0ff8856d7d62c | [
"Apache-1.1"
] | 1 | 2021-07-12T09:15:44.000Z | 2021-07-12T09:15:44.000Z | # future
from __future__ import annotations
# stdlib
from typing import Any
from typing import List
from typing import Optional
from typing import Tuple as TypeTuple
from typing import Union
# third party
from google.protobuf.reflection import GeneratedProtocolMessageType
from nacl.signing import VerifyKey
import num... | 34.293349 | 113 | 0.612537 |
from __future__ import annotations
from typing import Any
from typing import List
from typing import Optional
from typing import Tuple as TypeTuple
from typing import Union
from google.protobuf.reflection import GeneratedProtocolMessageType
from nacl.signing import VerifyKey
import numpy as np
import numpy.typing ... | true | true |
1c2350652273242d8890d8dd04ac89213e124285 | 11,078 | py | Python | intersight/model/niaapi_field_notice_all_of.py | CiscoDevNet/intersight-python | 04b721f37c3044646a91c185c7259edfb991557a | [
"Apache-2.0"
] | 5 | 2021-12-16T15:13:32.000Z | 2022-03-29T16:09:54.000Z | intersight/model/niaapi_field_notice_all_of.py | CiscoDevNet/intersight-python | 04b721f37c3044646a91c185c7259edfb991557a | [
"Apache-2.0"
] | 4 | 2022-01-25T19:05:51.000Z | 2022-03-29T20:18:37.000Z | intersight/model/niaapi_field_notice_all_of.py | CiscoDevNet/intersight-python | 04b721f37c3044646a91c185c7259edfb991557a | [
"Apache-2.0"
] | 2 | 2020-07-07T15:01:08.000Z | 2022-01-31T04:27:35.000Z | """
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advan... | 51.525581 | 1,678 | 0.631251 |
import re
import sys
from intersight.model_utils import (
ApiTypeError,
ModelComposed,
ModelNormal,
ModelSimple,
cached_property,
change_keys_js_to_python,
convert_js_args_to_python_args,
date,
datetime,
file_type,
none_type,
validate_get_composed_info,
)
def la... | true | true |
1c2350ac40cdb0d66d0ff59f853b0906a8e8f894 | 6,535 | py | Python | home/views.py | italoseara/Django-Movie | 57721da4a972f059c5bf67bff8183724e62307b6 | [
"MIT"
] | 1 | 2022-03-03T15:49:37.000Z | 2022-03-03T15:49:37.000Z | home/views.py | italoseara/Django-Movie | 57721da4a972f059c5bf67bff8183724e62307b6 | [
"MIT"
] | null | null | null | home/views.py | italoseara/Django-Movie | 57721da4a972f059c5bf67bff8183724e62307b6 | [
"MIT"
] | null | null | null | import os
import re
import json
from mimetypes import guess_type
from wsgiref.util import FileWrapper
from django.http.response import HttpResponse, StreamingHttpResponse
from django.views.generic import DetailView, ListView
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import ... | 30.537383 | 145 | 0.599541 | import os
import re
import json
from mimetypes import guess_type
from wsgiref.util import FileWrapper
from django.http.response import HttpResponse, StreamingHttpResponse
from django.views.generic import DetailView, ListView
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import ... | true | true |
1c235161b3c166d4a2eb09691e0dbe215baa098b | 5,407 | py | Python | bot/core.py | mprimi/skill-bot | d0d0278944ee777b05b1970011952cc612d92cc4 | [
"MIT"
] | 8 | 2021-04-16T12:42:07.000Z | 2021-12-16T16:53:34.000Z | bot/core.py | mprimi/skill-bot | d0d0278944ee777b05b1970011952cc612d92cc4 | [
"MIT"
] | 2 | 2021-05-19T14:05:20.000Z | 2021-12-17T01:21:02.000Z | bot/core.py | mprimi/skill-bot | d0d0278944ee777b05b1970011952cc612d92cc4 | [
"MIT"
] | 2 | 2021-04-14T20:04:59.000Z | 2021-11-21T18:47:24.000Z | from collections.abc import Iterable
import re
import traceback
import discord
from constants import Strings as k
from . import messages
class Controller(discord.Client):
"""Top level controller for Skill Bot"""
def __init__(self, guild_id: int, channel_id: int, repository, commands):
super().__init__... | 38.347518 | 103 | 0.634733 | from collections.abc import Iterable
import re
import traceback
import discord
from constants import Strings as k
from . import messages
class Controller(discord.Client):
def __init__(self, guild_id: int, channel_id: int, repository, commands):
super().__init__()
self.channel_id = channel_id
... | true | true |
1c23529aff8cb7a059465b47014783e1a50545bd | 789 | py | Python | ident/app/cdr_redis.py | AlexShander/Grafana_Asterisk | 1f8b20e2d3e6960c13d223baf9ce134fca402b1f | [
"Apache-2.0"
] | null | null | null | ident/app/cdr_redis.py | AlexShander/Grafana_Asterisk | 1f8b20e2d3e6960c13d223baf9ce134fca402b1f | [
"Apache-2.0"
] | null | null | null | ident/app/cdr_redis.py | AlexShander/Grafana_Asterisk | 1f8b20e2d3e6960c13d223baf9ce134fca402b1f | [
"Apache-2.0"
] | 1 | 2021-04-22T05:47:13.000Z | 2021-04-22T05:47:13.000Z | import redis
import ast
class GetChannelsFromRedis():
def __init__(self, host='127.0.0.1', port=6379, db=0):
self._redis = redis.Redis(host=host, port=port, db=db)
def _eval_to_dict(self, any_string: str):
try:
ev = ast.literal_eval(any_string)
return ev
except... | 27.206897 | 62 | 0.589354 | import redis
import ast
class GetChannelsFromRedis():
def __init__(self, host='127.0.0.1', port=6379, db=0):
self._redis = redis.Redis(host=host, port=port, db=db)
def _eval_to_dict(self, any_string: str):
try:
ev = ast.literal_eval(any_string)
return ev
except... | true | true |
1c2352e06b01aa2732906fe7e3488996eebefc2a | 17,159 | py | Python | api/batch_processing/data_preparation/manage_local_batch.py | cshclm/CameraTraps | 2fbb09f983c46297300a38acdd8c5629ad3e493e | [
"MIT"
] | null | null | null | api/batch_processing/data_preparation/manage_local_batch.py | cshclm/CameraTraps | 2fbb09f983c46297300a38acdd8c5629ad3e493e | [
"MIT"
] | null | null | null | api/batch_processing/data_preparation/manage_local_batch.py | cshclm/CameraTraps | 2fbb09f983c46297300a38acdd8c5629ad3e493e | [
"MIT"
] | null | null | null | """
manage_local_batch.py
Semi-automated process for managing a local MegaDetector job, including
standard postprocessing steps.
"""
#%% Imports and constants
import sys
import json
import os
import subprocess
from datetime import date
import humanfriendly
import ai4e_azure_utils # from ai4... | 31.71719 | 155 | 0.724401 |
import sys
import json
import os
import subprocess
from datetime import date
import humanfriendly
import ai4e_azure_utils
import path_utils
from api.batch_processing.postprocessing.postprocess_batch_results import (
PostProcessingOptions, process_batch_results)
max_task_name_length = 92
max_tole... | true | true |
1c23542f2dbc4541793d5b768804deed6bc2f71d | 5,168 | py | Python | main.py | deibraz-free/dsp_effects | 1ca1f1f400ea276755ede54d0b2d2a5d12cf61b7 | [
"MIT"
] | null | null | null | main.py | deibraz-free/dsp_effects | 1ca1f1f400ea276755ede54d0b2d2a5d12cf61b7 | [
"MIT"
] | null | null | null | main.py | deibraz-free/dsp_effects | 1ca1f1f400ea276755ede54d0b2d2a5d12cf61b7 | [
"MIT"
] | null | null | null | '''
Created by Deividas Brazauskas 2020
# Read in WAV file into Python Class
sound1 = AudioProcessing('input.wav')
# Set the speed of the audio
sound1.set_audio_speed(0.5)
# Set the pitch of the audio
sound1.set_audio_pitch(2)
# Reverse the content of the audio
sound1.set_reverse()
# Add an echo to the a... | 32.3 | 96 | 0.719234 |
import sys, wave
import numpy as np
from numpy import array, int16
from scipy.signal import lfilter, butter
from scipy.io.wavfile import read,write
from scipy import signal
import random
class AudioProcessing(object):
__slots__ = ('audio_data', 'sample_freq')
def __init__(self, input_audio_path):
self.sample_freq... | true | true |
1c23543cf0090d5cf7f9b469493f14bc1cced8f6 | 5,477 | py | Python | core/storage/feedback/gae_models_test.py | rajibmitra/oppia | a2b24a0b6a63cad4b225d6c99413ae62be10bb02 | [
"Apache-2.0"
] | 1 | 2019-01-31T18:48:50.000Z | 2019-01-31T18:48:50.000Z | core/storage/feedback/gae_models_test.py | debck/oppia | 7126b42bf105724cb82dd2d4df377e7a35c3ca18 | [
"Apache-2.0"
] | null | null | null | core/storage/feedback/gae_models_test.py | debck/oppia | 7126b42bf105724cb82dd2d4df377e7a35c3ca18 | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
#
# Copyright 2014 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 39.402878 | 80 | 0.711156 |
from core.platform import models
from core.tests import test_utils
import feconf
(feedback_models,) = models.Registry.import_models([models.NAMES.feedback])
CREATED_ON_FIELD = 'created_on'
LAST_UPDATED_FIELD = 'last_updated'
DELETED_FIELD = 'deleted'
FIELDS_NOT_REQUIRED = [CREATED_ON_FIELD, LAST_UPDA... | true | true |
1c2355941c8f0ee0e39b96466307ae2a1e4a0894 | 629 | py | Python | lms/validation/_assignment.py | mattdricker/lms | 40b8a04f95e69258c6c0d7ada543f4b527918ecf | [
"BSD-2-Clause"
] | null | null | null | lms/validation/_assignment.py | mattdricker/lms | 40b8a04f95e69258c6c0d7ada543f4b527918ecf | [
"BSD-2-Clause"
] | null | null | null | lms/validation/_assignment.py | mattdricker/lms | 40b8a04f95e69258c6c0d7ada543f4b527918ecf | [
"BSD-2-Clause"
] | null | null | null | """Validation for the configure_assignment() view."""
from webargs import fields
from lms.validation._base import PyramidRequestSchema
class ConfigureAssignmentSchema(PyramidRequestSchema):
"""Schema for validating requests to the configure_assignment() view."""
location = "form"
document_url = fields... | 31.45 | 76 | 0.761526 |
from webargs import fields
from lms.validation._base import PyramidRequestSchema
class ConfigureAssignmentSchema(PyramidRequestSchema):
location = "form"
document_url = fields.Str(required=True)
resource_link_id = fields.Str(required=True)
tool_consumer_instance_guid = fields.Str(required=True)
... | true | true |
1c235741f625d22d47839a722528b41228823d0a | 1,213 | py | Python | components/collector/tests/source_collectors/jira/test_issues.py | kargaranamir/quality-time | 1c427c61bee9d31c3526f0a01be2218a7e167c23 | [
"Apache-2.0"
] | 33 | 2016-01-20T07:35:48.000Z | 2022-03-14T09:20:51.000Z | components/collector/tests/source_collectors/jira/test_issues.py | kargaranamir/quality-time | 1c427c61bee9d31c3526f0a01be2218a7e167c23 | [
"Apache-2.0"
] | 2,410 | 2016-01-22T18:13:01.000Z | 2022-03-31T16:57:34.000Z | components/collector/tests/source_collectors/jira/test_issues.py | kargaranamir/quality-time | 1c427c61bee9d31c3526f0a01be2218a7e167c23 | [
"Apache-2.0"
] | 21 | 2016-01-16T11:49:23.000Z | 2022-01-14T21:53:22.000Z | """Unit tests for the Jira issues collector."""
from source_collectors.jira.issues import JiraIssues
from .base import JiraTestCase
class JiraIssuesTest(JiraTestCase):
"""Unit tests for the Jira issue collector."""
METRIC_TYPE = "issues"
async def test_issues(self):
"""Test that the issues are... | 39.129032 | 115 | 0.680956 |
from source_collectors.jira.issues import JiraIssues
from .base import JiraTestCase
class JiraIssuesTest(JiraTestCase):
METRIC_TYPE = "issues"
async def test_issues(self):
issues_json = dict(total=1, issues=[self.issue()])
response = await self.get_response(issues_json)
self.assert... | true | true |
1c235811267ebf99d444d1388398b19dafea03db | 418 | py | Python | Python 100 Days 100 Project /01_band-name-generator/01_band-name-generator.py | akhmadzaki/Programming | c91365432761f32550800b968c4bad03e1288de7 | [
"MIT"
] | 1 | 2022-02-17T10:24:15.000Z | 2022-02-17T10:24:15.000Z | Python 100 Days 100 Project /01_band-name-generator/01_band-name-generator.py | akhmadzaki/Programming | c91365432761f32550800b968c4bad03e1288de7 | [
"MIT"
] | 1 | 2022-02-21T15:00:24.000Z | 2022-03-07T12:15:31.000Z | Python 100 Days 100 Project /01_band-name-generator/01_band-name-generator.py | akhmadzaki/Programming | c91365432761f32550800b968c4bad03e1288de7 | [
"MIT"
] | 1 | 2022-02-22T15:09:53.000Z | 2022-02-22T15:09:53.000Z | #1. Create a greeting for your program.
print("Welcome to Band Name Generator")
#2. Ask the user for the city that they grew up in.
print("What's name of city You grew up in ?")
cityName = input()
#3. Ask the user for the name of a pet.
print("What's your pet's nane ?")
petName = input()
#4. Combine the name of their c... | 38 | 73 | 0.712919 |
print("Welcome to Band Name Generator")
print("What's name of city You grew up in ?")
cityName = input()
#3. Ask the user for the name of a pet.
print("What's your pet's nane ?")
petName = input()
#4. Combine the name of their city and pet and show them their band name.
print("Your band name could be " + cityName + p... | true | true |
1c23585aeacbf2dd4450963eecbbc6b4ce2a6bda | 182 | py | Python | one_chan/channels/urls.py | Mikerah/1Chan | 1f21a3765bfbea230badc31d2da718c6ec89827b | [
"MIT"
] | 1 | 2017-04-06T18:36:32.000Z | 2017-04-06T18:36:32.000Z | one_chan/channels/urls.py | Mikerah/1Chan | 1f21a3765bfbea230badc31d2da718c6ec89827b | [
"MIT"
] | 1 | 2017-04-05T04:47:08.000Z | 2017-04-05T12:56:26.000Z | one_chan/channels/urls.py | Mikerah/1Chan | 1f21a3765bfbea230badc31d2da718c6ec89827b | [
"MIT"
] | null | null | null | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^(?P<board_name>[A-Za-z]+)/$', views.board, name='board')
] | 26 | 67 | 0.626374 | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^(?P<board_name>[A-Za-z]+)/$', views.board, name='board')
] | true | true |
1c23588ce28dda04a45ed422e1d6846a52a0e5cf | 513 | py | Python | repless/aws_peices/s3.py | VulcanoAhab/repless | 88cd47b128671cf12ea82acb0cb0fb165ea717a9 | [
"Apache-2.0"
] | null | null | null | repless/aws_peices/s3.py | VulcanoAhab/repless | 88cd47b128671cf12ea82acb0cb0fb165ea717a9 | [
"Apache-2.0"
] | null | null | null | repless/aws_peices/s3.py | VulcanoAhab/repless | 88cd47b128671cf12ea82acb0cb0fb165ea717a9 | [
"Apache-2.0"
] | null | null | null | from custodi.smallBoto import S3Bucket, #Relational
def bucketToSql(Configuration):
"""
headers | type::manual, biggest, commons
"""
## get s3 iterator
S3Bucket.basic_conn(
aws_access_key_id=Configuration.aws_key,
aws_secret_access_key=Configuration.aws_secret,
region_name=C... | 25.65 | 55 | 0.68616 | from custodi.smallBoto import S3Bucket,
def bucketToSql(Configuration):
"""
headers | type::manual, biggest, commons
"""
ic_conn(
aws_access_key_id=Configuration.aws_key,
aws_secret_access_key=Configuration.aws_secret,
region_name=Configuration.region_name
)
s3B=S3Bucke... | false | true |
1c2358aade57ec297b7c41ba377c88ad55df6541 | 713 | py | Python | server/constants.py | KshitijKarthick/animewreck | 494ac6ae3eb21c6c7641a51e368dc72b5d1279c5 | [
"MIT"
] | 2 | 2019-03-01T11:36:24.000Z | 2019-03-01T11:36:31.000Z | server/constants.py | KshitijKarthick/animewreck | 494ac6ae3eb21c6c7641a51e368dc72b5d1279c5 | [
"MIT"
] | 1 | 2020-10-03T19:43:41.000Z | 2020-10-03T19:43:41.000Z | server/constants.py | KshitijKarthick/animewreck | 494ac6ae3eb21c6c7641a51e368dc72b5d1279c5 | [
"MIT"
] | null | null | null | import torch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
random_seed = 42
num_genres = 44
min_slice = 6
max_slice = 11
past_anime_length = 10
num_users, num_anime = (108711, 6668)
train_frac = 0.8
encoded_values_for_rating = 11
batch_size = 512
num_workers_dataloader = 0
genre_embedding_si... | 23 | 88 | 0.806452 | import torch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
random_seed = 42
num_genres = 44
min_slice = 6
max_slice = 11
past_anime_length = 10
num_users, num_anime = (108711, 6668)
train_frac = 0.8
encoded_values_for_rating = 11
batch_size = 512
num_workers_dataloader = 0
genre_embedding_si... | true | true |
1c2359b059f9174704592237aa23c59c51814206 | 1,434 | py | Python | Server/Python/tests/dbsserver_t/unittests/business_t/DBSOutputConfig_t.py | vkuznet/DBS | 14df8bbe8ee8f874fe423399b18afef911fe78c7 | [
"Apache-2.0"
] | 8 | 2015-08-14T04:01:32.000Z | 2021-06-03T00:56:42.000Z | Server/Python/tests/dbsserver_t/unittests/business_t/DBSOutputConfig_t.py | yuyiguo/DBS | 14df8bbe8ee8f874fe423399b18afef911fe78c7 | [
"Apache-2.0"
] | 162 | 2015-01-07T21:34:47.000Z | 2021-10-13T09:42:41.000Z | Server/Python/tests/dbsserver_t/unittests/business_t/DBSOutputConfig_t.py | yuyiguo/DBS | 14df8bbe8ee8f874fe423399b18afef911fe78c7 | [
"Apache-2.0"
] | 16 | 2015-01-22T15:27:29.000Z | 2021-04-28T09:23:28.000Z | """
business unittests
"""
__revision__ = "$Id: DBSOutputConfig_t.py,v 1.2 2010/01/07 17:38:52 afaq Exp $"
__version__ = "$Revision: 1.2 $"
import os
import unittest
import logging
from WMCore.Database.DBFactory import DBFactory
from dbs.business.DBSOutputConfig import DBSOutputConfig
class DBSOutputConfig_t(unittes... | 33.348837 | 79 | 0.679219 |
__revision__ = "$Id: DBSOutputConfig_t.py,v 1.2 2010/01/07 17:38:52 afaq Exp $"
__version__ = "$Revision: 1.2 $"
import os
import unittest
import logging
from WMCore.Database.DBFactory import DBFactory
from dbs.business.DBSOutputConfig import DBSOutputConfig
class DBSOutputConfig_t(unittest.TestCase):
def s... | true | true |
1c235c4f63243ee873a316c3fff53c851e8c5da5 | 1,131 | py | Python | example_remesh.py | Sin-tel/spheremesh | c9a8e14a8dbf2d8e6e1cf46eaae8b25492cd36ea | [
"MIT"
] | 1 | 2021-10-04T06:27:25.000Z | 2021-10-04T06:27:25.000Z | example_remesh.py | Sin-tel/spheremesh | c9a8e14a8dbf2d8e6e1cf46eaae8b25492cd36ea | [
"MIT"
] | null | null | null | example_remesh.py | Sin-tel/spheremesh | c9a8e14a8dbf2d8e6e1cf46eaae8b25492cd36ea | [
"MIT"
] | null | null | null | import spheremesh as sh
import igl
import numpy as np
filename = "data/cell.obj"
l_max = 20
orig_v, faces = igl.read_triangle_mesh(filename)
sphere_verts = sh.conformal_flow(orig_v, faces)
sphere_verts = sh.mobius_center(orig_v,sphere_verts,faces)
orig_v, sphere_verts = sh.canonical_rotation(orig_v, sphere_verts, ... | 20.944444 | 75 | 0.734748 | import spheremesh as sh
import igl
import numpy as np
filename = "data/cell.obj"
l_max = 20
orig_v, faces = igl.read_triangle_mesh(filename)
sphere_verts = sh.conformal_flow(orig_v, faces)
sphere_verts = sh.mobius_center(orig_v,sphere_verts,faces)
orig_v, sphere_verts = sh.canonical_rotation(orig_v, sphere_verts, ... | true | true |
1c235deb7b09950943848091944d51a40f2864be | 476 | py | Python | olc_webportalv2/new_multisample/migrations/0003_sample_amr_status.py | forestdussault/olc_webportalv2 | 9c8c719279ac7dfe9ea749c977d5391e4709b5b9 | [
"MIT"
] | null | null | null | olc_webportalv2/new_multisample/migrations/0003_sample_amr_status.py | forestdussault/olc_webportalv2 | 9c8c719279ac7dfe9ea749c977d5391e4709b5b9 | [
"MIT"
] | 8 | 2018-03-05T21:19:41.000Z | 2018-04-05T13:54:45.000Z | olc_webportalv2/new_multisample/migrations/0003_sample_amr_status.py | forestdussault/olc_webportalv2 | 9c8c719279ac7dfe9ea749c977d5391e4709b5b9 | [
"MIT"
] | 1 | 2018-03-02T18:09:43.000Z | 2018-03-02T18:09:43.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-03-22 17:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('new_multisample', '0002_amrresult'),
]
operations = [
migrations.AddField(
... | 22.666667 | 74 | 0.62605 |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('new_multisample', '0002_amrresult'),
]
operations = [
migrations.AddField(
model_name='sample',
name='amr_status',
... | true | true |
1c235e1b4a6d648f91680caf8ac3c60e94b1e438 | 10,604 | py | Python | src/sentry/models/user.py | boblail/sentry | 71127331e58791d4651e480b65dd66f06cadc1c8 | [
"BSD-3-Clause"
] | 1 | 2018-12-04T12:57:00.000Z | 2018-12-04T12:57:00.000Z | src/sentry/models/user.py | boblail/sentry | 71127331e58791d4651e480b65dd66f06cadc1c8 | [
"BSD-3-Clause"
] | 1 | 2021-05-09T11:43:43.000Z | 2021-05-09T11:43:43.000Z | src/sentry/models/user.py | boblail/sentry | 71127331e58791d4651e480b65dd66f06cadc1c8 | [
"BSD-3-Clause"
] | null | null | null | """
sentry.models.user
~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import logging
import warnings
from bitfield import BitField
from django.contrib.auth.models import AbstractBas... | 33.241379 | 108 | 0.616183 | from __future__ import absolute_import
import logging
import warnings
from bitfield import BitField
from django.contrib.auth.models import AbstractBaseUser, UserManager
from django.core.urlresolvers import reverse
from django.db import IntegrityError, models, transaction
from django.utils import timezone
from django.... | true | true |
1c235f87d62c956502872909b6950c6e090771f4 | 7,692 | py | Python | plugins/modules/oci_compute_app_catalog_subscription_facts.py | hanielburton/oci-ansible-collection | dfdffde637f746d346ba35569be8c3a3407022f2 | [
"Apache-2.0"
] | null | null | null | plugins/modules/oci_compute_app_catalog_subscription_facts.py | hanielburton/oci-ansible-collection | dfdffde637f746d346ba35569be8c3a3407022f2 | [
"Apache-2.0"
] | null | null | null | plugins/modules/oci_compute_app_catalog_subscription_facts.py | hanielburton/oci-ansible-collection | dfdffde637f746d346ba35569be8c3a3407022f2 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python
# Copyright (c) 2017, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... | 33.58952 | 129 | 0.650286 |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
"metadata_version": "1.1",
"status": ["preview"],
"supported_by": "community",
}
DOCUMENTATION = """
---
module: oci_compute_app_catalog_subscription_facts
short_description: Fetches detail... | true | true |
1c23605fbe43b8943c2c252a3b2def2f7b54649d | 16,646 | py | Python | sympy/core/sympify.py | CameronKing/sympy | 3295b02c617a10ea8db0a070356cc0ba5a3b5121 | [
"BSD-3-Clause"
] | 2 | 2019-06-12T16:15:39.000Z | 2019-10-06T10:40:59.000Z | sympy/core/sympify.py | CameronKing/sympy | 3295b02c617a10ea8db0a070356cc0ba5a3b5121 | [
"BSD-3-Clause"
] | 2 | 2019-08-04T13:10:46.000Z | 2020-11-06T19:59:25.000Z | sympy/core/sympify.py | CameronKing/sympy | 3295b02c617a10ea8db0a070356cc0ba5a3b5121 | [
"BSD-3-Clause"
] | null | null | null | """sympify -- convert objects SymPy internal format"""
from __future__ import print_function, division
from inspect import getmro
from .core import all_classes as sympy_classes
from .compatibility import iterable, string_types, range
from .evaluate import global_evaluate
class SympifyError(ValueError):
def __i... | 31.706667 | 99 | 0.584525 |
from __future__ import print_function, division
from inspect import getmro
from .core import all_classes as sympy_classes
from .compatibility import iterable, string_types, range
from .evaluate import global_evaluate
class SympifyError(ValueError):
def __init__(self, expr, base_exc=None):
self.expr = e... | true | true |
1c2360764bf067fc6f90a8e0d699453cabb038c5 | 381 | py | Python | If-Elif-Else/01 - Test/04.py | VasudevJaiswal/Python-Quistions-CP | ba6727f9037823e4644b3142a280ef3a12fcf4c3 | [
"MIT"
] | 1 | 2021-08-18T08:25:05.000Z | 2021-08-18T08:25:05.000Z | If-Elif-Else/01 - Test/04.py | VasudevJaiswal/Python-Quistions-CP | ba6727f9037823e4644b3142a280ef3a12fcf4c3 | [
"MIT"
] | null | null | null | If-Elif-Else/01 - Test/04.py | VasudevJaiswal/Python-Quistions-CP | ba6727f9037823e4644b3142a280ef3a12fcf4c3 | [
"MIT"
] | null | null | null | # Write a program to display "Hello" if a number entered by user is a multiple of five ,
# otherwise print "Bye".
print("Program displayed - 'Hello' If user Entered Number multiple of 5 Other-wise displayed bye")
num = int(input("Enter the Number : "))
if(num%5==0):
print("Hello")
else:
print("Bye")
# For ... | 25.4 | 98 | 0.695538 |
print("Program displayed - 'Hello' If user Entered Number multiple of 5 Other-wise displayed bye")
num = int(input("Enter the Number : "))
if(num%5==0):
print("Hello")
else:
print("Bye")
input("Press Enter to close program")
| true | true |
1c236143f950d7d97ecdc9fe3c18132c19008ad4 | 436 | py | Python | custodian/vasp/validators.py | image-tester/custodian | 9d10b9ad93306ec2545d6f74c9fd37073aa13cc7 | [
"MIT"
] | null | null | null | custodian/vasp/validators.py | image-tester/custodian | 9d10b9ad93306ec2545d6f74c9fd37073aa13cc7 | [
"MIT"
] | null | null | null | custodian/vasp/validators.py | image-tester/custodian | 9d10b9ad93306ec2545d6f74c9fd37073aa13cc7 | [
"MIT"
] | null | null | null | # coding: utf-8
from __future__ import unicode_literals, division
from custodian.custodian import Validator
from pymatgen.io.vaspio.vasp_output import Vasprun
class VasprunXMLValidator(Validator):
"""
Checks that a valid vasprun.xml was generated
"""
def __init__(self):
pass
def check(... | 18.956522 | 50 | 0.651376 |
from __future__ import unicode_literals, division
from custodian.custodian import Validator
from pymatgen.io.vaspio.vasp_output import Vasprun
class VasprunXMLValidator(Validator):
def __init__(self):
pass
def check(self):
try:
Vasprun("vasprun.xml")
except:
... | true | true |
1c236277ca5ba4fc9b2a19c69896a418216535c3 | 2,868 | py | Python | utilities/make_subcifar.py | bbboming/inc_via_bay | 0a339a866e8f83ff8fbda99909a58d24514ca3d1 | [
"MIT"
] | null | null | null | utilities/make_subcifar.py | bbboming/inc_via_bay | 0a339a866e8f83ff8fbda99909a58d24514ca3d1 | [
"MIT"
] | null | null | null | utilities/make_subcifar.py | bbboming/inc_via_bay | 0a339a866e8f83ff8fbda99909a58d24514ca3d1 | [
"MIT"
] | null | null | null | from glob import glob
import sys
import os
import argparse
import tqdm
import numpy as np
parser = argparse.ArgumentParser(description='Search Train/Test Folder and Find Match Dataset for Feature Extraction')
parser.add_argument('DIR', help='base_directory')
parser.add_argument('DST', help='dst directory')
args = pa... | 38.24 | 118 | 0.654463 | from glob import glob
import sys
import os
import argparse
import tqdm
import numpy as np
parser = argparse.ArgumentParser(description='Search Train/Test Folder and Find Match Dataset for Feature Extraction')
parser.add_argument('DIR', help='base_directory')
parser.add_argument('DST', help='dst directory')
args = pa... | true | true |
1c2362b929dbd52aaccff6047167ca26911cedd7 | 6,584 | py | Python | samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_api_endpoints/group_parameters.py | Laurens-W/openapi-generator | bcc77d4ac4d233759278b77f1d034d7e8088fe36 | [
"Apache-2.0"
] | 1 | 2022-01-11T15:49:34.000Z | 2022-01-11T15:49:34.000Z | samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_api_endpoints/group_parameters.py | Laurens-W/openapi-generator | bcc77d4ac4d233759278b77f1d034d7e8088fe36 | [
"Apache-2.0"
] | 5 | 2022-03-22T02:37:12.000Z | 2022-03-30T10:23:21.000Z | samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_api_endpoints/group_parameters.py | Laurens-W/openapi-generator | bcc77d4ac4d233759278b77f1d034d7e8088fe36 | [
"Apache-2.0"
] | 1 | 2022-03-20T14:46:48.000Z | 2022-03-20T14:46:48.000Z | # coding: utf-8
"""
Generated by: https://openapi-generator.tech
"""
from dataclasses import dataclass
import re # noqa: F401
import sys # noqa: F401
import typing
import urllib3
import functools # noqa: F401
from urllib3._collections import HTTPHeaderDict
from petstore_api import api_client, exceptions
imp... | 27.09465 | 103 | 0.703524 |
from dataclasses import dataclass
import re
import sys
import typing
import urllib3
import functools
from urllib3._collections import HTTPHeaderDict
from petstore_api import api_client, exceptions
import decimal
from datetime import date, datetime
from frozendict import frozendict
from petstore_api.sch... | true | true |
1c2362f93c42bbe3527bf2787fef562ef400addb | 12,621 | py | Python | thuja/generator.py | benmca/pyComposition | 24c6313c51eb203bb25eb862ed180a0efeddaa1c | [
"MIT"
] | 1 | 2016-12-19T06:42:36.000Z | 2016-12-19T06:42:36.000Z | thuja/generator.py | benmca/pyComposition | 24c6313c51eb203bb25eb862ed180a0efeddaa1c | [
"MIT"
] | 7 | 2016-11-24T18:38:50.000Z | 2016-12-19T06:42:20.000Z | thuja/generator.py | benmca/pyComposition | 24c6313c51eb203bb25eb862ed180a0efeddaa1c | [
"MIT"
] | null | null | null | from thuja.itemstream import Itemstream
from thuja.itemstream import Streammodes
from thuja.itemstream import Notetypes
from thuja.event import Event
from thuja import utils
from collections import OrderedDict
import copy
import funcsigs
import socket
import logging
import threading
import time
class StreamKey:
... | 33.836461 | 141 | 0.532684 | from thuja.itemstream import Itemstream
from thuja.itemstream import Streammodes
from thuja.itemstream import Notetypes
from thuja.event import Event
from thuja import utils
from collections import OrderedDict
import copy
import funcsigs
import socket
import logging
import threading
import time
class StreamKey:
... | true | true |
1c2363de7fac08c5563d9968c466764b1a873e83 | 560 | py | Python | venv/Lib/site-packages/django_ajax/ajax_processors.py | lsmiley/esstools-adminlte-3 | ec3a7334be0ab05e9d336e397d6edb881131b932 | [
"MIT"
] | null | null | null | venv/Lib/site-packages/django_ajax/ajax_processors.py | lsmiley/esstools-adminlte-3 | ec3a7334be0ab05e9d336e397d6edb881131b932 | [
"MIT"
] | null | null | null | venv/Lib/site-packages/django_ajax/ajax_processors.py | lsmiley/esstools-adminlte-3 | ec3a7334be0ab05e9d336e397d6edb881131b932 | [
"MIT"
] | 3 | 2018-04-11T07:39:01.000Z | 2022-01-10T00:43:21.000Z | def media(request):
from django.conf import settings
return {
'MEDIA_URL': settings.MEDIA_URL
}
def static(request):
from django.conf import settings
return {
'STATIC_URL': settings.STATIC_URL
}
def session(request):
from django.core.urlresolvers import reverse
ret... | 18.666667 | 61 | 0.557143 | def media(request):
from django.conf import settings
return {
'MEDIA_URL': settings.MEDIA_URL
}
def static(request):
from django.conf import settings
return {
'STATIC_URL': settings.STATIC_URL
}
def session(request):
from django.core.urlresolvers import reverse
ret... | true | true |
1c236524bfa19a5e7293a71984166719761e2d4e | 4,891 | py | Python | experiment 2/bbi/mini_classes.py | MichaelSinsbeck/paper_hyperparameters-without-exploratory-phase | 50fee3aaee14748cb1970ae47ed7dc7ebd6098d5 | [
"MIT"
] | 1 | 2022-02-07T09:34:45.000Z | 2022-02-07T09:34:45.000Z | bbi/mini_classes.py | MichaelSinsbeck/paper_sequential-design-model-selection | 9a423b3b6f5ec480b72c42d955a449c13d3afb75 | [
"MIT"
] | null | null | null | bbi/mini_classes.py | MichaelSinsbeck/paper_sequential-design-model-selection | 9a423b3b6f5ec480b72c42d955a449c13d3afb75 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Module helpers
Contains the following classes, mostly for shorter notation:
1) Nodes - Sampling Points and the corresponding model response
2) Data - Data plus Variance, part of an inverse problem
3) Problem - An inverse problem, consists of grid, model an... | 32.825503 | 76 | 0.56103 |
import numpy as np
class Nodes:
def __init__(self, idx=None, y=None):
self.idx = np.empty((0), dtype=int)
if not idx is None and not y is None:
self.append(idx, y)
def append(self, idx, y):
if self.idx.size == 0:
n_entries = np.array(idx).size
s... | true | true |
1c23659b8db88585c9238ce0dee59cdfa4af1acf | 11,180 | py | Python | jupiter/jupiter_decomposition.py | tingyuansen/Wobble_NN | 325d389589301d4056e68fa8ce4bfe86eacce312 | [
"MIT"
] | null | null | null | jupiter/jupiter_decomposition.py | tingyuansen/Wobble_NN | 325d389589301d4056e68fa8ce4bfe86eacce312 | [
"MIT"
] | null | null | null | jupiter/jupiter_decomposition.py | tingyuansen/Wobble_NN | 325d389589301d4056e68fa8ce4bfe86eacce312 | [
"MIT"
] | null | null | null | #%% import packages
import numpy as np
import torch
from torchsearchsorted import searchsorted
const_c=2.99792458e5
#%%
import matplotlib.pyplot as pl
import seaborn as sns
sns.set(style='ticks', font_scale=1.6, font='sans-serif')
from matplotlib import rc
rc('text', usetex=True)
#%%
%matplotlib inline
#%%==========... | 41.407407 | 202 | 0.582826 |
import numpy as np
import torch
from torchsearchsorted import searchsorted
const_c=2.99792458e5
import matplotlib.pyplot as pl
import seaborn as sns
sns.set(style='ticks', font_scale=1.6, font='sans-serif')
from matplotlib import rc
rc('text', usetex=True)
%matplotlib inline
data = np.load('spectra_jupiter_hds.... | false | true |
1c2365f7021f06fecb85e8a128c5f297618c0bd6 | 6,108 | py | Python | optimization/bin_lr/federated_bin_lr.py | diptanshumittal/FCO-ICML21 | 4a9f4456cb7e1c3a0646c9b91a0926ba87fc6a48 | [
"Apache-2.0"
] | 4 | 2021-06-07T18:34:52.000Z | 2021-10-05T13:20:16.000Z | optimization/bin_lr/federated_bin_lr.py | diptanshumittal/FCO-ICML21 | 4a9f4456cb7e1c3a0646c9b91a0926ba87fc6a48 | [
"Apache-2.0"
] | null | null | null | optimization/bin_lr/federated_bin_lr.py | diptanshumittal/FCO-ICML21 | 4a9f4456cb7e1c3a0646c9b91a0926ba87fc6a48 | [
"Apache-2.0"
] | 4 | 2021-12-20T18:40:31.000Z | 2022-03-24T12:28:08.000Z | # Copyright 2021, Google LLC.
#
# 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... | 38.658228 | 80 | 0.746398 |
import functools
from typing import Callable, Optional
from absl import flags
from absl import logging
import tensorflow as tf
import tensorflow_federated as tff
from utils import training_loop
from utils import training_utils
from utils.datasets import synthetic_dataset
from utils.models import bin_lr_... | true | true |
1c23660aca4d27f90bed9d48da984c3bc629975c | 2,284 | py | Python | gazebo_assets_drone_race/tools/gazebo_world_parser/world_objects_to_file.py | Veilkrand/drone_race | 7391f1a94bfe354aab3e24be61b76e1595481ad9 | [
"MIT"
] | 2 | 2018-12-31T01:33:21.000Z | 2019-02-12T07:50:19.000Z | tools/gazebo_world_parser/world_objects_to_file.py | Veilkrand/gazebo_assets_drone_race | 75362b4d65086c1152c06196fb3b568544bc2511 | [
"MIT"
] | null | null | null | tools/gazebo_world_parser/world_objects_to_file.py | Veilkrand/gazebo_assets_drone_race | 75362b4d65086c1152c06196fb3b568544bc2511 | [
"MIT"
] | 2 | 2019-04-15T10:34:44.000Z | 2020-08-09T15:08:20.000Z | import json, io
import re
import xml.etree.ElementTree as ET
import argparse
def parse_pose(pose):
p_list = pose.split(' ')
return (float(p_list[0]), float(p_list[1]), float(p_list[2]), float(p_list[3]), float(p_list[4]), float(p_list[5]))
def get_id_text_from_name(name, regex):
ids = re.compile(r... | 32.169014 | 148 | 0.629159 | import json, io
import re
import xml.etree.ElementTree as ET
import argparse
def parse_pose(pose):
p_list = pose.split(' ')
return (float(p_list[0]), float(p_list[1]), float(p_list[2]), float(p_list[3]), float(p_list[4]), float(p_list[5]))
def get_id_text_from_name(name, regex):
ids = re.compile(r... | false | true |
1c2366f9291b6acea3d995ca9cd502421be9acd8 | 8,705 | py | Python | examples/speech_to_text/prep_mustc_data.py | hnt4499/fairseq | 4b519e9876737db32047167e77bf5f8781edef99 | [
"MIT"
] | 1 | 2020-12-24T06:30:10.000Z | 2020-12-24T06:30:10.000Z | examples/speech_to_text/prep_mustc_data.py | hnt4499/fairseq | 4b519e9876737db32047167e77bf5f8781edef99 | [
"MIT"
] | null | null | null | examples/speech_to_text/prep_mustc_data.py | hnt4499/fairseq | 4b519e9876737db32047167e77bf5f8781edef99 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# 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 sys
import argparse
from loguru import logger
import os
import os.path as op
import shutil
from itertools import... | 37.200855 | 87 | 0.590465 |
import sys
import argparse
from loguru import logger
import os
import os.path as op
import shutil
from itertools import groupby
from tempfile import NamedTemporaryFile
from typing import Tuple
import pandas as pd
import torchaudio
from examples.speech_to_text.data_utils import (
create_zip,
extract_fbank... | true | true |
1c2367f81ced5ad7382931a5fd473fc258496eb3 | 4,021 | py | Python | docs/archive/spyder-like-silk/registers/blockmixin.py | sjdv1982/seamless | 1b814341e74a56333c163f10e6f6ceab508b7df9 | [
"MIT"
] | 15 | 2017-06-07T12:49:12.000Z | 2020-07-25T18:06:04.000Z | docs/archive/spyder-like-silk/registers/blockmixin.py | sjdv1982/seamless | 1b814341e74a56333c163f10e6f6ceab508b7df9 | [
"MIT"
] | 110 | 2016-06-21T23:20:44.000Z | 2022-02-24T16:15:22.000Z | docs/archive/spyder-like-silk/registers/blockmixin.py | sjdv1982/seamless | 1b814341e74a56333c163f10e6f6ceab508b7df9 | [
"MIT"
] | 6 | 2016-06-21T11:19:22.000Z | 2019-01-21T13:45:39.000Z | from seamless.core.cached_compile import cached_compile
def substitute_error_message(validation_block_lines, eblocks):
tmpl = "raise SilkValidationError(\"%s\", globals(), locals())"
# TODO: swallow original exception
if eblocks is None:
return validation_block_lines
ret = []
for l in valid... | 37.579439 | 80 | 0.549117 | from seamless.core.cached_compile import cached_compile
def substitute_error_message(validation_block_lines, eblocks):
tmpl = "raise SilkValidationError(\"%s\", globals(), locals())"
if eblocks is None:
return validation_block_lines
ret = []
for l in validation_block_lines:
ll = l.... | true | true |
1c23687cd379bd241efe670e210ddd5109c32a41 | 1,742 | py | Python | test/test_search.py | FlorianLudwig/code-owl | be6518c89fb49ae600ee004504f9485f328e1090 | [
"Apache-2.0"
] | 6 | 2017-04-15T22:13:48.000Z | 2020-02-04T09:41:02.000Z | test/test_search.py | FlorianLudwig/code-owl | be6518c89fb49ae600ee004504f9485f328e1090 | [
"Apache-2.0"
] | null | null | null | test/test_search.py | FlorianLudwig/code-owl | be6518c89fb49ae600ee004504f9485f328e1090 | [
"Apache-2.0"
] | null | null | null | import os
import codeowl.search
import codeowl.code
BASE_PATH = os.path.dirname(__file__) + '/examples'
def test_basic():
src = BASE_PATH + '/world.py'
# searching for a variable name
query = codeowl.search.generate_query('hello_world')
assert len(codeowl.search.source_file(query, src)) == 1
#... | 31.107143 | 73 | 0.698622 | import os
import codeowl.search
import codeowl.code
BASE_PATH = os.path.dirname(__file__) + '/examples'
def test_basic():
src = BASE_PATH + '/world.py'
query = codeowl.search.generate_query('hello_world')
assert len(codeowl.search.source_file(query, src)) == 1
query = codeowl.search.gene... | true | true |
1c236a57471438fa56e74e5d6d55e971992caf95 | 214 | py | Python | pydcop/version.py | rpgoldman/pyDcop | 65e458b180b5614015872214c29d25fa8c306867 | [
"BSD-3-Clause"
] | null | null | null | pydcop/version.py | rpgoldman/pyDcop | 65e458b180b5614015872214c29d25fa8c306867 | [
"BSD-3-Clause"
] | null | null | null | pydcop/version.py | rpgoldman/pyDcop | 65e458b180b5614015872214c29d25fa8c306867 | [
"BSD-3-Clause"
] | null | null | null | # Store the version here so:
# 1) we don't load dependencies by storing it in __init__.py
# 2) we can import it in setup.py for the same reason
# 3) we can import it into your module module
__version__ = '0.3.0a1'
| 35.666667 | 60 | 0.728972 |
# 2) we can import it in setup.py for the same reason
# 3) we can import it into your module module
__version__ = '0.3.0a1'
| true | true |
1c236a5e5d1073fb27b6a478d12b5090a2f87cf0 | 6,844 | py | Python | euca2ools/commands/iam/createaccesskey.py | salewski/euca2ools | 6b3f62f2cb1c54f14d3bfa5fd92dab3c0ecafecb | [
"BSD-2-Clause"
] | 30 | 2015-02-10T05:47:38.000Z | 2022-01-20T08:48:43.000Z | euca2ools/commands/iam/createaccesskey.py | salewski/euca2ools | 6b3f62f2cb1c54f14d3bfa5fd92dab3c0ecafecb | [
"BSD-2-Clause"
] | 16 | 2015-01-08T23:24:34.000Z | 2018-07-18T07:15:40.000Z | euca2ools/commands/iam/createaccesskey.py | salewski/euca2ools | 6b3f62f2cb1c54f14d3bfa5fd92dab3c0ecafecb | [
"BSD-2-Clause"
] | 19 | 2015-05-07T05:34:42.000Z | 2020-12-13T10:50:14.000Z | # Copyright (c) 2009-2016 Hewlett Packard Enterprise Development LP
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# Redistributions of source code must retain the above copyright notice,
# thi... | 50.696296 | 79 | 0.599942 |
import sys
from requestbuilder import Arg
import six
from euca2ools.commands.iam import IAMRequest, AS_ACCOUNT, arg_user
from euca2ools.commands.iam.getuser import GetUser
import euca2ools.exceptions
import euca2ools.util
class CreateAccessKey(IAMRequest):
DESCRIPTION = 'Create a new ac... | false | true |
1c236a6a891ebc09446f7c5a5de17e68bdbce23e | 1,897 | py | Python | kinematic.py | kochman/kinematic | a80717578e65e30dbac21c197ba56f6440c23fbc | [
"MIT"
] | null | null | null | kinematic.py | kochman/kinematic | a80717578e65e30dbac21c197ba56f6440c23fbc | [
"MIT"
] | null | null | null | kinematic.py | kochman/kinematic | a80717578e65e30dbac21c197ba56f6440c23fbc | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import argparse
import sympy
import sys
from sympy import Symbol as Sym
class DuoSymbol:
def __init__(self, name, value):
self.name = name
self.value = float(value)
def __repr__(self):
return "DuoSymbol('{}', {})".format(self.name, self.value)
class KinematicEquation:
def __init_... | 23.7125 | 71 | 0.659989 |
import argparse
import sympy
import sys
from sympy import Symbol as Sym
class DuoSymbol:
def __init__(self, name, value):
self.name = name
self.value = float(value)
def __repr__(self):
return "DuoSymbol('{}', {})".format(self.name, self.value)
class KinematicEquation:
def __init__(self, func, variable... | true | true |
1c236ce14c5a72f585ee5ce4ccc0798f880776ba | 6,680 | py | Python | src/problem1.py | Cooperma1/24-Exam3-201920 | 344360d8e541541088a8e886e6a78b6af0c04a25 | [
"MIT"
] | null | null | null | src/problem1.py | Cooperma1/24-Exam3-201920 | 344360d8e541541088a8e886e6a78b6af0c04a25 | [
"MIT"
] | null | null | null | src/problem1.py | Cooperma1/24-Exam3-201920 | 344360d8e541541088a8e886e6a78b6af0c04a25 | [
"MIT"
] | null | null | null | """
Exam 3, problem 1.
Authors: Vibha Alangar, Aaron Wilkin, David Mutchler, Dave Fisher,
Matt Boutell, Amanda Stouder, their colleagues and
Miguel Cooper. January 2019.
""" # done: 1. PUT YOUR NAME IN THE ABOVE LINE.
import time
import testing_helper
def main():
""" Calls the TEST fu... | 34.973822 | 79 | 0.569461 |
import time
import testing_helper
def main():
run_test_problem1()
def run_test_problem1():
| true | true |
1c236efa17c85dbb571cd6a759f8569556327186 | 199 | py | Python | homeassistant/external/__init__.py | Cribstone/home-assistant | 328b9a84c0169c8067f2aa8d07392519de8a5e35 | [
"MIT"
] | 1 | 2022-01-09T18:02:24.000Z | 2022-01-09T18:02:24.000Z | homeassistant/packages/__init__.py | jwveldhuis/home-assistant | f07622e0d77ceac236d631245a2486f249812666 | [
"MIT"
] | null | null | null | homeassistant/packages/__init__.py | jwveldhuis/home-assistant | f07622e0d77ceac236d631245a2486f249812666 | [
"MIT"
] | null | null | null | """
Not all external Git repositories that we depend on are
available as a package for pip. That is why we include
them here.
PyChromecast
------------
https://github.com/balloob/pychromecast
"""
| 16.583333 | 55 | 0.713568 | true | true | |
1c23709203906b667b9696b2dc00ba6b1959fa37 | 589 | py | Python | tests/test_asgs.py | hmrc/telescope-ec2-age | 13375b8059f1b20508e5743c04588f847c9ab34a | [
"Apache-2.0"
] | null | null | null | tests/test_asgs.py | hmrc/telescope-ec2-age | 13375b8059f1b20508e5743c04588f847c9ab34a | [
"Apache-2.0"
] | 1 | 2021-10-01T16:12:05.000Z | 2021-10-01T16:12:05.000Z | tests/test_asgs.py | hmrc/telescope-ec2-age | 13375b8059f1b20508e5743c04588f847c9ab34a | [
"Apache-2.0"
] | 1 | 2021-04-10T23:37:07.000Z | 2021-04-10T23:37:07.000Z | from telemetry.telescope_ec2_age.desc_asg import describe_asgs_launch_conf
#should refactor asgs for response being outside function
def test_response_get():
test_response = 'test'
describe_asgs_launch_conf(test_response)
def test_response():
asg_dict, conf_dict = describe_asgs_launch_conf()
assert t... | 32.722222 | 74 | 0.711375 | from telemetry.telescope_ec2_age.desc_asg import describe_asgs_launch_conf
def test_response_get():
test_response = 'test'
describe_asgs_launch_conf(test_response)
def test_response():
asg_dict, conf_dict = describe_asgs_launch_conf()
assert type(asg_dict) == dict
assert type(conf_dict) == dict
... | true | true |
1c237132af7bff3b84556347b27cfcdcaec74c10 | 10,347 | py | Python | aiohttp/pytest_plugin.py | adamko147/aiohttp | 3250c5d75a54e19e2825d0a609f9d9cd4bf62087 | [
"Apache-2.0"
] | 1 | 2021-01-19T09:47:03.000Z | 2021-01-19T09:47:03.000Z | aiohttp/pytest_plugin.py | adamko147/aiohttp | 3250c5d75a54e19e2825d0a609f9d9cd4bf62087 | [
"Apache-2.0"
] | 199 | 2020-11-01T08:02:46.000Z | 2022-03-31T07:05:31.000Z | aiohttp/pytest_plugin.py | adamko147/aiohttp | 3250c5d75a54e19e2825d0a609f9d9cd4bf62087 | [
"Apache-2.0"
] | null | null | null | import asyncio
import contextlib
import inspect
import warnings
import pytest
from aiohttp.web import Application
from .test_utils import (
BaseTestServer,
RawTestServer,
TestClient,
TestServer,
loop_context,
setup_test_loop,
teardown_test_loop,
unused_port as _unused_port,
)
try:
... | 28.741667 | 83 | 0.623562 | import asyncio
import contextlib
import inspect
import warnings
import pytest
from aiohttp.web import Application
from .test_utils import (
BaseTestServer,
RawTestServer,
TestClient,
TestServer,
loop_context,
setup_test_loop,
teardown_test_loop,
unused_port as _unused_port,
)
try:
... | true | true |
1c2371808433e486f35a7313b0d322a474506322 | 9,470 | py | Python | pyleecan/Classes/OptiGenAlgNsga2Deap.py | helene-t/pyleecan | 8362de9b0e32b346051b38192e07f3a6974ea9aa | [
"Apache-2.0"
] | null | null | null | pyleecan/Classes/OptiGenAlgNsga2Deap.py | helene-t/pyleecan | 8362de9b0e32b346051b38192e07f3a6974ea9aa | [
"Apache-2.0"
] | null | null | null | pyleecan/Classes/OptiGenAlgNsga2Deap.py | helene-t/pyleecan | 8362de9b0e32b346051b38192e07f3a6974ea9aa | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""File generated according to Generator/ClassesRef/Optimization/OptiGenAlgNsga2Deap.csv
WARNING! All changes made in this file will be lost!
"""
from os import linesep
from logging import getLogger
from ._check import check_var, raise_
from ..Functions.get_logger import get_logger
from ..Funct... | 35.871212 | 110 | 0.627244 |
from os import linesep
from logging import getLogger
from ._check import check_var, raise_
from ..Functions.get_logger import get_logger
from ..Functions.save import save
from .OptiGenAlg import OptiGenAlg
try:
from ..Methods.Optimization.OptiGenAlgNsga2Deap.solve import solve
except ImportError as error:
... | true | true |
1c237191115f0d8b525977d829fe66ff6117a3fb | 18,028 | py | Python | Python/grovepi.py | prolon-control-systems/dtu-smartlib-sensor-pi | 143f1d00cc0adadbdd0dc6ef3df3eaa0d27a7a68 | [
"MIT"
] | null | null | null | Python/grovepi.py | prolon-control-systems/dtu-smartlib-sensor-pi | 143f1d00cc0adadbdd0dc6ef3df3eaa0d27a7a68 | [
"MIT"
] | null | null | null | Python/grovepi.py | prolon-control-systems/dtu-smartlib-sensor-pi | 143f1d00cc0adadbdd0dc6ef3df3eaa0d27a7a68 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
#
# GrovePi Python library
# v1.2.2
#
# This file provides the basic functions for using the GrovePi
#
# The GrovePi connects the Raspberry Pi and Grove sensors. You can learn more about GrovePi here: http://www.dexterindustries.com/GrovePi
#
# Have a question about this example? Ask on the for... | 30.147157 | 139 | 0.735855 |
import sys
import time
import math
import struct
import numpy
debug = 0
if sys.version_info<(3,0):
p_version=2
else:
p_version=3
if sys.platform == 'uwp':
import winrt_smbus as smbus
bus = smbus.SMBus(1)
else:
import smbus
import RPi.GPIO as GPIO
rev = GPIO.RPI_REVISION
if rev == 2 or rev ... | true | true |
1c2371c59010dd2f4b9c379ae9219bf13169345a | 4,519 | py | Python | examples/embeddings/utils.py | nlp-greyfoss/metagrad | 0f32f177ced1478f0c75ad37bace9a9fc4044ba3 | [
"MIT"
] | 7 | 2022-01-27T05:38:02.000Z | 2022-03-30T01:48:00.000Z | examples/embeddings/utils.py | nlp-greyfoss/metagrad | 0f32f177ced1478f0c75ad37bace9a9fc4044ba3 | [
"MIT"
] | null | null | null | examples/embeddings/utils.py | nlp-greyfoss/metagrad | 0f32f177ced1478f0c75ad37bace9a9fc4044ba3 | [
"MIT"
] | 2 | 2022-02-22T07:47:02.000Z | 2022-03-22T08:31:59.000Z | from collections import defaultdict
import numpy as np
from metagrad import Tensor
BOS_TOKEN = "<bos>" # 句子开始标记
EOS_TOKEN = "<eos>" # 句子结束标记
PAD_TOKEN = "<pad>" # 填充标记
UNK_TOKEN = "<unk>" # 未知词标记
WEIGHT_INIT_RANGE = 0.1
class Vocabulary:
def __init__(self, tokens=None):
self._idx_to_token = list()
... | 28.967949 | 118 | 0.595928 | from collections import defaultdict
import numpy as np
from metagrad import Tensor
BOS_TOKEN = "<bos>"
EOS_TOKEN = "<eos>"
PAD_TOKEN = "<pad>"
UNK_TOKEN = "<unk>"
WEIGHT_INIT_RANGE = 0.1
class Vocabulary:
def __init__(self, tokens=None):
self._idx_to_token = list()
self._token_to_idx = d... | true | true |
1c2371db710811cfe8cdb8671dd8968b23cb16cc | 862 | py | Python | Chapter10/complex_cross_platform_demo/backend.py | Xgb6train167/01.tk001 | 7be65b23f8fdf266b8cb69dcae53f704100f5d22 | [
"MIT"
] | 24 | 2021-06-05T22:42:39.000Z | 2022-03-28T21:23:13.000Z | Chapter10/complex_cross_platform_demo/backend.py | Xgb6train167/01.tk001 | 7be65b23f8fdf266b8cb69dcae53f704100f5d22 | [
"MIT"
] | null | null | null | Chapter10/complex_cross_platform_demo/backend.py | Xgb6train167/01.tk001 | 7be65b23f8fdf266b8cb69dcae53f704100f5d22 | [
"MIT"
] | 25 | 2021-04-18T12:30:13.000Z | 2022-03-29T12:12:45.000Z | import subprocess
def get_process_getter_class(os_name):
backends = {
'Linux': LinuxProcessGetter,
'Darwin': MacBsdProcessGetter,
'Windows': WindowsProcessGetter,
'freebsd7': MacBsdProcessGetter
}
try:
return backends[os_name]
except KeyError:
raise NotI... | 22.684211 | 58 | 0.633411 | import subprocess
def get_process_getter_class(os_name):
backends = {
'Linux': LinuxProcessGetter,
'Darwin': MacBsdProcessGetter,
'Windows': WindowsProcessGetter,
'freebsd7': MacBsdProcessGetter
}
try:
return backends[os_name]
except KeyError:
raise NotI... | true | true |
1c2371f812aa342d314b7d7b49f6f6502a121b8a | 1,575 | py | Python | app/main/views.py | seron-ux/News-app | d22b256b26fb9fa2bb77658952139b9ddebb8f8c | [
"MIT"
] | 1 | 2021-04-16T12:03:37.000Z | 2021-04-16T12:03:37.000Z | app/main/views.py | seron-ux/News-app | d22b256b26fb9fa2bb77658952139b9ddebb8f8c | [
"MIT"
] | null | null | null | app/main/views.py | seron-ux/News-app | d22b256b26fb9fa2bb77658952139b9ddebb8f8c | [
"MIT"
] | null | null | null | from flask import render_template,request,redirect,url_for
from . import main
from ..requests import get_news,get_news,search_news,get_article
from .forms import ReviewForm
from ..models import News
# Article=Article
# Views
@main.route('/')
def index():
'''
View root page function that returns the index p... | 25.819672 | 177 | 0.690794 | from flask import render_template,request,redirect,url_for
from . import main
from ..requests import get_news,get_news,search_news,get_article
from .forms import ReviewForm
from ..models import News
@main.route('/')
def index():
popularity = get_news('popularity')
bitcoin = get_news('bitcoin')
... | true | true |
1c23724c87583e4dc8fe2d914fccc06e1ee65b60 | 345 | py | Python | 04_P7.py | wiphoo/computer_programing_101 | 59013d774f6ec6e019829d73ce163cf5766c6a48 | [
"MIT"
] | null | null | null | 04_P7.py | wiphoo/computer_programing_101 | 59013d774f6ec6e019829d73ce163cf5766c6a48 | [
"MIT"
] | null | null | null | 04_P7.py | wiphoo/computer_programing_101 | 59013d774f6ec6e019829d73ce163cf5766c6a48 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
inp = input()
listNum = []
checkList=['0','1','2','3','4','5','6','7','8','9']
for i in inp:
if i not in listNum:
listNum.append(i)
listNum.sort()
notFound = []
print(listNum)
for j in checkList:
if j not in listNum:
notFound.append(j)
if len(notFound) == 0:
print ("No missing digits")... | 16.428571 | 51 | 0.623188 |
inp = input()
listNum = []
checkList=['0','1','2','3','4','5','6','7','8','9']
for i in inp:
if i not in listNum:
listNum.append(i)
listNum.sort()
notFound = []
print(listNum)
for j in checkList:
if j not in listNum:
notFound.append(j)
if len(notFound) == 0:
print ("No missing digits")
else:
print(*notFoun... | true | true |
1c23726017d1a754e5970401cc963b783de86f9e | 7,143 | py | Python | flask_rest_jsonapi/api.py | kiptoomm/flask-rest-jsonapi | b4cb5576b75ffaf6463abb8952edc8839b03463f | [
"MIT"
] | null | null | null | flask_rest_jsonapi/api.py | kiptoomm/flask-rest-jsonapi | b4cb5576b75ffaf6463abb8952edc8839b03463f | [
"MIT"
] | null | null | null | flask_rest_jsonapi/api.py | kiptoomm/flask-rest-jsonapi | b4cb5576b75ffaf6463abb8952edc8839b03463f | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""This module contains the main class of the Api to initialize the Api, plug default decorators for each resources
methods, speficy which blueprint to use, define the Api routes and plug additional oauth manager and permission manager
"""
import inspect
from functools import wraps
from flask... | 37.397906 | 119 | 0.590928 |
import inspect
from functools import wraps
from flask import request, abort
from flask_rest_jsonapi.resource import ResourceList, ResourceRelationship
from flask_rest_jsonapi.decorators import jsonapi_exception_formatter
class Api(object):
def __init__(self, app=None, blueprint=None, decorators=None):
... | true | true |
1c23730bed872e6ef3fc6d8bedf4cb39cb6d8a40 | 1,537 | py | Python | yepes/validators/phone_number.py | samuelmaudo/yepes | 1ef9a42d4eaa70d9b3e6e7fa519396c1e1174fcb | [
"BSD-3-Clause"
] | null | null | null | yepes/validators/phone_number.py | samuelmaudo/yepes | 1ef9a42d4eaa70d9b3e6e7fa519396c1e1174fcb | [
"BSD-3-Clause"
] | null | null | null | yepes/validators/phone_number.py | samuelmaudo/yepes | 1ef9a42d4eaa70d9b3e6e7fa519396c1e1174fcb | [
"BSD-3-Clause"
] | null | null | null | # -*- coding:utf-8 -*-
from __future__ import unicode_literals
import re
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from yepes.validators.base import Validator
CLOSE_PARENTHESES = re.compile(r'\)')
DIGITS_RE = re.compile(r'[0-9]')
HYPHENS_RE = re.compile(r'... | 31.367347 | 65 | 0.623292 |
from __future__ import unicode_literals
import re
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from yepes.validators.base import Validator
CLOSE_PARENTHESES = re.compile(r'\)')
DIGITS_RE = re.compile(r'[0-9]')
HYPHENS_RE = re.compile(r'-')
OPEN_PARENTHESES =... | true | true |
1c23739d2d308e070b8630b274d954a65e7cc931 | 3,159 | py | Python | pre_commit/commands/install_uninstall.py | bukzor/pre-commit | 7d546c1f815a41f17af276e2f8d0636efdd87a6d | [
"MIT"
] | null | null | null | pre_commit/commands/install_uninstall.py | bukzor/pre-commit | 7d546c1f815a41f17af276e2f8d0636efdd87a6d | [
"MIT"
] | null | null | null | pre_commit/commands/install_uninstall.py | bukzor/pre-commit | 7d546c1f815a41f17af276e2f8d0636efdd87a6d | [
"MIT"
] | null | null | null | from __future__ import print_function
from __future__ import unicode_literals
import io
import logging
import os
import os.path
import stat
import sys
from pre_commit.logging_handler import LoggingHandler
from pre_commit.util import resource_filename
logger = logging.getLogger('pre_commit')
# This is used to iden... | 29.523364 | 78 | 0.707186 | from __future__ import print_function
from __future__ import unicode_literals
import io
import logging
import os
import os.path
import stat
import sys
from pre_commit.logging_handler import LoggingHandler
from pre_commit.util import resource_filename
logger = logging.getLogger('pre_commit')
PREVIOUS_IDENTIFYING_... | true | true |
1c237415a1f1c49f37f793f793faec16bf4c99f2 | 1,238 | py | Python | learning/basic.py | seasonfif/python | e165826526af7f1a8336b9db461abfaaed57567a | [
"Apache-2.0"
] | null | null | null | learning/basic.py | seasonfif/python | e165826526af7f1a8336b9db461abfaaed57567a | [
"Apache-2.0"
] | null | null | null | learning/basic.py | seasonfif/python | e165826526af7f1a8336b9db461abfaaed57567a | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python
# coding=utf-8
counter = 100
miles = 100.123
print counter
print miles
str = 'Hello World!'
print str # 输出完整字符串
print str[0] # 输出字符串中的第一个字符
print str[2:5] # 输出字符串中第三个至第五个之间的字符串
print str[2:] # 输出从第三个字符开始的字符串
print str * 2 # 输出字符串两次
print str + "TEST" # 输出连接的字符串
# 列... | 21.344828 | 56 | 0.588045 |
counter = 100
miles = 100.123
print counter
print miles
str = 'Hello World!'
print str
print str[0]
print str[2:5]
print str[2:]
print str * 2
print str + "TEST"
print "列表List"
list = [ 'runoob', 786 , 2.23, 'john', 70.2 ]
tinylist = [123, 'john']
print list
... | false | true |
1c2374bd75b48c17ee861a153d67a5af9404e946 | 835 | py | Python | foolbox/tests/attacks/test_attacks_decoupled_direction_norm.py | mkyybx/foolbox | 00b2dcc5ed30b12f28431e9dabe4d2bbc214d444 | [
"MIT"
] | 3 | 2021-12-25T02:29:24.000Z | 2022-02-22T02:12:30.000Z | foolbox/tests/attacks/test_attacks_decoupled_direction_norm.py | pige2nd/foolbox | 2daabba8355afce9dfbec3de8d71dadadcfbd10b | [
"MIT"
] | null | null | null | foolbox/tests/attacks/test_attacks_decoupled_direction_norm.py | pige2nd/foolbox | 2daabba8355afce9dfbec3de8d71dadadcfbd10b | [
"MIT"
] | 2 | 2020-11-27T00:03:48.000Z | 2020-11-27T00:08:04.000Z | import numpy as np
from foolbox.attacks import DecoupledDirectionNormL2Attack as Attack
def test_untargeted_attack(bn_adversarial):
adv = bn_adversarial
attack = Attack()
attack(adv)
assert adv.perturbed is not None
assert adv.distance.value < np.inf
def test_targeted_attack(bn_targeted_adversa... | 23.194444 | 68 | 0.726946 | import numpy as np
from foolbox.attacks import DecoupledDirectionNormL2Attack as Attack
def test_untargeted_attack(bn_adversarial):
adv = bn_adversarial
attack = Attack()
attack(adv)
assert adv.perturbed is not None
assert adv.distance.value < np.inf
def test_targeted_attack(bn_targeted_adversa... | true | true |
1c23771fc5701a08c4353c1167a6245078caeae3 | 2,440 | py | Python | core/layers/segmentation.py | CnybTseng/YOLACT | e8564b9f961dc99c740a58efc199243233c8cbfe | [
"MIT"
] | 3 | 2020-11-23T12:58:45.000Z | 2020-12-28T11:57:21.000Z | core/layers/segmentation.py | CnybTseng/YOLACT | e8564b9f961dc99c740a58efc199243233c8cbfe | [
"MIT"
] | null | null | null | core/layers/segmentation.py | CnybTseng/YOLACT | e8564b9f961dc99c740a58efc199243233c8cbfe | [
"MIT"
] | 1 | 2020-11-23T12:58:49.000Z | 2020-11-23T12:58:49.000Z | import torch
import torch.nn.functional as F
class MaskProducer(object):
def __init__(self, interpolation_mode='bilinear', crop_mask=True, score_thresh=0):
self.interpolation_mode = interpolation_mode
self.crop_mask = crop_mask
self.score_thresh = score_thresh
def __call__... | 41.355932 | 118 | 0.531148 | import torch
import torch.nn.functional as F
class MaskProducer(object):
def __init__(self, interpolation_mode='bilinear', crop_mask=True, score_thresh=0):
self.interpolation_mode = interpolation_mode
self.crop_mask = crop_mask
self.score_thresh = score_thresh
def __call__... | true | true |
1c2377642181f1d975ccbdd9d66f3c3517304f42 | 4,514 | py | Python | ucsmsdk/mometa/memory/MemoryBufferUnitEnvStatsHist.py | Kego/ucsmsdk | 244f283a5c295cf746110bb96686d079b19927ce | [
"Apache-2.0"
] | 78 | 2015-11-30T14:10:05.000Z | 2022-02-13T00:29:08.000Z | ucsmsdk/mometa/memory/MemoryBufferUnitEnvStatsHist.py | Kego/ucsmsdk | 244f283a5c295cf746110bb96686d079b19927ce | [
"Apache-2.0"
] | 113 | 2015-11-20T09:42:46.000Z | 2022-03-16T16:53:29.000Z | ucsmsdk/mometa/memory/MemoryBufferUnitEnvStatsHist.py | Kego/ucsmsdk | 244f283a5c295cf746110bb96686d079b19927ce | [
"Apache-2.0"
] | 86 | 2015-12-12T08:22:18.000Z | 2022-01-23T03:56:34.000Z | """This module contains the general information for MemoryBufferUnitEnvStatsHist ManagedObject."""
from ...ucsmo import ManagedObject
from ...ucscoremeta import MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class MemoryBufferUnitEnvStatsHistConsts:
MOST_RECENT_FALSE = "false"
MOST_RECENT_NO = "no... | 58.623377 | 258 | 0.655738 |
from ...ucsmo import ManagedObject
from ...ucscoremeta import MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class MemoryBufferUnitEnvStatsHistConsts:
MOST_RECENT_FALSE = "false"
MOST_RECENT_NO = "no"
MOST_RECENT_TRUE = "true"
MOST_RECENT_YES = "yes"
SUSPECT_FALSE = "false"
SUSPECT... | true | true |
1c2377c65008a9ed54ce638fe5a3404d02693a7d | 5,058 | py | Python | edit_file_disini_yan.py | rumputliar/lazada1 | 52450c465de0d22cf03e0010a43d58f00ff8a412 | [
"MIT"
] | null | null | null | edit_file_disini_yan.py | rumputliar/lazada1 | 52450c465de0d22cf03e0010a43d58f00ff8a412 | [
"MIT"
] | null | null | null | edit_file_disini_yan.py | rumputliar/lazada1 | 52450c465de0d22cf03e0010a43d58f00ff8a412 | [
"MIT"
] | null | null | null | import time
import undetected_chromedriver as UC
import pyfiglet as pf
import matplotlib.pyplot as plt
from selenium.common.exceptions import *
from selenium.webdriver.support.ui import WebDriverWait as wd
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from... | 36.388489 | 106 | 0.563859 | import time
import undetected_chromedriver as UC
import pyfiglet as pf
import matplotlib.pyplot as plt
from selenium.common.exceptions import *
from selenium.webdriver.support.ui import WebDriverWait as wd
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from... | true | true |
1c2378aa16f4286adb3bfd6314f03b74a9b27b0a | 732 | py | Python | sm2/regression/tests/generate_lasso.py | jbrockmendel/sm2 | c02a3f9a4fcba35ffc8c852ca5ad8b9d7620f4cf | [
"BSD-3-Clause"
] | 1 | 2021-08-02T13:48:59.000Z | 2021-08-02T13:48:59.000Z | sm2/regression/tests/generate_lasso.py | jbrockmendel/sm2 | c02a3f9a4fcba35ffc8c852ca5ad8b9d7620f4cf | [
"BSD-3-Clause"
] | 24 | 2018-03-26T00:44:58.000Z | 2018-10-09T17:06:07.000Z | sm2/regression/tests/generate_lasso.py | jbrockmendel/sm2 | c02a3f9a4fcba35ffc8c852ca5ad8b9d7620f4cf | [
"BSD-3-Clause"
] | null | null | null | """
Generate data sets for testing OLS.fit_regularized
After running this script, rerun lasso_r_results.R in R to rebuild the
results file "glmnet_r_results.py".
Currently only tests OLS. Our implementation covers GLS, but it's not
clear if glmnet does.
"""
import os
import numpy as np
n = 300
p = 5
np.random.see... | 23.612903 | 70 | 0.70765 | import os
import numpy as np
n = 300
p = 5
np.random.seed(83423)
exog = np.random.normal(size=(n, p))
params = (-1.)**np.arange(p)
params[::3] = 0
expval = np.dot(exog, params)
endog = expval + np.random.normal(size=n)
data = np.concatenate((endog[:, None], exog), axis=1)
data = np.around(100 * data)
here = os.pat... | true | true |
1c2379cf5ff333d094483df3524bb2c4bb0923d4 | 5,915 | py | Python | sandbox/legacy_plot_code/plot_icd_mass_multimontage.py | boada/ICD | c1bfedf5f8e5b0e9f77c6d1194bf1e0266d7efd8 | [
"MIT"
] | null | null | null | sandbox/legacy_plot_code/plot_icd_mass_multimontage.py | boada/ICD | c1bfedf5f8e5b0e9f77c6d1194bf1e0266d7efd8 | [
"MIT"
] | null | null | null | sandbox/legacy_plot_code/plot_icd_mass_multimontage.py | boada/ICD | c1bfedf5f8e5b0e9f77c6d1194bf1e0266d7efd8 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# File: montage.py
# Created on: Mon Mar 18 10:08:05 2013
# Last Change: Tue Aug 20 14:17:48 2013
# Purpose of script: <+INSERT+>
# Author: Steven Boada
import img_scale
import pyfits as pyf
import pylab as pyl
from mpl_toolkits.axes_grid1 import axes_grid
#from mk_galaxy_struc import mk_galaxy_s... | 33.230337 | 80 | 0.626205 |
import img_scale
import pyfits as pyf
import pylab as pyl
from mpl_toolkits.axes_grid1 import axes_grid
import cPickle as pickle
import os
from random import choice
def mk_image(galaxy):
base = './../../images_v5/GS_2.5as_matched/gs_all_'
i_img = pyf.getdata(base+str(galaxy)+'_I.fits')
j_img = pyf... | false | true |
1c2379d99099f6ae5edb52970e530bb5b984aef9 | 1,820 | py | Python | dev/bloomfiltertest.py | libercoinproject/LMessage | d284a450f52ad6e98d4ec18379542405d766c854 | [
"MIT",
"BSD-2-Clause-FreeBSD"
] | 1 | 2018-08-13T15:42:27.000Z | 2018-08-13T15:42:27.000Z | dev/bloomfiltertest.py | libercoinproject/LMessage | d284a450f52ad6e98d4ec18379542405d766c854 | [
"MIT",
"BSD-2-Clause-FreeBSD"
] | null | null | null | dev/bloomfiltertest.py | libercoinproject/LMessage | d284a450f52ad6e98d4ec18379542405d766c854 | [
"MIT",
"BSD-2-Clause-FreeBSD"
] | null | null | null | from math import ceil
from os import stat, getenv, path
from pybloom import BloomFilter as BloomFilter1
from pybloomfilter import BloomFilter as BloomFilter2
import sqlite3
from time import time
# Ubuntu: apt-get install python-pybloomfiltermmap
conn = sqlite3.connect(path.join(getenv("HOME"), '.config/PyLMessage/mes... | 29.836066 | 99 | 0.66044 | from math import ceil
from os import stat, getenv, path
from pybloom import BloomFilter as BloomFilter1
from pybloomfilter import BloomFilter as BloomFilter2
import sqlite3
from time import time
conn = sqlite3.connect(path.join(getenv("HOME"), '.config/PyLMessage/messages.dat'))
conn.text_factory = str
cur = conn.c... | false | true |
1c237a8b78294b4a245c9aab256986e2c6285a29 | 4,002 | py | Python | 2019/day24.py | dopplershift/advent-of-code | dfb722c8600e902b65cb9f10a16c11a2ab40db8c | [
"MIT"
] | 3 | 2020-12-10T02:45:51.000Z | 2020-12-25T23:16:45.000Z | 2019/day24.py | dopplershift/advent-of-code | dfb722c8600e902b65cb9f10a16c11a2ab40db8c | [
"MIT"
] | null | null | null | 2019/day24.py | dopplershift/advent-of-code | dfb722c8600e902b65cb9f10a16c11a2ab40db8c | [
"MIT"
] | 2 | 2020-12-02T03:37:04.000Z | 2021-12-04T18:45:44.000Z | def cycle_board(board):
seq = set()
while True:
if tuple(board) in seq:
break
seq.add(tuple(board))
next_board = []
for r, line in enumerate(board):
row = []
for c, char in enumerate(line):
count = 0
if r > 0 and... | 33.630252 | 87 | 0.434533 | def cycle_board(board):
seq = set()
while True:
if tuple(board) in seq:
break
seq.add(tuple(board))
next_board = []
for r, line in enumerate(board):
row = []
for c, char in enumerate(line):
count = 0
if r > 0 and... | true | true |
1c237aa86a5947361476d22f8e8bdd796da91416 | 14,448 | py | Python | notebooks/134.0-BDP-embed-revamp.py | zeou1/maggot_models | 4e1b518c2981ab1ca9607099c3813e8429d94ca4 | [
"BSD-3-Clause"
] | null | null | null | notebooks/134.0-BDP-embed-revamp.py | zeou1/maggot_models | 4e1b518c2981ab1ca9607099c3813e8429d94ca4 | [
"BSD-3-Clause"
] | null | null | null | notebooks/134.0-BDP-embed-revamp.py | zeou1/maggot_models | 4e1b518c2981ab1ca9607099c3813e8429d94ca4 | [
"BSD-3-Clause"
] | null | null | null | # %% [markdown]
# ##
import os
import time
import warnings
from itertools import chain
import colorcet as cc
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.transforms as transforms
import networkx as nx
import numpy as np
import pandas as pd
import seaborn as sns
from anytree import LevelOr... | 25.708185 | 86 | 0.650471 |
port os
import time
import warnings
from itertools import chain
import colorcet as cc
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.transforms as transforms
import networkx as nx
import numpy as np
import pandas as pd
import seaborn as sns
from anytree import LevelOrderGroupIter, NodeMixi... | true | true |
1c237bb1cc84dcdc35a49ed566430a75d675c3a6 | 2,177 | py | Python | lldb/packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py | tkf/opencilk-project | 48265098754b785d1b06cb08d8e22477a003efcd | [
"MIT"
] | 2 | 2019-05-24T14:10:24.000Z | 2019-05-24T14:27:38.000Z | packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py | DalavanCloud/lldb | e913eaf2468290fb94c767d474d611b41a84dd69 | [
"Apache-2.0"
] | 10 | 2018-05-27T23:16:42.000Z | 2019-09-30T13:28:45.000Z | packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py | DalavanCloud/lldb | e913eaf2468290fb94c767d474d611b41a84dd69 | [
"Apache-2.0"
] | 3 | 2019-12-21T06:35:35.000Z | 2020-06-07T23:18:58.000Z | """
Test some lldb command abbreviations.
"""
from __future__ import print_function
import lldb
import os
import time
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class FatArchiveTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
... | 35.688525 | 91 | 0.651814 | from __future__ import print_function
import lldb
import os
import time
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class FatArchiveTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
NO_DEBUG_INFO_TESTCASE = True
@skipUnl... | true | true |
1c237bfe5683d592666f969ae0b58cf2169f7653 | 92,682 | py | Python | ion_functions/data/vel_functions.py | steinermg/ion-functions | cea532ad9af51e86768572c8deb48547d99567c5 | [
"Apache-2.0"
] | 6 | 2019-05-06T21:06:12.000Z | 2021-09-15T08:34:30.000Z | ion_functions/data/vel_functions.py | steinermg/ion-functions | cea532ad9af51e86768572c8deb48547d99567c5 | [
"Apache-2.0"
] | 4 | 2018-09-11T21:17:04.000Z | 2019-12-09T19:39:52.000Z | ion_functions/data/vel_functions.py | steinermg/ion-functions | cea532ad9af51e86768572c8deb48547d99567c5 | [
"Apache-2.0"
] | 10 | 2017-04-26T22:56:18.000Z | 2021-06-30T00:07:43.000Z | #!/usr/bin/env python
"""
@package ion_functions.data.vel_functions
@file ion_functions/data/vel_functions.py
@author Stuart Pearce, Russell Desiderio
@brief Module containing velocity family instrument related functions
"""
import numpy as np
import numexpr as ne
from numpy import sin, cos, radians
from ion_function... | 43.67672 | 102 | 0.662308 |
"""
@package ion_functions.data.vel_functions
@file ion_functions/data/vel_functions.py
@author Stuart Pearce, Russell Desiderio
@brief Module containing velocity family instrument related functions
"""
import numpy as np
import numexpr as ne
from numpy import sin, cos, radians
from ion_functions.data.generic_functi... | false | true |
1c237c1d6fbbd8fb10c3fb355c711820e8d98b10 | 1,936 | py | Python | rpython/translator/cli/test/test_standalone.py | kantai/passe-pypy-taint-tracking | b60a3663f8fe89892dc182c8497aab97e2e75d69 | [
"MIT"
] | 2 | 2016-07-06T23:30:20.000Z | 2017-05-30T15:59:31.000Z | rpython/translator/cli/test/test_standalone.py | kantai/passe-pypy-taint-tracking | b60a3663f8fe89892dc182c8497aab97e2e75d69 | [
"MIT"
] | null | null | null | rpython/translator/cli/test/test_standalone.py | kantai/passe-pypy-taint-tracking | b60a3663f8fe89892dc182c8497aab97e2e75d69 | [
"MIT"
] | 2 | 2020-07-09T08:14:22.000Z | 2021-01-15T18:01:25.000Z | import subprocess
from rpython.translator.c.test.test_standalone import TestStandalone as CTestStandalone
from rpython.annotator.listdef import s_list_of_strings
from rpython.translator.translator import TranslationContext
from rpython.translator.cli.sdk import SDK
class CliStandaloneBuilder(object):
def __init__... | 35.2 | 87 | 0.669421 | import subprocess
from rpython.translator.c.test.test_standalone import TestStandalone as CTestStandalone
from rpython.annotator.listdef import s_list_of_strings
from rpython.translator.translator import TranslationContext
from rpython.translator.cli.sdk import SDK
class CliStandaloneBuilder(object):
def __init__... | true | true |
1c237c8108707a843172e4789e8bafa54ae6a274 | 40,601 | py | Python | tutorials/tutorial_views.py | Nightfurex/MSS | 51a1bc0d4ce759288b5f3a0a46e538aa0c1a8788 | [
"Apache-2.0"
] | null | null | null | tutorials/tutorial_views.py | Nightfurex/MSS | 51a1bc0d4ce759288b5f3a0a46e538aa0c1a8788 | [
"Apache-2.0"
] | null | null | null | tutorials/tutorial_views.py | Nightfurex/MSS | 51a1bc0d4ce759288b5f3a0a46e538aa0c1a8788 | [
"Apache-2.0"
] | null | null | null | """
mss.tutorials.tutorial_views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This python script generates an automatic demonstration of how to use the top view, side view, table view and
linear view section of Mission Support System in creating a operation and planning the flightrack.
This file is part of mss.
... | 43.423529 | 122 | 0.545331 |
import pyautogui as pag
import multiprocessing
import sys
from sys import platform
from pyscreeze import ImageNotFoundException
from tutorials import screenrecorder as sr
from mslib.msui import mss_pyui
def initial_ops():
pag.sleep(5)
if platform == "linux" or platform == "linux2":
pag.hotkey('winlef... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.