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 |
|---|---|---|---|---|---|---|
tap/tests/test_main.py | cans/tappy-pkg | 0 | 12769751 | # Copyright (c) 2015, <NAME>
import os
from tap.main import main
from tap.tests import TestCase
class TestMain(TestCase):
"""Tests for tap.main.main"""
def test_exits_with_error(self):
"""The main function returns an error status if there were failures."""
argv = ['/bin/fake', 'fake.tap']
... | 2.78125 | 3 |
tests/fixtures/CKANDataSet_fixtures.py | bdolor/bcdc2bcdc | 0 | 12769752 | """[summary]
:return: [description]
:rtype: [type]
"""
import os
import constants
import pytest
import json
import logging
import CKANData
import tests.helpers.CKANDataHelpers as CKANDataHelpers
LOGGER = logging.getLogger(__name__)
@pytest.fixture(scope="session")
def CKANData_User_Data_Raw():
"""returns a use... | 2.1875 | 2 |
src/main.py | lyw1217/scraping-news | 0 | 12769753 | from app import *
from threading import Thread
def get_morning_news() :
root_logger.critical("< NEWS > get_morning_new Thread Started ... ")
while True :
d_month = datetime.now().month
d_day = datetime.now().day
d_hour = datetime.now().hour
# 정해진 시간에 뉴스 전송
... | 2.515625 | 3 |
jupiter/domain/smart_lists/service/__init__.py | horia141/jupiter | 15 | 12769754 | <gh_stars>10-100
"""Smart list service classes."""
| 1.0625 | 1 |
isi_mip/core/migrations/0006_auto_20170306_1515.py | ISI-MIP/isimip | 4 | 12769755 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-03-06 14:15
from __future__ import unicode_literals
from django.db import migrations
import wagtail.core.blocks
import wagtail.core.fields
class Migration(migrations.Migration):
dependencies = [
('core', '0005_headerlink_menu_items'),
]
... | 1.65625 | 2 |
lib/gui/custom_widgets.py | aaman123/faceswap | 2 | 12769756 | <reponame>aaman123/faceswap
#!/usr/bin/env python3
""" Custom widgets for Faceswap GUI """
import logging
import platform
import re
import sys
import tkinter as tk
from tkinter import ttk, TclError
import numpy as np
from .utils import get_config
logger = logging.getLogger(__name__) # pylint: disable=invalid-name
... | 2.421875 | 2 |
rcj_soccer/views/competition.py | rcjaustralia/rcj-soccer-platform | 1 | 12769757 | from rcj_soccer.base import app, db
from rcj_soccer.models import Competition
from flask import render_template, jsonify, request
from datetime import datetime
from dateutil.parser import parse
from rcj_soccer.util import config, obj_to_dict
import logging
logger = logging.getLogger(__name__)
@app.route("/")
def lis... | 2.359375 | 2 |
toy/hello.py | bheavner/python_toy | 0 | 12769758 | """Hello world module"""
def hello_func():
"""return 'Hello!'"""
return "Hello!"
def main():
"""print 'Hello!'"""
print(hello_func())
if __name__ == '__main__':
main()
| 2.46875 | 2 |
jax_cfd/spectral/time_stepping_test.py | rainwangphy/jax-cfd | 0 | 12769759 | <filename>jax_cfd/spectral/time_stepping_test.py<gh_stars>0
# 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
#
#... | 2.25 | 2 |
mangadex/routes/base.py | mansuf/mangadex.py | 0 | 12769760 | import sys
import aiohttp
from .. import __version__
__all__ = (
'BaseRoute', 'RequireLogin', 'GET',
'POST', 'PUT', 'DELETE',
)
class BaseRoute:
BASE_URL = 'https://api.mangadex.org'
user_agent = 'mangadex.py (https://github.com/mansuf/mangadex.py {0}) Python/{1[0]}.{1[1]} aiohttp/{2}'.format(
... | 2.421875 | 2 |
Python/Fundamentals/Extras/Stores_And_Products/store_test.py | handtjaxon1/Coding-Dojo-Development | 0 | 12769761 | <filename>Python/Fundamentals/Extras/Stores_And_Products/store_test.py<gh_stars>0
from store import *
from product import *
# Create a store and some products
convenience_store = Store("Kwik E-Mart")
donut = Product("Donut", 1.99, ProductCategory.Food)
beer = Product("Beer", 6.99, ProductCategory.Beverages)
pacifier =... | 3.484375 | 3 |
mac/pyobjc-core/libffi-src/tests/dejagnu.py | albertz/music-player | 132 | 12769762 | #!/usr/bin/python
"""
A very crude emulator of dejagnu, just enough to integrate the libbfi
unittests into the pyobjc ones.
"""
import os
import re
import sys
import signal
from fnmatch import fnmatch
import unittest
from distutils.util import get_platform
gDgCommands=re.compile(r'''
(?:{\s*(dg-do)\s*run\s*({[... | 2.5 | 2 |
nirvana/data/bin2d.py | kbwestfall/BarFit | 0 | 12769763 | <filename>nirvana/data/bin2d.py
"""
Two-dimensional binning routines.
.. include common links, assuming primary doc root is up one directory
.. include:: ../include/links.rst
"""
import warnings
import numpy as np
from matplotlib import pyplot
from vorbin.voronoi_2d_binning import voronoi_2d_binning
from .util impor... | 2.796875 | 3 |
binary_tree/tests/test_level_order_traversal.py | ahcode0919/python-ds-algorithms | 0 | 12769764 | <reponame>ahcode0919/python-ds-algorithms
from test_helpers.test_helpers import get_binary_tree
from binary_tree.level_order_traversal import level_order_traversal
def test_level_order_traversal():
tree = get_binary_tree()
assert level_order_traversal(tree) == [[1], [2, 3], [4, 5]]
| 3.046875 | 3 |
examples/VECs/microbench/test_switch.py | UTexas-PSAAP/Parla.py | 11 | 12769765 | <reponame>UTexas-PSAAP/Parla.py
import time
t = time.perf_counter()
from parla.multiload import multiload_contexts
begin_multiload = time.perf_counter() - t
m = 12
import_times = []
for i in range(m):
with multiload_contexts[i]:
t = time.perf_counter()
import numpy as np
t = time.perf_coun... | 1.992188 | 2 |
helpers/org_files_by_date.py | rom1504/crawlingathome-gpu-hcloud | 0 | 12769766 | <reponame>rom1504/crawlingathome-gpu-hcloud
import os
import time
import shutil
# Change the directory and jump to the location
# where you want to arrange the files
os.chdir(r"/mnt/md1/export/rsync")
files = os.listdir('.')
# files in the current directory
i = 0
for file in files:
if os.path.isfile(file) and os... | 2.875 | 3 |
gorilla/core/misc.py | sunjiahao1999/gorilla-core | 4 | 12769767 | <filename>gorilla/core/misc.py<gh_stars>1-10
# Copyright (c) Open-MMLab. All rights reserved.
import functools
import operator
import subprocess
import warnings
from collections import abc
from importlib import import_module
from inspect import getfullargspec
from six.moves import map, zip
from typing import Dict, List... | 2.21875 | 2 |
conclusion/models.py | DamienMAYAUX/pilot_LEEP_RS | 0 | 12769768 | <gh_stars>0
from otree.api import (
models,
widgets,
BaseConstants,
BaseSubsession,
BaseGroup,
BasePlayer,
Currency as c,
currency_range,
)
author = '<NAME>'
doc = """
"""
class Constants(BaseConstants):
name_in_url = 'attention_test'
players_per_group = ... | 2.1875 | 2 |
poll/migrations/0003_poll_expires.py | devs4v/opinify | 0 | 12769769 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import datetime
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('poll', '0002_remove_poll_expires'),
]
operations = [
migrations.AddFie... | 1.632813 | 2 |
django_sqlalchemy/models/query.py | brosner/django-sqlalchemy | 4 | 12769770 | <gh_stars>1-10
from django.db.models.query import QuerySet
from django.db.models.sql.constants import ORDER_PATTERN
from sqlalchemy.orm import attributes
from sqlalchemy.orm.query import _ColumnEntity
from sqlalchemy.sql import operators
from django_sqlalchemy.models import query_utils as utils
from django.db.models... | 2.4375 | 2 |
module_test.py | chroblert/sourceCodeCheck | 6 | 12769771 | import os
import time
import re
# import lxml
from lxml import etree
from tool import read_txt_file_to_list
with open('ttttt.html','a',encoding = 'utf-8') as f:
f.write('盖雅放假啊')
f.write('\n')
with open('ttttt.html','r',encoding = 'utf-8') as f:
fileHtml = f.read()
sensitiveKeywordListUri = './config/sensi... | 2.96875 | 3 |
docxx/oxml/notes.py | betasewer/python-docx-xtended | 1 | 12769772 | <reponame>betasewer/python-docx-xtended
# encoding: utf-8
"""
Custom element classes related to the numbering part
"""
from docxx.oxml import OxmlElement
from docxx.oxml.shared import CT_DecimalNumber
from docxx.oxml.simpletypes import ST_DecimalNumber, ST_FtnEdn, ST_OnOff
from docxx.oxml.xmlchemy import (
BaseOx... | 2.359375 | 2 |
tests/task.py | AlexGrig/pytorch-lr-finder | 0 | 12769773 | <reponame>AlexGrig/pytorch-lr-finder<gh_stars>0
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import DataLoader, Subset
import pytest
from model import LinearMLP
from dataset import XORDataset, ExtraXORDataset
def use_cuda():
if pytest.custom... | 2.234375 | 2 |
market/core/forms.py | katomaso/django-market | 0 | 12769774 | # coding: utf-8
import re
import logging
from decimal import Decimal
from allauth import account
from django import forms
from django.forms import widgets
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.forms.utils import ErrorList, ErrorDict
fro... | 2.03125 | 2 |
format_data.py | JohndeVostok/THU-Network-Management | 0 | 12769775 | import os
import argparse
import json
from utils import print_host
from xml.dom import minidom
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--input", type=str, help="input dir")
parser.add_argument("--output", type=str, help="output file")
args = parser.parse_args(... | 3 | 3 |
external/kit_sch_ge/run_tracking.py | sjeknic/CellST | 0 | 12769776 | from pathlib import Path
import numpy as np
from tifffile import imread
from tracker.export import ExportResults
from tracker.extract_data import get_img_files
from tracker.extract_data import get_indices_pandas
from tracker.tracking import TrackingConfig, MultiCellTracker
def run_tracker(img_path, segm_path, res_p... | 2.3125 | 2 |
app/decorators.py | Andrew342/flask_study | 0 | 12769777 | from functools import wraps
from flask import abort
from flask_login import current_user
from .models import Permission
def permission_required(permission):
def decorator(f):
@wraps(f)
def decarated_function(*args,**kwargs):
if not current_user.can(permission):
abort(40... | 2.46875 | 2 |
app/users/models/users.py | chavez897/blood-bank-management | 0 | 12769778 | """
Application name: users.py
Author/Programmer: <NAME>
Date application created: April 1st, 2022
This model helps to define the strucutre of stored data.
The fields used are:
*id
*is_active
*email
*username
*name
*last_name
*is_verified
"""
from django.db... | 3.03125 | 3 |
nncli/gui.py | CraigInches/nncli | 0 | 12769779 | # -*- coding: utf-8 -*-
"""nncli_gui module"""
import hashlib
import subprocess
import threading
import urwid
from . import view_titles, view_note, view_help, view_log, user_input
from .utils import exec_cmd_on_note, get_pager
# pylint: disable=too-many-instance-attributes, unused-argument
class NncliGui:
"""Nncl... | 2.015625 | 2 |
test/AzflowTest.py | aslotnick/azflow | 8 | 12769780 | <reponame>aslotnick/azflow
from unittest import TestCase
from azflow.DAG import DAG
from azflow.Task import Task
from azflow.AzflowException import AzflowException
class AzflowTest(TestCase):
def test_dag_validate(self):
# create a valid DAG
test_dag = DAG(dag_id='test_dag')
task_1 = Task(tas... | 2.5625 | 3 |
src/test/python/unit/context/test_context.py | ettoreleandrotognoli/etto-robot | 0 | 12769781 | from aiounittest import AsyncTestCase
from urllib.parse import urlparse
from robot.api import Context
from robot.context.core import ContextImpl
class ResolveUrlContextImplTest(AsyncTestCase):
context: Context = None
@classmethod
def setUpClass(cls):
cls.context = ContextImpl(url=urlparse('http:/... | 2.671875 | 3 |
abc170/e_tle.py | nishio/atcoder | 1 | 12769782 | <filename>abc170/e_tle.py
from collections import defaultdict
N, Q = [int(x) for x in input().split()]
rate = [None] # 1-origin
k_to_ps = defaultdict(list) # 1-origin
p_to_k = [None]
for i in range(N):
A, B = [int(x) for x in input().split()]
rate.append(A)
k_to_ps[B].append(i + 1)
p_to_k.append(B)
f... | 2.34375 | 2 |
datasets/spm_dataset.py | chinaliwenbo/ChineseBert | 298 | 12769783 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@file : spm_dataset.py
@author: zijun
@contact : <EMAIL>
@date : 2021/1/21 15:00
@version: 1.0
@desc : Dataset for sentence pair matching tasks
"""
from functools import partial
import torch
from torch.utils.data import DataLoader
from datasets.chinese_bert_datase... | 2.65625 | 3 |
sketches/Sampler.py | DanielTing/datasketches-experimentation | 1 | 12769784 | <filename>sketches/Sampler.py
#
# 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, Versio... | 2.421875 | 2 |
leapp/messaging/testing.py | drehak/leapp | 0 | 12769785 | <reponame>drehak/leapp<filename>leapp/messaging/testing.py
from leapp.messaging import BaseMessaging
class TestMessaging(BaseMessaging):
"""
This class implements a messaging implementation made for unit tests - Data is only stored in memory and
not stored in a database.
"""
def __init__(self):
... | 2.609375 | 3 |
src/medbot_xmpp.py | mogron/ep_dyntest | 6 | 12769786 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A chat bot based on SleekXMPP
Scope parameter is https://www.googleapis.com/auth/googletalk
Best is the generate the request with the OauthPlayground:
https://developers.google.com/oauthplayground/
"""
from __future__ import absolute_import, division,... | 2.46875 | 2 |
kvoter/home.py | geokala/k-voter | 0 | 12769787 | <filename>kvoter/home.py
from flask import render_template, request
from kvoter import app
from kvoter.db import Election, Candidate, User
from wtforms import Form, IntegerField, validators
class VoteForm(Form):
election_id = IntegerField(
'Election ID',
[
validators.Required(),
... | 2.578125 | 3 |
phase1/prediction.py | lyubom/ATMO_Data_Challenge | 0 | 12769788 | <reponame>lyubom/ATMO_Data_Challenge
# -*- coding: utf-8 -*-
from utils import load_data,get_data_day
import numpy as np
import pickle
import datetime
import calendar
import time
import os
import sys
import pickle
from keras.models import model_from_json
from keras import optimizers
#### Predict function for a given... | 2.484375 | 2 |
vispy/util/tests/test_key.py | MatthieuDartiailh/vispy | 0 | 12769789 | from nose.tools import assert_raises, assert_true, assert_equal
from vispy.util.keys import Key, ENTER
def test_key():
"""Test basic key functionality"""
def bad():
return (ENTER == dict())
assert_raises(ValueError, bad)
assert_true(not (ENTER == None)) # noqa
assert_equal('Return', ENTE... | 2.59375 | 3 |
tests/developer/Li_PBC/relax_vol/vol_0.97/os_opt/run.py | pyflosic/pyeff | 3 | 12769790 | <filename>tests/developer/Li_PBC/relax_vol/vol_0.97/os_opt/run.py
from pyeff_calculator_pbc import *
import time
t0 = time.clock()
# single point
print 'Single Point Calculation'
p_cfg = 'pyeff.cfg'
calc = pyeff_pbc(p_cfg=p_cfg,scale=1.0)
calc.initialize()
calc.show_all()
print(calc.get_energy())
t = time.clock() - t0... | 1.945313 | 2 |
test/shapes/test_lineJoin.py | XRDX/pyleap | 6 | 12769791 | from pyleap import *
c = Circle(200, 200, 100)
t = Triangle(120, 130, 400, 300, 200, 230)
l = Line(100, 500, 500, 420)
r = Rectangle(40, 50, 100, 100)
c.color = "#ff000090"
l.color = "#00ff0090"
r.color = "#0000ff90"
r.rotation = 45
r.line_width = 20
c.line_width = 20
l.line_width = 100
t.line_width = 15
@repeat
... | 2.78125 | 3 |
experimental/ipynb/jsplugins/ipynbgalry/generate_scene.py | rossant/galry | 55 | 12769792 | <filename>experimental/ipynb/jsplugins/ipynbgalry/generate_scene.py
from galry import *
s = SceneCreator()
x = np.linspace(-1., 1., 1000)
y = np.sin(20 * x) * .2 - .5
x = np.vstack((x, x))
y = np.vstack((y, y + 1))
color = np.array([[1., 0., 0., 1.],
[0., 0., 1., 1.]], dtype=np.float32)
s.add_visu... | 2.21875 | 2 |
Dspot/Dspot/bookm/views.py | attaakkhan/Dspot-FYP-2016 | 0 | 12769793 | <reponame>attaakkhan/Dspot-FYP-2016
#!/usr/bin/python
# -*- coding: utf-8 -*-
from django.shortcuts import render
from django.template import RequestContext
# Create your views here.
from django.http import HttpResponse
from django.template import Context
from django.template.loader import get_template
from django.h... | 2.34375 | 2 |
render.py | Hypersycos/3D-Noughts-and-Crosses | 2 | 12769794 | <reponame>Hypersycos/3D-Noughts-and-Crosses<gh_stars>1-10
import math
import pygame
import pygame.gfxdraw
class Vector3d:
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
def __add__(self, addition):
return __class__(self.x + addition.x, self.y + addit... | 3.078125 | 3 |
scripts/20210331_prepare_text_classify/filter_articles.py | SPOClab-ca/writing-features-AI-papers | 0 | 12769795 | import argparse
import os, sys, time
import json
import jsonlines
import nltk
from nltk import word_tokenize, sent_tokenize
import pandas as pd
from pathlib import Path
import pickle
from utils import timed_func
categories = [
"AAAI", "ACL", "COLING", "CVPR", "EMNLP", "ICML", "ICRA", "IJCAI", "NAACL", "N... | 2.546875 | 3 |
otp/boundingbox.py | NExTplusplus/object-trajectory-proposal | 2 | 12769796 | import numpy as np
class BBoxFilter(object):
def __init__(self, min_area, max_area, min_ratio):
self.min_area = min_area
self.max_area = max_area
self.min_ratio = min_ratio
def __call__(self, bbox):
assert len(bbox) == 4
area = bbox[2] * bbox[3]
if area < self.min_area or area > self.... | 2.375 | 2 |
build/lib/discovery_imaging_utils/imaging_utils.py | erikglee/discovery_imaging_utils | 0 | 12769797 | #!/usr/bin/env python
import sys
from nibabel import load as nib_load
import nibabel as nib
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
import statsmodels.api as sm
from scipy import signal
import os
from numpy import genfromtxt
from sklearn.decomposition import PCA
def... | 2.640625 | 3 |
software/fmcw.py | matthuszagh/fmcw | 14 | 12769798 | <reponame>matthuszagh/fmcw
#!/usr/bin/env python
from __future__ import annotations
from time import clock_gettime, CLOCK_MONOTONIC
import sys
from enum import IntEnum, auto
from typing import Union, Optional, Callable, List, Tuple
from pathlib import Path
from shutil import rmtree
from multiprocessing import Process, ... | 2.03125 | 2 |
simdb/viewer/app/config.py | king-michael/simulation_database | 0 | 12769799 | class Config(object):
SQLALCHEMY_DATABASE_URI = 'sqlite:///app.db'
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY = '1234567890'
SQLALCHEMY_ECHO = False
FLASK_ADMIN_SWATCH = 'united'
if __name__ == '__main__':
for key in Config.__dict__:
print(key, Config.__dict__[key]) | 2.34375 | 2 |
aiostripe/test/resources/test_coupon.py | cypreess/aiostripe | 0 | 12769800 | import unittest
import aiostripe
from aiostripe.test.helper import StripeResourceTest, DUMMY_COUPON
class CouponTest(StripeResourceTest):
async def test_create_coupon(self):
await aiostripe.Coupon.create(**DUMMY_COUPON)
self.requestor_mock.request.assert_called_with('post', '/v1/coupons',
... | 2.46875 | 2 |
Python 3 - Curso completo/exercicio016.py | PedroMunizdeMatos/Estudos-e-Projetos | 0 | 12769801 | # faça u programa que leia um ângulo qualquer e mostre na etla o valor do seno, cosseno e tangente desse ângulo.
import math
n = int(input('Digite o ângulo: '))
sen = math.sin(math.radians(n))
cos = math.cos(math.radians(n))
tan = math.tan(math.radians(n))
print('Sabendo que o ângulo vale {}º, o seno vale {:.2f}, o c... | 4.03125 | 4 |
boggle.py | eliblaney/boggle | 0 | 12769802 | import nltk
from nltk.corpus import words
from pprint import pprint
end = '_end_'
def is_valid(trie, word):
pos = trie
for letter in word:
if letter not in pos:
return False
pos = pos[letter]
return end in pos
def is_prefix(trie, word):
pos = trie
for letter in word:
... | 3.734375 | 4 |
coding_interviews/leetcode/easy/generate_the_string/generate_the_string.py | LeandroTk/Algorithms | 205 | 12769803 | <gh_stars>100-1000
# https://leetcode.com/problems/generate-a-string-with-characters-that-have-odd-counts
def generate_the_string(n):
if n % 2 == 0:
return 'a' * (n - 1) + 'b'
return 'a' * n | 3.296875 | 3 |
python/argparse/git.py | macgregor/demos | 0 | 12769804 | <reponame>macgregor/demos<filename>python/argparse/git.py
import argparse
def git_add(args):
print 'adding file to git...'
print 'parsed_args.filename = \'%s\'' % args.filename
print 'parsed_args.debug = \'%s\'' % args.debug
def git_commit(args):
print 'commiting to git...'
print 'parsed_args.mess... | 3.546875 | 4 |
Books/TensorFlowDeepLearningCookbook/Chapter1_TensorFlow_An_Introduction/subchapter_03_Hello_world_in_TensorFlow.py | Tim232/Python-Things | 2 | 12769805 | <filename>Books/TensorFlowDeepLearningCookbook/Chapter1_TensorFlow_An_Introduction/subchapter_03_Hello_world_in_TensorFlow.py
import tensorflow as tf # tensorflow 임포트
message = tf.constant('Welcome to the exciting world of Deep Neural Networks!') # 상수 문자열을 사용하기 위해 tf.constant 사용
with tf.Session() as sess: # graph el... | 3 | 3 |
network/__init__.py | K-Mahfoudh/Sign-Language-Translator | 26 | 12769806 | <gh_stars>10-100
from .network import Network | 1.054688 | 1 |
Services/Aslide/aslide.py | jinimp/QAS | 0 | 12769807 | <gh_stars>0
import os
from openslide import OpenSlide
from openslide import lowlevel as openslide_lowlevel
from Services.Aslide.kfb import kfb_lowlevel
from Services.Aslide.kfb.kfb_slide import KfbSlide
from Services.Aslide.tmap.tmap_slide import TmapSlide
class Aslide(object):
def __init__(self, filepath):
sel... | 2.3125 | 2 |
remimi/datasets/open3d.py | xiong-jie-y/remimi | 23 | 12769808 | import open3d as o3d
import os
import glob
import numpy as np
import json
class Open3DReconstructionDataset:
def __init__(self, root_dir):
self.root_dir = root_dir
self.len_frame = len(list(glob.glob(os.path.join(root_dir, "color/*.jpg"))))
def get_rgb_paths(self):
open3d_rgb_paths = ... | 2.46875 | 2 |
gecko/geckolib/automation/keypad.py | mmillmor/home_assistant-components | 0 | 12769809 | <reponame>mmillmor/home_assistant-components<gh_stars>0
""" Gecko Keypads """
from .base import GeckoAutomationBase
class GeckoKeypad(GeckoAutomationBase):
""" Keypad management class """
def __init__(self, facade):
super().__init__(facade, "Keypad", "KEYPAD")
def __str__(self):
return ... | 1.890625 | 2 |
Tutorial/Code/29. NumPy ufuncs.py | Deve-BlackHeart/Numpy | 1 | 12769810 | import numpy as np
x = [0, 1, 2, 3, 4]
y = [5, 6, 7, 8, 9]
z = []
for i, j in zip(x, y):
z.append(i + j)
print(z)
z = np.add(x, y)
print(z)
def my_add(a, b):
return a + b
my_add = np.frompyfunc(my_add, 2, 1)
z = my_add(x, y)
print(z)
print(type(np.add))
print(type(np.concatenate))
print(type(my_add))
| 3.28125 | 3 |
tests/workers/test_eval_cipher_suites_openssl1_0_2.py | timb-machine-mirrors/tlsmate | 0 | 12769811 | <reponame>timb-machine-mirrors/tlsmate
# -*- coding: utf-8 -*-
"""Implements a class to be used for unit testing.
"""
import pathlib
from tlsmate.workers.eval_cipher_suites import ScanCipherSuites
from tlsmate.tlssuite import TlsSuiteTester
from tlsmate.tlssuite import TlsLibrary
tls10_cs = [
"TLS_RSA_WITH_RC4_12... | 1.664063 | 2 |
neuralpp/inference/graphical_model/variable/variable.py | stefanwebb/neuralpp | 0 | 12769812 | from typing import Any
import torch
class Variable:
def __eq__(self, other) -> bool:
self._not_implemented("__eq__")
def __hash__(self):
self._not_implemented("__hash__")
def __repr__(self) -> str:
self._not_implemented("__repr__")
def featurize(self, value) -> torch.Tensor... | 2.734375 | 3 |
script/main.py | repen/SPyRender | 0 | 12769813 | """
Copyright 2021 <NAME> (<EMAIL>)
Licensed under the Apache License v2.0
http://www.apache.org/licenses/LICENSE-2.0
"""
from multiprocessing import Process, Lock
from tool import log as _log
import time, argparse
parser = argparse.ArgumentParser(
formatter_class=argparse.RawTextHelpFormatter
)
parser.add_argumen... | 2.109375 | 2 |
mitmproxy/http.py | cifred98/mitmproxy | 1 | 12769814 | <filename>mitmproxy/http.py
import html
import time
from typing import Optional, Tuple
from mitmproxy import connections
from mitmproxy import flow
from mitmproxy import version
from mitmproxy.net import http
HTTPRequest = http.Request
HTTPResponse = http.Response
class HTTPFlow(flow.Flow):
"""
An HTTPFlow i... | 2.953125 | 3 |
tests/file_handler/test_local.py | Gallaecio/spider-feeder | 0 | 12769815 | <reponame>Gallaecio/spider-feeder
from spider_feeder.file_handler import local
def test_open_local_file(mocker):
mock = mocker.patch('spider_feeder.file_handler.local.builtins.open')
local.open('/tmp/input_urls.txt', encoding='utf-8')
mock.assert_called_once_with('/tmp/input_urls.txt', encoding='utf-8')
... | 2.0625 | 2 |
tests/test_connection_pooling.py | ckwang8128/pycassa | 64 | 12769816 | import threading
import unittest
import time
from nose.tools import assert_raises, assert_equal, assert_true
from pycassa import ColumnFamily, ConnectionPool, InvalidRequestError,\
NoConnectionAvailable, MaximumRetryException, AllServersUnavailable
from pycassa.logging.pool_stats_logger import Stat... | 2.15625 | 2 |
03 Queue/queue2Stacks.py | harshrajm/Python-Algo-DS | 0 | 12769817 | <filename>03 Queue/queue2Stacks.py
class Queue2Stacks:
def __init__(self):
self.stack1 = []
self.stack2 = []
def size(self):
return len(self.stack1)
def isEmpty(self):
return self.stack1 == []
def enqueue(self,item):
self.stack... | 3.84375 | 4 |
Iterator.py | AutogenSh/design_patterns | 0 | 12769818 | from abc import abstractmethod
'''
迭代器模式(Iterator Pattern)是 Java 和 .Net 编程环境中非常常用的设计模式。
这种模式用于顺序访问集合对象的元素,不需要知道集合对象的底层表示。
意图:提供一种方法顺序访问一个聚合对象中各个元素, 而又无须暴露该对象的内部表示。
主要解决:不同的方式来遍历整个整合对象。
何时使用:遍历一个聚合对象。
如何解决:把在元素之间游走的责任交给迭代器,而不是聚合对象。
关键代码:定义接口:hasNext, next。
'''
class Iterator:
@abstractmethod
def hasNext(... | 4.21875 | 4 |
excel_magic/splitter.py | HJFG/excel-magic | 0 | 12769819 | <reponame>HJFG/excel-magic
import xlrd
import xlsxwriter
import os
class Pointer:
def __init__(self, row: int, col: int):
self.row = row
self.col = col
def next_row(self, current_col=False):
if not current_col:
self.col = 0
self.row += 1
def next_col(self):
... | 3.0625 | 3 |
setify/__init__.py | MinaGabriel/setify | 0 | 12769820 | from . import datasets
from . import utils
__version__ = '0.9.3'
| 1.109375 | 1 |
bin/async_cnn_train.py | DwangoMediaVillage/marltas_core | 9 | 12769821 | """Asynchronized (distributed) cnn training."""
import os # noqa isort:skip
os.environ['OMP_NUM_THREADS'] = '1' # noqa isort:skip
import argparse
import logging
import pprint
import time
from dataclasses import asdict, dataclass
from functools import partial
from pathlib import Path
import numpy as np
from dqn.act... | 2.265625 | 2 |
Lib/site-packages/pylint/config/help_formatter.py | edupyter/EDUPYTER38 | 0 | 12769822 | <gh_stars>0
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
import argparse
from pylint.config.callback_actio... | 2.265625 | 2 |
tests/tests.py | granttremblay/HRCbus | 0 | 12769823 | #!/usr/bin/env python
# Set the path explicitly #
sys.path.insert(0, os.path.abspath(__file__+"/../.."))
import unittest
class BasicTestSuit(unittest.TestCase):
"""Basic test cases."""
def test_absolute_truth_and_meaning(self):
assert True
def test_check_environment(self):
hrcbus.che... | 2.671875 | 3 |
src/cluster/migrations/0006_auto_20180801_1521.py | mrc-rius/computational_marketing_master_thesis | 0 | 12769824 | <filename>src/cluster/migrations/0006_auto_20180801_1521.py
# Generated by Django 2.0.5 on 2018-08-01 13:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cluster', '0005_costs'),
]
operations = [
migrations.RemoveField(
mo... | 1.515625 | 2 |
src/chapters/wall/hyperspace_helper/SceneManager.py | scottalmond/EscapeRoom | 1 | 12769825 |
# class does ...
import sys
import numpy as np
import math
import random
import time
from enum import Enum
from chapters.wall.hyperspace_helper.Segment import Segment
from chapters.wall.hyperspace_helper.AssetLibrary import AssetLibrary
from chapters.wall.hyperspace_helper.RingAssembly import RingAssembly
from chapt... | 2.328125 | 2 |
database.py | Mdsid7/Student_Result_Analyzer_using_OOPS_and_Database | 3 | 12769826 | <reponame>Mdsid7/Student_Result_Analyzer_using_OOPS_and_Database<gh_stars>1-10
import mysql.connector
import string
mydb = mysql.connector.connect (
host="localhost",
user="root",
password="<PASSWORD>",
database="result"
)
mycursor=mydb.cursor()
def A_view():
mycursor.execute("SELECT * FROM A_section")
fiel... | 2.765625 | 3 |
python/pybool/chow_liu_trees.py | JohnReid/pybool | 5 | 12769827 | <reponame>JohnReid/pybool<filename>python/pybool/chow_liu_trees.py
#
# Copyright <NAME> 2011
#
"""
Chow-Liu Trees
==============
`Chow-Liu trees`_ were originally defined in <NAME>.; <NAME>. (1968),
"Approximating discrete probability distributions with dependence trees",
IEEE Transactions on Information Theory IT-14... | 3.078125 | 3 |
tensorflow_serving/servables/caffe/test_data/mnist_caffe_fetch.py | rayglover-ibm/serving-caffe | 48 | 12769828 | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | 1.992188 | 2 |
beginning-game-development/Chapter 3/3-1.py | CrtomirJuren/pygame-projects | 43 | 12769829 | <reponame>CrtomirJuren/pygame-projects
#!/usr/bin/env python
background_image_filename = 'sushiplate.jpg'
mouse_image_filename = 'fugu.png'
import pygame
from pygame.locals import *
from sys import exit
pygame.init()
screen = pygame.display.set_mode((640, 480), 0, 32)
pygame.display.set_caption("Hello... | 3.28125 | 3 |
test.py | Joshuawadd/rlcard | 0 | 12769830 | import rlcard
rlcard.make('whist', config={'record_action': True}) | 1.320313 | 1 |
goutdotcom/profiles/tests/test_models.py | Spiewart/goutdotcom | 0 | 12769831 | <gh_stars>0
import pytest
from .factories import PatientProfileFactory
pytestmark = pytest.mark.django_db
| 1.046875 | 1 |
examples/sock/latency.py | iliar-rabet/dao-projection | 1 | 12769832 | <filename>examples/sock/latency.py
#!/usr/bin/python3
from datetime import datetime
import sys
import numpy
PKTS=300
slip=2
try:
if sys.argv[1]:
fileName = sys.argv[1]
except IndexError:
print("Using default file name.")
fileName = 'loglistener.txt'
f = open(fileName,"r")
#f.close()
def test():
list=[]
... | 2.75 | 3 |
code/day06.py | nbhh1234/test1 | 0 | 12769833 | v0,v1,t=eval(raw_input('Enter v0,v1,and t:'))
a=(v1-v0)/t
print('The average acceleration is {}'.format(a))
| 3.453125 | 3 |
challenge-1.py | matt-kendall/python-challenge | 0 | 12769834 | """
Python Challenge Level 1.
An image of a notepad with what appear to be letter transformations:
K -> M
O -> Q
E -> G
And the following hint:
'g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr
gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle
qrpgle.kyicrpyl... | 3.890625 | 4 |
site_config/migrations/0015_auto_20171107_1326.py | LaudateCorpus1/apostello | 69 | 12769835 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-07 13:26
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("site_config", "0014_auto_20171025_1053")]
operations = [
migrations.AlterField(
... | 1.726563 | 2 |
beproud/django/commons/models/__init__.py | beproud/bpcommons | 2 | 12769836 | from __future__ import absolute_import
from .base import *
from .fields import *
from .utils import *
| 1.09375 | 1 |
code/Rek_UpdateBlacklist.py | aws-samples/amazon-rekognition-reviewing-user-content | 8 | 12769837 | from __future__ import print_function
import boto3
from decimal import Decimal
import json
import urllib
import os
print('Loading function')
rekognition = boto3.client('rekognition')
s3 = boto3.client('s3')
# --------------- Helper Functions to call Rekognition APIs ------------------
def add_image_to_Collection... | 2.75 | 3 |
xsd-fu/python/generateDS/Demos/Xmlbehavior/po.py | jburel/ome-model | 11 | 12769838 | #!/usr/bin/env python
#
# Generated Fri Jul 2 13:32:06 2004 by generateDS.py.
#
import sys
import getopt
from xml.dom import minidom
from xml.dom import Node
#
# If you have installed IPython you can uncomment and use the following.
# IPython is available from http://ipython.scipy.org/.
#
## from IPython.Shell imp... | 2.6875 | 3 |
ChamarScriptLinux/Main.py | LeandroTeodoroRJ/ExemplosPython | 1 | 12769839 | <filename>ChamarScriptLinux/Main.py
######################################################
# Programa principal em Python
######################################################
import os #Importa módulo
var="Param1" #Parâmetro que será passado para o shell
os.system("./LinuxScript.sh %s" %var) #Chamada do scri... | 2.296875 | 2 |
MI_analyzer.py | DanielMartinAlarcon/influenza_RNA_structure | 0 | 12769840 | <filename>MI_analyzer.py
import pandas
import matplotlib.pyplot as plt
from sklearn.metrics import mutual_info_score as mi
import numpy as np
def Calculate_MI(numpy_array):
"""
Takes in a numpy array (which has been presumably parsed from an alignment),
calculates the mutual information, and returns it as a vector.... | 3.25 | 3 |
niworkflows/workflows/epi/tests/test_refmap.py | notZaki/niworkflows | 0 | 12769841 | <reponame>notZaki/niworkflows
"""Check the refmap module."""
import os
from ..refmap import init_epi_reference_wf
def test_reference(tmpdir, ds000030_dir, workdir, outdir):
"""Exercise the EPI reference workflow."""
tmpdir.chdir()
wf = init_epi_reference_wf(omp_nthreads=os.cpu_count(), auto_bold_nss=True... | 1.820313 | 2 |
server/models/User.py | surbina/devocion-ar-server | 0 | 12769842 | """This module contains the class definition for Users."""
from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import relationship
from server.models.Base import BaseModel
from server.models.Devotional import DevotionalModel
from server.models.Comment import CommentModel
class UserModel(BaseModel):
... | 3.21875 | 3 |
djangobmf/contrib/quotation/workflows.py | dmatthes/django-bmf | 1 | 12769843 | #!/usr/bin/python
# ex:set fileencoding=utf-8:
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from djangobmf.workflows import Workflow, State, Transition
import datetime
class QuotationWorkflow(Workflow):
class States:
draft = State(_(u"Draft"), True, d... | 2.15625 | 2 |
graditudelib/heatmap.py | foerstner-lab/GRADitude | 1 | 12769844 | import pandas as pd
import holoviews as hv
import matplotlib.pyplot as plt
hv.extension('bokeh', width=90)
def plot_heatmap(feature_count_table, feature_count_start_column,
feature_count_end_column, y_label_, output_file):
table = pd.read_table(feature_count_table, sep="\t")
table.set_index(... | 2.625 | 3 |
scons/mara_options.py | svn2github/Escript | 0 | 12769845 |
##############################################################################
#
# Copyright (c) 2003-2018 by The University of Queensland
# http://www.uq.edu.au
#
# Primary Business: Queensland, Australia
# Licensed under the Apache License, version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Development unt... | 1.515625 | 2 |
vulnscan_parser/models/nmap/host.py | happyc0ding/vulnscan-parser | 17 | 12769846 | from vulnscan_parser.models.vshost import VSHost
class NmapHost(VSHost):
def __init__(self):
super().__init__()
self.ignored_dict_props.append('scripts')
self.scripts = set()
@property
def address(self):
return self.ip
@address.setter
def address(self, value):
... | 2.265625 | 2 |
dashboard/migrations/0027_rename_psetsubmission_pset.py | ankanb240/otis-web | 15 | 12769847 | <filename>dashboard/migrations/0027_rename_psetsubmission_pset.py
# Generated by Django 3.2.5 on 2021-08-04 19:25
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('roster', '0061_alter_registrationcontainer_allowed_tracks'),
('core', '0027_alter_semester_... | 1.5625 | 2 |
generator_counter.py | volhadounar/Python_tricks | 0 | 12769848 | <reponame>volhadounar/Python_tricks
def gen_counter(cnt=None):
res = 0
while True:
yield res
res += 1 if cnt is None else cnt
if __name__=='__main__':
cnt = gen_counter()
print(next(cnt))
print(next(cnt))
print(next(cnt))
print(next(cnt))
print(next(cnt))
cnt = gen... | 3.5625 | 4 |
ultraopt/hdl/_hdl2cs.py | auto-flow/oxygen | 90 | 12769849 | import re
from collections import defaultdict
from copy import deepcopy
from typing import Dict, List
from ConfigSpace import CategoricalHyperparameter, Constant
from ConfigSpace import ConfigurationSpace, Configuration
from ConfigSpace import ForbiddenInClause, ForbiddenEqualsClause, ForbiddenAndConjunction
from Conf... | 2.21875 | 2 |
boozo/utils/timestamp.py | skillplot/pyboozo | 0 | 12769850 | <reponame>skillplot/pyboozo
## Copyright (c) 2020 mangalbhaskar
"""Common date and timestamp utilities and inter-conversion of them.
Dependencies: arrow
References:
* http://zetcode.com/python/arrow/
"""
__author__ = 'mangalbhaskar'
import os
import arrow
from boozo.boot._log_ import log
from .typeformats impo... | 2.53125 | 3 |