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 |
|---|---|---|---|---|---|---|
akatsuki/thanos/views.py | raun/vigilant-system | 0 | 12775951 | <reponame>raun/vigilant-system
from thanos import models, serializers
from rest_framework import generics, mixins
# Create your views here.
class FeatureRequestsListAll(generics.ListAPIView):
queryset = models.FeatureRequest.objects.all()
serializer_class = serializers.FeatureRequestsBasicListSerializer
cl... | 2.09375 | 2 |
girlfriend/util/concurrent.py | chihongze/girlfriend | 83 | 12775952 | <filename>girlfriend/util/concurrent.py
# coding: utf-8
"""并发工具集
"""
from __future__ import absolute_import
import threading
from girlfriend.exception import InvalidArgumentException
class CountDownLatch(object):
"""基于计数的闭锁实现
"""
def __init__(self, count):
if count <= 0:
raise Inv... | 3.15625 | 3 |
backend/src/deploy/deployCandProp.py | pedromtelho/BlockchainElection-TestNetwork | 0 | 12775953 | <reponame>pedromtelho/BlockchainElection-TestNetwork<gh_stars>0
import json
from web3 import Web3
from solc import compile_standard
import time
provider_url = "https://kovan.infura.io/v3/175c2cb13956473187db1e38282f6d6c"
web3 = Web3(Web3.HTTPProvider(provider_url))
def receiveFormInformations(ipca, pib, name, privKe... | 2.109375 | 2 |
jobmon/launcher.py | adamnew123456/jobmon | 2 | 12775954 | """
JobMon Launcher
===============
Launches the JobMon supervisor as a daemon - generally, the usage pattern for
this module will be something like the following::
>>> from jobmon import config
>>> config_handler = config.ConfigHandler
>>> config_handler.load(SOME_FILE)
>>> run(config_handler)
"""
im... | 2.953125 | 3 |
code/testing/gaussian/2d_plot.py | MorrisHuang-skipper/Serial-MD | 0 | 12775955 | import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
from pylab import cm
mpl.rcParams['font.family'] = 'STIXGeneral'
plt.rcParams['xtick.labelsize'] = 16
plt.rcParams['ytick.labelsize'] = 16
plt.rcParams['font.size'] = 16
plt.rcParams['figure.figsize'] = [5.6, 4]
plt.rcParams['axes.titlesize'] ... | 2.1875 | 2 |
pymenu.py | JessieMB/snake | 0 | 12775956 | # coding=utf-8
"""
EXAMPLE
Example file, timer clock with in-menu options.
Copyright (C) 2017 <NAME> @ppizarror
This program 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 Foundation, either version 3 of the License, ... | 3.46875 | 3 |
parcv/ResumeParser.py | asimokby/cv-parser-huggingface | 0 | 12775957 | from tracemalloc import start
from matplotlib.pyplot import contour
from parcv.Models import Models
from datetime import datetime
from dateutil import parser
import re
from string import punctuation
from collections import Counter
import math
class ResumeParser:
def __init__(self, ner, ner_dates, zero_shot_classi... | 2.40625 | 2 |
clearData.py | thesociallions/geotweetclusters | 0 | 12775958 | <reponame>thesociallions/geotweetclusters
# clearData.py
# <NAME> (s2497867)
# <NAME> (s2580861)
import pickle
import sys
def main():
tweets = {}
for line in sys.stdin:
datalist = line.rstrip().split(' ')
tweetID = datalist[0]
tweetUser = datalist[1]
tweetText = datalist[2]
try:
tweetGEO = datalist[3]
... | 2.8125 | 3 |
airnetSNL/dataset/rand_shapes.py | dennis-j-lee/AirNet-SNL | 1 | 12775959 | <gh_stars>1-10
import numpy as np
from skimage.draw import random_shapes
import torch
from torch.utils.data import Dataset
from torch_radon import Radon
class RandomShapeDataset(Dataset):
"""
Generate random shapes for training and testing.
Args:
* imgSize (int): Number of rows / cols in image
... | 2.5625 | 3 |
Python/interview/review/MeanMedianDataStruct.py | darrencheng0817/AlgorithmLearning | 2 | 12775960 | <filename>Python/interview/review/MeanMedianDataStruct.py
'''
Created on 2016年2月29日
@author: Darren
'''
class My_DS:
def __init__(self):
self.sum=0
self.count=0
self.data=[0]*1001
def add(self,num):
self.sum+=num
self.count+=1
self.data[num]+=1
... | 3.25 | 3 |
example_images.py | BerenMillidge/Theory_Associative_Memory | 3 | 12775961 | # quick scripts to generate example images for figures
import matplotlib.pyplot as plt
import seaborn as sns
import torch
import numpy as np
from functions import *
from data import *
from copy import deepcopy
import pickle
def plot_threshold_value_examples(savename):
with open(savename, 'rb') as handle:
d... | 2.515625 | 3 |
savman/cli.py | stratts/savman | 0 | 12775962 | '''A utility for backing up and restoring saved games.
Usage:
savman list [--backups]
savman scan [--nocache]
savman update
savman load <directory>
savman backup <directory> [<game>] [options]
savman restore <game> [<directory>] [options]
savman -h | --help
Commands:
list Show a list ... | 2.921875 | 3 |
bsm/operation/detect_package.py | bsmsoft/bsm | 3 | 12775963 | from bsm.config.util import detect_package
from bsm.operation import Base
class DetectPackage(Base):
def execute(self, directory):
return detect_package(directory, self._config['package_runtime'])
| 1.960938 | 2 |
faker/providers/person/vi_VN/__init__.py | nkthanh98/faker | 0 | 12775964 | <gh_stars>0
# coding=utf-8
from __future__ import unicode_literals
from collections import OrderedDict
from .. import Provider as PersonProvider
class Provider(PersonProvider): # Data from https://github.com/duyetdev/vietnamese-namedb
"""Provider for Vietnamese person generator"""
formats_female = Orde... | 2.265625 | 2 |
server/opendp_apps/terms_of_access/migrations/0001_initial.py | mikephelan/opendp-ux | 6 | 12775965 | # Generated by Django 3.1.12 on 2021-07-28 18:28
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='TermsOfAccess',
... | 1.773438 | 2 |
envs/CartPole/play.py | Rhushabh1/Mini-AI-Games | 0 | 12775966 | import gym
env_name = "CartPole-v0"
env_name = "Ant-v2"
env = gym.make(env_name)
class Agent:
def __init__(self, env):
self.action_space = env.action_space
def get_action(self, obs):
return self.action_space.sample()
env.reset()
agent = Agent(env)
for i_episode in range(10):
state = env.reset()
for t in rang... | 2.671875 | 3 |
Labs/Topic06-Functions/Lab06-Walkthrough.py | conor1982/Labs_Practice | 0 | 12775967 | <filename>Labs/Topic06-Functions/Lab06-Walkthrough.py<gh_stars>0
import json
students = []
filename = "/Users/Oriordanc/Desktop/HDip/Programming/Python_Module/students.json"
def writedict(obj):
with open(filename,'wt') as f:
json.dump(obj,f)
def readdict():
with open(filename) as f:
return j... | 3.703125 | 4 |
view/board.py | Joao360/Python-2048 | 0 | 12775968 | import curses
import os
import sys
import time
class Board:
column_width = 6
blank_column_line = "{}|".format(" " * column_width)
column_divider = "{}+".format("-" * column_width)
def __init__(self, boardSupplier):
self.boardSupplier = boardSupplier
board = boardSupplier()
... | 3.59375 | 4 |
eogrow/utils/meta.py | sentinel-hub/eo-grow | 17 | 12775969 | """
Utilities for solving different problems in `eo-grow` package structure, which are mostly a pure Python magic.
"""
from __future__ import annotations
import importlib
import inspect
from typing import TYPE_CHECKING, Any, Dict, Type
if TYPE_CHECKING:
from ..core.pipeline import Pipeline
from ..core.schemas... | 2.640625 | 3 |
server/accession/namebuilder.py | coll-gate/collgate | 2 | 12775970 | <reponame>coll-gate/collgate<filename>server/accession/namebuilder.py<gh_stars>1-10
# -*- coding: utf-8; -*-
#
# @file batchnamebuilder
# @brief Construct a new batch name using a specific convention and some constraints
# @author <NAME> (INRA UMR1095)
# @date 2018-01-08
# @copyright Copyright (c) 2018 INRA/CIRAD
# @li... | 2.359375 | 2 |
mapperpy/object_mapper.py | lgrech/MapperPy | 2 | 12775971 | from enum import Enum
from mapperpy.one_way_mapper import OneWayMapper
__author__ = 'lgrech'
class MappingDirection(Enum):
left_to_right = 1
right_to_left = 2
class ObjectMapper(object):
def __init__(self, from_left_mapper, from_right_mapper):
"""
:param from_left_mapper:
:type... | 2.84375 | 3 |
server.py | martinezpl/STARTHACK21-SBB-backend | 0 | 12775972 | <gh_stars>0
# import main Flask class and request object
from flask import Flask, request
from logic import Logic
# create the Flask app
app = Flask("SBB-backend")
log = Logic()
@app.route('/detail')
def detail():
facility = request.args.get('facility')
date = request.args.get('date')
return log.detail(fa... | 2.6875 | 3 |
benri/pytorch/rnn.py | MaxOSmith/benri | 0 | 12775973 | """ Configurable recurrent cell. """
import copy
from pydoc import locate
import torch
from torch.autograd import Variable
import torch.nn as nn
from torch.nn.utils.rnn import PackedSequence, pack_padded_sequence, pad_packed_sequence
from benri.configurable import Configurable
class RNN(nn.Module, Configurable):
... | 2.5625 | 3 |
cycles/utils/loadShader.py | em-yu/BlenderToolbox | 3 | 12775974 | import bpy
import os
# pwd = os.getcwd()
pwd = os.path.dirname(os.path.realpath(__file__))
def loadShader(shaderName, mesh):
# switch to different shader names
if shaderName is "EeveeToon":
bpy.context.scene.render.engine = 'BLENDER_EEVEE'
bpy.context.scene.render.alpha_mode = 'TRANSPARENT'
... | 2.515625 | 3 |
Base/views.py | yorlysoro/INCOLARA | 0 | 12775975 | <reponame>yorlysoro/INCOLARA<gh_stars>0
from django.urls import reverse_lazy
from django.views.generic import TemplateView, UpdateView, ListView, CreateView, DetailView, DeleteView
from .forms import FormularioSectores, FormularioCuenta
from .models import Cuenta, Sectores
# Create your views here.
class Inicio(Templ... | 2.234375 | 2 |
collector_service_sdk/api/template/update_template_with_yaml_pb2.py | easyopsapis/easyops-api-python | 5 | 12775976 | <reponame>easyopsapis/easyops-api-python<filename>collector_service_sdk/api/template/update_template_with_yaml_pb2.py
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: update_template_with_yaml.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('... | 1.53125 | 2 |
instacart-basket-analysis/pipelines/models/previous_order.py | yasserglez/kaggle_titanic | 2 | 12775977 | <reponame>yasserglez/kaggle_titanic
import luigi
import ujson
from ..models import PredictModel
class PredictPreviousOrder(PredictModel):
products = luigi.ChoiceParameter(choices=['all', 'reordered'], default='all')
@property
def model_name(self):
return 'previous_order_{}'.format(self.products... | 2.421875 | 2 |
ogle/lexer/language_spec.py | yshrdbrn/ogle | 0 | 12775978 | tokens = {
'ID': r'[A-Za-z][A-Za-z_0-9]*',
'FLOATNUM': r'(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][+-]?[0-9]+)?|[0-9]+[Ee][+-]?[0-9]+)',
'INTNUM': r'[0-9]+',
# Multi-character operators
'==': r'==',
'<=': r'<=',
'>=': r'>=',
'<>': r'<>',
'::': r'::',
}
special_characters = '<>+-*/=(){}... | 2.5625 | 3 |
cb_news/news_extractor/views/report_handler.py | astandre/cb_news_extractor | 0 | 12775979 | from flakon import JsonBlueprint
from cb_news.news_extractor.database import *
from flask import request
import logging
report_handler = JsonBlueprint('report_handler', __name__)
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
logger = loggin... | 2.34375 | 2 |
api/admin.py | surajsonee/Ionic-Django | 0 | 12775980 | from django.contrib import admin
from .models import Team, Kpi, KpiValue, Organization
# Register your models here.
@admin.register(Organization)
class OrganizationAdmin(admin.ModelAdmin):
pass
@admin.register(Team)
class TeamAdmin(admin.ModelAdmin):
pass
@admin.register(Kpi)
class KpiAdmin(admin.ModelAdmi... | 1.6875 | 2 |
src/simple_io.py | lucascimeca/Robotics_Palpation | 0 | 12775981 | from pathlib import Path
from os import path as pt
def file_exist_query(filename):
path = Path(filename)
if path.is_file():
res = None
while res not in ['y', 'Y', 'n', 'N']:
res = input("\nThe file in '{}' already exists, do you really wish to re-write its contents? [y/n]".format(f... | 3.71875 | 4 |
v7.0/map_analyze.py | jsstwright/osumapper | 296 | 12775982 | # -*- coding: utf-8 -*-
#
# JSON osu! map analysis
#
import numpy as np;
def get_map_timing_array(map_json, length=-1, divisor=4):
if length == -1:
length = map_json["obj"][-1]["time"] + 1000; # it has an extra time interval after the last note
if map_json["obj"][-1]["type"] & 8: # spinner end
... | 2.375 | 2 |
views.py | vsantiago113/Flask-API-Boilerplate | 1 | 12775983 | from flask import Flask, request, make_response, jsonify, Response
from flask_restx import Resource, Api, abort, reqparse
from flask_jwt_extended import JWTManager
from flask_jwt_extended import (create_access_token, create_refresh_token, jwt_required,
jwt_refresh_token_required, get_jwt... | 2.1875 | 2 |
extra/test_multi.py | ragnariock/DeepFashion | 255 | 12775984 | ### IMPORTS
from __future__ import print_function
import os
import fnmatch
import numpy as np
import skimage.data
import cv2
import sys
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from PIL import Image
from keras import applications
from keras.preprocessing.image import ImageDataGenerator
fr... | 1.992188 | 2 |
utils/del_dummydirs.py | shleee47/shleee47 | 0 | 12775985 | import os
import glob
import shutil
def del_dummydirs(rootpath, list):
for root, subdirs, files in os.walk(rootpath):
"""
walk through given rootpath, delete dirs in list
"""
for s in subdirs:
if s in list:
shutil.rmtree(os.path.join(root, s))
... | 3.046875 | 3 |
train/inflammation-classifier.py | JorisRoels/mri-inflammation-prediction | 0 | 12775986 | '''
This script illustrates training of an inflammation classifier for patches along SI joints
'''
import argparse
import os
import shutil
import pytorch_lightning as pl
from torch.utils.data import DataLoader
from neuralnets.util.io import print_frm
from neuralnets.util.tools import set_seed
from neuralnets.util.augm... | 2.296875 | 2 |
algorithm/16-DFS.py | LeeBeral/python | 0 | 12775987 | # DFS: Depth First Search, 从最左侧由根向下遍历,对象有未被遍历的叶时继续往下遍历,无未被遍历叶时向上返回,返回到根时退出。
nums = [2, 0, 3, 1, 3, 4]
pst = 3
def dfs(nums, p, t=0, nb=set()):
step = nums[p]
if p - step < 0 and p + step > len(nums):
return False
if nums[p - step] == t or nums[p + step] == t:
return p - step or p + step
... | 3.875 | 4 |
day-1/range-type.py | anishLearnsToCode/python-workshop-3 | 2 | 12775988 | <reponame>anishLearnsToCode/python-workshop-3
"""
Range
range(stop)
range(start, stop)
range(start, stop, step)
default start = 0
default step = 1
"""
r = range(5, 10, 2)
print(r.start)
print(r.stop)
print(r.step)
print(type(r))
| 3.734375 | 4 |
apps/lti_app/middleware.py | PremierLangage/premierlangage | 8 | 12775989 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# middleware.py
#
# Authors:
# - <NAME> <<EMAIL>>
#
import logging
from django.contrib import auth
from django.core.exceptions import ImproperlyConfigured
from django.shortcuts import redirect, get_object_or_404
from django.urls import resolve, reverse
from djan... | 2.171875 | 2 |
docker_registry_client/Repository.py | agrrh/docker-registry-client | 49 | 12775990 | <filename>docker_registry_client/Repository.py
from __future__ import absolute_import
from .Image import Image
class BaseRepository(object):
def __init__(self, client, repository, namespace=None):
self._client = client
self.repository = repository
self.namespace = namespace
@property... | 2.34375 | 2 |
code_examples/tensorflow/mcmc/mcmc_tfp.py | xihuaiwen/chinese_bert | 0 | 12775991 | # Copyright 2020 Graphcore Ltd.
import argparse
import os
import time as time
import numpy as np
import tensorflow as tf
from tensorflow.python.ipu import ipu_compiler, ipu_infeed_queue, loops, utils
from tensorflow.python.ipu.scopes import ipu_scope, ipu_shard
import tensorflow_probability as tfp
# ... | 2.3125 | 2 |
Matplotlib/Matplotlib-PieChart.py | H2oPtic/Codecademy | 0 | 12775992 | <gh_stars>0
from matplotlib import pyplot as plt
import numpy as np
payment_method_names = ["Card Swipe", "Cash", "Apple Pay", "Other"]
payment_method_freqs = [270, 77, 32, 11]
plt.pie(payment_method_freqs)
plt.axis('equal')
plt.show()
| 2.71875 | 3 |
tensorflow_graphics/rendering/tests/splat_with_opengl_test.py | sarvex/graphics | 2,759 | 12775993 | <filename>tensorflow_graphics/rendering/tests/splat_with_opengl_test.py<gh_stars>1000+
# Copyright 2020 The TensorFlow Authors
#
# 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
#
# https://w... | 1.984375 | 2 |
sdtest-wip.py | benhastings/SeGrid_EC2 | 0 | 12775994 | from selenium import webdriver
import selenium.webdriver.support.ui as ui
from selenium.webdriver.common.keys import Keys
#from selenium.webdriver.common.action_chains import ActionChains
import time
import datetime
import csv
import random
import sys
import urllib2
import socket
#from metricsCollect import metricsCol... | 2.453125 | 2 |
Python/Stepik/Beginner/Exam-loops/review-9.py | SergeyOcheretenko/PythonLearning | 0 | 12775995 | count = 0
maximum = (-10) ** 9
for _ in range(4):
x = int(input())
if x % 2 == 1:
count += 1
if x > maximum:
maximum = x
if count > 0:
print(count)
print(maximum)
else:
print('NO')
| 3.390625 | 3 |
zipfileworker.py | Lazymindz/AzDevopsAPIWrapper | 0 | 12775996 | <reponame>Lazymindz/AzDevopsAPIWrapper
import logging
from logging import NullHandler
import zipfile
import os, os.path
from os import walk
import time
# Set default logging handler to avoid "No handler found" warnings.
logging.getLogger(__name__).addHandler(NullHandler())
def task_getfilenames(rootdir):
filename... | 2.328125 | 2 |
api/routes/guilds.py | vcokltfre/Raptor | 3 | 12775997 | <gh_stars>1-10
from fastapi import APIRouter, HTTPException
from tortoise.exceptions import DoesNotExist
from ..config import get_guild_config as get_config
from ..models import GuildConfigResponse
router = APIRouter(prefix="/guilds")
@router.get("/{id}/config")
async def get_guild_config(id: int) -> GuildConfigRes... | 2.3125 | 2 |
DebrisFromExercises/06/Assemble-py/Assemble_py.py | it-depends/CPSG-Nand2Tetris | 0 | 12775998 | <filename>DebrisFromExercises/06/Assemble-py/Assemble_py.py
import os
import re
import sys
symbolTable = {
"SP": 0,
"LCL": 1,
"ARG": 2,
"THIS": 3,
"THAT": 4,
"SCREEN": 16384,
"KBD": 24576,
"R0": 0,
"R1": 1,
"R2": 2,
"R3": 3,
"R4": 4,
"R5": 5,
"R6": 6,
"R7": 7... | 2.140625 | 2 |
demo/custom_extensions/cachebust_static_assets/main.py | uk-gov-mirror/LandRegistry.hmlr-design-system | 6 | 12775999 | import hashlib
import os
from flask import current_app, url_for
cache_busting_values = {}
class CachebustStaticAssets(object):
def __init__(self, app=None):
self.app = app
if app is not None:
self.init_app(app)
def init_app(self, app):
@app.context_processor
def ... | 2.828125 | 3 |
test/test_commandmanager.py | lietu/twitch-bot | 6 | 12776000 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# coding: utf-8
# coding=utf-8
import os
import bot.commandmanager
from bot.chat import Chat
from unittest import TestCase
from mock import Mock
class FakeBot(object):
settings = None
def set_command(self, channel, command, want_user, user_level, code):
pass
... | 2.640625 | 3 |
Python/neon_numbers.py | MjCode01/DS-Algo-Point | 1,148 | 12776001 | # Neon number --> If the sum of digits of the squared numbers are equal to the orignal number , the number is said to be Neon number. Example 9
ch=int(input("Enter 1 to do it with loop and 2 without loop :\n"))
n= int(input("Enter the number :\n"))
def number(n):
sq= n**2
digisum=0
while sq>0:
r... | 4.28125 | 4 |
valheim_server/log_dog.py | wchesley/discord_bot.py | 0 | 12776002 | <filename>valheim_server/log_dog.py
## TODO:
# set log file location (Config.json?)
# Read file up to present
# Read any new lines written to file
# Pass information from within log files to log_parser.py
# avoid duplicates?
import os
import discord
import logging
import time
import asyncio
import random
import json... | 2.546875 | 3 |
src/predict.py | HariWu1995/miRACL | 0 | 12776003 | import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
# os.environ['CUDA_DEVICE_ORDER'] = 'PCI_BUS_ID'
# os.environ['CUDA_VISIBLE_DEVICES'] = '0'
import json
import time
import argparse
from pathlib import Path
import random
import numpy as np
import tensorflow as tf
tf.autograph.set_verbosity(3) # 0: deb... | 2.03125 | 2 |
passwordgenerator/app.py | aminbeigi/Password-Generator-Rest-API | 0 | 12776004 | <reponame>aminbeigi/Password-Generator-Rest-API
from flask import Flask, request
from flask_restful import Api, Resource
from .data_generator import DataGenerator
from webargs import fields, validate
from webargs.flaskparser import use_args, use_kwargs, parser, abort
"""The Password-Generator Restful API
This API wil... | 3.21875 | 3 |
tf/begin.py | rishuatgithub/MLPy | 0 | 12776005 | <reponame>rishuatgithub/MLPy
# Tensor Flow basic - <NAME>
#import the tf canonical lib
import tensorflow as tf
#from __future__ import print_function
#A computational graph is a series of TensorFlow operations arranged into a graph of nodes.
#Let's build a simple computational graph. Each node takes zero or more tens... | 4.03125 | 4 |
medium/Palindrome Partitioning/palindrome.py | yujiecong/LeetCode-learning | 0 | 12776006 | class Solution(object):
def partition(self, s):
self.isPalindrome = lambda s : s == s[::-1]
res = []
self.backtrack(s, res, [])
return res
def backtrack(self, s, res, path):
print(path)
if not s: #如果是空字符串 ''
res.append(path)
return... | 3.328125 | 3 |
gb_chat/common/thread_executor.py | Cerzon/gb_chat | 0 | 12776007 | from queue import Empty, SimpleQueue
from typing import Any, Callable, Optional, cast
from PyQt5.QtCore import QEvent, QObject
from PyQt5.QtWidgets import QApplication
from ..log import get_logger
Function = Callable[[], None]
class IoThreadExecutor:
def __init__(self) -> None:
self._queue: SimpleQueue... | 2.375 | 2 |
sitenco/config/code_browser.py | Kozea/sitenco | 3 | 12776008 | <reponame>Kozea/sitenco
"""
Code browser tools.
"""
import abc
from docutils import nodes
from flask import request
from .tool import Tool, Role, Directive
class CodeBrowser(Tool):
"""Abstract class for code browser tools."""
__metaclass__ = abc.ABCMeta
def __init__(self, project_name, ribbon=None):
... | 2.421875 | 2 |
components/reports/report_list/report_list.py | Sitelink3D-v2-Developer/sitelink3dv2-examples | 1 | 12776009 | <reponame>Sitelink3D-v2-Developer/sitelink3dv2-examples<filename>components/reports/report_list/report_list.py
#!/usr/bin/python
import argparse
import json
import logging
import os
import sys
import requests
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "tokens"))
sys.path.appe... | 2.453125 | 2 |
ADE-20k_Dataset/Scripts/Script1_anotaions_to_custom_anotations.py | bilals08/F-20-09-R-BA | 0 | 12776010 | # -*- coding: utf-8 -*-
"""
Created on Tue Sep 29 17:41:44 2020
@author: salman
"""
from PIL import Image
import pandas as pd
import numpy as np
import cv2
import os
d={}
data = pd.read_csv('E:\\fyp data\\ADEK-20\\new_se_new\\new.txt', sep="\t")
arr=np.zeros(151)
print(arr)
for point in data.values:
(key,name,... | 2.3125 | 2 |
RegressionModels/SimpleLinearRegression.py | nicohm/Machine-Learning | 0 | 12776011 | <filename>RegressionModels/SimpleLinearRegression.py
"""
SIMPLE LINEAR REGRESION
-----------------------
@autor: <NAME>
We'll learn to compute linear regression model using scikit-learn library
"""
# Import packages
import pandas as pd
import numpy as np
import pylab as pl
import matplotlib.pyplot as plt
from sklearn ... | 4.15625 | 4 |
src/marion/marion/tests/test_views.py | OmenApps/marion | 7 | 12776012 | """Tests for the marion application views"""
import json
import tempfile
from pathlib import Path
from django.urls import reverse
import pytest
from pytest_django import asserts as django_assertions
from rest_framework import exceptions as drf_exceptions
from rest_framework import status
from rest_framework.test imp... | 2.546875 | 3 |
code/test.py | JJBUP/yolov3_pytorch | 1 | 12776013 | <filename>code/test.py
# -*- coding: utf-8 -*-
import argparse
import tqdm
import torch
from torch.utils.data import DataLoader
from torch.autograd import Variable
import numpy as np
from terminaltables import AsciiTable
from Yolo3Body import YOLOV3
from utils.util import get_classes_name, xywh2xyxy, non_max_suppr... | 2.171875 | 2 |
verticapy/tests/vModel/test_svd.py | vertica/vertica_ml_python | 7 | 12776014 | <filename>verticapy/tests/vModel/test_svd.py<gh_stars>1-10
# (c) Copyright [2018-2022] Micro Focus or one of its affiliates.
# 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.apach... | 2.109375 | 2 |
src/Cells/Gol_Cell.py | eniallator/Game-of-Life-Workshop | 0 | 12776015 | from src.Cells.Base_Cell import Base_Cell
class Gol_Cell(Base_Cell):
_neighbour_radius = 1
@classmethod
def try_spawn(cls, neighbours):
gol_cell_count = 0
for row in neighbours:
for cell in row:
if cell.__class__ == Gol_Cell:
gol_cell_count... | 3.171875 | 3 |
codeSheets/SEAS6401/PGAProject/Exploratory_Analysis.py | kylearbide/kylearbide.github.io | 0 | 12776016 | # Databricks notebook source
import pandas as pd
import math
import matplotlib.pyplot as plt
import numpy as np
# COMMAND ----------
roundsDf = pd.read_csv("/dbfs/FileStore/karbide/Rounds.txt")
holesDf = pd.read_csv("/dbfs/FileStore/karbide/Holes.txt")
holesDf.drop(["Score", "ToPar", "Unnamed: 0"],axis=1,inplace = Tr... | 2.859375 | 3 |
parasite/doc.py | SGevorg/parasite | 9 | 12776017 | import os
import numpy as np
from glob import glob
from textwrap import wrap
from tabulate import tabulate
from collections import defaultdict
from typing import List, Union, Iterator, Iterable, Tuple, Dict
from typing import TypeVar, Generic
from .applicator import Applicator
T = TypeVar('T', bound='BiText')
... | 2.3125 | 2 |
captain_hook/services/pagerduty/__init__.py | brantje/captain_hook | 1 | 12776018 | <reponame>brantje/captain_hook
from __future__ import absolute_import
from .pagerduty import PagerdutyService
| 1.109375 | 1 |
dashboard/views.py | yahyasaadi/jirani | 0 | 12776019 | <reponame>yahyasaadi/jirani
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from .models import Post, Neighborhood, Business, Contact
from .forms import HoodForm, PostForm
# Create your views here.
@login_req... | 2.125 | 2 |
abstract-factory-pattern/motorcycle/MotorcycleImpl.py | lcarnevale/software-pattern-python | 0 | 12776020 | from .Motorcycle import Motorcycle
class MotorcycleImpl(Motorcycle):
def useful_function_b(self) -> str:
return "The result of implementing Motorcycle."
| 2.703125 | 3 |
kisn_pylab/kilosort.py | Whitlock-Group/KISN-PyLab | 0 | 12776021 | # -*- coding: utf-8 -*-
"""
@author: bartulem
Run Kilosort2 through Python.
As it stands (spring/summer 2020), to use Kilosort2 one still requires Matlab. To ensure it works,
one needs a specific combination of Matlab, the GPU driver version and CUDA compiler files.
On the lab computer, I set it up to work on Matla... | 3 | 3 |
src/3_pd_model_gradient_boosting.py | pegodk/lending_club | 0 | 12776022 | import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor, GradientBoostingClassifier
from sklearn.metrics import mean_absolute_error, accuracy_score, roc_curve, roc_auc_score
from src.utils import calc_annual_return_vec, ... | 2.734375 | 3 |
rlutils/pytorch/functional.py | vermouth1992/rlutils | 0 | 12776023 | import numpy as np
import torch
import torch.nn as nn
def soft_update(target: nn.Module, source: nn.Module, tau):
with torch.no_grad():
for target_param, param in zip(target.parameters(), source.parameters()):
target_param.data.copy_(target_param.data * (1.0 - tau) + param.data * tau)
def ha... | 2.984375 | 3 |
projects/zfssa_projects.py | aldenso/zfssa-scripts | 1 | 12776024 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# @CreateTime: Jun 18, 2017 1:13 PM
# @Author: <NAME>
# @Contact: <EMAIL>
# @Last Modified By: <NAME>
# @Last Modified Time: Jun 18, 2017 3:45 PM
# @Description: Modify Here, Please
from __future__ import print_function, division
import re
import json
import csv
from datetime ... | 2.28125 | 2 |
plugins/sort_by_article_count/__init__.py | julianespinel/website | 0 | 12776025 | from pelican import signals
from . import count
def add_filter(pelican):
"""Add count_elements filter to Pelican."""
pelican.env.filters.update(
{'sort_by_article_count': count.sort_by_article_count})
def register():
"""Plugin registration."""
signals.generator_init.connect(add_filter)
| 1.867188 | 2 |
event_evaluator.py | aria-jpl/coseismic_usgs_neic_evaluator | 0 | 12776026 | #!/usr/bin/env python
'''
Takes in the usgs neic event object, then determines if it
is relevant above the input filter criteria. If it passes
this filter, an aoi type for the event is created and submitted
to create_aoi
'''
from __future__ import division
from builtins import range
from past.utils import old_div
im... | 2.3125 | 2 |
sklearn_pmml_model/linear_model/__init__.py | iamDecode/sklearn-pmml-model | 62 | 12776027 | """
The :mod:`sklearn_pmml_model.linear_model` module implements generalized linear models.
"""
# License: BSD 2-Clause
from .implementations import PMMLLinearRegression, PMMLLogisticRegression, PMMLRidge, \
PMMLRidgeClassifier, PMMLLasso, PMMLElasticNet
__all__ = [
'PMMLLinearRegression',
'PMMLLogisticR... | 1.234375 | 1 |
services/__init__.py | S4CH/discord-bot | 1 | 12776028 | from .group import GroupMeet | 1.070313 | 1 |
shapeft/views.py | dksivagis/shpescape | 1 | 12776029 | #!/usr/bin/env python
#
# Copyright 2010 Google Inc.
#
# 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 ... | 1.9375 | 2 |
tests/unit/utils.py | satra/hdmf | 0 | 12776030 | <filename>tests/unit/utils.py
import tempfile
from hdmf.utils import docval, getargs
from hdmf.container import Container
CORE_NAMESPACE = 'test_core'
class Foo(Container):
@docval({'name': 'name', 'type': str, 'doc': 'the name of this Foo'},
{'name': 'my_data', 'type': ('array_data', 'data'), 'do... | 2.3125 | 2 |
detector_mxnet/videoflow_contrib/detector_mxnet/__init__.py | videoflow/videoflow-contrib | 12 | 12776031 | from contextlib import suppress
with suppress(ImportError):
from .mxnet_object_detector import MxnetObjectDetector
| 1.210938 | 1 |
abstract_scorm_xblock/abstract_scorm_xblock/utils.py | Abstract-Tech/abstract-scorm-xblock | 5 | 12776032 | <reponame>Abstract-Tech/abstract-scorm-xblock
# -*- coding: utf-8 -*-
import pkg_resources
from django.template import Context, Template
def gettext(text):
"""Dummy `gettext` replacement to make string extraction
tools scrape strings marked for translation """
return text
def resource_string(path):
... | 2.359375 | 2 |
python/pex/value.py | JiveHelix/pex | 0 | 12776033 | <filename>python/pex/value.py
##
# @file value.py
#
# @brief Synchronizes a value between the interface and the model, with
# both ends allowed to register callbacks to be notified when the value has
# changed.
#
# @author <NAME> (<EMAIL>)
# @date 06 Jun 2020
# @copyright <NAME>
# Licensed under the MIT license. See LI... | 2.578125 | 3 |
tests/otus/snapshots/snap_test_api.py | ColeVoelpel/virtool | 1 | 12776034 | # -*- coding: utf-8 -*-
# snapshottest: v1 - https://goo.gl/zC4yUc
from __future__ import unicode_literals
from snapshottest import GenericRepr, Snapshot
snapshots = Snapshot()
snapshots['TestCreate.test[True-uvloop-None-True] history'] = {
'_id': '9pfsom1b.0',
'created_at': GenericRepr('datetime.datetime(2... | 1.703125 | 2 |
3vvrsto.py | BlackPhoenixSlo/3vVrsto | 0 | 12776035 | <gh_stars>0
import bottle
import model
import random
igra = model.Igra()
second = True
@bottle.get('/AI_learns/')
def leanAI():
igra.learn()
return bottle.redirect('http://127.0.0.1:8080/new')
@bottle.get('/new')
def newgame():
igra.polje = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
if random.randint(0, 1) ... | 2.46875 | 2 |
backend/modules/dataprep/PandasPreprocessor.py | FeelsBright/SmartMed | 0 | 12776036 | <filename>backend/modules/dataprep/PandasPreprocessor.py
from typing import Dict
import pandas as pd
import logging
logging.basicConfig(filename='~/../logs/start.log', level=logging.DEBUG)
def debug(fn):
'''logging decorator'''
def wrapper(*args, **kwargs):
logging.debug("Entering {:s}...".format(fn.__name__))... | 2.734375 | 3 |
lwm2m/MdsNotificationDemo.py | jefforeilly/django-rest-framework-iot | 3 | 12776037 | <gh_stars>1-10
'''
Created on October 25th, 2014
Subscribe to a resource, connect to the notification channel of an mDS instance and receive
notifications from the subscribed resource
Process the notifications and filter a set of endpints and a particualr resource path. Index the
resource value from the notificatio... | 2.578125 | 3 |
raciocinio_algoritmico/6- 22-04-2020/02.py | PedroMoreira87/python | 0 | 12776038 | # [[1, 2, 3],
# [4, 5, 6],
# [7, 8, 9]]
#
# print(((1-4) ** 2 + (4-4) ** 2 + (7-4) ** 2)/3)
def constroi_matriz(n, m):
mat = []
for i in range(n):
linha = []
for j in range(m):
linha.append(0)
mat.append(linha)
return mat
def popula_matriz(mat):
for i in range(l... | 3.453125 | 3 |
src/python/nimbusml/linear_model/symsgdbinaryclassifier.py | michaelgsharp/NimbusML | 134 | 12776039 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------------------------
# - Generated by tools/entrypoint_co... | 2.75 | 3 |
hive/utils/registry.py | chandar-lab/RLHive | 81 | 12776040 | import argparse
import inspect
from copy import deepcopy
from functools import partial, update_wrapper
from typing import List, Mapping, Sequence, _GenericAlias
import yaml
class Registrable:
"""Class used to denote which types of objects can be registered in the RLHive
Registry. These objects can also be co... | 2.890625 | 3 |
linuxmachinebeta/review/signals.py | linux-machine/linuxmachinebeta | 0 | 12776041 | from django.dispatch import receiver
from django.db.models.signals import post_delete
from linuxmachinebeta.review.models import ServiceReview
@receiver(post_delete, sender=ServiceReview)
def update_rating_after_delete(sender, instance, **kwargs):
instance.service.update_rating()
| 1.648438 | 2 |
users/admin.py | mixnix/subject_rate | 0 | 12776042 | # users/admin.py
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from .forms import ReviewsUserCreationForm, ReviewsUserChangeForm
from .models import ReviewsUser
class ReviewUserAdmin(UserAdmin):
add_form = ReviewsUserCreationForm
form = ReviewsUserChangeForm
list_displa... | 1.648438 | 2 |
air_pollution_death_rate_related/interactive_map/interactive_map.py | nghitrampham/air_pollution_death_rate_related | 0 | 12776043 | <gh_stars>0
'''
Interactive map of repiratory deaths and air pollution across U.S. counties
Note: naming conventions confirmed by pylint
'''
import json
from urllib.request import urlopen
import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
from plotly.callbacks import... | 2.859375 | 3 |
movie/app/models.py | zhangzhibo123/flask---movie | 0 | 12776044 | <filename>movie/app/models.py
# -*- coding:utf-8 -*-
from datetime import datetime
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField
from wtforms.validators import DataRequired
__author__ = 'zhangzhibo'
__date__ = '202018/5/18 10:36'
from app import db
class UserInfo(db.Model):
tablen... | 2.75 | 3 |
pjproject_android/pjsip-apps/src/python/samples/presence.py | WachterJud/qaul.net_legacy | 4 | 12776045 | <filename>pjproject_android/pjsip-apps/src/python/samples/presence.py
# $Id: presence.py 2171 2008-07-24 09:01:33Z bennylp $
#
# Presence and instant messaging
#
# Copyright (C) 2003-2008 <NAME> <<EMAIL>>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Pu... | 2.28125 | 2 |
plot.py | thepushkarp/Analyze-IMDB-Top-250 | 4 | 12776046 | <reponame>thepushkarp/Analyze-IMDB-Top-250
import os
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
import pandas as pd
print('Reading data from csv...')
# Read data from csv file
movieRatings = pd.read_csv('movieRatings.csv', header = 0)
# Add decade column to Movie Ratings DataFrame
movi... | 3.359375 | 3 |
module/utils.py | XuanMaoSecLab/shockwave | 8 | 12776047 |
import os
import itertools
from itertools import product
# get_files(loadrules,["[F.3]","[A.1]"],[".yaml"])
def get_files(_path, _startwith=None, _endwith=None):
'''
get all files
:param _startwith : ["str1","str2"]
:param _endwith : [".sol",".py"]
'''
if not _startwith: _startwi... | 2.9375 | 3 |
freqtools/freq_models.py | bleykauf/freqtools | 0 | 12776048 | """Submodule containing frequency-based models."""
from freqtools.freq_data import OscillatorNoise
import numpy as np
import matplotlib.pyplot as plt
class FreqModel:
"""
Base class for frequency based models, i.e. values (y axis) as a function of
frequency (x axis). Its functionality is purposfully kept... | 3.1875 | 3 |
homeassistant/components/derivative/__init__.py | domwillcode/home-assistant | 22,481 | 12776049 | """The derivative component."""
| 1.148438 | 1 |
desafios/Mundo 2/Ex043IMC.py | duartecgustavo/Python---Estudos- | 6 | 12776050 | <filename>desafios/Mundo 2/Ex043IMC.py
# Desafio 43 - Aula 12 : Programa que calcule o IMC e apresente a tabela:
# A/ Abaixo de 18.5 - ABAIXO DO PESO.
# B/ Entre 18.5 e 25 - PESO IDEAL.
# C/ De 25 até 30 - SOBREPESO.
# D/ 30 até 50 - OBESIDADE.
# E/ Acima de 40 - OBESIDADE MORBIDA.
# FORMULA - ALTURA² / PESO
print('=... | 3.4375 | 3 |