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 |
|---|---|---|---|---|---|---|
codility.com/sorting/__twice_for.py | Jagrmi-C/jagrmitest | 0 | 12791651 | <reponame>Jagrmi-C/jagrmitest
ar = [1, 4, 7, 2, 6]
for i in range(5):
for k in range(i+1, 5):
print(i, k)
print("array")
n = len(ar)
for i in range(n):
for k in range(i, n):
print(ar[i], ar[k])
| 3.453125 | 3 |
server/fire_watch/log/log_configs.py | Aradhya-Tripathi/free-watch | 5 | 12791652 | <filename>server/fire_watch/log/log_configs.py
import logging
import fire_watch
from fire_watch.errorfactory import LogsNotEnabled
FMT = "%(asctime)s:%(name)s:%(message)s"
def get_logger(
logger_name: str,
filename: str,
level: int = 10,
) -> logging.getLogger:
"""Simple logger configuration impleme... | 2.578125 | 3 |
dero/ml/typing.py | whoopnip/dero | 0 | 12791653 | from typing import List, Dict, Optional, Union, Any
import pandas as pd
ModelParam = Optional[Union[str, int, float]]
ParamDict = Dict[str, ModelParam]
ModelDict = Dict[str, Union[ParamDict, float]]
AllModelResultsDict = Dict[str, List[ModelDict]]
DfDict = Dict[str, pd.DataFrame]
ModelOptionPossibilitiesDict = Dict[s... | 2.453125 | 2 |
agents/Power_Supply/8320/power_supply_monitors.2.0.py | nishanthprakash-hpe/nae-scripts | 0 | 12791654 | # -*- coding: utf-8 -*-
#
# (c) Copyright 2018 Hewlett Packard Enterprise Development LP
#
# 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... | 2.078125 | 2 |
blog/admin/__init__.py | hentt30/education4all | 0 | 12791655 | """
Admin access page settings
"""
from django.contrib import admin
from blog.models import get_model_factory
from .posts_admin import PostAdmin
# Register your models here.
admin.site.register(get_model_factory('PostsFactory').create(), PostAdmin)
| 1.484375 | 1 |
Road2Knowledge/inScripter/processALL_OpenAire.py | fbellidopazos/OpenScience-Public | 0 | 12791656 | <gh_stars>0
# %%
import jsonlines
from multiprocessing.pool import ThreadPool
import glob
import json
import os
# %%
whereData = "../OpenAire/publication/" # where to store and access OpenAire data
# MUST end with a slash!!!!
def process_one_file(outputName,inputFile):
... | 2.671875 | 3 |
setup.py | astariul/pytere | 21 | 12791657 | import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
# # The following code can be used if you have private dependencies. Basically it requires the user to set an
# # environment variable `GH_PAT` to a Github Personal Access Token (with access to the private reposi... | 1.953125 | 2 |
Web/sessionManager.py | cmd2001/Open-TesutoHime | 11 | 12791658 | <reponame>cmd2001/Open-TesutoHime
from userManager import UserManager
from flask import request
class SessionManager:
def __init__(self):
self.mem = {}
return
def check_user_status(self) -> bool: # to check whether current user has logged in properly
lid = request.cookies.get('Login_... | 2.78125 | 3 |
miniboss/__init__.py | afroisalreadyinu/miniboss | 633 | 12791659 | from .main import cli
from .services import Service
from .context import Context
from .types import set_group_name as group_name
| 1.125 | 1 |
plotsky.py | hagabbar/VItamin | 13 | 12791660 | import numpy as np
from ligo.skymap import kde
import matplotlib
matplotlib.use('Agg')
from matplotlib.colors import to_rgb
from matplotlib import pyplot as plt
from mpl_toolkits.basemap import Basemap
#matplotlib.rc('text', usetex=True)
def greedy(density):
i,j = np.shape(density)
idx = np.argsort(density.fla... | 2.421875 | 2 |
TEKDB/TEKDB/apps.py | Ecotrust/TEKDB | 4 | 12791661 | # TEKDB/apps.py
from django.apps import AppConfig
class TEKDBConfig(AppConfig):
name = 'TEKDB'
verbose_name = 'Records'
| 1.15625 | 1 |
DataStructures/LinkedList/CycleDetection.py | baby5/HackerRank | 0 | 12791662 | <reponame>baby5/HackerRank<filename>DataStructures/LinkedList/CycleDetection.py
#coding:utf-8
def has_cycle(head):
ptr1 = head
ptr2 = head
while ptr2 and ptr1.next:
ptr1 = ptr1.next.next
ptr2 = ptr2.next
if ptr1 is ptr2:
return 1
return 0
| 3.671875 | 4 |
utils/trainer.py | tonouchi510/kfp-project | 0 | 12791663 | # DLトレーニングで共通のロジック・モジュール
import tensorflow as tf
from tensorflow.python.data.ops.readers import TFRecordDatasetV2
from tensorflow.python.keras.callbacks import History
from google.cloud import storage
from typing import Callable, List
import os
def get_tfrecord_dataset(
dataset_path: str,
preprocessing: Call... | 2.671875 | 3 |
cameramodels/align.py | iory/cameramodels | 9 | 12791664 | import numpy as np
def align_depth_to_rgb(
depth,
bgr_cameramodel,
depth_cameramodel,
depth_to_rgb_transform):
"""Align depth image to color image.
Parameters
----------
depth : numpy.ndarray
depth image in meter order.
bgr_cameramodel : cameramodels.Pinhol... | 2.90625 | 3 |
tests/fixtures/me.py | akram/ovh-cli | 42 | 12791665 | <filename>tests/fixtures/me.py<gh_stars>10-100
# -*- coding: utf-8 -*-
def info():
return {
'country': 'FR',
'firstname': 'John',
'legalform': 'individual',
'name': 'Doe',
'currency': {
'code': 'EUR',
'symbol': 'EURO'
},
'ovhSubsidiar... | 1.757813 | 2 |
homeassistant/components/hardkernel/const.py | liangleslie/core | 30,023 | 12791666 | <filename>homeassistant/components/hardkernel/const.py
"""Constants for the Hardkernel integration."""
DOMAIN = "hardkernel"
| 1.039063 | 1 |
DataConnector/AppDataPublisher.py | twatteynelinear/dustlink_sierra | 4 | 12791667 | #!/usr/bin/python
import logging
class NullHandler(logging.Handler):
def emit(self, record):
pass
log = logging.getLogger('AppDataPublisher')
log.setLevel(logging.ERROR)
log.addHandler(NullHandler())
import copy
import threading
from DustLinkData import DustLinkData
from EventBus import EventBusClient
... | 2.1875 | 2 |
tests/UnitTests/Morphology/Disambiguator/disambiguator_prefix_rule1_test.py | ZenaNugraha/PySastrawi | 282 | 12791668 | import unittest
from Sastrawi.Morphology.Disambiguator.DisambiguatorPrefixRule1 import DisambiguatorPrefixRule1a, DisambiguatorPrefixRule1b
class Test_DisambiguatorPrefixRule1Test(unittest.TestCase):
def setUp(self):
self.subject1a = DisambiguatorPrefixRule1a()
self.subject1b = DisambiguatorPrefixR... | 2.78125 | 3 |
move.py | laybatin/move-to-registry | 0 | 12791669 | <filename>move.py<gh_stars>0
import subprocess
import requests
import json
host='registry.host.com'
port='16443'
url_addr='{}:{}/v2'.format(host,port)
print(url_addr)
r = requests.get('https://{}/_catalog'.format(url_addr))
js = json.loads(r.content)
#print(js)
tag_format='https://' + url_addr + '/{IMAGE_NAME}/ta... | 2.375 | 2 |
Phase_1/O-18-by-Yuewei.py | yapanliu/ashrae-ob-database | 0 | 12791670 | <filename>Phase_1/O-18-by-Yuewei.py
import pandas as pd
import numpy as np
import os
# specify the path
data_path = 'D:/yapan_office_D/Data/Annex-79-OB-Database/2021-06-03-raw-data/Annex 79 Data Collection/O-18-Nan Gao/CornishCollege_CleanEXPORT (6)/'
template_path = 'D:/yapan_office_D/Data/Annex-79-OB-Database/OB Dat... | 2.421875 | 2 |
main.py | pteoh/serverless-telegram-bot | 2 | 12791671 | <gh_stars>1-10
import os
import telegram
import random
bot = telegram.Bot(token=os.environ["TELEGRAM_TOKEN"])
# dictionary of trigger words with single 1:1 reply
singlereplydict = {
"tableflip": "(╯°□°)╯︵ ┻━┻",
"bagelflip": "(╯°□°)╯︵ 🥯",
"tacoflip": "(╯°□°)╯︵ 🌮",
"pizzaflip": "(╯°□°)╯︵ 🍕",
"hot... | 2.46875 | 2 |
python/anagram_solver.py | patrickleweryharris/code-snippets | 5 | 12791672 | import itertools
# This snippet has been turned into a full repo:
# github.com/patrickleweryharris/anagram_solver
def anagram_solver(lst):
"""
Return all possible combinations of letters in lst
@type lst: [str]
@rtype: None
"""
for i in range(0, len(lst) + 1):
for subset in itertools.... | 3.84375 | 4 |
pwm_motor_control_ros/test/integration/pwm_test_support/xbox_controller_joy_stub.py | GTAeberhard/pwm_motor_control_ros | 0 | 12791673 | <filename>pwm_motor_control_ros/test/integration/pwm_test_support/xbox_controller_joy_stub.py
from sensor_msgs.msg import Joy
class XboxControllerJoyStub:
@staticmethod
def right_trigger_depressed():
joy_msg = XboxControllerJoyStub.idle_controller()
joy_msg.axes[5] = -1.0
return joy_msg... | 2.28125 | 2 |
BranchFilters/HeadToMasterBranchFilterer.py | Christian-Nunnally/git-chains | 0 | 12791674 | from BranchFilters.BranchFilterer import BranchFilterer
from Interoperability.ShellCommandExecuter import ShellCommandExecuter
from RepositoryWalkers.BranchToCommitWalker import BranchToCommitWalker
from Logger import Logger
class HeadToMasterBranchFilterer(BranchFilterer):
def __init__(self, repository):
... | 2.40625 | 2 |
arviz/plots/backends/__init__.py | Ban-zee/arviz | 0 | 12791675 | <gh_stars>0
"""ArviZ plotting backends."""
| 1.070313 | 1 |
Data Science With Python/14-interactive-data-visualization-with-bokeh/01-basic-plotting-with-bokeh/12-color-mapping.py | aimanahmedmoin1997/DataCamp | 3 | 12791676 | '''
Colormapping
The final glyph customization we'll practice is using the CategoricalColorMapper to color each glyph by a categorical property.
Here, you're going to use the automobile dataset to plot miles-per-gallon vs weight and color each circle glyph by the region where the automobile was manufactured.
The ori... | 3.765625 | 4 |
esipysi/esipysi.py | FlyingKiwiBird/EsiPysi | 7 | 12791677 | import asyncio
import aiohttp
import requests
import json
from .op import EsiOp
from .auth import EsiAuth
from .cache import EsiCache, DictCache
from .esisession import EsiSession
import logging
logger = logging.getLogger("EsiPysi")
class EsiPysi(object):
"""
The EsiPysi class creates "EsiOp" operations based... | 2.53125 | 3 |
language/__init__.py | UoA-ECE-RP/sha | 1 | 12791678 | __author__ = 'Avinash'
| 0.988281 | 1 |
Part 1/Chapter 4/example 1.1.py | MineSelf2016/PythonInEconomicManagement | 0 | 12791679 | <filename>Part 1/Chapter 4/example 1.1.py<gh_stars>0
score = 92
print("优秀") if score >= 90 else print("及格")
a = 1
b = 2
print(type(a))
print(type(b))
print(a/b) | 3.328125 | 3 |
core/extract_plain_text.py | Gatorix/tranSub | 1 | 12791680 | <filename>core/extract_plain_text.py
import utils
import sys
path = r'/Users/caosheng/Downloads/Kota Factory (webm)/(English)(499) Kota Factory - EP 01 - Inventory - YouTube.srt'
output_file_name = utils.get_filename(path)
def extract_plain_text(path, english_only=False, chinese_only=False):
timer = utils.Time... | 2.796875 | 3 |
python/gpio.py | trojanspike/qbian-server | 0 | 12791681 | <gh_stars>0
import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(g.BCM)
try:
GPIO.setup(17, GPIO.OUT) # GPIO17
while True:
GPIO.output(17, GPIO.HIGH)
sleep(1.5)
GPIO.output(17, GPIO.LOW)
sleep(1.5)
except KeyboardInterrupt:
GPIO.cleanup();
| 2.828125 | 3 |
branchdb/git_tools.py | CalgaryMichael/branchdb-python | 0 | 12791682 | <reponame>CalgaryMichael/branchdb-python
# coding=utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
from git import Repo
def get_repo():
"""Returns the Repo of the current directory"""
call_dir ... | 2.6875 | 3 |
discord/webhook/sync.py | RamzziSudip/nextcord | 3 | 12791683 | """
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
Copyright (c) 2021-present tag-epic
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
t... | 0.96875 | 1 |
player.py | duct-tape/taped-car-stereo | 0 | 12791684 | import pifacecad
import asyncore
from mplayer.async import AsyncPlayer
def handle_data(data):
if not data.startswith('EOF code'):
print('log: %s' % (data, ))
else:
player.quit()
def init_player():
# Don't autospawn because we want to setup the args later
player = AsyncPlayer(autospaw... | 2.625 | 3 |
i_xero2/__init__.py | aracnid/i-xero2 | 0 | 12791685 | """A set of functions to retrieve and save data into Xero.
"""
# import package modules
from i_xero2.i_xero import ExpiredCredentialsException
from i_xero2.i_xero import XeroInterface
from i_xero2.i_xero_ui import XeroInterfaceUI
__version__ = '2.4.2'
| 1.710938 | 2 |
lib/utils.py | chawins/entangle-rep | 15 | 12791686 | import numpy as np
import torch
def compute_lid(x, x_train, k, exclude_self=False):
"""
Calculate LID using the estimation from [1]
[1] Ma et al., "Characterizing Adversarial Subspaces Using
Local Intrinsic Dimensionality," ICLR 2018.
"""
with torch.no_grad():
x = x.view((x.size(... | 2.4375 | 2 |
plico/utils/loop.py | lbusoni/plico | 0 | 12791687 | import abc
from six import with_metaclass
class Loop(with_metaclass(abc.ABCMeta, object)):
@abc.abstractmethod
def name(self):
assert False
@abc.abstractmethod
def close(self):
assert False
@abc.abstractmethod
def open(self):
assert False
@abc.abstractmethod
... | 2.9375 | 3 |
neuralmt/utils.py | anoopsarkar/nlp-class-hw | 7 | 12791688 | <gh_stars>1-10
import io
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from PIL import Image
def alphaPlot(alpha,
output,
source):
plt.figure(figsize=(14, 6))
sns.heatmap(alpha, xticklabels=output.split(), yticklabels=source.split(),
linewi... | 2.9375 | 3 |
bookorbooks/school/models/class_model.py | talhakoylu/SummerInternshipBackend | 1 | 12791689 | <reponame>talhakoylu/SummerInternshipBackend
from django.core.exceptions import ValidationError
from constants.school_strings import SchoolStrings
from django.db import models
from school.models.abstract_base_model import AbstractSchoolBaseModel
class Class(AbstractSchoolBaseModel):
school = models.ForeignKey(
... | 2.375 | 2 |
app/admin/__init__.py | sunshineinwater/flask-Purchase_and_sale | 122 | 12791690 | <filename>app/admin/__init__.py
#-*- coding:utf-8 -*-
# author:Agam
# datetime:2018-11-05
from flask import Blueprint
admin=Blueprint('admin',__name__)
import app.admin.views
| 1.46875 | 1 |
cstorage/tests/listen-gcs.py | sebgoa/triggers | 4 | 12791691 | <filename>cstorage/tests/listen-gcs.py
#!/usr/bin/env python
from google.cloud import pubsub_v1
sub = pubsub_v1.SubscriberClient()
#topic = 'project/skippbox/topics/barfoo'
sub_name = 'projects/skippbox/subscriptions/carogoasub'
subscription = sub.subscribe(sub_name)
def callback(message):
print message
mes... | 2.078125 | 2 |
scripts/irgen.py | srijan-paul/meep | 6 | 12791692 | <gh_stars>1-10
# This is a helper script to automatically generate code
# since Javascript doesn't have enums and using objects as \
# enums is painful.
import re
IR = """
pop_ push_ inc dec
add sub equals
set_var get_var
inc_n false_ true_
load_byte print start_if close_if_body
end_if start_else end_else... | 2.609375 | 3 |
janitor/functions/groupby_agg.py | thatlittleboy/pyjanitor | 225 | 12791693 | from typing import Callable, List, Union
import pandas_flavor as pf
import pandas as pd
from janitor.utils import deprecated_alias
@pf.register_dataframe_method
@deprecated_alias(new_column="new_column_name", agg_column="agg_column_name")
def groupby_agg(
df: pd.DataFrame,
by: Union[List, Callable, str],
... | 3.578125 | 4 |
lambda/build/lambda_start_pipeline.py | acere/amazon-sagemaker-drift-detection | 27 | 12791694 | <gh_stars>10-100
import boto3
from botocore.config import Config
from botocore.exceptions import ClientError
import json
import os
import logging
LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO").upper()
logger = logging.getLogger()
logger.setLevel(LOG_LEVEL)
config = Config(retries={"max_attempts": 10, "mode": "standard"})... | 1.992188 | 2 |
archive/srcKelly/optimizationMooring.py | mattEhall/FloatingSE | 1 | 12791695 | <gh_stars>1-10
from openmdao.main.api import Component, Assembly, convert_units
from openmdao.main.datatypes.api import Float, Array, Enum, Str, Int, Bool
from openmdao.lib.drivers.api import COBYLAdriver, SLSQPdriver
from mooring import Mooring
import time
import numpy as np
class optimizationMooring(Assembly):
#... | 2.0625 | 2 |
OCR.py | developerVictorNkuna/frontend-tools | 0 | 12791696 | import pytesseract
import requests
from PIL import Image
from PIL import ImageFilter
import io
def process_image(url):
image= _get_image(url)
image.filter(ImageFilter.SHARPEN)
return pytesseract.image_to_string(image)
def _get_image(url):
pattern_string = requests.get(url).content()
return Ima... | 2.875 | 3 |
Jasper/Light.py | Granyy/maison_intelligente | 0 | 12791697 | #******************************************************************************#
#* @TITRE : Light.py *#
#* @VERSION : 1.0 *#
#* @CREATION : 05 01, 2017 ... | 2.21875 | 2 |
plots/model_explorer/app_hooks.py | ZviBaratz/pylabber | 3 | 12791698 | <filename>plots/model_explorer/app_hooks.py
from .setup import load_django
def on_server_loaded(server_context):
load_django()
| 1.367188 | 1 |
routely/__init__.py | jhags/routely | 1 | 12791699 | <filename>routely/__init__.py
from .routely import Route | 1.304688 | 1 |
nc/migrations/0035_portfolio_rawportfoliodata.py | kfarrelly/nucleo | 1 | 12791700 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-07-16 15:20
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('nc', '0034_auto_20180710_2209'),
]
... | 1.6875 | 2 |
src/scs_core/sys/modem.py | south-coast-science/scs_core | 3 | 12791701 | """
Created on 24 Mar 2021
@author: <NAME> (<EMAIL>)
Modem
-----
modem.generic.device-identifier : 3f07553c31ce11715037ac16c24ceddcfb6f7a0b
modem.generic.manufacturer : QUALCOMM INCORPORATED
modem.generic.model : QUECTEL Mobile Broadband Module
modem.ge... | 1.1875 | 1 |
build/lib.linux-armv7l-2.7/bibliopixel/drivers/WS2801.py | sethshill/final | 6 | 12791702 | <reponame>sethshill/final<gh_stars>1-10
from spi_driver_base import DriverSPIBase, ChannelOrder
import os
from .. import gamma
class DriverWS2801(DriverSPIBase):
"""Main driver for WS2801 based LED strips on devices like the Raspberry Pi and BeagleBone"""
def __init__(self, num, c_order=ChannelOrder.RGB, use... | 2.640625 | 3 |
migrations/versions/004_Create_User_table.py | LCBRU/batch_demographics | 0 | 12791703 | <gh_stars>0
from sqlalchemy import (
MetaData,
Table,
Column,
Integer,
NVARCHAR,
DateTime,
Boolean,
DateTime,
)
def upgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
user = Table(
"user",
meta,
Column("id", Integer, primary_key=T... | 2.359375 | 2 |
marsDemonstrator/__init__.py | tum-fml/marsDemonstrator | 1 | 12791704 | <reponame>tum-fml/marsDemonstrator
from .designMethods import MARSInput, ENComputation, LoadCollectivePrediction, load_all_gps, InputFileError # noqa: F401
from .main_app import MainApplication, ResultWriter # noqa: F401
__all__ = ["MARSInput", "Computation", "LoadCollectivePrediction", "MainApplication", "ResultWr... | 1.398438 | 1 |
pydnameth/model/tree.py | AaronBlare/pydnameth | 2 | 12791705 | <filename>pydnameth/model/tree.py
from anytree import PostOrderIter
from pydnameth.infrastucture.save.info import save_info
from pydnameth.model.context import Context
import hashlib
from anytree.exporter import JsonExporter
def calc_tree(root):
for node in PostOrderIter(root):
config = node.config
... | 2.375 | 2 |
B3Analyzer/utilities.py | mauromatsudo/brazilian-stocks-analyzer | 0 | 12791706 | <filename>B3Analyzer/utilities.py
from requests import get
from bs4 import BeautifulSoup
import pandas as pd
class Stock:
def __init__(self, ticker):
self._ticker = ticker
self._url = f'https://statusinvest.com.br/acoes/{self._ticker}'
def get_all_indicators(self):
html = get(self._url)... | 3.078125 | 3 |
virtual/bin/django-admin.py | vinnyotach7/insta-photo | 0 | 12791707 | #!/home/moringaschool/Documents/django projects/insta-moringa/virtual/bin/python3.6
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| 1.070313 | 1 |
pelayanan/apps.py | diaksizz/Adisatya | 0 | 12791708 | from django.apps import AppConfig
class PelayananConfig(AppConfig):
name = 'pelayanan'
| 1.171875 | 1 |
dqn_cartpole.py | subinlab/dqn | 1 | 12791709 | import gym
import math
import random
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from collections import namedtuple
from itertools import count
from PIL import Image
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torchvision.transforms as... | 2.640625 | 3 |
src/transposer.py | polifonia-project/harmonic-similarity | 0 | 12791710 | import sys
import os
import re, getopt
key_list = [('A',), ('A#', 'Bb'), ('B', 'Cb'), ('C',), ('C#', 'Db'), ('D',),
('D#', 'Eb'), ('E',), ('F',), ('F#', 'Gb'), ('G',), ('G#', 'Ab')]
sharp_flat = ['#', 'b']
sharp_flat_preferences = {
'A': '#',
'A#': 'b',
'Bb': 'b',
'B': '#',
'C': 'b',
... | 2.828125 | 3 |
web/views/blog.py | aHugues/blog | 0 | 12791711 | <reponame>aHugues/blog
from flask import Blueprint
from flask import render_template
from flask import request
from flask import jsonify
from ..services import ArticlesService
blog_views = Blueprint('blog_views', __name__)
articles_service = ArticlesService()
@blog_views.route('/blog')
def home_page():
articles ... | 2.859375 | 3 |
worker/worker.py | GeorgianBadita/remote-code-execution-engine | 0 | 12791712 | import logging
import subprocess
from typing import Optional
from celery import Celery
from celery.utils.log import get_logger
from code_execution.code_execution import CodeExcution
from utils import generate_random_file
tmp_dir_path = '/worker/tmp'
compiled_dir_path = '/worker/tmp/compiled_files'
# Create the cel... | 2.484375 | 2 |
databroker/databroker.py | EliasKal/ai4eu_pipeline_visualization | 0 | 12791713 | #imports
import haversine as hs
import pandas as pd
import numpy as np
import random
import time
from concurrent import futures
import grpc
import databroker_pb2_grpc
import databroker_pb2
port = 8061
class Databroker(databroker_pb2_grpc.DatabrokerServicer):
def __init__(self):
self.current_row = 0
... | 2.546875 | 3 |
pyrallis/wrappers/dataclass_wrapper.py | eladrich/pyrallis | 22 | 12791714 | <reponame>eladrich/pyrallis<filename>pyrallis/wrappers/dataclass_wrapper.py<gh_stars>10-100
import argparse
import dataclasses
from dataclasses import _MISSING_TYPE
from logging import getLogger
from typing import Dict, List, Optional, Type, Union, cast
from pyrallis.utils import Dataclass
from . import docstring
from... | 2.25 | 2 |
MCMC_plotting.py | jlindsey1/MappingExoplanets | 0 | 12791715 | <reponame>jlindsey1/MappingExoplanets<filename>MCMC_plotting.py
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 15 21:12:41 2017
@author: Jordan
"""
# The following plots several figures from the MCMC. Not all are relevant, but the code has been kept in this single file
# for simplicity.
print "... | 2.34375 | 2 |
src/the_tale/the_tale/finances/shop/relations.py | al-arz/the-tale | 85 | 12791716 |
import smart_imports
smart_imports.all()
INFINIT_PREMIUM_DESCRIPTION = 'Вечная подписка даёт вам все бонусы подписчика на всё время игры.'
class PERMANENT_PURCHASE_TYPE(rels_django.DjangoEnum):
description = rels.Column(unique=False)
might_required = rels.Column(unique=False, single_type=False)
level_... | 1.882813 | 2 |
latextools_utils/is_tex_file.py | MPvHarmelen/MarkdownCiteCompletions | 0 | 12791717 | <filename>latextools_utils/is_tex_file.py
from .settings import get_setting
strbase = str
def get_tex_extensions():
tex_file_exts = get_setting('tex_file_exts', ['.tex'])
return [s.lower() for s in set(tex_file_exts)]
def is_tex_file(file_name):
if not isinstance(file_name, strbase):
raise TypeE... | 2.6875 | 3 |
spasco/main.py | NiklasTiede/spasco | 2 | 12791718 | """spasco - spaces to underscores
==============================
Command line tool for replacing/removing whitespaces or other patterns of file- and directory names.
"""
# Copyright (c) 2021, <NAME>.
# All rights reserved. Distributed under the MIT License.
import argparse
import configparser
import fnmatch
import logg... | 2.703125 | 3 |
pyc_compat.py | jplevyak/pyc | 3 | 12791719 | <reponame>jplevyak/pyc
__pyc_declare__ = None
| 1.054688 | 1 |
flask-proj/manage.py | uninstallHahaha/flask-project | 0 | 12791720 | <filename>flask-proj/manage.py<gh_stars>0
from App import create_app
# 初始化模块
manager = create_app()
if __name__ == '__main__':
manager.run()
| 1.40625 | 1 |
melodyrnn/dataset.py | bfw930/uv-eurovision-ai | 0 | 12791721 |
''' imports '''
# filesystem management
import os
# tensors and nn modules
import torch
# array handling
import numpy as np
# midi file import and parse
from mido import MidiFile
class MelodyDataset(torch.utils.data.Dataset):
''' dataset class for midi files '''
def __init__(self, dir_path: str, cache... | 2.71875 | 3 |
tests/test_pickle_funcs.py | Mishne-Lab/cidan | 2 | 12791722 | from cidan.LSSC.functions.pickle_funcs import *
def test_pickle_funcs():
test_dir = "test_pickle"
pickle_set_dir(test_dir)
if not os.path.isdir(test_dir):
os.mkdir(test_dir)
pickle_clear(trial_num=0)
assert not pickle_exist("test", trial_num=0)
obj = "pickle save"
pickle_save(obj, "t... | 2.5625 | 3 |
libs/redis.py | fightingfish008/tornado-extensions | 5 | 12791723 | <reponame>fightingfish008/tornado-extensions
# -*- coding:utf-8 -*-
import traceback
import logging
import aioredis
from tornado.options import options
class AsyncRedisClient(object):
def __init__(self,loop=None):
self.loop = loop
async def init_pool(self, db=None):
if db is None:
... | 2.234375 | 2 |
errorhandler.py | BenjaminHalko/WiiMusicEditorPlus | 7 | 12791724 | from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QDialog
from errorhandler_ui import Ui_Error
class ShowError(QDialog,Ui_Error):
def __init__(self,error,message,parent=None,geckocode=False):
super().__init__(parent)
self.setWindowFlag(Qt.WindowContextHelpButtonHint,False)
self.setupU... | 2.46875 | 2 |
PyFlow/Packages/PyFlowBase/Nodes/forLoopBegin.py | luzpaz/PyFlow | 1,463 | 12791725 | ## Copyright 2015-2019 <NAME>, <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/licenses/LICENSE-2.0
## Unless required by applicable law or agreed to i... | 2.09375 | 2 |
day23/script1.py | Moremar/advent_of_code_2015 | 0 | 12791726 | import re
class Command:
def __init__(self, name, register, jump_addr=None):
self.name = name
self.register = register
self.jump_addr = jump_addr
class Program:
def __init__(self, commands, registers):
self.commands = commands
self.registers = registers
self.i... | 3.3125 | 3 |
example/paywall/migrations/0002_auto_20200417_2107.py | wuuuduu/django-getpaid | 6 | 12791727 | # Generated by Django 3.0.5 on 2020-04-17 21:07
import uuid
import django_fsm
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("paywall", "0001_initial"),
]
operations = [
migrations.RemoveField(model_name="paymententry", name="payment",... | 1.898438 | 2 |
chemvae/vae_examples.py | amirnikooie/chemical_vae | 0 | 12791728 | from vae_model import *
#======================
""" Creating the VAE object and initializing the instance """
model_DIR = "./aux_files/"
vae = VAE_Model(directory=model_DIR)
print("The VAE object created successfully!")
'''
#============
""" Working with a sample smiles string to reconstruct it and predict its
p... | 2.765625 | 3 |
python/search_in_binary_search_tree.py | anishLearnsToCode/leetcode-algorithms | 17 | 12791729 | # Definition for a binary tree node.
from typing import Optional
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def searchBST(self, root: Optional[TreeNode], val: int) -> Optional[TreeNode]:
... | 3.828125 | 4 |
sdk/python/feast/infra/offline_stores/contrib/postgres_repo_configuration.py | ibnummuhammad/feast | 0 | 12791730 | from feast.infra.offline_stores.contrib.postgres_offline_store.tests.data_source import (
PostgreSQLDataSourceCreator,
)
from tests.integration.feature_repos.integration_test_repo_config import (
IntegrationTestRepoConfig,
)
FULL_REPO_CONFIGS = [
IntegrationTestRepoConfig(
provider="local",
... | 0.921875 | 1 |
mod_arrow_func.py | pfalcon/python-imphook | 22 | 12791731 | <reponame>pfalcon/python-imphook<gh_stars>10-100
# This imphook module implements "arrow functions", similar to JavaScript.
# (a, b) => a + b ---> lambda a, b: a + b
import tokenize
import imphook
class TokBuf:
def __init__(self):
self.tokens = []
def append(self, t):
self.tokens.append... | 2.53125 | 3 |
apps/terreno/admin.py | Ajerhy/proyectosigetebr | 1 | 12791732 | <filename>apps/terreno/admin.py
from django.contrib import admin
from .models import Ubicacion
from .models import Lote
from .models import Manzano
from .models import Medida
from .models import Distrito
"""
class lotesInlines(admin.TabularInline):
model = Manzano.lotes.through
class LoteAdmin(admin.ModelAdmin):
... | 2.015625 | 2 |
preprocessor/constants.py | AhsanAliLodhi/statistical_data_preprocessing | 0 | 12791733 | # TODO: Substitue all strings with constants
# Column types (in context of data science)
TYPE = {
'numerical',
'categorical',
'datetime'
}
# List of date time features available in pandas date time columns
DATE_TIME_FEATURES = {
'NUMERICS':['year', 'month', 'day', 'hour', 'dayofyear', 'weekofyear', 'w... | 3.3125 | 3 |
sim/python/plot_logsim.py | wpisailbot/boat | 4 | 12791734 | <filename>sim/python/plot_logsim.py
#!/usr/bin/python3
import numpy as np
import sys
from matplotlib import pyplot as plt
def norm_theta(theta):
while (theta > np.pi):
theta -= 2 * np.pi
while (theta < -np.pi):
theta += 2 * np.pi
return theta
def plot_vec(d, starti, name, ax, maxy=50):
t = data[:, 0]
... | 3.0625 | 3 |
models/spec_analyse.py | zaqwes8811/voicegen | 0 | 12791735 | <reponame>zaqwes8811/voicegen
#!/usr/bin/python
#-*- coding: utf-8 -*-
import wave as wv
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(0, 5, 0.1);
y = np.sin(x)
plt.plot(x, y) | 2.125 | 2 |
mg/pyguitools/easy_settings.py | mgotz/PyGUITools | 0 | 12791736 | <reponame>mgotz/PyGUITools
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
easily editable settings: wrapper around formlayout
"""
from formlayout import fedit
class EasyEditSettings():
"""a class around formlayout to give easy to use settings
initalized with a list of tuples that specifiy the setting... | 2.953125 | 3 |
Chapter 6/Code/servo_minimum.py | professor-li/book-dow-iot-projects | 17 | 12791737 | <gh_stars>10-100
from gpiozero import Servo
servoPin=17
servoCorrection=0.5
maxPW=(2.0+servoCorrection)/1000
minPW=(1.0-servoCorrection)/1000
servo=Servo(servoPin, min_pulse_width=minPW, max_pulse_width=maxPW)
servo.min() | 2.4375 | 2 |
lang/py/cookbook/v2/source/cb2_20_6_sol_1.py | ch1huizong/learning | 0 | 12791738 | <reponame>ch1huizong/learning
import inspect
def wrapfunc(obj, name, processor, avoid_doublewrap=True):
""" patch obj.<name> so that calling it actually calls, instead,
processor(original_callable, *args, **kwargs)
"""
# get the callable at obj.<name>
call = getattr(obj, name)
# optional... | 3.265625 | 3 |
utils/utils.py | sarrouti/multi-class-text-classification-pytorch | 3 | 12791739 | <filename>utils/utils.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 9 18:56:39 2020
@author: sarroutim2
"""
import torch
import torchtext
import json
class Vocabulary (object):
SYM_PAD = '<pad>' # padding.
SYM_UNK = '<unk>' # Unknown word.
def __init__(self):
... | 3.09375 | 3 |
manage.py | larryTheGeek/ride_my_way_v2 | 0 | 12791740 | <gh_stars>0
import os
from app.app import create_app
from app.models.db import Db
environment = os.getenv('config_name')
app = create_app(environment)
#creates database tables if they don't exist
Db.create_tables()
if __name__ == '__main__':
app.run() | 2.171875 | 2 |
albackup/__main__.py | campenberger/albackup | 0 | 12791741 | <gh_stars>0
import argparse
import logging
import json
import sqlalchemy as sa
from .dump import Dump
from .restore import Restore
from . import Password
if __name__ == '__main__':
parser=argparse.ArgumentParser("python -m albackup")
parser.add_argument('mode',metavar='MODE',choices=('dump','restore','chg-password... | 2.3125 | 2 |
train/utils.py | mcclow12/chatbot | 0 | 12791742 | import random
def utils_min_required():
responses = [
"Sorry, I need your opinion on a movie "\
"before I can give you quality recommendations.",
"Sorry, I don't have enough information yet "\
"to make a good recommendation.",
"I can't give a good recomme... | 3.328125 | 3 |
Phenotyping/Phenotyping.py | lsymuyu/Digital-Plant-Phenotyping-Platform | 10 | 12791743 | '''
The main function to conduct phenotyping experiments
11/09/2017
<NAME>
'''
import os
from adel import AdelR
from adel.geometric_elements import Leaves
from adel.AdelR import R_xydb, R_srdb, genGeoLeaf
import pandas as pd
from adel.plantgen import plantgen_interface
import numpy as np
from adel.astk_interface imp... | 2.078125 | 2 |
cmds/moderations.py | james10949/sijingprogram | 0 | 12791744 | <reponame>james10949/sijingprogram<gh_stars>0
import discord
from discord.ext import commands
from core.classes import Cog_Extension
class Moderations(Cog_Extension):
@commands.command()
async def clean(self, ctx, num : int):
await ctx.channel.purge(limit = num+1)
def setup(bot):
bot.add_cog(Moderations(bot)) | 2.25 | 2 |
padinfo/view_state/otherinfo.py | chasehult/padbot-cogs | 0 | 12791745 | <reponame>chasehult/padbot-cogs<gh_stars>0
from padinfo.pane_names import IdMenuPaneNames
from padinfo.view_state.base_id import ViewStateBaseId
class OtherInfoViewState(ViewStateBaseId):
def serialize(self):
ret = super().serialize()
ret.update({
'pane_type': IdMenuPaneNames.otherinfo... | 2.046875 | 2 |
tests/test_draft.py | edsn60/tensorbay-python-sdk | 0 | 12791746 | <reponame>edsn60/tensorbay-python-sdk
#!/usr/bin/env python3
#
# Copyright 2021 Graviti. Licensed under MIT License.
#
import pytest
from tensorbay.client import GAS
from tensorbay.client.gas import DEFAULT_BRANCH
from tensorbay.client.struct import Draft
from tensorbay.exception import ResourceNotExistError, Respons... | 1.875 | 2 |
ObjDetector_CV.py | JunHong-1998/OpenCV-Scikit-ObjectSizeDetector- | 3 | 12791747 | import cv2
import math
import imutils
import numpy as np
import warnings
from sklearn.cluster import KMeans
from skimage.morphology import *
from skimage.util import *
class OD_CV:
def loadImage(self, filepath):
return cv2.imread(filepath)
def resizeImage(self, image, kar, width, height... | 2.5625 | 3 |
src/vimpdb/proxy.py | dtrckd/vimpdb | 110 | 12791748 | import os
import socket
import subprocess
from vimpdb import config
from vimpdb import errors
def get_eggs_paths():
import vim_bridge
vimpdb_path = config.get_package_path(errors.ReturnCodeError())
vim_bridge_path = config.get_package_path(vim_bridge.bridged)
return (
os.path.dirname(vimpdb_p... | 2.359375 | 2 |
drf_file_management/urls.py | FJLendinez/drf-file-management | 0 | 12791749 | from django.urls import path, include
from rest_framework import routers
from drf_file_management.views import FileAPIView
router = routers.SimpleRouter()
router.register(r'file', FileAPIView)
app_name = 'drf_file_management'
urlpatterns = router.urls
| 1.625 | 2 |
alembic/versions/0aedc36acb3f_upgrade_to_2_0_0.py | goodtiding5/flask-track-usage | 46 | 12791750 | <gh_stars>10-100
"""Upgrade to 2.0.0
Revision ID: <KEY>
Revises: 0<PASSWORD>
Create Date: 2018-04-25 09:39:38.879327
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '0<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade():
... | 1.28125 | 1 |