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 |
|---|---|---|---|---|---|---|
exercicios_programas/ex7_contadores/exercicio5.7.py | robinson-1985/livro_python | 0 | 12778851 | ''' 5.7 Modifique o programa anterior de forma que o usuário também digite o
início e o fim da tabuada, em vez de começar com 1 e 10. ''' | 2 | 2 |
island_backup/islands/the2chan.py | mishrasanskriti802/island-backup | 17 | 12778852 | <filename>island_backup/islands/the2chan.py
from .bases import BasePage, BaseBlock
from bs4 import BeautifulSoup
import re
from urllib import parse
def openbr2closebr(html: str):
return html.replace('<br>', '<br/>')
class The2ChanBlock(BaseBlock):
request_info = {
'cdn_host': None,
'headers'... | 2.96875 | 3 |
src/comparator_code_processor.py | williamnash/CSCCoffea | 0 | 12778853 | """Processor to create histograms and generate plots from fed comparator code."""
import awkward as ak
from coffea import hist, processor
from coffea.nanoevents.methods import candidate
ak.behavior.update(candidate.behavior)
class ComparatorCodeProcessor(processor.ProcessorABC):
"""Runs the analysis."""
de... | 3.046875 | 3 |
src/network_analyzer/cli.py | nekhaly/network-analyzer | 0 | 12778854 | import click
from network_analyzer.analyzer import Analyzer
@click.group()
def main():
pass
@main.command(short_help="Analyze networks")
@click.option(
"--jsonrpc",
help="JsonRPC URL of the ethereum client",
default="https://tlbc.rpc.anyblock.tools",
show_default=True,
metavar="URL",
)
@cli... | 2.578125 | 3 |
lambda/functions/config.py | tylabs/quicksand | 46 | 12778855 | <gh_stars>10-100
import boto3
import botocore
# General Settings Here
# S3 bucket - don't need the secret if you have given lambda permissions for s3
boto_s3 = boto3.client(
's3',
region_name='##region###',
config=botocore.config.Config(s3={'add... | 1.648438 | 2 |
aas_timeseries/data.py | astrofrog/aas-time-series-affiliated | 3 | 12778856 | <filename>aas_timeseries/data.py<gh_stars>1-10
import uuid
from astropy.units import Quantity, UnitsError
__all__ = ['Data']
class Data:
def __init__(self, time_series):
self.time_series = time_series
self.uuid = str(uuid.uuid4())
self.time_column = 'time'
def column_to_values(self... | 3.125 | 3 |
ufcnn-keras/models/mnist_autoencoder_1d.py | mikimaus78/ml_monorepo | 51 | 12778857 | <reponame>mikimaus78/ml_monorepo<filename>ufcnn-keras/models/mnist_autoencoder_1d.py
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten, Reshape
... | 3.0625 | 3 |
aio/cluster/zk_client.py | eigenphi/gcommon | 3 | 12778858 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# created: 2015-04-22
"""ZooKeeper 客户端。
和 asyncio 联用时请注意:
所有 watch observer 必须使用 reactor.callFromThread() 将 watch 结果返回给 twisted 线程。
为调用方便,请使用 twisted_kazoo.twisted_callback 对回调进行封装。
"""
import logging
import threading
from queue import Queue
from kazoo.client import KazooC... | 2.15625 | 2 |
glue_jupyter/table/tests/test_table.py | ibusko/glue-jupyter | 57 | 12778859 | from glue_jupyter.table import TableViewer
def test_table_filter(app, dataxyz):
table = app.table(data=dataxyz)
assert len(table.layers) == 1
assert table.widget_table is not None
table.widget_table.checked = [1]
table.apply_filter()
assert len(table.layers) == 2
subset = table.layers[1].l... | 2.5 | 2 |
modules/other_ns.py | nam-pi/data_conversion | 1 | 12778860 | <reponame>nam-pi/data_conversion
from rdflib import Namespace
class Other_ns:
geonames = Namespace("https://sws.geonames.org/")
gnd = Namespace("https://d-nb.info/gnd/")
wikidata = Namespace("https://www.wikidata.org/entity/")
| 2.0625 | 2 |
csv-manipulation.py | ismailfaruk/COMP551-mp1 | 1 | 12778861 | import pandas as pd
import sklearn.datasets as datasets
import pandas_ml as pdml
import numpy as np
# READ DATASETS AND CLEAR NAN COLUMNS AND ROWS
search_data = pd.read_csv(
"c:/Users/<NAME>/Desktop/Arya/comp551/2020_US_weekly_symptoms_dataset.csv", sep=',',
header=0, engine='python')
search_data.drop... | 2.828125 | 3 |
multimodal/db/models/sound.py | omangin/multimodal | 17 | 12778862 | <filename>multimodal/db/models/sound.py
# -*- coding: utf-8 -*-
__author__ = '<NAME> <<EMAIL>>'
__date__ = '10/2011'
import os
import json
class Record:
def __init__(self, db, speaker, audio, tags,
transcription, style):
self.db = db
self.spkr_id = speaker
self.audio ... | 2.765625 | 3 |
src/infi/storagemodel/aix/rescan.py | Infinidat/infi.storagemodel | 6 | 12778863 | from infi.execute import execute_assert_success
from .scsi import AixModelMixin, AixSCSIBlockDevice
from .native_multipath import AixMultipathBlockDevice
from infi.storagemodel.errors import DeviceError
class AixRescan(AixModelMixin):
def _add_new_devices(self):
execute_assert_success(["cfgmgr"])
def ... | 2.046875 | 2 |
app/main/forms.py | zs3189/web_flask | 0 | 12778864 | from flask_wtf import Form
from wtforms import StringField, TextAreaField, BooleanField, SelectField,\
SubmitField,StringField
from wtforms.validators import DataRequired, Length, Email, Regexp
from wtforms import ValidationError
from flask_pagedown.fields import PageDownField
from ..models import Role, User,BID_ac... | 2.421875 | 2 |
python/dataset.py | francois-rozet/adopptrs | 11 | 12778865 | #!/usr/bin/env python
"""
PyTorch datasets and data augmenters
"""
###########
# Imports #
###########
import cv2
import numpy as np
import os
import random
import torch
from PIL import Image, ImageFilter
from torch.utils import data
from torchvision import transforms
#############
# Functions #
#############
de... | 2.984375 | 3 |
store/views/my_order.py | UniqueQueue/ethereum-store | 0 | 12778866 | import logging
import random
from django.conf import settings
from django.db import IntegrityError
from django.db.models import Q
from rest_access_policy import AccessPolicy
from rest_framework import viewsets
from store.const import ORDER_IDS_SESSION_PARAM_NAME
from store.models import Order
from store.serializers i... | 2.046875 | 2 |
src/compas_plotters/artists/polylineartist.py | mattiskoh/compas | 0 | 12778867 | <filename>src/compas_plotters/artists/polylineartist.py
from typing import Literal, Tuple, List
from matplotlib.lines import Line2D
from compas.geometry import Polyline
from compas_plotters.artists import Artist
Color = Tuple[float, float, float]
class PolylineArtist(Artist):
"""Artist for COMPAS polylines."""
... | 2.96875 | 3 |
src/Program/Python/Testing/verifyOutputTest.py | smiths/swhs | 2 | 12778868 | import sys
sys.path.insert(0, '.')
import unittest
import load_params
import warnings
import verify_output
class TestVerifyOutput(unittest.TestCase):
def setUp(self):
self.params = load_params.load_params('test.in')
self.time = [0, 10, 20, 30]
self.tempW = [40, 42, 44, 46]
self.t... | 2.765625 | 3 |
pyquil/quil.py | JansenZhao/GPNN | 0 | 12778869 | ##############################################################################
# Copyright 2016-2017 Rigetti Computing
#
# 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... | 1.78125 | 2 |
src/GL/sim/gql_ml_cv.py | kylmcgr/RL-RNN-SURF | 2 | 12778870 | <gh_stars>1-10
# Evaluates GQL in terms of cross-validation. Note that this file only evaluates the model and it needs
# the output of file 'fit/gql_ml_cv.py' for trained models.
from actionflow.qrl.gql import GQL
from actionflow.qrl.opt_ml import OptML
from actionflow.qrl.simulate import Simulator
from BD.data.data_r... | 2.265625 | 2 |
currint/tests/test_amount.py | valentin-eb/currint | 15 | 12778871 | <reponame>valentin-eb/currint<filename>currint/tests/test_amount.py
# encoding: utf8
from __future__ import unicode_literals
import six
from decimal import Decimal
from unittest import TestCase
from ..currency import currencies, Currency
from ..amount import Amount, _ZeroAmount
class AmountTests(TestCase):
def t... | 3.15625 | 3 |
setup.py | geotip/django-rest-params | 0 | 12778872 | # -*- coding: utf-8 -*-
from codecs import open # To use a consistent encoding
from os import path
from setuptools import find_packages, setup
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_desc... | 1.601563 | 2 |
Scripts/find_imposter.py | yogeshwaran01/Mini-Projects | 4 | 12778873 | """
There is an array with some numbers.
All numbers are equal except for one(imposter).
"""
def imposter(arr: list) -> str:
"""
>>> imposter([1,2,1,1,1,1])
2
>>> imposter(["python", "java", "python", "python"])
'java'
"""
n = []
s = set(arr)
for e in s:
... | 3.578125 | 4 |
model/bifpn.py | sevakon/efficientdet | 25 | 12778874 | import torch
import torch.nn as nn
import torch.nn.functional as F
from model.efficientnet.utils import MemoryEfficientSwish as Swish
from model.module import DepthWiseSeparableConvModule as DWSConv
from model.module import MaxPool2dSamePad
class BiFPN(nn.Module):
"""
BiFPN block.
Depending on its order,... | 2.546875 | 3 |
madminer/plotting/__init__.py | johannbrehmer/madminer | 13 | 12778875 | <reponame>johannbrehmer/madminer
from .distributions import plot_distributions, plot_histograms
from .morphing import (
plot_2d_morphing_basis,
plot_nd_morphing_basis_scatter,
plot_nd_morphing_basis_slices,
plot_1d_morphing_basis,
)
from .fisherinformation import (
plot_fisherinfo_barplot,
plot_... | 1.507813 | 2 |
tests/test_node.py | luminescence/pycrunchbase | 67 | 12778876 | from unittest import TestCase
import json
from pycrunchbase.resource.node import Node
from pycrunchbase.resource.utils import parse_date
class TestNode(Node):
KNOWN_PROPERTIES = ['property1', 'property2']
def _coerce_values(self):
# intentionally coerce bad values for test purposes
attr = '... | 3.078125 | 3 |
django_project/weather/urls.py | bbsoft0/weather | 1 | 12778877 | <filename>django_project/weather/urls.py
from django.urls import path,include
from . import views
urlpatterns = [
path('',views.index,name="home"),
path('about/',views.about,name="about"),
path('help/',views.help,name="help"),
path('delete/<city_name>/',views.delete_city,name="delete_city"),
] | 2.0625 | 2 |
ib/utilities.py | dhsdshdhk/tchan | 0 | 12778878 | import re
import html
import string
from functools import partial
from PIL import Image
from os.path import split, splitext
import random
from django.core.files.uploadedfile import InMemoryUploadedFile
from ib.models import Post, File
from django.conf import settings
from os.path import join
import subprocess
from dj... | 2.234375 | 2 |
RNNS/model/baseLangRNN.py | CenIII/Text-style-transfer-DeleteRetrieve | 0 | 12778879 | <gh_stars>0
import torch.nn as nn
from .baseRNN import BaseRNN
import numpy as np
class baseLangRNN(BaseRNN):
def __init__(self, vocab_size, max_len, hidden_size,
input_dropout_p=0, dropout_p=0,
n_layers=1, bidirectional=False, rnn_cell='gru', variable_lengths=False,
... | 2.59375 | 3 |
stream/tests.py | 0xdc/estuary-app-livestream | 0 | 12778880 | from django.test import TestCase
# Create your tests here.
from .models import Stream
class StreamTests(TestCase):
pass
| 1.289063 | 1 |
question34.py | larkaa/project_euler | 0 | 12778881 | #!/usr/bin/env python3
# quesiton 34 digit factorials
#145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.
#Find the sum of all numbers which are equal to the sum of the factorial of their digits.
#Note: as 1! = 1 and 2! = 2 are not sums they are not included.
#idea brute force
# note that
# 3 != 3!, s... | 3.890625 | 4 |
code/runner.py | rapidclock/simple-neural-network | 0 | 12778882 | <filename>code/runner.py
from data_prep import process_csv
from nn.model import NeuralNetwork
from nn.layers import InputLayer, Dense
from nn.loss import CrossEntropy
from nn.optimizer import SGD
from nn.activations import sigmoid, tanh
test_file = '../data/mnist_test.csv'
train_file = '../data/mnist_train.csv'
x_tra... | 2.96875 | 3 |
socialforcemodel/math.py | bazylip/socialforcemodel | 2 | 12778883 | def length_squared(vector):
""" Return the length squared of a vector. """
return vector[0]**2 + vector[1]**2
| 3.734375 | 4 |
hospital/admin.py | kurbster/HospitalManagement | 1 | 12778884 | from django.contrib import admin
from .models import *
# Register your models here.
class DoctorAdmin(admin.ModelAdmin):
pass
admin.site.register(Doctor, DoctorAdmin)
class HospitalStaffAdmin(admin.ModelAdmin):
pass
admin.site.register(HospitalStaff, HospitalStaffAdmin)
#insurance created by prem
class Insura... | 1.875 | 2 |
example/ex_orbit.py | NSLS-II/aphla | 0 | 12778885 | <filename>example/ex_orbit.py
import aphla as ap
import numpy as np
import matplotlib.pylab as plt
import time
print ap.__path__
ap.initNSLS2V1()
bpms = ap.getElements('BPM')
#trims = ap.getGroupMembers(['*', '[HV]COR'], op='intersection')
trims = ap.getElements('HCOR')[:30] + ap.getElements('VCOR')[-30:]
print "Bpms... | 2.296875 | 2 |
core/utils.py | 0xdia/BrainyBot | 29 | 12778886 | import discord
from collections.abc import Sequence
import json
import os
import requests
from types import SimpleNamespace
import sys
from core.errors import *
import base64
import requests
import json
def loads_to_object(json_file):
"""
Loads from a json file to a python object filling its properties w... | 2.609375 | 3 |
dictionary/migrations/__init__.py | Sanquira/immortalfighters | 0 | 12778887 | # migrations.RunPython(race.initialize_races),
# migrations.RunPython(profession.init_professions),
# migrations.RunPython(spell.initialize_spell_directions),
# migrations.RunPython(skill.init_ranks_and_difficulty),
# migrations.RunPython(skill.init_skills),
# migrations.RunPython(beast.init_weakness),
# migrations.Run... | 1.453125 | 1 |
covid19_cases/hk_database/helperfunc.py | wtydavid99/COVID-19-cases | 0 | 12778888 | <reponame>wtydavid99/COVID-19-cases
import os
from datetime import date
import pandas as pd
from openpyxl import load_workbook
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from... | 3.0625 | 3 |
PCI_o_B/DAMfile.py | MatteoMilani95/PCI_o_Bpy | 1 | 12778889 | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 1 13:49:13 2021
@author: Matteo
"""
import numpy as np
import matplotlib.pyplot as plt
import PCI_o_B
from PCI_o_B import CIfile as CI
from PCI_o_B import G2file as g2
from PCI_o_B import SharedFunctions as sf
class DAM(g2.G2):
def __init__(self,Fold... | 2.28125 | 2 |
app/public/views.py | dev-johnlopez/astrix | 0 | 12778890 | # -*- coding: utf-8 -*-
"""Public section, including homepage and signup."""
from flask import (
Blueprint,
current_app,
flash,
redirect,
render_template,
request,
url_for,
)
from flask_login import login_required, login_user, logout_user
from app.extensions import login_manager
from app.pu... | 2.390625 | 2 |
empower/managers/ranmanager/vbsp/vbshandler.py | joncnet/empower-runtime | 0 | 12778891 | <filename>empower/managers/ranmanager/vbsp/vbshandler.py
#!/usr/bin/env python3
#
# Copyright (c) 2019 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/lice... | 1.914063 | 2 |
app/index/routes.py | lambda-science/IMPatienT | 5 | 12778892 | from app.index import bp
from flask import render_template
@bp.route("/")
def index():
"""View function for the Index page
Returns:
str: HTML template for the Index page
"""
return render_template("index.html")
| 2.34375 | 2 |
app/misc/inline_constructor/models/button.py | vitaliy-ukiru/math-bot | 1 | 12778893 | <reponame>vitaliy-ukiru/math-bot
__all__ = (
"Button",
)
from typing import Optional, Union
from aiogram.types import InlineKeyboardButton
from .base import ButtonTypes, BaseObject
from app.keyboards import custom_gen_cb
from app.utils.exceptions import ConstructorException
def _format_button_type(obj_type: st... | 2.296875 | 2 |
withNoise/SynthGAN_Noise.py | lelynn/RF_GANsynth | 0 | 12778894 | <filename>withNoise/SynthGAN_Noise.py
import torch.nn as nn
import random
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.optim as optim
import torch.utils.data as dataset
from tqdm import tqdm
import model_file
import module_Noise as module
import RF_module as RF
import torchvision.tra... | 2.09375 | 2 |
house/house.py | devksingh4/imsa-csi-python | 0 | 12778895 | <filename>house/house.py
# <NAME>, House, 4/9/2020
from graphics import GraphWin, Rectangle, Point, Polygon, Text
import time # allows me to sleep the program
def main():
win = GraphWin("House", 600, 600)
win.setCoords(0,0,600,600)
Text(Point(300,10),"5 Click House").draw(win)
# Draw the main house
... | 3.265625 | 3 |
Desafios/Mundo 2/ex051.py | ZaikoXander/Python | 0 | 12778896 | <filename>Desafios/Mundo 2/ex051.py<gh_stars>0
print('\033[1;97m-' * 23)
print('| \033[91m10 TERMOS DE UMA PA \033[97m|')
print('-' * 23)
ptermo = int(input('Primeiro termo: '))
razao = int(input('Razão: '))
decimo = ptermo + (10 - 1) * razao
print()
for c in range(ptermo, decimo + razao, razao):
print('\033[97m{}'... | 3.5625 | 4 |
src/masonite/managers/__init__.py | Abeautifulsnow/masonite | 95 | 12778897 | <filename>src/masonite/managers/__init__.py
from .Manager import Manager
from .AuthManager import AuthManager
from .BroadcastManager import BroadcastManager
from .CacheManager import CacheManager
from .MailManager import MailManager
from .QueueManager import QueueManager
from .SessionManager import SessionManager
from ... | 1.25 | 1 |
logger.py | ranihorev/arxiv-sanity-preserver | 81 | 12778898 | <filename>logger.py
import logging
from logging.config import dictConfig
def logger_config(path='', info_filename='info.log', num_backups=5):
logging.getLogger('boto3').setLevel(logging.WARNING)
logging.getLogger('botocore').setLevel(logging.WARNING)
handlers = {
"console": {
... | 2.5625 | 3 |
ext2/fs/bgdt.py | mrfalcone/pyext2 | 1 | 12778899 | <filename>ext2/fs/bgdt.py
#!/usr/bin/env python
"""
Defines internal classes for the block group descriptor table used by the ext2 module.
"""
__license__ = "BSD"
__copyright__ = "Copyright 2013, <NAME>"
from struct import pack,unpack_from
from math import ceil
from time import time
from ..error import FilesystemErro... | 2.25 | 2 |
scripts/transform_wiki_to_openapi.py | will7200/go-crypto-sync | 4 | 12778900 | <reponame>will7200/go-crypto-sync
import os
import re
from ruamel.yaml import YAML
import pandas as pd
from io import StringIO
from urllib.parse import urlparse, parse_qs
import json
pd.options.display.max_columns = 7
pd.options.display.width = 200
example = """
# Acquire Market Statistics
* Request description: Acqu... | 2.6875 | 3 |
projectwo/servicetwo/test_servicetwo.py | ayonadee/prizegenerator | 0 | 12778901 | <reponame>ayonadee/prizegenerator
from unittest.mock import patch
from flask import url_for
from flask_testing import TestCase
from app import app
import requests
class TestBase(TestCase):
def create_app(self):
return app
class TestViews(TestBase):
def test_get_randomnumber(self):
re... | 2.734375 | 3 |
apps/trade/urls.py | shao-169/SLTP | 0 | 12778902 | # _*_ encoding:utf-8 _*_
from django.conf.urls import url
from .views import *
__author__ = 'YZF'
__date__ = '2018/4/5,20:20'
urlpatterns =[
url(r'^list/',FightListView.as_view(),name='fight_list'),
url(r'^class/(?P<fight_id>.*)/', FightDetailView.as_view(), name='fight_class'),
url(r'^addcart/',AddCartVie... | 1.578125 | 2 |
bot/components/token.py | fossabot/jdan734-bot | 0 | 12778903 | import telebot
import os
import json
if "TOKEN" in os.environ:
bot = telebot.TeleBot(os.environ["TOKEN"])
heroku = True
else:
with open("../token2.json") as token:
heroku = False
bot = telebot.TeleBot(json.loads(token.read())["token"])
| 2.421875 | 2 |
tsundoku/blueprints/api/__init__.py | fossabot/Tsundoku | 0 | 12778904 | <filename>tsundoku/blueprints/api/__init__.py
from .routes import api_blueprint
| 1.203125 | 1 |
external/iotivity/iotivity_1.2-rel/build_common/iotivityconfig/compiler/default_configuration.py | SenthilKumarGS/TizenRT | 1,433 | 12778905 | # ------------------------------------------------------------------------
# Copyright 2015 Intel Corporation
#
# 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/li... | 2.03125 | 2 |
sktime_dl/classification/_lstmfcn.py | Sugam10/sktime-dl | 0 | 12778906 | __author__ = "<NAME>"
import numpy as np
from tensorflow import keras
from sktime_dl.classification._classifier import BaseDeepClassifier
from sktime_dl.networks._lstmfcn import LSTMFCNNetwork
from sktime_dl.utils import check_and_clean_data, \
check_and_clean_validation_data
from sktime_dl.utils import check_is_... | 2.328125 | 2 |
aplatam/console/train.py | fossabot/ap-latam | 31 | 12778907 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Train a detection model from an already prepared dataset.
"""
import argparse
import logging
import os
import random
import sys
import warnings
import rasterio
from aplatam import __version__
from aplatam.build_trainset import CnnTrainsetBuilder
from aplatam.train_cl... | 2.78125 | 3 |
minjector/providers/classprovider.py | MichaelSchneeberger/minjector | 0 | 12778908 | <filename>minjector/providers/classprovider.py
from minjector.providers.providerbase import ProviderBase
from minjector.readermonad.reader import Reader
from minjector.readermonad.readermonadop import ReaderMonadOp
from minjector.core.variableenvironment import VariableEnvironment
class ClassProvider(ProviderBase):
... | 2.578125 | 3 |
apps/approval/migrations/0001_initial.py | Kpaubert/onlineweb4 | 32 | 12778909 | # -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = []
operations = [
migrations.CreateModel(
name="Approval",
fields=[
(
"id",
models.AutoField(
... | 1.726563 | 2 |
alf/environments/suite_safety_gym.py | hnyu/entropy_reward | 0 | 12778910 | # Copyright (c) 2020 Horizon Robotics. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | 1.625 | 2 |
Recursion/sum_of_digits.py | eferroni/Data-Structure-and-Algorithms | 0 | 12778911 | """
How to find the sum of digits of a positive integer number using recursion?
"""
def sum_of_digits(n):
assert n >= 0 and int(n) == n, "n is lower than 0 or not a int"
if n < 10:
return n
return sum_of_digits(n // 10) + n % 10
print(sum_of_digits(0.6))
| 4.25 | 4 |
tests/test_clusterStructures/__init__.py | alekLukanen/pyDist | 5 | 12778912 | <reponame>alekLukanen/pyDist
#import tests.test_clusterStructures.star
from tests.test_clusterStructures.star import *
| 0.914063 | 1 |
tests/test_util.py | magicalyak/blinkpy | 272 | 12778913 | <gh_stars>100-1000
"""Test various api functions."""
import unittest
from unittest import mock
import time
from blinkpy.helpers.util import json_load, Throttle, time_to_seconds, gen_uid
class TestUtil(unittest.TestCase):
"""Test the helpers/util module."""
def setUp(self):
"""Initialize the blink mo... | 2.65625 | 3 |
rename.py | isjeffcom/Emotion-Surveillance | 1 | 12778914 | <filename>rename.py
# !/usr/bin/python
import os
for root, dirs, files in os.walk("./mn/", topdown=True):
for name in dirs:
path = os.path.join(root, name)
al = os.listdir(path)
i = 0
for file in al:
i = i + 1
old = path + '/' + file
new = path + ... | 3.34375 | 3 |
src/bots/cogs/admin.py | cyork95/KronaBotFam | 1 | 12778915 | import discord
from discord.ext import commands
class Admin(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command(help("Deletes the specified number of chats. Default is 2 messages."))
@commands.has_permissions(manage_messages=True)
async def clear(self, ctx, amou... | 2.703125 | 3 |
brunton_lab_to_nwb/nwbwidgets.py | catalystneuro/brunton-lab-to-nwb | 1 | 12778916 | <gh_stars>1-10
import numpy as np
import plotly.graph_objects as go
import pynwb
from ipywidgets import widgets, ValueWidget
from plotly.colors import DEFAULT_PLOTLY_COLORS
class ShowElectrodesWidget(ValueWidget, widgets.HBox):
def __init__(self, nwbobj: pynwb.base.DynamicTable, **kwargs):
super().__init_... | 2.25 | 2 |
yetAnotherDudeApp/issueTracker/admin.py | grillazz/yet-another-dude-app | 1 | 12778917 | from django.contrib import admin
from django.db.models import Count
from .models import *
@admin.register(Status)
class StatusAdmin(admin.ModelAdmin):
list_display = ('code',)
@admin.register(Priority)
class PriorityAdmin(admin.ModelAdmin):
list_display = ('code',)
@admin.register(Issue)
class IssueAdmin... | 1.757813 | 2 |
keras_frcnn/reporting/GoogleSpreadsheetReporter.py | kwon-young/MusicObjectDetector | 1 | 12778918 | import traceback
from typing import List
import httplib2
import os
from apiclient import discovery
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
# If modifying these scopes, delete your previously saved credentials
# at ~/.credentials/sheets.googleapis.com-pytho... | 2.875 | 3 |
wmt/flask/views/sims.py | mcflugen/wmt-rest | 0 | 12778919 | import os
from flask import Blueprint
from flask import json, url_for, current_app
from flask import g, request, abort, send_file
from flaskext.uploads import UploadSet
from ..utils import as_resource, as_collection
from ..db import sim as sim_db
sims_page = Blueprint('sims', __name__)
#STAGE_DIR = '/data/web/htdoc... | 2.1875 | 2 |
mergesort/merge_sort_test.py | timpel/stanford-algs | 0 | 12778920 | <reponame>timpel/stanford-algs
import merge_sort
for n in [2**n for n in range(20)]:
merge_sort.main(n, False) | 2.28125 | 2 |
plugins/ts.py | lucasberti/telegrao-py | 0 | 12778921 | <gh_stars>0
# Roubado / adaptado de https://github.com/benediktschmitt/py-ts3/blob/master/ts3/examples/viewer.py
from pprint import pprint
from api import send_message
import ts3
import os
__all__ = ["ChannelTreeNode",
"view"]
result = ""
class ChannelTreeNode(object):
def __init__(self, info, parent... | 2.4375 | 2 |
a10sdk/core/aam/aam_authentication_relay_kerberos_instance.py | deepfield/a10sdk-python | 16 | 12778922 | from a10sdk.common.A10BaseClass import A10BaseClass
class Instance(A10BaseClass):
"""Class Description::
Kerberos Authentication Relay.
Class instance supports CRUD Operations and inherits from `common/A10BaseClass`.
This class is the `"PARENT"` class for this module.`
:param kerberos_accou... | 2.015625 | 2 |
filem/filem/samples/load_xml.py | DmitryRyumin/pkgs | 2 | 12778923 | <reponame>DmitryRyumin/pkgs<filename>filem/filem/samples/load_xml.py<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Загрузка XML файла
python filem/samples/load_xml.py --file путь_к_файлу_XML [--no_clear_shell]
"""
# ###################################################################################... | 2.0625 | 2 |
tests/musictree/test_accidentals.py | alexgorji/music_score | 2 | 12778924 | <gh_stars>1-10
import os
from quicktions import Fraction
from musicscore.musicstream.streamvoice import SimpleFormat
from musicscore.musictree.treechord import TreeChord
from musicscore.musictree.treechordflags3 import TreeChordFlag3
from musicscore.musictree.treescoretimewise import TreeScoreTimewise
from musicxmlun... | 2.484375 | 2 |
src/main/python/tweetGater/gater.py | bryaneaton/BurstyTwitterStreams | 2 | 12778925 | #!/usr/bin/python
import sys
import re
gatedTweetPath = sys.argv[1]
inputPath = sys.argv[2]
outputPath = sys.argv[3]
tweetIdRegEx = re.compile("[0-9]{18}")
gatedTweetSet = set()
with open(gatedTweetPath, "r") as f:
for l in f:
gatedTweetSet.add(long(l))
# print gatedTweetSet
outputFile = open(outputPath, "w")
... | 2.796875 | 3 |
sensu_plugin/__init__.py | tubular/sensu-plugin-python | 35 | 12778926 | """This module provides helpers for writing Sensu plugins"""
from sensu_plugin.plugin import SensuPlugin
from sensu_plugin.check import SensuPluginCheck
from sensu_plugin.metric import SensuPluginMetricGeneric
from sensu_plugin.metric import SensuPluginMetricGraphite
from sensu_plugin.metric import SensuPluginMetricInf... | 1.398438 | 1 |
article/views/home.py | vyahello/newspaper-parser | 0 | 12778927 | <reponame>vyahello/newspaper-parser<filename>article/views/home.py
"""Contains API for home page views."""
from typing import Any
from flask import Response, render_template
from article import application
from article.status import HttpStatus
@application.route(rule="/")
@application.route(rule="/home")
@application... | 2.671875 | 3 |
tests/test_match_simulation.py | pitzer42/mini-magic | 0 | 12778928 | import tests.scenarios as scenarios
from tests.api_test_case import APITestCase
from entities import Match, Player
import events
class TestHappyPath(APITestCase):
@classmethod
def setUpClass(cls):
scenarios.two_players()
def match_setup(self):
match_id = self.post_to_create_a_new_match()... | 2.578125 | 3 |
bistiming/utils.py | candy02058912/bistiming | 1 | 12778929 | from __future__ import print_function, division, absolute_import, unicode_literals
import datetime
def div_timedelta_int(d, i):
d_us = d.microseconds + 1000000 * (d.seconds + 86400 * d.days)
return datetime.timedelta(microseconds=d_us / i)
def div_timedelta(d1, d2):
if isinstance(d2, int):
retur... | 2.59375 | 3 |
src/examples/tutorial/ascent_intro/python/ascent_scene_example1.py | srini009/ascent | 0 | 12778930 | <reponame>srini009/ascent
###############################################################################
# Copyright (c) Lawrence Livermore National Security, LLC and other Ascent
# Project developers. See top-level LICENSE AND COPYRIGHT files for dates and
# other details. No copyright assignment is required to contr... | 2.78125 | 3 |
automator/browsers/bugs/report_selenium.py | JannisBush/xs-leaks-browser-web | 0 | 12778931 | <filename>automator/browsers/bugs/report_selenium.py
import os
from selenium import webdriver
grid_url = "http://localhost:4444/wd/hub"
def get_driver():
return webdriver.Remote(
command_executor=grid_url,
options=webdriver.ChromeOptions())
try:
driver = get_driver()
driver.get("http://... | 2.6875 | 3 |
build-android/build.py | Zenfone2-Dev/vulkan-validation-layers | 0 | 12778932 | <reponame>Zenfone2-Dev/vulkan-validation-layers
#!/usr/bin/env python
#
# Copyright (C) 2015 The Android Open Source Project
#
# 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://ww... | 1.8125 | 2 |
getHammersleyNodes_171203.py | yasokada/pySpherepts_171126 | 0 | 12778933 | <gh_stars>0
import numpy as np
import sys
'''
v0.1 Dec. 03, 2017
- add getHammersleyNodes()
- add vdcorput()
- add get_fliplr()
- add basexpflip()
- add Test_getHammersleyNodes()
- add round_zero_direction()
'''
# %GETHAMMERSLEYNODES Comutes a Hammersley set of nodes on the unit sphere,
# % which are lo... | 2.734375 | 3 |
btgs/server.py | MineRobber9000/btgs | 2 | 12778934 | from socketserver import BaseRequestHandler
import pathlib
import os
import mimetypes
import urllib.parse as urlparse
urlparse.uses_netloc.append("gemini")
urlparse.uses_relative.append("gemini")
class GeminiRequest:
"""A Gemini request, with URL and access to the underlying socket."""
def __init__(self,sock,url,ini... | 3.15625 | 3 |
vel/launcher.py | cclauss/vel | 0 | 12778935 | <reponame>cclauss/vel<gh_stars>0
#!/usr/bin/env python
import argparse
import datetime as dtm
from vel.api import ModelConfig
from vel.util.random import set_seed
from vel.internals.parser import Parser
def main():
""" Paperboy entry point - parse the arguments and run a command """
parser = argparse.Argumen... | 2.5 | 2 |
app/shop/migrations/0002_auto_20201010_1116.py | chriskmamo/greenvoice | 0 | 12778936 | <reponame>chriskmamo/greenvoice<filename>app/shop/migrations/0002_auto_20201010_1116.py<gh_stars>0
# Generated by Django 3.0.10 on 2020-10-10 11:16
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('taxo... | 1.515625 | 2 |
cloudrunner_server/db/versions/330568e8928c_added_phone_field_for_user.py | ttrifonov/cloudrunner-server | 2 | 12778937 | """Added phone field for User
Revision ID: 330568e8928c
Revises: <PASSWORD>
Create Date: 2015-02-05 16:53:40.517660
"""
# revision identifiers, used by Alembic.
revision = '330568e8928c'
down_revision = '<PASSWORD>'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by A... | 1.34375 | 1 |
cryptoquant/app/cta_strategy/strategies/macd_strategy.py | studyquant/StudyQuant | 74 | 12778938 | <filename>cryptoquant/app/cta_strategy/strategies/macd_strategy.py
from cryptoquant.app.cta_strategy import (
CtaTemplate,
StopOrder,
TickData,
BarData,
TradeData,
OrderData,
BarGenerator,
ArrayManager,
)
import talib
from cryptoquant.trader.object import OrderData, Direction, Exchange, ... | 2.203125 | 2 |
documentation/environment_canada/ec_adhesion.py | gauteh/OilLibrary | 11 | 12778939 |
from ec_models import Adhesion
from ec_xl_parse import get_oil_properties_by_category
from ec_oil_props import get_oil_weathering
from ec_oil_misc import g_cm_2_to_kg_m_2
def get_oil_adhesions(oil_columns, field_indexes):
'''
Getting the adhesion is fairly straightforward. We simply get the
val... | 2.5625 | 3 |
bubbleimg/imgdownload/sdss/test/test_sdssimgloader_init.py | aileisun/bubblepy | 3 | 12778940 | <filename>bubbleimg/imgdownload/sdss/test/test_sdssimgloader_init.py<gh_stars>1-10
# test_sdssimgloader_init.py
# ALS 2017/05/02
"""
to be used with pytest
test sets for sdssimgloader
test suite init
"""
import numpy as np
import astropy.table as at
import astropy.units as u
import shutil
import os
import pytest
... | 2.140625 | 2 |
algotrade-bot-main/bot.py | ChoiceCoin/DeFi | 2 | 12778941 | from dataclasses import dataclass
import time
from tinyman.v1.client import TinymanTestnetClient, TinymanMainnetClient
from utils import get_trades
from colorama import Fore
@dataclass
class Account:
"""
DataClass For Bot Account
"""
address: str
private_key: str
class Bot:
def __init__(self,... | 2.765625 | 3 |
app.py | FrankchingKang/BasketbakkTeamStatusTool | 0 | 12778942 | <reponame>FrankchingKang/BasketbakkTeamStatusTool
import constants
import os
import copy
def clear_screen():
os.system("cls" if os.name == "nt" else "clear")
def conver_height(Players):
for player in Players:
l_height = player['height'].split()
player['height'] = int(l_height[0])
return Players
def c... | 3.046875 | 3 |
events/matsucon2018/migrations/0003_signupextra_shirt_size.py | darkismus/kompassi | 13 | 12778943 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-02-03 21:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('matsucon2018', '0002_auto_20180203_2326'),
]
operations = [
migrations.AddField(
model_name='signupextra... | 1.898438 | 2 |
Packs/Imperva_WAF/Integrations/ImpervaWAF/ImpervaWAF.py | diCagri/content | 799 | 12778944 | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
''' IMPORTS '''
import json
import requests
import traceback
# Disable insecure warnings
requests.packages.urllib3.disable_warnings()
''' CONSTANTS '''
INTEGRATION_CONTEXT_NAME = 'ImpervaWAF'
class Client(BaseClient... | 2.0625 | 2 |
LeetCode/May Leetcoding Challenge/Ambiguous Coordinates.py | UtkarshPathrabe/Competitive-Coding | 13 | 12778945 | class Solution:
def ambiguousCoordinates(self, s: str) -> List[str]:
def make(frag):
N = len(frag)
for d in range(1, N + 1):
left, right = frag[:d], frag[d:]
if ((not left.startswith('0') or left == '0') and (not right.endswith('0'))):
... | 3.3125 | 3 |
e2e/pages/security_page.py | svic/jenkins-configuration | 0 | 12778946 | <filename>e2e/pages/security_page.py
import os
import re
from . import JENKINS_HOST
from bok_choy.page_object import PageObject
class SecurityConfigurationPage(PageObject):
url = "http://{}:8080/configureSecurity".format(JENKINS_HOST)
def is_browser_on_page(self):
return "configure global security" i... | 2.625 | 3 |
example/trade/post_batch_create_order.py | bailzx5522/huobi_Python | 611 | 12778947 | <gh_stars>100-1000
import time
from huobi.client.trade import TradeClient
from huobi.constant import *
from huobi.utils import *
trade_client = TradeClient(api_key=g_api_key, secret_key=g_secret_key)
client_order_id_header = str(int(time.time()))
symbol_eosusdt = "eosusdt"
client_order_id_eos_01 = client_order_id_... | 2 | 2 |
root/plugins/screenshot.py | sahaynitin4tellyfun/TG-RenameBot | 1 | 12778948 | <filename>root/plugins/screenshot.py
import logging
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
import os
import shutil
import time
from root.config import Config
from pyrogram import Client, filters
... | 2.328125 | 2 |
tool/staticAnalysis/remove_bitfield.py | SZU-SE/PERIOD | 16 | 12778949 | <reponame>SZU-SE/PERIOD
#!/usr/bin/python3
import os
import sys
import re
# traverse root directory, and list directories as dirs and files as files
for root, dirs, files in os.walk(sys.argv[1]):
for file in files:
if file == "tags":
continue
name = os.path.join(root,file)
if o... | 2.703125 | 3 |
agent/command/control/libknot/control.py | riszkymf/RESTKnot | 1 | 12778950 | <gh_stars>1-10
"""Libknot server control interface wrapper.
Example:
import json
from libknot.control import *
ctl = KnotCtl()
ctl.connect("/var/run/knot/knot.sock")
try:
ctl.send_block(cmd="conf-begin")
resp = ctl.receive_block()
ctl.send_block(cmd="conf-set", section="z... | 2.15625 | 2 |