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 |
|---|---|---|---|---|---|---|
mcp_generation/mcqa_formatter.py | yuchenlin/XCSR | 16 | 22600 | <gh_stars>10-100
import json
probes = []
with open("./multilingual_probes.jsonl",'r') as f:
for line in f:
probes.append(json.loads(line.rstrip('\n|\r')))
results = []
for probe in probes:
new_items = {}
answer_labels = ["A", "B", "C", "D", "E","F","G","H"]
print(probe["truth_id"])
answerK... | 2.3125 | 2 |
tests/test_behavior.py | beskyfil/labels | 0 | 22601 | import pytest
from labelsync.github import Github
from labelsync.helpers import HTTPError
from tests.helpers import fl, FIXTURES_PATH, create_cfg_env, get_labels
c = create_cfg_env('good.cfg')
github = Github(c, name='github', api_url='https://api.github.com/repos')
label = {
'name':'blabla',
'color':... | 2.34375 | 2 |
authentication/cryptosign/function/authenticator.py | oberstet/crossbar-examples | 0 | 22602 | <reponame>oberstet/crossbar-examples
import copy
import random
from pprint import pformat
from txaio import make_logger
from autobahn.wamp.exception import ApplicationError
from autobahn.util import hl, hltype, hlid, hlval
# a simple principals database. in real world use, this likey would be
# replaced by some persis... | 2.6875 | 3 |
syd/syd_stitch_image.py | OpenSyd/syd | 4 | 22603 | <gh_stars>1-10
#!/usr/bin/env python3
import itk
import syd
# -----------------------------------------------------------------------------
def stitch_image(db, image1, image2):
print('image1', image1)
print('image2', image2)
im1 = syd.read_itk_image(db, image1)
im2 = syd.read_itk_image(db, image2)
... | 2.515625 | 3 |
pylinear/h5table/ddt.py | npirzkal/pyLINEAR | 0 | 22604 | <filename>pylinear/h5table/ddt.py<gh_stars>0
import numpy as np
import pdb
from . import columns
from . import h5utils
from .base import Base
class DDT(Base):
def __init__(self,segid):
self.segid=segid
self.pix=[]
self.xyg=columns.XYG()
self.wav=columns.WAV()
self.val=colum... | 2.390625 | 2 |
tools/auto_freeze.py | airacid/pruned-face-detector | 1 | 22605 |
import os
import tensorflow as tf
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--ckpt_path', type=str)
parser.add_argument('--output_path', type=str)
args = parser.parse_args()
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
checkpoint = args.ckpt_path
##input_checkpoint
input_che... | 2.265625 | 2 |
examples/nowcoder/SQL3/models.py | zhengtong0898/django-decode | 5 | 22606 | <reponame>zhengtong0898/django-decode<filename>examples/nowcoder/SQL3/models.py<gh_stars>1-10
from django.db import models
# 1. Django不支持符合主键(Composite Primary Key).
# 2. Django不支持关闭主键(Disable Primary Key),
# 当表中的所有字段都没有定义 Primary Key 时,
# Django会自动增加一个id字段, 并将primary key设定到id字段上.
#
#
# 一般情况下, InnoDB在建表时, 当没有定义Pr... | 2.421875 | 2 |
concat_csv.py | jweckman/vim | 0 | 22607 | import pandas as pd
from pathlib import Path
import sys
''' Concatenates all csv files in the folder passed to stdin '''
path = Path(sys.argv[1])
def get_csv_paths(path):
return [p for p in path.iterdir() if p.suffix == '.csv']
def ask_details():
print('Please specify the following:')
encod... | 3.484375 | 3 |
catkin_ws/src/rostest_example/tests/duckiecall_tester_node.py | DiegoOrtegoP/Software | 12 | 22608 | <reponame>DiegoOrtegoP/Software
#!/usr/bin/env python
import rospy
import unittest, rostest
from rostest_example.Quacker import *
from std_msgs.msg import String, Int32
class DuckiecallTesterNode(unittest.TestCase):
def __init__(self, *args):
super(DuckiecallTesterNode, self).__init__(*args)
self.m... | 2.484375 | 2 |
buildroot/support/testing/tests/init/test_busybox.py | rbrenton/hassos | 617 | 22609 | <gh_stars>100-1000
import infra.basetest
from tests.init.base import InitSystemBase as InitSystemBase
class InitSystemBusyboxBase(InitSystemBase):
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
"""
# BR2_TARGET_ROOTFS_TAR is not set
"""
def check_init(self):
super(InitSyst... | 2.09375 | 2 |
mayan/apps/linking/api_views.py | darrenflexxu/Mayan-EDMS | 0 | 22610 | <reponame>darrenflexxu/Mayan-EDMS
from __future__ import absolute_import, unicode_literals
from django.shortcuts import get_object_or_404
from mayan.apps.acls.models import AccessControlList
from mayan.apps.documents.models import Document
from mayan.apps.documents.permissions import permission_document_view
from may... | 1.976563 | 2 |
download_stats.py | zhengsipeng/kinetics-downloader | 263 | 22611 | import argparse, os
import lib.config as config
import lib.utils as utils
def count_present_and_missing(cls, directory, metadata):
"""
Count present and missing videos for a class based on metadata.
:param cls: The class. If None, count all videos (used for testing videos - no classes).
:param direc... | 2.859375 | 3 |
ex-mundo3/ex107/moeda.py | PedroPegado/ex-cursoemvideo | 0 | 22612 | def aumentar(preco, taxa):
p = preco + (preco * taxa/100)
return p
def diminuir(preco, taxa):
p = preco - (preco * taxa/100)
return p
def dobro(preco):
p = preco * 2
return p
def metade(preco):
p = preco / 2
return p
| 2.625 | 3 |
e2e/test_accessbot_show_resources.py | arthurSena0704/accessbot | 0 | 22613 | <filename>e2e/test_accessbot_show_resources.py<gh_stars>0
# pylint: disable=invalid-name
import pytest
import sys
from unittest.mock import MagicMock
from test_common import create_config, DummyResource
sys.path.append('plugins/sdm')
from lib import ShowResourcesHelper
pytest_plugins = ["errbot.backends.test"]
extra_... | 2.109375 | 2 |
tftf/layers/activations/tanh.py | yusugomori/tftf | 35 | 22614 | import tensorflow as tf
def tanh(x):
return tf.nn.tanh(x)
| 2.0625 | 2 |
game/migrations/0011_onlinegame_playersready.py | dimamelnik22/drawfulru | 0 | 22615 | # Generated by Django 3.0 on 2019-12-23 06:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('game', '0010_auto_20191223_0818'),
]
operations = [
migrations.AddField(
model_name='onlinegame',
name='... | 1.703125 | 2 |
deprecated.py | tungr/CoeusBot | 0 | 22616 | #### Transfer data from JSON file to MongoDB ####
# @client.command()
# async def qupload(self, ctx):
# mclient = MongoClient(host="localhost", port=27017)
# db = mclient.coeusbot
# quotesdb = db.quotes
# with open('quotes.json', 'r') as f:
# quotes = json.load(f)
# for quotenum in ra... | 2.59375 | 3 |
packaging/scripts/collect_matlab.py | robotraconteur/robotraconteur | 37 | 22617 | import shutil
import pathlib
asset_dirs = ["artifacts/main", "artifacts/build_python_version"]
pathlib.Path("distfiles").mkdir(exist_ok=True)
for asset_dir in asset_dirs:
for fname in list(pathlib.Path(asset_dir).glob('**/RobotRaconteur-*-MATLAB*')):
print(fname)
dest = pathlib.Path(fname)
... | 2.15625 | 2 |
setup.py | bryan-he/closek | 0 | 22618 | """Metadata for package to allow installation with pip."""
import setuptools
exec(open("closek/version.py").read())
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="closek",
description="Scikit-learn-style implementation of the close-k classifier.",
long_descri... | 1.484375 | 1 |
ramda/memoize_with_test.py | jakobkolb/ramda.py | 56 | 22619 | <gh_stars>10-100
from ramda.memoize_with import memoize_with
from ramda.product import product
from ramda.private.asserts import assert_equal as e
count = 0
def memoize_with_test():
@memoize_with(lambda x: -x)
def factorial(n):
global count
count += 1
return product(range(1, n + 1))
... | 2.296875 | 2 |
cdlib/evaluation/comparison.py | xing-lab-pitt/cdlib | 248 | 22620 | import numpy as np
from cdlib.evaluation.internal import onmi
from cdlib.evaluation.internal.omega import Omega
from nf1 import NF1
from collections import namedtuple, defaultdict
__all__ = [
"MatchingResult",
"normalized_mutual_information",
"overlapping_normalized_mutual_information_LFK",
"overlappin... | 2.359375 | 2 |
node/views/__init__.py | mohamedmansor/path-detector | 0 | 22621 | <reponame>mohamedmansor/path-detector
from .node_view import ConnectNodesViewSet, PathViewSet
| 1.054688 | 1 |
tests/modules/extra/fastapi/controller/integration/test_fastapi_app_with_controller.py | alice-biometrics/petisco | 19 | 22622 | from typing import Optional
import pytest
from fastapi import FastAPI, Header
from fastapi.testclient import TestClient
from meiga import BoolResult, Failure, isFailure, isSuccess
from petisco import NotFound, assert_http
from petisco.extra.fastapi import FastAPIController
app = FastAPI(title="test-app")
result_fro... | 2.484375 | 2 |
component/reminder/tasks.py | pablo0723/just-a-test | 0 | 22623 | from django.core.mail import send_mail
from component.reminder.models import Reminder
from server.celery import app
@app.task
def send_email(id):
reminder = Reminder.objects.filter(id=id).first()
if reminder is not None:
send_mail(subject="ReminderMessage",
message=reminder.text,
... | 2.078125 | 2 |
skmine/tests/test_base.py | remiadon/scikit-mine | 0 | 22624 | import pandas as pd
import pytest
from ..base import BaseMiner, MDLOptimizer
def test_inst_params():
class MyMiner(BaseMiner):
def __init__(self, eps=3):
self.eps = eps
self._a = 2
def fit(self, D):
self._a = 12
kwargs = dict(eps=4)
miner = MyMiner(**... | 2.1875 | 2 |
src/season/data/websrc/modules/intro/controller/index.py | season-framework/season-flask-wiz | 6 | 22625 | <reponame>season-framework/season-flask-wiz
import season
import random
class Controller(season.interfaces.controller.base):
def __init__(self, framework):
super().__init__(framework)
def __default__(self, framework):
return self.redirect('list')
def list(self, framework):
data ... | 2.3125 | 2 |
crypten/nn/onnx_converter.py | chenfar/CrypTen | 0 | 22626 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import copy
import io
import onnx
import torch
import torch.onnx.symbolic_helper as sym_help
import torch.onnx.symbo... | 2.40625 | 2 |
examples/pipeline.py | nicolay-r/AREk | 0 | 22627 | from arekit.common.data.input.providers.label.multiple import MultipleLabelProvider
from arekit.common.data.row_ids.multiple import MultipleIDProvider
from arekit.common.data.storages.base import BaseRowsStorage
from arekit.common.data.views.samples import BaseSampleStorageView
from arekit.common.experiment.data_type i... | 1.835938 | 2 |
python/lapack_like/reflect.py | justusc/Elemental | 0 | 22628 | <filename>python/lapack_like/reflect.py
#
# Copyright (c) 2009-2015, <NAME>
# All rights reserved.
#
# This file is part of Elemental and is under the BSD 2-Clause License,
# which can be found in the LICENSE file in the root directory, or at
# http://opensource.org/licenses/BSD-2-Clause
#
from ..core import *
i... | 1.59375 | 2 |
src/PointClasses/Bisector.py | Lovely-XPP/tkzgeom | 41 | 22629 | from Point import Point
import Constant as c
from GeometryMath import bisector_point
class Bisector(Point):
def __init__(self, item):
"""Construct Bisector."""
Point.__init__(self, item)
self.item["sub_type"] = c.Point.Definition.BISECTOR
def tikzify(self):
return '\\tkzDefLin... | 3.0625 | 3 |
custom_components/fitx/const.py | Raukze/home-assistant-fitx | 3 | 22630 | <gh_stars>1-10
DOMAIN = "fitx"
ICON = "mdi:weight-lifter"
CONF_LOCATIONS = 'locations'
CONF_ID = 'id'
ATTR_ADDRESS = "address"
ATTR_STUDIO_NAME = "studioName"
ATTR_ID = CONF_ID
ATTR_URL = "url"
DEFAULT_ENDPOINT = "https://www.fitx.de/fitnessstudios/{id}"
REQUEST_METHOD = "GET"
REQUEST_AUTH = None
REQUEST_HEADERS = None... | 1.359375 | 1 |
youtube_dl/extractor/scivee.py | Logmytech/youtube-dl-QT | 5 | 22631 | from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import int_or_none
class SciVeeIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?scivee\.tv/node/(?P<id>\d+)'
_TEST = {
'url': 'http://www.scivee.tv/node/62352',
'md5': 'b16699b74c9e6a120f677... | 2.375 | 2 |
examples/plot_tuh_eeg_corpus.py | SciMK/braindecode | 0 | 22632 | <reponame>SciMK/braindecode<filename>examples/plot_tuh_eeg_corpus.py
"""Process a big data EEG resource (TUH EEG Corpus)
===================================================
In this example, we showcase usage of the Temple University Hospital EEG Corpus
(https://www.isip.piconepress.com/projects/tuh_eeg/html/downloads.... | 2.265625 | 2 |
tests/metrics/test_metrics.py | HiromuHota/emmental | 0 | 22633 | <reponame>HiromuHota/emmental<gh_stars>0
import logging
import numpy as np
from emmental.metrics.accuracy import accuracy_scorer
from emmental.metrics.accuracy_f1 import accuracy_f1_scorer
from emmental.metrics.fbeta import f1_scorer, fbeta_scorer
from emmental.metrics.matthews_correlation import (
matthews_corre... | 2.09375 | 2 |
vesper/command/job_logging_manager.py | HaroldMills/NFC | 0 | 22634 | """Module containing class `JobLoggingManager`."""
from collections import defaultdict
from logging import FileHandler, Handler
from logging.handlers import QueueHandler, QueueListener
from multiprocessing import Queue
import logging
import vesper.util.logging_utils as logging_utils
import vesper.util.os_utils as os... | 2.953125 | 3 |
evaluation/metrics.py | victorperezpiqueras/MONRP | 0 | 22635 | import math
from typing import List
import numpy as np
from datasets.Dataset import Dataset
from models.Solution import Solution
def calculate_avgValue(population: List[Solution]) -> float:
avgValue = 0
for ind in population:
avgValue += ind.compute_mono_objective_score()
avgValue /= len(populati... | 2.9375 | 3 |
networkx/classes/tests/test_digraph_historical.py | KyleBenson/networkx | 0 | 22636 | <filename>networkx/classes/tests/test_digraph_historical.py
#!/usr/bin/env python
"""Original NetworkX graph tests"""
from nose.tools import *
import networkx
import networkx as nx
from networkx.testing.utils import *
from historical_tests import HistoricalTests
class TestDiGraphHistorical(HistoricalTests):
def ... | 2.515625 | 3 |
older/fn_res_to_icd/fn_res_to_icd/components/res_to_icd_function.py | nickpartner-goahead/resilient-community-apps | 65 | 22637 | <reponame>nickpartner-goahead/resilient-community-apps<gh_stars>10-100
# -*- coding: utf-8 -*-
# (c) Copyright IBM Corp. 2019. All Rights Reserved.
# pragma pylint: disable=unused-argument, no-self-use
import logging
import re
import sys
import requests
from bs4 import BeautifulSoup as bsoup
from resilient_circuits im... | 2 | 2 |
nimbleclient/v1/api/groups.py | prachiruparelia-hpe/nimble-python-sdk | 1 | 22638 | <filename>nimbleclient/v1/api/groups.py
#
# © Copyright 2020 Hewlett Packard Enterprise Development LP
#
# This file was auto-generated by the Python SDK generator; DO NOT EDIT.
#
from ...resource import Resource, Collection
from ...exceptions import NimOSAPIOperationUnsupported
class Group(Resource):
"""Gr... | 1.554688 | 2 |
sdk_client/scripts/cards2json.py | victorlacorte/MTG-SDK-Client | 0 | 22639 | import json
import mtgsdk as mtg
magic_sets = ('grn',)
def main():
for s in magic_sets:
cards = [vars(c) for c in mtg.Card.where(set=s).all()]
with open(f'tests/data/{s}.json', 'w') as f:
json.dump(cards, f, indent=4, sort_keys=True)
if __name__ == '__main__':
main()
| 2.296875 | 2 |
metview/param.py | ecmwf/metview-python | 88 | 22640 | # (C) Copyright 2017- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernme... | 1.9375 | 2 |
flask_edu_1/file1.py | fulkgl/Flask_edu_1 | 1 | 22641 | <reponame>fulkgl/Flask_edu_1
#!/usr/bin/env python3
# coding: UTF-8
'''!
module description
@author <A href="email:<EMAIL>"><NAME></A>
'''
__version__ = 0.01
def main():
'''!
main description
'''
print("Hello world")
return 0
if __name__ == "__main__":
# command line entry point
main()
... | 1.960938 | 2 |
write_grok/__init__.py | namedyangfan/Python_practice | 0 | 22642 | from .write_grok import * | 1.054688 | 1 |
backend/usuarios/views.py | alfmorais/pi-univesp | 1 | 22643 | from hashlib import sha256
from django.http import HttpResponse
from django.shortcuts import redirect, render
from .models import Usuarios
def login(request):
if request.session.get('usuario'):
return redirect('/livro/home/')
status = request.GET.get('status')
return render(request, 'login.... | 2.203125 | 2 |
textclf/tester/dl_tester.py | lswjkllc/textclf | 146 | 22644 | <reponame>lswjkllc/textclf<gh_stars>100-1000
import torch
from transformers import BertTokenizer
from .base_tester import Tester
from textclf.utils.raw_data import create_tokenizer
from textclf.utils.create import create_instance
from textclf.config import DLTesterConfig
from textclf.data.dictionary import Dictionary
... | 2.3125 | 2 |
scripts/pughpore/randomwalk/get_D_old.py | jhwnkim/nanopores | 8 | 22645 | import matplotlib
matplotlib.use("Agg")
from matplotlib import pyplot as plt
import numpy as np
import os
from nanopores.tools import fields
from scipy.interpolate import interp1d
HOME = os.path.expanduser("~")
DATADIR = os.path.join(HOME, "Dropbox", "nanopores", "fields")
fields.set_dir(DATADIR)
data = fields.get_fi... | 2.015625 | 2 |
scripts/unseen_pairs_prepare.py | dhh1995/SCL | 32 | 22646 | <reponame>dhh1995/SCL
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# File : unseen_pairs_prepare.py
# Author : <NAME>
# Email : <EMAIL>
# Date : 02/04/2019
#
# Distributed under terms of the MIT license.
'''
To split dataset into {train/val/test}_split_{rel}_{attr}_{args}.pkl
It will produce a set of indexes s... | 2.234375 | 2 |
apis/common/models/movie.py | sunil28rana/flask-imdb-sample-project | 0 | 22647 | <reponame>sunil28rana/flask-imdb-sample-project<gh_stars>0
from datetime import datetime
from sqlalchemy import UniqueConstraint
from apis.initialization import db
class Movie(db.Model):
""" Movie Model for storing movie details"""
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
ninety... | 2.890625 | 3 |
setup.py | DewMaple/toolkit | 0 | 22648 | <gh_stars>0
# from distutils.core import setup
from setuptools import setup, find_packages
setup(
name='py-toolkit',
version='0.0.3',
packages=find_packages(exclude=("tests",)),
url='https://github.com/DewMaple/toolkit',
description='python toolkit for common usage',
author='DewMaple',
auth... | 1.15625 | 1 |
ui.py | xKynn/zerox-assistant | 1 | 22649 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'hnc.ui'
#
# Created by: PyQt5 UI code generator 5.15.6
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, Q... | 2.109375 | 2 |
text_clf/data_load.py | kejunxiao/TextClf | 2 | 22650 | <filename>text_clf/data_load.py
"""
data preprocessing and get batch
"""
import os
import re
import logging
import itertools
from collections import Counter
import numpy as np
import pandas as pd
class DataLoad(object):
logging.getLogger().setLevel(logging.INFO)
def __init__(self, data_path, batch_size, num_... | 2.71875 | 3 |
pydsm/audio_weightings.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 0 | 22651 | <reponame>EnjoyLifeFund/macHighSierra-py36-pkgs
# -*- coding: utf-8 -*-
# Copyright (c) 2013, <NAME>
# All rights reserved.
# This file is part of PyDSM.
# PyDSM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundati... | 1.804688 | 2 |
data_custom/data_load.py | icon-lab/provoGAN | 1 | 22652 | import os
import nibabel
import numpy as np
import random
from scipy import ndimage
import SimpleITK as sitk
def load_nifty_volume_as_array(filename, with_header = False):
"""
load nifty image into numpy array, and transpose it based on the [z,y,x] axis order
The output array shape is like [Depth, Height,... | 3.234375 | 3 |
project/server/user/views.py | kangusrm/XML-parser | 1 | 22653 | <reponame>kangusrm/XML-parser<gh_stars>1-10
# project/server/user/views.py
#################
#### imports ####
#################
from flask import render_template, Blueprint, url_for, \
redirect, flash, request, session
from flask_login import login_user, logout_user, login_required
from project.server import b... | 2.125 | 2 |
active_feature_extractor/experiments/linear_q_learner.py | benblack769/atari_q_learner | 0 | 22654 | <gh_stars>0
import torch
import numpy as np
from torch import nn
def get_avg_discounted_value(next_dones, next_mask, next_rewards, next_value_preds, gamma):
minibatch_size, td_lambda = next_dones.shape
lambda_gamma = torch.cumprod(torch.ones(td_lambda)*gamma,dim=0) * (1/gamma)
# all dones also must be m... | 2.140625 | 2 |
Qualification/lazyLoader.py | monisjaved/Facebook-Hacker-Cup | 0 | 22655 | # https://www.facebook.com/hackercup/problem/169401886867367/
__author__ = "<NAME>"
__email__ = "<EMAIL>"
def numberOfDays(arr):
arr = sorted(arr)
n = 0
while len(arr) > 0:
k = arr[-1]
w = k
del arr[-1]
while w <= 50:
try:
del arr[0]
w += k
except:
break
if w > 50:
n += 1
return n
i... | 3.3125 | 3 |
examples/robot_mock.py | gmamaladze/robo-pi | 1 | 22656 | <filename>examples/robot_mock.py
class Robot:
def __init__(self, left="MOTOR4", right="MOTOR2", config=1):
print("init")
def forward(self):
print("forward")
def backward(self):
print("backward")
def left(self):
print("left")
def right(self):
print("right")... | 2.71875 | 3 |
libs/messaging_service/__init__.py | wip-abramson/aries-jupyter-playground | 6 | 22657 | <reponame>wip-abramson/aries-jupyter-playground
from .messaging_service import MessagingService | 0.949219 | 1 |
Ex087.py | andrade-lcs/ex_curso_em_video_python | 0 | 22658 | from random import randint
s = t = ma = 0
m = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
for l in range(0, 3):
for c in range(0, 3):
m[l][c] = randint(0, 100)
print('-='*15)
for l in range(0, 3):
t += m[l][2]
for c in range(0, 3):
print(f'[{m[l][c]:^5}]', end='')
if m[l][c] % 2 == 0:
... | 3.390625 | 3 |
networkx-d3-v2/networkx/tests/__init__.py | suraj-testing2/Clock_Websites | 0 | 22659 | <gh_stars>0
from .utils_tests import *
from .views_tests import *
| 1.117188 | 1 |
ros/src/waypoint_updater/waypoint_updater.py | dan-fern/CarND-Capstone-P9 | 0 | 22660 | #!/usr/bin/env python
import rospy as rp
import numpy as np
import math as math
from geometry_msgs.msg import PoseStamped, TwistStamped
from styx_msgs.msg import Lane, Waypoint
from scipy.spatial import KDTree
from std_msgs.msg import Int32
'''
This node will publish waypoints from the car's current position to some... | 2.890625 | 3 |
oandapy/exceptions.py | extreme4all/oandapy | 0 | 22661 | <gh_stars>0
"""Exceptions."""
class OandaError(Exception):
""" Generic error class, catches oanda response errors
"""
def __init__(self, error_response):
self.error_response = error_response
msg = f"OANDA API returned error code {error_response['code']} ({error_response['message']}) "
... | 2.71875 | 3 |
synthesis/reverse_map/reverse_map_ast.py | jajajaqlt/nsg | 10 | 22662 | # Copyright 2017 Rice University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 1.679688 | 2 |
ch10/myproject_virtualenv/src/django-myproject/myproject/settings/production.py | PacktPublishing/Django-3-Web-Development-Cookbook | 159 | 22663 | from ._base import *
DEBUG = False
WEBSITE_URL = "https://example.com" # without trailing slash
MEDIA_URL = f"{WEBSITE_URL}/media/"
| 1.289063 | 1 |
v2/gui.py | appills/pyascii | 0 | 22664 | from tkinter import *
from tkinter import filedialog
from pyascii import main
class App:
def __init__(self, master):
#initalize myFile instance variable
self.myFile = None
self.saveFile = None
#set window height
master.minsize(height = 440, width = 680)
#create frame
frame = Frame(master)
f... | 3.546875 | 4 |
tests/integration_tests/test_solution/test_solution_interior.py | cwentland0/perform | 6 | 22665 | import unittest
import os
import numpy as np
from constants import (
del_test_dir,
gen_test_dir,
get_output_mode,
solution_domain_setup,
CHEM_DICT_REACT,
SOL_PRIM_IN_REACT,
TEST_DIR,
)
from perform.constants import REAL_TYPE
from perform.system_solver import SystemSolver
from perform.input... | 2.15625 | 2 |
tests/system/post_cars_positive_test.py | ikostan/REST_API_AUTOMATION | 8 | 22666 | <filename>tests/system/post_cars_positive_test.py<gh_stars>1-10
#!/path/to/interpreter
"""
Flask App REST API testing: POST
"""
# Created by <NAME>.
# GitHub: https://github.com/ikostan
# LinkedIn: https://www.linkedin.com/in/egor-kostan/
import allure
import requests
from tests.system.base_test import BaseTestCa... | 2.40625 | 2 |
bin/h5zero.py | ickc/dautil-py | 0 | 22667 | #!/usr/bin/env python
'''Assert HDF5 input is non-zero.
Print to stderr if not.
For example,
find . -iname '*.hdf5' -exec h5zero.py {} +
'''
from __future__ import print_function
import argparse
import sys
import h5py
from dautil.IO.h5 import h5assert_nonzero
__version__ = '0.1'
def main(args):
for filenam... | 2.59375 | 3 |
cla_backend/apps/core/validators.py | uk-gov-mirror/ministryofjustice.cla_backend | 3 | 22668 | <reponame>uk-gov-mirror/ministryofjustice.cla_backend<filename>cla_backend/apps/core/validators.py
from django.core.exceptions import ValidationError
def validate_first_of_month(value):
if value.day != 1:
raise ValidationError("%s should only be first day of the month." % value)
| 2 | 2 |
app/_version.py | sunhailin-Leo/myMacAssistant | 63 | 22669 | __version__ = "1.0.0"
__author__ = "sunhailin-Leo"
| 1.03125 | 1 |
Week6/GFG(Day8-14)/Day14/Day14 - Solution.py | ShreyaPanale/100DaysOfCode | 22 | 22670 | #User function Template for python3
class Solution:
def calculateSpan(self,a,n):
Span = [0 for i in range(n)]
stack = [0]
#span value of first day is always 1.
Span[0] = 1
for i in range(1, n):
#we pop elements from the stack till price at top of stack is less th... | 3.515625 | 4 |
test/tests.py | jasedit/papers_base | 8 | 22671 | #!python
# -*- coding: utf-8 -*-
"""Unit testing for scriptorium"""
import os
import tempfile
import shutil
import textwrap
import unittest
import scriptorium
class TestScriptorium(unittest.TestCase):
@classmethod
def setUpClass(cls):
"""Set up unit tests for scriptorium"""
TestScriptorium.templa... | 2.703125 | 3 |
imblearn/combine/tests/test_smote_enn.py | themrzmaster/imbalanced-learn | 2 | 22672 | """Test the module SMOTE ENN."""
# Authors: <NAME> <<EMAIL>>
# <NAME>
# License: MIT
import pytest
import numpy as np
from sklearn.utils.testing import assert_allclose, assert_array_equal
from imblearn.combine import SMOTEENN
from imblearn.under_sampling import EditedNearestNeighbours
from imblearn.over_sam... | 1.984375 | 2 |
tests/unittests/test_mock_network_plugin_public_nat.py | cloudify-cosmo/tosca-vcloud-plugin | 4 | 22673 | <filename>tests/unittests/test_mock_network_plugin_public_nat.py
# Copyright (c) 2014-2020 Cloudify Platform 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
#
# ... | 1.9375 | 2 |
Taller_estruturas_de_control_secuenciales/Python_yere/Ejercicio_17.py | Matieljimenez/Algoritmos_y_programacion | 0 | 22674 | """
Entradas
monto de dinero presupuestal-->float-->a
Salidas
dinero correspondiente para ginecologia-->float-->b
dinero correspondiente para traumatologia-->float-->c
dinero correspondiente para pediatria-->float-->d
"""
a=float(input("Presupuesto anual al Hospital rural "))
b=a*0.40
c=a*0.30
d=a*0.30
print("El presup... | 4.03125 | 4 |
tools/generate_things/generate_navigation.py | akalenuk/wordsandbuttons | 367 | 22675 | <reponame>akalenuk/wordsandbuttons
import os
import subprocess
PAGES_DIR = "../../pages"
keyword_note = {
'tutorials': '',
'demos': '',
'quizzes': '',
'mathematics': '',
'algorithms': '',
'programming': 'By the way, if you prefer books to blogs, <a href="https://wordsandbuttons.online/SYTYKC.pdf">there is a free book... | 2.875 | 3 |
apps/listings/migrations/0002_remove_post_author.py | favours-io/favours | 11 | 22676 | # Generated by Django 3.0.7 on 2020-09-22 05:14
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('listings', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='post',
name='author',
),
]
| 1.46875 | 1 |
venv/Lib/site-packages/bootstrap4/widgets.py | HRangelov/gallery | 3 | 22677 | <gh_stars>1-10
from django.forms import RadioSelect
class RadioSelectButtonGroup(RadioSelect):
"""
This widget renders a Bootstrap 4 set of buttons horizontally instead of typical radio buttons.
Much more mobile friendly.
"""
template_name = "bootstrap4/widgets/radio_select_button_group.html"
| 1.695313 | 2 |
workflower/services/workflow/loader.py | dmenezesgabriel/workflower | 0 | 22678 | import logging
import os
import traceback
from typing import List
from workflower.adapters.sqlalchemy.setup import Session
from workflower.adapters.sqlalchemy.unit_of_work import SqlAlchemyUnitOfWork
from workflower.application.event.commands import CreateEventCommand
from workflower.application.workflow.commands impo... | 2.203125 | 2 |
setup.py | neuroticnerd/dragoncon-bot | 2 | 22679 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import io
import os
import re
from setuptools import find_packages, setup
here = os.path.abspath(os.path.dirname(__file__))
PROJECT_MODULE = 'dragonite'
PROJECT = 'dragonite'
AUTHOR = '<NAME>'
EMAIL = '<EMAIL>'... | 1.5625 | 2 |
backend/api.py | RuiL1904/Hackathon | 5 | 22680 | <gh_stars>1-10
import random
import database
from fastapi import FastAPI, Request
from fastapi.middleware.cors import CORSMiddleware
import uvicorn
# Instantiate FastAPI
app = FastAPI()
# Whitelist origins
app.add_middleware(
CORSMiddleware,
allow_origins = ["*"],
allow_credentials = True,
allow_met... | 2.625 | 3 |
lfs/portlet/models/pages.py | zhammami/django-lfs | 0 | 22681 | # django imports
from django import forms
from django.conf import settings
from django.core.cache import cache
from django.template.loader import render_to_string
# portlets imports
from portlets.models import Portlet
# lfs imports
from lfs.page.models import Page
class PagesPortlet(Portlet):
"""Portlet to disp... | 2.25 | 2 |
feed/models.py | kassupto007/photo-sharing-app | 0 | 22682 | <gh_stars>0
from django.conf import settings
from django.db import models
from django.utils import timezone
from users.models import Profile
class Post(models.Model):
description = models.CharField(max_length=255)
picture = models.ImageField(upload_to='posts', blank=True)
date_posted = models.DateTimeFiel... | 2.203125 | 2 |
zampol/osoba/admin.py | VadymRud/zampolit | 0 | 22683 | from django.contrib import admin
from django.db import models
from django.utils.translation import gettext as _
from .models import (MilitaryRank, Platoon, ServiseID, Unit, OfficialPosition, Company,
Education, Creed, Nationality, Command)
from osoba.widgets import CustomDatePickerInput
class Ser... | 1.71875 | 2 |
python/src/problem/leetcode/easy/leetcode_189.py | yipwinghong/Algorithm | 9 | 22684 | # coding=utf-8
from typing import List
class Solution:
"""
旋转数组
"""
def reverse(self, nums: List[int], i: int, j: int) -> None:
"""
:param nums:
:param i:
:param j:
:return:
"""
while i < j:
nums[i], nums[j] = nums[j], nums[i]
... | 3.953125 | 4 |
brainmix_register/display/display.py | ThunderShiviah/brainmix-register | 4 | 22685 | import sys, os, glob
from skimage import io
from skimage import viewer
import registration as reg
from skimage import data
def display():
pass
if __name__ == "__main__":
# ------------------Create input ndarray------------------------
inputDir = '../data/test/'
imageFiles = glob.glob(os.path.join(inp... | 2.453125 | 2 |
lib/datasets/LFW2G.py | blacknwhite5/facial-anonymizer | 10 | 22686 | <filename>lib/datasets/LFW2G.py
import numpy as np
import torch
import torch.utils.data as data
from PIL import Image, ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
import os, random, glob, cv2
class LFW2G(data.Dataset):
def __init__(self, data_dir='data', transform=None):
super(LFW2G, self).__init__()
... | 2.5625 | 3 |
questions.py | lasyasreepada/iplaw-for-digital-teens | 0 | 22687 | <reponame>lasyasreepada/iplaw-for-digital-teens
"""Set of questions for the IP Law quiz
questions.py
<NAME>
Yale College '19
May 6, 2017
"""
from random import shuffle
import time
def quiz():
questions = [
("Copyright protects both expression of an idea and the idea itself. \nTrue or False?", "f", "cp")... | 3.15625 | 3 |
Python/leetcode/Triangle.py | darrencheng0817/AlgorithmLearning | 2 | 22688 | <filename>Python/leetcode/Triangle.py<gh_stars>1-10
'''
Created on 1.12.2016
@author: Darren
''''''
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.
For example, given the following triangle
[
[2],
[3,4],
[6... | 3.75 | 4 |
regulations/tests/layers_toc_applier_tests.py | contolini/regulations-site | 18 | 22689 | from unittest import TestCase
from regulations.generator.layers.toc_applier import *
class TableOfContentsLayerTest(TestCase):
def test_section(self):
toc = TableOfContentsLayer(None)
el = {}
toc.section(el, {'index': ['1']})
self.assertEqual({}, el)
toc.section(el, {'in... | 2.765625 | 3 |
array_range.py | fasiha/array-range-slices-py | 1 | 22690 | """
Numpy's `split` can split a multidimensional array into non-overlapping
sub-arrays. However, this is not a memory-efficient way of dealing with
non-overlapping partitions of an array because it effectively doubles
memory usage.
This module provides an iterable generator that produces tuples of slices,
each of whic... | 3.921875 | 4 |
test-framework/test-suites/integration/tests/add/test_add_host_bonded.py | knutsonchris/stacki | 123 | 22691 | <filename>test-framework/test-suites/integration/tests/add/test_add_host_bonded.py
import json
from textwrap import dedent
import pytest
@pytest.mark.usefixtures("add_host_with_interface")
class TestAddHostBonded:
def test_no_hosts(self, host):
result = host.run('stack add host bonded')
assert result.rc == 255
... | 2.421875 | 2 |
BITs/2014/Kozlov_A_D/task_8_11.py | YukkaSarasti/pythonintask | 0 | 22692 | <gh_stars>0
#Задача 8. Вариант 11.
#1-50. Доработайте игру "Анаграммы" (см. М.Доусон Программируем на Python. Гл.4) так, чтобы к каждому слову полагалась подсказка. Игрок должен получать право на подсказку в том случае, если у него нет никаких предположений. Разработайте систему начисления очков, по которой бы игроки,... | 4 | 4 |
master/teachkids-master/teachkids-master/ch09/Challenge2_ColorPaint.py | AlexRogalskiy/DevArtifacts | 4 | 22693 | # ColorPaint.py
import pygame # setup
import random
pygame.init()
screen = pygame.display.set_mode([800, 600])
pygame.display.set_caption('Click and drag to draw, using up to 3 mouse buttons')
keepGoing = True
ORANGE = (255,255,0) # RGB color triplets for 3 mousebutton colors
GREEN = (0,25... | 3.640625 | 4 |
eventmanager/events/tests.py | karinakozarova/EventManager | 4 | 22694 | import datetime
import unittest
from accounts.models import AccountDetails
from categories.models import Category
from django.contrib.auth.models import User
from django.test import Client
from django.test import TestCase
from django.urls import reverse
from events.models import Comment
from events.models import E... | 2.46875 | 2 |
billing/tests/views.py | hkhanna/django-stripe-billing | 1 | 22695 | from django.views.generic import TemplateView
from .. import mixins
class ProfileView(mixins.BillingMixin, TemplateView):
template_name = "profile.html"
| 1.5 | 2 |
core/model/meta/mtl.py | Aamer98/LibFewShot_NoAffine | 1 | 22696 | # -*- coding: utf-8 -*-
"""
@inproceedings{DBLP:conf/cvpr/SunLCS19,
author = {<NAME> and
<NAME> and
Tat{-}<NAME> and
<NAME>},
title = {Meta-Transfer Learning for Few-Shot Learning},
booktitle = {{IEEE} Conference on Computer Vision and Pattern Recognition, {CVPR... | 2.421875 | 2 |
game.py | gustavonaldoni/command-line-hangman | 0 | 22697 | from capture_words import capture_words_from_file
import random
def find_letter_indexes(letter, word):
indexes = []
for index, l in enumerate(word):
if l == letter:
indexes.append(index)
return indexes
def convert_word_to_asterisks(word):
final_word = '*' * len(word)
return... | 3.53125 | 4 |
src/OTLMOW/OTLModel/Classes/DwarseMarkeringVerschuind.py | davidvlaminck/OTLClassPython | 2 | 22698 | # coding=utf-8
from OTLMOW.OTLModel.BaseClasses.OTLAttribuut import OTLAttribuut
from OTLMOW.OTLModel.Classes.DwarseMarkeringToegang import DwarseMarkeringToegang
from OTLMOW.OTLModel.Datatypes.KlDwarseMarkeringVerschuindCode import KlDwarseMarkeringVerschuindCode
from OTLMOW.OTLModel.Datatypes.KlDwarseMarkeringVerschu... | 1.960938 | 2 |
backend/reviews/forms.py | ranwise/djangochannel | 45 | 22699 | <reponame>ranwise/djangochannel
from django import forms
from .models import Review
class ReviewsForm(forms.ModelForm):
"""Форма добавления отзыва"""
class Meta:
model = Review
fields = ["name", "text", "social_link", "git_link"]
labels = {
"name": (""),
"text"... | 2.15625 | 2 |