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 |
|---|---|---|---|---|---|---|
html_parsing/https_www_stoloto_ru_4x20_archive__parse_all_loto.py | DazEB2/SimplePyScripts | 117 | 50100 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from urllib.parse import urljoin
import requests
from bs4 import BeautifulSoup
import csv
def get_number(text: str) -> int:
return int(''.join(c for c in text.strip() if c.isdigit()))
first = 1
last = 50
step = 50
result = []
while True... | 2.890625 | 3 |
common/services/notice/NewsService.py | linkgeek/python_flask_cms | 1 | 50101 | # -*- coding: utf-8 -*-
from common.models.notice.UserNews import UserNews
from common.services.BaseService import BaseService
from application import db
class NewsService(BaseService):
@staticmethod
def addNews(params):
model_user_news = UserNews(**params)
db.session.add(model_user_news)
... | 2.265625 | 2 |
marvin.py | vrillusions/marvin-jabberbot | 1 | 50102 | #!/usr/bin/env python
# vim:ts=4:sw=4:expandtab:ft=python:fileencoding=utf-8
"""Marvin jabber bot.
A jabber bot made to play with jabber, python, etc and hopefully still be
useful.
@todo: use a decorator for admin commands
"""
#__version__ = "$Rev$"
import sys
sys.path.append('lib')
import datetime
import hashlib... | 2.5625 | 3 |
examples/garbage.py | cyberbeast/pympler | 862 | 50103 | <filename>examples/garbage.py
from pympler.garbagegraph import start_debug_garbage
from pympler import web
class Leaf(object):
pass
class Branch(object):
def __init__(self, root):
self.root = root
self.leaf = Leaf()
class Root(object):
def __init__(self, num_branches):
self.br... | 2.703125 | 3 |
src/planners/exact/exact_planner.py | griprox/EVCP_partially_observable_locations | 0 | 50104 | from src.planners.exact._create_model import create_model
from src.planners.exact._read_model import read_model
from src.planners.planner import Planner
from pyomo.environ import *
class ExactPlanner(Planner):
def __init__(self,
opf_method='lossless',
observe_ev_locations='full'... | 2.09375 | 2 |
src/Database/DbHandler.py | nogebour/PereBlaiseBot | 0 | 50105 | import pymongo
import pymongo.errors
import datetime
import os
from src.Error.ErrorManager import ErrorManager, ErrorCode
class DbHandler:
snapshot_pattern = "%Y%m%d_%H%M"
snapshot_name = "snapshot"
key_game = "kornettoh"
key_name = 'name'
def __init__(self, party_name=key_game):
self.pa... | 2.65625 | 3 |
src/darcyai/output/csv_output_stream.py | edgeworx/darcyai | 0 | 50106 | import csv
import io
from darcyai.file_stream import FileStream
from darcyai.output.output_stream import OutputStream
from darcyai.utils import validate_not_none, validate_type
class CSVOutputStream(OutputStream):
"""
OutputStream implementation that writes to a CSV file.
# Arguments
file_path (str)... | 3.25 | 3 |
alerter/src/utils/data.py | SimplyVC/panic | 41 | 50107 | import json
import logging
from enum import Enum
from typing import Dict
import requests
from prometheus_client.parser import text_string_to_metric_families
from src.utils.exceptions import (NoMetricsGivenException,
MetricNotFoundException,
ReceivedU... | 2.703125 | 3 |
confcrawler/acl2019/crawler/workshop_crawler.py | kronung/DASP-Project | 0 | 50108 | <reponame>kronung/DASP-Project<gh_stars>0
__author__ = "<NAME>"
import copy
from urllib import request
from bs4 import BeautifulSoup
from bs4 import element
import re
from confcrawler.util import util
def get_timestamps(url):
try:
page = request.urlopen(url)
except ConnectionError:
print("Cou... | 2.8125 | 3 |
STS.py | RafalKucharskiPK/PTVVisum_Python_Snippets | 3 | 50109 | <reponame>RafalKucharskiPK/PTVVisum_Python_Snippets
import sqlite3
def VisumInit(path=None,COMAddress='Visum.Visum.125'):
"""
###
Automatic Plate Number Recognition Support
(c) 2012 <NAME> <EMAIL>
####
VISUM INIT
"""
import win32com.client
Visum = win32com.clien... | 2.515625 | 3 |
winejournal/blueprints/wines/__init__.py | rickandersonaia/wine-journal | 0 | 50110 | from winejournal.blueprints.wines.views import wines | 1.109375 | 1 |
src_aryan/bot1/scripts/ball_detection.py | iamprasann/UMIC_TEAM4-Final | 0 | 50111 | <reponame>iamprasann/UMIC_TEAM4-Final
#!/usr/bin/env python
## Simple talker demo that listens to std_msgs/Strings published
## to the 'chatter' topic
import rospy
import cv2
import numpy as np
from std_msgs.msg import String
import matplotlib.pyplot as plt
from sensor_msgs.msg import Image
import cv2
from cv_bridg... | 2.578125 | 3 |
top-website-ranking/get_different_area_site_ranking.py | statby/spider | 1 | 50112 | <gh_stars>1-10
#!/bin/env python3
# coding=utf-8
# Filename : get_different_area_site_ranking.py
# Date : 2016-03-30 23:28:28
# Author : Statby
# Description : Get top 500 site from different area ,and write in excel.
import requests
from bs4 import BeautifulSoup
import xlsxwriter
from get_area_url impo... | 3.15625 | 3 |
examples/ner/interactive.py | laugustyniak/nlp-architect | 0 | 50113 | <filename>examples/ner/interactive.py
# ******************************************************************************
# Copyright 2017-2018 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... | 2.515625 | 3 |
lingoshell/sync.py | gavinkhung/lingoshell-lang | 0 | 50114 | <gh_stars>0
import csv
import json
def update_languages():
try:
with open("lingoshell/languages.csv", mode="r") as csv_file:
keywords = []
language_keywords = {}
csv_reader = csv.DictReader(csv_file)
for row in csv_reader:
keywords.extend(l... | 2.984375 | 3 |
array/arrayBasicprogram.py | abegpatel/Array-Practice-Programs | 1 | 50115 | <filename>array/arrayBasicprogram.py
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 24 22:12:02 2021
@author: Abeg
"""
#all symmetric pair of an array
def symmetricpair(pairs):
s=set()
for (x,y) in pairs:
s.add((x,y))
if (y,x) in s:
print((x,y),"|",((y,x)))
pairs=[(11,20),(30,40),(5,10... | 3.765625 | 4 |
ws-python/ex022.py | DerickSilva/Python | 0 | 50116 | <reponame>DerickSilva/Python
nome = str(input('Digite seu nome completo ')).strip()
maisculas = nome.upper()
minusculas = nome.lower()
letras = len(nome) - nome.count(' ')
primeiro = nome.find(' ')
print(f'Seu nome em maiusculas é {maisculas}')
print(f'Seu nome em minusculas é {minusculas}')
print(f'Seu nome tem ao tod... | 3.9375 | 4 |
ner/ner_silver_to_gold.py | svlandeg/prodigy-recipes | 312 | 50117 | <gh_stars>100-1000
import prodigy
from prodigy.models.ner import EntityRecognizer
from prodigy.components.preprocess import add_tokens
from prodigy.components.db import connect
from prodigy.util import split_string
import spacy
from typing import List, Optional
# Recipe decorator with argument annotations: (descripti... | 2.578125 | 3 |
unit 7/exc. 7.2.4.py | AviKalPython/self.py | 0 | 50118 | <filename>unit 7/exc. 7.2.4.py<gh_stars>0
# exc. 7.2.4
def seven_boom(end_number):
my_list = []
for i in range(0, end_number + 1):
s = str(i)
if '7' in s or i % 7 == 0:
my_list += ['BOOM']
else:
my_list += [i]
print(my_list)
def ma... | 3.5625 | 4 |
demo/lazy_numpy.py | markflorisson/minivect | 4 | 50119 | """
Minimal library for lazy evaluation with NumPy. Uses minivect's LLVM backend
for evaluation.
"""
import sys
import time
import numpy as np
import miniast
import specializers
import minitypes
import codegen
import xmldumper
import treepath
from ctypes_conversion import get_data_pointer, convert_to_ctypes, get_poi... | 2.296875 | 2 |
Scripts/write_sbx.py | TheOpponent/st3-translation-notes | 0 | 50120 | <reponame>TheOpponent/st3-translation-notes<gh_stars>0
# This script reads a CSV file in the translate subdirectory and inserts the strings within into an uncompressed SBX or SBN script
# with a corresponding filename with extension .SBX.bin or .SBN in the source subdirectory.
# It outputs files in the 'output' subdir... | 2.5625 | 3 |
tests/test_ping.py | naujoh/TorMySQL | 340 | 50121 | <reponame>naujoh/TorMySQL<filename>tests/test_ping.py
#!/usr/bin/env python
# encoding: utf-8
import uuid
from tornado.testing import gen_test
from . import BaseTestCase
class TestPing(BaseTestCase):
@gen_test
def test1(self):
with (yield self.pool.Connection()) as connection:
yield connec... | 1.992188 | 2 |
lab4/alr/lexer.py | aslastin/ITMO-Translation-Methods-y2021 | 0 | 50122 | import re
from alr.input_streams import InputStream
from alr.instances import Terminal, Token, END_TERMINAL_NAME
class LexerException(Exception):
pass
class Lexer:
def next(self) -> Token:
pass
def findMatchInfo(terminals: [Terminal], data: str):
for terminal in terminals:
match = re.... | 2.6875 | 3 |
Basic Markov Model Implementation/transition_prob_through_time.py | alfredholmes/cryptocurrency_data_analysis | 0 | 50123 | import sys
sys.path.append('../lib')
import exchange
import datetime
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from scipy.stats import norm
def transition_probabilities(chain, offset=1):
states = np.array([s for s in set(chain)])
state_space = {s: i for i, s in enumerate(st... | 2.359375 | 2 |
internos/survey/migrations/0008_monitoringreporting.py | UNICEFLebanonInnovation/Staging-Neuro | 0 | 50124 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2020-05-13 23:41
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import smart_selects.db_fields
class Migration(migrations.Migration):
dependencies = [
('survey', '0007_auto_2020051... | 1.601563 | 2 |
text/_cascade/formatting/viewport.py | jedhsu/text | 0 | 50125 | from ..base import AtRule
"""
Viewport
Area of the canvas document intends to use.
"""
class Viewport(AtRule):
viewport_fit: property
user_zoom: property
orientation: property
min_zoom: property
height_at_viewport: type
width_at_viewport: type
zoom_at_viewport: type
| 1.890625 | 2 |
CAPPA_Data_Analysis/DBR_Analysis_Old.py | rnsheehan/CAPPA_Data_Analysis | 0 | 50126 | <gh_stars>0
import os
import glob
import re
import sys # access system routines, including writing console output to file
import math
import scipy
import numpy as np
import matplotlib.pyplot as plt
import Common
import Plotting
# Make plots of the results obtained for the design of the DBR grating for the CORNERSTON... | 2.546875 | 3 |
hackathon/lib/setup.py | IceKhan13/QiskitFlow | 7 | 50127 | <gh_stars>1-10
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
with open("version", "r") as f:
version = f.read()
setuptools.setup(
name="qiskitflow",
version=version,
author="<NAME>",
author_email="",
description="QiskitFlow. Reproducible quantum experim... | 1.648438 | 2 |
utils/misc_utils.py | Oliver-Tautz/minecraft-bc-2020 | 11 | 50128 | #
# Miscellenous tools
#
from argparse import ArgumentParser
import inspect
from pprint import pprint
def parse_keyword_arguments(unparsed_args, class_object, debug=True):
"""
Take unparsed arguments and a class object,
check what keyword arguments class's __init__
takes, create ArgumentParser object ... | 3.53125 | 4 |
lvmsurveysim/utils/plot.py | sdss/lvmsurveysim | 3 | 50129 | <filename>lvmsurveysim/utils/plot.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @Author: <NAME> (<EMAIL>)
# @Date: 2017-10-17
# @Filename: plot.py
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause)
#
# @Last modified by: <NAME> (<EMAIL>)
# @Last modified time: 2019-03-29 01:23:34
import ... | 2.75 | 3 |
dynsimf/test/test_model.py | Tensaiz/DyNSimF | 3 | 50130 | <filename>dynsimf/test/test_model.py
import unittest
from dynsimf.models.Model import Model
from dynsimf.models.Model import ModelConfiguration
import networkx as nx
import numpy as np
__author__ = "<NAME>"
__email__ = "<EMAIL>"
class ModelTest(unittest.TestCase):
def test_model_init(self):
g = nx.rand... | 2.921875 | 3 |
effdet/config/train_config.py | phager90/efficientdet-pytorch | 1,386 | 50131 | from omegaconf import OmegaConf
def default_detection_train_config():
# FIXME currently using args for train config, will revisit, perhaps move to Hydra
h = OmegaConf.create()
# dataset
h.skip_crowd_during_training = True
# augmentation
h.input_rand_hflip = True
h.train_scale_min = 0.1
... | 1.828125 | 2 |
dacy/about.py | peleiden/DaCy | 0 | 50132 | __title__ = "dacy"
__version__ = "1.0.1" # the ONLY source of version ID
__download_url__ = "https://github.com/KennethEnevoldsen/DaCy" | 0.976563 | 1 |
CryptoHack Resources/Introduction-to-CryptoHack/great_snakes_35381fca29d68d8f3f25c9fa0a9026fb.py | ClutchKick2207/CryptoHack | 0 | 50133 | #!/usr/bin/env python3
import sys
# import this
if sys.version_info.major == 2:
print("You are running Python 2, which is no longer supported. Please update to Python 3.")
ords = [81, 64, 75, 66, 70, 93, 73, 72, 1, 92, 109, 2, 84, 109, 66, 75, 70, 90, 2, 92, 79]
print("Here is your flag:")
print("".join(chr(o ^... | 3.375 | 3 |
examples/ordering.py | F483/easyapi | 0 | 50134 | #!/usr/bin/env python
# coding: utf-8
# Copyright (c) 2015 <NAME> <<EMAIL>>
# License: MIT (see LICENSE file)
import apigen
class Ordering(apigen.Definition):
@apigen.command()
def first(self):
return "first"
@apigen.command()
def second(self):
return "second"
@apigen.command(... | 2.328125 | 2 |
app.py | JamesBarciz/U3_Flask_review | 1 | 50135 | from flask import Flask, request
from flask_sqlalchemy import SQLAlchemy
from ast import literal_eval
import requests
DB = SQLAlchemy()
class Record(DB.Model):
id = DB.Column(DB.BigInteger, primary_key=True, nullable=False)
name = DB.Column(DB.String, nullable=False)
age = DB.Column(DB.SmallInteger, nu... | 2.8125 | 3 |
src/czml3/__init__.py | mstill3/czml3 | 28 | 50136 | <reponame>mstill3/czml3
from ._version import get_versions
from .core import CZML_VERSION, Document, Packet, Preamble
__version__ = get_versions()["version"]
del get_versions
__all__ = ["Document", "Preamble", "Packet", "CZML_VERSION"]
| 1.546875 | 2 |
src/libs/best_individual.py | ronaldpereira/symbolic-regression | 0 | 50137 | <gh_stars>0
#!/usr/bin/python3
import math
import copy
class BestIndividual:
def __init__(self):
self.individual = None
self.fitness = math.inf
def check_best_individual(self, newInd):
if newInd.fitness < self.fitness:
self.individual = copy.deepcopy(newInd)
se... | 2.890625 | 3 |
tkgui/codegen.py | duangsuse-valid-projects/TkGUI | 1 | 50138 | <reponame>duangsuse-valid-projects/TkGUI
from traceback import extract_stack #codegen autoname
class SyntaxFmt: #singleton
'''some language-sepcific syntax formatters'''
@staticmethod
def pyArg(params):
'''arg1, arg2, kw1=kw1v, kw2=kw2v'''
(args, kwargs) = params
sb = []
sb.extend(args)
for (... | 2.53125 | 3 |
RNAPuzzles/rnapuzzles/views/faq/detail.py | whinyadventure/RNA-Puzzles | 0 | 50139 | <filename>RNAPuzzles/rnapuzzles/views/faq/detail.py<gh_stars>0
from django.http import Http404, HttpResponseRedirect
from django.urls import reverse
from django.views.generic import DetailView
from guardian.mixins import PermissionRequiredMixin
from rnapuzzles.models import NewsModel, FaqModel
class Detail(DetailVie... | 2.09375 | 2 |
src/discord_bot_maker/dbot.py | dehadeaaryan/discord-bot-maker | 1 | 50140 | <filename>src/discord_bot_maker/dbot.py
import discord
from discord.ext import commands
PACKAGENAME = "DiscordBotMaker"
color = discord.Color.dark_red()
FATHER = "<@!781547664079847464>"
owner = FATHER
class DBot:
def __init__(self,
bTOKEN : str,
bPrefix : tuple = ".",
owner : str = FATHER,
he... | 2.859375 | 3 |
crate/web/lists/models.py | vijay2312/crate.web | 1 | 50141 | <reponame>vijay2312/crate.web<gh_stars>1-10
from django.core.urlresolvers import reverse
from django.db import models, IntegrityError
from django.template.defaultfilters import slugify
from django.utils.translation import ugettext_lazy as _
from model_utils.models import TimeStampedModel
class List(TimeStampedModel)... | 2.453125 | 2 |
examples/idioms/programs/173.2427-format-a-number-with-grouped-thousands.py | laowantong/paroxython | 31 | 50142 | <reponame>laowantong/paroxython
"""Format a number with grouped thousands.
Number will be formatted with a comma separator between every group of thousands.
Source: cup
"""
# Implementation author: cup
# Created on 2018-09-17T20:09:08.888749Z
# Last modified on 2018-09-17T20:09:08.888749Z
# Version 1
print("f'{1000... | 3.34375 | 3 |
playerctlctl/core.py | udf/playerctlctl | 0 | 50143 | """
A daemon to make controlling multiple players easier.
Daemon core, contains the glib event loop
"""
import logging
from functools import partial
import gi
gi.require_version('Playerctl', '2.0')
from gi.repository import Playerctl, GLib
from .utils import get_player_instance, is_player_active
logger = logging.g... | 2.453125 | 2 |
api/users/migrations/0001_initial.py | fujikawahiroaki/webspecimanager | 0 | 50144 | <gh_stars>0
# Generated by Django 3.1.3 on 2021-01-10 03:26
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django_countries.fields
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappab... | 1.71875 | 2 |
util/rooms/roads.py | Polygon-MUD/mud_build | 0 | 50145 | <reponame>Polygon-MUD/mud_build
from django.contrib.auth.models import User
from adventure.models import Player, Room
p_dirt_path = Room(title="Dirt Path", description="Easy going path to a variety of adventures")
p_mushroom_road = Room(title="Mushroom Road", description="The road to meet Mario")
p_desert_path = Ro... | 2.03125 | 2 |
ABC/200/b.py | buchi1002/AtCoder | 0 | 50146 | def main():
# input
N, K = map(int, input().split())
# compute
def twoN(a: int):
if a%200 == 0:
a = int(a/200)
else:
a = int(str(a) + "200")
return a
for i in range(K):
N = twoN(N)
# output
print(N)
if __name__ == '__main_... | 3.328125 | 3 |
run.py | huhlim/alphafold | 1 | 50147 | <gh_stars>1-10
#!/usr/bin/env python
# Copyright 2021 DeepMind Technologies Limited
#
# 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
#
# Unl... | 1.640625 | 2 |
python/diodberg/renderers/serial_renderers.py | ikea-lisp-code/diodberg | 5 | 50148 | <gh_stars>1-10
from diodberg.core.renderer import Renderer
import sys
try:
import serial
except ImportError as err:
sys.stderr.write("Error: failed to import module ({})".format(err))
class DMXSerialRenderer(Renderer):
""" DMXSerialRenderer provides a renderer interface to a custom DMX shield
using ... | 2.375 | 2 |
tests/test_example.py | ARCTraining/example_project | 0 | 50149 | <filename>tests/test_example.py<gh_stars>0
def increment_by_one(x):
return x + 1
def test_increment_by_one():
assert increment_by_one(3) == 4
| 2.78125 | 3 |
output/models/ms_data/simple_type/st_h001_xsd/st_h001.py | tefra/xsdata-w3c-tests | 1 | 50150 | from dataclasses import dataclass, field
from enum import Enum
from typing import Optional, Union
class FooTypeValue(Enum):
WA = "WA"
OR = "OR"
CA = "CA"
@dataclass
class FooTest:
class Meta:
name = "fooTest"
value: Optional[Union[int, FooTypeValue]] = field(
default=None,
... | 2.984375 | 3 |
producer/plan.py | Keck-FOBOS/producer | 0 | 50151 | <reponame>Keck-FOBOS/producer
"""
Construct a set of observations by assigning fibers to targetsAllocate apertures to targets.
Contains code originally written by 2021 Akamai intern, <NAME>.
.. include:: ../include/links.rst
"""
import io
import sys
import time
import warnings
from pathlib import Path
from configpars... | 2.25 | 2 |
accounts/urls.py | SynBioUC/flapjack_api | 0 | 50152 | from django.urls import path
from rest_framework_simplejwt.views import TokenRefreshView
from .views import registration, log_in
urlpatterns = [
path('register/', registration, name='register'),
path('log_in/', log_in, name='log_in'),
path('refresh/', TokenRefreshView.as_view(), name='token_refresh'),
]
| 1.703125 | 2 |
scripts/BuildTimes.py | grassofsky/llfio | 356 | 50153 | #!/usr/bin/python3
# Calculate boost.afio build times under various configs
# (C) 2015 <NAME>
# Created: 12th March 2015
#[ [`--link-test --fast-build debug`][][[footnote ASIO has a link error without `link=static`]][fails]]
#[ [`--link-test debug`][][][]]
#[ [`--link-test --lto debug`][[]][][]]
... | 1.851563 | 2 |
core/network/utils.py | jlin/inventory | 22 | 50154 | <gh_stars>10-100
from core.network.models import Network
def calc_networks(network, nq=None):
network.update_network()
eldars = []
sub_networks = []
if not nq:
nq = Network.objects.all()
for pnet in nq.order_by('prefixlen', 'ip_upper', 'ip_lower'):
pnet.update_network()
if... | 2.234375 | 2 |
problem0231.py | kmarcini/Project-Euler-Python | 0 | 50155 | ###########################
#
# #231 The prime factorisation of binomial coefficients - Project Euler
# https://projecteuler.net/problem=231
#
# Code by <NAME>
#
###########################
| 2.03125 | 2 |
src/Client/recitationSystem/editRecitation/editRecitation.py | Sniper970119/MemoryAssistInPython | 19 | 50156 | # -*- coding:utf-8 -*-
from src.Client.Conf.config import *
from src.Client.recitationSystem.editRecitation.tools import editRecitationList, removeRecitation
from src.Client.SystemTools.SaveFiles import saveFiles
class EditRecitation():
"""
编辑任务子系统。调用类,任务由被调用者完成。
"""
def __init__(self, filename='../... | 2.625 | 3 |
app.py | mdwiltfong/capstone_one | 0 | 50157 | <reponame>mdwiltfong/capstone_one<filename>app.py<gh_stars>0
from locale import currency
import os
import pdb
from flask import Flask, render_template, flash, redirect, session, jsonify,request,send_file
from flask_debugtoolbar import DebugToolbarExtension
from sqlalchemy.exc import IntegrityError
from models import T... | 2.125 | 2 |
Lstm_Attention_mnist.py | ttom525tw/keras_deeplearningwithAI_model | 3 | 50158 | # -*- coding: utf-8 -*-
from __future__ import print_function
import keras
from keras.datasets import mnist
from keras.models import Model
from keras.layers import Input, Dense, TimeDistributed
from keras import initializers,regularizers,activations,constraints
from keras.engine.topology import Layer,InputSpec
from ke... | 2.46875 | 2 |
nysa/cbuilder/sdb.py | CospanDesign/nysa | 15 | 50159 | <gh_stars>10-100
#! /usr/bin/python
# Copyright (c) 2015 <NAME> (<EMAIL>)
#
# This file is part of Nysa.
# (http://wiki.cospandesign.com/index.php?title=Nysa.org)
#
# Nysa is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software ... | 2.390625 | 2 |
projectrecipe/aws_service.py | rishuatgithub/projectrecipe | 1 | 50160 | <filename>projectrecipe/aws_service.py<gh_stars>1-10
import boto3 as boto
import read_config
import setup_logging
import datetime
import socket
config = read_config.getconfig()
log = setup_logging.getLogger() # 192.168.0.17
def getAWSSession(profile='Default'):
log.info("Setting up AWS Session for profile: {}".f... | 2.46875 | 2 |
problem01.py | goznauk/ProjectEuler.py | 0 | 50161 | <reponame>goznauk/ProjectEuler.py<gh_stars>0
i = 1
sum = 0
for i in range(1000) :
if i%3==0 :
sum += i
elif i%5==0 :
sum += i
print sum
| 3.0625 | 3 |
DataIngestion_FeaturePreparation/utilFunctions.py | Glorf/SparkDLTrigger | 24 | 50162 | import numpy as np
import math
from pyspark.sql import Row
"""
Implementation of Lorentz vector
"""
class LorentzVector(object):
def __init__(self, *args):
if len(args)>0:
self.x = args[0]
self.y = args[1]
self.z = args[2]
self.t = args[3]
def SetPt... | 3.1875 | 3 |
gym_pybullet_drones/envs/single_agent_rl/BaseSingleAgentAviary.py | ramonfontes/gym-pybullet-drones | 0 | 50163 | <gh_stars>0
import os
import numpy as np
from scipy.optimize import nnls
from gym import spaces
import pybullet as p
import pybullet_data
from gym_pybullet_drones.envs.BaseAviary import DroneModel, Physics, ImageType, BaseAviary
########################################################################################... | 1.867188 | 2 |
pybash/csvcolumn.py | nguyentu1602/pyexp | 0 | 50164 | <reponame>nguyentu1602/pyexp
#!/usr/bin/env python
# csv module that comes with the python standard library
import csv
import sys
""" cat emailcomments.csv | python csvcolumn.py 0
Each argument that is provided to a Python script is exposed through the sys.argv array,
which can be accessed by first importing... | 3.984375 | 4 |
Utils/Sprite_utils.py | kuyu12/Tower_defence | 0 | 50165 | import pygame
from Utils.Math_utils import distance
class SpriteUtils:
@staticmethod
def get_closet_enemy(x, y, max_radius, sprites: [pygame.sprite.Sprite], metric_func):
radius_sprites = list(
filter(lambda pos: distance((x, y), (pos.rect.centerx, pos.rect.centery)) <= max_radius, sprit... | 3.015625 | 3 |
tests/test_lesson4_frog_river_one.py | ardenn/codility | 0 | 50166 | <reponame>ardenn/codility
from solutions.lesson4_frog_river_one import solution
def test_for_x_5_time_found():
solution([1,3,1,4,2,3,5,4],5)
def test_for_x_5_time_not_found():
solution([1,3,1,4,2,3,6,4],5) | 2.984375 | 3 |
app/helpers/tenor.py | NewShadesDAO/api | 1 | 50167 | <reponame>NewShadesDAO/api<gh_stars>1-10
from typing import Optional
import requests
from app.config import get_settings
class TenorClient:
def __init__(self):
settings = get_settings()
self.api_key = settings.tenor_api_key
self.search_endpoint = "https://g.tenor.com/v1/search"
s... | 2.546875 | 3 |
BOJ/02000~02999/2800~2899/2858.py | shinkeonkim/today-ps | 2 | 50168 | from math import sqrt
R,B=list(map(int,input().split()))
S = R+B
for i in range(1, int(sqrt(S))+1):
if S % i ==0 :
a = i
b = S // i
if a<b:
a,b=b,a
if a>2 and b>2 and (a-2)*(b-2) == B:
print(a,b) | 3.21875 | 3 |
hint_cli/format.py | agarthetiger/hint | 1 | 50169 | <reponame>agarthetiger/hint<gh_stars>1-10
import re
import click
import rich
RE_COMMAND = re.compile(r"`(?P<command>.*?)`")
# See available colours listed under click.Style on
# https://click.palletsprojects.com/en/7.x/api/#utilities
TITLE_COLOUR = "cyan"
COMMAND_COLOUR = "blue"
def style_command(match):
retu... | 2.625 | 3 |
dynamic_dispatch/__init__.py | XevoInc/dynamic_dispatch | 5 | 50170 | """ Like functools.singledispatch, but dynamic, value-based dispatch. """
__all__ = ('dynamic_dispatch',)
import functools
import inspect
from typing import Union, Callable, Type, Hashable
from dynamic_dispatch._class import class_dispatch
from dynamic_dispatch._func import func_dispatch
from ._typeguard import ty... | 3.578125 | 4 |
cogs/utils/hypixel.py | HypixelBot/bot | 10 | 50171 | <reponame>HypixelBot/bot<gh_stars>1-10
""" Simple Hypixel-API in Python, by Snuggle | 2017-09-30 to 2017-10-28 """
import base64
import gzip
import aiohttp
from collections import Counter
import io
from argparse import Namespace
from cogs.utils import jnbt
__version__ = '0.7.4'
# pylint: disable=C0103
# TODO: Add mo... | 1.984375 | 2 |
steam/ext/tf2/protobufs/struct_messages.py | olifog/steam-ext-tf2 | 0 | 50172 | from __future__ import annotations
from typing_extensions import Self
from ....protobufs.struct_messages import StructMessage
from ....utils import StructIO
# some custom messages to make things a lot easier decoding/encoding wise
class CraftRequest(StructMessage):
recipe: int
items: list[int]
def __by... | 2.21875 | 2 |
cms/publications/models.py | dragon-dxw/nhs-ei.website | 0 | 50173 | <reponame>dragon-dxw/nhs-ei.website
from urllib.parse import urlparse
from cms.categories.models import Category, PublicationType, CategoryPage
from cms.publications.blocks import PublicationsBlocks
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from django.db import models
from django.db.mod... | 2.265625 | 2 |
src/tests/scanner/controls/conftest.py | alex-dya/security_scanner | 0 | 50174 | <filename>src/tests/scanner/controls/conftest.py
from abc import ABC, abstractmethod
from functools import partial
from textwrap import dedent
from scanner.types import ControlStatus
def pytest_generate_tests(metafunc):
if metafunc.function.__name__ != 'test_case':
return metafunc
idlist = [
... | 2.3125 | 2 |
netbox-interact/netbox-extract.py | jmanteau/evpn-cicd-arista-containerlab | 1 | 50175 |
from pprint import pprint
from collections import defaultdict
import yaml
import pynetbox
def get_netbox():
"""
Return Netbox API handler
Returns:
pynetbox.API -- Netbox API handler
"""
nburl = "http://1192.168.127.12:8000/"
NETBOX_TOKEN = "<KEY>"
session = requests.Session()
... | 2.546875 | 3 |
mmd_tools/operators/misc.py | lordscales91/blender_mmd_tools | 1 | 50176 | # -*- coding: utf-8 -*-
import re
import bpy
from bpy.types import Operator
from collections import OrderedDict
from mmd_tools import utils
from mmd_tools.core import model as mmd_model
from mmd_tools.core.morph import FnMorph
from mmd_tools.core.material import FnMaterial
PREFIX_PATT = r'(?P<prefix>[0-9A-Z]{3}_)(?... | 1.976563 | 2 |
tests/test_vectorizers.py | TimSchopf/Keyphrase_Vectorizers | 23 | 50177 | <filename>tests/test_vectorizers.py
from typing import List
import flair
from flair.models import SequenceTagger
from flair.tokenization import SegtokSentenceSplitter
from keybert import KeyBERT
import tests.utils as utils
from keyphrase_vectorizers import KeyphraseCountVectorizer, KeyphraseTfidfVectorizer
english_d... | 2.25 | 2 |
util.py | mayuansdu/paper_spider | 0 | 50178 | <gh_stars>0
#!usr/bin/env python
# -*- coding: utf-8 -*-
import platform, random, time, logging, logging.handlers
from pymongo import MongoClient
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
# 记录程序运行的日志文件设定
logfile = './log/log_util.log'
logfile_size = 5... | 2.203125 | 2 |
pybabylonjs/babylonjs.py | TileDB-Inc/TileDB-PyBabylonJS | 2 | 50179 | <filename>pybabylonjs/babylonjs.py<gh_stars>1-10
#!/usr/bin/env python
# coding: utf-8
# Copyright (c) TileDB, Inc..
# Distributed under the terms of the Modified BSD License.
"""
BabylonJS Jupyter Widget
"""
from ipywidgets import DOMWidget
import json
import os
from traitlets import CInt, Float, Dict, List, TraitE... | 2.203125 | 2 |
CBCS_Tickets/apps.py | tjdolan121/tickets | 1 | 50180 | <gh_stars>1-10
from django.apps import AppConfig
class CbcsTicketsConfig(AppConfig):
name = 'CBCS_Tickets'
| 1.148438 | 1 |
traiders/backend/api/models/__init__.py | rdilruba/bounswe2019group2 | 11 | 50181 | <gh_stars>10-100
from .equipment import Equipment
from .investment import ManualInvestment, Asset, OnlineInvestment
from .parity import Parity
from .users import User
from .article import Article
from .comment import ArticleComment, EquipmentComment
from .mobile_app import MobileApp
from .likes import Like
from .follow... | 0.988281 | 1 |
lib/test/lib/classifiers/hmm/test_topologies.py | eonu/tempora | 32 | 50182 | import pytest, warnings, numpy as np
from sequentia.classifiers import _Topology, _LeftRightTopology, _ErgodicTopology, _LinearTopology
from ....support import assert_equal, assert_all_equal, assert_distribution
# Set seed for reproducible randomness
seed = 0
np.random.seed(seed)
rng = np.random.RandomState(seed)
# =... | 2.59375 | 3 |
psiPerGene.py | CDZBIOSTU/SUPPA | 176 | 50183 | <filename>psiPerGene.py
# -*- coding: utf-8 -*-
"""
Created on Fri May 23 10:17:33 2014
@author: <NAME>
@email: <EMAIL>
"""
import sys
import logging
from argparse import ArgumentParser, RawTextHelpFormatter
from lib.tools import *
from lib.gtf_store import *
description = \
"Description:\n\n" + \
"This to... | 2.546875 | 3 |
funilaria/migrations/0009_auto_20191010_1655.py | ph0980/OPE-IndyCar | 2 | 50184 | # Generated by Django 2.2 on 2019-10-10 19:55
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('funilaria', '0008_auto_20191009_0904'),
]
operations = [
migrations.AddField(
model_name='orcamento',
... | 1.460938 | 1 |
agora/model/account.py | perkexchange/kin-python | 11 | 50185 | <reponame>perkexchange/kin-python<gh_stars>10-100
from typing import Optional
from agoraapi.account.v4 import account_service_pb2 as account_pb_v4
from agora.keys import PublicKey
class AccountInfo:
"""The information of a Kin account.
:param account_id: The ID of the account.
:param balance: The balan... | 2.390625 | 2 |
ctdConfig.py | trondkr/okokyst_toolbox | 0 | 50186 | <reponame>trondkr/okokyst_toolbox
class CTDConfig(object):
def __init__(self, createStationPlot,
createTSPlot,
createContourPlot,
createTimeseriesPlot,
binDataWriteToNetCDF,
describeStation,
createHistoricalTi... | 2.0625 | 2 |
al/algorithms/deep_bayesian.py | kili-technology/active-learning | 3 | 50187 | # https://arxiv.org/pdf/1703.02910.pdf, Deep Bayesian Active Learning with Image Data
import numpy as np
from .baseline import Strategy
from ..helpers.time import timeit
class BayesianActiveLearning(Strategy):
def __init__(self, nb_forward=10, **kwargs):
super(BayesianActiveLearning, self).__init__()
... | 2.515625 | 3 |
admin/handler/userHandler.py | xin1195/smart | 1 | 50188 | <filename>admin/handler/userHandler.py
#!/usr/bin/env python3
# _*_coding:utf-8_*_
import hashlib
import traceback
import tornado.web
from tornado import gen
from admin.handler.baseHandler import BaseHandler
from common.authLib import auth_permissions
from setting import logger
class AdminUserHandler(BaseHandler):
... | 2.171875 | 2 |
tensorforce/core/memories/old_naive_prioritized_replay.py | philipshurpik/tensorforce | 1 | 50189 | <gh_stars>1-10
# Copyright 2017 reinforce.io. 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 ap... | 2.015625 | 2 |
leetcode/0001.Two-Sum/0001.Two-Sum.py | oohyeah0331/UVa | 0 | 50190 | <reponame>oohyeah0331/UVa
class Solution:
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
i, j = 0, 0
for i, n in enumerate(nums):
a = target - n
# print('i = ',i,'n = ',n)
#... | 3.34375 | 3 |
config/custom_components/hydroquebec/sensor.py | drynish/home-assistant | 1 | 50191 | import logging
import asyncio
import json
from datetime import datetime, timedelta
from dateutil import tz, relativedelta
from pyhydroquebec.error import PyHydroQuebecHTTPError
from pyhydroquebec.client import HydroQuebecClient
from pyhydroquebec.consts import (
CURRENT_MAP,
DAILY_MAP,
)
import voluptuous a... | 2.0625 | 2 |
backend/db_mongo.py | TripleDogDare/RadioWCSpy | 0 | 50192 | import database
import pymongo
from pymongo import MongoClient
import copy
class Database(database.Database):
def __init__(self):
database.Database.__init__(self)
client = None
db = None
collection = None
recent = None
host = 'localhost'
port = 27017
timeout = 20
database_name = 'radiowcs'
auth... | 2.96875 | 3 |
trainers/expname_trainer.py | Hhhhhhhhhhao/image-cartoonization | 0 | 50193 | import torch
from torchvision.utils import make_grid
import numpy as np
from base import BaseTrainer
from models import Generator, Discriminator
from losses import *
from data_loaders import CartoonDataLoader
from utils import MetricTracker
class ExpnameTrainer(BaseTrainer):
def __init__(self, config):
su... | 2.140625 | 2 |
redcaphelper/utils.py | sujaypatil96/redcaphelper | 10 | 50194 | <reponame>sujaypatil96/redcaphelper<gh_stars>1-10
"""
Very assorted utilities and odds and ends for use in module.
"""
### IMPORTS
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from future import standard_library
st... | 2.40625 | 2 |
tests/test_temp.py | D-Bits/Converty | 1 | 50195 | <reponame>D-Bits/Converty<filename>tests/test_temp.py
from unittest import TestCase
from converty.temperature import(
fahrenheit_to_celsius,
celsius_to_fahrenheit,
celsius_to_kelvin,
kelvin_to_celsius,
fahrenheit_to_kelvin,
kelvin_to_fahrenheit
)
# Temperature unit tests
class TempTests(TestCa... | 3.1875 | 3 |
tests/urls.py | nkantar/django-distill | 138 | 50196 | from django.conf import settings
from django.http import HttpResponse
from django.urls import include, path
from django.contrib.flatpages.views import flatpage as flatpage_view
from django.apps import apps as django_apps
from django_distill import distill_url, distill_path, distill_re_path
def test_no_param_view(requ... | 2.078125 | 2 |
wily/archivers/__init__.py | wcooley/wily | 0 | 50197 | <gh_stars>0
from collections import namedtuple
from dataclasses import dataclass
class BaseArchiver(object):
"""Abstract Archiver Class"""
def revisions(self, path, max_revisions):
"""
Get the list of revision
:param path: the path
:type path: ``str``
:param max_revi... | 2.875 | 3 |
TwitterStatsLib/test/__init__.py | pecet/pytosg | 0 | 50198 | <reponame>pecet/pytosg
""" Main unit test module """
import unittest
from .test_LazyDict import TestLazyDict
from .test_TwitterStatsGenerator import TestMap
from .test_InsertableOrderedDict import TestInsertableOrderedDict
if __name__ == '__main__':
unittest.main()
| 1.242188 | 1 |
audioengine/model/finetuning/wav2vec2/helper/load_preprocessed_data.py | NiklasHoltmeyer/stt-audioengine | 0 | 50199 | <filename>audioengine/model/finetuning/wav2vec2/helper/load_preprocessed_data.py
from pathlib import Path
from audioengine.model.finetuning.wav2vec2.helper.argument_parser import argument_parser
from audioengine.model.finetuning.wav2vec2.helper.parquetdataset import ParquetDataset
def load_datasets(data_args):
tr... | 2.5 | 2 |