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
LinkedList/test XOR.py
ikaushikpal/DS-450-python
3
30600
# import required module import ctypes # create node class class Node: def __init__(self, value): self.value = value self.npx = 0 # create linked list class class XorLinkedList: # constructor def __init__(self): self.head = None self.tail = None self.__nodes = [] # method to insert no...
3.96875
4
opticmedian/utils/file_reader.py
QuicqDev/OpticRescue
2
30601
""" class to read files in specific ways """ import glob import random class Filer: """ read files """ def __init__(self, file_path): self.path = file_path def get_random_iter(self): """ get file contents in random """ nb_files = sum(1 for _ in glob.iglob(self.path)) file_iter = glob.glob(self.path...
3.484375
3
pypiv/velofilter.py
jr7/pypiv
7
30602
import numpy as np from scipy.stats import linregress as li from math import exp def calc_factor(field,stepsize=0.01): """ Function for calculation of the summed binning. The returned result is an integral over the binning of the velocities. It is done for the negative and positive half separately. ...
3.75
4
lib/floppy.py
FlorianPoot/Floppy
0
30603
from machine import Pin, UART from grip import Grip import time class Floppy: AXIS_POS_LIMIT = (0, 5, 5) AXIS_NEG_LIMIT = (-7.5, 0, -5) def __init__(self): # region Attributes self._speed = 20 self._buffer = 0 self._pos_tracker = [0.0, 0.0, 0.0] # endregion ...
2.765625
3
WeatherStationSensorsReader/controllers/wind_measurement_controller.py
weather-station-project/weather-station-sensors-reader
0
30604
<gh_stars>0 from controllers.controller import Controller from dao.wind_measurement_dao import WindMeasurementDao from sensors.wind_measurement_sensor import WindMeasurementSensor class WindMeasurementController(Controller): """ Represents the controller with the wind measurement sensor and DAO """ def __ini...
2.515625
3
Alignment/CommonAlignmentProducer/python/ALCARECOTkAlMinBias_Output_cff.py
ckamtsikis/cmssw
852
30605
<gh_stars>100-1000 import FWCore.ParameterSet.Config as cms # AlCaReco for track based alignment using MinBias events OutALCARECOTkAlMinBias_noDrop = cms.PSet( SelectEvents = cms.untracked.PSet( SelectEvents = cms.vstring('pathALCARECOTkAlMinBias') ), outputCommands = cms.untracked.vstring( ...
1.453125
1
dashboard/migrations/0005_usercacherefreshtime.py
Wassaf-Shahzad/micromasters
32
30606
<gh_stars>10-100 # -*- coding: utf-8 -*- # Generated by Django 1.9.10 on 2016-11-04 21:12 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations....
1.578125
2
easy/836-Rectangle Overlap.py
Davidxswang/leetcode
2
30607
""" https://leetcode.com/problems/rectangle-overlap/ A rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) are the coordinates of its bottom-left corner, and (x2, y2) are the coordinates of its top-right corner. Two rectangles overlap if the area of their intersection is positive. To be clear, two rec...
3.875
4
src/vaccinebot_token.py
DPS0340/vaccine-dispenser
2
30608
import os def get_token(): return os.environ['VACCINEBOT_TOKEN']
1.539063
2
fluiddb/scripts/testing.py
fluidinfo/fluiddb
3
30609
<gh_stars>1-10 import logging from fluiddb.data.store import getMainStore from fluiddb.exceptions import FeatureError from fluiddb.model.namespace import NamespaceAPI from fluiddb.model.tag import TagAPI from fluiddb.model.user import UserAPI, getUser TESTING_DATA = { u'users': [ u'testuser1', u'...
2.375
2
prediction/main_ml.py
Anukriti12/OptumStratethon2.0
1
30610
import urllib3 import pandas as pd import numpy as np import zipfile import copy import pickle import os from esig import tosig from tqdm import tqdm from multiprocessing import Pool from functools import partial from os import listdir from os.path import isfile, join from sklearn.ensemble import RandomForestClassifier...
2.421875
2
NeuralNetworkRef/create_pics.py
cmt-qo/cm-flakes
6
30611
#------------------------------------------------------------------------------- # Filename: create_pics.py # Description: creates square pictures out of a picture which is mostly empty # for training a neural network later. # The parameters to fool around with include: # factor: scaled down image for faster imag...
2.96875
3
pyomt5/api/__init__.py
paulorodriguesxv/pyomt5
8
30612
from .metatradercom import (MetatraderCom, ConnectionTimeoutError, DataNotFoundError) from .timeframe import MT5TimeFrame
1.0625
1
driverapp/models.py
gabyxbinnaeah/Bus-Booking
0
30613
<reponame>gabyxbinnaeah/Bus-Booking from django.db import models from django.contrib.auth.models import AbstractUser # Create your models here. class Driver(models.Model): name = models.CharField(max_length=30) password = models.CharField(max_length=30) email = models.EmailField() Contact = models.Char...
2.53125
3
tests/helper.py
MSLNZ/MSL-IO
6
30614
""" Helper functions for the tests """ import os import numpy as np from msl.io import read def read_sample(filename, **kwargs): """Read a file in the 'samples' directory. Parameters ---------- filename : str The name of the file in the samples/ directory Returns ------- A root...
2.75
3
imagepy/tools/Draw/floodfill_tol.py
adines/imagepy
1
30615
# -*- coding: utf-8 -*- """ Created on Wed Oct 19 17:35:09 2016 @author: yxl """ from imagepy.core.engine import Tool import numpy as np from imagepy.core.manager import ColorManager from imagepy.core.draw.fill import floodfill class Plugin(Tool): title = 'Flood Fill' para = {'tor':10, 'con':'8-connect'} ...
2.28125
2
authors/apps/articles/signals.py
andela/ah-backend-summer
1
30616
"""Signal dispatchers and handlers for the articles module""" from django.db.models.signals import post_save from django.dispatch import receiver, Signal from authors.apps.articles.models import Article # our custom signal that will be sent when a new article is published # we could have stuck to using the post_save ...
2.5
2
benchmarks/roberta/benchmark_tft.py
legacyai/tf-transformers
116
30617
"""TFTBechmark scripts""" import shutil import tempfile import time import tensorflow as tf import tqdm from datasets import load_dataset from transformers import RobertaTokenizerFast from tf_transformers.models import Classification_Model from tf_transformers.models import RobertaModel as Model _ALLOWED_DECODER_TYP...
2.140625
2
Linear Structures/LinkedList/Single Linkedlist/LinkedList Traversal.py
Ash515/PyDataStructures
7
30618
<gh_stars>1-10 class Node(): def __init__(self,data): self.data=data self.ref=None class LinkedList(): def __init__(self): self.head=None def Print_ll(self): n=self.head if n is None: print("LinkedList is empty") else: while n is not No...
3.703125
4
devlivery/ext/migrate/__init__.py
wlsouza/flasklivery
0
30619
<gh_stars>0 from flask import Flask from flask_migrate import Migrate from devlivery.ext.db import db migrate = Migrate() def init_app(app: Flask): migrate.init_app(app, db)
1.570313
2
src/query_planner/storage_plan.py
alilakda/Eva
0
30620
from src.models.catalog.video_info import VideoMetaInfo from src.query_planner.abstract_plan import AbstractPlan from src.query_planner.types import PlanNodeType class StoragePlan(AbstractPlan): """ This is the plan used for retrieving the frames from the storage and and returning to the higher levels. ...
2.59375
3
env/lib/python3.6/base64.py
xianjunzhengbackup/Cloud-Native-Python
2
30621
/usr/local/lib/python3.6/base64.py
1.078125
1
python-scripts/3nPlus1.py
leo237/scripts
0
30622
<filename>python-scripts/3nPlus1.py import logging import matplotlib.pyplot as plt import argparse from typing import List from enum import Enum from enum import Enum class Constants: class PlotType(Enum): HAILSTONE = 'HAILSTONE' PEAK = 'PEAK' STOPPING_TIMES = 'STOPPING_TIMES' class Stats: def __init__(self, ...
3.078125
3
test/functional/tests/initialize/test_clean_reboot.py
Ostrokrzew/open-cas-linux
139
30623
# # Copyright(c) 2020-2021 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause-Clear # import os import pytest from api.cas import casadm from api.cas.cache_config import CacheMode from core.test_run import TestRun from storage_devices.disk import DiskTypeSet, DiskType, DiskTypeLowerThan from test_tools.dd impo...
1.929688
2
4/state/ResultState.py
ytyaru/Pygame.GameState.201707251432
0
30624
import pygame from pygame.locals import * from .GameState import GameState class ResultState(GameState): def __init__(self, stateSwitcher): super().__init__(stateSwitcher) def Event(self, event): if event.type == KEYDOWN: if event.key == K_RETURN or event.key == K_SPACE or event.key == K_z:...
2.8125
3
bindgen.py
fitzgen/wasmtime-py
0
30625
# type: ignore # This is a small script to parse the header files from wasmtime and generate # appropriate function definitions in Python for each exported function. This # also reflects types into Python with `ctypes`. While there's at least one # other generate that does this already it seemed to not quite fit our p...
2.296875
2
Chapter38.ManagedAttributes/3-desc-state-inst.py
mindnhand/Learning-Python-5th
0
30626
<filename>Chapter38.ManagedAttributes/3-desc-state-inst.py #!/usr/bin/env python3 #encoding=utf-8 #------------------------------------------------ # Usage: python3 3-desc-state-inst.py # Description: descriptor for attribute intercept #------------------------------------------------ class InstState: # Using...
2.640625
3
src/property_app/app_info.py
almostprod/property-app
2
30627
<reponame>almostprod/property-app import time from dataclasses import dataclass from datetime import date, datetime from property_app.config import get_config config = get_config() @dataclass class AppInfo: project: str = config.ASGI_APP commit_hash: str = config.APP_BUILD_HASH build_date: date = datet...
2.25
2
services/explorer/config/gunicorn/config.py
cheperuiz/elasticskill
0
30628
<gh_stars>0 bind = "0.0.0.0:5000" backlog = 2048 workers = 1 worker_class = "sync" threads = 16 spew = False reload = True loglevel = "debug"
1.046875
1
Boot2Root/hackthebox/Tenten/files/exploit.py
Kan1shka9/CTFs
21
30629
<reponame>Kan1shka9/CTFs<gh_stars>10-100 import requests print """ CVE-2015-6668 Title: CV filename disclosure on Job-Manager WP Plugin Author: <NAME> Blog: https://vagmour.eu Plugin URL: http://www.wp-jobmanager.com Versions: <=0.7.25 """ website = raw_input('Enter a vulnerable website: ') filename ...
2.828125
3
setup.py
iomintz/sql-remove-comma
0
30630
#!/usr/bin/env python3 import setuptools setuptools.setup( name='sql-remove-comma', description='remove illegal trailing commas from your SQL code', use_scm_version=True, author='<NAME>', author_email='<EMAIL>', long_description=open('README.md').read(), long_description_content_type='text/markdown', license=...
1.46875
1
RQ1and2/code/results/test_all.py
CESEL/BatchBuilderResearch
0
30631
from utils import project_list from learning import IncrementalLearningModel def get_testing_dataset_size(prj): l = IncrementalLearningModel(prj['name'], 'RF', 30, 1) y_proba, y_test = l.get_predicted_data() return len(y_test) def main(): for idx, prj in enumerate(project_list): print(prj['...
2.703125
3
src/zebra_refresh.py
r0x73/alfred-zebra
3
30632
import zebra from workflow import Workflow if __name === '__main__': wf = Workflow() wf.cache_data('zebra_all_projects', zebra.get_all_projects()) wf.cache_data('zebra_aliased_activities', zebra.get_aliased_activities())
1.585938
2
car_core/car.py
edwardyehuang/CAR
6
30633
# ================================================================ # MIT License # Copyright (c) 2022 edwardyehuang (https://github.com/edwardyehuang) # ================================================================ import tensorflow as tf from iseg.layers.normalizations import normalization from iseg.utils.attent...
2.109375
2
packs/orion/actions/list_sdk_verb_args.py
prajwal222/prajwal
0
30634
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
2.046875
2
Ui_share.py
Mochongli/lanzou-gui
2
30635
<filename>Ui_share.py<gh_stars>1-10 # -*- coding: utf-8 -*- # Form implementation generated from reading ui file '/home/rach/Documents/lanzou-gui/share.ui' # # Created by: PyQt5 UI code generator 5.13.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Dia...
1.601563
2
codeforces/anirudhak47/1335/A.py
anirudhakulkarni/codes
3
30636
for t in range(int(input())): n=int(input()) if n%2==0: print(int(n/2-1)) else: print(int(n//2))
3.6875
4
imageclassification/training/session.py
aisosalo/CIFAR-10
4
30637
<gh_stars>1-10 import sys import os import time import random import numpy as np from termcolor import colored from functools import partial from tensorboardX import SummaryWriter import torch from torch.utils.data import DataLoader from torchvision import transforms as tv_transforms import solt.transforms as sl...
2
2
remotelogin/oper_sys/busybox/__init__.py
filintod/pyremotelogin
1
30638
from . import shellcommands from ..linux import LinuxOS __author__ = '<NAME> (<EMAIL>)' # TODO: break unix/linux to a bare and expand from there class BusyBoxOS(LinuxOS): """ Embedded Linux device """ name = 'busybox' cmd = shellcommands.get_instance()
2.3125
2
DIP/src/utils/utils.py
Jay-Lewis/phase_retrieval
4
30639
<gh_stars>1-10 import math import numpy as np import os.path import urllib.request as urllib import gzip import pickle import pandas as pd from scipy.misc import imsave from src.utils.download import * import src.utils.image_load_helpers as image_load_helpers import glob def CelebA_load(label_data = None, image_paths...
2.328125
2
2. Conditional and Repetitive Execution/2.2. Even or Odd.py
ahmetutkuozkan/my_ceng240_exercises_solutions
0
30640
<filename>2. Conditional and Repetitive Execution/2.2. Even or Odd.py<gh_stars>0 value1 = int(input()); value2 = value1//100 if value1 % 2==0 and value2 % 2==0: print("Even") elif value1 % 2==0 and value2 % 2==1: print("Even Odd") elif value1 % 2==1 and value2 % 2==1: print("Odd") elif value1 % 2==1 ...
3.65625
4
First_course/ex2_2.py
laetrid/learning
0
30641
#!/usr/bin/env python column1 = "NETWORK_NUMBER" column2 = "FIRST_OCTET_BINARY" column3 = "FIRST_OCTET_HEX" ip_addr = '172.16.58.3' formatter = '%-20s%-20s%-20s' octets = ip_addr.split('.') a = bin(int(octets[0])) b = hex(int(octets[0])) print "" print formatter % (column1, column2, column3) print formatter % (ip_ad...
2.78125
3
serendipity/set_and_map/singly_linked_list_set.py
globotree/serendipity
3
30642
from serendipity.linear_structures.singly_linked_list import LinkedList class Set: def __init__(self): self._list = LinkedList() def get_size(self): return self._list.get_size() def is_empty(self): return self._list.is_empty() def contains(self, e): return self._list...
3.375
3
settings.py
gaomugong/flask-demo
12
30643
<reponame>gaomugong/flask-demo # -*- coding: utf-8 -*- """ settings = conf.default.py + settings_{env}.py """ # import os # import importlib from conf.default import * # ======================================================================================== # IMPORT ENV SETTINGS # ==...
2.53125
3
scripts/elitech_device.py
grvstick/elitech-datareader
58
30644
#!/usr/bin/env python # coding: utf-8 import argparse import elitech import datetime from elitech.msg import ( StopButton, ToneSet, AlarmSetting, TemperatureUnit, ) from elitech.msg import _bin import six import os def main(): args = parse_args() if (args.command == 'simple-set'): com...
2.546875
3
Assignment 1/task3/map.py
JeetKamdar/Big-Data-Assignments
0
30645
#!/usr/bin/env python import sys import string import re for line in sys.stdin: if '"' in line: entry = re.split(''',(?=(?:[^'"]|'[^']*'|"[^"]*")*$)''', line) else: entry = line.split(",") licence_type = entry[2] amount_due = entry[-6] print("%s\t%s" % (licence_type, amount_due))
3.4375
3
src/aijack/attack/inversion/__init__.py
luoshenseeker/AIJack
1
30646
from .gan_attack import GAN_Attack # noqa: F401 from .generator_attack import Generator_Attack # noqa: F401 from .gradientinversion import GradientInversion_Attack # noqa: F401 from .mi_face import MI_FACE # noqa: F401 from .utils import DataRepExtractor # noqa: F401
1.09375
1
INBa/2015/ZORIN_D_I/task_4_7.py
YukkaSarasti/pythonintask
0
30647
<filename>INBa/2015/ZORIN_D_I/task_4_7.py # Задача 4. Вариант 7. # Напишите программу, которая выводит имя, под которым скрывается <NAME>. Дополнительно необходимо вывести область интересов указанной личности, место рождения, годы рождения и смерти (если человек умер), вычислить возраст на данный момент (или момент сме...
2.09375
2
backend/api/models/request.py
haroldadmin/transportation-analytics-platform
0
30648
from flask_restplus import fields, Model def add_models_to_namespace(namespace): namespace.models[route_request_model.name] = route_request_model route_request_model = Model("Represents a Route Request", { "id": fields.Integer(description="Unique identifier for the ride"), "start_point_lat": fields.Floa...
2.828125
3
uitester/ui/main_window.py
IfengAutomation/uitester
4
30649
<filename>uitester/ui/main_window.py<gh_stars>1-10 # @Time : 2016/8/17 10:56 # @Author : lixintong import logging import os import sys from PyQt5 import uic from PyQt5.QtCore import pyqtSignal, Qt from PyQt5.QtWidgets import QMainWindow, QApplication, QDesktopWidget, QMessageBox from uitester.test_manager.tester ...
1.804688
2
demos/DPSRGAN/dpsrmodels/basicblock.py
hduba/MDF
1
30650
from collections import OrderedDict import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Module ''' # =================================== # Advanced nn.Sequential # reform nn.Sequentials and nn.Modules # to a single nn.Sequential # =================================== ''' def sequen...
2.6875
3
ml-models-analyses/readahead-mixed-workload/kmlparsing.py
drewscottt/kernel-ml
167
30651
<filename>ml-models-analyses/readahead-mixed-workload/kmlparsing.py<gh_stars>100-1000 # # Copyright (c) 2019-2021 <NAME> # Copyright (c) 2021-2021 <NAME> # Copyright (c) 2021-2021 <NAME> # Copyright (c) 2021-2021 <NAME> # Copyright (c) 2020-2021 <NAME> # Copyright (c) 2020-2021 <NAME> # Copyright (c) 2019-2021 <NAME> #...
2.234375
2
src/py_dss_tools/secondary/Circuit.py
eniovianna/py_dss_tools
3
30652
# -*- encoding: utf-8 -*- """ Created by <NAME> at 01/09/2021 at 19:51:44 Project: py_dss_tools [set, 2021] """ import attr import pandas as pd from py_dss_tools.model.other import VSource from py_dss_tools.utils import Utils @attr.s class Circuit(VSource): _name = attr.ib(validator=attr.validators.instance_of...
2.328125
2
day2.py
cjfuller/adventofcode2015
0
30653
<reponame>cjfuller/adventofcode2015<gh_stars>0 from dataclasses import dataclass from util import load_input, bear_init box_specs = load_input(2) @bear_init @dataclass class Box: l: int w: int h: int @classmethod def from_str(cls, s: str) -> "Box": l, w, h = tuple(map(int, s.split("x")...
3.1875
3
todo/commands/complete.py
Kuro-Rui/JojoCogs
0
30654
<reponame>Kuro-Rui/JojoCogs # Copyright (c) 2021 - Jojo#7791 # Licensed under MIT import asyncio from contextlib import suppress from typing import List import discord from redbot.core import commands from redbot.core.utils.chat_formatting import pagify from redbot.core.utils.predicates import MessagePredicate from ...
2.140625
2
network/demo_espat_ap_test.py
708yamaguchi/MaixPy_scripts
485
30655
<reponame>708yamaguchi/MaixPy_scripts # This file is part of MaixPY # Copyright (c) sipeed.com # # Licensed under the MIT license: # http://www.opensource.org/licenses/mit-license.php # from network_espat import wifi wifi.reset() print(wifi.at_cmd("AT\r\n")) print(wifi.at_cmd("AT+GMR\r\n")) ''' >>> reset... b'\r\n...
1.8125
2
scripts/plot_pca.py
taoyilee/ml_final_project
0
30656
<reponame>taoyilee/ml_final_project from preprocessing.dataset import SVHNDataset import numpy as np import configparser as cp from datetime import datetime as dt import os from sklearn.decomposition import PCA import pandas as pd import seaborn as sns import matplotlib.pyplot as plt if __name__ == "__main__": con...
2.75
3
DoodleParser.py
luigiberducci/turni-biblioteca
0
30657
<reponame>luigiberducci/turni-biblioteca # File: DoodleParser.py # # Author: <NAME> # Date: 2018-11-30 import sys import datetime import requests import json class DoodleParser: """ Retrieves poll data from doodle.com and fill data structure for participants, options and preferences. """ ...
3.359375
3
bot-stopots/configuracao.py
leosantosx/bot-stopots
2
30658
<reponame>leosantosx/bot-stopots<filename>bot-stopots/configuracao.py """ VARIÁVEIS DE CONFIGURAÇÃO DO BOT True PARA ATIVAR E False PARA DESATIVAR """ escrever_nos_campos = True # PREENCHE OS CAMPOS COM AS RESPOSTAS modo_de_aprendizado = False # APRENDE NOVAS RESPOSTAS SALVANDO AS RESPOSTAS DOS OUTROS JOGADORES ...
1.1875
1
InterpolLagrange.py
davidfotsa/Numerical_Methods_With_Python
1
30659
<reponame>davidfotsa/Numerical_Methods_With_Python # -*- coding: utf-8 -*- def a(i,x,X,Y): rep=1 for j in range(min(len(X),len(Y))): if (i!=j): rep*=(x-X[j])/(X[i]-X[j]) return (rep) def P(x,X,Y): rep=0 for i in range(min(len(X),len(Y))): rep+=a(i,x,X,Y)*Y[i] return (rep) X=[-2,0,1,2] ...
3.8125
4
stockroom_bot/stock_products.py
amjadmajid/rosbook
442
30660
<filename>stockroom_bot/stock_products.py #!/usr/bin/env python import rospy, tf from gazebo_msgs.srv import * from geometry_msgs.msg import * if __name__ == '__main__': rospy.init_node("stock_products") rospy.wait_for_service("gazebo/delete_model") # <1> rospy.wait_for_service("gazebo/spawn_sdf_model") delete...
2.28125
2
code/GC_mass_evolv.py
EnthalpyBill/GC-formation
0
30661
''' Mass evolution of GC Created Apr. 2020 Last Edit Apr. 2020 By <NAME> ''' import numpy as np # Note: all times in [Gyr] # ***** Dynamic evolution of GC in Choksi & Gnedin (2018) ***** def t_tid_cg18(m): # Tidally-limited disruption timescale in Choksi & Gnedin (2018) P = 0.5 return 5 * ((m/2e5)**(2...
1.875
2
tests/test_deploy.py
NCAR/marbl-solutions
0
30662
<reponame>NCAR/marbl-solutions import solutions def test_deploy_config(): deploy_config = solutions.config.deploy_config assert deploy_config['reference_case'] == 'ref_case' assert type(deploy_config['reference_case_path']) == list assert deploy_config['reference_case_file_format'] == 'history' as...
2.265625
2
backend/home/models.py
crowdbotics-apps/test-29106
0
30663
from django.conf import settings from django.db import models class Tasks(models.Model): "Generated Model" task_name = models.TextField()
1.617188
2
tests/urls.py
xiu1/django-rest
0
30664
<filename>tests/urls.py from django.conf.urls import include, url from django.contrib import admin from rest.views import TestRestView, TestAuthHeaderView, TestAuthUrlView urlpatterns = [ url('^rest/$', TestRestView.as_view(), name='rest'), url('^auth_header_rest/$', TestAuthHeaderView.as_view(), name='rest_au...
1.820313
2
services/controllers/thruster_controller.py
gizmo-cda/g2x-submarine-v2
1
30665
import os import json from vector2d import Vector2D from interpolator import Interpolator from utils import map_range # Each game controller axis returns a value in the closed interval [-1, 1]. We # limit the number of decimal places we use with the PRECISION constant. This is # done for a few reasons: 1) it makes th...
3.1875
3
montagem/models.py
Glaysonvisgueira/agendamento-de-servico
0
30666
<gh_stars>0 from django.db import models LOJAS = ( ('TES', 'TES'), ('TEU', 'TEU'), ('TMA', 'TMA'), ('TPI', 'TPI'), ('TMO', 'TMO'), ('TEZ', 'TEZ'), ('TED', 'TED'), ('TPP', 'TPP'), ('TIM', 'TIM'), ('TEC', 'TEC'), ('RTT', 'RTT...
1.820313
2
em/src/dataset/metrics.py
tecdatalab/biostructure
0
30667
<filename>em/src/dataset/metrics.py import numpy as np from scipy.optimize import linear_sum_assignment def intersection_over_union(segmented_map, gt_map): s_array = segmented_map.getEmMap().data() gt_array = gt_map.getEmMap().data() labels = np.unique(gt_array) if s_array.shape != gt_array.shape: ...
2.40625
2
asq/test/test_pre_scan.py
SlamJam/asq
3
30668
import operator import unittest from asq.queryables import Queryable __author__ = "<NAME>" class TestPreScan(unittest.TestCase): def test_pre_scan_empty_default(self): a = [] b = Queryable(a).pre_scan().to_list() c = [] self.assertEqual(b, c) def test_pre_scan_s...
2.765625
3
magicmethod__str__.py
maahi07m/OOPS
1
30669
<filename>magicmethod__str__.py class ComplexNumber: # TODO: write your code here def __init__(self,real=0, imag=0): self.real_part = real self.imaginary_part = imag def __str__(self): return f"{self.real_part}{self.imaginary_part:+}i" if __name__ == "__main__": import json ...
3.765625
4
src/form/panel/ParamAdvancePanel.py
miu200521358/pmx_tailor
4
30670
<reponame>miu200521358/pmx_tailor # -*- coding: utf-8 -*- # import wx from form.panel.BasePanel import BasePanel from utils.MLogger import MLogger # noqa logger = MLogger(__name__) class ParamAdvancePanel(BasePanel): def __init__(self, frame: wx.Frame, export: wx.Notebook, tab_idx: int): super(...
1.976563
2
hexrd/ui/calibration/powder_calibration.py
bnmajor/hexrdgui
0
30671
<reponame>bnmajor/hexrdgui<filename>hexrd/ui/calibration/powder_calibration.py import numpy as np from scipy.optimize import leastsq, least_squares from hexrd import instrument from hexrd.matrixutil import findDuplicateVectors from hexrd.fitting import fitpeak from hexrd.ui.hexrd_config import HexrdConfig from hexrd...
2.265625
2
covid-tweets/process-tweets-2.py
kadams4/NLPCoronavirus
1
30672
import pandas as pd root = "Split/" types = ["train-70", "test-30"] for type in types: filenames = ["2020-03-"+str(i)+"-Labels-"+type for i in range(12, 29)] for suffix in ["pos", "neg", "neu"]: data = [] for filename in filenames: path = root + filename data += li...
2.828125
3
sample/crawler/login.py
xuegangliu/Python-Learning
0
30673
#!/usr/bin/python # -*- coding: UTF-8 -*- """ @Project: python @Date: 8/30/2018 9:53 PM @Author: xuegangliu @Description: login """ import urllib.request import http.cookiejar import urllib.parse def getOpener(header): '''构造文件头''' # 设置一个cookie处理器,它负责从服务器下载cookie到本地,并且在发送请求时带上本地的cookie coo...
2.78125
3
djangocms_comments/widgets.py
Nekmo/djangocms-comments-module
11
30674
from django.core.exceptions import SuspiciousOperation from django.core.signing import Signer, BadSignature from django.forms import HiddenInput signer = Signer() class SignedHiddenInput(HiddenInput): def __init__(self, include_field_name=True, attrs=None): self.include_field_name = include_field_name ...
2.28125
2
860-lemonade-change.py
Iciclelz/leetcode
0
30675
<reponame>Iciclelz/leetcode class Solution: def lemonadeChange(self, bills: List[int]) -> bool: money = [0, 0, 0] for x in bills: if x == 5: money[0] += 1 if x == 10: if money[0] >= 1: money[1] += 1 ...
3.578125
4
openspeech/search/beam_search_ctc.py
techthiyanes/openspeech
207
30676
<reponame>techthiyanes/openspeech<filename>openspeech/search/beam_search_ctc.py<gh_stars>100-1000 # MIT License # # Copyright (c) 2021 <NAME> and <NAME> and <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to ...
1.742188
2
Software/Services/__init__.py
Hackin7/BlockComPi
0
30677
#Do Not Edit #colors R G B white = (255, 255, 255) red = (255, 0, 0) green = ( 0, 255, 0) blue = ( 0, 0, 255) black = ( 0, 0, 0) cyan = ( 50, 255, 255) magenta = (255, 0, 255) yellow = (255, 255, 0) orange = (255, 127, 0) #The Service/Notifications List # L...
2.75
3
src/ml_fastapi/routers.py
sebastianschramm/ml_fastapi
2
30678
from fastapi import APIRouter from starlette.requests import Request router = APIRouter() @router.get('/') async def read_root(request: Request): return "ML serving with fastapi" @router.get('api/predict') async def predict_number(request: Request): model = request.app.ml_model return model.predict('bla...
2.390625
2
spinoffs/inference_gym/inference_gym/targets/eight_schools_test.py
PavanKishore21/probability
3,670
30679
# Copyright 2020 The TensorFlow Probability 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 o...
2.015625
2
ch01/dictionaries.py
PacktPublishing/Python-Networking-Cookbook
5
30680
<filename>ch01/dictionaries.py config = {} with open("config.txt", "r") as f: lines = f.readlines() for line in lines: key, value = line.split("=") value = value.replace("\n", "") config[key] = value print(f"Added key {key} with value {value}") user_key = input("Which key would...
3.6875
4
letra_m/extensions.py
frotacaio/tutorial_flask
0
30681
<filename>letra_m/extensions.py<gh_stars>0 """ Extensões populares Flask Mail - Fornece uma interface SMTP para o aplicativo Flask Flask WTF - Adicione renderização e validação de WTForms Flask SQLAlchemy - Adicionando suporte SQLAlchemy para o aplicativo Flask Flask Sijax-Sijax - biblioteca de interface-Python/jQu...
1.484375
1
File/Common/directory.py
nikminer/HomeCloud
0
30682
import os from django.http import HttpResponse from django.contrib.auth.decorators import login_required def isAccess(path): try: os.listdir(path) return True except PermissionError: return False @login_required def isExist(request): return HttpResponse(os.path.exists(os.path.abspat...
2.46875
2
plasmapy/examples/plot_distribution.py
techieashish/PlasmaPy
1
30683
<reponame>techieashish/PlasmaPy<gh_stars>1-10 """ 1D Maxwellian distribution function =================================== We import the usual modules, and the hero of this notebook, the Maxwellian 1D distribution: """ import numpy as np from astropy import units as u import matplotlib.pyplot as plt from astropy.cons...
2.71875
3
models/__init__.py
yoshikawat64m/kalman-variational-auto-encoder
0
30684
from .kvae import KVAE __all__ = ( 'KVAE', )
0.976563
1
get_color_wordcloud.py
Joe606/scrape_sportshoes
0
30685
<reponame>Joe606/scrape_sportshoes # -*- coding: utf-8 -*- import pymysql import time import os import matplotlib.pyplot as plt print(os.getcwd()) db = pymysql.connect( host='localhost', user='root', passwd='<PASSWORD>', database='男运动鞋' ) cur = db.cursor() cur.execute('select ...
2.828125
3
Lesson05_Strings/DNAExtravaganzaSOLUTION.py
WomensCodingCircle/CodingCirclePython
4
30686
<gh_stars>1-10 # A little bit of molecular biology # Codons are non-overlapping triplets of nucleotides. # ATG CCC CTG GTA ... - this corresponds to four codons; spaces added for emphasis # The start codon is 'ATG' # Stop codons can be 'TGA' , 'TAA', or 'TAG', but they must be 'in frame' with the start codon. The fi...
3.90625
4
backend/radio/views.py
dtcooper/jewpizza
5
30687
from django.conf import settings from django.core.exceptions import PermissionDenied from django.views.generic import TemplateView class LiquidsoapScriptView(TemplateView): content_type = "text/plain" template_name = "radio/radio.liq" def dispatch(self, request, *args, **kwargs): secret_key = req...
2
2
torcharc/module/merge.py
kengz/torcharc
1
30688
<filename>torcharc/module/merge.py<gh_stars>1-10 from abc import ABC, abstractmethod from torch import nn from typing import Dict, List import torch class Merge(ABC, nn.Module): '''A Merge module merges a dict of tensors into one tensor''' @abstractmethod def forward(self, xs: dict) -> torch.Tensor: # p...
3.0625
3
tests/milvus_benchmark/local_runner.py
NeatNerdPrime/milvus
1
30689
<gh_stars>1-10 import os import logging import pdb import time import random from multiprocessing import Process import numpy as np from client import MilvusClient import utils import parser from runner import Runner logger = logging.getLogger("milvus_benchmark.local_runner") class LocalRunner(Runner): """run lo...
2.21875
2
subsurface/geological_formats/segy_reader.py
andieie/subsurface
55
30690
from typing import Union from scipy.spatial.qhull import Delaunay from shapely.geometry import LineString from subsurface.structs.base_structures import StructuredData import numpy as np try: import segyio segyio_imported = True except ImportError: segyio_imported = False def read_in_segy(filepath: str, ...
2.359375
2
python_learning/basic_learning/lesson_interview.py
suncht/sun-python
0
30691
#生成器的创建,区分迭代器、生成器、推导式、生成器表达式 l_01 = [x for x in range(10)] #列表推导式 print(l_01) l_02 = (x for x in range(10)) #列表生成器表达式 print(l_02) class Fib: def __init__(self): self.prev = 0 self.curr = 1 def __iter__(self): #Fib是迭代对象, 因为Fib实现了__iter__方法 -->类/对象 return self def __next__(self...
4
4
hack/generateChartOptions.py
deissnerk/external-dns-management
0
30692
#!/bin/python # should be started from project base directory # helper script to regenerate helm chart file: partial of charts/external-dns-management/templates/deployment.yaml import re import os helpFilename = "/tmp/dns-controller-manager-help.txt" rc = os.system("make build-local && ./dns-controller-manager --he...
2.359375
2
test.py
ttran1904/MDP
0
30693
from MDP import MDP import unittest class MDPTestCase(unittest.TestCase): def test_small1(self): lst = [['a', 'a', 'b', 'b', 'c', 'c', 'd', 'd']] self.__printInput(lst) mdp = MDP(lst) mdp.run() # Get the result Transition Probabilities (dictionary) tp = mdp.getTrans...
2.9375
3
apps/purchases/migrations/0009_auto_20200502_0253.py
jorgesaw/kstore
0
30694
# Generated by Django 2.2.10 on 2020-05-02 05:53 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('purchases', '0008_auto_20200430_1617'), ] operations = [ migrations.RenameField( model_name='itempurchase', old_name='suppl...
1.710938
2
getKey.py
cychiang/spotify-lyrics
0
30695
<reponame>cychiang/spotify-lyrics def musixmatch(): with open('musixmatch.txt', 'r') as key: return key.readline()
2.390625
2
pylayers/antprop/examples/ex_meta.py
usmanwardag/pylayers
143
30696
from pylayers.gis.layout import * from pylayers.antprop.signature import * from pylayers.antprop.channel import * import pylayers.signal.waveform as wvf import networkx as nx import numpy as np import time import logging L = Layout('WHERE1_clean.ini') #L = Layout('defstr2.ini') try: L.dumpr() except: L.build()...
1.867188
2
code/dash_app/app.py
siwei-li/tweet_stock
0
30697
import dash from dash import Output, Input, dcc from dash import html from tabs import tab1, tab2 # from tab2_callbacks import tab2_out, upload_prediction, render_graph2 import flask server = flask.Flask(__name__) # define flask app.server external_stylesheets = [ { "href": "https://fonts.googleapis.com...
2.796875
3
18.py
christi-john/codechef-practice
0
30698
<reponame>christi-john/codechef-practice # REMISS for i in range(int(input())): A,B = map(int,input().split()) if A>B: print(str(A) + " " + str(A+B)) else: print(str(B) + " " + str(A+B))
3.40625
3
pydemic/data/__init__.py
uiuc-covid19-modeling/pydemic
6
30699
<gh_stars>1-10 __copyright__ = """ Copyright (C) 2020 <NAME> Copyright (C) 2020 <NAME> """ __license__ = """ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without ...
2.203125
2