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
external/modbus_tk/modbus_tk/__init__.py
iconnect-iot/intel-device-resource-mgt-lib
2
37200
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Modbus TestKit: Implementation of Modbus protocol in python (C)2009 - <NAME> - <EMAIL> (C)2009 - Apidev - http://www.apidev.fr This is distributed under GNU LGPL license, see license.txt Make possible to write modbus TCP and RTU master and slave for te...
1.671875
2
utils/scripts/visualize_allocations.py
dmoham1476/glow
0
37201
<gh_stars>0 #!/usr/bin/env python import sys from PIL import Image # This script is used to visualize memory allocations in the Glow compiler. # # Usage: ./visualize.py dump.txt # # The script will dump a sequence of bitmap files that can be combined into a # video. Example: heap100123.bmp, heap heap100124.bmp, heap1...
2.671875
3
src/c3nav/control/models.py
NoMoKeTo/c3nav-new
0
37202
from contextlib import contextmanager from typing import Dict from django.conf import settings from django.contrib.auth.models import User from django.core.cache import cache from django.db import models, transaction from django.utils.functional import cached_property, lazy from django.utils.translation import gettext...
1.921875
2
OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/raw/EGL/MESA/drm_image.py
JE-Chen/je_old_repo
0
37203
<filename>OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/raw/EGL/MESA/drm_image.py '''Autogenerated by xml_generate script, do not edit!''' from OpenGL import platform as _p, arrays # Code generation uses this from OpenGL.raw.EGL import _types as _cs # End users want this... from OpenGL.raw.EGL._types import * fr...
1.804688
2
pysnmp/hlapi/v1arch/asyncore/ntforg.py
RKinsey/pysnmp
492
37204
<reponame>RKinsey/pysnmp # # This file is part of pysnmp software. # # Copyright (c) 2005-2019, <NAME> <<EMAIL>> # License: http://snmplabs.com/pysnmp/license.html # from pysnmp.hlapi.v1arch.auth import * from pysnmp.hlapi.v1arch.asyncore import * from pysnmp.hlapi.varbinds import * from pysnmp.smi.rfc1902 import * fro...
2.03125
2
Temperatura.py
russeleiser/ProjectTemperature
0
37205
print ("--------------------------------------------------------") print ("-------------Bienvenido a la Temperatura----------------") print ("--------------------------------------------------------\n") x = 0 while x < 10000: print ("Elige tus opciones:") print ("(1) Convertir de °C a °F") print ("(2) Co...
4.25
4
scripts/pretrain_n_times.py
gabrielasuchopar/info-nas
0
37206
<reponame>gabrielasuchopar/info-nas import random import click import json import os import numpy as np import torch from info_nas.config import local_dataset_cfg, load_json_cfg from info_nas.datasets.networks.pretrained import pretrain_network_dataset from nasbench import api from nasbench_pytorch.datasets.cifar10 ...
1.953125
2
python/dazl/pretty/_module_builder.py
digital-asset/dazl-client
8
37207
# Copyright (c) 2017-2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. # SPDX-License-Identifier: Apache-2.0 from typing import Dict, List, Sequence from ..damlast.daml_lf_1 import DottedName, Module from ..damlast.util import module_name, package_ref from ..model.types import ModuleR...
1.992188
2
test/Test.py
AmeCode/DyMatByJoerg-Raedler
8
37208
#!/usr/bin/env python # Copyright (c) 2011, <NAME> (Berlin, Germany) # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # Redistributions of source code must retain the above copyright notice, this...
1.859375
2
httptesting/main.py
HttpTesting/pyhttp
6
37209
<filename>httptesting/main.py # ######################################################## # 将根目录加入sys.path中,解决命令行找不到包的问题 import sys import os curPath = os.path.abspath(os.path.dirname(__file__)) rootPath = os.path.split(curPath)[0] sys.path.insert(0, rootPath) # ######################################################## i...
2.328125
2
setup.py
smok-serwis/longshot-python
0
37210
#!/usr/bin/env python from distutils.core import setup setup(name='longshot', version='0.1alpha', description='SMOK client connectivity library', author='<EMAIL>k-serwis.pl', author_email='<EMAIL>', url='https://github.com/smok-serwis/longshot-python', packages=['longshot', 'longsh...
1
1
users/tests/test_delete_user.py
tgamauf/spritstat
1
37211
<filename>users/tests/test_delete_user.py from django.urls import reverse from rest_framework import status from rest_framework.test import APITestCase from users.models import CustomUser class TestDeleteUser(APITestCase): fixtures = ["user.json"] url: str user: CustomUser @classmethod def setUp...
2.375
2
sphinxcontrib/needs/builder.py
tlovett/sphinxcontrib-needs
0
37212
<filename>sphinxcontrib/needs/builder.py<gh_stars>0 from sphinx.builders import Builder from sphinxcontrib.needs.utils import NeedsList import sphinx from pkg_resources import parse_version sphinx_version = sphinx.__version__ if parse_version(sphinx_version) >= parse_version("1.6"): from sphinx.util import logging ...
2.359375
2
coding/exceptions.py
ffaristocrat/coding
0
37213
<reponame>ffaristocrat/coding<gh_stars>0 class GameException(Exception): pass class GameFlowException(GameException): pass class EndProgram(GameFlowException): pass class InvalidPlayException(GameException): pass
1.3125
1
usercodex/plugins/powertools.py
ipindanger/Codex-z
2
37214
import sys from asyncio.exceptions import CancelledError from time import sleep from usercodex import codex from ..core.logger import logging from ..core.managers import edit_or_reply from ..sql_helper.global_collection import ( add_to_collectionlist, del_keyword_collectionlist, get_collectionlist_items, ...
2.140625
2
MC_vis_histogram.py
FloweryK/Neutrino-vertex-reconstruction
2
37215
from utils import load, save, path_list, DEAD_PMTS import nets import torch import numpy as np import pandas as pd from scipy import interpolate import matplotlib.pyplot as plt from matplotlib.ticker import PercentFormatter from itertools import repeat from multiprocessing import Pool def neural_residual(root_dir):...
2.265625
2
py/annotate.py
Capstone-Projects-2019-Fall/TAG-Local
0
37216
<reponame>Capstone-Projects-2019-Fall/TAG-Local<filename>py/annotate.py<gh_stars>0 import json import argparse import sys import spacy class DocumentClass: def __init__(self, title, text, annotations): self.title = title self.text = text self.annotations = annotations class AnnotationCla...
2.6875
3
tests/model_test.py
jicewarwick/AShareData
30
37217
import datetime as dt import unittest from AShareData import set_global_config from AShareData.model import * class MyTestCase(unittest.TestCase): def setUp(self) -> None: set_global_config('config.json') def test_something(self): self.assertEqual(True, False) @staticmethod def test...
2.34375
2
quantifying-aliasing/torch_util.py
antonior92/aliasing-in-cnns
3
37218
import torch from collections.abc import Iterable def _get_layers(model, all_layers=None, all_names=None, top_name=None, fn=None, sep='_'): """Auxiliar function. Recursive method for getting all in the model for which `fn(layer)=True`.""" if all_names is None: all_names = [] if all_layers is None:...
3.078125
3
HorribleConky.py
WolfgangAxel/ConkyConfigs
1
37219
#!/usr/bin/python from lxml import html import requests """ Enter HorribleSubs's title for the shows you watch in quotes followed by a comma, then hit enter to add another show. When all of your watched shows are entered, put the ending bracket. EX: MYSHOWS = ["Bananya", "New Game", "Kono Bijutsubu ni wa Mondai ga ...
3.3125
3
appengine/components/components/endpoints_webapp2/partial.py
Swift1313/luci-py
0
37220
# Copyright 2018 The LUCI Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 # that can be found in the LICENSE file. """Partial response utilities for an Endpoints v1 over webapp2 service. Grammar of a fields partial response string: fields: selector [,select...
2.3125
2
Python/02-Django/01-Try-Django/Challenges/01-Getting-Started/03/mainurls.py
pabhd3/Code-School
0
37221
<gh_stars>0 # Python # Django # Try Django # Getting Started (Level 1) # Challenge 03 - Refactor the existing URL Dispatchers from django.conf.urls import url from . import views urlpatterns = [ # TODO: Add a url() object whose regex parameter takes an empty path that # terminates, and goes to views.ho...
1.796875
2
vmraid/patches/v13_0/add_switch_theme_to_navbar_settings.py
sowrisurya/vmraid
0
37222
<reponame>sowrisurya/vmraid from __future__ import unicode_literals import vmraid def execute(): navbar_settings = vmraid.get_single("Navbar Settings") if vmraid.db.exists('Navbar Item', {'item_label': 'Toggle Theme'}): return for navbar_item in navbar_settings.settings_dropdown[6:]: navbar_item.idx = navbar_...
2.140625
2
Python/04. Sets/006. Set union() Operation.py
stonehengee/HackerrankPractice
0
37223
<reponame>stonehengee/HackerrankPractice # Problem: https://www.hackerrank.com/challenges/py-set-union/problem # Score: 10
1.484375
1
fun/vowel_counter.py
ahmedelq/PythonicAlgorithms
0
37224
<reponame>ahmedelq/PythonicAlgorithms def count_vowels(txt): vs = "a, e, i, o, u".split(', ') return sum([1 for t in txt if t in vs]) print(count_vowels('Hello world'))
4
4
GestureAgents/AppRecognizer.py
chaosct/GestureAgents
1
37225
<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- from GestureAgents.Recognizer import Recognizer, newHypothesis import copy from GestureAgents.Agent import Agent from GestureAgents.Events import Event class FakeAgent(Agent): def __init__(self, original, creator): self.original_agent = origin...
2.328125
2
Tools/_create_model.py
825477418/XX
0
37226
<reponame>825477418/XX #!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/11/1 11:33 # @Author : Peter # @Des : 生成model类 # @File : _create_model.py # @Software: PyCharm import os import re # fp = "C:\\Users\\billsteve\\Desktop\\tmp\\" fp = "../Model/SqlAlchemy/T.py" link = "sqlacodegen my...
1.484375
1
stdplugins/__init__.py
ppppspsljdhdd/Pepe
20
37227
<reponame>ppppspsljdhdd/Pepe from uniborg import * from userbot import *
0.996094
1
CAAPR/CAAPR_AstroMagic/PTS/pts/evolve/FunctionSlot.py
wdobbels/CAAPR
7
37228
#!/usr/bin/env python # -*- coding: utf8 -*- # ***************************************************************** # ** PTS -- Python Toolkit for working with SKIRT ** # ** © Astronomical Observatory, Ghent University ** # ***************************************************************** ##...
3.125
3
test_spelling_corrector.py
mustafaKus/spellcheck
6
37229
"""Implements the test class for the spelling corrector""" import json import logging import os import sys import unittest from unittest import TestCase from spelling_corrector import NorvigCorrector, SymmetricDeleteCorrector class SpellingCorrectorTest(TestCase): """Implements the test class for the spelling c...
3.5
4
src/pyglue/DocStrings/GroupTransform.py
omenos/OpenColorIO
7
37230
class GroupTransform: """ GroupTransform """ def __init__(self): pass def getTransform(self): pass def getTransforms(self): pass def setTransforms(self, transforms): pass def size(self): pass def push_back(self, transform): pass de...
2.28125
2
censusreporter/apps/census/urls.py
Durellg/censusreporter
0
37231
from django.conf import settings from django.conf.urls import url, patterns, include from django.contrib import admin from django.core.urlresolvers import reverse_lazy from django.http import HttpResponse from django.views.decorators.cache import cache_page from django.views.generic.base import TemplateView, RedirectVi...
1.960938
2
Pythonista/Editor/cambiar.py
walogo/Pythonista-scripts
2
37232
from re import search from editor import get_path def count_spaces(line): patter = r' {1,6}' return search(patter, line).span()[1] def replace(): steps={1:'Extracting content',2:'Starting edition',3:'Getting cuantity'} actual=1 try: file = get_path() print(steps[1]) content = open(file).read() line = ...
3.484375
3
example.py
Tobi-De/qosic-sdk
1
37233
import phonenumbers from dotenv import dotenv_values from qosic import Client, MtnConfig, MTN, MOOV, OPERATION_CONFIRMED from qosic.exceptions import ( InvalidCredentialsError, InvalidClientIdError, ServerError, RequestError, ) config = dotenv_values(".env") moov_client_id = config.get("MOOV_CLIENT_I...
2.59375
3
rlcard/games/karma/card.py
pettaa123/rlcard
0
37234
<filename>rlcard/games/karma/card.py class KarmaCard(object): info = {'type': ['number', 'wild'], 'trait': ['4', '5', '6', '7', '8', '9', 'J', 'Q', 'K', 'A', '2', '3', '10', 'draw'], 'order': ['4:4', '4:3', '4:2', '4:1', '5:4', '5:3', '5:2', '5:1', '6:4', '6:3', '6:2', '6:1', ...
1.867188
2
datasets/Part 1 - Data Preprocessing/Section 2 -------------------- Part 1 - Data Preprocessing --------------------/my_version_kevinml/Preprocessing_CategoricalData.py
kevinLCG/machinelearning-az
0
37235
<filename>datasets/Part 1 - Data Preprocessing/Section 2 -------------------- Part 1 - Data Preprocessing --------------------/my_version_kevinml/Preprocessing_CategoricalData.py #!/home/kevinml/anaconda3/bin/python3.7 # -*- coding: utf-8 -*- """ Created on Tue Dec 10 11:47:39 2019 @author: kevinml Version Python: 3.7 ...
3.546875
4
docker_registry_client_async/specs.py
GitHK/docker-registry-client-async
2
37236
<filename>docker_registry_client_async/specs.py #!/usr/bin/env python # pylint: disable=too-few-public-methods """Reusable string literals.""" class DockerAuthentication: """ https://github.com/docker/distribution/blob/master/docs/spec/auth/token.md https://github.com/docker/distribution/blob/master/doc...
1.796875
2
test/toxiproxy_api_test.py
ondrejsika/toxiproxy-python
36
37237
<gh_stars>10-100 from unittest import TestCase import requests from toxiproxy.api import validate_response from toxiproxy.exceptions import NotFound, ProxyExists class IntoxicatedTest(TestCase): def setUp(self): self.base_url = "http://127.0.0.1:8474" def test_not_found(self): """ Test an i...
2.78125
3
tests/cases/help/see_for_top_level/test_see_for_top_level.py
WilliamMayor/vantage
1
37238
def test_see_for_top_level(result): assert ( "usage: vantage [-a PATH] [-e NAME ...] [-v KEY=[VALUE] ...] [--verbose] [-h] COMMAND..." in result.stdout_ )
1.671875
2
integritybackend/geocoder.py
starlinglab/integrity-backend
1
37239
import geocoder from .log_helper import LogHelper _logger = LogHelper.getLogger() class Geocoder: def reverse_geocode(self, lat, lon): """Retrieves reverse geocoding informatioon for the given latitude and longitude. Args: lat, long: latitude and longitude to reverse geocode, as floa...
3.296875
3
dsa/patterns/binary_search/number_range.py
bksahu/dsa
0
37240
<reponame>bksahu/dsa<filename>dsa/patterns/binary_search/number_range.py """ Given an array of numbers sorted in ascending order, find the range of a given number ‘key’. The range of the ‘key’ will be the first and last position of the ‘key’ in the array. Write a function to return the range of the ‘key’. If the ‘key...
3.890625
4
not_tf_opt/__init__.py
gergely-flamich/not-tf-opt
0
37241
from .variables import * from .optimize import * from .utils import *
1.0625
1
models/__init__.py
davmre/sigvisa
0
37242
import numpy as np import cPickle class Distribution(object): def dim(self): raise NotImplementedError('abstract base class') def predict(self, cond=None): raise NotImplementedError('abstract base class') def sample(self, cond=None, key_prefix=""): raise NotImplementedError('ab...
2.90625
3
foodapp/urls.py
gauravmahale47/Foodstore
0
37243
from django.urls import path from foodapp.views import * from django.views.generic.base import TemplateView from .views import FoodCreateView,FoodListView from django.conf import settings from django.conf.urls.static import static ''' TemplateView is built-in django Class Based view Class which is used to ren...
2.15625
2
22/a.py
Unlink/AdventOfCode2018
0
37244
from PIL import Image, ImageDraw # depth = 6084 # target = (14,709) # depth = 510 # target = (10,10) # depth = 4848 # target = (15, 700) depth = 9171 target = (7,721) # depth = 11820 # target = (7,782) buffer = 50 def getErrosion(index): return (index + depth) % 20183 def getType(errosion): return...
2.96875
3
wordBreak3Ways.py
ezquire/python-challenges
0
37245
<reponame>ezquire/python-challenges def wordBreakDP(word, dic): n = len(word) if word in dic: return True if len(dic) == 0: return False dp = [False for i in range(n + 1)] dp[0] = True for i in range(1, n + 1): for j in range(i - 1, -1, -1): if dp[j] == True: ...
3.515625
4
src/embedding/utilslib/baidu_spider_threads.py
mykiscool/DeepCamera
914
37246
#!/usr/bin/env python # -*- coding:utf-8 -*- import os import sys import re import urllib import json import socket import time import multiprocessing from multiprocessing.dummy import Pool from multiprocessing import Queue import requests timeout = 5 socket.setdefaulttimeout(timeout) class Image(object): """图...
2.859375
3
cgi-bin/pybrowser.py
fanuware/pybrowser
0
37247
<gh_stars>0 #!/usr/bin/env python3 import cgi, os import shutil from userlogger import UserLogger import templates import mimetypes from stat import S_IEXEC def getUnusedName(file): if not os.path.exists(file): return file basepath, basename = os.path.split(file) p = basename.rfind('.') exte...
2.3125
2
prog_python/strings/sustring_2.py
TCGamer123/python
1
37248
<filename>prog_python/strings/sustring_2.py<gh_stars>1-10 s = "Olá, mundo!"; print(s[::2]); # Imprime os caracteres nos índices pares. print(s[1::2]) # Imprime os caracteres nos índices ímpares. frase = "Mundo mundo vasto mundo" print(frase[::-1]); #inverte a frase; # Forma mais avançada de formatação de strings fra...
3.75
4
pymonad/maybe/maybe_test.py
Wildhoney/Pymonad
0
37249
<gh_stars>0 import unittest from . import Nothing, Just a = Just('Adam') b = Nothing() def lower(x): return x.lower() def reverse(x): return x[::-1] def shout(x): return '%s!' % x def capitalise(x): return x.capitalize() class TestJust(unittest.TestCase): def test_is_just(self): self.assertEqual(a.is...
3.421875
3
ryu/gui/models/topology.py
isams1/Thesis
3
37250
<reponame>isams1/Thesis import logging import json from socket import error as SocketError from httplib import HTTPException import gevent import gevent.monkey gevent.monkey.patch_all() from ryu.lib.dpid import str_to_dpid from ryu.lib.port_no import str_to_port_no from ryu.app.client import TopologyClient LOG = log...
2.3125
2
IMU/VTK-6.2.0/ThirdParty/Twisted/twisted/internet/test/process_gireactornocompat.py
timkrentz/SunTracker
4
37251
<reponame>timkrentz/SunTracker import sys # Override theSystemPath so it throws KeyError on gi.pygtkcompat: from twisted.python import modules modules.theSystemPath = modules.PythonPath([], moduleDict={}) # Now, when we import gireactor it shouldn't use pygtkcompat, and should # instead prevent gobject from be...
1.867188
2
octostore/mongo_helper.py
luzhang06/octostore
1
37252
<gh_stars>1-10 from pymongo import MongoClient import os import sys from pathlib import Path from environs import Env sys.path.append("..") sys.path.append(str(Path(__file__).parent.resolve())) class MongoHelpers: _client = None _db = None _collection = None def __init__(self, connection_uri=None, d...
2.421875
2
tests/test_app.py
jonathanharg/covid_dashboard
0
37253
<gh_stars>0 from app import create_app from utils import get_setting import pytest @pytest.fixture def client(): app = create_app(testing=True) with app.test_client() as client: yield client @pytest.mark.parametrize("url", ["/", "/index"]) def test_get_url(client, url): response = client.get(ur...
2.3125
2
wp/modules/utils/frame.py
ExLeonem/master-thesis-code
0
37254
<reponame>ExLeonem/master-thesis-code import pandas as pd import numpy as np class Frame: """ Uitiliy methods for dataframe operations across multiple dataframes. """ @staticmethod def set_columns(frame, new_names): frame.columns = new_names return frame @staticmethod ...
3.265625
3
setup.py
jeblohe/strup
0
37255
from setuptools import setup, find_packages from codecs import open import os # Get the long description from the README file here = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(here, "README.md")) as f: long_description = f.read() # Get the version for line in open(os.path.join(here, "strup...
1.796875
2
dags/load_transformations.py
brendasanchezs/Capstonev2
0
37256
<filename>dags/load_transformations.py from datetime import datetime, timedelta import boto3 from airflow.models import Variable from airflow import DAG from airflow.operators.dummy_operator import DummyOperator from airflow.hooks.S3_hook import S3Hook from airflow.contrib.operators.emr_create_job_flow_operator import ...
1.898438
2
pypower/runpf_fast.py
felixkoeth/PYPOWER
0
37257
# Copyright (c) 1996-2015 PSERC. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. """Runs a power flow. """ from sys import stdout, stderr from os.path import dirname, join from time import time from numpy import r_, c_, ix_, zeros, pi, ones...
2.40625
2
SimpleTrading/commodities_inflation.py
Nawter/Quantiacs
0
37258
# This program imports the federal reserve economic data consumer price index # values from 1990 and uses those values to get the real values or infaltion adjusted # values of the sepcific commodities/markets. # Then when a commdoity hits a specific low infaltion based price, the algo # enters into a long psoiton and ...
3.734375
4
encryptor/encryptor.py
crafter-hub/Kreusada-Cogs
21
37259
import contextlib import random import string from password_strength import PasswordStats from redbot.core import commands from redbot.core.utils import chat_formatting as cf from .word_list import * GREEN_CIRCLE = "\N{LARGE GREEN CIRCLE}" YELLOW_CIRCLE = "\N{LARGE YELLOW CIRCLE}" ORANGE_CIRCLE = "\N{LARGE ORANGE CI...
2.5625
3
semana4/app.py
ArseniumGX/bluemer-modulo2
0
37260
<gh_stars>0 from werkzeug.security import generate_password_hash, check_password_hash from flask import Flask, render_template, jsonify, request, redirect, flash, url_for from flask_sqlalchemy import SQLAlchemy from flask_login import LoginManager, UserMixin, current_user, login_required, logout_user, login_user app =...
2.390625
2
setup.py
osilkin98/HappyMail
1
37261
<filename>setup.py from subprocess import call from sys import executable from distutils.core import setup from distutils.command.build_py import build_py import os from os.path import exists from getpass import getuser from time import sleep try: import colorama except ImportError as IE: print("Module Color...
2
2
project_3/code/characters.py
Psemp/oc_project_11
0
37262
<filename>project_3/code/characters.py from get_char_pos import get_char_position class Character: def __init__(self): self.x = 0 self.y = 0 self.vel = 32 self.alive = True self.tag = "str" mac = Character() mac.tag = "mac" guard = Character() guard.tag = "guard" macp...
2.859375
3
share/regulate/steps/deduplicate.py
CenterForOpenScience/SHARE
87
37263
<gh_stars>10-100 from share.regulate.steps import GraphStep class Deduplicate(GraphStep): """Look for duplicate nodes and merge/discard them Example config (YAML): ```yaml - namespace: share.regulate.steps.graph name: deduplicate ``` """ MAX_MERGES = 100 # map f...
2.484375
2
mit-ml/reinforcedl.py
stepinski/machinelearning
0
37264
import numpy as np gama = 0.5 alfa = 0.75 data = np.array([[1, 1, 1], [1, 2, -1], [2, 1, 1]]) #(s, s', R) Q = np.zeros((data.shape[0]+1, 2)) #(iterations, |S|) k = 1 for d in range(data.shape[0]): R = data[d, 2] #inmediate reward idx_s = data[d, 0] - 1 # index of state s in Q idx_sp = data[d, 1] - 1 #ind...
2.515625
3
database.py
ISProject1/POS
0
37265
<reponame>ISProject1/POS file1= "db_breakfast_menu.txt" file2= "db_lunch_menu.txt" file3= "db_dinner_menu.txt" file4 = "db_label_text.txt" retail = [] title = [] label = [] with open(file1, "r") as f: data = f.readlines() for line in data: w = line.split(":") title.append(w[1]) ...
2.796875
3
libvis/scripts/LMOptimizer SE3Optimization Test Jacobian derivation.py
zimengjiang/badslam
541
37266
from sympy import * # Implementation of QuaternionBase<Derived>::toRotationMatrix(void). # The quaternion q is given as a list [qw, qx, qy, qz]. def QuaternionToRotationMatrix(q): tx = 2 * q[1] ty = 2 * q[2] tz = 2 * q[3] twx = tx * q[0] twy = ty * q[0] twz = tz * q[0] txx = tx * q[1] txy = ty * q[...
2.75
3
train_cnn.py
hee9joon/Single-Image-Super-Resolution
5
37267
import os import numpy as np import warnings warnings.filterwarnings('ignore') import torch import torch.nn as nn from torchvision.utils import save_image from utils import get_lr_scheduler, sample_images, inference # Reproducibility # torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False ...
2.4375
2
8_kyu/Finish_Guess_the_Number_Game.py
UlrichBerntien/Codewars-Katas
0
37268
<reponame>UlrichBerntien/Codewars-Katas class Guesser: def __init__(self, number, lives): self.number = number self.lives = lives def guess(self,n): if self.lives < 1: raise Exception("Omae wa mo shindeiru") match = n == self.number if not match: ...
3.171875
3
GGL_LensCats/CREATE_FITS_HEALPIX_MASKS/BOSS_2dFLenS_healpix_masks.py
KiDS-WL/Cat_to_Obs_K1000_P1
7
37269
############################## ## MFP_K1000.py ## ## <NAME> ## ## Version 2020.03.25 ## ############################## import os import os.path as osp import time import subprocess as spc import numpy as np import scipy as sp import astropy.io.fits as fits import h...
1.664063
2
2019/try/simple.py
rishidevc/stkovrflw
0
37270
def get_assign(user_input): key, value = user_input.split("gets") key = key.strip() value = int(value.strip()) my_dict[key] = value print(my_dict) def add_values(num1, num2): return num1 + num2 print("Welcome to the Adder REPL.") my_dict = dict() while True: user_input = input("???") ...
3.890625
4
mecc/middleware.py
unistra/eva
0
37271
from django.contrib.auth.models import User from mecc.apps.years.models import UniversityYear class UsefullDisplay(object): def process_request(self, request): # always sent real user in order e.g. to display last first name if request.session.get('is_spoofed_user'): u = User.objects....
2.421875
2
solitude/_commandline/main.py
incerto-crypto/solitude
7
37272
#!/usr/bin/env python # Copyright (c) 2019, Solitude Developers # # This source code is licensed under the BSD-3-Clause license found in the # COPYING file in the root directory of this source tree from typing import List, Tuple # noqa import sys import os import argparse import datetime import binascii import json ...
2.140625
2
pypy/module/cpyext/typeobjectdefs.py
benoitc/pypy
1
37273
from pypy.rpython.lltypesystem import rffi, lltype from pypy.rpython.lltypesystem.lltype import Ptr, FuncType, Void from pypy.module.cpyext.api import (cpython_struct, Py_ssize_t, Py_ssize_tP, PyVarObjectFields, PyTypeObject, PyTypeObjectPtr, FILEP, Py_TPFLAGS_READYING, Py_TPFLAGS_READY, Py_TPFLAGS_HEAPTYPE) fr...
1.875
2
photobooth/1-web-base-layout/app/views.py
albertoSoto/raspberry-tic-projects
0
37274
<filename>photobooth/1-web-base-layout/app/views.py<gh_stars>0 from flask import render_template, flash, redirect from app import app @app.route('/') @app.route('/index') def index(): user = {'nickname': 'Berto'} posts = [ { 'author': {'nickname': 'Alum Post 1'}, 'body': 'This ...
2.21875
2
twstock/stock.py
LorneWu/twstock
0
37275
<reponame>LorneWu/twstock # -*- coding: utf-8 -*- import datetime import urllib.parse from collections import namedtuple from operator import attrgetter from time import sleep from twstock.proxy import get_proxies import os import json try: from json.decoder import JSONDecodeError except ImportError: JSONDec...
2.40625
2
kth_power.py
UPstartDeveloper/Problem_Solving_Practice
0
37276
""" Solution for Sort Integers by The Power Value: https://leetcode.com/problems/sort-integers-by-the-power-value/ """ class Solution: def getKth(self, lo: int, hi: int, k: int) -> int: # Can I calculate the power of an integer? # if two ints have same power, sort by the ints # power of 1...
3.890625
4
aruco-decoder/tests/test_aruco_detection_blue.py
Shinyhero36/Info
2
37277
import os import unittest from aruco import ArucoDetector class TestArucoDetectionBlue(unittest.TestCase): ar = ArucoDetector() BLUE = 13 def test_blue(self): result = self.ar.read_image(os.path.abspath("./datasets/blue.jpg")) self.assertEqual(self.BLUE, result) def test_blue_tilt...
2.96875
3
script.py
michaelihwang/speedtest-monitor
1
37278
import sys import time from datetime import datetime from traceback import print_exc import speedtest from decorator import restartable KILOBYTE = 1024 MEGABYTE = 1024 * KILOBYTE REPORT_FREQ = 60 def test_setup(st): st.get_servers() st.get_best_server() st.download() # bits/s st.upload() # bi...
2.609375
3
reports/management/mw.py
Wellheor1/l2
10
37279
import os from importlib import import_module from django.apps import apps from django.db.migrations.loader import MigrationLoader from django.db.migrations.serializer import serializer_factory from django.db.models import ForeignKey, ManyToManyField from django.utils.inspect import get_func_args from django.utils.mod...
2.25
2
example/011_matching_zero_or_more_repetitions.py
mafda/regex_101
0
37280
""" Task You have a test string S. Your task is to write a regex that will match S using the following conditions: S should begin with 2 or more digits. After that, S should have 0 or more lowercase letters. S should end with 0 or more uppercase letters """ import re Regex_Pattern = r'^[\d]{2,}[a-z]*[A-Z]*$' print...
4.1875
4
day-16/part_2.py
leotappe/aoc-2021
0
37281
""" Advent of Code 2021 | Day 16 | Part 2 """ import sys import math class Packet: def __init__(self, version, type_id): self.version = version self.type_id = type_id class Literal(Packet): def __init__(self, version, type_id, value): super().__init__(version, type_id) self.va...
3.09375
3
pyspark/test/bigdl/test_engine_env.py
twicoder/BigDL
55
37282
# # Copyright 2016 The BigDL Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
2.125
2
hex-to-dec/eval.py
adiyen/jetson-projects
0
37283
# MIT License # Copyright (c) 2019 JetsonHacks # See license # Using a CSI camera (such as the Raspberry Pi Version 2) connected to a # NVIDIA Jetson Nano Developer Kit using OpenCV # Drivers for the camera and OpenCV are included in the base image from __future__ import print_function import os import argparse impor...
2.40625
2
graphics/__main__.py
wangyibin/biowy
1
37284
<reponame>wangyibin/biowy #!/usr/bin/env python # -*- coding:utf-8 -*- # @Time: 2019/1/8 16:41 from bioway.apps.base import dmain if __name__ == "__main__": dmain()
0.980469
1
sparse_operation_kit/sparse_operation_kit/core/initialize.py
marsmiao/HugeCTR
0
37285
<reponame>marsmiao/HugeCTR """ Copyright (c) 2021, <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.apache.org/licenses/LICENSE-2.0 Unless required by applicable law o...
1.710938
2
ErrorsAndExceptionsHandling/assignment.py
theprogrammingthinker/Python-practice
1
37286
<filename>ErrorsAndExceptionsHandling/assignment.py try: for i in ['a', 'b', 'c']: print(i ** 2) except TypeError: print("An error occured!") x = 5 y = 0 try: z = x /y print(z) except ZeroDivisionError: print("Can't devide by zero") finally: print("All done") def ask(): while Tru...
3.75
4
ex1/owais/imu_exercise.py
balintmaci/drone_intro_exercises
0
37287
<gh_stars>0 #!/usr/bin/python # -*- coding: utf-8 -*- # IMU exercise # Copyright (c) 2015-2020 <NAME> <EMAIL> <EMAIL> ##### Insert initialize code below ################### ## Uncomment the file to read ## fileName = 'imu_razor_data_static.txt' #fileName = 'imu_razor_data_pitch_55deg.txt' #fileName = 'imu_razor_data...
2.78125
3
theroot/users_bundle/models/address.py
Deviad/Adhesive
0
37288
from theroot.db import * from theroot.users_bundle.models.user_info import address_user_table class Address(db.Model): __tablename__ = 'addresses' id = db.Column(db.Integer, primary_key=True, autoincrement=True) address_line = db.Column(db.String(255), unique=False, nullable=False) zip = db.Column(db...
2.625
3
aoc/day06_2.py
GitOnUp/Advent2021
0
37289
from aoc.day06_1 import run if __name__ == "__main__": print(run(256))
1.109375
1
pymatgen/io/abinitio/workflow.py
miaoliu/pymatgen
0
37290
""" Abinit workflows """ from __future__ import division, print_function import sys import os import os.path import shutil import abc import collections import functools import numpy as np from pprint import pprint from pymatgen.core.lattice import Lattice from pymatgen.core.structure import Structure from pymatgen....
1.671875
2
mdstudio/mdstudio/deferred/__init__.py
NLeSC/LIEStudio
10
37291
<gh_stars>1-10 __all__ = ['chainable', 'make_deferred', "return_value", 'lock']
1.09375
1
setup.py
TheMatjaz/RangeForce
0
37292
<reponame>TheMatjaz/RangeForce #!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright © 2019-2020, <NAME> <<EMAIL>> <https://matjaz.it>. # Released under the BSD 3-Clause License """Package setup for the Rangeforce library.""" from distutils.core import setup # noinspection PyUnresolvedReferences import setupt...
1.242188
1
dataset/Dataset Processing/data_processing.py
Eashwar-S/Icy-Road-Website
0
37293
#!/usr/bin/env python # coding: utf-8 # In[10]: import os import pandas as pd import networkx as nx import matplotlib.pyplot as plt import random as rd # In[11]: def readFile(folderPath): with open(folderPath, 'r') as f: fileContents = f.readlines() return fileContents # In[12]: def fillI...
2.84375
3
settings.py
ErikRichardS/mnist-ann
0
37294
<filename>settings.py NR_CLASSES = 10 hyperparameters = { "number-epochs" : 30, "batch-size" : 100, "learning-rate" : 0.005, "weight-decay" : 1e-9, "learning-decay" : 1e-3 }
1.429688
1
strategy/managers.py
moshthepitt/probsc
0
37295
from core.managers import CoreManager class StrategicThemeManager(CoreManager): pass class ObjectiveManager(CoreManager): pass
1.304688
1
03 Prime Number .py
yoursamlan/FunWithNumbers
0
37296
# A prime number is a positive integer greater than one, that has no positive integer factors except one and itself. # Since we have already dealt with number of factors of a number, I'm thinking to implement this idea finding prime number. # The prime number has the factor of 1 and itself. # So, number of factors of a...
4.15625
4
upload2db/upload2db.py
rhoerbe/eu23enerwatch
0
37297
<reponame>rhoerbe/eu23enerwatch<gh_stars>0 """ Upload samples into database """ import os import sys import psycopg2 from pathlib import Path import constants def main(): password = os.environ['<PASSWORD>'] conn = psycopg2.connect(host="dc.idn.local", dbname="eu23enerwatch", user="eu23enerwatch", password=p...
2.359375
2
tests/unit/test_heap.py
thoughteer/edera
3
37298
import pytest from edera import Heap def test_heap_is_initially_empty(): assert not Heap() def test_pushing_items_increases_heap_size(): heap = Heap() for i in range(1, 6): heap.push(str(i), 0) assert len(heap) == i def test_top_of_heap_always_has_highest_priority(): heap = Heap()...
2.734375
3
curso_python#07.py/desafio7.1.py
robinson-85/python_curso_em_video
0
37299
''' 7. Desenvolva um programa que leia as duas notas de um aluno, calcule e mostre a sua média. ''' import sys try: n1 = float(input("Primeira nota do aluno: ")) except Exception as error: print("Voce deve informar apenas numeros") sys.exit() try: n2 = float(input("Segunda nota do aluno: ")) except ...
4.03125
4