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 |
|---|---|---|---|---|---|---|
python/challenges/queue_with_stacks/queue_with_stacks.py | marvincolgin/data-structures-and-algorythms | 5 | 48400 | import os,sys,inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, currentdir+'/../../data-structures/stacks_and_queues')
p = currentdir+'/../../data-structures/linked_list'
sys.path.insert(0,p)
from stack... | 3.28125 | 3 |
shallow_backup/git_wrapper.py | nunomdc/shallow-backup | 0 | 48401 | import os
import git
from shutil import move
from printing import *
from config import get_config
#########
# GLOBALS
#########
COMMIT_MSG = {
"fonts": "Back up fonts.",
"packages": "Back up packages.",
"configs": "Back up configs.",
"all": "Full back up.",
"dotfiles": "Back up dotfiles."
}
###########
# FUNCTI... | 2.59375 | 3 |
demos/remote-demo/client.py | duguyue100/pyaer-demo | 0 | 48402 | """Client software that receives the data.
Author: <NAME>
Email : <EMAIL>
"""
from __future__ import print_function, absolute_import
import socket
try:
import cPickle as pickle
except:
import pickle
import zlib
import cv2
buffer_size = 2**17
IP_address = "172.19.11.178"
port = 8080
address = (IP_address, p... | 2.4375 | 2 |
3 Facebook scraping.py | SajawalChopra/Facebook-Scraping | 1 | 48403 | from bs4 import BeautifulSoup as Bs4
from time import sleep
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import pandas as pd
def scroll(driver, timeout):
scroll_pause_time = timeout
# Get scroll height
last_height = driver.execute_script("return document.body.sc... | 3.390625 | 3 |
app/mybot.py | arudmin/rocketgram-template | 0 | 48404 | import logging
import pickle
from datetime import datetime
import munch
from rocketgram import Bot, Dispatcher, DefaultValuesMiddleware, ParseModeType
logger = logging.getLogger('mybot')
router = Dispatcher()
def get_bot(token: str):
bot = Bot(token, router=router, globals_class=munch.Munch, context_data_clas... | 2.28125 | 2 |
meiduo_mall/meiduo_mall/apps/users/views.py | yy12950906/meiduo_project | 0 | 48405 | from django.shortcuts import render, redirect
from django.views import View
from django import http
import re
from .models import User
from django.contrib.auth import login
from meiduo_mall.utils.response_code import RETCODE
class RegisterView(View):
"""用户注册"""
def get(self, request):
return render... | 2.171875 | 2 |
lists/longestMatchingParentheses.py | santoshmano/pybricks | 0 | 48406 | class ArrayStack:
def __init__(self):
self.data = []
def isEmpty(self):
return len(self.data) == 0
def push(self, val):
return self.data.append(val)
def pop(self):
if self.isEmpty():
raise Empty("Stack underflow!")
return self.data.pop()
def ... | 3.765625 | 4 |
src/tests/hoplalib/cast/test_classmodels.py | rickie/hopla | 0 | 48407 | #!/usr/bin/env python3
from typing import List
class HabiticaClassData:
"""A class with data about habitica classes.
@see: hopla api content | jq .classes
"""
class_names: List[str] = ["warrior", "rogue", "healer", "wizard"]
| 2.703125 | 3 |
Lectures/dirk_drone_code/gravity.py | donnel2-cooper/drone_control | 0 | 48408 | import numpy as np
from rotations import rot2, rot3
import mavsim_python_parameters_aerosonde_parameters as P
class Gravity:
def __init__(self, state):
self.mass = P.mass
self.gravity = P.gravity
self.state = state
# Aero quantities
@property
def force(self):
... | 2.625 | 3 |
notification/migrations/0001_initial.py | Petro-Viron/django-notification | 0 | 48409 | <filename>notification/migrations/0001_initial.py
# -*- coding: utf-8 -*-
from django.conf import settings
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
migrations.... | 1.703125 | 2 |
classifier/classifier.py | naveenrc/YelpChallenge | 4 | 48410 | from tensorflow.python.framework import ops
import tensorflow as tf
from utilities import model as md
import matplotlib.pyplot as plt
import numpy as np
from sklearn.model_selection import train_test_split
import os
import time
import cv2
def model(photos_train, Y_train, photos_test, Y_test, learning_rate=0.0005,
... | 3.78125 | 4 |
quordle.py | tipa16384/wordle | 0 | 48411 | <filename>quordle.py
from itertools import combinations
from collections import defaultdict
vowels = 'aeiouy'
# read a list of words from wordle.txt
def read_words():
with open('wordle.txt', 'r') as f:
return [line.strip() for line in f]
def checker(word_list):
for words in combinations(word_list, 3... | 4.09375 | 4 |
stataLogObject/Supports/supports.py | sbaker-dev/stataLogObject | 0 | 48412 | <reponame>sbaker-dev/stataLogObject
from string import ascii_letters
import re
forest_attr = ['var_name', 'coefficient', 'lb_95', 'ub_95']
forest_header = ["Phenotype", "Coefficient", "Lower Bound", "Upper Bound"]
FOREST_DICT = {attr: header for attr, header in zip(forest_attr, forest_header)}
def clean_line(line):... | 2.5625 | 3 |
FPSimRotaryPotentiometer.py | dliess/FreeCADFrontPanelSimulation | 8 | 48413 | import FreeCAD
import FPEventDispatcher
from FPInitialPlacement import InitialPlacements
import FPSimServer
import FPUtils
pressEventLocationXY = dict()
rotationAngleAtPress = dict()
class FPSimRotaryPotentiometer(InitialPlacements):
def __init__(self, obj):
InitialPlacements.__init__(self, obj)
o... | 2.15625 | 2 |
solved/mq003.py | zao95/codingdojang-zao95-solving | 2 | 48414 | <reponame>zao95/codingdojang-zao95-solving
# 자작 문제풀이
# Question number. 003
# Author: <NAME>
# Github name: zao95
# ========== Question ==========
# python-packer를 이용하여 실행파일 제작
# ==============================
def abc():
print("a")
abc()
print(hex(id(abc())))
print(hex(id("abc"))) | 2.6875 | 3 |
selenium_python/5/5.6_visibility_of.py | small99/DevAuto | 11 | 48415 | <gh_stars>10-100
# -*- coding: utf-8 -*-
__author__ = "苦叶子"
from selenium import webdriver
# 导入WebDriverWait类
from selenium.webdriver.support.ui import WebDriverWait
# 导入定位方式
from selenium.webdriver.common.by import By
# 导入
from selenium.webdriver.support.expected_conditions import presence_of_element_located,visi... | 3.484375 | 3 |
tagger.py | medric49/NLTK_POS_tagging | 0 | 48416 | from nltk.tag import TaggerI
import spacy.tokens
class SpacyTagger(TaggerI):
def __init__(self):
super(SpacyTagger, self).__init__()
self.nlp = spacy.load('en_core_web_sm', disable=['parser', 'ner'])
def tag(self, tokens):
doc = spacy.tokens.doc.Doc(self.nlp.vocab, words=tokens)
... | 2.671875 | 3 |
exercises/exercise4_test_driven_development/tests/test_dna/test_dna.py | stijn-arends/programming2 | 0 | 48417 | <filename>exercises/exercise4_test_driven_development/tests/test_dna/test_dna.py
# from pytest import capfd
import pytest
from bin.dna import DNA
from bin.dna import NotDNAError
def test_init():
dna = DNA('ACTGACTGACTA')
assert all(c in "ACGT" for c in dna.seq), 'DNA sequence does not exists only of ACTG'
... | 3.453125 | 3 |
tests/env_up/env_tests/script_up_test.py | aoxiangflysky/onedata | 61 | 48418 | <filename>tests/env_up/env_tests/script_up_test.py
"""This module contains acceptance tests of scripts that bring up dockerized
test environment.
"""
__author__ = "<NAME>"
__copyright__ = "Copyright (C) 2016 ACK CYFRONET AGH"
__license__ = "This software is released under the MIT license cited in " \
"LIC... | 2.234375 | 2 |
XiaoAi-Music-Bridge.py | lwl12/XiaoAi-Music-Bridge | 13 | 48419 | <reponame>lwl12/XiaoAi-Music-Bridge<gh_stars>10-100
from xiaoai import *
import json
import requests
def outputJson(toSpeakText, is_session_end, openMic=True):
xiaoAIResponse = XiaoAIResponse(to_speak=XiaoAIToSpeak(
type_=0, text=toSpeakText), open_mic=openMic)
response = xiaoai_response(XiaoA... | 2.53125 | 3 |
decuen/actors/strats/epsilon.py | ziyadedher/decuen | 2 | 48420 | <reponame>ziyadedher/decuen
"""Implementation of an epsilon-greedy action selection strategy."""
from abc import ABC, abstractmethod
from typing import Callable, ClassVar, Optional
from decuen.actors.strats._strategy import Strategy
from decuen.actors.strats.greedy import GreedyStrategy
from decuen.actors.strats.unif... | 2.671875 | 3 |
src/common/timestamp.py | vkhaydarov/PlantEye | 1 | 48421 | <reponame>vkhaydarov/PlantEye
from time import time
def get_timestamp():
return int(round(time() * 1000)) | 1.734375 | 2 |
Game.py | KingJMS1/MathIA | 0 | 48422 | import os
import scipy
import numpy as np
from ImageStatistics import UsefulImDirectory
import scipy as sp
import ast
from bokeh.charts import Histogram, show
import pandas as pd
class Game(object):
def __init__(self, gamefolder):
self.gamefolder = os.path.abspath(gamefolder)
file = open(os.path.jo... | 2.65625 | 3 |
src/python/judger.py | pj1031999/nemesis-worker | 0 | 48423 | import argparse
import compile_sandbox
import default_nemesis_proto
import logging
import nemesis_pb2
import os
import runner
import shutil
import tempfile
class Judger(object):
def __init__(self, conf, logger):
self.conf = conf
self.logger = logger
self.checker_path = None
self.w... | 2.078125 | 2 |
plugins/fakeaction.py | FastmoreCrak/Fantasmas | 1 | 48424 | # Ultroid - UserBot
# Copyright (C) 2020 TeamUltroid
#
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
# PLease read the GNU Affero General Public License in
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
"""
✘ Commands Available -
• `{i}ftyping <time/in secs>`
`Show Fake ... | 2.1875 | 2 |
whatthefood/train/sgd.py | lychanl/WhatTheFood | 0 | 48425 | from whatthefood.train import Minimizer
class SGD(Minimizer):
def __init__(self, model, loss, lr=0.1, regularization=None):
super(SGD, self).__init__(model, loss, regularization)
self.lr = lr
def _run(self, grads, lr_decay=1., *args, **kwargs):
for v, g in zip(self.vars, grads):
... | 2.671875 | 3 |
QuakeAnssComCatRequester.py | KheprySoftware/PyQuakeAnssComCat | 0 | 48426 | # -*- coding: utf-8 -*-
# ========================================================================
#
# Copyright © <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.a... | 2.5625 | 3 |
interleaving/optimized.py | mpkato/interleaving | 107 | 48427 | from .ranking import CreditRanking
from .interleaving_method import InterleavingMethod
import numpy as np
from scipy.optimize import linprog
class Optimized(InterleavingMethod):
'''
Optimized Interleaving
Args:
lists: lists of document IDs
max_length: the maximum length of resultant inter... | 2.859375 | 3 |
Python/Single-Number/HashTable.py | Quananhle/Data-Structure-and-Algorithms | 5 | 48428 | from collections import defaultdict
class HashTable(object):
def singleNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
#initialize a hash table object
hash_table = defaultdict(int)
#for each num in list nums
for num in nums:
#... | 3.8125 | 4 |
static/test.py | phongchara/thesis | 0 | 48429 | import cv2
import numpy as np
cap = cv2.VideoCapture(0)
while True:
ret, frame = cap.read()
cv2.imshow('frame', frame)
cap.release()
cv2.destroyAllWindows() | 2.84375 | 3 |
StockSentimentAnalysis.py | udaydatar7/SSA | 0 | 48430 | # import key libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from wordcloud import WordCloud, STOPWORDS
import nltk
import re
from nltk.stem import PorterStemmer, WordNetLemmatizer
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize,... | 2.625 | 3 |
FixedEffectModel/OLSHighDCategory.py | ksecology/FixedEffectModel | 28 | 48431 | <gh_stars>10-100
from statsmodels.compat import lrange
from statsmodels.iolib import SimpleTable
from .DemeanDataframe import demean_dataframe,demeanonex
from .FormTransfer import form_transfer
from .OLSFixed import OLSFixed
from .RobustErr import robust_err
from .ClusterErr import *
from .CalDf import cal_df
from .Cal... | 2.140625 | 2 |
demo_python.py | PoseAI/PoseCameraAPI | 37 | 48432 | <gh_stars>10-100
'''
Authored by Pose AI Ltd, 2021
Simple demo of a UDP server for Pose Camera in python.
Once connected will receive stream of poses from the app
Apache License 2.0
'''
import socket
import json
PORT_NUM = 8080
''' Prints your local IP address. Configure this in the App.
Make sure your router... | 2.6875 | 3 |
flask_maple/log.py | honmaple/flask-maple | 9 | 48433 | <reponame>honmaple/flask-maple
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# **************************************************************************
# Copyright © 2016, 2017 jianglin
# File Name: log.py
# Author: jianglin
# Email: <EMAIL>
# Created: 2016-11-19 10:32:05 (CST)
# Last Update: Wednesday 2018-09-26 10:... | 2.328125 | 2 |
tensorflow/lite/python/util.py | yage99/tensorflow | 3 | 48434 | <gh_stars>1-10
# Lint as: python2, python3
# Copyright 2018 The TensorFlow 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses... | 1.367188 | 1 |
helpers/banner.py | Aayush9029/Authomator | 0 | 48435 | # pylint: skip-file
'''
Contains banner for the application.
'''
class COLORS:
RED = '\033[91m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
LINK = '\033[94m'
PURPLE = '\033[95m'
CYAN = '\033[96m'
PRIMARY = '\033[97m'
SECONDARY = '\033[90m'
END = '\033[0m'
PINK = '\033[95m'
banner ... | 2.84375 | 3 |
robustbench/model_zoo/models.py | flymin/robustbench | 2 | 48436 | <reponame>flymin/robustbench<gh_stars>1-10
from collections import OrderedDict
from typing import Any, Dict, OrderedDict as OrderedDictType
from robustbench.model_zoo.cifar10 import cifar_10_models
from robustbench.model_zoo.cifar100 import cifar_100_models
from robustbench.model_zoo.enums import BenchmarkDataset, Thr... | 1.765625 | 2 |
07/part2.py | adityachandak287/aoc-2021 | 0 | 48437 | import sys
import math
positions = [int(x) for x in sys.stdin.readline().strip().split(",")]
mean = sum(positions) / len(positions)
mUpper = math.ceil(mean)
mLower = math.floor(mean)
cost = {mUpper: 0, mLower: 0}
for pos in positions:
for m in [mUpper, mLower]:
diff = abs(pos - m)
cost[m] += (dif... | 2.640625 | 3 |
humfrey/update/templatetags/humfrey_update.py | ox-it/humfrey | 6 | 48438 | from django import template
register = template.Library()
@register.filter
def can_view(obj, user):
return obj.can_view(user)
@register.filter
def can_change(obj, user):
return obj.can_change(user)
@register.filter
def can_execute(obj, user):
return obj.can_execute(user)
@register.filter
def can_delete... | 1.984375 | 2 |
paleosites/apps.py | dennereed/paleocore | 1 | 48439 | <filename>paleosites/apps.py<gh_stars>1-10
from django.apps import AppConfig
class PaleositesConfig(AppConfig):
name = 'paleosites'
| 1.3125 | 1 |
701-800/771.JewelsAndStones.py | Arrackisarookie/leetcode | 0 | 48440 | #
# 771. Jewels and Stone
#
# You're given strings J representing the types of stones that are jewels, and
# S representing the stones you have.
#
# Each character in S is a type of stone you have. You want to know how many of
# the stones you have are also jewels.
#
# The letters in J are guaranteed distinct, and all ... | 3.828125 | 4 |
neo/api/utils.py | BarracudaPff/code-golf-data-pythpn | 0 | 48441 | from aiohttp import web
from aiohttp.web_response import ContentCoding
from functools import wraps
COMPRESS_FASTEST = 1
BASE_STRING_SIZE = 49
MTU_TCP_PACKET_SIZE = 1500
COMPRESS_THRESHOLD = MTU_TCP_PACKET_SIZE + BASE_STRING_SIZE
def json_response(func):
""" @json_response decorator adds header and dumps response objec... | 2.75 | 3 |
poll/forms.py | vishalpandeyvip/GURU--an-online-class-portal | 1 | 48442 | from django import forms
from .models import Poll, Choice
class QuestionForm(forms.ModelForm):
class Meta:
model = Poll
fields = ['topic','poll_details','who_can_vote','announce_at']
class PollUpdateForm(forms.ModelForm):
class Meta:
model = Poll
fields = ['topic','poll_details','announce_at']
class Choic... | 2.171875 | 2 |
utils/models/erfnet_encoder.py | voldemortX/DeeplabV3_PyTorch1.3_Codebase | 1 | 48443 | # modified from utils/models/segmentation/erfnet.py
# load pretrained weights during initialization of encoder
import torch
import torch.nn as nn
import torch.nn.functional as F
from .common_models import non_bottleneck_1d
from .builder import MODELS
class DownsamplerBlock(nn.Module):
def __init__(self, ninput,... | 2.515625 | 3 |
bilireq/utils/av_bv.py | SK-415/bilireq | 2 | 48444 | from typing import Union
table = "fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF"
tr = {}
for i in range(58):
tr[table[i]] = i
s = [11, 10, 3, 8, 4, 6]
xor = 177451812
add = 8728348608
def av2BV(aid: Union[int, str]) -> str:
aid = (aid ^ xor) + add
r = list("BV1 4 1 7 ")
for i in range(... | 2.796875 | 3 |
mdssdk/parsers/vsan/show_vsan.py | akshatha-s13/mdssdk | 4 | 48445 | <reponame>akshatha-s13/mdssdk<gh_stars>1-10
import logging
import re
log = logging.getLogger(__name__)
class ShowVsan(object):
def __init__(self, outlines, vsan_id=None):
self._all_vsans = []
self._group_dict = {}
self.vsan_id = vsan_id
self.process_all(outlines)
def process_... | 2.078125 | 2 |
magicmirror/tools/es/__init__.py | memirror/magicMirror | 5 | 48446 | # -*- coding: utf-8 -*-
# @Author: xiaodong
# @Date : 2021/5/27
from elasticsearch import Elasticsearch
from .question import ElasticSearchQuestion
from ...setting import ELASTICSEARCH_HOST
ElasticSearchQuestion.es = Elasticsearch(ELASTICSEARCH_HOST)
esq = ElasticSearchQuestion("mm_question")
| 1.601563 | 2 |
DSA/Python/src/dsa/lib/algo/sort/counting_sort/tests/test_counting_sort.py | JackieMa000/problems | 0 | 48447 | <filename>DSA/Python/src/dsa/lib/algo/sort/counting_sort/tests/test_counting_sort.py
from unittest import TestCase
from dsa.lib.algo.sort.counting_sort import counting_sort
class CountingSortTest(TestCase):
def test_sortInt(self):
nums = [1, 3, 2]
counting_sort.sortInt(nums)
self.assertEq... | 3.140625 | 3 |
mirari/TCS/migrations/0051_merge_20200210_1930.py | gcastellan0s/mirariapp | 0 | 48448 | # Generated by Django 2.0.5 on 2020-02-11 01:30
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('TCS', '0050_auto_20190918_1247'),
('TCS', '0050_auto_20191127_2331'),
]
operations = [
]
| 1.328125 | 1 |
sdk/python/pulumi_aws/elasticbeanstalk/get_solution_stack.py | lemonade-hq/pulumi-aws | 0 | 48449 | <reponame>lemonade-hq/pulumi-aws<filename>sdk/python/pulumi_aws/elasticbeanstalk/get_solution_stack.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
impo... | 1.96875 | 2 |
Tavan/old_04.py | vedgar/ip | 5 | 48450 | """Jednostavni SQL parser, samo za nizove CREATE i SELECT naredbi.
Ovaj fragment SQLa je zapravo regularan -- nigdje nema ugnježđivanja!
Semantički analizator u obliku name resolvera:
provjerava jesu li svi selektirani stupci prisutni, te broji pristupe.
Na dnu je lista ideja za dalji razvoj.
"""
from pj import ... | 2.4375 | 2 |
bsddb3/bsddb3-6.2.6/make3.py | mpwillson/spambayes3 | 1 | 48451 | #!/usr/bin/env python
"""
Copyright (c) 2008-2018, <NAME> <<EMAIL>>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list o... | 1.6875 | 2 |
pyTD/tests/unit/test_cache.py | kevmartian/pyTD | 16 | 48452 | # MIT License
# Copyright (c) 2018 <NAME>
# 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 the rights
# to use, copy, modify, merge, publish... | 1.90625 | 2 |
tests/test_tree.py | Schoyen/arbitrary-woodland | 0 | 48453 | <gh_stars>0
import numpy as np
import sklearn.datasets as skd
import sklearn.model_selection as skms
import sklearn.metrics as skm
import sklearn.tree as skt
from arbitrary_woodland.tree import DecisionTree
def test_decision_tree():
X, y = skd.load_breast_cancer(return_X_y=True)
X_train, X_test, y_train, y_... | 2.28125 | 2 |
TestModel/migrations/0001_initial.py | WenGeYJ/Mail-Master-in-School | 0 | 48454 | # -*- coding: utf-8 -*-
# Generated by Django 1.11a1 on 2017-05-11 08:37
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='allBoo... | 1.796875 | 2 |
world_creator/objects.py | lilSpeedwagon/zaWRka-project | 1 | 48455 | <gh_stars>1-10
#!/usr/bin/env python3
from data_structures import *
import copy
import logging as log
import converter
import math as m
from enum import Enum
import os
APP_VERSION = 1.0
class SignsTypes(Enum):
STOP = "stop sign"
ONLY_FORWARD = "only forward sign"
ONLY_RIGHT = "only right sign"
ONLY_LE... | 2.8125 | 3 |
theano/tensor/io.py | jsalvatier/Theano-1 | 0 | 48456 | <filename>theano/tensor/io.py
import numpy
import theano
from theano import gof
from theano.gof import Apply, Constant, Generic, Op, Type, Value, Variable
from basic import tensor
##########################
# Disk Access
##########################
class LoadFromDisk(Op):
"""
An operation to load an array from ... | 2.59375 | 3 |
mediasurvey/views_edit.py | shagun30/djambala-2 | 0 | 48457 | <reponame>shagun30/djambala-2<filename>mediasurvey/views_edit.py
#-*-coding: utf-8 -*-
"""
/dms/mediasurvey/views_edit.py
.. enthaelt den View zum Aendern der Eigenschaften eines Medien-Fragebogens
Django content Management System
<NAME>
<EMAIL>
Die Programme des dms-Systems koennen frei genutzt und den spe... | 1.75 | 2 |
file_path/proc_dup_files.py | daineseh/python_code | 0 | 48458 | #!/usr/bin/env python2
import os
import sys
def convert_bytes(bytes):
bytes = float(bytes)
if bytes >= 1099511627776:
terabytes = bytes / 1099511627776
size = '%.2fT' % terabytes
elif bytes >= 1073741824:
gigabytes = bytes / 1073741824
size = '%.2fG' % gigabytes
elif by... | 3.4375 | 3 |
test/features/util.py | shivam00/thrift | 2 | 48459 | <filename>test/features/util.py
import argparse
import socket
from local_thrift import thrift # noqa
from thrift.transport.TSocket import TSocket
from thrift.transport.TTransport import TBufferedTransport, TFramedTransport
from thrift.transport.THttpClient import THttpClient
from thrift.protocol.TBinaryProtoco... | 2.171875 | 2 |
nova/scheduler/weights/__init__.py | bopopescu/nova-token | 0 | 48460 | <reponame>bopopescu/nova-token
begin_unit
comment|'# Copyright (c) 2011 OpenStack Foundation'
nl|'\n'
comment|'# All Rights Reserved.'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl|'\n'
comment|'# not use this file except in compliance with the ... | 1.867188 | 2 |
nomad/api/allocations.py | shinespb/python-nomad | 0 | 48461 | from nomad.api.base import Requester
class Allocations(Requester):
"""
The allocations endpoint is used to query the status of allocations.
By default, the agent's local region is used; another region can be
specified using the ?region= query parameter.
https://www.nomadproject.io/docs/http/allo... | 2.609375 | 3 |
src/training/run_training_pipeline.py | IINemo/isanlp_srl_framebank | 20 | 48462 | import os
import sys
sys.path.append('../')
import fire
import pickle
import json
def run_command(command):
if os.system(command) != 0:
raise RuntimeError()
def work_with_one_model(cleared_corpus_path, ling_data, output_dir):
if not os.path.exists(output_dir):
os.mkdir(output_dir)
... | 2.46875 | 2 |
rvpvp/isa/rvv/vwmxxxx_vv.py | ultrafive/riscv-pvp | 5 | 48463 | from ...isa.inst import *
import numpy as np
class Vwmacc_vv(Inst):
name = 'vwmacc.vv'
# vwmacc.vv vd, vs1, vs2, vm
def golden(self):
if self['vl']==0:
return self['ori']
result = self['ori'].copy()
maskflag = 1 if 'mask' in self else 0
vstart = self['v... | 2.53125 | 3 |
example/tester/migrations/0001_initial.py | WenminZhao/django-reactive | 0 | 48464 | # Generated by Django 2.0.9 on 2018-12-08 12:25
from django.db import migrations, models
import django_reactive.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='TestModel',
fields=[
... | 1.71875 | 2 |
support/cross/aio/atexit.py | pmp-p/python-wasm-plus | 3 | 48465 | plan = []
def register(func, *args, **kwargs):
global plan
plan.append( (func,arg,kwargs,) )
def unregister(func):
global plan
todel = []
for i,elem in enumerate(plan)
if elem[0] is func:
todel.append(i)
while len(todel):
plan.pop( todel.pop() )
def exiting():
... | 2.703125 | 3 |
tracpro/orgs_ext/utils.py | rapidpro/tracpro | 5 | 48466 | <gh_stars>1-10
from __future__ import unicode_literals
class OrgConfigField(object):
"""
Allows setting and retrieving of a config field as if it were a normal
class attribute.
The result of the initial retrieval is cached on the object.
This avoids reloading the JSON-encoded config each time tha... | 2.765625 | 3 |
amla/common/schedule.py | tremblerz/amla | 118 | 48467 | <filename>amla/common/schedule.py
#Copyright 2018 Cisco Systems All Rights Reserved
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
#http://www.apache.org/licenses/LICENSE-2.0
#
#Unless requir... | 2.609375 | 3 |
tests/core_test.py | soft-r-evolution/lib.s_utils | 1 | 48468 | <filename>tests/core_test.py
from s_utils.dict import get_key
def test_no_log():
assert not get_key(None, None, no_log=1)
assert not get_key(None, None, no_log=True)
# should test log is empty
def test_log():
assert not get_key(None, None)
assert not get_key(None, None, no_log=0)
assert not ... | 2.203125 | 2 |
oslc_api/rest_api/representations.py | koneksys/aras-oslc | 3 | 48469 | <filename>oslc_api/rest_api/representations.py
from http.client import OK
from flask import make_response, request
from rdflib import Graph, Literal, URIRef, RDF
from rdflib.resource import Resource
from oslc_api.aras.namespaces import OSLC
representations = {
'json-ld': ['application/json', 'application/json+ld... | 2.609375 | 3 |
jinfo/sequence.py | JBwdn/jinfo | 0 | 48470 | from jinfo.tables import (
DNA_VOCAB,
RNA_VOCAB,
AA_VOCAB,
CODON_TABLE,
RC_TABLE,
NT_MW_TABLE,
AA_MW_TABLE,
)
class SeqVocabError(Exception):
pass
class SeqLengthError(Exception):
pass
class UnknownBaseError(Exception):
pass
class BaseSeq:
"""
Parent class for DNA... | 2.71875 | 3 |
pygame/platform-moving-up-down/main-2-class.py | whitmans-max/python-examples | 140 | 48471 | <filename>pygame/platform-moving-up-down/main-2-class.py
#!/usr/bin/env python3
# date: 2020.01.23
# https://stackoverflow.com/questions/59870590/collision-detection-ball-landing-on-platform
# Press SPACE to change player_gravity when it falls
import pygame
# --- constants --- (UPPER_CASE_NAMES)
SCREEN_WIDTH = 800... | 3.96875 | 4 |
Exercise 7: More Printing.py | EarthBeLost/Learning.Python | 0 | 48472 | print "Mary had a little lamb." # Prints "Mary had a little lamb."
print "It's fleece was white as %s." % 'snow' # Prints "It's fleece was white as snow."
print "And everywhere that Mary went." # Prints "And everywhere that Mary went."
print "." * 10 # What'd that do? I'm sure it prints full stop 10 times.
end1 = "C" ... | 4.03125 | 4 |
engine/manual_flappy_engine.py | OscarGarciaPeinado/flappy_bird | 5 | 48473 | # coding: utf-8
import pygame
from engine.flappy_engine import FlappyEngine
from entities.bird import Bird
class ManualFlappyEngine(FlappyEngine):
def __init__(self):
self.birds = [Bird(name="Manual")]
def get_birds(self):
return self.birds
def on_update(self, next_pipe_x, next_pipe_y)... | 3.03125 | 3 |
app/services/models/time_series.py | samelamin/kylinmonitorbot | 0 | 48474 | <reponame>samelamin/kylinmonitorbot
import json
import time
from services.lib.db import DB
BNB_SYMBOL = 'BNB.BNB'
BUSD_SYMBOL = 'BNB.BUSD-BD1'
USDT_SYMBOL = 'BNB.USDT-6D8'
RUNE_SYMBOL = 'BNB.RUNE-B1A'
BTCB_SYMBOL = 'BNB.BTCB-1DE'
ETHB_SYMBOL = 'BNB.ETH-1C9'
RUNE_SYMBOL_DET = 'RUNE-DET'
class TimeSeries:
def __i... | 2.0625 | 2 |
holobot/extensions/todo_lists/repositories/todo_item_repository.py | rexor12/holobot | 1 | 48475 | from .todo_item_repository_interface import TodoItemRepositoryInterface
from ..models import TodoItem
from asyncpg.connection import Connection
from holobot.sdk.database import DatabaseManagerInterface
from holobot.sdk.database.queries import Query
from holobot.sdk.database.queries.enums import Equality
from holobot.sd... | 2.421875 | 2 |
examples/id_pools_ipv4_ranges.py | LaudateCorpus1/oneview-python | 18 | 48476 | <reponame>LaudateCorpus1/oneview-python<filename>examples/id_pools_ipv4_ranges.py
# -*- coding: utf-8 -*-
###
# (C) Copyright [2021] 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 ... | 2.25 | 2 |
pikos/monitors/api.py | enthought/pikos | 3 | 48477 | <reponame>enthought/pikos
# -*- coding: utf-8 -*-
#----------------------------------------------------------------------------
# Package: Pikos toolkit
# File: monitors/api.py
# License: LICENSE.TXT
#
# Copyright (c) 2014, Enthought, Inc.
# All rights reserved.
#---------------------------------------------------... | 1.554688 | 2 |
deeppages/admin.py | ricardofalasca/deep-pages | 0 | 48478 | <gh_stars>0
from django.contrib import admin
from django.forms import Textarea
from django.db import models
from deeppages.models import Template, Page
@admin.register(Template)
class TemplateAdmin(admin.ModelAdmin):
fieldsets = (
('Identification', {
'fields': ('name', ),
}),
... | 2.015625 | 2 |
lists/main.py | olepunchy/hacker-rank-python-track | 0 | 48479 | #!/usr/bin/env python3
"""
Consider a list (list = []). You can perform the following commands:
insert i e: Insert integer e at position i.
print: Print the list.
remove e: Delete the first occurrence of integer e.
append e: Insert integer e at the end of the list.
sort: Sort the list.
pop: Pop the last element from ... | 4.59375 | 5 |
day01/part2.py | BaderSZ/adventofcode2020 | 0 | 48480 | <reponame>BaderSZ/adventofcode2020
arr = []
b = False
with open("input","r") as f:
for i in f.readlines():
arr = arr + [int(i.rstrip("\n"))]
length = len(arr)
for i in range(0,length):
for j in range(0,length):
for k in range(0,length):
if (arr[i]+arr[j]+arr[k] == 2020):
... | 3.046875 | 3 |
General.py | AllVides/DB_EDD_G9 | 0 | 48481 | <gh_stars>0
import MainG as j
# LLAMADA DE METODOS COMO EL EJEMPLO DEL INGE
print(j.createDatabase('db1')) # 0
print(j.createDatabase('db1')) # 2
print(j.createDatabase('db4')) # 0
print(j.createDatabase('db5')) # 0
print(j.alterDatabase('db5','db1')) # 3
print(j.alterDatabase('db5','db2')) # 0
p... | 3 | 3 |
nidaqmx/tests/test_write_exceptions.py | hboshnak/nidaqmx-python | 0 | 48482 | import collections
import re
import numpy
import pytest
import random
import time
import nidaqmx
from nidaqmx.constants import (
AcquisitionType, BusType, RegenerationMode)
from nidaqmx.error_codes import DAQmxErrors
from nidaqmx.utils import flatten_channel_string
from nidaqmx.tests.fixtures import x_series_devi... | 2.015625 | 2 |
example_contests/fk_2014_beta/problems/rod/data/secret/gen.py | ForritunarkeppniFramhaldsskolanna/epsilon | 6 | 48483 | <reponame>ForritunarkeppniFramhaldsskolanna/epsilon
import random
ts = [
(-1,-1),
(-1,-1),
(-1,-1),
(3,3),
(3,3),
(3,3),
(4,1),
(4,5),
(4,20),
(10,100),
(10,100),
(10,100),
(20,100),
(26,100),
(26,100),
(26,100),
(10, 'rev'),
(26, 'rev'),
]
for ... | 2.203125 | 2 |
convert.py | spookyahell/aax-to-audio-python | 0 | 48484 | import argparse
import json
import os
import re
import shutil
import subprocess
from pathlib import Path
"""
See https://wphelp365.com/blog/ultimate-guide-downloading-converting-aax-mp3/
on how to use.
Step 3 + 4 will get activation bytes.
Example:
python convert.py -i "The Tower of the Swallow.aax" -a xxxxxx
where... | 2.96875 | 3 |
sponge-integration-tests/examples/core/unordered_rules_instances.py | mnpas/sponge | 9 | 48485 | <gh_stars>1-10
"""
Sponge Knowledge Base
Unordered rules - instances
"""
from java.util.concurrent.atomic import AtomicInteger
def onInit():
# Variables for assertions only
sponge.setVariable("countAB", AtomicInteger(0))
sponge.setVariable("countA", AtomicInteger(0))
sponge.setVariable("max... | 2.625 | 3 |
django/AIST_survey/tests/test_choice_model.py | aistairc/voteclustering_aist | 0 | 48486 | <reponame>aistairc/voteclustering_aist<filename>django/AIST_survey/tests/test_choice_model.py
from django.test import TestCase
from AIST_survey.models import Choice
from .test_question_model import QuestionModelTests
class ChoiceModelTests(TestCase):
def test_is_empty(self):
saved_choices = Choice.objects... | 2.390625 | 2 |
src/leetcode_1998_gcd_sort_of_an_array.py | sungho-joo/leetcode2github | 0 | 48487 | <gh_stars>0
# @l2g 1998 python3
# [1998] GCD Sort of an Array
# Difficulty: Hard
# https://leetcode.com/problems/gcd-sort-of-an-array
#
# You are given an integer array nums,
# and you can perform the following operation any number of times on nums:
#
# Swap the positions of two elements nums[i] and nums[j] if gcd(nums... | 4.1875 | 4 |
callback/leehyunseob.py | SanghunOh/share_5GUAV_2021 | 0 | 48488 | def func():
pass
return
#file length check
if __name__ == '__main__':
try:
f = open('./testfile.txt', 'r') #1.file read -> open('')
length = len(f.read()) #2.length 설정
f.close() #... | 3.0625 | 3 |
tkp.py | Robin-mlh/TKPass | 1 | 48489 | <reponame>Robin-mlh/TKPass<filename>tkp.py
#!/usr/bin/python3
""" Password toolkit. """
import sys
import os
import getpass
import configparser
from secrets import randbelow # To use random cryptography.
import argparse # Module for the command line system.
import pyperclip # To copy and get the clipboard.
from ... | 2.890625 | 3 |
daze.py | JTechnologies/daze-tool | 1 | 48490 | <reponame>JTechnologies/daze-tool
#!/usr/bin/env python
import sys
import os
def split(delimiters, string, maxsplit=0):
import re
regexPattern = '|'.join(map(re.escape, delimiters))
return re.split(regexPattern, string, maxsplit)
def toHtml(input, outputPart="full"):
head=input.split("$content")[0]
bod... | 2.78125 | 3 |
gamenotify/gamenotify.py | flaree/CASE | 0 | 48491 | import logging
import discord
from redbot.core import Config, bank, commands
from redbot.core.utils.chat_formatting import escape, humanize_list, humanize_number, inline
log = logging.getLogger("red.flare.gamenotify")
class Gamenotify(commands.Cog):
"""Sub to game pings"""
__version__ = "0.0.1"
def fo... | 2.4375 | 2 |
obstacle.py | B3CTOR/runner-ursina-engine | 0 | 48492 | from ursina import *
from random import randint
class Obstacle(Entity):
def __init__(self, position, scale, model, texture, shader):
super().__init__(
model = model,
position = position,
scale = scale,
collider = 'box',
texture = texture,
eternal = True,
shader = shader,
)
... | 2.578125 | 3 |
glamkit_collections/contrib/work_creator/migrations/0030_auto_20170523_1243.py | ic-labs/glamkit-collections | 52 | 48493 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import edtf.fields
class Migration(migrations.Migration):
dependencies = [
('gk_collections_work_creator', '0029_auto_20170523_1149'),
]
operations = [
migrations.AddField(
... | 1.75 | 2 |
ControlSystem.py | towhidabsar/architecture-tactics | 0 | 48494 | import Reactor
import multiprocessing
import sys
from Queue import Empty
import random
import os
import time
'''
Class representing the control system for the nuclear reactor.
'''
class ControlSystem:
def __init__(self, reactor, receiver):
self.reactor = reactor
self.receiver = receiver
def ru... | 3.171875 | 3 |
predict.py | DavideA/deeplabv2-keras | 43 | 48495 | <filename>predict.py
import numpy as np
import matplotlib.pyplot as plt
import cv2
from utils import palette
from deeplabV2 import DeeplabV2
# predicts an image, with the cropping policy of deeplab (single scale for simplicity)
def predict(img, model, crop_size):
img = img.astype(np.float32)
h, w, c = img.... | 2.9375 | 3 |
ietf/api/__init__.py | MatheusProla/Codestand | 2 | 48496 | import re
import six
import datetime
from urllib import urlencode
from django.conf import settings
from django.http import HttpResponse
from django.core.exceptions import ObjectDoesNotExist
from django.urls import reverse
from django.utils.encoding import force_text
import debug # pyflakes:... | 2.078125 | 2 |
UnityEngine/MaterialGlobalIlluminationFlags/__init__.py | Grim-es/udon-pie-auto-completion | 0 | 48497 | <reponame>Grim-es/udon-pie-auto-completion<gh_stars>0
from UdonPie import UnityEngine
from UdonPie.Undefined import *
class MaterialGlobalIlluminationFlags:
def __new__(cls, arg1=None):
'''
:returns: MaterialGlobalIlluminationFlags
:rtype: UnityEngine.MaterialGlobalIlluminationFlags
... | 1.765625 | 2 |
kbench/deployment.py | keichi/kbench | 0 | 48498 | from kubernetes import client
from kubernetes.watch import Watch
from loguru import logger
from .consts import CONTAINER_NAME, DEPLOYMENT_PREFIX, NAMESPACE
def create_deployment(v1, image, num_replicas):
container = client.V1Container(name=CONTAINER_NAME, image=image)
container_spec = client.V1PodSpec(contai... | 2.1875 | 2 |
tests/test_spartan6/test_fdce.py | phanrahan/mantle | 33 | 48499 | import magma as m
from magma import DefineCircuit, EndCircuit, In, Out, Bit, Clock, wire
from magma.backend.verilog import compile
from mantle.xilinx.spartan6 import FDCE
def test_fdce():
main = DefineCircuit('main', 'I', In(Bit), "O", Out(Bit), "CLK", In(Clock))
dff = FDCE()
wire(m.enable(1), dff.CE)
... | 2.21875 | 2 |