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 |
|---|---|---|---|---|---|---|
feed/serializers/extensions.py | cul-it/arxiv-rss | 4 | 800 | <reponame>cul-it/arxiv-rss
"""Classes derived from the Feedgen extension classes."""
from typing import Dict, List, Optional
from lxml import etree
from lxml.etree import Element
from flask import current_app
from feedgen.ext.base import BaseEntryExtension, BaseExtension
from feed.domain import Author, Media
class ... | 2.015625 | 2 |
discovery-infra/test_infra/helper_classes/config/controller_config.py | lranjbar/assisted-test-infra | 0 | 801 | <reponame>lranjbar/assisted-test-infra
from abc import ABC
from pathlib import Path
from typing import Any
from dataclasses import dataclass
from test_infra import consts
from test_infra.utils.global_variables import GlobalVariables
from .base_config import _BaseConfig
global_variables = GlobalVariables()
@datacla... | 2.078125 | 2 |
bitcoinpy/mempool.py | obulpathi/bitcoinpy | 21 | 802 | # MemPool.py
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import logging
from lib.serialize import uint256_to_shortstr
class MemPool(object):
def __init__(self):
self.pool = {}
# setup logging
logging.basicConfi... | 2.21875 | 2 |
bashspy/parser.py | sarvi/bashspy | 0 | 803 | '''
Created on Jun 13, 2019
@author: sarvi
'''
from sly import Parser
from .lexer import BashLexer
class ASTCommands(list):
__slots__ = ('grouping')
def __init__(self, command, grouping=None):
self.append(command)
self.grouping = grouping
def __repr__(self):
x=[str(i) for i in s... | 2.71875 | 3 |
Module03/pregnancy_wheel.py | biomed-bioinformatics-bootcamp/bmes-t580-2019-coursework-charrison620 | 0 | 804 | <reponame>biomed-bioinformatics-bootcamp/bmes-t580-2019-coursework-charrison620<gh_stars>0
import datetime
def print_header():
print('----------------------------')
print(' Due Date APP ')
print('----------------------------')
print()
def get_lmp_from_patient():
print("When was the ... | 3.59375 | 4 |
costcalculator/forms.py | connor-c/Trip-Gas-Cost-Calculator | 0 | 805 | from django import forms
from django.core.validators import MinValueValidator, MinLengthValidator
class OriginForm(forms.Form):
origin_address = forms.CharField(validators=[MinLengthValidator(1)], widget=forms.TextInput(attrs={'class': 'form-control', 'id': 'inlineFormInputGroup', 'placeholder': '123 Tech St, Sili... | 2.234375 | 2 |
tasks/storm_raffle_handler.py | Ayouuuu/bili2.0 | 2 | 806 | <reponame>Ayouuuu/bili2.0
import bili_statistics
from reqs.storm_raffle_handler import StormRaffleHandlerReq
from tasks.utils import UtilsTask
from .base_class import Forced, DontWait, Multi
class StormRaffleJoinTask(Forced, DontWait, Multi):
TASK_NAME = 'join_storm_raffle'
# 为了速度,有时不用等room_id验证就参加,置room_id为... | 1.882813 | 2 |
u24_lymphocyte/third_party/treeano/sandbox/nodes/gradnet.py | ALSM-PhD/quip_classification | 45 | 807 | <gh_stars>10-100
import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn
fX = theano.config.floatX
@treeano.register_node("grad_net_interpolation")
class GradNetInterpolationNode(treeano.NodeImpl):
"""
interpolates outputs between 2 nodes
"""
hyperparameter_names = ("late... | 2.078125 | 2 |
minus80/RawFile.py | brohammer/Minus80 | 0 | 808 | <filename>minus80/RawFile.py
import gzip #pragma: no cover
import bz2 #pragma: no cover
import lzma #pragma: no cover
class RawFile(object):#pragma: no cover
def __init__(self,filename):
self.filename = filename
if filename.endswith('.gz'):
self.handle = gzip.open(filename,'rt'... | 3.28125 | 3 |
utils/config.py | jtr109/Alpha2kindle | 0 | 809 | <gh_stars>0
# -*- coding: utf-8 -*-
import os
class BaseConf(object):
HEADERS = {
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) "
"AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/55.0.2883.95 "
"Safari/537.36",
"A... | 2.21875 | 2 |
framework/database/__init__.py | fabmiz/osf.io | 0 | 810 | <filename>framework/database/__init__.py<gh_stars>0
# -*- coding: utf-8 -*-
import functools
import httplib as http
import markupsafe
from django.core.paginator import Paginator
from django.db.models import Q, QuerySet
from framework.exceptions import HTTPError
def get_or_http_error(Model, pk_or_query, allow_deleted... | 2.359375 | 2 |
neptune/internal/client_library/job_development_api/image.py | jiji-online/neptune-cli | 0 | 811 | <reponame>jiji-online/neptune-cli
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016, deepsense.io
#
# 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... | 2 | 2 |
src/picome/hukeyboard.py | guibohnert91/picome | 0 | 812 | <filename>src/picome/hukeyboard.py
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.keycode import Keycode
import usb_hid
import time
class HumanKeyboard(object):
def __init__(self):
self.keyboard = Keyboard(usb_hid.devices)
... | 2.890625 | 3 |
src/solutions/part2/q104_max_bi_tree_depth.py | hychrisli/PyAlgorithms | 0 | 813 | <filename>src/solutions/part2/q104_max_bi_tree_depth.py
from src.base.solution import Solution
from src.tests.part2.q104_test_max_bi_tree_depth import MaxBiTreeDepthTestCases
class MaxBiTreeDepth(Solution):
def gen_test_cases(self):
return MaxBiTreeDepthTestCases()
def run_test(self, input):
... | 2.359375 | 2 |
inventory/admin.py | shakyasaijal/businessAnalytics | 0 | 814 | from django.contrib import admin
from . import models
class SupplierAdmin(admin.ModelAdmin):
list_display = ('supplier_name', 'contact', )
search_fields = ['supplier_name', 'contact', ]
admin.site.register(models.Suppliers, SupplierAdmin)
class InventoryUserAdmin(admin.ModelAdmin):
list_display = ('empl... | 1.726563 | 2 |
python/testData/resolve/TryExceptElse.py | jnthn/intellij-community | 2 | 815 | <gh_stars>1-10
try:
name = ""
except:
pass
else:
print na<ref>me | 1.132813 | 1 |
pybyte/session.py | ms7m/py-byte | 4 | 816 | <reponame>ms7m/py-byte
import requests
class ByteSession(object):
def __init__(self, token, providedSession=False):
self._userToken = token
if providedSession == False:
self._session = requests.session()
else:
self._session = providedSession
self._session.h... | 2.234375 | 2 |
pyqtgraph/examples/template.py | secantsquared/pyqtgraph | 0 | 817 | # -*- coding: utf-8 -*-
"""
Description of example
"""
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui, mkQApp
import numpy as np
app = mkQApp()
# win.setWindowTitle('pyqtgraph example: ____')
if __name__ == '__main__':
pg.exec()
| 2.09375 | 2 |
ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py | cas-packone/ambari-chs | 3 | 818 | '''
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | 1.632813 | 2 |
debugging/code/multiprocess_main.py | awesome-archive/python-debugging-skills | 0 | 819 | # -*- encoding: utf-8 -*-
import multiprocessing as mp
import time
from pudb.remote import set_trace
def worker(worker_id):
""" Simple worker process"""
i = 0
while i < 10:
if worker_id == 1: # debug process with id 1
set_trace(term_size=(80, 24))
time.sleep(1) # represents ... | 2.96875 | 3 |
lldb/packages/Python/lldbsuite/test/expression_command/anonymous-struct/TestCallUserAnonTypedef.py | bytesnake/Enzyme | 0 | 820 | <filename>lldb/packages/Python/lldbsuite/test/expression_command/anonymous-struct/TestCallUserAnonTypedef.py
"""
Test calling user defined functions using expression evaluation.
This test checks that typesystem lookup works correctly for typedefs of
untagged structures.
Ticket: https://llvm.org/bugs/show_bug.cgi?id=26... | 2.203125 | 2 |
main.py | ThomasDLi/simple-photo-editor | 1 | 821 | <filename>main.py
from PIL import Image, ImageEnhance
user_account_name = "Thomas.Li26"
def main():
mode = input("Specify image editing mode. Type DEEPFRY, STRETCH, BRIGHTNESS, SHARPEN, or INVERT: ")
if mode == "DEEPFRY":
DEEPFRY()
if mode == "STRETCH":
STRETCH()
if mode == "... | 3.59375 | 4 |
scripts/field/Curbrock_Summon1.py | G00dBye/YYMS | 54 | 822 | <reponame>G00dBye/YYMS<gh_stars>10-100
# Curbrock Summon 2
CURBROCK2 = 9400930 # MOD ID
CURBROCKS_ESCAPE_ROUTE_VER2 = 600050040 # MAP ID
CURBROCKS_ESCAPE_ROUTE_VER3 = 600050050 # MAP ID 2
sm.spawnMob(CURBROCK2, 190, -208, False)
sm.createClock(1800)
sm.addEvent(sm.invokeAfterDelay(1800000, "warp", CURBROCKS_ESCAPE_RO... | 1.34375 | 1 |
trainloops/listeners/cluster_killswitch.py | Gerryflap/master_thesis | 0 | 823 | <reponame>Gerryflap/master_thesis
"""
Cancelling jobs on the University cluster forces programs to instantly quit,
which sometimes crashes cluster nodes.
As a remedy, this killswitch listener will stop the experiment in a nicer way to prevent this from happening.
The experiment will be stopped if a ... | 2.59375 | 3 |
authors/apps/notifications/views.py | andela/ah-backend-spaces- | 2 | 824 | <gh_stars>1-10
from rest_framework import status
from rest_framework.generics import (
RetrieveUpdateAPIView, CreateAPIView,
RetrieveUpdateDestroyAPIView
)
from rest_framework.permissions import AllowAny, IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
from ... | 2.5 | 2 |
scripts/common/frozendict.py | bopopescu/build | 0 | 825 | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Implements a frozen dictionary-like object"""
import collections
import copy
import common.memo as memo
class frozendict(collections.Mapping):
"""A f... | 3.125 | 3 |
avatar/__init__.py | yogeshkheri/geonode-avatar | 3 | 826 | <reponame>yogeshkheri/geonode-avatar
__version__ = '5.0.2'
| 0.828125 | 1 |
__init__.py | mmanganel/neurecon | 0 | 827 | from neurecon.reconstruction import reconstruct
| 0.988281 | 1 |
Fundamentals/Reversed Strings.py | gnvidal/Codewars | 49 | 828 | def solution(string):
return string[::-1]
| 1.71875 | 2 |
python/flexflow/keras/datasets/cifar.py | zmxdream/FlexFlow | 455 | 829 | # -*- coding: utf-8 -*-
"""Utilities common to CIFAR10 and CIFAR100 datasets.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
from six.moves import cPickle
def load_batch(fpath, label_key='labels'):
"""Internal utility for parsing CIFAR ... | 2.25 | 2 |
day7/p2.py | Seralpa/Advent-of-code | 1 | 830 | <gh_stars>1-10
def getNumBags(color):
if color=='':
return 0
numBags=1
for bag in rules[color]:
numBags+=bag[1]*getNumBags(bag[0])
return numBags
with open('day7/input.txt') as f:
rules=dict([l.split(' contain') for l in f.read().replace(' bags', '').replace(' bag', '').replace('.',... | 2.984375 | 3 |
adv/luther.py | 6tennis/dl | 0 | 831 | from core.advbase import *
from slot.d import *
def module():
return Luther
class Luther(Adv):
a1 = ('cc',0.10,'hit15')
conf = {}
conf ['slots.d'] = Leviathan()
conf['acl'] = """
`dragon
`s1
`s2, seq=5 and cancel
`s3, seq=5 and cancel or fsc
`fs, seq=5
... | 1.921875 | 2 |
wandb/sdk/data_types/image.py | macio232/client | 0 | 832 | import hashlib
from io import BytesIO
import logging
import os
from typing import Any, cast, Dict, List, Optional, Sequence, Type, TYPE_CHECKING, Union
from pkg_resources import parse_version
import wandb
from wandb import util
from ._private import MEDIA_TMP
from .base_types.media import BatchableMedia, Media
from .... | 2.078125 | 2 |
src/ACC_Backend_Utils.py | skostic14/isda-racing-backend | 1 | 833 | <reponame>skostic14/isda-racing-backend
import datetime
# Gets time from milliseconds
# Returns string formatted as HH:MM:SS:mmm, MM:SS:mmm or S:mmm, depending on the time.
def get_time_from_milliseconds(milli):
milliseconds = milli % 1000
seconds= (milli//1000)%60
minutes= (milli//(1000*60))%60
hours... | 2.84375 | 3 |
examples/advanced/pidigits.py | ovolve/sympy | 3 | 834 | #!/usr/bin/env python
"""Pi digits example
Example shows arbitrary precision using mpmath with the
computation of the digits of pi.
"""
from mpmath import libmp, pi
from mpmath import functions as mpf_funs
import math
from time import clock
import sys
def display_fraction(digits, skip=0, colwidth=10, columns=5):
... | 3.796875 | 4 |
authserver/mailauth/migrations/0011_mnserviceuser.py | yopiti/authserver | 8 | 835 | <filename>authserver/mailauth/migrations/0011_mnserviceuser.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-03-13 00:16
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import mailauth.models
import uuid
... | 1.710938 | 2 |
tempest/hacking/checks.py | rishabh20111990/tempest | 2 | 836 | # Copyright 2013 IBM Corp.
#
# 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 wri... | 2.21875 | 2 |
data/train/python/6a98547230e4cc83fa248137ca0fde09ebb67dcfController.py | harshp8l/deep-learning-lang-detection | 84 | 837 | import SimpleXMLRPCServer
import sys
import logging
from K8055Controller import K8055Controller
logging.basicConfig()
controller_log = logging.getLogger("Controller")
class Controller:
def __init__(self):
self.k8055 = K8055Controller()
controller_log.debug("initialized")
def reset(s... | 2.609375 | 3 |
model/__init__.py | sun1638650145/CRNN | 11 | 838 | <gh_stars>10-100
from .crnn import CRNN
from .crnn import CRNN_Attention | 1.03125 | 1 |
models2.py | Lydia-Tan/MindLife | 1 | 839 | <filename>models2.py
import nltk
import re
import sys
from sys import argv
from nltk.sentiment.vader import SentimentIntensityAnalyzer
def ajay(ans):
ajay = SentimentIntensityAnalyzer()
completeScore = 0
questionWeights = [0.05, 0.20, 0.05, 0.05, 0.05, 0.20, 0.05, 0.05, 0.20, 0.10]
print ans
ansLi... | 3.234375 | 3 |
tokendito/tool.py | pcmxgti/tokendito | 40 | 840 | # vim: set filetype=python ts=4 sw=4
# -*- coding: utf-8 -*-
"""This module retrieves AWS credentials after authenticating with Okta."""
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
from future import standard_library
from tokendito import aws_helpers
from tokendit... | 2.0625 | 2 |
resources/__init__.py | Boryslavq/UHMI_Chalenge | 0 | 841 | <reponame>Boryslavq/UHMI_Chalenge<filename>resources/__init__.py
from . import rest
from . import helpers
| 1.203125 | 1 |
ir_datasets/formats/trec.py | cakiki/ir_datasets | 0 | 842 | <filename>ir_datasets/formats/trec.py
import io
import codecs
import tarfile
import re
import gzip
import xml.etree.ElementTree as ET
from fnmatch import fnmatch
from pathlib import Path
from typing import NamedTuple
import ir_datasets
from ir_datasets.indices import PickleLz4FullStore
from .base import GenericDoc, Gen... | 2.046875 | 2 |
textpand/download.py | caufieldjh/textpand-for-kgs | 3 | 843 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from .utils import download_from_yaml
def download(output_dir: str, snippet_only: bool, ignore_cache: bool = False) -> None:
"""Downloads data files from list of URLs (default: download.yaml) into data directory (default: data/).
Args:
output_dir: A str... | 2.8125 | 3 |
venv/lib/python3.6/site-packages/ansible_collections/netapp/ontap/plugins/modules/na_ontap_autosupport_invoke.py | usegalaxy-no/usegalaxy | 1 | 844 | #!/usr/bin/python
# (c) 2020, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
'''
na_ontap_autosupport_invoke
'''
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
's... | 1.992188 | 2 |
tests/api/serializer/test_user.py | armandomeeuwenoord/freight | 562 | 845 | from freight.api.serializer import serialize
from freight.testutils import TestCase
class UserSerializerTest(TestCase):
def test_simple(self):
user = self.create_user()
result = serialize(user)
assert result["id"] == str(user.id)
assert result["name"] == user.name
| 2.65625 | 3 |
binning/pozo_5m_class_dem.py | UP-RS-ESP/GEW-DAP04-WS201819 | 2 | 846 | import sys
import numpy as np
from matplotlib import pyplot as pl
from rw import WriteGTiff
fn = '../pozo-steep-vegetated-pcl.npy'
pts = np.load(fn)
x, y, z, c = pts[:, 0], pts[:, 1], pts[:, 2], pts[:, 5]
ix = (0.2 * (x - x.min())).astype('int')
iy = (0.2 * (y - y.min())).astype('int')
shape = (100, 100)
xb = np.aran... | 2.125 | 2 |
comtypes/_meta.py | phuslu/pyMSAA | 23 | 847 | <reponame>phuslu/pyMSAA
# comtypes._meta helper module
from ctypes import POINTER, c_void_p, cast
import comtypes
################################################################
# metaclass for CoClass (in comtypes/__init__.py)
def _wrap_coclass(self):
# We are an IUnknown pointer, represented as a c_voi... | 2.1875 | 2 |
bin/ADFRsuite/CCSBpckgs/mglutil/gui/BasicWidgets/Tk/Dial.py | AngelRuizMoreno/Jupyter_Dock_devel | 0 | 848 | ################################################################################
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## License as published by the Free Software Foundation; either
## version 2.1 of the License, or (at your op... | 0.957031 | 1 |
qt-creator-opensource-src-4.6.1/scripts/checkInstalledFiles.py | kevinlq/Qt-Creator-Opensource-Study | 5 | 849 | #!/usr/bin/env python
############################################################################
#
# Copyright (C) 2016 The Qt Company Ltd.
# Contact: https://www.qt.io/licensing/
#
# This file is part of Qt Creator.
#
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in
#... | 1.382813 | 1 |
deep_sdf/workspace.py | huajian1069/non-convex_optimisation | 2 | 850 | <reponame>huajian1069/non-convex_optimisation
#!/usr/bin/env python3
# Copyright 2004-present Facebook. All Rights Reserved.
import json
import os
import torch
model_params_subdir = "ModelParameters"
optimizer_params_subdir = "OptimizerParameters"
latent_codes_subdir = "LatentCodes"
logs_filename = "Logs.pth"
reconst... | 2.078125 | 2 |
EmoPy/EmoPy/examples/convolutional_dropout_model.py | Rahmatullina/FinalYearProject | 0 | 851 | <reponame>Rahmatullina/FinalYearProject<filename>EmoPy/EmoPy/examples/convolutional_dropout_model.py
from EmoPy.src.fermodel import FERModel
from EmoPy.src.directory_data_loader import DirectoryDataLoader
from EmoPy.src.csv_data_loader import CSVDataLoader
from EmoPy.src.data_generator import DataGenerator
from EmoPy.s... | 2.515625 | 3 |
ENV/lib/python3.6/site-packages/pyramid_jinja2/tests/extensions.py | captain-c00keys/pyramid-stocks | 0 | 852 | <filename>ENV/lib/python3.6/site-packages/pyramid_jinja2/tests/extensions.py
from jinja2 import nodes
from jinja2.ext import Extension
class TestExtension(Extension):
tags = {'test_ext'}
def parse(self, parser): return nodes.Const("This is test extension")
| 2.171875 | 2 |
deepstream_ignition_usb_yolo.py | valdivj/Deepstream-IGN-Maker-YOLO | 18 | 853 | <reponame>valdivj/Deepstream-IGN-Maker-YOLO
#!/usr/bin/env python3
################################################################################
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and asso... | 1.148438 | 1 |
src/pyams_i18n/tests/__init__.py | Py-AMS/pyams-i18n | 0 | 854 | <filename>src/pyams_i18n/tests/__init__.py
#
# Copyright (c) 2015-2019 <NAME> <tflorac AT ulthar.net>
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY ... | 1.765625 | 2 |
tests/test_custom_experts.py | protagohhz/hivemind | 1,026 | 855 | import os
import pytest
import torch
from hivemind import RemoteExpert
from hivemind.moe.server import background_server
CUSTOM_EXPERTS_PATH = os.path.join(os.path.dirname(__file__), "test_utils", "custom_networks.py")
@pytest.mark.forked
def test_custom_expert(hid_dim=16):
with background_server(
expe... | 1.90625 | 2 |
tqsdk/demo/example/momentum.py | boyscout2008/tqsdk-python | 0 | 856 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Ringo"
'''
价格动量 策略 (难度:初级)
参考: https://www.shinnytech.com/blog/momentum-strategy/
注: 该示例策略仅用于功能示范, 实盘时请根据自己的策略/经验进行修改
'''
from tqsdk import TqAccount, TqApi, TargetPosTask
# 设置指定合约,获取N条K线计算价格动量
SYMBOL = "SHFE.au1912"
N = 15
api = TqApi()
klines = api.get_... | 2.4375 | 2 |
color_transfer/__init__.py | AdamSpannbauer/color_transfer | 0 | 857 | <reponame>AdamSpannbauer/color_transfer<gh_stars>0
# import the necessary packages
import numpy as np
import cv2
import imutils
def color_transfer(source, target, clip=True, preserve_paper=True):
"""
Transfers the color distribution from the source to the target
image using the mean and standard deviation... | 3.140625 | 3 |
Python/Tree/TestCreateTreeLibraryImport.py | zseen/hackerrank-challenges | 0 | 858 | from Library.CreateATree import CreateATree
tree = CreateATree.BinarySearchTree()
nodesList = list((4, 5, 1, 3, 2))
for i in range(0, len(nodesList)):
tree.insert(nodesList[i])
#tree.printInorder()
tree.printPreorder()
#tree.printPostorder()
| 3.65625 | 4 |
application/siteApp/urls.py | Marcelotsvaz/vaz-projects | 0 | 859 | #
# VAZ Projects
#
#
# Author: <NAME> <<EMAIL>>
from django.urls import path
from . import views
app_name = 'siteApp'
urlpatterns = [
path( '', views.Home.as_view(), name = 'home' ),
path( 'about-me', views.About_me.as_view(), name = 'about_me' ),
path( 'search', views.Search.as_view(), na... | 1.5625 | 2 |
svd/core/exc.py | epicosy/svd | 0 | 860 | <reponame>epicosy/svd<filename>svd/core/exc.py
class SVDError(Exception):
"""Generic errors."""
pass
| 1.226563 | 1 |
Classes/ServiceBase.py | tkeske/SMS-Fetcher | 0 | 861 | '''
@author <NAME>
@since 10.8.2019
'''
import sys
from jnius import autoclass
from Conf.Conf import *
class ServiceBase():
def __init__(self):
PythonServiceClass = autoclass('org.kivy.android.PythonService')
self.Context = autoclass('android.content.Context')
self.Service = PythonServi... | 2.359375 | 2 |
api/queue/__init__.py | sofia008/api-redis-queue | 0 | 862 | # api/queue/__init__.py
import os
from flask import Flask
from flask_bootstrap import Bootstrap
# instantiate the extensions
bootstrap = Bootstrap()
def create_app(script_info=None):
# instantiate the app
app = Flask(
__name__,
template_folder="../client/templates",
static_folder=... | 2.1875 | 2 |
tests/test_engine.py | Foxboron/python-adblock | 35 | 863 | <filename>tests/test_engine.py<gh_stars>10-100
import adblock
import pytest
SMALL_FILTER_LIST = """
||wikipedia.org^
||old.reddit.com^
||lobste.rs^
"""
def empty_engine():
return adblock.Engine(adblock.FilterSet())
def test_engine_creation_and_blocking():
filter_set = adblock.FilterSet(debug=True)
filt... | 2.5 | 2 |
v1/status_updates/urls.py | DucPhamTV/Bank | 94 | 864 | <gh_stars>10-100
from rest_framework.routers import SimpleRouter
from .views.upgrade_notice import UpgradeNoticeViewSet
router = SimpleRouter(trailing_slash=False)
router.register('upgrade_notice', UpgradeNoticeViewSet, basename='upgrade_notice')
| 1.34375 | 1 |
data_structures/stack/largest_rectangle_area_in_histogram.py | ruler30cm/python-ds | 1,723 | 865 | <gh_stars>1000+
'''
Largest rectangle area in a histogram::
Find the largest rectangular area possible in a given histogram where the largest rectangle can be made of a number of contiguous bars.
For simplicity, assume that all bars have same width and the width is 1 unit.
'''
def max_area_histogram(histogram):
... | 3.859375 | 4 |
gluon/contrib/pbkdf2_ctypes.py | Cwlowe/web2py | 9 | 866 | <reponame>Cwlowe/web2py
# -*- coding: utf-8 -*-
"""
pbkdf2_ctypes
~~~~~~
Fast pbkdf2.
This module implements pbkdf2 for Python using crypto lib from
openssl or commoncrypto.
Note: This module is intended as a plugin replacement of pbkdf2.py
by <NAME>.
Git repository:
$ git clone ... | 2.265625 | 2 |
auth_backend/src/key_op.py | cispa/bitahoy | 0 | 867 | import sys
import os
import psycopg2
import base64
from cryptography.hazmat.primitives import serialization, hashes
from cryptography.hazmat.primitives.asymmetric import padding, rsa
from cryptography.hazmat.backends import default_backend
import time
if len(sys.argv) < 2:
print("Please enter either create or rem... | 3 | 3 |
src/tools/types/obj.py | loongson-zn/build | 215 | 868 | <filename>src/tools/types/obj.py<gh_stars>100-1000
# Copyright <NAME> 2004. Distributed under the Boost
# Software License, Version 1.0. (See accompanying
# file LICENSE.txt or copy at https://www.bfgroup.xyz/b2/LICENSE.txt)
from b2.build import type
def register ():
type.register_type ('OBJ', ['obj'], None, ['NT... | 1.617188 | 2 |
sympy/polys/tests/test_sqfreetools.py | eriknw/sympy | 7 | 869 | <filename>sympy/polys/tests/test_sqfreetools.py
"""Tests for square-free decomposition algorithms and related tools. """
from sympy.polys.rings import ring
from sympy.polys.domains import FF, ZZ, QQ
from sympy.polys.polyclasses import DMP
from sympy.polys.specialpolys import f_polys
from sympy.utilities.pytest import... | 2.5 | 2 |
ezno_convert/enums.py | ofersadan85/ezno_convert | 2 | 870 | import enum
from typing import Union
@enum.unique
class PPT(enum.Enum):
# Source: https://docs.microsoft.com/en-us/office/vba/api/powerpoint.ppsaveasfiletype
AnimatedGIF = 40
BMP = 19
Default = 11
EMF = 23
External = 64000
GIF = 16
JPG = 17
META = 15
MP4 = 39
OpenPresentati... | 2.734375 | 3 |
app/django_first/news/migrations/0002_movies_year.py | vvuri/flask_pipeline | 0 | 871 | <reponame>vvuri/flask_pipeline<gh_stars>0
# Generated by Django 4.0.1 on 2022-01-19 23:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('news', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='movies',
... | 1.578125 | 2 |
scripts/issue_param_value.py | Jhsmit/awesome-panel-extensions | 3 | 872 | import panel as pn
import param
from awesome_panel_extensions.frameworks.fast import FastTemplate, FastTextInput
WIDGETS = {
"some_text": {"type": FastTextInput, "readonly": True, "sizing_mode": "fixed", "width": 400}
}
class ParameterizedApp(param.Parameterized):
some_text = param.String(default="This is s... | 2.21875 | 2 |
gjqyxyxxcxxt/gjqyxyxxcxxt/queue_companies.py | AisinoPythonTeam/PythonAiniso | 0 | 873 | # -*- coding: utf-8 -*-
import pymysql
import sys, os, json, time, pymongo
app_dir = os.path.abspath("../")
sys.path.append(app_dir)
from gjqyxyxxcxxt import settings
from gjqyxyxxcxxt.database.my_redis import QueueRedis
conn = None
def connect_db():
global conn
conn = pymysql.connect(host="172.16.16.15",port... | 2.3125 | 2 |
tests/pm/update_sla.py | supsi-dacd-isaac/parity-sidechain-interface | 0 | 874 | # Importing section
import json
import requests
import argparse
import hashlib
import time
from http import HTTPStatus
# Main
if __name__ == "__main__":
arg_parser = argparse.ArgumentParser()
args = arg_parser.parse_args()
set_cmd = 'updateSla'
params = {
'idx': 'sla04',
... | 2.5625 | 3 |
array/python3/5_move_all_negative_elements.py | jitendragangwar123/cp | 0 | 875 | <reponame>jitendragangwar123/cp
def sort(arr):
# Start index 0.
start = 0
# End index
end = len(arr)-1
while start <= end:
# Swap all positive value with last index end & decrease end by 1.
if arr[start] >= 0:
arr[start], arr[end] = arr[end], arr[start]
end -... | 3.59375 | 4 |
misc.py | hldai/wikiprocesspy | 0 | 876 | <gh_stars>0
import json
def __text_from_anchor_sents_file(anchor_sents_file, output_file):
f = open(anchor_sents_file, encoding='utf-8')
fout = open(output_file, 'w', encoding='utf-8', newline='\n')
for i, line in enumerate(f):
sent = json.loads(line)
fout.write('{}\n'.format(sent['tokens'... | 2.84375 | 3 |
test/smptest.py | myrtam/CANNR | 0 | 877 | """
Test harness for smp.py
"""
import sys
import os
sys.path.append('/Users/ptendick/open-source-workspace/cannr Image/source/cannr/lib')
os.environ['PATH'] = '/Library/Frameworks/Python.framework/Versions/3.7/bin:' + os.environ['PATH']
import cannr
import smp
# Test openProcess by opening a Flask process
def test_o... | 1.914063 | 2 |
neural_toolbox/inception.py | ibrahimSouleiman/GuessWhat | 0 | 878 | <reponame>ibrahimSouleiman/GuessWhat
import tensorflow as tf
import tensorflow.contrib.slim as slim
import tensorflow.contrib.slim.python.slim.nets.resnet_v1 as resnet_v1
import tensorflow.contrib.slim.python.slim.nets.inception_v1 as inception_v1
import tensorflow.contrib.slim.python.slim.nets.resnet_utils as slim_ut... | 2.515625 | 3 |
timm/utils/checkpoint_saver.py | Robert-JunWang/pytorch-image-models | 17,769 | 879 | <filename>timm/utils/checkpoint_saver.py
""" Checkpoint Saver
Track top-n training checkpoints and maintain recovery checkpoints on specified intervals.
Hacked together by / Copyright 2020 <NAME>
"""
import glob
import operator
import os
import logging
import torch
from .model import unwrap_model, get_state_dict
... | 2.328125 | 2 |
AGC004/AGC004a.py | VolgaKurvar/AtCoder | 0 | 880 | <filename>AGC004/AGC004a.py
# AGC004a
def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
a, b, c = map(int, input().split())
if a % 2 == 0 or b % 2 == 0 or c % 2 == 0:
print(0)
exit(0)
print(min(a*b, b*c, c*a))
if __name__ == '__main__':
main()
| 2.796875 | 3 |
glance/tests/functional/test_api.py | arvindn05/glance | 0 | 881 | # Copyright 2012 OpenStack Foundation
# 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 requ... | 1.625 | 2 |
qcore/asserts.py | corey-sobel/qcore | 1 | 882 | # Copyright 2016 Quora, 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 in writing, so... | 2.4375 | 2 |
lib/galaxy/web/__init__.py | rikeshi/galaxy | 4 | 883 | <gh_stars>1-10
"""
The Galaxy web application framework
"""
from .framework import url_for
from .framework.base import httpexceptions
from .framework.decorators import (
do_not_cache,
error,
expose,
expose_api,
expose_api_anonymous,
expose_api_anonymous_and_sessionless,
expose_api_raw,
... | 1.617188 | 2 |
src/python/pants/core/goals/check_test.py | yoav-orca/pants | 1,806 | 884 | <reponame>yoav-orca/pants
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from abc import ABCMeta, abstractmethod
from pathlib import Path
from textwrap import dedent
from typing import ClassVar, Iterable, List, Optional, Tuple, Type
f... | 2.078125 | 2 |
data-processing/entities/definitions/model/utils.py | alexkreidler/scholarphi | 0 | 885 | import os
import random
from typing import Any, Dict, List, Union
import numpy as np
import torch
from colorama import Fore, Style
from sklearn.metrics import f1_score
from sklearn.metrics import precision_recall_fscore_support as score
from sklearn.metrics import precision_score, recall_score
def highlight(input_: ... | 2.125 | 2 |
fire/trace.py | nvhoang55/python-fire | 0 | 886 | <reponame>nvhoang55/python-fire<gh_stars>0
# Copyright (C) 2018 Google 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 ... | 2.34375 | 2 |
test/unit/__init__.py | thiagodasilva/swift | 0 | 887 | <filename>test/unit/__init__.py
# Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 req... | 1.78125 | 2 |
fairseq/models/bart/model.py | samsontmr/fairseq | 172 | 888 | <reponame>samsontmr/fairseq<gh_stars>100-1000
# 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.
"""
BART: Denoising Sequence-to-Sequence Pre-training for
Natural Language Generation, Translatio... | 2.046875 | 2 |
tracker/view/error.py | cmm1107/arch-security-tracker | 0 | 889 | <gh_stars>0
from binascii import hexlify
from functools import wraps
from logging import error
from os import urandom
from random import randint
from flask import make_response
from flask import render_template
from werkzeug.exceptions import BadRequest
from werkzeug.exceptions import Forbidden
from werkzeug.exception... | 2.078125 | 2 |
tb_plugin/torch_tb_profiler/profiler/trace.py | azhou-determined/kineto | 0 | 890 | <gh_stars>0
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# --------------------------------------------------------------------------
from enum import IntEnum
from .. import utils
__all__ = ["EventTypes", "create_event"]
logge... | 2.046875 | 2 |
base/base.gyp | eval1749/elang | 1 | 891 | <reponame>eval1749/elang
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
},
'includes': [
'../build/win_precompile.gypi',
'base.gypi',
],
'tar... | 1.601563 | 2 |
solutions/PE4.py | KerimovEmil/ProjectEuler | 1 | 892 | """
PROBLEM
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers
is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
ANSWER:
906609
Solve time ~ 0.760 seconds
"""
from itertools import product
import unittest
fro... | 4.125 | 4 |
indexclient/parsers/info.py | uc-cdis/indexclient | 2 | 893 | import sys
import json
import logging
import argparse
import warnings
import requests
from indexclient import errors
# DEPRECATED 11/2019 -- interacts with old `/alias/` endpoint.
# For creating aliases for indexd records, prefer using
# the `add_alias` function, which interacts with the new
# `/index/{GUID}/aliase... | 2.578125 | 3 |
email-worker-compose/app/sender.py | guilhermebc/docker-playground | 1 | 894 | <reponame>guilhermebc/docker-playground<filename>email-worker-compose/app/sender.py
import psycopg2
import redis
import json
from bottle import Bottle, request
class Sender(Bottle):
def __init__(self):
super().__init__()
self.route('/', method='POST', callback=self.send)
self.fila = redis.... | 2.140625 | 2 |
tests/ximpl.py | zsimic/sandbox | 0 | 895 | <reponame>zsimic/sandbox
import click
import poyo
import ruamel.yaml
import runez
import strictyaml
import yaml as pyyaml
from zyaml import load_path, load_string, tokens_from_path, tokens_from_string
from zyaml.marshal import decode, default_marshal, represented_scalar
from . import TestSettings
class Implementati... | 2.046875 | 2 |
mummi_ras/online/aa/aa_get_tiltrot_z_state.py | mummi-framework/mummi-ras | 4 | 896 | ###############################################################################
# @todo add Pilot2-splash-app disclaimer
###############################################################################
""" Get's KRAS states """
import MDAnalysis as mda
from MDAnalysis.analysis import align
from MDAnalysis.lib.mdamath ... | 1.914063 | 2 |
homeassistant/components/switch/hikvisioncam.py | maddox/home-assistant | 1 | 897 | """
homeassistant.components.switch.hikvision
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support turning on/off motion detection on Hikvision cameras.
Note: Currently works using default https port only.
CGI API Guide: http://bit.ly/1RuyUuF
Configuration:
To use the Hikvision motion detection switch you will need to... | 2.453125 | 2 |
src/richie/apps/search/filter_definitions/mixins.py | leduong/richie | 0 | 898 | """Define mixins to easily compose custom FilterDefinition classes."""
class TermsQueryMixin:
"""A mixin for filter definitions that need to apply term queries."""
def get_query_fragment(self, data):
"""Build the query fragments as term queries for each selected value."""
value_list = data.ge... | 2.796875 | 3 |
electrumsv/gui/qt/receive_view.py | AustEcon/electrumsv | 1 | 899 | from typing import List, Optional, TYPE_CHECKING
import weakref
from PyQt5.QtCore import QEvent, Qt
from PyQt5.QtWidgets import (QComboBox, QGridLayout, QGroupBox, QHBoxLayout, QLabel, QLineEdit,
QVBoxLayout, QWidget)
from electrumsv.app_state import app_state
from electrumsv.bitcoin import script_template_to_str... | 1.773438 | 2 |