max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
teacher/explanation/__init__.py | Kaysera/fuzzy-lore | 3 | 12768451 | <filename>teacher/explanation/__init__.py<gh_stars>1-10
from ._factual import FID3_factual, m_factual, mr_factual, c_factual
from ._counterfactual import FID3_counterfactual, i_counterfactual, f_counterfactual
from .FID3_explainer import FID3Explainer
from .FDT_explainer import FDTExplainer
__all__ = [
"FID3_factua... | 1.539063 | 2 |
Python-desenvolvimento/ex031.py | MarcosMaciel-MMRS/Desenvolvimento-python | 0 | 12768452 | <filename>Python-desenvolvimento/ex031.py
#custo de uma viagem. ate 200km( R$0,50), mais q isso (R$0,45)
distancia = float(input('Informe a distância: '))
print('Por essa distância {}km: '.format(distancia))
if distancia <= 200:
preco = distancia * 0.50
print('O valor da passagem será de R${:.2f}.'.format... | 4.15625 | 4 |
src/openpersonen/api/tests/test_data/kind.py | maykinmedia/open-personen | 2 | 12768453 | <reponame>maykinmedia/open-personen
KIND_RETRIEVE_DATA = {
"_embedded": {
"naam": {
"_embedded": {
"inOnderzoek": {
"_embedded": {
"datumIngangOnderzoek": {
"dag": None,
"datum": N... | 1.46875 | 1 |
spyce/test/support.py | markrwilliams/capysicum | 7 | 12768454 | <filename>spyce/test/support.py<gh_stars>1-10
import contextlib
import tempfile
import unittest
import socket
import errno
import sys
import os
class ErrnoMixin(unittest.TestCase):
@contextlib.contextmanager
def assertRaisesWithErrno(self, exc, errno):
with self.assertRaises(exc) as caught_ce:
... | 2.203125 | 2 |
auxCallsHandler.py | storage4grid/s4g-electric-vehicle-analytics | 0 | 12768455 | <reponame>storage4grid/s4g-electric-vehicle-analytics
import os, json, time
| 0.902344 | 1 |
phase4.py | NimaVahdat/SNN-Framework- | 0 | 12768456 | import torch
from cnsproject.network.neural_populations import LIFPopulation, ELIFPopulation, AELIFPopulation
from cnsproject.network.monitors import Monitor
from cnsproject.network.connections import DenseConnection, RandomConnection
from cnsproject.plotting.plotting import plot_current, raster, population_activi... | 2.296875 | 2 |
nere/ner_models/bilstm_att.py | WangShengguang/NERE | 0 | 12768457 | <filename>nere/ner_models/bilstm_att.py
import torch
import torch.nn as nn
import torch.nn.functional as F
class BiLSTM_ATT(nn.Module):
def __init__(self, vocab_size, num_ent_tags, ent_emb_dim, batch_size, sequence_len):
super(BiLSTM_ATT, self).__init__()
self.batch_size = batch_size
self.... | 2.5 | 2 |
bank/src/bank_account_app/views.py | yuramorozov01/bank_system | 0 | 12768458 | from bank_account_app.models import BankAccount
from bank_account_app.permissions import (CanChangeBankAccount,
CanViewBankAccount)
from bank_account_app.serializers import (BankAccountDetailsSerializer,
BankAccountShortDetailsSerialize... | 1.960938 | 2 |
jtracker/__init__.py | jthub/jt-cli | 2 | 12768459 | __version__ = '0.2.0a33'
| 1.054688 | 1 |
poker/hand.py | ensley/poker | 0 | 12768460 | <reponame>ensley/poker<filename>poker/hand.py<gh_stars>0
import collections
from poker import card
class Hand(collections.MutableSequence):
"""docstring for Hand"""
def __init__(self, cards):
cards = cards.split()
cards = [card.Card(c) for c in cards]
if len(cards) != 5:
raise ValueError('A hand must have ... | 3.265625 | 3 |
package/zimagi/exceptions.py | zimagi/zima | 0 | 12768461 | <filename>package/zimagi/exceptions.py<gh_stars>0
import sys
import traceback
def format_exception_info():
exc_type, exc_value, exc_tb = sys.exc_info()
return traceback.format_exception(exc_type, exc_value, exc_tb)
class ParameterError(Exception):
pass
class CodecError(Exception):
pass
class Comma... | 2.3125 | 2 |
delphin/mrs/path.py | matichorvat/pydelphin | 9 | 12768462 | """
Classes and functions for path exploration on semantic graphs.
"""
#import pdb
import re
import warnings
from collections import deque, defaultdict
from itertools import product
from .components import (Pred, links, var_sort)
from .util import powerset
from .config import IVARG_ROLE
from delphin.exceptions import... | 2.34375 | 2 |
PY_Basics/test_square.py | CodexLink/StashedCodes | 0 | 12768463 | <reponame>CodexLink/StashedCodes<gh_stars>0
import math
def test_sqrt():
num = 25
assert math.sqrt(num) == 5
def test_square():
num = 7
assert num * num == 49
| 2.046875 | 2 |
toolbox/visualization/bin/setup.py | brennengreen/NIRFAST-Parallel | 1 | 12768464 | # for building the exe:
# python setup.py py2exe --includes sip
from distutils.core import setup
from py2exe.build_exe import py2exe
from glob import glob
import py2exe
import sys
sys.path.append("C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\redist\\x86\\Microsoft.VC90.CRT")
data_files = [("Mic... | 1.804688 | 2 |
tests/test_airflownetworkdistributioncomponentduct.py | marcelosalles/pyidf | 19 | 12768465 | import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.natural_ventilation_and_duct_leakage import AirflowNetworkDistributionComponentDuct
log = logging.getLogger(__name__)
class TestAirflowNetworkDistributionComponentDuct(unittest.... | 2.40625 | 2 |
ls/sampleproject/tests/test_square_builder.py | linuxsoftware/ls.SampleProject | 0 | 12768466 | # ------------------------------------------------------------------------------
# Unittests
# ------------------------------------------------------------------------------
import sys
import os.path
from unittest import TestCase
from ls.sampleproject import SquareBuilder
class TestSquareBuilder(TestCase):
def se... | 3.21875 | 3 |
portfolio/display/models.py | vasu1818/django-Portfolio | 0 | 12768467 | <reponame>vasu1818/django-Portfolio
from django.db import models
# Create your models here.
class Profile(models.Model):
image = models.ImageField(upload_to="images/")
summary = models.CharField(max_length=200) | 2.03125 | 2 |
tests/test_executors.py | smartlegionlab/commandpack | 1 | 12768468 | <filename>tests/test_executors.py
# -*- coding: utf-8 -*-
# --------------------------------------------------------
# Licensed under the terms of the BSD 3-Clause License
# (see LICENSE for details).
# Copyright © 2018-2021, <NAME>
# All rights reserved.
# -------------------------------------------------------
import... | 2.765625 | 3 |
cam/models.py | 4the1appdevs/face_recognition | 1 | 12768469 | # -*- coding: utf-8 -*-
#from pkg_resources import resource_filename
class dlib_model:
def pose_predictor_model_location():
return "./models/dlib/shape_predictor_68_face_landmarks.dat"
def pose_predictor_five_point_model_location():
return "./models/dlib/shape_predictor_5_face_landmarks.dat"
def face_... | 1.695313 | 2 |
syntacticframes_project/syntacticframes/migrations/0007_auto_20141106_2121.py | aymara/verbenet-editor | 0 | 12768470 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('syntacticframes', '0006_auto_20141103_0939'),
]
operations = [
migrations.AlterModelOptions(
name='verbnetclass'... | 1.53125 | 2 |
helpers/rally.py | klehman-rally/rasl-theia | 0 | 12768471 | <filename>helpers/rally.py<gh_stars>0
import sys
import time
import json
import re
import time
import string
from collections import OrderedDict
import requests
RALLY_BASE_URL = 'https://rally1.rallydev.com/slm/webservice/v2.0'
RALLY_ART_ID_PATTERN = re.compile(r'\b((?:US|S|DE|DS|TA|TC|F|I|T)\d{1,7})\b')
PAGESIZE = ... | 2.421875 | 2 |
basics/singals_and_slots_1.py | klinga/pyside-tests | 0 | 12768472 | <filename>basics/singals_and_slots_1.py
import sys
from PySide2.QtCore import QSize, Qt
from PySide2.QtWidgets import QApplication, QMainWindow, QPushButton
class MainWindow(QMainWindow):
"""
Subclass QMainWindow
"""
def __init__(self):
super().__init__()
# variables
self.bu... | 2.953125 | 3 |
setup.py | m4ce/google-drive-api | 2 | 12768473 | <reponame>m4ce/google-drive-api
from distutils.core import setup
version = '0.0.4'
setup(
name = 'google-drive-api',
packages = ['google_drive'],
version = version,
description = 'Python library for Google Drive API',
author = '<NAME>',
author_email = '<EMAIL>',
url = 'https://github.com/m4ce/google-dri... | 1.4375 | 1 |
u24_lymphocyte/third_party/treeano/sandbox/nodes/tests/wta_sparsity_test.py | ALSM-PhD/quip_classification | 45 | 12768474 | import nose.tools as nt
import numpy as np
import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn
from treeano.sandbox.nodes import wta_sparisty as wta
fX = theano.config.floatX
def test_wta_spatial_sparsity_node_serialization():
tn.check_serialization(wta.WTASpatialSparsityNode("a"... | 2.015625 | 2 |
tests/test_checker.py | parafoxia/len8 | 3 | 12768475 | # Copyright (c) 2021-2022, <NAME>, Jonxslays
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditi... | 1.445313 | 1 |
810/HW04_Test_Qi_Zhao.py | qiblaqi/Stevens-Python-Course-ByQ.Zhao | 0 | 12768476 | """
this is a program contains Test Class for HW04
Written by <NAME>
"""
import unittest as ut
import HW04_Qi_Zhao as HW04
class TestFraction(ut.TestCase):
#Test cases class with extended test cases.
def test_simplify(self):
self.assertEqual(HW04.Fraction(9, 27).simplify(),HW04.Fraction(1,3))
... | 3.421875 | 3 |
pmworker/document_file.py | ciur/papermerge-worker | 2 | 12768477 | import os
class DocumentFile:
def __init__(self, fmtdirstr, file_name, media_root):
self.fmtdirstr = fmtdirstr
self.file_name = file_name
self.media_root = media_root
@property
def dir_path(self):
return os.path.join(
self.media_root,
self.fmtdirstr... | 3.15625 | 3 |
codes_/0705_Design_HashSet.py | SaitoTsutomu/leetcode | 0 | 12768478 | # %% [705. Design HashSet](https://leetcode.com/problems/design-hashset/)
class MyHashSet(set):
remove = set.discard
contains = set.__contains__
| 2.03125 | 2 |
script/main.py | MakiSakurai/robosys2021_homework2 | 0 | 12768479 | <filename>script/main.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
import moveit_commander
import geometry_msgs.msg
import math
from geometry_msgs.msg import Point
from geometry_msgs.msg import Twist
from robosys2021_homework2.msg import CustomArray
class pose_main():
def __init__(self):
... | 2.734375 | 3 |
v2ex_daily_mission/notifier/slack.py | lord63/v2ex_daily_mission | 44 | 12768480 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import json
import requests
from v2ex_daily_mission.notifier.abc import Notifier, NotificationSendFailedException
class SlackNotifier(Notifier):
def __init__(self, config):
self.config = config
def send_notificati... | 2.859375 | 3 |
dserver/config.py | dandk105/Asyncpyserver | 0 | 12768481 | # -*- coding: utf-8 -*-
# tab level: 4
#!/usr/bin/env python3
"""this module will control all settings
"""
import logging
import logging.config
import logging.handlers
import json
import os
from pathlib import Path
from mytemplate.errorclass import CustomError as customerr
logger = logging.getLogger(__name__)
logge... | 2.53125 | 3 |
stop/exit.py | J-Massey/postproc | 0 | 12768482 | # -*- coding: utf-8 -*-
"""
@author: <NAME>
@description: Graceful stopping condition
@contact: <EMAIL>
"""
import signal
import time
import subprocess
from pathlib import Path
class GracefulKiller:
kill_now = False
def __init__(self):
signal.signal(signal.SIGINT, self.exit_gracefully)
signal.... | 2.546875 | 3 |
Python/hardware/HardwareDevices.py | marcostrullato/RoobertV2 | 0 | 12768483 | #!/usr/bin/env python
# Roobert V2 - second version of home robot project
# ________ ______ _____
# ___ __ \______________ /_______________ /_
# __ /_/ / __ \ __ \_ __ \ _ \_ ___/ __/
# _ _, _// /_/ / /_/ / /_/ / __/ / / /_
# /_/ |_| \____/\____//... | 1.75 | 2 |
Day_6_Lists/lists_g1.py | ValRCS/Python_TietoEvry_Sep2021 | 0 | 12768484 | # # # you have some similar items that you want to store
# a1 = 3
# a2 = 5
# a3 = 8
# # ...
# a100 = 151
# # # # # # # There has to be a better way
# #
# # # # # # # # # What is a list after all?
# # # # # # # # # * ordered
# # # # # # # # # * collection of arbitrary objects (anything goes in)
# # # # # # # # # * neste... | 4.625 | 5 |
attic/iterables/almost_aritprog_v0.py | matteoshen/example-code | 5,651 | 12768485 | """
Arithmetic progression class
>>> ap = ArithmeticProgression(1, .5, 3)
>>> list(ap)
[1.0, 1.5, 2.0, 2.5]
"""
from collections import abc
class ArithmeticProgression:
def __init__(self, begin, step, end):
self.begin = begin
self.step = step
self.end = end
def __iter... | 3.6875 | 4 |
examples/all.py | yukkun007/mmbooks | 0 | 12768486 | <gh_stars>0
from typing import List
from moz_books import Calil, Google, OpenDB, Rakuten, SearchParams
from moz_books.interface.i_service import IService
from moz_books.log import get_logger
LOGGER = get_logger(__name__)
def search(params: SearchParams):
services: List[IService] = [Rakuten(), Google(), OpenDB()... | 2.390625 | 2 |
libcity/executor/map_matching_executor.py | moghadas76/test_bigcity | 221 | 12768487 | from logging import getLogger
from libcity.executor.abstract_tradition_executor import AbstractTraditionExecutor
from libcity.utils import get_evaluator
class MapMatchingExecutor(AbstractTraditionExecutor):
def __init__(self, config, model):
self.model = model
self.config = config
self.ev... | 2.484375 | 2 |
snoop/data/celery.py | liquidinvestigations/hoover-snoop2 | 0 | 12768488 | <gh_stars>0
"""Configuration for Celery.
Logging and Settings for Celery are all handled here.
"""
import logging
import os
from celery import Celery
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "snoop.defaultsettings")
app = Celery('snoop.data')
app.conf.update(
worker_log_format="[%(asctime)s: %(name)s %(... | 2 | 2 |
copilot-read-email.py | ghoelzer-rht/python-copilot-experiments | 0 | 12768489 | # Create program to read email from Gmail account and perform a sentiment analysis on the email.
import imaplib
import email
import email.message
import email.utils
import re
import datetime
import sys
import os
# import pandas as pd
# import numpy as np
# import matplotlib.pyplot as plt
# from matplotlib.b... | 2.953125 | 3 |
Two_Pointers/Tests.py | daniel-zeiler/potential-happiness | 0 | 12768490 | <reponame>daniel-zeiler/potential-happiness<filename>Two_Pointers/Tests.py
import unittest
from typing import List
import Two_Pointers.Solutions as two_pointer
import Two_Pointers.Solutions_Two as two_pointer_two
import Linked_List.Tests as linked_list
def print_list(head: linked_list.ListNode):
result = []
... | 3.765625 | 4 |
euler/60_1.py | stauntonknight/algorithm | 0 | 12768491 | <reponame>stauntonknight/algorithm
limit = 10000
primes = primelist(limit)
s1 = dict()
s2 = set()
s3 = set()
s4 = set()
for p in primes:
s1[p] = set()
for s in s1:
if isprime(int(str(p) + str(s)), primes) and isprime(int(str(s) + str(p)), primes):
s1[s].add(p)
s1[p].add(s... | 2.859375 | 3 |
marrow/util/context/__init__.py | isprime/marrow.util | 0 | 12768492 | <filename>marrow/util/context/__init__.py
# encoding: utf-8
import os
from contextlib import contextmanager
__all__ = ['cd', 'path']
@contextmanager
def cd(path, on=os):
"""Change the current working directory within this context.
Preserves the previous working directory and can be applied to remote... | 2.5625 | 3 |
bot.py | Rishiraj0100/world-chat | 14 | 12768493 | <filename>bot.py
"""
MIT License
Copyright (c) 2021 deadshot
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, mer... | 1.9375 | 2 |
setup.py | M-o-a-T/ping3 | 0 | 12768494 | import setuptools
with open('README.md') as f:
long_desc = f.read()
setuptools.setup(
name='asyncping3',
use_scm_version={"version_scheme": "guess-next-dev", "local_scheme": "dirty-tag"},
setup_requires=["setuptools_scm"],
description='A pure python3 version of ICMP ping implementation using raw s... | 1.382813 | 1 |
setup.py | neilalbrock/flask-elasticutils | 1 | 12768495 | <reponame>neilalbrock/flask-elasticutils
import os
from setuptools import setup
def _read(fn):
path = os.path.join(os.path.dirname(__file__), fn)
return open(path).read()
setup(
name='Flask-ElasticUtils',
version='0.1.7',
url='https://github.com/neilalbrock/flask-elasticutils/',
license='BSD... | 1.34375 | 1 |
automl_in_action/3_adanet/1_simple_boston.py | wdxtub/deep-learning-note | 37 | 12768496 | <filename>automl_in_action/3_adanet/1_simple_boston.py
import functools
import os
import adanet
import tensorflow as tf
# 固定种子
RANDOM_SEED = 42
LOG_DIR = 'models'
'''
In this example, we will solve a regression task known as the Boston Housing dataset to
predict the price of suburban houses in Boston, MA in the 19... | 3.28125 | 3 |
Basics/exercises/online_dictionary_problem.py | AMZEnterprise/Python_Course_Jadi | 0 | 12768497 | words_count = int(input())
words_dict = {}
def add_word(word,definition):
words_dict[word] = definition
def translate_sentence(words_list):
sentence = ""
for word in words_list:
if word in words_dict:
sentence += words_dict[word] + " "
else:
sentence += word + " "... | 3.9375 | 4 |
classNotes/control_structures2,3/Selection3/control_structures.py | minefarmer/Think_like_a_programmer | 0 | 12768498 | ''' Control Structures
A statement used to control the flow of execution in a program is called a control structure.
Types of control structures
1. Sequence ******************************************************
In a sequential structure the statements are executed in the same order in which they a... | 3.265625 | 3 |
bii_webapp/apps/accounts/views.py | ISA-tools/bii-webapp | 2 | 12768499 | <filename>bii_webapp/apps/accounts/views.py
from django.contrib.auth.decorators import login_required
from django.shortcuts import redirect,render
from forms import ProfileForm,UserForm
from models import UserProfile
@login_required
def profile(request):
user = request.user
profile,created=UserProf... | 2.109375 | 2 |
Python/033 SearchInRotatedArrayI.py | Fiona08/leetcode | 0 | 12768500 | #33
# Time: O(logn)
# Space: O(1)
# Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
# (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).
#
# You are given a target value to search. If found in the array return its index, otherwise return -1.
#
# You may assume no dupli... | 3.734375 | 4 |
xlmhg/result.py | flo-compbio/xlmhg | 15 | 12768501 | # Copyright (c) 2016-2019 <NAME>
#
# This file is part of XL-mHG.
"""Contains the `mHGResult` class."""
import sys
import hashlib
import logging
import numpy as np
try:
# This is a duct-tape fix for the Google App Engine, on which importing
# the C extension fails.
from . import mhg_cython
except Import... | 2.203125 | 2 |
src/sphinx_c_autodoc/napoleon/__init__.py | speedyleion/sphinx-c-doc | 7 | 12768502 | """
Extend napoleon to provide a `Members` section for C structs and unions
similar to the `Attributes` section in python objects.
"""
from functools import partial
from typing import Optional, Any, List, Union, Dict, Callable
from sphinx.config import Config
from sphinx.ext.autodoc import Options
from sphinx.applica... | 2.390625 | 2 |
BitTorrent-5.2.2/BTL/likewin32api.py | jpabb7/p2pScrapper | 4 | 12768503 | import ctypes
DWORD = ctypes.c_ulong
MAX_PATH = ctypes.c_int(260)
MAX_PATH_NULL = int(MAX_PATH.value) + 1
def decode(s):
if isinstance(s, unicode):
return s
return s.decode('mbcs')
def GetModuleFileName(handle):
r = 0
if hasattr(ctypes.windll.kernel32, "GetModuleFileNameW"):
name = ... | 2.15625 | 2 |
fetalnav/transforms/itk_transforms.py | ntoussaint/fetalnav | 24 | 12768504 | <gh_stars>10-100
# emacs: -*- coding: utf-8; mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
"""
Relevant Transforms of 2D/3D Biomedical Images using itk (sitk) images.
Transforms
1. ITK image to another ITK image
2. ITK image to pytorch tensors
3. Pytorch tensors to ITK images
"""
# Authors:
# <NAME> <<... | 2.984375 | 3 |
games/detection_game.py | ieee-uh-makers/pi-workshop | 0 | 12768505 | <reponame>ieee-uh-makers/pi-workshop
import time
from typing import List
import random
class Region(object):
def __init__(self, x, y, w, h):
self.x = x
self.y = y
self.w = w
self.h = h
def __repr__(self):
return "X: %d Y: %d W: %d H: %d" % (self.x, self.y, self.w, self... | 3.234375 | 3 |
attic/readjsonQ4.py | CitizenScienceInAstronomyWorkshop/pyIBCC | 11 | 12768506 | # created 2013 Feb 23 by MES
# reads in all Q4 simulation json files in directory and outputs to Q4sim_positions.txt
# the start x and end x position of tne injected transit(s) if present
# not all Q4 simulations jsons will have a planet transit in it so if there is no planet transit
# present in a given json ... | 2.703125 | 3 |
tests/unit_tests/test_nn/test_converters/test_tensorflow/test_Reshape.py | samysweb/dnnv | 5 | 12768507 | import numpy as np
import pytest
from dnnv.nn.converters.tensorflow import *
from dnnv.nn.operations import *
def test_Reshape():
original_shape = [0, 3, 4]
data = np.random.random_sample(original_shape).astype(np.float32)
new_shape = np.array([3, 4, 0], dtype=np.int64)
y = np.reshape(data, new_shape... | 2.328125 | 2 |
autosub3/__init__.py | henry40408/autosub | 10 | 12768508 | <gh_stars>1-10
#!/usr/bin/env python3
"""
Usage:
autosub3.py -h | --help
autosub3.py --list-formats
autosub3.py --list-languages
autosub3.py [options] <source>
Options:
-h --help Show this screen
-q --quiet Do NOT show progress bar
-C --concurrency=<concurr... | 2.453125 | 2 |
tayph/ccf.py | bmorris3/tayph | 0 | 12768509 | <reponame>bmorris3/tayph
__all__ = [
"xcor",
"clean_ccf",
"filter_ccf",
"shift_ccf",
"construct_KpVsys"
]
def xcor(list_of_wls,list_of_orders,wlm,fxm,drv,RVrange,plot=False,list_of_errors=None):
"""
This routine takes a combined dataset (in the form of lists of wl spaces,
spectral ord... | 2.34375 | 2 |
platform/core/tests/test_encryptor/test_service.py | hackerwins/polyaxon | 0 | 12768510 | <filename>platform/core/tests/test_encryptor/test_service.py<gh_stars>0
import pytest
from django.test import override_settings
import conf
import encryptor
from encryptor.manager import EncryptionManager
from options.registry.core import ENCRYPTION_KEY, ENCRYPTION_SECRET
from tests.base.case import BaseTest
@pyte... | 2.21875 | 2 |
thresh/__main__.py | 06f7b1afdb2a4801b0dbde6635f227b7/thresh | 0 | 12768511 | <gh_stars>0
import sys
from . import main
main(sys.argv[1:])
| 1.140625 | 1 |
superradiance_plot.py | matthewjstott/AlpPy | 0 | 12768512 | #!/usr/bin/python
import sys, platform, os
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
from matplotlib import pyplot
import numpy as np
from matplotlib.patches import Ellipse
import camb
from camb import model, initialpower
from pysm.nominal import models
import healpy as hp
import site
plt.... | 2.265625 | 2 |
tests/test_compose/test_write/test_tag/test_div.py | schireson/htmxl | 2 | 12768513 | from tests.utils import WriteTests
class WriteDiv(WriteTests):
fixture_dir = "tests/fixtures/templates/tags/div"
class TestAdjacentDivs(WriteDiv):
template_file = "adjacent_divs.html.jinja2"
expected_result_file = "adjacent_divs.xlsx"
class TestContainedDivs(WriteDiv):
template_file = "contained_d... | 2.125 | 2 |
tests/test_lsf_config.py | NBMueller/lsf | 0 | 12768514 | from io import StringIO
from tests.src.lsf_config import Config
class TestBool:
def test_empty_returns_false(self):
config = Config({})
assert not config
def test_non_empty_returns_true(self):
config = Config({1: 1})
assert config
class TestDefaultConstructor:
def test... | 2.515625 | 3 |
models/MF/IALS.py | yigitozgumus/PolimiRecSys2018 | 0 | 12768515 | import numpy as np
from base.RecommenderUtils import check_matrix
from base.BaseRecommender import RecommenderSystem
from tqdm import tqdm
import models.MF.Cython.MF_RMSE as mf
class IALS_numpy(RecommenderSystem):
'''
binary Alternating Least Squares model (or Weighed Regularized Matrix Factorization)
Re... | 2.578125 | 3 |
django_crud/views.py | Francislley/crudDjango170118 | 0 | 12768516 | from copy import copy
import uuid
from pprint import pprint
from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django import forms
from django.template.defaultfilters import striptags
from django.conf import settings
from django.utils.h... | 1.914063 | 2 |
shap/plots/_bar.py | YotamElor/shap | 2 | 12768517 | <reponame>YotamElor/shap<gh_stars>1-10
import warnings
try:
import matplotlib.pyplot as pl
except ImportError:
warnings.warn("matplotlib could not be loaded!")
pass
from ._labels import labels
from ..utils import format_value
from . import colors
import numpy as np
# TODO: improve the bar chart to look be... | 3.390625 | 3 |
exercicio3.py | FelipeFerreiraSS/trabalho-logica-de-programacao-python-ads | 0 | 12768518 | <filename>exercicio3.py
# Número de quantos alunos vão ser cadastrados
numeroAlunos = int(input('Quantos alunos quer cadastrar? '))
notasAlunos = {}
todosAlunos = []
# Usei um for que se repete na quantidade de vezes no número de alunos
for i in range(numeroAlunos):
notasAlunos['aluno'] = input('Qual o nome do alu... | 4 | 4 |
tests/adapters/test_array.py | zackw/pyamf | 14 | 12768519 | <filename>tests/adapters/test_array.py
# Copyright (c) The PyAMF Project.
# See LICENSE.txt for details.
"""
Tests for the L{array} L{miniamf.adapters._array} module.
@since: 0.5
"""
from __future__ import absolute_import
import array
import unittest
import miniamf
class ArrayTestCase(unittest.TestCase):
"""
... | 2.40625 | 2 |
tests/v2/test_auth_api.py | emdeechege/Questionaire-API | 0 | 12768520 | import os,unittest, json
from app import create_app
from instance.config import app_config
from app.connect import QuestionerDB
app = create_app(app_config['testing'])
class UserTestCases(unittest.TestCase):
""" Base test class """
def setUp(self):
""" Defining test variables """
self.app = ... | 3.0625 | 3 |
pythontutorials/books/CrackingCodes/Ch08/PracticeQuestions/Question3.py | JoseALermaIII/python-tutorials | 2 | 12768521 | """Chapter 8 Practice Question 3
Draw the complete truth tables for the and, or, and not operators.
"""
def notTruthTable() -> None:
"""Not truth table.
Prints a truth table for the not operator.
Returns:
None. Only prints out a table.
"""
print(" _________________________\n",
... | 4.4375 | 4 |
applications/pytorch/conformer/tests/convolution.py | payoto/graphcore_examples | 260 | 12768522 | <filename>applications/pytorch/conformer/tests/convolution.py
# Copyright (c) 2021 Graphcore Ltd. 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.... | 2.40625 | 2 |
vocoder_inference.py | jireh-father/Real-Time-Voice-Cloning | 0 | 12768523 | <filename>vocoder_inference.py
from utils.argutils import print_args
from vocoder import inference as vocoder
import numpy as np
import librosa
import argparse
import torch
import traceback
if __name__ == '__main__':
## Info & args
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefa... | 2.359375 | 2 |
src/M_star.py | Eashwar-S/Multi-agent-Pathplanning | 0 | 12768524 | import numpy as np
import heapq
import math
import time
import pygame
class Node:
def __init__(self, state=None, cost=float('inf'), costToCome=float('inf'), parent=None, collision=None):
self.state = state
self.parent = parent
self.cost = cost
self.costToCome = costToCome
s... | 3.0625 | 3 |
Problems/Miscellaneous/Medium/35_champagne_tower.py | andor2718/LeetCode | 1 | 12768525 | <reponame>andor2718/LeetCode
# https://leetcode.com/problems/champagne-tower/
from collections import namedtuple
Coord = namedtuple('Coord', ['row', 'col'])
Glass = namedtuple('Glass', ['in_glass', 'excess'])
class Solution:
def champagneTower(
self, poured: int, query_row: int, query_glass: int) ->... | 3.6875 | 4 |
app/models/res.py | Hansybx/guohe3 | 1 | 12768526 | """
-*- coding: utf-8 -*-
Time : 2019/7/19 8:25
Author : Hansybx
"""
class Res:
code = 200
msg = ''
info = {}
def __init__(self, code, msg, info):
self.code = code
self.msg = msg
self.info = info
| 2.703125 | 3 |
tests/test_select.py | timgates42/goless | 266 | 12768527 | import goless
from goless.backends import current as be
from . import BaseTests
class RecvCaseTests(BaseTests):
chansize = 1
def setUp(self):
BaseTests.setUp(self)
self.ch = goless.chan(self.chansize)
self.ca = goless.rcase(self.ch)
def test_ready(self):
self.assertFalse(... | 2.21875 | 2 |
fetch.py | JonathanKryza/TankFetch | 2 | 12768528 | # Copyright 2013 <NAME>. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 2.6875 | 3 |
cupy/cuda/cutensor.py | prkhrsrvstv1/cupy | 6,180 | 12768529 | """
cuTENSOR Wrapper
Use `cupy_backends.cuda.libs.cutensor` directly in CuPy codebase.
"""
available = True
try:
from cupy_backends.cuda.libs.cutensor import * # NOQA
except ImportError as e:
available = False
from cupy._environment import _preload_warning
_preload_warning('cutensor', e)
| 1.179688 | 1 |
src/spaceone/statistics/model/schedule_model.py | choonho/statistics | 0 | 12768530 | from mongoengine import *
from spaceone.core.model.mongo_model import MongoModel
class Scheduled(EmbeddedDocument):
cron = StringField(max_length=1024, default=None, null=True)
interval = IntField(min_value=1, max_value=60, default=None, null=True)
minutes = ListField(IntField(), default=None, null=True)... | 2.328125 | 2 |
pysaintcoinach/xiv/territory_type.py | icykoneko/saintcoinach-py | 7 | 12768531 | from ..ex.relational import IRelationalRow
from . import xivrow, XivRow, IXivSheet
@xivrow
class TerritoryType(XivRow):
_weather_groups = None
_maps_by_index = None
@property
def name(self): return self.as_string('Name')
@property
def bg(self): return self.as_string('Bg')
@property
... | 2.0625 | 2 |
Compressing data/functions_1.py | zhengzhang96/Hardware-efficient-MUA-compression | 0 | 12768532 | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 9 20:00:55 2021
@author: oscar
"""
import numpy as np
import math
def bin_MUA_data(MUA,bin_res):
counter = 0
binned_MUA = np.zeros([math.ceil(len(MUA[:,1])/bin_res),len(MUA[1,:])])
for bin in range(math.ceil(len(MUA[:,1])/bin_res)):
if... | 2.8125 | 3 |
gridpath/project/operations/carbon_cap.py | nmgeek/gridpath | 0 | 12768533 | # Copyright 2016-2020 Blue Marble Analytics 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 ag... | 1.851563 | 2 |
webtopay/models.py | motiejus/django-webtopay | 2 | 12768534 | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from webtopay.signals import payment_was_successful, payment_was_flagged
class WebToPayResponse(models.Model):
# Non-webtopay params
def __unicode__(self):
amount = self.amount / 100 if self.... | 1.976563 | 2 |
code_week6_61_614/ping_heng_er_cha_shu_lcof.py | dylanlee101/leetcode | 0 | 12768535 | <filename>code_week6_61_614/ping_heng_er_cha_shu_lcof.py
'''
输入一棵二叉树的根节点,判断该树是不是平衡二叉树。如果某二叉树中任意节点的左右子树的深度相差不超过1,那么它就是一棵平衡二叉树。
示例 1:
给定二叉树 [3,9,20,null,null,15,7]
3
/ \
9 20
/ \
15 7
返回 true 。
示例 2:
给定二叉树 [1,2,2,3,3,null,null,4,4]
1
/ \
2 2
/ \
3 3
/ \
4 4
返... | 3.53125 | 4 |
flask_cognito_auth/decorators.py | ankit-shrivastava/flask-cognito-auth | 1 | 12768536 | <gh_stars>1-10
#!/usr/bin/env python3
"""
File handle the decorators for AWS Cognito login / logout features.
On successfull login, add "groups" in session object if user is
part of AWS Cognito group. This helps application for authorization.
"""
import logging
import json
import requests
from requests.auth import HT... | 2.953125 | 3 |
challenges/array_shift/test_array_shift.py | ravewillow6383/data-structures-and-algorithms-python | 0 | 12768537 | from array_shift import insert_shift_array
# def test_insert_to_middle():
# expected = [1, 2, 3]
# actual = insert_shift_array([1, 3], 2)
# assert expected == actual
def test_insert_to_middle():
expected = [1, 2, 3, 4, 5, 6]
actual = insert_shift_array([1, 2, 3, 5, 6], 4)
assert ... | 3.328125 | 3 |
tests/pages/login_page.py | Schveitzer/selenium-python-bdd-behave-example | 0 | 12768538 | from selenium.webdriver.common.by import By
from browser import Driver
class LoginPage(Driver):
instance = None
@classmethod
def get_instance(cls):
if cls.instance is None:
cls.instance = LoginPage()
return cls.instance
def open(self, context):
self.driver.get(co... | 2.9375 | 3 |
rlkit/torch/irl/fetch_task_design.py | yifan-you-37/rl_swiss | 56 | 12768539 | from collections import OrderedDict
import numpy as np
import torch
import torch.optim as optim
from torch import nn as nn
from torch import autograd
from torch.autograd import Variable
import torch.nn.functional as F
from rlkit.core import logger
import rlkit.torch.pytorch_util as ptu
from rlkit.core.eval_util impo... | 2.015625 | 2 |
SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/lang/objc/forward-decl/TestForwardDecl.py | Polidea/SiriusObfuscator | 427 | 12768540 | <gh_stars>100-1000
"""Test that a forward-declared class works when its complete definition is in a library"""
from __future__ import print_function
import os
import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class ForwardDeclT... | 2.078125 | 2 |
OOP/Classes and objectives excercise/To-do-list/project/task.py | petel3/Softuni_education | 2 | 12768541 | class Task:
def __init__(self,name,due_date):
self.name = name
self.due_date = due_date
self.comments=[]
self.completed=False
def change_name(self,new_name:str):
if self.name==new_name:
return f"Name cannot be the same."
self.name=new_name
ret... | 3.546875 | 4 |
whisperbackup/gcs.py | asvyatov/whisper-backup | 44 | 12768542 | <reponame>asvyatov/whisper-backup<filename>whisperbackup/gcs.py
#!/usr/bin/env python
#
# Copyright 2019 42 Lines, Inc.
# Original Author: <NAME> <<EMAIL>>
#
# 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 ... | 2.484375 | 2 |
ParsingProject/movie/migrations/0007_alter_movie_photo.py | rzhvn1/Parsing-APi | 0 | 12768543 | # Generated by Django 3.2 on 2021-04-12 13:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('movie', '0006_alter_movie_rating'),
]
operations = [
migrations.AlterField(
model_name='movie',
name='photo',
... | 1.53125 | 2 |
src/pyinfrabox/testresult/__init__.py | agu3rra/InfraBox | 265 | 12768544 | from builtins import int, range
from pyinfrabox import ValidationError
from pyinfrabox.utils import *
def check_version(v, path):
if not isinstance(v, int):
raise ValidationError(path, "must be an int")
if v != 1:
raise ValidationError(path, "unsupported version")
def parse_measurement(d, pa... | 2.90625 | 3 |
arrow/__init__.py | galaxy-genome-annotation/python-apollo | 5 | 12768545 | __version__ = '4.2.13'
| 1.039063 | 1 |
webware/Request.py | PeaceWorksTechnologySolutions/w4py3 | 11 | 12768546 | <filename>webware/Request.py
"""An abstract request"""
from MiscUtils import AbstractError
from MiscUtils.Funcs import asclocaltime
class Request:
"""The abstract request class.
Request is a base class that offers the following:
* A time stamp (indicating when the request was made)
* An input s... | 3.46875 | 3 |
tests/plantcv/visualize/test_colorize_label_img.py | ygarrot/plantcv | 1 | 12768547 | import numpy as np
from plantcv.plantcv.visualize import colorize_label_img
def test_colorize_label_img():
"""Test for PlantCV."""
label_img = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
colored_img = colorize_label_img(label_img)
assert (colored_img.shape[0:-1] == label_img.shape) and colored_img.sha... | 2.9375 | 3 |
setup.py | stakelink/substrate-utils | 0 | 12768548 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import io
import os
import sys
from shutil import rmtree
from setuptools import find_packages, setup, Command
NAME = 'substrate-utils'
VERSION = '0.1'
DESCRIPTION = ''
URL = 'https://github.com/stakelink/substrate-utils'
EMAIL = '<EMAIL>'
AUTHOR = 'STAKELINK'
REQUIRES_PY... | 1.585938 | 2 |
geomagio/adjusted/transform/ZRotationHScale.py | usgs/geomag-algorithms | 49 | 12768549 | import numpy as np
from typing import List, Optional, Tuple
from .LeastSq import LeastSq
class ZRotationHscale(LeastSq):
"""Calculates affine using least squares, constrained to rotate about the Z axis
and apply uniform horizontal scaling."""
def get_matrix(
self,
matrix: List[List[float... | 3.078125 | 3 |
src/scipp/core/shape.py | mlund/scipp | 0 | 12768550 | <gh_stars>0
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2022 Scipp contributors (https://github.com/scipp)
# @author <NAME>
# flake8: noqa: E501
import numpy as np
from typing import Dict, List, Optional, Sequence, Tuple, Union
from .._scipp import core as _cpp
from ._cpp_wrapper_util import call_func as ... | 2.796875 | 3 |