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 |
|---|---|---|---|---|---|---|
config.py | avilene/mplus.subcreation.net | 0 | 53300 |
# raider.io api configuration
RIO_MAX_PAGE = 5
# need to update in templates/stats_table.html
# need to update in templates/compositions.html
# need to update in templates/navbar.html
RIO_SEASON = "season-sl-3"
WCL_SEASON = 3
WCL_PARTITION = 1
# config
RAID_NAME = "<NAME>"
# for heroic week, set this to 10
# aft... | 1.25 | 1 |
libi2g/log.py | seb36273/email2gotify | 0 | 53301 | # -*- coding: utf8 -*-
import os
import sys
import logging
from logging.handlers import RotatingFileHandler
__all__ = (
'get_logger',
)
LOG_PATH = "/var/log/imap2gotify.log"
__LOG__ = None
def get_logger(path=LOG_PATH):
global __LOG__
if __LOG__ is not None:
return __LOG__... | 2.453125 | 2 |
data_visualization/api_blueprint/categories.py | danielrenes/data-visualization | 0 | 53302 | <reponame>danielrenes/data-visualization
import json
from flask import g, url_for, jsonify, abort, request
from sqlalchemy.exc import IntegrityError
from . import api
from .. import db
from ..models import Category
from ..queries import query_get_category_by_id, query_all_categories
@api.route('/categories', methods... | 2.703125 | 3 |
RoboticsLanguage/Base/Initialise.py | omelinopineda/RoboticsLanguage | 0 | 53303 | <reponame>omelinopineda/RoboticsLanguage<filename>RoboticsLanguage/Base/Initialise.py
# -*- coding: utf-8 -*-
#
# This is the Robotics Language compiler
#
# Default Parameters.py: These are the default parameters that are passed to the compiler
#
# Created on: February 8, 2018
# Author: <NAME>
# Licenc... | 2.375 | 2 |
src/python/stellar_code_function.py | rmcmaho/scd | 0 | 53304 | <filename>src/python/stellar_code_function.py
import decimal
import json
import boto3
import stellar_code.stellar_code as stellar_code
TABLE_STELLAR_SYSTEMS_ = 'stellar_systems'
TABLE_STELLAR_SECTORS_ = 'stellar_sectors'
TABLE_SYSTEM_SEARCHES_ = 'system_searches'
def generate_system_name(req):
if 'proper' in... | 2.125 | 2 |
dearpypixl/appitems/__init__.py | Atlamillias/pixl-engine | 6 | 53305 | __all__ = [
'plotting',
'misc',
'colors',
'tables',
'nodes',
'containers',
'values',
'basic',
'textures',
'drawing',
]
__version__ = '1.1.1'
| 1.054688 | 1 |
main/views.py | suda/warsztat-django | 1 | 53306 | # -*- encoding: utf-8 -*-
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from django.shortcuts import redirect
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.core.paginator import Paginator... | 2.125 | 2 |
parseanno/engine/anno_processor.py | zjZSTU/ParseAnno | 0 | 53307 | # -*- coding: utf-8 -*-
"""
@date: 2020/7/14 下午8:34
@file: anno_processor.py
@author: zj
@description:
"""
import os
import glob
from parseanno.anno import build_anno
from parseanno.utils.logger import setup_logger
class AnnoProcessor(object):
"""
对标注数据进行处理,创建指定格式的训练数据
"""
def __init__(self, cfg)... | 2.0625 | 2 |
components/google-cloud/google_cloud_pipeline_components/container/v1/gcp_launcher/delete_model_remote_runner.py | richardsliu/pipelines | 1 | 53308 | <filename>components/google-cloud/google_cloud_pipeline_components/container/v1/gcp_launcher/delete_model_remote_runner.py
# Copyright 2022 The Kubeflow Authors. 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.
# ... | 2.078125 | 2 |
make.py | khuongduybui/aws_emojipacks | 40 | 53309 | <reponame>khuongduybui/aws_emojipacks
#!/usr/bin/env python
import logging
import os
import shutil
import tempfile
import zipfile
try:
from urllib.parse import urljoin
from urllib.request import urlretrieve
except ImportError:
from urllib import urlretrieve
from urlparse import urljoin
import yaml
fro... | 1.90625 | 2 |
pyActLearn/learning/hmm.py | TinghuiWang/pyActLearn | 3 | 53310 | <reponame>TinghuiWang/pyActLearn<filename>pyActLearn/learning/hmm.py
import pickle
import numpy as np
from hmmlearn.hmm import MultinomialHMM
class HMM:
r"""Hidden Markov Model
This HMM class implements solution of two problems:
# Supervised learning problem
# Decode Problem
Supervised learning:... | 3.453125 | 3 |
views/__init__.py | govle-192-21-2/govle | 0 | 53311 | from flask import Flask
from .calendar import calendar as calendar_blueprint
from .classes import classes as classes_blueprint
from .dashboard import dashboard as dashboard_blueprint
from .index import index as index_blueprint
from .link_google import link_google as link_google_blueprint
from .link_moodle import link_m... | 1.601563 | 2 |
quantified_flu/helpers.py | cjb/quantified-flu | 0 | 53312 | import arrow
from datetime import timedelta
def identify_missing_sources(oh_member):
missing_sources = {"oura": True, "fitbit": True}
# Check data already in Open Humans.
for i in oh_member.list_files():
if i["source"] == "direct-sharing-184" and i["basename"] == "oura-data.json":
mis... | 2.4375 | 2 |
Web_App/views.py | SanjayMarreddi/GameInShape | 11 | 53313 | <reponame>SanjayMarreddi/GameInShape
from django.shortcuts import render, redirect
from django.http.response import StreamingHttpResponse
from Web_App.SetupGame import StartSetup
from Web_App.StartGame import Start
from Web_App.models import BoundingBoxes
from Web_App.Direct_Keys import *
def home(request):
retur... | 2.34375 | 2 |
tests/test_html5writer.py | andredias/rst2html5 | 1 | 53314 | <filename>tests/test_html5writer.py
from io import StringIO
from pathlib import Path
from tempfile import gettempdir
from typing import Any, Dict, Iterable, Tuple
import pytest
from bs4 import BeautifulSoup
from docutils.core import publish_parts
from rst2html5 import HTML5Writer
tmpdir = gettempdir()
TestCase = Tup... | 2.46875 | 2 |
tgt_grease/enterprise/Detectors/regex.py | jairamd22/grease | 44 | 53315 | from tgt_grease.enterprise.Model import Detector
import re
class Regex(Detector):
"""Regular Expression Detector for GREASE Detection
A Typical Regex configuration looks like this::
{
...
'logic': {
'Regex': [
{
'fie... | 3.03125 | 3 |
Classifier/preprocess/contrast_enhansement.py | withanageyasiru/diabetic-retinopathy-detection | 0 | 53316 | <reponame>withanageyasiru/diabetic-retinopathy-detection<gh_stars>0
import cv2
def contrast_enhancement(images):
'''
:param images:
:return:
creating a Histograms Equalization
of a image using cv2.equalizeHist()
'''
clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8, 8))
for i in... | 2.796875 | 3 |
news_analyzer/tests/test_article_recommender.py | heybaebae/news-articles-nlp | 2 | 53317 | <reponame>heybaebae/news-articles-nlp
"""This module does unittest on the functions in article_recommender
Classes:
TestArticleRecommender: A class of functions to perform
unit test for article_recommender
Functions:
test_knn_dimension: A function that checks KDTree
returns 5 indexes to join to corpus... | 3.1875 | 3 |
examples/timesegment_matching_utils.py | agramfort/multiviewica | 0 | 53318 | <filename>examples/timesegment_matching_utils.py
# Authors: <NAME>, <NAME>
# License: BSD 3 clause
import numpy as np
import scipy.stats as stats
def time_segment_matching(
data, win_size=10,
):
"""
Performs time segment matching experiment
(code inspired from brainiak tutorials at
https://braini... | 2.8125 | 3 |
lecture05_scientific_netcdf.py | cgalli/ATMOS_6910_2018 | 2 | 53319 | <filename>lecture05_scientific_netcdf.py
import numpy as np
from netCDF4 import Dataset
import matplotlib.pyplot as plt
import h5py
#from pyhdf.SD import SD,SDC
nc_f='/uufs/chpc.utah.edu/common/home/mace-group3/arm/grw/grwvceil25kM1.b1/2010/grwvceil25kM1.b1.20100828.000008.cdf'
nc_fid=Dataset(nc_f,'r')
print nc_fid.fi... | 2.359375 | 2 |
tests/unit/dev_support.py | CCI-MOC/hil | 23 | 53320 | <reponame>CCI-MOC/hil<gh_stars>10-100
"""Test the hil.dev_support module."""
from hil.dev_support import no_dry_run
import pytest
from hil.test_common import fail_on_log_warnings, config_merge
fail_on_log_warnings = pytest.fixture(autouse=True)(fail_on_log_warnings)
# We test two ways of using the decorator: applyi... | 2.21875 | 2 |
python/integrations/hamcrest.py | google/checkers_classic | 6 | 53321 | <reponame>google/checkers_classic<gh_stars>1-10
# Copyright 2015 Google Inc. 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/LICENS... | 2.03125 | 2 |
bleak_ex/BLEdiscover04.py | vhzkflrjf/pythonStudy | 0 | 53322 | import asyncio
from bleak import BleakScanner
def detection_callback(*args):
print(args)
async def run():
scanner = BleakScanner()
scanner.register_detection_callback(detection_callback)
await scanner.start()
await asyncio.sleep(2.0)
await scanner.stop()
devices = await scanner.get_discove... | 2.984375 | 3 |
perrot/plot/labels.py | labqui/perrot | 0 | 53323 | # Created byMartin.cz
# Copyright (c) <NAME>. All rights reserved.
from pero.properties import *
from pero import Label, LabelBox
from . graphics import InGraphics
class Labels(InGraphics):
"""
Labels container provides a simple tool to draw all given labels at once in
the order defined by their 'z_in... | 3.125 | 3 |
hyperparam_optim_mask_rcnn.py | branislav1991/MicroscopyUNet | 1 | 53324 | <gh_stars>1-10
import os
from sys import float_info
from hyperopt import fmin, tpe, hp
from train_mask_rcnn import train_mask_rcnn, CHECKPOINT_DIR
import pickle
import math
from keras import backend as K
train_path="./data/stage1_train/"
val_path="./data/stage1_val/"
train_ids = next(os.walk(train_path))
... | 2.078125 | 2 |
users/models.py | arianmotti/story-contest | 3 | 53325 | <reponame>arianmotti/story-contest<filename>users/models.py<gh_stars>1-10
from django.db import models
from django.contrib.auth.models import User
from PIL import Image
from django.core.files.storage import default_storage
class Profile(models.Model):
user = models.OneToOneField(User , on_delete = models.CASCADE)
... | 2.4375 | 2 |
Compilation star patterns.py | Ranjul-Arumadi/Coding-Problems | 0 | 53326 | '''
Q: Popular star patterns
Pattern 1:
*
**
***
****
*****
******
Pattern 2:
* * * * * *
* * * * *
* * * *
* * *
* *
*
Pattern 3:
*
***
*****
*******
*********
Pattern 4:
*
... | 4.125 | 4 |
Tests/benchmarks/bench_microbenchmarks.py | AlexWaygood/Pyjion | 0 | 53327 | import pyjion
import timeit
from statistics import fmean
def test_floats(n=10000):
for y in range(n):
x = 0.1
z = y * y + x - y
x *= z
def test_ints(n=10000):
for y in range(n):
x = 2
z = y * y + x - y
x *= z
if __name__ == "__main__":
tests = (test_floa... | 3 | 3 |
curvefitgui/_gui.py | moosepy/curvefitgui | 0 | 53328 | # import the required packages
import warnings
import sys
from scipy.optimize import OptimizeWarning
from PyQt5 import QtCore, QtWidgets
from ._tools import Fitter, value_to_string
from ._widgets import PlotWidget, ModelWidget, ReportWidget
from ._settings import settings
from ._version import __version__ as CFGversio... | 2.40625 | 2 |
server/server.py | JohnRobards/Chaos | 0 | 53329 | import http.server
import socketserver
import socket
#set the process name to "chaos_server" so we can easily kill it with "pkill chaos_server"
def set_proc_name(newname):
from ctypes import cdll, byref, create_string_buffer
libc = cdll.LoadLibrary('libc.so.6')
buff = create_string_buffer(len(newname)+1)
... | 2.84375 | 3 |
tests/test_errors.py | ootiq/smax | 0 | 53330 | <reponame>ootiq/smax<gh_stars>0
import pytest
from smaxpy import Smax
from smaxpy.errors import RequestError
# test error handling
def test_error_handling():
with pytest.raises(RequestError):
_ = Smax("nonexistentwebsite")
| 2.078125 | 2 |
api/migrations/0003_data_type.py | ajmaln/kerala-university-api | 0 | 53331 | <filename>api/migrations/0003_data_type.py<gh_stars>0
# Generated by Django 2.1.1 on 2018-09-07 04:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0002_auto_20180906_1708'),
]
operations = [
migrations.AddField(
mo... | 1.609375 | 2 |
Domotique/Temperature Fablab/temperature.py | LaFabrickMassy/Projet-Fablab | 0 | 53332 | import board
import adafruit_ahtx0
from datetime import datetime
html_dir = "/var/www/html/temp"
data_fname = "temperature.csv"
html_fname = "index.html"
sensor = adafruit_ahtx0.AHTx0(board.I2C())
temp = sensor.temperature
hum = sensor.relative_humidity
now = datetime.now()
# open data file
history = []
with open... | 2.75 | 3 |
modules/experiment/tests/test_autoencoder.py | avogel88/compare-VAE-GAE | 0 | 53333 | <reponame>avogel88/compare-VAE-GAE
import numpy as np
from numpy.testing import (assert_array_equal, assert_almost_equal,
assert_array_almost_equal, assert_equal, assert_)
from pathlib import Path
from modules.experiment.autoencoder import file_basename, ckpt_nr
def test_filebasename():
... | 2.34375 | 2 |
src/utils/util.py | ashishpapanai/IMGprove | 0 | 53334 | <filename>src/utils/util.py
import tensorflow as tf
from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
#os.environ["TFHUB_DOWNLOAD_PROGRESS"] = "True"
class utils:
def preprocess_image(image_path):
hr_image = tf.image.decode_image(tf.io.read_file(image_path))
if hr_image.shape... | 2.78125 | 3 |
12_misc-semantic-code/hello_all.py | abdullahzameek/politics-of-code | 21 | 53335 | <filename>12_misc-semantic-code/hello_all.py<gh_stars>10-100
#!/usr/bin/python
#<NAME>, 2013
import iptools, httplib
for ip in iptools.IpRangeList('0.0.0.0/0'):
try:
print "Greeting " + ip
cx = httplib.HTTPConnection("%s:80" % ip)
cx.request("POST", '/', "message=Hello+world!")
except:
pass
| 2.296875 | 2 |
src/gitvcs/repository.py | Stdubic/Track | 1 | 53336 | <filename>src/gitvcs/repository.py
import json
from time import mktime
import time
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.utils import timezone
from django.utils.datetime_safe import datetime
from git.objects.commit import Commit
from gitvcs impo... | 2.015625 | 2 |
psm/lake/lake_driver.py | amoodie/PRYSM | 21 | 53337 | <gh_stars>10-100
#======================================================================
# <NAME>
# Modified 03/08/16 <<EMAIL>>
# Modified 04/02/18 <<EMAIL>>
# Script to run lake sediment proxy system model
#======================================================================
# PRYSM v2.0 Lake Sediments, DRIVER SCRI... | 2.234375 | 2 |
batchgenerators/utilities/file_and_folder_operations.py | Paddy-Xu/batchgenerators | 2 | 53338 | import os
import pickle
import json
from typing import List
def subdirs(folder: str, join: bool = True, prefix: str = None, suffix: str = None, sort: bool = True) -> List[str]:
if join:
l = os.path.join
else:
l = lambda x, y: y
res = [l(folder, i) for i in os.listdir(folder) if os.path.isd... | 2.890625 | 3 |
spin_tensor.py | gicheonkang/pyTorch-101 | 2 | 53339 | import torch
from torch.autograd import Variable
batch_size = 100
row_lenth = 10
col_length = 10
if __name__ == '__main__':
a = Variable(torch.randn((batch_size, row_lenth, col_length)))
b = Variable(torch.randn((batch_size, row_lenth, col_length)))
c = Variable(torch.randn((batch_size, row_lenth, col_length)))
s... | 2.734375 | 3 |
pdf/imgtopdf.py | VoshVolk/public_python | 1 | 53340 | <filename>pdf/imgtopdf.py
import sys
import os
import glob
import tempfile
import shutil
import argparse
import img2pdf
from natsort import natsorted
import cv2
def create_parser():
parser = argparse.ArgumentParser()
parser.add_argument(
"source",
type=str,
help="This is pdf source fil... | 3.140625 | 3 |
UE4Parse/Provider/Vfs/AbstractVfsFileProvider.py | zbx911/pyUE4Parse | 0 | 53341 | <reponame>zbx911/pyUE4Parse<filename>UE4Parse/Provider/Vfs/AbstractVfsFileProvider.py
from UE4Parse.Assets.Exports.UObjects import UObject
from UE4Parse.Assets.PackageReader import Package
from UE4Parse.BinaryReader import BinaryStream
from UE4Parse.Provider.Vfs.DirectoryStorageProvider import DirectoryStorageProvider
... | 2.03125 | 2 |
scheduler.py | beepscore/remy_python | 13 | 53342 | <filename>scheduler.py<gh_stars>10-100
#!/usr/bin/env/python3
# Potential alternatives:
# Use cron, available on Raspberry Pi Raspbian Linux don't need to worry about Windows
# flask-apscheduler adds support for flask context but I think that's not needed here
# https://apscheduler.readthedocs.io/en/latest/userguide.h... | 2.59375 | 3 |
app/core/tests/test_models.py | dumrich/profiles-rest-api | 0 | 53343 | from django.test import TestCase
from django.contrib.auth import get_user_model
from unittest.mock import patch
from core import models
class ModelTests(TestCase):
"""Test the core models"""
def test_create_user_with_email(self):
"""Create User with email"""
email = "<EMAIL>"
passwor... | 3 | 3 |
src/gluonts/nursery/tsbench/src/tsbench/evaluations/training/fit.py | RingoIngo/gluon-ts | 1 | 53344 | <reponame>RingoIngo/gluon-ts
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICEN... | 1.90625 | 2 |
hilltoppy/tests/test_web_service.py | mullenkamp/hilltoppy | 7 | 53345 | # -*- coding: utf-8 -*-
"""
Created on Wed May 30 12:05:46 2018
@author: MichaelEK
"""
import pytest
import numpy as np
from hilltoppy.web_service import measurement_list, site_list, collection_list, get_data, wq_sample_parameter_list
### Parameters
test_data1 = dict(
base_url = 'http://data.ecan.govt.nz/',
... | 2.4375 | 2 |
POP1/assignment-three/sudoku.py | silvafj/BBK-MSCCS-2017-18 | 1 | 53346 | <filename>POP1/assignment-three/sudoku.py
"""
Author: <NAME> <fdealm02>
This program can be used to solve sudoku puzzles, giving the user a full or
partial (in case of more complex problems) solutions.
"""
def read_sudoku(file_name):
"""
Reads a file and returns a two-dimensional list of integers.
:param... | 4.28125 | 4 |
StockExcahnge_Daily_Process2.py | waditya/Miscellaneous | 0 | 53347 | ##Author : <NAME>
##Date : 9/24/2017
import csv
import sys
import operator
from xml.etree.ElementTree import ElementTree
from xml.etree.ElementTree import Element
import xml.etree.ElementTree as etree
from docutils.writers.odf_odt import ToString
from _elementtree import SubElement
from sqlalchemy.sql.expression import... | 2.640625 | 3 |
boa3_test/test_sc/interop_test/runtime/InvocationCounterCantAssign.py | hal0x2328/neo3-boa | 25 | 53348 | from boa3.builtin.interop.runtime import invocation_counter
def Main(example: int) -> int:
invocation_counter = example
return invocation_counter
| 1.6875 | 2 |
get_states_per_metatile.py | lee-vivian/platformer | 2 | 53349 | <reponame>lee-vivian/platformer
"""
Returns a map of the states associated with each metatile for a given level {metatile_str : {state_coord: 1}}
"""
import argparse
import networkx as nx
from datetime import datetime
from utils import read_pickle, write_pickle, get_filepath
def get_metatile_num_states_stats(metati... | 3.078125 | 3 |
datasets/san_francisco_bikeshare/_images/bikeshare_station_info/csv_transform.py | renovate-bot/public-datasets-pipelines | 90 | 53350 | <filename>datasets/san_francisco_bikeshare/_images/bikeshare_station_info/csv_transform.py<gh_stars>10-100
# Copyright 2021 Google LLC
#
# 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
#
# ... | 2.71875 | 3 |
ScriptGeneratorPython/generateScript.py | JakeChapeskie/MyoScripts | 4 | 53351 | #Generates Scripts for Myo
#<NAME>
#2014
import argparse
DEBUG_MODE=False #Set to true for extra print outputs
def debugPrint(s):
if DEBUG_MODE==True:
print(s)
return
def keyTwoMyo(key):
#TODO: Add special character parsing
str='myo.keyboard("'+key+'","press")'
return str
# parse Command Line inputs
parser = a... | 3.015625 | 3 |
scripts/generate_csv_from_json.py | henrykrumb/kvasir-capsule | 10 | 53352 | import json
import glob
import os
import argparse
import time
_DEFAULT_DATASET_DIR_PATH = "D:\\Documents\\output_vvs_2020\\labeled"
_DEFAULT_METADATA_PATH = "C:\\Users\\Steven\\github\\kvasir-capsule\\metadata.json"
_DEFAULT_WORK_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")
_ANATOMY_CLASSES =... | 2.40625 | 2 |
monai/data/png_writer.py | fabrizzioalco/MONAI | 0 | 53353 | <reponame>fabrizzioalco/MONAI
# Copyright 2020 MONAI Consortium
# 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 ... | 2.609375 | 3 |
Solve by myself/remove_element.py | NazarPonochevnyi/LeetCode | 1 | 53354 | <reponame>NazarPonochevnyi/LeetCode<filename>Solve by myself/remove_element.py<gh_stars>1-10
# 27. Remove Element
# Python 3
# https://leetcode.com/problems/remove-element
def removeElement(nums, val):
"""
:type nums: List[int]
:type val: int
:rtype: int
"""
nums[:] = [num for num in n... | 3.890625 | 4 |
src/data_split.py | futu-munich-racing/neural-network-trainer | 0 | 53355 | <filename>src/data_split.py
import sys
import argparse
import logging
from utils import fileio
from utils import model_selection
def parse_input_arguments(argv):
parser = argparse.ArgumentParser()
parser.add_argument("-inputdir", type=str)
parser.add_argument("-outputdir", type=str)
parser.add_argume... | 2.859375 | 3 |
talk/views/oj.py | PUANEY/OnlineJudge | 0 | 53356 | <filename>talk/views/oj.py
from ..serializers import TalkSerializers, TalkCommentSerializers
from ..models import TalkModel, TalkCommentModel
from utils.api import APIView
from account.decorators import admin_role_required
# from notification.models import NotifyModel
class TalkAPI(APIView):
"""
讨论区帖子api
... | 2.28125 | 2 |
web/app/admin/__init__.py | hdknr/django-books | 0 | 53357 | <gh_stars>0
from django.contrib import admin
from django.apps import apps
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import Permission, ContentType
from django.template import Template, Context
def render(src, request=None, **kwargs):
return Template(src).render(Contex... | 1.921875 | 2 |
website/views/GenomeTableAjax.py | blumeria/opengenomebrowser | 0 | 53358 | from django_datatables_view.base_datatable_view import BaseDatatableView
from django.db.models import Q
from django.contrib.postgres.aggregates.general import ArrayAgg
from website.models import Genome
class GenomeTableAjax(BaseDatatableView):
# The model we're going to show
model = Genome
# set max limi... | 2.53125 | 3 |
AmazonBot/plugins/channels.py | cusci/AmazonOffers-Manager | 9 | 53359 | from pyrogram import Client, Filters, InlineKeyboardButton, InlineKeyboardMarkup
from .antiflood import BANNED_USERS
from ..database import querymanager
from pyrogram.errors import FloodWait, exceptions
import logging
import time
import re
from base64 import b64encode as b64enc
from base64 import b64decode as b64dec
im... | 2.21875 | 2 |
components/Actuators/HighLevel/driveTrainHandler.py | Raptacon/Robot-2022 | 4 | 53360 | <filename>components/Actuators/HighLevel/driveTrainHandler.py
import logging as log
from magicbot import AutonomousStateMachine, MagicRobot
from components.Actuators.LowLevel.driveTrain import DriveTrain, ControlMode
class DriveTrainHandler():
"""
This class is how we're going to control the drivetrain
... | 2.90625 | 3 |
docs/examples/data-completeness.py | kperrynrel/pvanalytics | 0 | 53361 | <reponame>kperrynrel/pvanalytics<filename>docs/examples/data-completeness.py<gh_stars>0
"""
Missing Data Periods
====================
Identifying days with missing data using a "completeness" score metric.
"""
# %%
# Identifying days with missing data and filtering these days out reduces noise
# when performing data ... | 3.0625 | 3 |
tests/integration/test_database/test_model/test_file_type.py | refitt/ref | 4 | 53362 | # SPDX-FileCopyrightText: 2019-2021 REFITT Team
# SPDX-License-Identifier: Apache-2.0
"""Database file_type model integration tests."""
# external libs
import pytest
from sqlalchemy.exc import IntegrityError
# internal libs
from refitt.database.model import FileType, NotFound
from tests.integration.test_database.te... | 2.28125 | 2 |
lampip/core/package.py | hayashiya18/lampip | 1 | 53363 | import os
import os.path as op
import shutil
import sys
from datetime import datetime
from tempfile import TemporaryDirectory
import boto3
import sh
from termcolor import cprint
from .cloudformation import get_cf_resources
from .config import Config
def _docker(*args):
cprint("$", "red", end=" ")
cprint("do... | 1.976563 | 2 |
NLP programmes in Python/5. Information Extraction/NP chunking (NER)/NP chunking (NER).py | AlexandrosPlessias/NLP-Greek-Presentations | 0 | 53364 | <reponame>AlexandrosPlessias/NLP-Greek-Presentations<gh_stars>0
# NP chunking (NER)
import nltk
f=open("sample.txt")
text=f.read()
sentences = nltk.sent_tokenize(text)
tokenized_sentences = [nltk.word_tokenize(sentence) for sentence in sentences]
tagged_sentences = [nltk.pos_tag(sentence) for sentence in tokeni... | 3.09375 | 3 |
gesund_projekt/pomodoros/views.py | asis2016/gesund-projekt | 0 | 53365 | <gh_stars>0
#
#
# This django app is not completed.
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse_lazy
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.views.generic import ListView
from .models import Pomodoro
class PomodoroListView(L... | 2.109375 | 2 |
test/linear/ex1.py | taowu750/wtml | 0 | 53366 | <filename>test/linear/ex1.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
在整个练习中,您将使用脚本ex1.py和ex1 multi.py。
这些脚本为问题设置数据集并调用要编写的函数。你不需要修改它们中的任何一个。您只需要按照此分配中
的说明修改其他文件中的函数。对于这个编程练习,您只需要完成练习的第一部分,就可以用一个变量
实现线性回归。练习的第二部分是可选的,包括多变量线性回归。
假设你是一家连锁餐厅的首席执行官,正在考虑在不同的城市开设一家新的分店。这家连锁店在各个城市
都有卡车,你有数据显示城市的利润和人口。您希望使用此数据帮助您选择... | 3.09375 | 3 |
visionlib/object/detection/__init__.py | sumeshmn/Visionlib | 46 | 53367 | <filename>visionlib/object/detection/__init__.py<gh_stars>10-100
from .detection import ODetection
| 1.179688 | 1 |
examples/models1.py | weatherhead99/symdiff | 8 | 53368 | from symdiff import *
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
print(symdiff('declare_model(x)'))
print(symdiff('define_model(y, a*x)'))
print(symdiff('diff(y, x)'))
print(symdiff('clear_model(x)'))
print(ordered_list('y'))
print(symdiff('declare_model(x)')... | 2.796875 | 3 |
docs/tutorial/python/sanic/users_if.py | mrpotes/go-raml | 142 | 53369 | <reponame>mrpotes/go-raml
# DO NOT EDIT THIS FILE. This file will be overwritten when re-running go-raml.
from sanic import Blueprint
from sanic.views import HTTPMethodView
from sanic.response import text
from . import users_api
from .oauth2_itsyouonline import oauth2_itsyouonline
users_if = Blueprint('users_if')
... | 1.898438 | 2 |
post/coldJet/uvelScatter.py | BYUignite/ODT | 6 | 53370 | <filename>post/coldJet/uvelScatter.py
#plots scatter plot of u-velocity vs. position at specified dmp time for a single case
#or, plots a group of 4 scatter plots of u-velocity vs. position at 4 specified dmp times for a single case (easier to compare different dmp times, but each subplot lower quality)
#plot file dire... | 2.359375 | 2 |
scripts/cleanup.py | felis/kicad-schlib | 38 | 53371 | #!/usr/bin/python3
import os
import subprocess
import sys
md5sums = {}
dirname = sys.argv[1]
for fn in os.listdir(dirname):
md5sum = subprocess.check_output(['md5sum', os.path.join(dirname, fn)]).decode('ascii').partition(" ")[0]
if md5sum in md5sums:
# This blob already exists. Symlink it
o... | 2.53125 | 3 |
clyther/rttt.py | srossross/Clyther | 17 | 53372 | '''
clyther.rttt
--------------------
Run Time Type Tree (rttt)
'''
from clast import cast
from clyther.pybuiltins import builtin_map
from inspect import isroutine, isclass, isfunction
from meta.asttools.visitors import visit_children, Mutator
from meta.asttools.visitors.print_visitor import print_ast
from opencl im... | 2.546875 | 3 |
tdd3/lib/python3.7/hmac.py | yjj2100/flask-microservices-users | 0 | 53373 | /usr/local/python3/lib/python3.7/hmac.py | 1.179688 | 1 |
stability_label_algorithm/modules/dataset_generator/dataset.py | DaphneO/stabilitylabelalgorithm | 0 | 53374 | from typing import List
from stability_label_algorithm.modules.dataset_generator.dataset_item import DatasetItem
class Dataset:
def __init__(self, name: str, argumentation_system_name: str, dataset_items: List[DatasetItem]):
"""
A Dataset has a name, the name of its ArgumentationSystem and a list... | 3.125 | 3 |
tests/test_version_agreement.py | yakutovicha/aiida-raspa | 7 | 53375 | # -*- coding: utf-8 -*-
"""Check versions"""
import sys
import json
import aiida_raspa
def test_version_agreement():
"""Check if versions in setup.json and in plugin are consistent"""
version1 = aiida_raspa.__version__
with open("setup.json") as fhandle:
version2 = json.load(fhandle)['version']
... | 2.5 | 2 |
example/urls.py | bennylope/django-shop | 1 | 53376 | <reponame>bennylope/django-shop<filename>example/urls.py
from django.conf.urls.defaults import *
from shop.views import ShopTemplateView
from shop import urls as shop_urls
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Exampl... | 1.835938 | 2 |
aser/conceptualize/utils.py | ZfSangkuan/ASER | 256 | 53377 | from collections import defaultdict
from copy import copy, deepcopy
from tqdm import tqdm
from ..eventuality import Eventuality
from ..relation import Relation
def conceptualize_eventualities(aser_conceptualizer, eventualities):
""" Conceptualize eventualities by an ASER conceptualizer
:param aser_conceptual... | 2.71875 | 3 |
main.sikuli/main.py | JonsonChang/baidu_netdisk_free_trial | 0 | 53378 | <gh_stars>0
import datetime
while 1:
doubleClick("1547277479115.png")
if exists(Pattern("download_list.png").similar(0.80), 15):
click("download_list.png")
if exists(Pattern("start_all.png").similar(0.80), 5):
click("start_all.png")
starttime = time.time()
endtime = time.time()
#for x in range(100/3... | 2.796875 | 3 |
python/multiprocessing_multithreading/basic_asyncio.py | rcanepa/cs-fundamentals | 0 | 53379 | <gh_stars>0
import asyncio
import datetime
import random
async def my_sleep_func(who_is_sleeping):
sleep_time = random.randint(0, 5)
print("\t-> Loop {} is going to sleep for {} seconds".format(who_is_sleeping, sleep_time))
await asyncio.sleep(sleep_time)
async def display_date(num, loop):
end_time ... | 3.328125 | 3 |
drf_tools/validation/base.py | seebass/drf-toolbox | 5 | 53380 | from abc import ABCMeta, abstractmethod
from django_tooling.exceptions import ValidationError
class FailedValidation():
def __init__(self, code, details, msg):
self.code = code
self.details = details
self.msg = msg
if msg and details:
self.msg = msg.format(**details)
... | 2.984375 | 3 |
osr/apps/registry/migrations/0006_auto_20191029_2325.py | offurface/osr | 0 | 53381 | # Generated by Django 2.2.6 on 2019-10-29 20:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('registry', '0005_auto_20191029_2312'),
]
operations = [
migrations.AlterField(
model_name='primary',
name='recommend... | 1.359375 | 1 |
src/values/locators.py | Jorge644/python-fravega-test | 0 | 53382 | from selenium.webdriver.common.by import By
search_locator = (By.XPATH , "//input[@placeholder='Buscar productos']")
search_button_locator = (By.CSS_SELECTOR , "button[class*='InputBar']")
all_brands_locator = (By.XPATH, "//li[@name='brandsFilter'] //a[text()='Ver todas']")
find_specify_brand_locator = (By.XPATH, "//d... | 2.75 | 3 |
src/util.py | jnxyp/NetInspectionHelper | 3 | 53383 | from config import DEBUG
def read_file(path: str) -> list:
with open(path, encoding='utf8') as file:
return file.readlines()
def p(s: str):
if (DEBUG):
print(s)
| 3.0625 | 3 |
imposc/test/test_main.py | FelixDux/imposcr | 0 | 53384 | from fastapi.testclient import TestClient
import pytest
from main import app
client = TestClient(app)
def get_response_for_test(path):
response = client.get(path)
return response.json(), response.status_code
def post_response_for_test(path, input_json):
response = client.post(path, json=input_json)... | 2.453125 | 2 |
python/ray/experimental/data/deltacat/utils/pyarrow.py | goswamig/amazon-ray | 0 | 53385 | <reponame>goswamig/amazon-ray
import pyarrow as pa
import gzip
import bz2
import io
import logging
from typing import Any, Callable, Dict, List, Optional
from fsspec import AbstractFileSystem
from pyarrow import feather as paf, parquet as papq, csv as pacsv, \
json as pajson
from ray.experimental.data.deltacat impo... | 1.953125 | 2 |
analysis/data.py | elv-youliangyu/youtube8m_v3 | 18 | 53386 | <gh_stars>10-100
import tensorflow as tf
import os
import json
class Youtube8M:
dream_segment_folder = "/media/linrongc/dream/data/yt8m/frame/3/"
dream_frame_folder = "/media/linrongc/dream/data/yt8m/frame/2/"
dream_strat_segment_folder = dream_segment_folder + "validate_strat_split/"
fast_segment_fo... | 2.5625 | 3 |
ecosante/utils/cache.py | betagouv/recosante-api | 3 | 53387 | <gh_stars>1-10
from contextlib import contextmanager
import time
from ecosante.extensions import cache
@contextmanager
def cache_lock(lock_id, oid):
LOCK_EXPIRE = 60 * 60
timeout_at = time.monotonic() + LOCK_EXPIRE - 180
status = cache.add(lock_id, oid, LOCK_EXPIRE)
try:
yield status
finall... | 2.40625 | 2 |
erebus/guild.py | ToxicKidz/discord-api-py | 0 | 53388 | <reponame>ToxicKidz/discord-api-py
class Guild:
__slots__ = ('id', 'name', 'icon', 'owner', 'client_is_owner', 'permissions', 'region', 'afk_channel',
'afk_timeout', 'verification_level', 'roles', 'emojis', 'system_channel', 'features',
'mfa_level', 'created', 'large', 'member_count'... | 2.28125 | 2 |
data.py | cmlohr/py-quiz-game | 0 | 53389 | <gh_stars>0
q_data = [
{"question": "Japan was part of the Allied Powers during World War I.", "correct_answer": "True",
"incorrect_answers": ["False"]}, {"category": "History", "type": "boolean", "difficulty": "easy",
"question": "The Tiananmen Square protests of 1989 we... | 2.078125 | 2 |
build/lib/Fittness/calories_burn/monitoring.py | RaineShen/data533Lab4 | 0 | 53390 | <reponame>RaineShen/data533Lab4
import pygal
from Fittness.calories_burn import records
from IPython.display import SVG, display
class Monitoring(records.Records):
"""
Aim to monitory the daily changes of weight and burned calories
"""
def __init__(self,name,gender,age,height,weight,calories):
... | 3.109375 | 3 |
figure_forward_model.py | milutter/DeepLagrangianNeuralNetworks | 0 | 53391 | import argparse
import sys
import optax
import torch
import numpy as np
import time
import jax
import jax.numpy as jnp
import matplotlib as mp
import haiku as hk
import dill as pickle
try:
mp.use("Qt5Agg")
mp.rc('text', usetex=True)
mp.rcParams['text.latex.preamble'] = [r"\usepackage{amsmath}"]
import... | 1.851563 | 2 |
exercises/005_Tuplas/tuple_002.py | Kike-Ramirez/intro-py-td | 0 | 53392 | # Python INTRO for TD Users
# <NAME>
# May, 2018
# Understanding Tuples
# Tuples comparison
#case 1
a=(5,6)
b=(1,4)
if (a>b):print("a is bigger")
else: print("b is bigger")
#case 2
a=(5,6)
b=(5,4)
if (a>b):print("a is bigger")
else: print ("b is bigger")
#case 3
a=(5,6)
b=(6,4)
if (a>b):print("a is bigger")
else: ... | 4.125 | 4 |
meraki/run.py | storybook808/Meraki-Bulk-Configuration-Tool | 1 | 53393 | #!flask/bi.python
from app import app
app.run(debug = True)
| 1.195313 | 1 |
llcv/datasets/coco.py | mtli/llcv | 1 | 53394 | <filename>llcv/datasets/coco.py<gh_stars>1-10
from os.path import join
from PIL import Image
import torch
torch.multiprocessing.set_sharing_strategy('file_system')
from torch.utils.data import Dataset
from torchvision import transforms as tv_transforms
from pycocotools.coco import COCO
class COCODatase... | 2.40625 | 2 |
scripts/uda_common.py | tmills/uda | 0 | 53395 | #!/usr/bin/env python
import numpy as np
import scipy.sparse
from sklearn import svm
from sklearn.metrics import f1_score, recall_score, precision_score, accuracy_score, make_scorer
from sklearn.model_selection import cross_val_score
def zero_pivot_columns(matrix, pivots):
matrix_lil = scipy.sparse.lil_matrix(matr... | 2.578125 | 3 |
transformer/__init__.py | DreamInvoker/attention-is-all-you-need-pytorch | 0 | 53396 | <filename>transformer/__init__.py
import transformer.Beam
import transformer.Constants
import transformer.Layers
import transformer.Models
import transformer.Modules
import transformer.Optim
import transformer.SubLayers
import transformer.Translator
__all__ = [
transformer.Constants, transformer.Modules, transform... | 1.039063 | 1 |
fairseq/tasks/translation_marian.py | Csinclair0/fairseq | 0 | 53397 | <filename>fairseq/tasks/translation_marian.py<gh_stars>0
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
from fairseq.data import (
TokenizerDictionary,
)
from ... | 1.789063 | 2 |
scripts/blast2nrheaders.py | mcsimenc/PhyLTR | 11 | 53398 | <reponame>mcsimenc/PhyLTR
#!/usr/bin/env python3
import sys
def help():
print('''
usage:
blast2nrheaders.py -nr <path> -blast <path> -min_pid <int|float>
-nr Path to nr
-blast Path to blast results
-min_pid Minimum percent id to include in output. default 60.0
''', file=sys.stderr)
args = sys.argv
... | 2.703125 | 3 |
src/main.py | Morteza-Haghshenas/SEAL-CI | 1 | 53399 | """Training a SEAL-CI model."""
import torch
from utils import tab_printer
from seal import SEALCITrainer
from param_parser import parameter_parser
def main():
"""
Parsing command line parameters, reading data.
Fitting and scoring a SEAL-CI model.
"""
args = parameter_parser()
tab_printer(args... | 2.328125 | 2 |