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 |
|---|---|---|---|---|---|---|
Sample_Code/Problem_4.py | clarkbains/1405_Practice_Problems | 0 | 12783551 | <reponame>clarkbains/1405_Practice_Problems
while True:
print ("Please Select an option. Q to Quit")
print ("[1] - Add a course")
print ("[2] - Drop a course")
choice = input ("> ")
if choice == 'q' or choice == 'Q':
break
choice = int(choice)
if choice == 1:
print ("Enter Co... | 4.15625 | 4 |
xrpl/core/binarycodec/types/blob.py | SubCODERS/xrpl-py | 1 | 12783552 | """
Codec for serializing and deserializing blob fields.
See `Blob Fields <https://xrpl.org/serialization.html#blob-fields>`_
"""
from __future__ import annotations
from typing import Type
from xrpl.core.binarycodec.binary_wrappers.binary_parser import BinaryParser
from xrpl.core.binarycodec.exceptions import XRPLBin... | 2.75 | 3 |
za/minstData/showImage.py | hth945/pytest | 0 | 12783553 | <filename>za/minstData/showImage.py
#%%
import cv2
from cv2 import cv2
import numpy as np
import shutil
import os
import random
from PIL import Image
import matplotlib.pyplot as plt
rootPath = '..\..\dataAndModel\data\mnist\\'
ID = random.randint(0, 10)
label_txt = rootPath + 'objtrainlab.txt'
image_info = open(labe... | 2.84375 | 3 |
scripts/startup.py | red61/docker-nginx-loadbalancer | 91 | 12783554 | #!/usr/bin/python
'''
This script will be run on start-up to evaluate the Docker link environment
variables and automatically generate upstream and location modules for
reverse-proxying and load-balancing.
It looks for environment variables in the following formats:
<service-name>_<service-instance-id>_PORT_80_TCP_ADD... | 2.421875 | 2 |
flask_mongodb/serializers/meta.py | juanmanuel96/flask-mongodb | 0 | 12783555 | <reponame>juanmanuel96/flask-mongodb<filename>flask_mongodb/serializers/meta.py<gh_stars>0
from wtforms.meta import DefaultMeta
class SerializerMeta(DefaultMeta):
def render_field(self, field, render_kw):
"""
render_field allows customization of how widget rendering is done.
The default i... | 2.578125 | 3 |
blog/models.py | lokeshmeher/django-blogging-platform | 0 | 12783556 | from __future__ import unicode_literals
from django.utils.encoding import python_2_unicode_compatible
from django.db import models
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
import time
def user_media_path(instance, filename):
"""
Returns the path to where a use... | 2.21875 | 2 |
getresponse/__init__.py | OpenAT/getresponse-python | 3 | 12783557 | <gh_stars>1-10
from getresponse.client import GetResponse
from getresponse.excs import UniquePropertyError
| 1.34375 | 1 |
voctogui/voctogui.py | 0xflotus/voctomix | 521 | 12783558 | #!/usr/bin/env python3
import gi
# import GStreamer and GLib-Helper classes
gi.require_version('Gtk', '3.0')
gi.require_version('Gst', '1.0')
gi.require_version('GstVideo', '1.0')
gi.require_version('GstNet', '1.0')
from gi.repository import Gtk, Gdk, Gst, GstVideo
import signal
import logging
import sys
import os
sy... | 2.15625 | 2 |
setup.py | Soundphy/diapason | 1 | 12783559 | """
Setup module.
"""
import re
from os.path import join as pjoin
from setuptools import setup
with open(pjoin('diapason', '__init__.py')) as f:
line = next(l for l in f if l.startswith('__version__'))
version = re.match('__version__ = [\'"]([^\'"]+)[\'"]', line).group(1)
setup(
name='diapason',
vers... | 1.554688 | 2 |
0/divide_two_int.py | IronCore864/leetcode | 4 | 12783560 | class Solution(object):
def divide(self, dividend, divisor):
"""
:type dividend: int
:type divisor: int
:rtype: int
"""
maxint = 2147483647
if divisor == 0:
return maxint
if dividend == 0:
return 0
if divisor == 1:
... | 3.375 | 3 |
bin/tryprev.py | yafeng/nf-core-dda-quant-proteomics | 5 | 12783561 | #!/usr/bin/env python3
import os
import sys
from Bio import SeqIO
from Bio.Seq import Seq
def insilico_trypsinized(seq) :
segments = []
seg = []
for i in range(len(seq)) :
if seq[i] in ('K','R') :
if i == len(seq)-1 :
seg.append(seq[i])
elif seq[i+1] == 'P'... | 2.265625 | 2 |
python-algorithm/leetcode/problem_973.py | isudox/nerd-algorithm | 5 | 12783562 | <gh_stars>1-10
"""973. K Closest Points to Origin
https://leetcode.com/problems/k-closest-points-to-origin/
We have a list of points on the plane. Find the K closest points to the
origin (0, 0).
(Here, the distance between two points on a plane is the Euclidean distance.)
You may return the answer in any order. Th... | 3.8125 | 4 |
Intermediate/27/widget_examples.py | Matthew1906/100DaysOfPython | 1 | 12783563 | <reponame>Matthew1906/100DaysOfPython
from tkinter import *
window = Tk()
window.title("Widget Examples")
window.minsize(width = 500, height=400)
label = Label(text="This is a new text", font = ['Arial',12,'normal'])
button = Button(text="Click Me")
text_input = Entry()
text_input.insert(END, string = 'Some text to... | 3.609375 | 4 |
test/functional/test_payfac_legalEntity.py | Vantiv/payfac-mp-sdk-python | 1 | 12783564 | <filename>test/functional/test_payfac_legalEntity.py
import unittest
from payfacMPSdk import payfac_legalEntity, generatedClass, utils
from dateutil.parser import parse
class TestLegalEntity(unittest.TestCase):
def test_get_by_legalEntityId(self):
response = payfac_legalEntity.get_by_legalEntityId("100029... | 2.609375 | 3 |
pinnacle/resources/baseresource.py | leokan92/pinnacle-modified | 1 | 12783565 | <gh_stars>1-10
import datetime
import json
from ..compat import basestring, integer_types
class BaseResource(object):
"""
Data structure based on a becket resource
https://github.com/phalt/beckett
"""
class Meta:
identifier = 'id' # The key with which you uniquely ident... | 2.796875 | 3 |
macaca/locator.py | macacajs/wd.py | 35 | 12783566 | <reponame>macacajs/wd.py
#
# https://w3c.github.io/webdriver/webdriver-spec.html#locator-strategies
# Locator according to WebDriver Protocol
#
from enum import Enum
class Locator(Enum):
"""Locator Enum defined by WebDriver Protocol."""
ID = "id"
XPATH = "xpath"
LINK_TEXT = "link text"
PARTIAL_LI... | 2.84375 | 3 |
pycyqle/test/test_factory.py | brunolange/pycyqle | 0 | 12783567 | import re
import unittest
from functools import partial
from pycyqle.builder import dict_build, param_build
from pycyqle.factory import Component, Factory
class FactoryTest(unittest.TestCase):
def test_param_build(self):
factory = param_build(
Factory,
name='bicycle-... | 2.953125 | 3 |
pass.py | schaten/nut-snmp | 0 | 12783568 | <filename>pass.py
#!/usr/bin/python3
import sys
import subprocess
import syslog as log
class Subtree:
def __init__(self, top, data):
self.data = data
self.top = top
self.arr = []
for (i,key) in enumerate(self.data):
self.data[key]['index'] = i
self.arr.append... | 2.4375 | 2 |
app/lib/firebase/fcm.py | kwahome/pycon-monitoring-workshop | 7 | 12783569 | import firebase_admin
from firebase_admin import credentials, messaging
file_path = './pycon-monitoring-workshop-firebase-adminsdk.json'
cred = credentials.Certificate(file_path)
default_app = firebase_admin.initialize_app(cred)
def send_message(recipients, message, dry_run=False):
if not isinstance(recipients,... | 2.171875 | 2 |
test.py | Ji-Xinyou/DIP-proj-DepthEstimation | 0 | 12783570 | <gh_stars>0
'''
I/O:
Input: image to be inferenced
Output: depth image
Relation: out = model(in)
path -> readimg -> image -> transform -> tensor
tensor -> model
model: get model from get_model() in train.py, load_param from .pth file
model -> output tensor -> transpose to H x W x C -> i... | 2.59375 | 3 |
qoredl_project/qoredl-core/Global_client.py | qore-dl/qore-dl-code | 0 | 12783571 | from influxdb import InfluxDBClient
class Global_Influx():
Client_all = InfluxDBClient(host='172.16.20.190',port=8086,username='voicecomm',password='<PASSWORD>')
| 1.71875 | 2 |
modoboa_radicale/urls_api.py | Toniob/modoboa-radicale | 0 | 12783572 | <reponame>Toniob/modoboa-radicale<filename>modoboa_radicale/urls_api.py
"""Radicale urls."""
from rest_framework_nested import routers
from . import viewsets
router = routers.SimpleRouter()
router.register(
r"user-calendars", viewsets.UserCalendarViewSet,
base_name="user-calendar")
router.register(
r"sha... | 1.929688 | 2 |
custom-recipes/ClassifierTrain/recipe.py | dataiku/dss-plugin-nlp-crowlingo | 1 | 12783573 | <reponame>dataiku/dss-plugin-nlp-crowlingo
from PyCrowlingo.Errors import ModelNotFound
from dataiku.customrecipe import get_recipe_config
from utils import apply_func, get_client
text_column = get_recipe_config().get("text_column")
lang_column = get_recipe_config().get("lang_column")
class_id_column = get_recipe_conf... | 2.203125 | 2 |
sklearnTUT/mysample/svdtest.py | mwsssxu/tutorials | 0 | 12783574 | # -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as img
from sklearn.decomposition import TruncatedSVD
"""
打个比方说一张女人图片,我们如何判定这个女人是不是美女呢。我们会看比较关键的一些特征,比如说脸好不好看,胸好不好看,屁股怎么样,腿怎么样,至于衣服上是某个花纹还是手臂上有一个小痔还是,这些特征我们都是不关心的,就可以过滤掉。我们关心的是主成分,也就是对结果贡献系数较大的特征。SVD算法的作用就是来告诉你哪些特征是重要的,... | 2.9375 | 3 |
PreliminaryAnalysis/Exponential parameters through time/simulation.py | alfredholmes/cryptocurrency_data_analysis | 0 | 12783575 | from scipy.stats import uniform
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import minimize
from scipy.stats import exponweib
def calculate_parameters(interarrivals):
sample = np.array(interarrivals)
x = np.linspace(0, 1 - 1 / sample.shape[0], sample.shape[0])
x = x[sample > 0... | 2.75 | 3 |
complete-dsa/string/printDups.py | nishantml/Data-Structure-And-Algorithms | 0 | 12783576 | <reponame>nishantml/Data-Structure-And-Algorithms
def print_duplicates(str):
hash = dict()
for c in list(str):
if c not in hash:
hash[c] = 1
else:
hash[c] = hash[c] + 1
for i in hash:
if hash[i] > 1:
print(i)
print_duplicates('test')
| 3.84375 | 4 |
flask/wsgi.py | jSm449g4d/web_by_flask | 0 | 12783577 | # coding: utf-8
import sys
import os
import flask
from flask import redirect,request,render_template_string,render_template
from werkzeug.utils import secure_filename
import importlib
import zipfile
import threading
import random
from datetime import datetime
import pytz
import time
from sqlalchemy import... | 2.046875 | 2 |
workflow/migrations/0006_tolabookmarks.py | meetdatastory/Activity-CE | 0 | 12783578 | <reponame>meetdatastory/Activity-CE
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-12-05 03:11
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('workflow', '0005_auto_20... | 1.570313 | 2 |
scripts/utils.py | deez79/PYTH2 | 7 | 12783579 | <filename>scripts/utils.py
import json
import os
from datetime import datetime
# TODO: refactor the filename_parts bits...
def does_dir_path_exist(filename, dirname="Notes"):
filename_parts = filename.split('/')
newdir = "/".join(filename_parts[0:-1]+[dirname])
filename_name = filename_parts.pop().split(... | 2.859375 | 3 |
Chapter02/Activity2_01/Activity2_01.py | PacktWorkshops/The-Spark-Workshop | 7 | 12783580 |
from pyspark.sql import SparkSession
if __name__ == "__main__":
# input = sample_warc_loc
spark: SparkSession = SparkSession.builder \
.appName('Activity 2.1') \
.getOrCreate()
spark.sparkContext.setLogLevel('ERROR') # avoids printing of info messages
from operator import add
f... | 2.796875 | 3 |
grama/dfply/transform.py | natalia-rubio/py_grama | 0 | 12783581 | <reponame>natalia-rubio/py_grama
from .base import *
@dfpipe
def mutate(df, **kwargs):
"""
Creates new variables (columns) in the DataFrame specified by keyword
argument pairs, where the key is the column name and the value is the
new column value(s).
Args:
df (pandas.DataFrame): data pas... | 4.15625 | 4 |
crawler_magazine/crawlers/__init__.py | EvertonTomalok/magazine | 0 | 12783582 | from abc import ABC, abstractmethod
from crawler_magazine.downloader.asynchronous import AsyncDownloader
class CrawlerInterface(ABC):
def __init__(self, url):
self.url = url
self.downloader = AsyncDownloader()
async def get_page(self, url=None):
return await self.downloader.get(url o... | 3.234375 | 3 |
model/device.py | Rubber-Duck-999/HouseGuard-StatusApi | 0 | 12783583 | import pymysql, json
from model.sql import Connection
class DeviceModel():
def create_device(self, allowed, blocked, unknown):
sql = "INSERT INTO `device` (`allowed_devices`, `blocked_devices`, `unknown_devices`) VALUES (%s, %s, %s)"
values = (allowed, blocked, unknown)
conn = Connection()... | 2.796875 | 3 |
freeldep/cloud/aws/validate.py | MatthieuBlais/freeldep | 0 | 12783584 | import os
import subprocess
import uuid
class CfnStackValidation:
@classmethod
def validate_config(cls, config):
"""Validate section of the stack config"""
if "aws" not in config:
raise KeyError("aws is required in a stack definition")
else:
cls._validate_aws_co... | 2.453125 | 2 |
src/studio2021/functions/geometry.py | Design-Machine-Group/studio2021 | 1 | 12783585 | from __future__ import print_function
from math import fabs
from math import sqrt
__author__ = ["<NAME>"]
__copyright__ = "Copyright 2020, Design Machine Group - University of Washington"
__license__ = "MIT License"
__email__ = "<EMAIL>"
__version__ = "0.1.0"
def midpoint_point_point(a, b):
return [0.5 * (a[0] ... | 3.203125 | 3 |
utils/db_api/db_commands.py | KARTASAR/DatingBot | 12 | 12783586 | <reponame>KARTASAR/DatingBot<filename>utils/db_api/db_commands.py
from django_project.telegrambot.usersmanage.models import User
from asgiref.sync import sync_to_async
@sync_to_async
def select_user(telegram_id: int):
user = User.objects.filter(telegram_id=telegram_id).first()
return user
@sync_to_async
def... | 2.203125 | 2 |
Define_Projection_of_SHAPEFILES_in_folder.py | mcfoi/arcpy-toolbox | 3 | 12783587 | # -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# Defin_Projection_GB_for_folder.py
# Created on: 2015-04-04 12:22:48.00000
# (generated by ArcGIS/ModelBuilder)
# Description:
# ---------------------------------------------------------------------------
# Import ... | 2.125 | 2 |
applications/SwimmingDEMApplication/python_scripts/derivative_recovery/standard_recoverer.py | AndreaVoltan/MyKratos7.0 | 2 | 12783588 | <filename>applications/SwimmingDEMApplication/python_scripts/derivative_recovery/standard_recoverer.py
from __future__ import print_function, absolute_import, division # makes KratosMultiphysics backward compatible with python 2.6 and 2.7
# importing the Kratos Library
from KratosMultiphysics import *
from KratosMulti... | 2.09375 | 2 |
fe_utils/cluster.py | ml-pipes/future_engineering_utils | 0 | 12783589 | <reponame>ml-pipes/future_engineering_utils
# AUTOGENERATED! DO NOT EDIT! File to edit: 00_cluster.ipynb (unless otherwise specified).
__all__ = ['load_embedding', 'BayesClusterTrainer']
# Cell
from functools import partial
import hdbscan
from hyperopt import hp
from hyperopt import fmin, tpe, space_eval
from hyperop... | 1.992188 | 2 |
sampledb/logic/schemas/validate.py | FlorianRhiem/sampledb | 0 | 12783590 | # coding: utf-8
"""
Implementation of validate(instance, schema)
"""
import re
import datetime
import typing
from ...logic import actions, objects, datatypes
from ..errors import ObjectDoesNotExistError, ValidationError, ValidationMultiError
from .utils import units_are_valid
def validate(instance: typing.Union[dic... | 3.078125 | 3 |
app/forms.py | ruppatel115/Local_Music | 0 | 12783591 | <gh_stars>0
from flask_wtf import FlaskForm, Form
from wtforms import StringField, PasswordField, BooleanField, SubmitField, DateField, SelectField, SelectMultipleField, \
TextAreaField
from wtforms.validators import ValidationError, DataRequired, Email, EqualTo
from app.models import User,Artist, Venue, Event, Art... | 2.796875 | 3 |
Heuristic based Approaches/Path Scanning Algorithm/path_scanning.py | Eashwar-S/Icy_Road_Project | 0 | 12783592 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
import time
# In[2]:
def createGraph(depotNodes ,requiredEdges, numNodes, show=True):
G = nx.Graph()
edges = []
pos = {}
reqPos = {}
s = [1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 6, 7]... | 3.046875 | 3 |
2to3/fix_reload.py | joulez/Limnoria | 1 | 12783593 | <filename>2to3/fix_reload.py
# Based on fix_intern.py. Original copyright:
# Copyright 2006 <NAME>.
# Licensed to PSF under a Contributor Agreement.
"""Fixer for intern().
intern(s) -> sys.intern(s)"""
# Local imports
from lib2to3 import pytree
from lib2to3 import fixer_base
from lib2to3.fixer_util import Name, Attr... | 2.015625 | 2 |
bncbot/event.py | TotallyNotRobots/bnc-bot | 3 | 12783594 | <filename>bncbot/event.py
# coding=utf-8
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from asyncirc.irc import ParamList, Message
from bncbot.bot import Command
from bncbot.conn import Conn
class Event:
def __init__(self, *, conn: 'Conn' = None, base_event: 'Event' = None,
nic... | 2.40625 | 2 |
checkmetadata.py | jkalkhof/MediaServer | 0 | 12783595 | import ffmpy, subprocess, json
import argparse
def main():
# Globals in Python are global to a module, not across all modules.
# global validDatesDict
# global stripDates
# TODO: use command line parameters to determine path to scan
# https://stackabuse.com/command-line-arguments-in-python/
... | 2.484375 | 2 |
sb3/querys.py | himalshakya1/sciencebasepy | 0 | 12783596 |
import json
meQuery = """
me {
username
myFolderExists
myFolder {
id
}
roles
}
"""
# createUploadSession({itemIdStr}, files : [{{ {filenameStr}, {fileContentType}}}]){{
def createUploadSessionQuery(itemStr, itemIdStr, filenameStr, fileContentType)... | 2.296875 | 2 |
worker/plugins/levels.py | NepStark/mee6 | 43 | 12783597 | <filename>worker/plugins/levels.py<gh_stars>10-100
from random import randint
from plugins.base import Base
from collections import defaultdict
from utils import fmt
from copy import copy
XP_REWARD_RANGE = (15, 25)
COOLDOWN_DURATION = 60
lvls_xp = [5*(i**2)+50*i+100 for i in range(200)]
def get_level_from_xp(xp):
... | 2.125 | 2 |
src/Observer/FileObserver.py | TheNexusAvenger/ROCKPro64-Fan-Controller | 1 | 12783598 | <gh_stars>1-10
"""
TheNexusAvenger
Observes changes to files and handles IO operations.
"""
import threading
import time
import os
from Observer import Observer
"""
Class representing a file observer.
"""
class FileObserver(Observer.Observable):
"""
Creates a file observer object.
"""
def __init__(... | 3.21875 | 3 |
app/globus_portal_framework/tests/test_utils.py | dbmi-pitt/aurora-meta | 0 | 12783599 | from unittest import mock
from django.test import TestCase
from django.contrib.auth.models import AnonymousUser
import globus_sdk
from globus_portal_framework.utils import load_globus_client
from globus_portal_framework.tests.mocks import (
MockGlobusClient, mock_user, globus_client_is_loaded_with_authorizer
)
... | 2.265625 | 2 |
ripiu/cmsplugin_articles/apps.py | ripiu/cmsplugin_articles | 0 | 12783600 | from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class ArticlesConfig(AppConfig):
name = 'ripiu.cmsplugin_articles'
verbose_name = _('Articles and sections')
| 1.414063 | 1 |
tests/test_downloader.py | codeasap-pl/asyncio-crawler | 0 | 12783601 | from crawler import Downloader, DownloaderError, Worker
from .testing import WorkerTestCase, FakeApp
import asyncio
import aiohttp
from urllib.parse import urljoin
class DownloaderTestCase(WorkerTestCase):
def setUp(self):
super().setUp()
# reset class attribute
Downloader.SEQ_ID = 0
... | 2.546875 | 3 |
hebert-sentiment-analysis-inference-docker-lambda/app/app.py | shneydor/aws-lambda-docker-serverless-inference | 0 | 12783602 | from transformers import pipeline
import json
sentiment_analysis = pipeline(
"sentiment-analysis",
model="./model",
tokenizer="./model",
return_all_scores = True
)
def handler(event, context):
print('Received event: ' + json.dumps(event, indent=2))
hebrew_text = event['hebrew_text']
resu... | 2.640625 | 3 |
tscreensvr.py | ninadmhatre/tweet2image | 1 | 12783603 | from draw_image import make_image
from twitter_interface import get_twitter_api, fetch_statues
from config import TWITTER_HANDLERS
def run():
api = get_twitter_api()
for handler in TWITTER_HANDLERS:
statues, user = fetch_statues(api, handler, count=20)
for status in statues:
make... | 2.6875 | 3 |
language/python/DeepNudeImage/DCGAN/dcgan_model.py | LIU2016/Demo | 1 | 12783604 | <reponame>LIU2016/Demo
import tensorflow as tf
import matplotlib.pyplot as plt
class Generator(tf.keras.Model):
def __init__(self):
super(Generator, self).__init__()
self.fc_a = tf.keras.layers.Dense(53 * 43 * 128, use_bias=False)
self.Conv2DT_a = tf.keras.layers.Conv2DTranspose(128, (5, ... | 2.59375 | 3 |
sniffing/http-password-sniffer.py | imsouza/pentest-tools | 0 | 12783605 | <gh_stars>0
from scapy.all import *
def print_packages(package):
header = str(package[TCP].payload[0:4])
if header == 'POST':
if 'pass' in str(package[TCP].payload).lower():
print package[TCP].payload
sniff(filter='port 80',store=0, prn=print_packages)
| 2.328125 | 2 |
pydatajson/status_indicators_generator.py | datosgobar/pydatajson | 13 | 12783606 | # -*- coding: utf-8 -*-
from pydatajson.readers import read_catalog
from pydatajson.reporting import generate_datasets_summary
from pydatajson.validators\
.distribution_download_urls_validator \
import DistributionDownloadUrlsValidator
class StatusIndicatorsGenerator(object):
def __init__(self, catalog,... | 2.375 | 2 |
Leetcode/Python/_169.py | Xrenya/algorithms | 1 | 12783607 | class Solution:
def majorityElement(self, nums: List[int]) -> int:
vote = 0
result = None
n = len(nums) // 2
for num in nums:
if vote == 0:
result = num
if result == num:
vote += 1
if vote > n:
... | 3.4375 | 3 |
tests/conftest.py | SuperBOY000/escape_roomba | 1 | 12783608 | <gh_stars>1-10
"""Shared configuration for unit tests:
docs.pytest.org/en/stable/fixture.html#conftest-py-sharing-fixture-functions.
"""
import argparse
import logging
from copy import copy
import discord
import pytest
import regex
from escape_roomba.format_util import fobj
import escape_roomba.context
logger_ = lo... | 2.25 | 2 |
pcdet/version.py | tuanho27/OpenPCDet | 0 | 12783609 | __version__ = "0.2.0+1e2b0ad"
| 1.046875 | 1 |
Z - TrashCode/algo1.py | khanfarhan10/100DaysofDSAAdvanced | 2 | 12783610 | """
cd G:\GitLab\pdf_extraction\ModularInsurance
python algo1.py
"""
import sys
import random
sys.setrecursionlimit(1500)
print(sys.getrecursionlimit())
def merge_sort(arr,n=None,pivot_index=None):
"""Returns sorted array"""
n = len(arr) if n is None else n
if n==1:
return arr
if n==2:
... | 3.09375 | 3 |
tools/unit_test/iter_next.py | HAOCHENYE/yehc_mmdet | 1 | 12783611 | class A(object):
def __init__(self):
self.array = [1, 2, 3]
self.index = 0
def __iter__(self):
return self
def __next__(self):
self.index += 1
return self.array[self.index]
x = A()
iter
print(next(x)) | 3.71875 | 4 |
Beginner_Day_1_14/Day5/Exc4/main.py | fredtheninja/100-Days-of-Code | 0 | 12783612 | <reponame>fredtheninja/100-Days-of-Code
#Write your code below this row 👇
for number in range(1,101):
if number%3 == 0 and number%5 == 0:
print("FizzBuzz")
elif number%3 == 0:
print("Fizz")
elif number%5 == 0:
print("Buzz")
else:
print(number) | 4 | 4 |
function_examples.py | dipakbari4/PythonExercises | 0 | 12783613 | def printMyName(name):
print("Hello", name)
printMyName("Dipak")
| 2.53125 | 3 |
LeetCode/Python/1295. Find Numbers with Even Number of Digits #2.py | rayvantsahni/Competitive-Programming-Codes | 1 | 12783614 | class Solution:
def numLength(self, n):
count = 0
while n:
n //= 10
count += 1
return count
def findNumbers(self, arr: List[int]) -> int:
count = 0
for a in arr:
if not self.numLength(a) & 1:
count += 1
... | 3.421875 | 3 |
magmap/tests/unit_testing.py | clifduhn/magellanmapper | 0 | 12783615 | <reponame>clifduhn/magellanmapper
# MagellanMapper unit testing
# Author: <NAME>, 2018, 2020
"""Unit testing for the MagellanMapper package.
"""
import unittest
from magmap.cv import stack_detect
from magmap.io import cli
from magmap.io import importer
from magmap.settings import config
TEST_IMG = "test.czi"
class... | 2.109375 | 2 |
motutils/bbox_mot.py | smidm/motutils | 1 | 12783616 | import numpy as np
import pandas as pd
import xarray as xr
from shape import BBox
from .mot import Mot
class BboxMot(Mot):
def __init__(self, **kwargs):
"""
Ground truth stored in xarray.Dataset with frame and id coordinates (frames are 0-indexed).
Example:
<xarray.Dataset>
... | 2.71875 | 3 |
filter_vulnerabilities.py | Thomas-Neumann/wiz-io-tools | 0 | 12783617 | #!/usr/bin/env python3
#
# filter out known vulnerabilities from wiz.io vulnerability report
#
# ./filter_vulnerabilities.py <report_file1> [<report_file2> ...]
#
# usage:
# ./filter_vulnerabilities.py data/vulnerability-reports/1644573599308653316.csv
# ./filter_vulnerabilities.py file1.csv file2.csv
# input fi... | 2.078125 | 2 |
custom_components/magic_lights/const.py | justanotherariel/hass_MagicLights | 0 | 12783618 | DOMAIN = "magic_lights"
| 1.117188 | 1 |
ptb_data/preprocessing.py | windweller/nlplab | 0 | 12783619 | <gh_stars>0
"""
Preprocess ptb.train.txt
into train.x.txt and train.y.txt type
that can be load into NLCEnv
We also prepare 10 characters and 30 characters version
like in AC paper
"""
import os
import numpy as np
import string
import random
import re
_WORD_SPLIT = re.compile(b"([.,!?\"':;)(])")
def basic_tokeniz... | 2.8125 | 3 |
CarlaScripts/new_static_cam_2veh_sem_go.py | ayushjain1144/SeeingByMoving | 13 | 12783620 | from subprocess import Popen, PIPE, STDOUT
import shlex
import time
import sys
import psutil
import os, signal
mod = 'aa' # first good moving camera data generated with carla version 0.97
mod = 'test' # 100 views
#mod = 'ab' # 88 views, yaw 0 to 359nes - 5 sceenes test
mod = 'ac' # 51 views, yaw 0 to 359 - 10 scenes... | 1.9375 | 2 |
envisage/ui/action/i_action_manager_builder.py | anshsrtv/envisage | 0 | 12783621 | # (C) Copyright 2007-2020 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at... | 1.875 | 2 |
src/py-entry-central/nightjar_central/tests/generate_test.py | groboclown/nightjar-mesh | 3 | 12783622 | <reponame>groboclown/nightjar-mesh
"""
Test the generate module.
"""
from typing import List, Dict, Optional, Any
import unittest
import os
import platform
import shutil
import json
from .. import generate
from ..config import (
Config,
ENV__DATA_STORE_EXEC, ENV__DISCOVERY_MAP_EXEC,
)
class GenerateDataImpl... | 2.28125 | 2 |
main.py | Inspirateur/fm-helper | 2 | 12783623 | import dofus_protocol as dp
from fm_state import FMState
def packet_handle(pkt: dp.DofusPacket):
state.update(pkt)
state = FMState()
listener = dp.DofusListener(packet_handle)
| 1.90625 | 2 |
object_generator/object_generator.pyde | aditikhare33/generative_art | 1 | 12783624 | w = 800
h = 800
blue = "#1380FF"
yellow = "#F8E500"
red = "#F40000"
green = "#2ABA00"
colors = [blue, red, green, yellow]
#curr_color = colors[int(random(0, len(colors)))]
curr_color = 255
incr = 0.1
recent_window = 3.0/incr
bgColor = 255
def setup():
size(w, h)
background(bgColor)
t_x = random(0, 100)
t... | 2.75 | 3 |
signup/models.py | PingaxAnalytics/koob_beta | 0 | 12783625 | # This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# * Make sure each ForeignKey has `on_delete` set to the desired behavior.
# * Remove `managed = False` lines if ... | 2.0625 | 2 |
src/genie/libs/parser/iosxr/tests/ShowSpanningTreePvrsTag/cli/equal/golden_output_expected.py | balmasea/genieparser | 204 | 12783626 |
expected_output = {
'pvrstag': {
'foo': {
'domain': 'foo',
'interfaces': {
'GigabitEthernet0/0/0/0': {
'interface': 'GigabitEthernet0/0/0/0',
'vlans': {
'5': {
'preempt_delay... | 1.671875 | 2 |
Chapter09/filepickle2.py | kaushalkumarshah/Learn-Python-in-7-Days | 12 | 12783627 | import pickle
pickle_file = open("emp1.dat",'r')
name_list = pickle.load(pickle_file)
skill_list =pickle.load(pickle_file)
print name_list ,"\n", skill_list | 2.84375 | 3 |
saas/tests/biz/policy_tests.py | nannan00/bk-iam-saas | 0 | 12783628 | from typing import List
import pytest
from backend.biz.policy import InstanceBean, InstanceBeanList, PathNodeBean, PathNodeBeanList
from backend.common.error_codes import APIException
from backend.service.models import PathResourceType, ResourceTypeDict
from backend.service.models.instance_selection import InstanceSe... | 2.0625 | 2 |
fileshare/models.py | bwelch21/secure-file-share | 0 | 12783629 | <reponame>bwelch21/secure-file-share
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
# Create your models here.
class Profile(models.Model):
# Django automatically creates a primary key ID... No need to cr... | 2.484375 | 2 |
Robot Code/autonomous/driveForwards.py | cboy116/Team-4480-Code-2018 | 4 | 12783630 | from robotpy_ext.autonomous import StatefulAutonomous, timed_state, state
class DriveForward(StatefulAutonomous):
DEFAULT = False
MODE_NAME = 'Drive Forward'
def initialize(self):
self.drive.setAutoSetpoint(696.75*10.5*12)
@timed_state(duration=0.5, next_state='drive_forward', first=True... | 2.8125 | 3 |
stored/backends/local.py | triagemd/stored | 3 | 12783631 | import os
import shutil
class LocalFileStorage(object):
def __init__(self, path):
self.path = path
self.filename = os.path.basename(path)
def list(self, relative=False):
matches = []
for root, dirnames, filenames in os.walk(self.path):
for filename in filenames:
... | 3.21875 | 3 |
api/views.py | Luanlpg/favorites_list | 0 | 12783632 | <gh_stars>0
from django.shortcuts import render
from django.http import Http404
from .utils import EmailService
from .serializer import ClientSerializer
from .serializer import UserSerializer
from .serializer import FavoriteSerializer
from .serializer import FavoriteIdSerializer
from .models import UserModel
from .m... | 2.125 | 2 |
anuga/file_conversion/sts2sww_mesh.py | GeoscienceAustralia/anuga_core | 136 | 12783633 | from __future__ import print_function
from __future__ import division
from builtins import range
from past.utils import old_div
import os
import numpy as num
from anuga.file.netcdf import NetCDFFile
import pylab as P
import anuga
from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular
from anuga.shallow_... | 1.929688 | 2 |
web/backend/app/resources.py | pascalpoizat/fbpmn | 27 | 12783634 | from flask import request
from flask_restplus import Resource, fields, Namespace
from app import db
from app.models import Application, Constraints, CounterExample, Model, Result, UserNets, UserProps, \
Verification, get_workdir
from app.schemas import CounterExampleSchema, ModelSchema, ResultSchema, VerificationSc... | 2.265625 | 2 |
can_tools/scrapers/official/PA/philadelhpia_vaccine.py | christopherturner/can-scrapers | 7 | 12783635 | import json
import pandas as pd
from us import states
from bs4 import BeautifulSoup
import urllib.parse
import json
from can_tools.scrapers import variables
from can_tools.scrapers.official.base import TableauDashboard
from can_tools.scrapers.util import requests_retry_session
class PhiladelphiaVaccine(TableauDashbo... | 2.859375 | 3 |
tests/test_toml_sort.py | kasium/toml-sort | 34 | 12783636 | <reponame>kasium/toml-sort
"""Test the toml_sort module."""
from toml_sort import TomlSort
def test_sort_toml_is_str() -> str:
"""Take a TOML string, sort it, and return the sorted string."""
sorted_result = TomlSort("[hello]").sorted()
assert isinstance(sorted_result, str)
| 2.75 | 3 |
GUI/Basic-train/Multi-Thread/MWE.py | muyuuuu/PyQt-learn | 12 | 12783637 | import sys, time
from PyQt5.QtWidgets import QMainWindow, QWidget, QHBoxLayout, QApplication, QPushButton
class mainwindow(QMainWindow):
def __init__(self):
super(mainwindow, self).__init__()
layout = QHBoxLayout()
w = QWidget()
w.setLayout(layout)
self.setCentralWidget(w)... | 2.828125 | 3 |
rbldap/commands/enable.py | butlerx/rb-ldap-python | 0 | 12783638 | """enable command"""
from ldap3 import MODIFY_REPLACE
from ..accounts.clients import LDAPConnection
async def enable(rb_client: LDAPConnection, commit: bool, username: str) -> int:
"""
Renable a Users LDAP Account
Args:
rb_client: ldap client configured for redbrick ldap
commit: flag to... | 2.46875 | 2 |
LEVEL1/키패드누르기/solution.py | seunghwanly/CODING-TEST | 0 | 12783639 | <reponame>seunghwanly/CODING-TEST
def solution(numbers, hand):
answer = ''
pad = [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9'], ['*', '0', '#']]
# [y][x]
leftCurr = [3, 0]
rightCurr = [3, 2]
for number in numbers:
for idx, line in enumerate(pad):
if str(number) in line... | 3.453125 | 3 |
ReverseWordsInAString.py | adesh-gadge/LeetCodePractice | 0 | 12783640 | <gh_stars>0
class Solution(object):
def reverseWords(self, s):
"""
:type s: str
:rtype: str
"""
ans=''
words=s.split()
for i in range(len(words)):
ans+=words[len(words)-1-i]
if i!=len(words)-1:
ans+=' '
... | 3.296875 | 3 |
src/book.py | psikon/pitft-scripts | 0 | 12783641 | <filename>src/book.py<gh_stars>0
class Book:
'''class for storing all relevant informations for playing a audio book and
show informations in the interfaces. The seperated chapter of audio books are
stored together for ensure an unbroken playback'''
def __init__(self, path, title, artist, album, chapte... | 3.5625 | 4 |
scripts/tweetsearch.py | xytosis/dataworx | 6 | 12783642 | # Class to store tweet information
import oauth2
import urllib2
import json
import sys
class Tweet:
def __init__(self, date, idd, text, username, location):
self.date = date
self.id = idd
self.text = text.replace("\n", " ")
self.username = username.replace("\n", " ")
self.lo... | 3.359375 | 3 |
src/tests/decision_tree_test.py | kafkasl/cart_and_random_forests | 0 | 12783643 | import os
import sys
import unittest
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from decision_tree import *
from decision_tree import DecisionTree
class DecisionTreeTests(unittest.TestCase):
def test_read_data(self):
result_data = [['FALSE', 'high', 'hot', 'sunn... | 2.71875 | 3 |
tts/setup.py | aws-robotics/tts-ros2 | 8 | 12783644 | <filename>tts/setup.py
from setuptools import find_packages
from setuptools import setup
package_name = 'tts'
setup(
name=package_name,
version='2.0.2',
packages=find_packages(exclude=['test']),
data_files=[
('share/ament_index/resource_index/packages',
['resource/' + package_name]... | 1.429688 | 1 |
services/Baseline_Approach/cells_lookup_strategies/all_tokens.py | muhammad-abbady/JenTab | 9 | 12783645 | <gh_stars>1-10
import itertools
from config import MAX_TOKENS, AllToken_priority, CLEAN_CELL_SEPARATOR
from utils.util import load_stop_words
from cells_lookup_strategies.strategy import *
class AllTokensLookup(CellsStrategy):
def __init__(self):
CellsStrategy.__init__(self, name='allTokens', priority=A... | 2.71875 | 3 |
xpath_blindeye/retrieve.py | OnBloom/xpath-blindeye | 2 | 12783646 | import os
import hashlib
import logging
import traceback
from typing import Union
from xml.etree.ElementTree import Element, SubElement, parse, ElementTree
from xpath_blindeye.xnode import XNode
from xpath_blindeye.util import prettify
from xpath_blindeye.config import ROOT_PATH, URL
logger = logging.getLogger("xpath... | 2.53125 | 3 |
src/python/pants/backend/scala/bsp/rules.py | danxmoran/pants | 0 | 12783647 | <filename>src/python/pants/backend/scala/bsp/rules.py
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import logging
import textwrap
from dataclasses import dataclass
from pathlib import Path
from typi... | 1.53125 | 2 |
src/cogs/commands.py | thekraftyman/discord-bot-starter | 0 | 12783648 | <gh_stars>0
# commands.py
# By: thekraftyman
# import packages
import discord
from discord.ext import commands
from src.lib.core_funcs import *
from random import choice
import subprocess
import asyncio
import random
import json
import os
class Bot_Commands(commands.Cog):
def __init__(self,client):
self.c... | 2.8125 | 3 |
statistic_scripts/job_arrival_graph.py | lfdversluis/wta-tools | 3 | 12783649 | <reponame>lfdversluis/wta-tools<filename>statistic_scripts/job_arrival_graph.py<gh_stars>1-10
import math
import os
import matplotlib
from matplotlib.ticker import ScalarFormatter
from pyspark.sql import SparkSession
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from sortedcontainers import SortedDict
class... | 2.421875 | 2 |
test_libs/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_crosslinks.py | prestonvanloon/eth2.0-specs | 1 | 12783650 | from copy import deepcopy
from eth2spec.test.context import spec_state_test, with_all_phases
from eth2spec.test.helpers.state import (
next_epoch,
next_slot
)
from eth2spec.test.helpers.block import apply_empty_block
from eth2spec.test.helpers.attestations import (
add_attestation_to_state,
fill_aggreg... | 2.03125 | 2 |