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 |
|---|---|---|---|---|---|---|
ga4gh/search/compliance/util/local_server.py | ga4gh-discovery/ga4gh-search-compliance | 0 | 12600 | <filename>ga4gh/search/compliance/util/local_server.py
# -*- coding: utf-8 -*-
"""Module compliance_suite.report_server.py
This module contains class definition of small web server utility. Serves final
report results as HTML.
"""
import datetime
import time
import http.server
import socketserver
import os
import log... | 2.53125 | 3 |
api/routefinder.py | shingkid/DrWatson-ToTheRescue_SCDFXIBM | 1 | 12601 | import csv
import pandas as pd
import numpy as np
import networkx as nx
class RouteFinder():
def __init__(self):
G = nx.Graph()
with open('data/node_pairs.csv') as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
for row in readCSV:
# add edges
... | 3.203125 | 3 |
lectures/extensions/hyperbolic_discounting/replication_code/.mywaflib/waflib/extras/rst.py | loikein/ekw-lectures | 4 | 12602 | #!/usr/bin/env python
# <NAME>, 2013 (zougloub)
"""
reStructuredText support (experimental)
Example::
def configure(conf):
conf.load('rst')
if not conf.env.RST2HTML:
conf.fatal('The program rst2html is required')
def build(bld):
bld(
features = 'rst',
type = 'rst2html', # rst2html, rst2pdf, ...
... | 2.375 | 2 |
mofa/analytics/tests/test_participationAnalytics/test_quizParticipation.py | BoxInABoxICT/BoxPlugin | 0 | 12603 | <gh_stars>0
import unittest
import json
import os
from unittest.mock import MagicMock, patch
from analytics.src.participationAnalytics import quizParticipation
class TestQuizParticipation(unittest.TestCase):
@patch("analytics.src.participationAnalytics.quizParticipation.runQuery")
def test_generateData(self... | 2.6875 | 3 |
visualize_cam.py | mhamdan91/Gradcam_eager | 2 | 12604 | # from utils import Sample_main
import gradcam_main
import numpy as np
import tensorflow as tf
import argparse
import os
tf.logging.set_verbosity(tf.logging.ERROR) # disable to see tensorflow warnings
def cam(in_path='sample.bmp', out_path = 'sample.png',):
gradcam_main.cam_vis(in_path, out_path)
def main():
... | 2.125 | 2 |
tests/molecular/molecules/building_block/test_with_functional_groups.py | andrewtarzia/stk | 21 | 12605 | from ..utilities import (
has_same_structure,
is_equivalent_molecule,
is_equivalent_building_block,
are_equivalent_functional_groups,
)
def test_with_functional_groups(building_block, get_functional_groups):
"""
Test :meth:`.BuildingBlock.with_functional_groups`.
Parameters
----------... | 2.40625 | 2 |
tests/master/test_master.py | bk-mtg/piwheels | 0 | 12606 | <reponame>bk-mtg/piwheels
# The piwheels project
# Copyright (c) 2017 <NAME> <https://github.com/bennuttall>
# Copyright (c) 2017 <NAME> <<EMAIL>>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistribu... | 1.46875 | 1 |
dibase/rpi/gpio/test/pinid-platformtests.py | ralph-mcardell/dibase-rpi-python | 0 | 12607 | '''
Part of the dibase.rpi.gpio.test package.
GPIO pin id support classes' platform tests.
Underlying GPIO pin ids are those used by the Linux gpiolib and used
to identify a device's GPIO pins in the Linux sys filesystem GPIO
sub-tree.
Developed by <NAME> / Dibase Limited.
Copyrig... | 2.46875 | 2 |
analysis.py | tj294/2.5D-RB | 0 | 12608 | """
Analysis code for plotting vertical flux transport and/or a gif of temperature,
velocity and KE from the merged output of a Dedalus Rayleigh-Bérnard code.
Author: <NAME>
"""
# ====================
# IMPORTS
# ====================
import numpy as np
import h5py
import argparse
import matplotlib.pyplot as plt
import ... | 2.5 | 2 |
direct_gd_predict/hash-profile.py | wac/meshop | 1 | 12609 | <reponame>wac/meshop<gh_stars>1-10
import sys
import heapq
import optparse
from bitcount2 import bitcount
hasher={}
profile={}
key_list=[]
key_col=0
def usage():
print sys.argv[0]," [profile_file]"
print " Load the profile lines from profile_file"
print " Hash function uses the features listed in profi... | 2.6875 | 3 |
sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_publisher_client_async.py | conniey/azure-sdk-for-python | 2 | 12610 | <filename>sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_publisher_client_async.py<gh_stars>1-10
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project ro... | 1.476563 | 1 |
multi_tool.py | zbigos/multi_project_tools | 0 | 12611 | <reponame>zbigos/multi_project_tools<gh_stars>0
#!/usr/bin/env python3
import logging, sys, argparse
from collect import Collection
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="test a project repo")
parser.add_argument('--force-delete', help='instead of aborting on existing files, d... | 2.078125 | 2 |
benchbuild/projects/benchbuild/bots.py | ognarb/benchbuild | 0 | 12612 | from plumbum import local
from benchbuild import project
from benchbuild.utils import compiler, download, run, wrapping
from benchbuild.utils.cmd import make, mkdir
@download.with_git("https://github.com/bsc-pm/bots", limit=5)
class BOTSGroup(project.Project):
"""
Barcelona OpenMP Task Suite.
Barcelona ... | 1.984375 | 2 |
clients/python/setup.py | timtadh/queued | 4 | 12613 | <gh_stars>1-10
try:
from setuptools import setup
setup # quiet "redefinition of unused ..." warning from pyflakes
# arguments that distutils doesn't understand
setuptools_kwargs = {
'install_requires': [
],
'provides': ['queued'],
'zip_safe': False
}
except Impor... | 1.3125 | 1 |
sym_executor.py | zhangzhenghsy/fiber | 0 | 12614 | #!/usr/bin/python
import angr,simuvex
import sys,os
import time
from utils_sig import *
from sym_tracer import Sym_Tracer
from sig_recorder import Sig_Recorder
#This class is responsible for performing symbolic execution.
class Sym_Executor(object):
def __init__(self,options=None,dbg_out=False):
self.trace... | 2.40625 | 2 |
apim-migration-testing-tool/Python/venv/lib/python3.6/site-packages/pymysql/constants/CR.py | tharindu1st/apim-migration-resources | 1,573 | 12615 | <filename>apim-migration-testing-tool/Python/venv/lib/python3.6/site-packages/pymysql/constants/CR.py
# flake8: noqa
# errmsg.h
CR_ERROR_FIRST = 2000
CR_UNKNOWN_ERROR = 2000
CR_SOCKET_CREATE_ERROR = 2001
CR_CONNECTION_ERROR = 2002
CR_CONN_HOST_ERROR = 2003
CR_IPSOCK_ERROR = 2004
CR_UNKNOWN_HOST = 2005
CR_SERVER_GON... | 1.21875 | 1 |
check-challenge.py | gjaiswal108/Check-if-Challenge-problem-added-in-codechef | 0 | 12616 | <filename>check-challenge.py
import requests,smtplib,time
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
r =requests.get('https://www.codechef.com/JUNE19B/')
while(1):
if('(Challenge)' in r.text):
s = smtplib.SMTP('smtp.gmail.com', 587)
s.starttls()
s.log... | 2.90625 | 3 |
applications/tensorflow/click_through_rate/din/test/test_attention_fcn.py | kew96/GraphcoreExamples | 0 | 12617 | # Copyright (c) 2020 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.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | 1.796875 | 2 |
shiva/constants.py | tooxie/shiva-server | 70 | 12618 | # -*- coding: utf-8 -*-
class HTTP:
BAD_REQUEST = 400
UNAUTHORIZED = 401
FORBIDDEN = 403
NOT_FOUND = 404
METHOD_NOT_ALLOWED = 405
CONFLICT = 409
UNSUPPORTED_MEDIA_TYPE = 415
| 1.382813 | 1 |
tests/test_cmdline.py | lin-zone/scrapyu | 1 | 12619 | <filename>tests/test_cmdline.py
import sys
import subprocess
from tempfile import mkdtemp, TemporaryFile
from path import Path
from tests import TEST_DIR
args = (sys.executable, '-m', 'scrapyu.cmdline')
def test_genspider_list():
new_args = args + ('genspider', '-l')
res = subprocess.check_output(new_args... | 2.4375 | 2 |
src/olympia/amo/cron.py | dante381/addons-server | 0 | 12620 | <gh_stars>0
from datetime import datetime, timedelta
from django.core.files.storage import default_storage as storage
import olympia.core.logger
from olympia import amo
from olympia.activity.models import ActivityLog
from olympia.addons.models import Addon
from olympia.addons.tasks import delete_addons
from olympia.a... | 1.9375 | 2 |
day8/test_day8.py | bwbeach/advent-of-code-2020 | 0 | 12621 | <filename>day8/test_day8.py
from day8.day8 import fix_code, parse_code, run
SAMPLE_CODE_LOOP = """nop +0
acc +1
jmp +4
acc +3
jmp -3
acc -99
acc +1
jmp -4
acc +6
"""
SAMPLE_CODE_HALT = """nop +0
acc +1
jmp +4
acc +3
jmp -3
acc -99
acc +1
nop -4
acc +6
"""
def test_parse():
assert parse_code("nop +0\nacc +1\nacc... | 2.96875 | 3 |
biosys/apps/main/tests/api/test_misc.py | florianm/biosys | 2 | 12622 | <reponame>florianm/biosys
from django.shortcuts import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from main.models import Project
from main.tests import factories
from main.tests.api import helpers
class TestWhoAmI(helpers.BaseUserTestCase):
... | 2.3125 | 2 |
src/netwrok/analytics.py | simonwittber/netwrok-server | 16 | 12623 | <gh_stars>10-100
import asyncio
import aiopg
from . import nwdb
from . import core
@core.handler
def register(client, path, event):
"""
Register an event occuring at path. Created time is automatically added.
Useful for generic analytics type stuff.
"""
with (yield from nwdb.connection()) as conn:... | 2.390625 | 2 |
monte_carlo/helpers/muaanalytical.py | nathhje/bachelorproject | 0 | 12624 | # -*- coding: utf-8 -*-
"""
Deterimines the reflectance based on r and mua.
"""
import math
import helpers.analyticalvalues as av
def reflectance(mua, r):
"""
mua: the absorption coefficient used.
r: the radial distance used.
"""
values = av.analyticalValues(r, mua)
# the value of th... | 3.21875 | 3 |
main/test_data.py | anna01111/demo_web_ui_test_suite | 0 | 12625 | <filename>main/test_data.py
from faker import Faker
"""
More info: https://microservices-demo.github.io/docs/user-accounts.html
"""
# The demo app is shipped with the following account:
username = 'user'
password = 'password'
# Fake data that is used for new registrations:
faker = Faker()
autogenerated_username = fa... | 2.0625 | 2 |
pfr/run.py | AnnaMag/pdf-flask-react | 2 | 12626 | <reponame>AnnaMag/pdf-flask-react<filename>pfr/run.py
from io import StringIO
from io import BytesIO
import urllib
from urllib import request
import utils
from pdf_processing import scrape_gazette_names, get_info_outline
from data_parsing import save_to_dict
if __name__ == '__main__':
# not saving anything loca... | 2.796875 | 3 |
day9/day9.py | jaredledvina/adventofcode2020 | 1 | 12627 | <filename>day9/day9.py
#!/usr/bin/env python3
import itertools
def read_input():
with open('input.txt') as f:
puzzle_input = f.read().splitlines()
puzzle_input = [int(num) for num in puzzle_input]
return puzzle_input
def part1(puzzle_input):
preamble = puzzle_input[:25]
remaining = puz... | 3.6875 | 4 |
streamlitfront/tests/common.py | i2mint/streamlitfront | 0 | 12628 | from contextlib import contextmanager
from functools import partial
from inspect import Parameter
from random import choice, randint, uniform
import string
from typing import Any
from i2 import Sig
from numbers import Number
from sys import platform
from selenium.common.exceptions import NoSuchElementException
from sel... | 2.46875 | 2 |
Python_files/analyse.py | Deniz-shelby/goodreads_webscrap | 0 | 12629 | <gh_stars>0
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from matplotlib import rcParams
from sklearn.preprocessing import MinMaxScaler
import warnings
import scipy.stats as st
import statsmodels as sm
def analyse(df_input,df_all_input):
df = df_input
fig, ax ... | 2.78125 | 3 |
3 assignment/number_of_digits_unitest.py | nastae/programavimas_python | 0 | 12630 | <gh_stars>0
import unittest
def number_of_digits(s):
return sum(c.isdigit() for c in s)
# Parašykite funkcijai X unittest'us
class Test(unittest.TestCase):
def test_only_digits(self):
s = "123456789"
self.assertEqual(number_of_digits(s), 9)
def test_only_letters(self):
s = "abcde... | 3.796875 | 4 |
scraper/edx.py | thanasis457/Mooc-platform | 4 | 12631 | import requests, json, bs4, urllib.parse, math
from . import Course, Platform
class Edx(Platform):
name = 'edX'
def _urls(self):
res = requests.get(make_url())
count = json.loads(res.text)['objects']['count']
num_pages = math.ceil(count / 20)
urls = [make_url(pag... | 2.84375 | 3 |
main.py | LaudateCorpus1/TotalConnect2.0_API-Arm-Disarm | 1 | 12632 | #!/usr/local/bin/python2.7
#FREEBSD 2 Minutes ARP Expires - /bin/echo "net.link.ether.inet.max_age 300" >> /etc/sysctl.conf
#Crontab -e "* * * * * /usr/local/bin/python2.7 /root/Security.py"
import subprocess
import ConfigParser
import string, os, sys, httplib
import xml.etree.ElementTree as ET
from datetime import da... | 2.25 | 2 |
prm/relations/migrations/0002_activity.py | justaname94/innovathon2019 | 0 | 12633 | # Generated by Django 2.2.5 on 2019-09-09 21:21
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('relations', '0001_initia... | 1.882813 | 2 |
elliptic_moab/Mesh/MeshQL.py | padmec-reservoir/elliptic_moab | 0 | 12634 | <reponame>padmec-reservoir/elliptic_moab
from typing import Type
from elliptic.Kernel.Context import ContextDelegate
from .Selector import SelectorImplementation
from .Manager import ManagerImplementation
from .Computer import ComputerImplementation
class MeshQLImplementation(ComputerImplementation, ManagerImplemen... | 2.140625 | 2 |
tests/test_quil.py | stjordanis/quantumflow | 99 | 12635 | <filename>tests/test_quil.py
# Copyright 2016-2018, Rigetti Computing
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
import pytest
import quantumflow as qf
QUIL_FILES = [
'hello_world.quil',
'empty.quil',
... | 2.375 | 2 |
gitool/util.py | eikendev/gitool | 1 | 12636 | <filename>gitool/util.py<gh_stars>1-10
import itertools
import logging
from git import Repo, InvalidGitRepositoryError
from .repository import Repository
logger = logging.getLogger("gitool")
def _list_repositories(path):
subdirectories = [p for p in path.iterdir() if p.is_dir()]
names = [p.name for p in su... | 2.765625 | 3 |
taiga/projects/epics/serializers.py | threefoldtech/Threefold-Circles | 0 | 12637 | <reponame>threefoldtech/Threefold-Circles
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2017 <NAME> <<EMAIL>>
# Copyright (C) 2014-2017 <NAME> <<EMAIL>>
# Copyright (C) 2014-2017 <NAME> <<EMAIL>>
# Copyright (C) 2014-2017 <NAME> <<EMAIL>>
# This program is free software: you can redistribute it and/or modify
# it under ... | 1.210938 | 1 |
src/TMDbApi/TMTranslationUnit.py | shasha79/nectm | 3 | 12638 | <gh_stars>1-10
#
# Copyright (c) 2020 <NAME>.
#
# This file is part of NEC TM
# (see https://github.com/shasha79/nectm).
#
# 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 copyr... | 1.78125 | 2 |
tests/test_268.py | sungho-joo/leetcode2github | 0 | 12639 | #!/usr/bin/env python
import pytest
"""
Test 268. Missing Number
"""
@pytest.fixture(scope="session")
def init_variables_268():
from src.leetcode_268_missing_number import Solution
solution = Solution()
def _init_variables_268():
return solution
yield _init_variables_268
class TestClass... | 2.859375 | 3 |
tests/db/test_connector.py | DaWeSearch/backend | 1 | 12640 | import unittest
import os
import json
from functions.db.connector import *
from functions.db.models import *
from functions.authentication import *
sample_search = {
"search_groups": [
{
"search_terms": ["blockchain", "distributed ledger"],
"match": "OR"
},
{
... | 2.65625 | 3 |
tests/test_capstone.py | GrammaTech/gtirb-capstone | 6 | 12641 | <gh_stars>1-10
# Copyright (C) 2020 GrammaTech, Inc.
#
# This code is licensed under the MIT license. See the LICENSE file in
# the project root for license terms.
#
# This project is sponsored by the Office of Naval Research, One Liberty
# Center, 875 N. Randolph Street, Arlington, VA 22203 under contract #
# N68335-1... | 1.9375 | 2 |
python/paddle/fluid/tests/unittests/npu/test_update_loss_scaling_min_op_npu.py | L-Net-1992/Paddle | 0 | 12642 | # Copyright (c) 2021 PaddlePaddle 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 app... | 2.03125 | 2 |
Examples/WorkingWithMimeMessages/SetEmailHeaders.py | Muzammil-khan/Aspose.Email-Python-Dotnet | 5 | 12643 | import aspose.email as ae
import datetime
def run():
# The path to the File directory.
dataDir = "Data/"
#ExStart: SetEmailHeaders
# Create an instance of MailMessage class
eml = ae.MailMessage()
# Specify ReplyTo, From, To field, Cc and Bcc Addresses
eml.reply_to_list.Add("<EMAIL>")
... | 2.96875 | 3 |
intrinsic/classify.py | seenu-andi-rajendran/plagcomps | 2 | 12644 | # classify.py
# Alternative methods to clustering
import sys, os
from random import shuffle
import cPickle
from collections import Counter
sys.path.append('../pybrain/') # add the pybrain module to the path... TODO: actually install it.
from plagcomps.shared.util import IntrinsicUtility
from ..dbconstants import user... | 2.140625 | 2 |
matplotlib-3.4.3/matplotlib-3.4.3/examples/images_contours_and_fields/image_transparency_blend.py | JohnLauFoo/clc_packages_Yu | 1 | 12645 | <reponame>JohnLauFoo/clc_packages_Yu
"""
==========================================
Blend transparency with color in 2D images
==========================================
Blend transparency with color to highlight parts of data with imshow.
A common use for `matplotlib.pyplot.imshow` is to plot a 2D statistical
map. T... | 3.5625 | 4 |
tests/test_admin.py | FernandoCelmer/django-global-permissions | 30 | 12646 | <reponame>FernandoCelmer/django-global-permissions
from django.test import TestCase
from django.core.urlresolvers import reverse
try:
from django.contrib.auth import get_user_model
User = get_user_model()
except ImportError:
from django.contrib.auth.models import User
class GlobalPermissionsAdminTest(Tes... | 2.3125 | 2 |
Models/utils.py | weslai/ecg_classification | 1 | 12647 | <reponame>weslai/ecg_classification
import matplotlib.pyplot as plt
import itertools
import numpy as np
from sklearn.metrics import confusion_matrix
## be used to evaluate the model
def evaluate_model(history, X_test, y_test, model):
scores = model.evaluate((X_test), y_test, verbose=0)
print("Accuracy: %.2f%%"... | 3.34375 | 3 |
evapotranspiration/penman_monteith_daily.py | JRoehrig/evapotranspiration | 2 | 12648 | import math
import numpy as np
import pandas as pd
class PenmanMonteithDaily(object):
r"""The class *PenmanMonteithDaily* calculates daily potential evapotranspiration according to the Penman-Monteith
method as described in
`FAO 56 <http://www.fao.org/tempref/SD/Reserved/Agromet/PET/FAO_Irrigation_Drainag... | 3.09375 | 3 |
src/cnc-app-name/views.py | scotchoaf/cnc-skeleton | 0 | 12649 | <reponame>scotchoaf/cnc-skeleton
# Copyright (c) 2018, Palo Alto Networks
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED... | 1.875 | 2 |
tcc_server/emulatorRPi.py | MegaNo0body/tcc | 1 | 12650 | <gh_stars>1-10
import sys
from time import sleep
from random import randint
from urllib.request import urlopen
from urllib.parse import urlencode
if len(sys.argv) != 2:
print('Por favor, usar: ' + sys.argv[0] + ' {idSensor}')
print('Exemplo: ' + sys.argv[0] + ' 8')
else:
sensorId = sys.argv[1]
URL_SERV... | 2.90625 | 3 |
sayn/logging/file_logger.py | robin-173/sayn | 105 | 12651 | from pathlib import Path
import logging
from .logger import Logger
from .log_formatter import LogFormatter
class FileLogger(Logger):
fmt = LogFormatter(use_colour=False, output_ts=False)
logger = None
def __init__(self, folder, format=None):
if format is None:
format = ("%(asctime)s|... | 2.828125 | 3 |
tests/test_docs.py | gitter-badger/pygsuite | 0 | 12652 | from pygsuite import DefaultFonts, TextStyle, Color
from pygsuite.docs.doc_elements.paragraph import Paragraph
BRIGHT_GREEN_HEX = "#72FF33"
def test_text(test_document):
document = test_document
docbody = document.body
docbody.delete()
docbody.add_text(
"TEST_CUSTOM\n",
style=TextStyl... | 2.59375 | 3 |
neutra/vae.py | dieterichlawson/google-research | 4 | 12653 | # coding=utf-8
# Copyright 2019 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | 1.84375 | 2 |
flask_oauth2_login/base.py | BasicBeluga/flask-oauth2-login | 42 | 12654 | from flask import request, session, url_for
from requests_oauthlib import OAuth2Session
class OAuth2Login(object):
def __init__(self, app=None):
if app:
self.init_app(app)
self.app = app
def get_config(self, app, name, default_value=None):
return app.config.get(self.config_prefix + name, def... | 2.96875 | 3 |
segmentation/utils/transforms.py | voldemortX/DST-CBC | 103 | 12655 | <gh_stars>100-1000
# Mostly copied and modified from torch/vision/references/segmentation to support unlabeled data
# Copied functions from fmassa/vision-1 to support multi-dimensional masks loaded from numpy ndarray
import numpy as np
from PIL import Image
import random
import torch
import utils.functional as F
# Fo... | 2.3125 | 2 |
server.py | drunkHatch/CMPUT404-assignment-webserver | 0 | 12656 | # coding: utf-8
import socketserver
import re
import socket
import datetime
import os
import mimetypes as MT
import sys
# Copyright 2013 <NAME>, <NAME>
#
# 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 ... | 2.5625 | 3 |
cloudkitty/rating/hash/controllers/root.py | wanghuiict/cloudkitty | 97 | 12657 | # -*- coding: utf-8 -*-
# Copyright 2015 <NAME>
#
# 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 appli... | 1.828125 | 2 |
.test/test/task2/Aufgabe1/python-lib/cuddlefish/docs/webdocs.py | sowinski/testsubtree | 0 | 12658 | import os, re, errno
import markdown
import cgi
from cuddlefish import packaging
from cuddlefish.docs import apirenderer
from cuddlefish._version import get_versions
INDEX_PAGE = '/doc/static-files/base.html'
BASE_URL_INSERTION_POINT = '<base '
VERSION_INSERTION_POINT = '<div id="version">'
THIRD_PARTY_PACKAGE_SUMMAR... | 2.3125 | 2 |
src/c3nav/site/templatetags/route_render.py | johnjohndoe/c3nav | 132 | 12659 | <reponame>johnjohndoe/c3nav
from django import template
register = template.Library()
@register.filter
def negate(value):
return -value
@register.filter
def subtract(value, arg):
return value - arg
| 1.953125 | 2 |
coax/experience_replay/_prioritized.py | sleepy-owl/coax | 0 | 12660 | # ------------------------------------------------------------------------------------------------ #
# MIT License #
# #
# Copyright (c) 2... | 1.148438 | 1 |
src/OTLMOW/OEFModel/Classes/Wilddet.py | davidvlaminck/OTLClassPython | 2 | 12661 | # coding=utf-8
from OTLMOW.OEFModel.EMObject import EMObject
# Generated with OEFClassCreator. To modify: extend, do not edit
class Wilddet(EMObject):
"""Een wilddetectiesysteem zal de weggebruikers waarschuwen bij de aanwezigheid van eventueel overstekend wild"""
typeURI = 'https://lgc.data.wegenenverkeer.b... | 1.804688 | 2 |
test/python/testworkflow.py | kokizzu/txtai | 0 | 12662 | <gh_stars>0
"""
Workflow module tests
"""
import contextlib
import glob
import io
import os
import tempfile
import sys
import unittest
import numpy as np
import torch
from txtai.api import API
from txtai.embeddings import Documents, Embeddings
from txtai.pipeline import Nop, Segmentation, Summary, Translation, Textr... | 2.28125 | 2 |
apps/summary/urls.py | sotkonstantinidis/testcircle | 3 | 12663 | from django.conf.urls import url
from .views import SummaryPDFCreateView
urlpatterns = [
url(r'^(?P<id>[\d]+)/$',
SummaryPDFCreateView.as_view(),
name='questionnaire_summary'),
]
| 1.65625 | 2 |
utipy/array/blend.py | LudvigOlsen/utipy | 0 | 12664 | """
@author: ludvigolsen
"""
from typing import Union
import numpy as np
import pandas as pd
from utipy.utils.check_instance import check_instance
from utipy.utils.convert_to_type import convert_to_type
def blend(x1: Union[list, np.ndarray, pd.Series], x2: Union[list, np.ndarray, pd.Series], amount: float = 0.5) -> ... | 2.921875 | 3 |
output/models/ms_data/regex/hangul_compatibility_jamo_xsd/__init__.py | tefra/xsdata-w3c-tests | 1 | 12665 | <reponame>tefra/xsdata-w3c-tests
from output.models.ms_data.regex.hangul_compatibility_jamo_xsd.hangul_compatibility_jamo import Doc
__all__ = [
"Doc",
]
| 0.917969 | 1 |
ex082.py | favitoria/python123 | 0 | 12666 | resposta = 'Ss'
numeros = 0
listaTODOS = []
listaPAR = []
listaIMPAR = []
while resposta != 'N':
numeros = int(input('Digite um número: '))
resposta = str(input('Deseja continuar [S/N]? '))
if numeros % 2 == 0:
listaPAR.append(numeros)
elif numeros % 2 == 1:
listaIMPAR.append(numeros)
... | 3.90625 | 4 |
CodingInterview2/29_PrintMatrix/print_matrix.py | hscspring/TheAlgorithms-Python | 10 | 12667 | <gh_stars>1-10
"""
面试题 29:顺时针打印矩阵
题目:输入一个矩阵,按照从外向里以顺时针的顺序依次打印出每一个数字。
"""
def make_matrix(rows: int, cols: int) -> list:
res = []
k = 0
for i in range(rows):
tmp = []
for j in range(cols):
k += 1
tmp.append(k)
res.append(tmp)
return res
def print_matri... | 4.0625 | 4 |
migrations/versions/ee5315dcf3e1_.py | wildintellect/tasking-manager | 3 | 12668 | <reponame>wildintellect/tasking-manager<filename>migrations/versions/ee5315dcf3e1_.py
"""empty message
Revision ID: ee<PASSWORD>
Revises: <PASSWORD>
Create Date: 2017-05-24 10:39:46.586986
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'ee<PASSWORD>'
down_revi... | 1.320313 | 1 |
python/random-videogame-generator.py | iamashiq/Hacktoberfest2021-2 | 6 | 12669 | <filename>python/random-videogame-generator.py<gh_stars>1-10
print("Are you trying to find new videogames to play?")
print("let me help you!")
print("do you like shooting games, yes or no")
shooting=input()
if shooting = "yes"
print("do you like battle royale games?")
br=input()
if br="yes"
print("you sho... | 3.421875 | 3 |
cosmic_ray/operators/unary_operator_replacement.py | rob-smallshire/cosmic-ray | 0 | 12670 | <gh_stars>0
"""Implementation of the unary-operator-replacement operator.
"""
import ast
from .operator import Operator
from ..util import build_mutations
# None indicates we want to delete the operator
OPERATORS = (ast.UAdd, ast.USub, ast.Invert, ast.Not, None)
def _to_ops(from_op):
"""
The sequence o... | 3.28125 | 3 |
src/icolos/core/workflow_steps/calculation/rmsd.py | jharrymoore/Icolos | 11 | 12671 | from typing import List
from pydantic import BaseModel
from icolos.core.containers.compound import Conformer, unroll_conformers
from icolos.utils.enums.step_enums import StepRMSDEnum, StepDataManipulationEnum
from icolos.core.workflow_steps.step import _LE
from icolos.core.workflow_steps.calculation.base import StepCa... | 2.09375 | 2 |
iot/iot_portal/doctype/iot_homepage/iot_homepage.py | srdgame/symlink_iot | 4 | 12672 | # -*- coding: utf-8 -*-
# Copyright (c) 2017, <NAME> and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.website.utils import delete_page_cache
class IOTHomepage(Document):
def validate(self):
... | 2.03125 | 2 |
src/garage/envs/env_spec.py | Maltimore/garage | 2 | 12673 | <filename>src/garage/envs/env_spec.py
"""EnvSpec class."""
class EnvSpec:
"""EnvSpec class.
Args:
observation_space (akro.Space): The observation space of the env.
action_space (akro.Space): The action space of the env.
"""
def __init__(self, observation_space, action_space):
... | 1.867188 | 2 |
exercises/exe41 - 50/exe047.py | thomas-rohde/Classes-Python | 0 | 12674 | t = int(input('Digite um nº: '))
for t0 in range(1, 11):
print('{} X {} = {}'.format(t, t0, t * t0))
| 3.6875 | 4 |
py_build/funcs.py | Aesonus/py-build | 0 | 12675 | from __future__ import annotations
from typing import Callable, Sequence, TYPE_CHECKING
import functools
if TYPE_CHECKING:
from .build import BuildStepCallable
def split_step_name(name: str, new = ' ', old='_'):
return name.replace(old, new).capitalize()
def print_step_name(formatter=split_step_name, args: Se... | 2.9375 | 3 |
src/jellyroll/managers.py | jacobian-archive/jellyroll | 3 | 12676 | import datetime
from django.db import models
from django.db.models import signals
from django.contrib.contenttypes.models import ContentType
from django.utils.encoding import force_unicode
from tagging.fields import TagField
class ItemManager(models.Manager):
def __init__(self):
super(ItemManager, sel... | 2.28125 | 2 |
app_metrics.py | GSH-LAN/byceps | 33 | 12677 | """
metrics application instance
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 <NAME>
:License: Revised BSD (see `LICENSE` file for details)
"""
import os
from byceps.config import ConfigurationError
from byceps.metrics.application import create_app
ENV_VAR_NAME_DATABASE_URI = 'DATABASE_URI'
database_uri = ... | 1.898438 | 2 |
mysql_tests/test_schema.py | maestro-1/gino | 1,376 | 12678 | from enum import Enum
import pytest
import gino
from gino.dialects.aiomysql import AsyncEnum
pytestmark = pytest.mark.asyncio
db = gino.Gino()
class MyEnum(Enum):
ONE = "one"
TWO = "two"
class Blog(db.Model):
__tablename__ = "s_blog"
id = db.Column(db.BigInteger(), primary_key=True)
title = ... | 2.28125 | 2 |
solutions/29-distinct-powers.py | whitegreyblack/euler | 0 | 12679 | <gh_stars>0
# problem 29
# Distinct powers
"""
Consider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5:
2**2=4, 2**3=8, 2**4=16, 2**5=32
3**2=9, 3**3=27, 3**4=81, 3**5=243
4**2=16, 4**3=64, 4**4=256, 4**5=1024
5**2=25, 5**3=125, 5**4=625, 5**5=3125
If they are then placed in numerical order, with any repe... | 3.296875 | 3 |
flexget/plugins/input/input_csv.py | metaMMA/Flexget | 0 | 12680 | <reponame>metaMMA/Flexget
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
from future.utils import PY3
import logging
import csv
from requests import RequestException
from flexget import plugin
from flexget.entry impor... | 2.390625 | 2 |
gdget.py | tienfuc/gdcmdtools | 29 | 12681 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import re
from gdcmdtools.base import BASE_INFO
from gdcmdtools.base import DEBUG_LEVEL
from gdcmdtools.get import GDGet
from gdcmdtools.get import export_format
import argparse
from argparse import RawTextHelpFormatter
from pprint import pprint
import logg... | 2.5 | 2 |
Lotus/controller/common.py | Jayin/Lotus | 0 | 12682 | # -*- coding: utf-8 -*-
from Lotus.app import app
from flask import render_template
@app.route('/')
def index():
return 'welcome'
@app.errorhandler(404)
def page_not_found(error):
return render_template('404.html')
@app.errorhandler(405)
def request_method_error(error):
return render_template('405.htm... | 2.3125 | 2 |
src/retrocookie/git.py | cjolowicz/retrocookie | 15 | 12683 | """Git interface."""
from __future__ import annotations
import contextlib
import functools
import operator
import re
import subprocess # noqa: S404
from dataclasses import dataclass
from dataclasses import field
from pathlib import Path
from typing import Any
from typing import cast
from typing import Iterator
from t... | 2.40625 | 2 |
apps/user/views.py | awsbreathpanda/dailyfresh | 0 | 12684 | <gh_stars>0
from django.shortcuts import redirect
from django.contrib.auth import authenticate, login, logout
from celery_tasks.tasks import celery_send_mail
from apps.user.models import User
import re
from django.shortcuts import render
from django.views import View
from utils.security import get_user_token, get_activ... | 2.078125 | 2 |
heatzy/pilote_v1.py | Devotics/heatzy-home-hassistant | 22 | 12685 | from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (HVAC_MODE_AUTO,
PRESET_AWAY,
PRESET_COMFORT, PRESET_ECO,
... | 2.53125 | 3 |
kubernetes-the-hard-way/system/collections/ansible_collections/community/general/plugins/modules/cloud/misc/proxmox_template.py | jkroepke/homelab | 5 | 12686 | #!/usr/bin/python
#
# Copyright: Ansible Project
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
module: proxmox_template
short_description: management of OS te... | 1.757813 | 2 |
polling_stations/apps/councils/management/commands/import_councils.py | DemocracyClub/UK-Polling-Stations | 29 | 12687 | <filename>polling_stations/apps/councils/management/commands/import_councils.py<gh_stars>10-100
import json
from html import unescape
import requests
from django.apps import apps
from django.contrib.gis.geos import GEOSGeometry, MultiPolygon, Polygon
from django.conf import settings
from django.core.management.base im... | 2.140625 | 2 |
saleor/webhook/observability/payload_schema.py | DevPoke/saleor | 0 | 12688 | from datetime import datetime
from enum import Enum
from json.encoder import ESCAPE_ASCII, ESCAPE_DCT # type: ignore
from typing import List, Optional, Tuple, TypedDict
class JsonTruncText:
def __init__(self, text="", truncated=False, added_bytes=0):
self.text = text
self.truncated = truncated
... | 2.625 | 3 |
NMTK_apps/NMTK_server/wms/djpaste.py | bhargavasana/nmtk | 0 | 12689 | # (c) 2013 <NAME> and contributors; written to work with Django and Paste (http://pythonpaste.org)
# Paste CGI "middleware" for Django by <NAME> <<EMAIL>>
# Open Technology Group, Inc <http://www.otg-nc.com>
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
import os
import sys
import... | 2.390625 | 2 |
Ago-Dic-2019/JOSE ONOFRE/PRACTICAS/Practica1/RestaurantSeat.py | Arbupa/DAS_Sistemas | 41 | 12690 | <gh_stars>10-100
cantidad= input("Cuantas personas van a cenar?")
cant = int(cantidad)
print(cant)
if cant > 8:
print("Lo siento, tendran que esperar")
else:
print("La mesa esta lista")
| 3.71875 | 4 |
build/piman.app/pysnmp/carrier/asyncore/dgram/base.py | jackgisel/team-athens | 0 | 12691 | #
# This file is part of pysnmp software.
#
# Copyright (c) 2005-2019, <NAME> <<EMAIL>>
# License: http://snmplabs.com/pysnmp/license.html
#
import socket
import errno
import sys
from pysnmp.carrier.asyncore.base import AbstractSocketTransport
from pysnmp.carrier import sockfix, sockmsg, error
from pysnmp import debug
... | 2.03125 | 2 |
src/coreclr/scripts/superpmi-replay.py | JimmyCushnie/runtime | 2 | 12692 | #!/usr/bin/env python3
#
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the MIT license.
#
##
# Title : superpmi_setup.py
#
# Notes:
#
# Script to run "superpmi replay" for various collections under various COMPlus_JitStressRegs value.... | 1.609375 | 2 |
parse_cookie.py | olnikiforov/hillel | 0 | 12693 | <reponame>olnikiforov/hillel
def parse_cookie(query: str) -> dict:
res = {}
if query:
data = query.split(';')
for i in data:
if '=' in i:
res[i.split('=')[0]] = '='.join(i.split('=')[1:])
return res
if __name__ == '__main__':
assert parse_cookie('name=Dima;... | 2.953125 | 3 |
neuralgym/callbacks/model_saver.py | pancookie/SNPGAN_TECcompletion | 1 | 12694 | <gh_stars>1-10
"""model_saver"""
import os
from . import PeriodicCallback, CallbackLoc
from ..utils.logger import callback_log
class ModelSaver(PeriodicCallback):
"""Save model to file at every pstep step_start.
Args:
pstep (int): Save to model every pstep.
saver: Tensorflow saver.
d... | 2.359375 | 2 |
rower_monitor/boat_metrics.py | sergiomo/diy-rower-monitor | 0 | 12695 | from .time_series import TimeSeries
class BoatModel:
def __init__(self, workout):
self.workout = workout
self.position = TimeSeries()
self.speed = TimeSeries()
def update(self):
"""This function gets called on every flywheel encoder tick."""
pass
class RotatingWheel... | 3.59375 | 4 |
trackMe-backend/src/config.py | matth3wliuu/trackMe | 1 | 12696 | <filename>trackMe-backend/src/config.py
dbConfig = {
"user": "root",
"password": "<PASSWORD>",
"host": "localhost",
"database": "trackMe_dev"
} | 1.039063 | 1 |
src/localsrv/urls.py | vladiibine/localsrv | 0 | 12697 | from django.conf.urls import url
from .views import serve_all
urlpatterns = (
url(r'^.*$', serve_all, name="localsrv:serve_all"),
) | 1.421875 | 1 |
netrd/__init__.py | sdmccabe/netrd | 116 | 12698 | """
netrd
-----
netrd stands for Network Reconstruction and Distances. It is a repository
of different algorithms for constructing a network from time series data,
as well as for comparing two networks. It is the product of the Network
Science Insitute 2019 Collabathon.
"""
from . import distance # noqa
from . impo... | 1.859375 | 2 |
pytorch/GPT.py | lyq628/NLP-Tutorials | 643 | 12699 | from transformer import Encoder
from torch import nn,optim
from torch.nn.functional import cross_entropy,softmax, relu
from torch.utils.data import DataLoader
from torch.utils.data.dataloader import default_collate
import torch
import utils
import os
import pickle
class GPT(nn.Module):
def __init__(self, model_d... | 2.515625 | 3 |