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 |
|---|---|---|---|---|---|---|
docs/webapps/czat/views_z1.py | sokol02/python101 | 0 | 54700 | # -*- coding: utf-8 -*-
# czatpro/czat/views.py
from django.http import HttpResponse
def index(request):
"""Strona główna aplikacji."""
return HttpResponse("Witaj w aplikacji Czat!")
| 1.734375 | 2 |
projects/code_combat/7_Sarven_Desert/311-Bait_and_Switch/bait_and_switch.py | only-romano/junkyard | 0 | 54701 | <reponame>only-romano/junkyard
def collectUntil(enoughGold):
while hero.gold < enoughGold:
item = hero.findNearestItem()
if item:
hero.moveXY(item.pos.x, item.pos.y)
collectUntil(25)
hero.buildXY("decoy", 40, 52)
hero.moveXY(20, 52)
collectUntil(50)
hero.buildXY("decoy", 6... | 2.421875 | 2 |
pubdisk/forms.py | zhazh/Pubdisk | 1 | 54702 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
:author: Zhazh
:copyright: © 2020 Zhazh <<EMAIL>>
:license: MIT, see LICENSE for more details.
"""
from flask_wtf import FlaskForm
from wtforms import (StringField, PasswordField, BooleanField, SelectField, SelectMultipleField, RadioField,
IntegerField, Float... | 2.78125 | 3 |
django/platzigram/users/urls.py | sjvasconcello/dev_python | 0 | 54703 | <filename>django/platzigram/users/urls.py
"""Users URLs"""
# Django
from django.urls import path
# View
from users import views
urlpatterns = [
# Management
path(route="login/", view=views.LoginView.as_view(), name="login"),
path(route="logout/", view=views.LogoutView.as_view(), name="logout"),
path(... | 2.234375 | 2 |
lab/10_ultimate-dht-solution/dht/util.py | mfranzil/unitn-m-ds2 | 1 | 54704 | from hashlib import sha256
from bitstring import BitArray
import requests
import sys
import logging
BITLENGTH = 128
logging.basicConfig(level=logging.INFO, stream=sys.stdout)
logger = logging.getLogger(__name__)
def info(string):
print(string, flush=True)
# logger.info(string)
def compute_key(string, bi... | 2.734375 | 3 |
chad_finance/api/forms.py | StfnC/chad-finance | 0 | 54705 | from django import forms
from django.contrib.auth import password_validation
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
from django.contrib.auth.forms import ReadOnlyPasswordHashField
from .models import UserAccount
class UserAccountCreationForm(UserCreationForm):
"""
Formulaire po... | 2.78125 | 3 |
catcher_modules/service/__init__.py | anandsunderraman/catcher_modules | 79 | 54706 | import logging
logging.getLogger("elasticsearch").setLevel(logging.WARNING)
| 1.3125 | 1 |
release/scripts/startup/bl_operators/presets.py | 1-MillionParanoidTterabytes/Blender-2.79b-blackened | 2 | 54707 | # ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | 1.835938 | 2 |
goto/commands/add.py | technocake/goto | 10 | 54708 | # coding: utf-8
from __future__ import unicode_literals
from ..gotomagic.text import GotoError, GotoWarning
def help():
return "{0:10}{1:30}{2}".format('add','<magicword> <url or path>','Add shortcut')
def names():
return ['add','--add']
def run(magic, command, args, options):
"""
Add magicword
... | 2.4375 | 2 |
main.py | CDargis/igrill | 0 | 54709 | <filename>main.py
import os
from bluepy.btle import Scanner
from scan import DeviceForwardingDelegate
from persistence import DataPersistence
from igrill import IGrillHandler
from tokencube import TokenCubeHandler
device_settings = {
"70:91:8f:01:f7:30": {
"device": "iGrill Mini",
"addr": "70:91:8... | 2.25 | 2 |
ehPrintQueue/users/urls.py | raydodds/eh-print-queue | 0 | 54710 | <filename>ehPrintQueue/users/urls.py
#!python
# log/urls.py
from django.conf.urls import url
from . import views
from users.forms import LoginForm
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^home/$', views.home, name='home'),
url(r'^profile$', views.profile, name='profile'),
... | 2 | 2 |
seabird/checks.py | nicholas512/seabird | 38 | 54711 | <filename>seabird/checks.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Do a sequence of checks on the parsed CNV data
"""
| 1.296875 | 1 |
custom_rclone_webui/webui/templatetags/list_tags.py | huenique/custom-rclone-webui | 1 | 54712 | from django import template
register = template.Library()
@register.filter
def next(some_list, current_index):
"""
Returns the next element of the list using the current index if it exists.
Otherwise returns an empty string.
https://docs.djangoproject.com/en/3.0/howto/custom-template-tags/#writing-c... | 2.953125 | 3 |
metamatelib/metamatecache.py | rbauction/metamate | 0 | 54713 | <gh_stars>0
import glob
import os
import yaml
class MetamateCache:
""" Class to manage local cache """
ROOT_DIR_NAME = ".metamate"
def __init__(self, username):
self._username = username
self._root_dir = os.path.join(os.path.expanduser("~"), self.ROOT_DIR_NAME)
self._org_root_dir ... | 2.640625 | 3 |
home/hairygael/GESTURES/howmanyfingersdoihave.py | rv8flyboy/pyrobotlab | 63 | 54714 | def howmanyfingersdoihave():
ear.pauseListening()
sleep(1)
fullspeed()
i01.moveHead(49,74)
i01.moveArm("left",75,83,79,24)
i01.moveArm("right",65,82,71,24)
i01.moveHand("left",74,140,150,157,168,92)
i01.moveHand("right",89,80,98,120,114,0)
sleep(2)
i01.moveHand("right",... | 2.53125 | 3 |
uploader/google_music_manager_uploader/uploader_daemon.py | tombriden/google-music-manager | 0 | 54715 | <reponame>tombriden/google-music-manager
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, time, logging, os, glob, netifaces, argparse
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
from gmusicapi import Musicmanager
__all__ = ['upload']
__DEFAULT_IFACE__ = netif... | 2.078125 | 2 |
codes/sumoAPI/signalControl.BAK.py | cbrafter/TRB18_GPSVA | 1 | 54716 | #!/usr/bin/env python
"""
@file signalControl.py
@author <NAME>
@date 31/01/2013
Parent class for signal control algorithms
"""
import subprocess, sys, os, platform, time
from threading import Thread
#Test to see if we're running on linux or windows
if platform.system() == 'Linux':
sys.path.append('/usr/s... | 2.375 | 2 |
Logic/ProperLogic/cluster_modules/cluster_dict.py | MischaDy/BA | 0 | 54717 | import operator
from itertools import chain
from Logic.ProperLogic.helper_classes.reducer import MaxReducer
from Logic.ProperLogic.misc_helpers import log_error
class ClusterDict(dict):
# TODO: Make sure constructor is only called when needed / doesn't produce more work than necessary!
def __init__(self, cl... | 2.390625 | 2 |
discor/algorithm/rlkit/torch/iwq/iwq.py | AIDefender/MyDiscor | 7 | 54718 | from collections import OrderedDict
import numpy as np
import math
import torch
import torch.optim as optim
from torch import nn as nn
import rlkit.torch.pytorch_util as ptu
from rlkit.core.eval_util import create_stats_ordered_dict
from rlkit.torch.torch_rl_algorithm import TorchTrainer
def kl_divergence(mu, std):... | 2.1875 | 2 |
dockerbuild/python/make_command.py | artemkaxboy/docker-opener | 3 | 54719 | <filename>dockerbuild/python/make_command.py
#!/usr/bin/python3
import sys
from commands import compose, common, container
from errors import OpenerBaseException
from tools import system_tools, docker_common_tools
# ------------------------------------ common commands
help_commands = ["h", "-h", "help", "--help"]
upd... | 2.03125 | 2 |
direct/fsm/StatePush.py | theclashingfritz/Cog-Invasion-Online-Dump | 1 | 54720 | <filename>direct/fsm/StatePush.py
# uncompyle6 version 3.2.4
# Python bytecode 2.7 (62211)
# Decompiled from: Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
# Embedded file name: direct.fsm.StatePush
__all__ = [
'StateVar', 'FunctionCall', 'EnterExit', 'Pulse', 'EventPulse',
'Ev... | 2.1875 | 2 |
tests/unit/filestorage/adapters/__init__.py | cjolowicz/cutty | 1 | 54721 | """Unit tests for cutty.filestorage.adapters."""
| 1.109375 | 1 |
chartofaccountDIT/test/test_upload_archived_chart_of_account.py | uktrade/fadmin2 | 3 | 54722 | <reponame>uktrade/fadmin2
from django.test import TestCase
from chartofaccountDIT.import_archived_from_csv import (
import_archived_analysis1,
import_archived_analysis2,
import_archived_nac,
import_archived_programme,
import_archived_project,
)
from chartofaccountDIT.models import (
ArchivedAna... | 2.34375 | 2 |
LeetCode/Session3/KthSmallestInSortedMatrix.py | shobhitmishra/CodingProblems | 0 | 54723 | <gh_stars>0
from typing import List
import heapq
class Solution:
def kthSmallest(self, matrix: List[List[int]], k: int) -> int:
heap = []
for i in range(min(k, len(matrix))):
heap.append((matrix[i][0], i, 0))
heapq.heapify(heap)
kthSmallestNum = 0
while k > 0:
... | 3.140625 | 3 |
search/util.py | The-Danx/comp30024-project-part-a | 1 | 54724 | <filename>search/util.py
"""
COMP30024 Artificial Intelligence, Semester 1, 2021
Project Part A: Searching
This module contains some helper functions for printing actions and boards.
"""
from search.node import distance
def get_board_dict(data):
"""Convert the data dictionary into a format that is used by the
... | 3.65625 | 4 |
user/__init__.py | sshikshu/app.cavill.in | 0 | 54725 | """
user exports
"""
from user.resources import UsersResource
from user.resources_auth import AuthResource
| 1.320313 | 1 |
scripts/start_ftrack_with_s3.py | hdd/ftrack-s3-accessor | 6 | 54726 | <reponame>hdd/ftrack-s3-accessor
import ftrack_api.structure.id
import sys
import os
import logging
'''
Starts ftrack using a plugin which registers a location
'''
logging.basicConfig()
plugin_logger = logging.getLogger()
plugin_logger.setLevel(logging.INFO)
root_dir = os.path.abspath(os.path.join(os.path.dirname(__f... | 1.9375 | 2 |
Q11__/46_Snapshot_Array/test.py | hsclinical/leetcode | 0 | 54727 | #!/usr/bin/python
'''
["SnapshotArray","snap","snap","get","set","snap","set"]
[[4],[],[],[3,1],[2,4],[],[1,4]]
'''
from Solution import SnapshotArray
'''
obj = SnapshotArray(4)
obj.snap()
obj.snap()
print(obj.get(3, 1))
obj.set(2, 4)
obj.snap()
obj.set(1, 4)
#
obj = SnapshotArray(2)
obj.snap()
print(obj.get(1, 0))
p... | 2.875 | 3 |
app.py | ArtisticTank/MusicGo | 0 | 54728 | <reponame>ArtisticTank/MusicGo
from flask import Flask, request
import handlers
app = Flask(__name__)
@app.route('/')
def indexpage():
return "Welcome"
@app.route("/search", methods =['GET'])
def search():
if request.method == 'GET':
query = request.args.get('name')
return handlers.search_que... | 2.453125 | 2 |
NSI/Chapitre 4/TP5.py | S-c-r-a-t-c-h-y/coding-projects | 0 | 54729 | <filename>NSI/Chapitre 4/TP5.py
from dico1 import entrer_dico
dico_morse = entrer_dico('morse.csv', str)
def morse(phrase):
phrase = phrase.upper()
rep = ''
for lettre in phrase:
rep += dico_morse[lettre]
rep += ' '
return rep
print(morse('LE ZOO')) | 2.96875 | 3 |
tests/unit2/test_opengl_types.py | LiorAvrahami/arcade | 1 | 54730 | <gh_stars>1-10
import pytest
import arcade
from pyglet import gl
from arcade.gl import types, ShaderException
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
@pytest.fixture(scope="module")
def ctx():
window = arcade.Window(SCREEN_WIDTH, SCREEN_HEIGHT, "Test OpenGL")
yield window.ctx
window.use()
window.close... | 2.046875 | 2 |
observations/tests/test_views.py | zsiciarz/variablestars.net | 0 | 54731 | <filename>observations/tests/test_views.py
from django.contrib import messages
from django.contrib.messages.middleware import MessageMiddleware
from django.contrib.sessions.middleware import SessionMiddleware
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from djet.assertions i... | 2.15625 | 2 |
tilty/emitters/influxdb.py | heresurpizza/tilty | 13 | 54732 | # -*- coding: utf-8 -*-
""" InfluxDB emitter """
import logging
from distutils import util as distutil
from influxdb_client import InfluxDBClient
from influxdb_client.client.write_api import SYNCHRONOUS
from jinja2 import Template
from tilty.common import safe_get_key
LOGGER = logging.getLogger()
def __type__() ->... | 2.140625 | 2 |
py/ns_override/override/classes.py | schaabs/sandbox | 0 | 54733 | from ..base import Foo as FooBase
class Foo(FooBase):
def print_greeting(self):
print(self.greeting('foo and improved'))
| 2.484375 | 2 |
script_training.py | vartikagpt10/memae-anomaly-detection | 297 | 54734 | import os
import utils
import torch
import torch.nn as nn
from torchvision import transforms
from torch.utils.data import DataLoader
import numpy as np
import data
import scipy.io as sio
from options.training_options import TrainOptions
import utils
import time
from models import AutoEncoderCov3D, AutoEncoderCov3DMem
f... | 1.945313 | 2 |
app.py | kravitsjacob/hiplot-dash-example | 1 | 54735 | # Example of embedding hiplot into dash
import dash
from dash import html
from dash import dcc
from dash.dependencies import Input, Output, State
import pandas as pd
import hiplot as hip
df = pd.read_csv('https://gist.githubusercontent.com/chriddyp/c78bf172206ce24f77d6363a2d754b59/raw/c353e8ef842413cae56ae3920b8fd784... | 2.53125 | 3 |
src/base/urls.py | LunchWith/app1 | 0 | 54736 | from django.conf.urls import url
from base import views as base_views
app_name = 'base'
urlpatterns = [
url(r'',
base_views.ProtectedDataView.as_view(),
name='protected_data'),
]
| 1.507813 | 2 |
flowtorch/distributions/__init__.py | sankethvedula/flowtorch | 207 | 54737 | # Copyright (c) Meta Platforms, Inc
"""
Warning: This file was generated by flowtorch/scripts/generate_imports.py
Do not modify or delete!
"""
from flowtorch.distributions.flow import Flow
from flowtorch.distributions.neals_funnel import NealsFunnel
__all__ = ["Flow", "NealsFunnel"]
| 0.835938 | 1 |
test/fixtures/python/corpus/assignment.B.py | matsubara0507/semantic | 8,844 | 54738 | <gh_stars>1000+
a, b = 2, 1
c = 1
b, = 1, 2
| 0.972656 | 1 |
db/base_class.py | Saphyel/recipes | 0 | 54739 | from dataclasses import dataclass
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.orm import registry
mapper_registry = registry()
@dataclass
class Base:
__sa_dataclass_metadata_key__ = "sa"
@declared_attr # type: ignore[misc]
def __tablename__(cls) -> str:
return cls.__na... | 2.3125 | 2 |
app/migrations/0012_auto_20200610_0323.py | taikhoangg003/django-dashboard-coreui | 0 | 54740 | <reponame>taikhoangg003/django-dashboard-coreui
# Generated by Django 3.0.5 on 2020-06-10 03:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0011_auto_20200403_0950'),
]
operations = [
migrations.AddField(
model_na... | 1.523438 | 2 |
MODEL_SRC/ckdmd.py | Jimmy-INL/SKDMD | 1 | 54741 | <reponame>Jimmy-INL/SKDMD<gh_stars>1-10
import sys
import numpy as np
sys.path.insert(0, '../../../')
from SKDMD.MODEL_SRC.kdmd import KDMD
from SKDMD.PREP_DATA_SRC.source_code.lib.utilities import timing
class CKDMD(KDMD):
"""
Class for Kernel DMD
with kernel as
* Gaussian kernel
* polynomial ... | 2.125 | 2 |
namePlotter.py | partofthething/nameAnalysis | 0 | 54742 | <reponame>partofthething/nameAnalysis
"""
Scans text for first names and prints out most common ones as document goes on
Useful for analyzing journals or whatever.
"""
# controls
NUM_FILE_SEGMENTS = 25
NUM_TOP_NAMES = 8
# consts
FEMALE = 0
MALE = 1
EITHER = 2
def read_names(filename):
"""
read potential fi... | 3.953125 | 4 |
src/consumer/data-exchange/swagger_server/services/service.py | CADDE-sip/connector | 1 | 54743 | # -*- coding: utf-8 -*-
from flask import Response
from swagger_server.utilities.cadde_exception import CaddeException
from swagger_server.utilities.external_interface import ExternalInterface
__HTTP_STATUS_CODE_SUCCESS_LOWER_LIMIT = 200
__HTTP_STATUS_CODE_SUCCESS_UPPER_LIMIT = 299
def data_exchange(
resou... | 2.296875 | 2 |
gixnaydb/util.py | RyanSquared/greater-ixnay-database | 0 | 54744 | from os import environ as env
from os import urandom, path
import sqlite3
import json
# Schema
db = sqlite3.connect('gixnay.db')
db_cursor = db.cursor()
db_cursor.execute("""CREATE TABLE IF NOT EXISTS Countries (
name TEXT NOT NULL,
-- name of country
abbreviation VARCHAR(... | 3.0625 | 3 |
admix/uploadmanager.py | XENONnT/admix | 2 | 54745 | <reponame>XENONnT/admix
import argparse
import logging
import os
import time
import psutil
import pymongo
import pprint
import json
from admix.helper.logger import Logger
import admix.helper.helper as helper
from admix import DEFAULT_CONFIG, __version__
from admix.helper.decorator import NameCollector, ClassCollector
... | 2.140625 | 2 |
ckan/tests/config/test_middleware.py | jbrown-xentity/ckan | 2,805 | 54746 | # encoding: utf-8
import pytest
import six
from flask import Blueprint
import ckan.plugins as p
from ckan.common import config, _
class MockRoutingPlugin(p.SingletonPlugin):
p.implements(p.IBlueprint)
def get_blueprint(self):
# Create Blueprint for plugin
blueprint = Blueprint(self.name, s... | 1.953125 | 2 |
cgtools/io/__init__.py | tneumann/cgtools | 10 | 54747 | from functools import partial
from os import path
from .obj import load_obj, save_obj
from .off import load_off, save_off
def load_mesh(filename):
loaders = {
'obj': load_obj,
'off': partial(load_off, no_colors=True),
}
ext = path.splitext(filename)[1].lower()[1:]
if ext not in loader... | 2.5 | 2 |
pickle_model_1.py | pratibha-bothra/Sentiment-analysis-with-Insights | 0 | 54748 | import pandas as pd
df = pd.read_csv(r'balanced_reviews.csv')
df.isnull().any(axis = 0)
#handle the missing data
df.dropna(inplace = True)
#leaving the reviews with rating 3 and collect reviews with
#rating 1, 2, 4 and 5 onyl
df = df [df['overall'] != 3]
import numpy as np
#creating a label... | 3.296875 | 3 |
src/robotcommand.py | Team-Joker-JU/mower-raspberry-pi | 0 | 54749 | <filename>src/robotcommand.py<gh_stars>0
from enum import IntEnum
class RobotCommand(IntEnum):
CONNECTED = 0,
DISCONNECTED = 1,
ACCELERATION = 2,
STEERING = 3,
COLLISION = 4,
MODE = 5,
POSITION = 6
| 2 | 2 |
CreatureRogue/data_layer/encounter.py | DaveTCode/CreatureRogue | 1 | 54750 | from CreatureRogue.data_layer.species import Species
class Encounter:
def __init__(self, species: Species, min_level: int, max_level: int, rarity):
self.species = species
self.min_level = min_level
self.max_level = max_level
self.rarity = rarity
def __str__(self):
retu... | 3.09375 | 3 |
LexTransformer/Modules.py | MuhengYan/LexTransformer | 0 | 54751 | #basic components: Embedding Layer, Scaled Dot-Product Attention, Dense Layer
import numpy as np
import torch.nn.functional as F
from torch import nn
import torch
class Embed(nn.Module):
def __init__(self, length, emb_dim,
embeddings=None, trainable=False, dropout=.1):
super(Embed, self... | 2.5 | 2 |
nntoolbox/init/uniform.py | nhatsmrt/nn-toolbox | 16 | 54752 | <gh_stars>10-100
import math
from torch.nn import init, Module
__all__ = ['sqrt_uniform_init']
def sqrt_uniform_init(component: Module):
for weight in component.parameters():
stdv = 1.0 / math.sqrt(weight.shape[-1])
init.uniform_(weight, -stdv, stdv)
| 2.4375 | 2 |
garage/baselines/__init__.py | shadiakiki1986/garage | 3 | 54753 | <filename>garage/baselines/__init__.py
from garage.baselines.base import Baseline
from garage.baselines.linear_feature_baseline import LinearFeatureBaseline
from garage.baselines.zero_baseline import ZeroBaseline
__all__ = ["Baseline", "LinearFeatureBaseline", "ZeroBaseline"]
| 1.234375 | 1 |
python/267.py | kylekanos/project-euler-1 | 0 | 54754 | <gh_stars>0
#!/usr/bin/env python
try:
from gmpy import mpq # much, much faster than Fraction
myfrac = mpq
except ImportError: # use slow python fractions if gmpy not installed
from fractions import Fraction
myfrac = Fraction
# Winning w times gives winnings of (1+2f)^w * (1-f)^(1000-w).
# There are c(... | 2.796875 | 3 |
src/blog/__init__.py | bbcyyb/missouri | 0 | 54755 | # -*- coding:utf-8 -*-
from flask import Blueprint
from flask import current_app
from flask_sqlalchemy import get_debug_queries
from model.permission import Permission
blog = Blueprint('blog', __name__)
@blog.app_context_processor
def inject_permissions():
return dict(Permission=Permission)
@blog.after_app_req... | 2.046875 | 2 |
cython_helper/setup.py | omron-sinicx/jaxmapp | 15 | 54756 | <reponame>omron-sinicx/jaxmapp<filename>cython_helper/setup.py
from distutils.core import setup
from Cython.Build import cythonize
setup(
name="check_continuous_collision",
ext_modules=cythonize("check_continuous_collision.pyx"),
)
| 1.203125 | 1 |
server/favorite_things/tests/test_fixtures/favorite_query.py | el-Joft/favorite-things | 1 | 54757 | create_favorite_query = '''
mutation {{
createFavorite (
title: "{title}",
description: "{description}",
category: "{category}",
ranking: {ranking}
) {{
message
errors
favorite {{
id
title
}}
}}
}}
'''
update_favorite_query = '''
mutation {{
updateFavorite (
id: ... | 1.273438 | 1 |
designate/tests/unit/scheduler/test_permutations.py | mrlesmithjr/designate | 145 | 54758 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | 1.867188 | 2 |
run_pmht.py | PrinceVictor/PMHT | 4 | 54759 | <gh_stars>1-10
import numpy as np
import argparse
from pmht.pmht import PMHT
from pmht.track import MOT
from generator.generator import SimulationGenerator
from visualizer.simulate_data_vis import DrawSimTarget
from utils.logger import setup_logger
from config import gen_cfg as cfg
parser = argparse.ArgumentParser(... | 2.28125 | 2 |
src/main/python/apache/aurora/client/cli/update.py | Yasumoto/incubator-aurora | 0 | 54760 | #
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under ... | 1.78125 | 2 |
setup.py | AntoninRousset/ModuleInterface | 0 | 54761 | <reponame>AntoninRousset/ModuleInterface<filename>setup.py
from distutils.core import Extension, setup
from Cython.Build import cythonize
setup(
ext_modules = cythonize(Extension(
'moduleinterface.master',
sources = ['moduleinterface/_master_cython.pyx'],
language = 'c++',
... | 1.640625 | 2 |
src/python_boilerplate/__init__.py | mateuspontesm/python-boilerplate | 0 | 54762 | """Top-level package for Python Boilerplate."""
__version__ = '0.2.0'
| 0.964844 | 1 |
pexen/sched/pool.py | comps/pexen | 1 | 54763 | <reponame>comps/pexen
import sys
from collections import namedtuple
import threading
import queue
import multiprocessing
import multiprocessing.queues # for picklability check
import pickle
from . import common, meta
class PoolError(common.SchedulerError):
"""Raised by ProcessWorkerPool or ThreadWorkerPool."""
... | 2.671875 | 3 |
plait/app/console.py | dustinlacewell/plait | 2 | 54764 | # -*- coding: utf-8 -*-
import urwid
from blinker import signal
from plait.app.base import PlaitApp
from plait.frame import ConsoleFrame
from plait.tabs import VerticalTabs
class WorkerLog(urwid.ListBox):
def __init__(self):
walker = urwid.SimpleListWalker([])
urwid.ListBox.__init__(self, walker... | 2.171875 | 2 |
training/HMM_test.py | tzmhuang/HMM_lc_prediction | 0 | 54765 | <filename>training/HMM_test.py
import numpy as np
from HiddenMarkovModel import HiddenMarkovModel
print("**********Test Tnitialization **********")
# states = {0: 'sunny', 1: 'rain', 2: 'cloudy'}
states = {0: 'default', 1: 'other'}
hmm = HiddenMarkovModel(states, method='gmm', data_dim=2, gmm_k=1)
print(hmm)
print("*... | 2.6875 | 3 |
summer-of-code/week-01/calc.py | Soundpowered/toolkitten | 1 | 54766 | <gh_stars>1-10
# calculator
print(1+2)
print(3)
print(10%2)
print(11%2) | 1.734375 | 2 |
fauxmo-automation.py | Obighbyd/fauxmo-automation | 2 | 54767 | <reponame>Obighbyd/fauxmo-automation<filename>fauxmo-automation.py
from fauxmo import *
from pyviera import VieraFinder
from wakeonlan import wol
#import requests
class vieria_handler(object):
def __init__(self):
self.vf = VieraFinder()
self.tv = vf.get_viera()
self.TV_WiFi_MAC = 'ff.ff.ff... | 2.578125 | 3 |
libapparmor/utils/pyronia/fail.py | pyronia-sys/libpyronia | 0 | 54768 | # ------------------------------------------------------------------
#
# Copyright (C) 2015 <NAME> <<EMAIL>>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License published by the Free Software Foundation.
#
# ---------... | 2.4375 | 2 |
2 - python intermediario/desafios - exercicios/68 - soma duas listas.py | AdrianaViabL/Curso-Python-udemy | 0 | 54769 | """
Considerando duas listas de inteiros ou floats (lista A e lista B)
Some os valores nas listas retornando uma nova lista com os valores somados:
Se uma lista for maior que a outra, a soma só vai considerar o tamanho da
menor.
Exemplo:
lista_a = [1, 2, 3, 4, 5, 6, 7]
lista_b = [1, 2, 3, 4]
===================... | 4.25 | 4 |
http.py | Senarc-Studios/Semethon | 2 | 54770 | import requests
import cool_utils
from typing import Union
cache = {}
cool_utils.JSON.open("config")
class HTTPClient:
def __init__(self):
self.username = None
self.token = None
self.BASE = cool_utils.JSON.get_data("server")
@classmethod
def create_request(
self,
t... | 2.703125 | 3 |
email-list.py | nwchinn/CSV-combiner | 1 | 54771 | ''' Python program to create email list from master. '''
import os
import csv
pathName = os.getcwd()
print(os.path.join(pathName, '/master.csv'))
file = open(os.path.join(pathName, 'master.csv'), "r")
reader = csv.reader(file, delimiter=',')
comp_dic = {}
tool_dic = {}
unsure_dic = {}
firstline = True
for row in ... | 3.90625 | 4 |
w01/e13.py | Luccifer/PythonCoruseraHSE | 1 | 54772 | # Следующее и предыдущее
num = int(input())
print("The next number for the number ", num, " is ", num + 1, ".\n"
"The previous number for the number ", num, " is ", num - 1, ".", sep='')
| 3.859375 | 4 |
config.py | AlbertMillan/adversarial-training-pytorch | 14 | 54773 | <gh_stars>10-100
import numpy as np
import math
import torch
from torchvision import transforms
mean=np.array([0.4914, 0.4822, 0.4465])
std=np.array([0.2023, 0.1994, 0.2010])
max_val = np.array([ (1. - mean[0]) / std[0],
(1. - mean[1]) / std[1],
(1. - mean[2]) / std[2],
... | 1.953125 | 2 |
text-vision-translation/translation/data_format.py | bitadept/text-vision-translation | 0 | 54774 | <filename>text-vision-translation/translation/data_format.py
# This script is used to format multiple en-ro translation datasets into the following format:
# {english sequence}{TAB character}{romanian sequence}
# \\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# corpus
# \\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# import xml.etree.Eleme... | 2.765625 | 3 |
backend/apps/accounts/migrations/0002_auto_20200206_1207.py | MgArreaza13/wonderhumans | 0 | 54775 | <reponame>MgArreaza13/wonderhumans
# Generated by Django 2.0.1 on 2020-02-06 16:07
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),... | 1.992188 | 2 |
tests/python-reference/bool/bool-float.py | jpolitz/lambda-py-paper | 25 | 54776 | ___assertEqual(float(False), 0.0)
___assertIsNot(float(False), False)
___assertEqual(float(True), 1.0)
___assertIsNot(float(True), True)
| 1.828125 | 2 |
src/genie/libs/parser/iosxe/tests/ShowSnmpMib/cli/equal/golden_output1_expected.py | balmasea/genieparser | 204 | 54777 | expected_output = {
"aal5VccEntry": {"3": {}, "4": {}, "5": {}},
"aarpEntry": {"1": {}, "2": {}, "3": {}},
"adslAtucChanConfFastMaxTxRate": {},
"adslAtucChanConfFastMinTxRate": {},
"adslAtucChanConfInterleaveMaxTxRate": {},
"adslAtucChanConfInterleaveMinTxRate": {},
"adslAtucChanConfMaxInter... | 1.320313 | 1 |
extreme_feedback_tts/build_status_enum.py | pavelhromada/extreme-feedback-tts | 0 | 54778 | <filename>extreme_feedback_tts/build_status_enum.py<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from enum import Enum
class BuildStatus( Enum ):
Success = 1
Failed = 2
Running = 3
Unavailable = 4
@classmethod
def has_value( cls, value ):
return any( BuildSt... | 2.75 | 3 |
examples/example_03.py | grimmigerFuchs/Pyticles | 1 | 54779 | <gh_stars>1-10
#!/usr/bin/env python3
# example_03.py
import pygame
import particlepy
import sys
import time
import random
pygame.init()
# pygame config
SIZE = 800, 800
screen = pygame.display.set_mode(SIZE)
pygame.display.set_caption("ParticlePy example program")
pygame.mouse.set_visible(False)
# timing
clock = py... | 2.703125 | 3 |
bench/stdlib/json.py | erezsh/python-parsing-benchmarks | 16 | 54780 | <reponame>erezsh/python-parsing-benchmarks<filename>bench/stdlib/json.py
import json
def invalid_constant(s):
raise ValueError(s)
def parse(s):
return json.loads(s, parse_constant=invalid_constant)
| 2.390625 | 2 |
Tired.py | RedHoodedWraith/Tired_Repitition | 0 | 54781 | """
I AM TIRED
Date: 13 March 2020
By <NAME>
This is a short and easy script that just creates or overwrites a file called 'tired.txt'
and repeatedly writes the sentence "i am tired".
At each sentence, one letter is capitalised. On the next sentence, the next character is capitalised instead.
This repeats until the ... | 4.0625 | 4 |
dockerspawner/volumenamingstrategy.py | hydroshare/dockerspawner | 2 | 54782 | def default_format_volume_name(template, spawner):
return template.format(username=spawner.user.name)
def escaped_format_volume_name(label_template, spawner):
"""Use this strategy if your usernames include illegal characters
for volume names and you do not use absolute paths in your volume
label templa... | 2.375 | 2 |
zmigrate/__init__.py | ziggurattech/zmigrate | 0 | 54783 | from argparse import ArgumentParser
from os import listdir
from os.path import isfile, isdir
from zmigrate.config import load as load_config
from zmigrate.range import Range
from zmigrate.dir import Dir
from zmigrate.drivers import SUPPORTED_DRIVERS
def str_to_bool(v):
if isinstance(v, bool):
return v
i... | 2.625 | 3 |
main/migrations/0005_rename_video_pricipal_main_video_principal.py | Aimene-BAHRI/ghanaiem_agency | 0 | 54784 | <reponame>Aimene-BAHRI/ghanaiem_agency
# Generated by Django 3.2.9 on 2021-12-16 21:03
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('main', '0004_main_video_pricipal'),
]
operations = [
migrations.RenameField(
model_name='main',
... | 1.664063 | 2 |
core_recorder.py | dengbuqi/lie_detection | 1 | 54785 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName : core_recorder.py
# @Time : 2020/9/25 12:29
# @Author : 陈嘉昕
# @Demand : 声音复杂记录
import threading
import logging
import wave
from pyaudio import PyAudio, paInt16
import numpy as np
import queue
import time
class CoreRecorder(threading.Thread):
... | 2.71875 | 3 |
conf.py | qqqestion/TypingSpeedTest | 0 | 54786 | <reponame>qqqestion/TypingSpeedTest
import pygame
screen_width, screen_height = 800, 600
valid_literal = set([letter for letter in range(pygame.K_a, pygame.K_z)])
| 2.09375 | 2 |
src/pmc_tables/fixers/_errors.py | pmc-tables/pmc-tables | 1 | 54787 | <filename>src/pmc_tables/fixers/_errors.py
class _FixDoesNotApplyError(Exception):
"""Error raised when a given fixer function does not apply to a particular case."""
pass
class _CouldNotApplyFixError(Exception):
"""Error raised when we could not apply a fix for some reason."""
pass
| 1.796875 | 2 |
src/animal_avatar/shapes/patterns.py | sprotg/animal-avatar-generator | 1 | 54788 | <reponame>sprotg/animal-avatar-generator<filename>src/animal_avatar/shapes/patterns.py
from animal_avatar.utils.colors import darken
PATTERNS = (
lambda color:
f'<path fill="{darken(color, -30)}" '
'd="M156 387.1c-57.8-12.3-96.7-42-96.7-107 0-9.4.8-18.6 2.4-27.6 '
'19.1 3.4 39.3 17 53.6 38.1a105 105 0 ... | 2.328125 | 2 |
service1/application/routes.py | Ashley-Edge/DnD_character_generator | 1 | 54789 | #!/usr/bin/python3
# Routes.py file
##### Imports #####
from flask import Flask, render_template, request
import requests, random
from application import app, db
from application.models import Character
from sqlalchemy import desc
##### Routes #####
@app.route('/', methods=['GET','POST'])
def ... | 2.578125 | 3 |
Analysis.py | Siddhesh268/Fleet-Management-system | 0 | 54790 | # import pandas and matplotlib
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
from connection import setConnection
def liabilityasset():
dataT=setConnection(["profitloss"])
labels=[]
Income_of_all_trips=[]
Expenditure_of_the_year=[]
... | 3.203125 | 3 |
apps/demo/models.py | blackmatrix7/apizen-tornado | 0 | 54791 | <filename>apps/demo/models.py<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/11/8 下午1:53
# @Author : Matrix
# @Github : https://github.com/blackmatrix7/
# @Blog : http://www.cnblogs.com/blackmatrix/
# @File : models.py
# @Software: PyCharm
from tornsql.model import ModelBase
from sqlalchemy imp... | 2.359375 | 2 |
data_stream.py | Rosfly/UdacityStreamingSparkProject | 0 | 54792 | <gh_stars>0
"""
Spark Streaming Example
=======================
This example uses Kafka to deliver a stream of words to a Python word count program
docker-compose up -d
docker ps
docker exec -it spark_project_kafka0_1 bash
Create a kafka topic (not needed here)
kafka-topics --create --bootstrap-server PLAINTEXT://k... | 2.65625 | 3 |
assopy/tests/factories/order.py | zevaverbach/epcon | 0 | 54793 | from datetime import timedelta
import uuid
import factory
from django.utils import timezone
from assopy.tests.factories.user import AssopyUserFactory
import conference.models
class CreditCardOrderFactory(factory.django.DjangoModelFactory):
class Meta:
model = 'assopy.Order'
user = factory.SubFacto... | 2.109375 | 2 |
common/smoketest/key_vault_base_async.py | iscai-msft/azure-sdk-for-python | 1 | 54794 | from key_vault_base import KeyVaultBase
from azure.identity.aio import DefaultAzureCredential
class KeyVaultBaseAsync(KeyVaultBase):
credential_type = DefaultAzureCredential | 1.367188 | 1 |
Mundo 1/ArquivosComCores/File 012.py | PedroHenriqueSimoes/Exercicios-Python | 1 | 54795 | preco = (float(input('\033[33mDigite o valor do produto: \033[m')))
print("""O\033[32m produto que custava {:.2f} com 5 por cento de desconto
ira valer {:.2f}\033[m""".format(preco, preco - ((5 / preco) * 100))) | 3.59375 | 4 |
votepredictapp/models.py | davidhammaker/votepredictbackend | 0 | 54796 | <reponame>davidhammaker/votepredictbackend
from django.contrib.auth.models import User
from django.db import models
from django.utils import timezone
class Question(models.Model):
content = models.CharField(max_length=128)
start_date = models.DateTimeField(default=timezone.now)
end_date = models.DateTimeF... | 2.1875 | 2 |
src/blocks/lootBlock.py | NaulaN/SuperMarioBros3-pygame | 2 | 54797 | from pygame.sprite import ( Sprite )
from src.entitys.mushroom import ( Mushroom )
from math import sin
class LootBlock( Sprite ):
def __init__( self, group_sprite, sheet, position, loot ):
self.groups = group_sprite
Sprite.__init__( self, group_sprite )
# ### STRING VARIABLES ###
... | 2.921875 | 3 |
testing/resources/test_pmatrixprint.py | timgates42/processing.py | 1,224 | 54798 | <filename>testing/resources/test_pmatrixprint.py
a = PMatrix3D()
a.print()
exit()
| 1.125 | 1 |
rltrade/core/genv/run.py | Lucien-MG/rl-trading-bot | 1 | 54799 | <gh_stars>1-10
#!/usr/bin/python3
# ‑∗‑ coding: utf‑8 ‑∗‑
class RunEnvironment:
""" Initialize the RunEnv class.
Args:
env: instance of OpenAI Gym's environment
agent: agent that will interact with the environment.
Attributes:
env: instance of OpenAI Gym's environment
agent:... | 2.828125 | 3 |