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 |
|---|---|---|---|---|---|---|
02-static-templates-files/02_html_template.py | saidulislam/flask-bootcamp-2 | 0 | 1300 | <filename>02-static-templates-files/02_html_template.py
from flask import Flask,
app = Flask(__name__)
@app.route("/")
def homepage():
return "Paws Rescue Center 🐾"
@app.route("/about")
def about():
return """We are a non-profit organization working as an animal rescue center.
We aim to help ... | 2.671875 | 3 |
src/compas/datastructures/mesh/bbox.py | arpastrana/compas | 2 | 1301 | <reponame>arpastrana/compas
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from compas.geometry import bounding_box
from compas.geometry import bounding_box_xy
__all__ = [
'mesh_bounding_box',
'mesh_bounding_box_xy',
]
def mesh_bounding_box(mes... | 2.5625 | 3 |
crop/source_selection/__init__.py | Lars-H/federated_crop | 0 | 1302 | from naive import NaiveSourceSelection
from star_based import StarBasedSourceSelection
from utils import AskSourceSelector, HybridSourceSelector, StatSourceSelector
from charset_selector import CharSet_Selector | 0.996094 | 1 |
base3_plus.py | Mhaiyang/iccv | 2 | 1303 | """
@Time : 201/21/19 10:47
@Author : TaylorMei
@Email : <EMAIL>
@Project : iccv
@File : base3_plus.py
@Function:
""" | 0.835938 | 1 |
visnav/algo/orig/tools.py | oknuutti/hw_visnav | 0 | 1304 | <filename>visnav/algo/orig/tools.py<gh_stars>0
import math
import time
import numpy as np
import numba as nb
import quaternion # adds to numpy # noqa # pylint: disable=unused-import
import sys
import scipy
from astropy.coordinates import SkyCoord
from scipy.interpolate import RectBivariateSpline
from scipy.interpol... | 2.078125 | 2 |
cirtorch/filters/sobel.py | Tarekbouamer/Image-Retrieval-for-Image-Based-Localization | 3 | 1305 | import torch
import torch.nn as nn
import torch.nn.functional as F
from .kernels import (
get_spatial_gradient_kernel2d,
get_spatial_gradient_kernel3d,
normalize_kernel2d
)
def spatial_gradient(input, mode='sobel', order=1, normalized=True):
"""
Computes the first order image derivative in bo... | 2.703125 | 3 |
PythonCookbook/concurrent_test/findrobots.py | xu6148152/Binea_Python_Project | 0 | 1306 | <filename>PythonCookbook/concurrent_test/findrobots.py
# -*- encoding: utf-8 -*-
import gzip
import io
import glob
from concurrent import futures
def find_robots(filename):
'''
Find all of the hosts that access robots.txt in a single log file
'''
robots = set()
with gzip.open(filename) as f:
... | 2.78125 | 3 |
docker/setup.py | sreynit02/RunestoneServer | 0 | 1307 | # ******************************************************************
# |docname| - Provide `docker_tools.py` as the script `docker-tools`
# ******************************************************************
from setuptools import setup
setup(
name="runestone-docker-tools",
version="0.1",
install_requires=[... | 1.351563 | 1 |
PS12/api2.py | AbhinavSingh-21f1002369/AFKZenCoders | 0 | 1308 | <reponame>AbhinavSingh-21f1002369/AFKZenCoders<filename>PS12/api2.py
from flask import Flask, render_template, request, jsonify,send_file, redirect,session, url_for
from werkzeug import secure_filename
import os
import utilities, queries
import logger
from flask_cors import CORS, cross_origin
from datetime import timed... | 2.234375 | 2 |
cnnblstm_with_adabn/cnnblstm_with_adabn.py | Fassial/Air-Writing-with-TL | 1 | 1309 | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
import matplotlib.pyplot as plt
# local model
import sys
sys.path.append("../network")
import Coral
from lstm import LSTMHardSigmoid
from AdaBN import AdaBN
sys.path.append("../network/Aut... | 2.421875 | 2 |
src/emmental/model.py | woffett/emmental | 0 | 1310 | <filename>src/emmental/model.py
"""Emmental model."""
import itertools
import logging
import os
from collections import defaultdict
from collections.abc import Iterable
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
import numpy as np
import torch
from numpy import ndarray
from torch import ... | 2.25 | 2 |
server/ws_server.py | jangxx/OVRT_Soundpad | 1 | 1311 | import asyncio, json
from config import Config
from soundpad_manager import SoundpadManager
from version import BRIDGE_VERSION
import websockets
from sanic.log import logger
# yes I know that it's very lazy to run a separate WS and HTTP server, when both could be run on the same port
# I don't like sanics ... | 2.53125 | 3 |
tests/route_generator_test.py | CityPulse/dynamic-bus-scheduling | 14 | 1312 | <gh_stars>10-100
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
"""
- LICENCE
The MIT License (MIT)
Copyright (c) 2016 <NAME> Ericsson AB (EU FP7 CityPulse Project)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to d... | 1.265625 | 1 |
tensorforce/tests/test_model_save_restore.py | gian1312/suchen | 0 | 1313 | <reponame>gian1312/suchen
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import unittest
import pytest
from tensorforce import TensorForceError
from tensorforce.core.networks import LayeredNetwork
from tensorforce.models import DistributionModel
from tenso... | 1.875 | 2 |
guid.py | lihuiba/SoftSAN | 1 | 1314 | <reponame>lihuiba/SoftSAN
import random
import messages_pb2 as msg
def assign(x, y):
x.a=y.a; x.b=y.b; x.c=y.c; x.d=y.d
def isZero(x):
return (x.a==0 and x.b==0 and x.c==0 and x.d==0)
def setZero(x):
x.a=0; x.b=0; x.c=0; x.d=0
def toStr(x):
return "%08x-%08x-%08x-%08x" % (x.a, x.b, x.c, x.d)
def to... | 2.46875 | 2 |
mango/__init__.py | kronael/mango-explorer | 0 | 1315 | <filename>mango/__init__.py
# In --strict mode, mypy complains about imports unless they're done this way.
#
# It complains 'Module has no attribute ABC' or 'Module "mango" does not explicitly export
# attribute "XYZ"; implicit reexport disabled'. We could dial that back by using the
# --implicit-reexport parameter, bu... | 1.9375 | 2 |
letters_of_sherlock.py | MariannaJan/LettersOfSherlock | 0 | 1316 | <filename>letters_of_sherlock.py
import lettercounter as lc
#Books form Gutenberg Project: https://www.gutenberg.org/ebooks/author/69
lc.showPlots(text_directory_pathname="./Books/",
title="<NAME>'s favourite letters",
legend_label_main="in Doyle's stories") | 2.484375 | 2 |
BB/bbObjects/items/bbTurret.py | mwaitzman/GOF2BountyBot | 0 | 1317 | from .bbItem import bbItem
from ...bbConfig import bbData
class bbTurret(bbItem):
dps = 0.0
def __init__(self, name, aliases, dps=0.0, value=0, wiki="", manufacturer="", icon="", emoji=""):
super(bbTurret, self).__init__(name, aliases, value=value, wiki=wiki, manufacturer=manufacturer, icon=icon, emoj... | 2.53125 | 3 |
what_can_i_cook/urls.py | s-maibuecher/what_can_i_cook | 0 | 1318 | from django.urls import path
from what_can_i_cook.views import WCICFilterView, WCICResultView
app_name = "wcic"
urlpatterns = [
path("", WCICFilterView.as_view(), name="wcic-start"),
path("results/", WCICResultView.as_view(), name="wcic-results"),
]
| 1.632813 | 2 |
shared/templates/grub2_bootloader_argument/template.py | justchris1/scap-security-guide | 1,138 | 1319 | import ssg.utils
def preprocess(data, lang):
data["arg_name_value"] = data["arg_name"] + "=" + data["arg_value"]
if lang == "oval":
# escape dot, this is used in oval regex
data["escaped_arg_name_value"] = data["arg_name_value"].replace(".", "\\.")
# replace . with _, this is used in t... | 2.671875 | 3 |
preprocess.py | NNDEV1/NMTWithLuongAttention | 4 | 1320 | <filename>preprocess.py<gh_stars>1-10
import tensorflow as tf
import os
import contractions
import tensorflow as tf
import pandas as pd
import numpy as np
import time
import rich
from rich.progress import track
import spacy
from config import params
#Preprocessing Text
class preprocess_text():
def __init__(self... | 2.5625 | 3 |
setup.py | johannesulf/dsigma | 4 | 1321 | from setuptools import setup, find_packages
from distutils.extension import Extension
from distutils.command.sdist import sdist
try:
from Cython.Build import cythonize
USE_CYTHON = True
except ImportError:
USE_CYTHON = False
ext = 'pyx' if USE_CYTHON else 'c'
extensions = [Extension(
'dsigma.precomput... | 1.742188 | 2 |
face_detector/modules/mod_faceDetection.py | jtfan3/face_detection | 0 | 1322 | import cv2
import mediapipe as mp
class FaceDetection():
# initialize the face detection class with arguments from https://google.github.io/mediapipe/solutions/face_detection.html
def __init__(self, model_selection = 0, threshold = 0.5):
self.model_selection = model_selection
self.threshold = t... | 3.203125 | 3 |
backend/0_publish_audio.py | bmj-hackathon/ethberlinzwei-babelfish_3_0 | 1 | 1323 | <filename>backend/0_publish_audio.py
import sys
import logging
# loggers_dict = logging.Logger.manager.loggerDict
#
# logger = logging.getLogger()
# logger.handlers = []
#
# # Set level
# logger.setLevel(logging.DEBUG)
#
# # FORMAT = "%(asctime)s - %(levelno)s - %(module)-15s - %(funcName)-15s - %(message)s"
# # FORMA... | 1.992188 | 2 |
src/pyRofex/components/messages.py | guillerminaamorin/pyRofex | 2 | 1324 | # -*- coding: utf-8 -*-
"""
pyRofex.components.messages
Defines APIs messages templates
"""
# Template for a Market Data Subscription message
MARKET_DATA_SUBSCRIPTION = '{{"type":"smd","level":1, "entries":[{entries}],"products":[{symbols}]}}'
# Template for an Order Subscription message
ORDER_SUBSCRIPTION = ... | 1.53125 | 2 |
course/task_6/flask_app.py | duboviy/async | 6 | 1325 | #!/usr/bin/env python3.4
from flask import Flask
import requests
from fibonacci import fibonacci as fib
app = Flask(__name__)
@app.route('/count/<key>')
def count(key):
return requests.get('http://127.0.0.1:8080/count/{}'.format(key)).text
@app.route('/fibonacci/<n>')
def fibonacci(n):
return str(fib(int(... | 3.046875 | 3 |
nexpose/nexpose_vulnerabilityexception.py | Patralos/nexpose-client-python | 29 | 1326 | <gh_stars>10-100
# Future Imports for py2/3 backwards compat.
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from builtins import object
from .xml_utils import get_attribute, get_content_of
from future import standard_library
standard_library.install_aliases... | 2.140625 | 2 |
myproject/IND_Project/backend/signup/apps.py | captainTOKIO/Premchand_Aug2022_fullstack_august_python1 | 4 | 1327 | from django.apps import AppConfig
class SignupConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'signup'
| 1.359375 | 1 |
pymc/mc_enum.py | cherish-web/pymc | 4 | 1328 | <gh_stars>1-10
# _*_ coding: utf-8 _*_
# @Time : 2021/3/29 上午 08:57
# @Author : cherish_peng
# @Email : <EMAIL>
# @File : cmd.py
# @Software : PyCharm
from enum import Enum
class EnumSubTitle(Enum):
Request4e = 0x5400
# 请求
Request = 0x5000
# 应答
Respond = 0xD000
Respond4e = 0xD400
class Enu... | 2.421875 | 2 |
py/sentry_data_schemas/__init__.py | getsentry/sentry-data-schemas | 7 | 1329 | from importlib.resources import path
from jsonschema_typed import JSONSchema
with path("sentry_data_schemas", "event.schema.json") as schema_path:
EventData = JSONSchema["var:sentry_data_schemas:schema_path"]
| 1.796875 | 2 |
predict.py | faroit/deep-fireball | 0 | 1330 | <gh_stars>0
# elsewhere...
import pandas as pd
from keras.models import model_from_json
import random
import sys
import numpy as np
maxlen = 15
step = 3
df = pd.read_pickle('articles.pandas')
text = str.join(' ', df.text.tolist())
chars = set(text)
print('total chars:', len(chars))
char_indices = dict((c, i) for i,... | 2.5 | 2 |
tests/simulation/test_container.py | Zavioer/SIR-simulation-IBM-ESI | 0 | 1331 | <filename>tests/simulation/test_container.py
import unittest
from simulation import container
from simulation import person
class ContainerTestCase(unittest.TestCase):
def setUp(self) -> None:
self.box = container.Container(100, 1000, 300, 1, 0.5)
self.s_instance = person.Person(x=0, y=0, infectio... | 3.515625 | 4 |
pontoon/base/migrations/0007_auto_20150710_0944.py | Tratty/pontoon | 3 | 1332 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import pontoon.base.models
class Migration(migrations.Migration):
dependencies = [
("base", "0006_auto_20150602_0616"),
]
operations = [
migrations.AddField(
model_name="... | 1.726563 | 2 |
platformio/project/commands/init.py | ufo2011/platformio-core | 0 | 1333 | # Copyright (c) 2014-present PlatformIO <<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 copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | 1.9375 | 2 |
12_module_release/message/__init__.py | DeveloperLY/Python-practice | 0 | 1334 | <filename>12_module_release/message/__init__.py
from . import send_message
from . import receive_message | 1.0625 | 1 |
guardian/decorators.py | peopledoc/django-guardian | 0 | 1335 | <reponame>peopledoc/django-guardian<filename>guardian/decorators.py
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.core.exceptions import PermissionDenied
from django.http import HttpResponseForbidden, HttpResponseRedirect
from django.utils.functional import wraps
from ... | 2.3125 | 2 |
images/forms.py | mpgarate/OST-fauxra | 1 | 1336 | <filename>images/forms.py
from django import forms
from django.forms import ModelForm
from images.models import Image
class ImageForm(ModelForm):
class Meta:
model = Image
| 1.679688 | 2 |
WebIOPi-0.7.1/python/webiopi/devices/analog/__init__.py | MORIMOTO520212/Arm-crawler | 1 | 1337 | <gh_stars>1-10
# Copyright 2012-2013 <NAME> - trouch.com
#
# 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 ... | 2.3125 | 2 |
osc_choochoo/tests/v1/test_train.py | dtroyer/osc-loco | 1 | 1338 | # Copyright 2013 Nebula Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 1.960938 | 2 |
scripts/firefox-wrapper.py | darioncassel/OmniCrawl | 2 | 1339 | #!/usr/bin/env python3
import sys
from os.path import dirname, abspath, join
import subprocess
# Note this does not resolve symbolic links
# https://stackoverflow.com/a/17806123
FIREFOX_BINARY = join(dirname(abspath(__file__)), 'firefox')
argvs = list(sys.argv)
argvs[0] = FIREFOX_BINARY
# geckdriver will run `firef... | 2.296875 | 2 |
src/pretix/base/payment.py | whiteyhat/pretix | 0 | 1340 | import json
import logging
from collections import OrderedDict
from decimal import ROUND_HALF_UP, Decimal
from typing import Any, Dict, Union
import pytz
from django import forms
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.dispatch import receiver
from django.fo... | 1.765625 | 2 |
tests/AssertFail/run.py | sag-tgo/EPL_assert_demo | 0 | 1341 | <filename>tests/AssertFail/run.py
from pysys.basetest import BaseTest
from apama.correlator import CorrelatorHelper
import os
class PySysTest(BaseTest):
def execute(self):
corr = CorrelatorHelper(self, name='correlator')
corr.start(logfile='correlator.log')
corr.injectEPL(os.getenv('APAMA_HOME','') + '/monitors... | 2.140625 | 2 |
src/beast/python/beast/env/ReadEnvFile_test.py | Ziftr/stellard | 58 | 1342 | from __future__ import absolute_import, division, print_function, unicode_literals
from unittest import TestCase
from beast.env.ReadEnvFile import read_env_file
from beast.util import Terminal
Terminal.CAN_CHANGE_COLOR = False
JSON = """
{
"FOO": "foo",
"BAR": "bar bar bar",
"CPPFLAGS": "-std=c++11 -frtti -fno... | 2.640625 | 3 |
signin/tests.py | pptnz/swa_team2 | 0 | 1343 | <reponame>pptnz/swa_team2
import json
from django.test import TestCase
from django.contrib.auth.models import User
from .models import CustomUser
from django.apps import apps
from .apps import SigninConfig
class SignInTest(TestCase):
def setUp(self):
self.django_user = User.objects.create_user(username='... | 2.4375 | 2 |
tree/list/BinaryNode.py | EliHar/BinaryTree-ADT | 0 | 1344 | <gh_stars>0
__author__ = '<NAME>'
class BinaryNode(object):
def __init__(self, data, left, right):
self.data = data
self.left = left
self.right = right
def getData(self):
return self.data
def getLeft(self):
return self.left
def getRight(self):
return ... | 3.140625 | 3 |
boolean2/tokenizer.py | AbrahmAB/booleannet | 0 | 1345 | <reponame>AbrahmAB/booleannet
"""
Main tokenizer.
"""
from itertools import *
import sys, random
import util
import ply.lex as lex
class Lexer:
"""
Lexer for boolean rules
"""
literals = '=*,'
tokens = (
'LABEL', 'ID','STATE', 'ASSIGN', 'EQUAL',
'AND', 'OR', 'NOT',
'NUMBE... | 2.8125 | 3 |
aiida/cmdline/params/options/test_interactive.py | tomzhang/aiida_core | 1 | 1346 | <reponame>tomzhang/aiida_core
"""Unit tests for the InteractiveOption."""
from __future__ import absolute_import
import unittest
import click
from click.testing import CliRunner
from click.types import IntParamType
from aiida.cmdline.params.options.interactive import InteractiveOption
from aiida.cmdline.params.option... | 2.4375 | 2 |
scripts/migration/migrate_registered_meta.py | fabmiz/osf.io | 0 | 1347 | """
Changes existing registered_meta on a node to new schema layout
required for the prereg-prize
"""
import json
import sys
import logging
from modularodm import Q
from framework.mongo import database as db
from framework.mongo.utils import from_mongo
from framework.transactions.context import TokuTransaction
from ... | 1.914063 | 2 |
pyec/distribution/bayes/structure/basic.py | hypernicon/pyec | 2 | 1348 | """
Copyright (C) 2012 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublice... | 1.90625 | 2 |
graph/tsp.py | pingrunhuang/CodeChallenge | 0 | 1349 | """
given a fully connected undirected graph(If no path exists between two cities, adding an arbitrarily long edge will complete the graph without affecting the optimal tour),
find the path with the lowest cost in total for a salesman to travel from a given start vertex
"""
import time
class Edge:
def __init__(sel... | 3.875 | 4 |
projects/code_combat/8_Cloudrip_Mountain/471-Distracting_Dungeon/distracting_dungeon.py | only-romano/junkyard | 0 | 1350 | def moveBothTo(point):
while hero.distanceTo(point) > 1:
hero.move(point)
hero.command(peasant, "move", point)
peasant = hero.findNearest(hero.findFriends())
while True:
hero.command(peasant, "buildXY", "decoy", peasant.pos.x + 2, peasant.pos.y)
var nextPoint = {"x": hero.pos.x,... | 3.09375 | 3 |
firstBadVersion.py | pflun/learningAlgorithms | 0 | 1351 | # The isBadVersion API is already defined for you.
# @param version, an integer
# @return a bool
# def isBadVersion(version):
class Solution(object):
def firstBadVersion(self, n):
start = 1
end = n
while start + 1 < end:
mid = start + (end - start) / 2
if isBadVersi... | 3.203125 | 3 |
issues/migrations/0001_initial.py | QizaiMing/ergo-project-manager | 0 | 1352 | # Generated by Django 2.2.12 on 2020-05-01 03:34
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
op... | 1.765625 | 2 |
com/binghe/hacker/tools/script/ak/check_virus.py | ffffff0x/python-hacker | 52 | 1353 | <reponame>ffffff0x/python-hacker
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- coding: gbk -*-
# Date: 2019/2/22
# Created by 冰河
# Description 将生成的bindshell.exe提交到vscan.novirusthanks.org检测
# 用法 python check_virus.py -f bindshell.exe
# 博客 https://blog.csdn.net/l1028386804
import re
import httplib
impo... | 2.265625 | 2 |
cogs/remind.py | LoganHaug/reminder-bot | 2 | 1354 | import asyncio
from typing import Union
import datetime
import time
from discord.ext import commands
import yaml
from cogs import checks
import database
import utils
# Loads the repeating interval dictionary
with open("conversions.yml", "r") as conversion_file:
conversion_dict = yaml.load(conversion_file, Loade... | 2.609375 | 3 |
setup.py | csengor/toraman_py | 2 | 1355 | import setuptools
from toraman.version import __version__
with open('README.md', 'r') as input_file:
long_description = input_file.read()
setuptools.setup(
name='toraman',
version=__version__,
author='<NAME>',
author_email='<EMAIL>',
description='A computer-assisted translation tool package',... | 1.578125 | 2 |
declarations_site/cms_pages/migrations/0015_auto_20150615_0201.py | li-ar/declarations.com.ua | 32 | 1356 | <gh_stars>10-100
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cms_pages', '0014_homepage_news_count'),
]
operations = [
migrations.AlterField(
model_name='ne... | 1.242188 | 1 |
tests/models/test_grad_norm.py | nightlessbaron/pytorch-lightning | 3 | 1357 | <gh_stars>1-10
# Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 2.140625 | 2 |
tensorflow/tools/compatibility/renames_v2.py | junjun315/tensorflow | 0 | 1358 | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 1.507813 | 2 |
deep_speech_2/decoder.py | Canpio/models | 1 | 1359 | """
CTC-like decoder utilitis.
"""
from itertools import groupby
import numpy as np
def ctc_best_path_decode(probs_seq, vocabulary):
"""
Best path decoding, also called argmax decoding or greedy decoding.
Path consisting of the most probable tokens are further post-processed to
remove consecutive... | 2.96875 | 3 |
modules/gitbox/files/asfgit/hooks/sync.py | Humbedooh/infrastructure-puppet | 1 | 1360 | <reponame>Humbedooh/infrastructure-puppet
#!/usr/local/bin/python
import json
import socket
import sys
import asfgit.cfg as cfg
import asfgit.git as git
import asfgit.log as log
import asfgit.util as util
import subprocess, os, time
def main():
ghurl = "git@github:apache/%s.git" % cfg.repo_name
os.chdir("/x1... | 2.109375 | 2 |
rosimport/_rosdef_loader.py | asmodehn/rosimport | 5 | 1361 | <filename>rosimport/_rosdef_loader.py
from __future__ import absolute_import, division, print_function
import contextlib
import importlib
import site
import tempfile
import shutil
from rosimport import genrosmsg_py, genrossrv_py
"""
A module to setup custom importer for .msg and .srv files
Upon import, it will fir... | 2.515625 | 3 |
PyLeague/logger.py | Ahuge/PyLeague | 0 | 1362 | import sys
def color(text, color):
if color == "blue":
color = "0;34m"
elif color == "green":
color = "0;32m"
elif color == "red":
color = "0;31m"
elif color == "yellow":
color = "0;33m"
else:
return text
return "\033[%s%s\033[0m\n" % (color, text)
cla... | 3.15625 | 3 |
setup.py | swtwsk/dbt-airflow-manifest-parser | 0 | 1363 | """dbt_airflow_factory module."""
from setuptools import find_packages, setup
with open("README.md") as f:
README = f.read()
# Runtime Requirements.
INSTALL_REQUIRES = ["pytimeparse==1.1.8"]
# Dev Requirements
EXTRA_REQUIRE = {
"tests": [
"pytest>=6.2.2, <7.0.0",
"pytest-cov>=2.8.0, <3.0.0",... | 1.804688 | 2 |
nightlightpi/errorstrings.py | jmb/NightLightPi | 2 | 1364 | <reponame>jmb/NightLightPi
# -*- coding: utf-8; -*-
"""Define error strings raised by the application."""
MISSING_CONFIG_VALUE = """
'{0}' is not specified or invalid in the config file!
""".strip()
| 1.671875 | 2 |
karabo_bridge/tests/test_serialize.py | European-XFEL/karabo-bridge-py | 6 | 1365 | import numpy as np
import pytest
from karabo_bridge import serialize, deserialize
from .utils import compare_nested_dict
def test_serialize(data, protocol_version):
msg = serialize(data, protocol_version=protocol_version)
assert isinstance(msg, list)
d, m = deserialize(msg)
compare_nested_dict(data... | 2.359375 | 2 |
indico/testing/fixtures/util.py | bpedersen2/indico | 1 | 1366 | # This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import inspect
from datetime import datetime
import freezegun
import pytest
from sqlalchemy import DateTi... | 2.3125 | 2 |
config.py | RomashkaGang/Update_Checker | 0 | 1367 | <reponame>RomashkaGang/Update_Checker
#!/usr/bin/env python3
# encoding: utf-8
import os
# 是否启用调试 若启用 将不再忽略检查过程中发生的任何异常
# 建议在开发环境中启用 在生产环境中禁用
DEBUG_ENABLE = False
# SQLite 数据库文件名
SQLITE_FILE = "saved.db"
# 日志文件名
LOG_FILE = "log.txt"
# 是否启用日志
ENABLE_LOGGER = True
# 循环检查的间隔时间(默认: 180分钟)
LOOP_CHECK_INTERVAL = 180 * ... | 1.945313 | 2 |
cmdb-compliance/biz/handlers/asset_hipaa_data.py | zjj1002/aws-cloud-cmdb-system | 0 | 1368 | <reponame>zjj1002/aws-cloud-cmdb-system<gh_stars>0
from sqlalchemy import or_
from websdk.db_context import DBContext
from libs.base_handler import BaseHandler
from libs.pagination import pagination_util
from models.hipaa_data import HipaaData, model_to_dict
class HipaaDataHandler(BaseHandler):
@pagination_util
... | 2.21875 | 2 |
scripts/count.py | hellocit/kadai2 | 0 | 1369 | #!/usr/bin/env python3
import rospy
from std_msgs.msg import Int32
import time
rospy.init_node('count') # ノード名「count」に設定
pub = rospy.Publisher('count_up', Int32, queue_size=1) # パブリッシャ「count_up」を作成
rate = rospy.Rate(10) # 10Hzで実行
n = 0
time.sleep(2)
w... | 2.6875 | 3 |
snmp/nav/smidumps/ZyXEL_GS4012F_mib.py | alexanderfefelov/nav-add-ons | 0 | 1370 | # python version 1.0 DO NOT EDIT
#
# Generated by smidump version 0.4.8:
#
# smidump -f python ZYXEL-GS4012F-MIB
FILENAME = "mibs/ZyXEL/zyxel-GS4012F.mib"
MIB = {
"moduleName" : "ZYXEL-GS4012F-MIB",
"ZYXEL-GS4012F-MIB" : {
"nodetype" : "module",
"language" : "SMIv2",
"organizat... | 1.421875 | 1 |
rx/concurrency/timeoutscheduler.py | yutiansut/RxPY | 1 | 1371 | <filename>rx/concurrency/timeoutscheduler.py
import logging
from threading import Timer
from datetime import timedelta
from rx.core import Scheduler, Disposable
from rx.disposables import SingleAssignmentDisposable, CompositeDisposable
from .schedulerbase import SchedulerBase
log = logging.getLogger("Rx")
class Ti... | 2.796875 | 3 |
vgazer/version/custom_checker/inputproto.py | edomin/vgazer | 2 | 1372 | import requests
from bs4 import BeautifulSoup
def Check(auth, mirrors):
response = requests.get("https://www.x.org/releases/individual/proto/")
html = response.content.decode("utf-8")
parsedHtml = BeautifulSoup(html, "html.parser")
links = parsedHtml.find_all("a")
maxVersionMajor = -1
maxVers... | 2.859375 | 3 |
src/pandas_profiling/model/summary_helpers.py | briangrahamww/pandas-profiling | 0 | 1373 | import os
import string
from collections import Counter
from datetime import datetime
from functools import partial
from pathlib import Path
from typing import Optional
import numpy as np
import pandas as pd
from scipy.stats.stats import chisquare
from tangled_up_in_unicode import block, block_abbr, categor... | 2.265625 | 2 |
inverse_warp.py | ZephyrII/competitive_colaboration | 357 | 1374 | # Author: <NAME>
# Copyright (c) 2019, <NAME>
# All rights reserved.
# based on github.com/ClementPinard/SfMLearner-Pytorch
from __future__ import division
import torch
from torch.autograd import Variable
pixel_coords = None
def set_id_grid(depth):
global pixel_coords
b, h, w = depth.size()
i_range = Va... | 2.3125 | 2 |
lingvo/core/egdd.py | ramonsanabria/lingvo | 0 | 1375 | <reponame>ramonsanabria/lingvo<gh_stars>0
# Lint as: python2, python3
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# htt... | 1.835938 | 2 |
examples/nn_cudamat.py | cloudspectatordevelopment/cudamat | 526 | 1376 | <filename>examples/nn_cudamat.py
# This file shows how to implement a single hidden layer neural network for
# performing binary classification on the GPU using cudamat.
from __future__ import division
import pdb
import time
import numpy as np
import cudamat as cm
from cudamat import learn as cl
import util
# initial... | 3.109375 | 3 |
fair/forcing/ozone_tr.py | znicholls/FAIR | 1 | 1377 | <reponame>znicholls/FAIR<filename>fair/forcing/ozone_tr.py
from __future__ import division
import numpy as np
from ..constants import molwt
def regress(emissions,
beta=np.array([2.8249e-4, 1.0695e-4, -9.3604e-4, 99.7831e-4])):
"""Calculates tropospheric ozone forcing from precursor emissions.
In... | 2.171875 | 2 |
tests/test_publish.py | oarepo/oarepo-references-draft | 0 | 1378 | import uuid
from invenio_indexer.api import RecordIndexer
from invenio_pidstore.models import PersistentIdentifier, PIDStatus
from invenio_records_draft.api import RecordContext
from invenio_records_draft.proxies import current_drafts
from invenio_search import RecordsSearch, current_search, current_search_client
from... | 1.921875 | 2 |
examples/ROS/tiscamera.py | xiaotiansf/tiscamera | 0 | 1379 | import os
import subprocess
from collections import namedtuple
import gi
gi.require_version("Gst", "1.0")
gi.require_version("Tcam", "0.1")
from gi.repository import Tcam, Gst, GLib, GObject
DeviceInfo = namedtuple("DeviceInfo", "status name identifier connection_type")
CameraProperty = namedtuple("CameraProperty", ... | 2.265625 | 2 |
helpers/config.py | bertrand-caron/cv_blog_flask | 0 | 1380 | from typing import Dict, Any
from yaml import load
def get_config() -> Dict[str, Any]:
try:
return load(open('config/config.yml').read())
except Exception as e:
raise Exception('ERROR: Missing config/config.yml file.') from e
CONFIG = get_config()
| 2.828125 | 3 |
raman/unmixing.py | falckt/raman | 1 | 1381 | <filename>raman/unmixing.py<gh_stars>1-10
# Author: <NAME> <<EMAIL>>
#
# License: BSD 3 clause
#
# SPDX-License-Identifier: BSD-3-Clause
import collections
from itertools import product
import cvxpy as cp
import numpy as np
def sunsal_tv(A, Y, lambda_1, lambda_tv, sweep='prod', tv_type='iso', additional_constraint='... | 2.234375 | 2 |
test_stock.py | ucsb-cs48-w19/6pm-stock-trading | 1 | 1382 | import pytest
def test_stock():
assert(0 == 0)
| 1.539063 | 2 |
TM1py/Objects/ElementAttribute.py | damirishpreet/TM1py | 19 | 1383 | <gh_stars>10-100
# -*- coding: utf-8 -*-
import json
from TM1py.Objects.TM1Object import TM1Object
class ElementAttribute(TM1Object):
""" Abstraction of TM1 Element Attributes
"""
valid_types = ['NUMERIC', 'STRING', 'ALIAS']
def __init__(self, name, attribute_type):
self.name = name
... | 2.484375 | 2 |
account.py | MaherClinc/stockly-bs | 0 | 1384 | from sqlalchemy import exc
from sqlalchemy.sql.expression import func
from models import Watchlist, Portfolio, Activity
from app import db
import metric
def buy_stock(ticker, units):
unit_price = metric.get_price(ticker)
total_price = units * unit_price
max_id = db.session.query(func.max(Activity.activity... | 2.5625 | 3 |
scripts/addons/kekit/ke_fit2grid.py | Tilapiatsu/blender-custom_conf | 2 | 1385 | <filename>scripts/addons/kekit/ke_fit2grid.py
bl_info = {
"name": "ke_fit2grid",
"author": "<NAME>",
"category": "Modeling",
"version": (1, 0, 2),
"blender": (2, 80, 0),
}
import bpy
import bmesh
from .ke_utils import get_loops, correct_normal, average_vector
from mathutils import Vector, Matrix
d... | 1.945313 | 2 |
tests/test_update.py | en0/pyavl3 | 0 | 1386 | import unittest
from pyavl3 import AVLTree
class AVLTreeUpdateTest(unittest.TestCase):
def test_add_one(self):
a = AVLTree()
a.update({1:'a'})
self.assertEqual(len(a), 1)
| 2.859375 | 3 |
python/day5-1.py | Aerdan/adventcode-2020 | 0 | 1387 | #!/usr/bin/env python3
def binary(code, max, bits):
ret = []
for i in range(max):
ret.append(bits[code[i]])
return int(''.join(ret), base=2)
mid = 0
with open('input5.txt') as f:
for line in f.readlines():
line = line[:-1]
row = binary(line[:7], 7, {'F': '0', 'B': '1'})
... | 3.453125 | 3 |
custom_stocks_py/base.py | baramsalem/Custom-stocks-py | 0 | 1388 | """
custom_stocks_py base module.
This is the principal module of the custom_stocks_py project.
here you put your main classes and objects.
Be creative! do whatever you want!
If you want to replace this with a Flask application run:
$ make init
and then choose `flask` as template.
"""
class BaseClass:
de... | 2.625 | 3 |
dummy_server.py | dpmkl/heimdall | 0 | 1389 | #!/usr/bin/env python
import SimpleHTTPServer
import SocketServer
import logging
PORT = 8000
class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Content-type','text/html')
self.end_headers()
self.wfile.write("Hel... | 2.984375 | 3 |
cimsparql/__init__.py | nalu-svk/cimsparql | 0 | 1390 | <gh_stars>0
"""Library for CIM sparql queries"""
__version__ = "1.9.0"
| 0.882813 | 1 |
scripts/49-cat-logs.py | jmviz/xd | 179 | 1391 | #!/usr/bin/env python3
# Usage:
# $0 -o log.txt products/
#
# concatenates .log files (even those in subdirs or .zip) and combines into a single combined.log
from xdfile.utils import find_files_with_time, open_output, get_args
import boto3
# from boto.s3.connection import S3Connection
import os
def main():
a... | 2.46875 | 2 |
manuscript/link_checker.py | wuyang1002431655/tango_with_django_19 | 244 | 1392 | # Checks for broken links in the book chapters, printing the status of each link found to stdout.
# The Python package 'requests' must be installed and available for this simple module to work.
# Author: <NAME>
# Date: 2017-02-14
import re
import requests
def main(chapters_list_filename, hide_success=True):
"""
hide... | 3.625 | 4 |
service/__init__.py | 2890841438/fast-index.py | 4 | 1393 | <filename>service/__init__.py
# -*- coding = utf-8 -*-
# @Time: 2020/9/4 18:52
# @Author: dimples_yj
# @File: __init__.py.py
# @Software: PyCharm
| 1.007813 | 1 |
CLIP-ViL-Direct/vqa/pythia_clip_grid_feature.py | HermannLiang/CLIP-ViL | 0 | 1394 | <reponame>HermannLiang/CLIP-ViL
#!/usr/bin/env python3
"""
Grid features extraction script.
"""
import argparse
import os
import torch
import tqdm
from fvcore.common.file_io import PathManager
from detectron2.checkpoint import DetectionCheckpointer
from detectron2.config import get_cfg
from detectron2.engine import d... | 1.859375 | 2 |
src/node.py | aerendon/blockchain-basics | 6 | 1395 | <filename>src/node.py
from flask import Flask, request
import time
import requests
import json
from blockchain import Blockchain
from block import Block
app = Flask(__name__)
blockchain = Blockchain()
peers = set()
@app.route('/add_nodes', methods=['POST'])
def register_new_peers():
nodes = request.get_json()
... | 3 | 3 |
Luke 02/02.py | Nilzone-/Knowit-Julekalender-2017 | 0 | 1396 | import numpy as np
size = 1000
def create_wall(x, y):
return "{0:b}".format(x**3 + 12*x*y + 5*x*y**2).count("1") & 1
def build_grid():
return np.array([create_wall(j+1, i+1) for i in range(size) for j in range(size)]).reshape(size, size)
def visit(grid, x=0, y=0):
if grid[x][y]:
return
grid[x][y] = 1
... | 3.5 | 4 |
databases/music.py | danielicapui/programa-o-avancada | 0 | 1397 | from utills import *
conn,cur=start('music')
criarTabela("tracks","title text,plays integer")
music=[('trunder',20),
('my way',15)]
insertInto("tracks","title,plays",music)
#cur.executemany("insert into tracks (title,plays) values (?,?)",music)
buscaTabela("tracks","title")
conn.commit()
conn.close()
| 2.796875 | 3 |
video_analysis/code/scene_postprocess.py | pdxcycling/carv.io | 0 | 1398 | <filename>video_analysis/code/scene_postprocess.py<gh_stars>0
import pandas as pd
import numpy as np
import re
from collections import Counter
from flow_preprocess import FlowPreprocess
class ScenePostprocess(object):
"""
Heavy-lifting macro-feature class
"""
def __init__(self, flow_df, quality_df, re... | 2.765625 | 3 |
examples/pytorch/mnist/plot.py | ThomasRot/rational_activations | 0 | 1399 | import torch
import numpy as np
import pickle
torch.manual_seed(17)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
np.random.seed(17)
import argparse
import torch.nn as nn
import torch.nn.functional as F
import matplotlib
import os
from rational.torch import Rational, RecurrentRationa... | 2.34375 | 2 |