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 |
|---|---|---|---|---|---|---|
tests/testing-populational.py | D3Mlab/ppandas | 1 | 53900 | import pandas as pd
from ppandas import PDataFrame
df1 = pd.read_csv("testing/populational1.csv")
df1 = df1.drop(columns=["Gender"])
pd1 = PDataFrame.from_populational_data(["Age"],df1,600)
pd1.visualise(show_tables=True) | 3.28125 | 3 |
hek/defs/eqip.py | holy-crust/reclaimer | 0 | 53901 | from .obje import *
from .item import *
from .objs.obje import ObjeTag
from supyr_struct.defs.tag_def import TagDef
# replace the object_type enum one that uses
# the correct default value for this object
obje_attrs = dict(obje_attrs)
obje_attrs[0] = dict(obje_attrs[0], DEFAULT=3)
eqip_attrs = Struct("eqip_... | 2.21875 | 2 |
corehq/apps/userreports/ui/widgets.py | kkrampa/commcare-hq | 1 | 53902 | <reponame>kkrampa/commcare-hq<filename>corehq/apps/userreports/ui/widgets.py
from __future__ import absolute_import
import json
from django import forms
import six
from corehq.util.python_compatibility import soft_assert_type_text
class JsonWidget(forms.Textarea):
def render(self, name, value, attrs=None, rende... | 1.78125 | 2 |
pypen/drawing/pypen_class.py | Canvim/Pyper | 2 | 53903 | import ctypes
from pypen.drawing.color import Color
from pypen.utils.math import TAU
from pypen.settings import default_settings
import cairo
from pyglet import gl, image
class PyPen():
def __init__(self, user_sketch):
self.user_sketch = user_sketch
self.surface_data = None
self.surface =... | 2.515625 | 3 |
src/optimizer.py | thayerAlshaabi/radiomics | 8 | 53904 | # coding: utf-8
""" MIT License """
'''
<NAME> & <NAME>
<NAME> & <NAME>
---
Description:
Function designed to evaluate all parameters provided to the gp and identify the best parameters.
Saves all fitness of individuals by logging them into csv files which will then be evaluated on plots.py... | 2.890625 | 3 |
HCm-opt/HCm_v4.2/HCm_v4.2.py | Borja-Perez-Diaz/HII-CHI-Mistry | 0 | 53905 | <reponame>Borja-Perez-Diaz/HII-CHI-Mistry
# Filename: HII-CHCm_v 4.2.py
import string
import numpy as np
import sys
#sys.stderr = open('errorlog.txt', 'w')
#Function for interpolation of grids
def interpolate(grid,z,zmin,zmax,n):
ncol = 9
vec = []
for col in range(ncol):
inter = 0
no_inter = ... | 2.765625 | 3 |
data-structures/lists.py | ermus19/python-examples | 0 | 53906 | a = ['a', 'b', 'c', 'd']
print("This is a list", a)
print("It is", len(a), "elements length.")
print("Let's check if element 'd' is in the list:", 'd' in a)
print("This should be the maximun value of the list", max(a))
print("This should be the minnimun value of the list", min(a))
print("This is a list, item ... | 4.09375 | 4 |
doc/example_esp32serial.py | a-bombarda/mvm-gui | 2 | 53907 | """
Example script on how to use the esp32serial library.
For the documentation. open a python and type:
>>> import esp32serial
>>> help(esp32serial.ESP32Serial)
"""
# import the library
import esp32serial
# create a connection
esp32 = esp32serial.ESP32Serial("/dev/ttyACM0")
# get an observable or parameter, conver... | 3.28125 | 3 |
source/60-Verifica_palíndromo.py | FelixLuciano/DesSoft-2020.2 | 0 | 53908 | <filename>source/60-Verifica_palíndromo.py
# Verifica palíndromo
# Faça uma função que recebe uma string e retorna True se ela for um palíndromo (é a mesma de trás para frente), ou False caso contrário. Por exemplo, a string 'roma é amor' é um palíndromo.
# Use fatiamento.
# Desafio 1: dá para fazer essa função com ape... | 3.296875 | 3 |
flask_csp/test_csp.py | twaldear/flask-csp | 8 | 53909 | import unittest
import tempfile
from flask import Flask
from flask_csp.csp import csp_default, create_csp_header, csp_header
class CspTestFunctions(unittest.TestCase):
""" test base functions """
def setUp(self):
tmp = tempfile.mkstemp()
self.dh = csp_default()
self.dh.default_file = tmp[1]
def test_create_c... | 2.859375 | 3 |
dhukiya/apps/core/migrations/0004_auto_20210211_1128.py | fikryans/dhukiya_porto | 0 | 53910 | # Generated by Django 3.1.6 on 2021-02-11 11:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0003_auto_20210210_2324'),
]
operations = [
migrations.AddField(
model_name='setting',
name='site_address',
... | 1.671875 | 2 |
train/PartNetTrainer.py | mznw/PersonReID-YouReID | 0 | 53911 | import torch
import torch.nn.functional as F
import numpy as np
from utils import *
from core.config import config
from train.BaseTrainer import BaseTrainer
class PartNetTrainer(BaseTrainer):
def __init__(self):
super(PartNetTrainer, self).__init__()
def build_opt_and_lr(self, model):
if ... | 2.109375 | 2 |
agent/utils.py | JIElite/RL-gridworld | 3 | 53912 |
def soft_update_network(target, source, tau):
for target_param, source_param in zip(target.parameters(), source.parameters()):
target_param.data.copy_(
target_param.data * (1 - tau) + source_param.data * tau
)
def hard_update_network(target, source):
target.load_state_dict(source.... | 2.09375 | 2 |
src/pyOER/measurement.py | ixdat/LowOverpotentialRegime | 0 | 53913 | <filename>src/pyOER/measurement.py
"""Define the Measurement class containing metadata and pointers to raw data.
"""
from pathlib import Path, PureWindowsPath, PurePosixPath
import json
import re
import time
import datetime
from ixdat import Measurement as Meas
from .constants import MEASUREMENT_DIR, MEASUREMENT_ID_F... | 2.296875 | 2 |
orchestra/tests/management_commands/test_migrate_certifications.py | code-review-doctor/orchestra | 444 | 53914 | from unittest.mock import patch
from django.core.management import call_command
from django.core.management.base import CommandError
from orchestra.tests.helpers import OrchestraTestCase
class MigrateCertificationsTestCase(OrchestraTestCase):
patch_path = ('orchestra.management.commands.'
'mig... | 2.1875 | 2 |
ude/communication/grpc_auth.py | aws-deepracer/ude | 0 | 53915 | <filename>ude/communication/grpc_auth.py
#################################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# #
# Licensed under the Apache Lic... | 2.328125 | 2 |
app/__init__.py | vyahello/trump-bullet | 0 | 53916 | <filename>app/__init__.py
class PropertyError(Exception):
"""Represents game property error."""
pass
| 1.671875 | 2 |
demo.py | mike-welch/pysam | 77 | 53917 | """
Most recently tested against PySAM 2.1.4
"""
from pathlib import Path
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import PySAM.Singleowner as Singleowner
import time
import multiprocessing
from itertools import product
import PySAM.Pvsamv1 as Pvsamv1
solar_resourc... | 1.953125 | 2 |
neutron_lbaas/agent/agent_api.py | kayrus/neutron-lbaas | 1 | 53918 | # Copyright 2013 New Dream Network, LLC (DreamHost)
# Copyright 2015 Rackspace
#
# 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
... | 1.609375 | 2 |
day_2/iterating_over_dictionary.py | anishLearnsToCode/python-workshop-9 | 3 | 53919 | words = {
'i': 520,
'am': 100,
'batman': 20,
'hello': 100
}
# iterate over keys
# for key in words.keys():
# print(key)
# for key in words:
# print(key)
# iterate over values
# words_keys = words.keys()
# print(words_keys)
# words_values = words.values()
# print(words_values)
# for value i... | 4.03125 | 4 |
backend/src/gloader/xml/sax/drivers2/drv_sgmlop_html.py | anrl/gini4 | 11 | 53920 | <gh_stars>10-100
"""
SAX2 driver for parsing HTML with the sgmlop parser.
$Id: drv_sgmlop_html.py,v 1.3 2002/05/10 14:50:06 akuchling Exp $
"""
version = "0.1"
from drv_sgmlop import *
from xml.dom.html import HTML_CHARACTER_ENTITIES, HTML_FORBIDDEN_END, HTML_OPT_END, HTML_DTD
from string import strip, upper
class ... | 2.859375 | 3 |
xscale/signal/tests/test_generator.py | xy6g13/xscale | 24 | 53921 | <gh_stars>10-100
# Python 2/3 compatibility
from __future__ import absolute_import, division, print_function
import xscale.signal.generator as xgen
import numpy as np
import pytest
def test_ar():
xgen.ar(0.3, 100, c=0.1)
def test_rednoise():
xgen.rednoise(0.3, 100, c=0.1)
with pytest.raises(TypeError, message="E... | 2.078125 | 2 |
Main.py | Faresalghazy/PiCa | 4 | 53922 | '''
Main Driver program for PiCa, a Raspberry pi based car --- Get it? "Driver"
Responsible for starting video feed in thread, handling web socket communication and moving the car
Program by <NAME>, started on the fifteenth of December 2017
'''
#Start with imports
from Car2 import Car
import socket
import subprocess
... | 2.984375 | 3 |
backend/web/product.py | allenwhalecs03/nctu_hackathon | 0 | 53923 | from req import WebRequestHandler
from req import Service
import tornado
class WebProductHandler(WebRequestHandler):
@tornado.gen.coroutine
def get(self, action=None, product_id=None):
print(action)
if action == None:
err, data = yield from Service.Product.get_product({'id': self.id... | 2.609375 | 3 |
src/gt4sd/frameworks/granular/arg_parser/parser.py | christofid/gt4sd-core | 57 | 53924 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge,... | 1.828125 | 2 |
gail_and_bc/get_data_gail.py | vluzko/652-project | 19 | 53925 | <filename>gail_and_bc/get_data_gail.py
# python -m baselines.gail.run_getDataGAIL
from os import listdir
from os.path import isfile, join
import re
import os
checkpointGail = 'checkpoint/trpo_gail.transition_limitation_4.Hopper.g_step_3.d_step_1.policy_entcoeff_0.adversary_entcoeff_0.001.seed_0/'
gailPrefix = 'trpo_g... | 1.898438 | 2 |
synthesis/train.py | aasensio/graphnet | 0 | 53926 | <filename>synthesis/train.py
import shutil
import numpy as np
import matplotlib.pyplot as pl
import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.utils.rnn
import torch_geometric.data
import time
from tqdm import tqdm
import model
import argparse
from sklearn import neighbors
import shortcar
from ... | 2.578125 | 3 |
.kodi/addons/plugin.video.1channel/waldo/indexes/1Channel_index.py | C6SUMMER/allinclusive-kodi-pi | 0 | 53927 | import os
import re
import sys
import urllib2
import HTMLParser
import xbmcgui
import xbmcplugin
from t0mm0.common.addon import Addon
from t0mm0.common.addon import Addon as Addon2
addon = Addon('plugin.video.waldo', sys.argv)
_1CH = Addon2('plugin.video.1channel', sys.argv)
#BASE_Address = 'www.primewire.ag'
BASE_A... | 2.546875 | 3 |
src/dev_config.py | Joonardo/FK-KULU | 0 | 53928 | <reponame>Joonardo/FK-KULU
SECRET = "very secret key"
DEBUG = False
LOG_FILE = "log"
LOG_FORMAT = '''
Message type: %(levelname)s
Location: %(pathname)s:%(lineno)d
Module: %(module)s
Function: %(funcName)s
Time: %(asctime)s
Message:
%(message)s
'''
SENDGRID_APIKEY... | 1.320313 | 1 |
src/using_tips/using_tips_2.py | HuangHuaBingZiGe/GitHub-Demo | 0 | 53929 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
50个话题
9章
1.课程简介
2.数据结构相关话题
3.迭代器与生成器相关话题
4.字符串处理相关话题
5.文件I/O操作相关话题
6.数据编码与处理相关话题
7.类与对象相关话题
8.多线程与多进程相关话题
9.装饰器相关话题
"""
"""
第1章 课程简介
1-1 课程简介
1-2 在线编码工具WebIDE使用指南
第2章 数据结构与算法进阶训练
2-1 如何在列表, 字典, 集合中根据条件筛选数据
2-2 如何为元组中的每个元素命名, 提高程序可读性
2-3 如何统计序列中元... | 2.71875 | 3 |
extraction.py | GruppoProgettoSWENG21/PaperAssignmentSystem | 2 | 53930 | <reponame>GruppoProgettoSWENG21/PaperAssignmentSystem
import re
import os
import platform
import getpass
import io
import numpy as np
import pandas as pd
import nltk
nltk.download('popular')
from tika import parser
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.metrics.pairwise import cosine_s... | 2.359375 | 2 |
peekingduck/pipeline/nodes/draw/group_bbox_and_tag.py | ericleehy/PeekingDuck | 1 | 53931 | <gh_stars>1-10
# Copyright 2022 AI Singapore
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 2.453125 | 2 |
code/src/utils.py | campfireman/bachelor-thesis | 0 | 53932 | <reponame>campfireman/bachelor-thesis<filename>code/src/utils.py
import csv
import os
from ctypes import ArgumentError
from typing import List
from tensorflow.python.lib.io import file_io
from .experiments.possible_moves import POSSIBLE_MOVES
def move_index_to_standard(index: int) -> str:
return POSSIBLE_MOVES[... | 2.890625 | 3 |
demo/showcase/colorpicker.py | ceccopierangiolieugenio/py-ttk | 0 | 53933 | #!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2021 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# ... | 2.140625 | 2 |
src/hg/utils/otto/nextstrainNcov/newick.py | andypohl/kent | 171 | 53934 | # Parse Newick-formatted file into tree of { 'kids': [], 'label': '', 'length': '' }
import logging
from utils import die
def skipSpaces(treeString, offset):
while (offset != len(treeString) and treeString[offset].isspace()):
offset += 1
return offset
def parseQuoted(treeString, offset):
"""Read ... | 3.234375 | 3 |
service/views.py | antorof/django-simple | 0 | 53935 | # -*- encoding: utf-8 -*-
from django import forms
from django.shortcuts import render, redirect
from django.http import HttpResponseRedirect
from django.http import HttpResponse
from django.core.validators import validate_slug, RegexValidator
from django.contrib.auth import authenticate, login, logout
from django.cont... | 2.15625 | 2 |
generate.py | g3y/password | 0 | 53936 | digits = '0123456789'
chars = 'abcdefghijklmn' + \
'opqrstuvwxyz'
up = chars.upper()
special = '_!$%&?ù'
all = digits+chars+up+special
from random import choice
password = ''.join (
choice(all) for i in range(10)
)
f = open('ascii.txt', 'r')
file_contents = f.read()
print("\x1b[1;32m ... | 3.25 | 3 |
app/models.py | JadeMaveric/CollegeVenturers | 1 | 53937 | from app import db
from app import login
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import UserMixin
from datetime import datetime
from hashlib import md5
@login.user_loader
def load_user(id):
return User.query.get(int(id))
project_contributors = db.Table('project_c... | 2.328125 | 2 |
satchmo/apps/satchmo_ext/wishlist/migrations/0001_initial.py | predatell/satchmo | 0 | 53938 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('contact', '0001_initial'),
('product', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='P... | 1.71875 | 2 |
VulnServer/GTER/exploit.py | cwinfosec/practice | 1 | 53939 | <reponame>cwinfosec/practice
#!/usr/bin/env python
"""
Description: Vanilla Buffer Overflow w/ egghunter via "GTER" in VulnServer
Author: <NAME>
Contact: @cwinfosec (twitter)
Date: 9/15/2019
Tested On: Windows XP SP2 EN
[+] Usage: python expoit.py <IP> <PORT>
$ python exploit.py 127.0.0.1 21
"""
import socket ... | 1.960938 | 2 |
modulo3/maxheap.py | levysiqueira/py-pcs3110 | 9 | 53940 | <filename>modulo3/maxheap.py
"""
Algoritmos de PCS3110 em Python
Módulo 3 - Análise de algoritmo e ordenação
"""
class MaxHeap:
""" Implementação de um max-heap.
"""
def __init__(self, lista = None):
if lista == None:
self.lista = []
else:
self.lista = lista
... | 4.125 | 4 |
SimpleShot/architecture/__init__.py | mbonto/fewshot_neuroimaging_classification | 4 | 53941 | from .GNN import *
from .Conv import *
from .MLP import *
from .LR import * | 1.0625 | 1 |
galleries/sql/connectors/__init__.py | mnicolas94/galleries | 0 | 53942 | <reponame>mnicolas94/galleries
from galleries.sql.connectors.connector import GallerySqlConnector
from galleries.sql.connectors.sqlite_connector import SqliteConnector
from galleries.sql.connectors.oracle_connector import OracleConnector
| 0.9375 | 1 |
copy_pods_redirector_data.py | Beit-Hatfutsot/mojp-k8s | 0 | 53943 | import sys
import time
import traceback
import subprocess
pods = [{
"name": pod,
"num_errors": 0,
"last_tmp_tar_size": 0,
"last_.redirector-data_tar_size": 0
} for pod in sys.argv[1:]]
while True:
time.sleep(10)
for pod in pods:
if pod["num_errors"] >= 20:
continue
... | 2.296875 | 2 |
mywork_python/prohl.py | DongZhizhen/Rotor-Dynamic | 0 | 53944 | <reponame>DongZhizhen/Rotor-Dynamic<gh_stars>0
"""
prohl.py
Description:
This program is used to calculate the rotor mode, based on the transfer matrix method.
The following code shows the calculation method of Prohl.
All the codes had been written by <NAME> in 2022
"""
impo... | 2.34375 | 2 |
encoder_ui/celery/discovery/redis_keys.py | hidnoiz/encoder_ui | 0 | 53945 | CONTAINERS_DISCOVERY_LOCK_KEY = 'containers_discovery.lock'
CONTAINERS_DISCOVERY_LAST_UPDATE_KEY = 'containers_discovery.last_update'
CONTAINERS_DISCOVERY_DATA_KEY = 'containers_discovery.data'
RESOURCES_DISCOVERY_LOCK_KEY = 'resources_discovery.lock'
RESOURCES_DISCOVERY_LAST_UPDATE_KEY = 'resources_discovery.last_upd... | 0.976563 | 1 |
f.py | BBernYY/baby-his-first-ai-steps | 1 | 53946 | <gh_stars>1-10
import math
import random
def rate(l):
scores = {}
num = 100000000
for i in l:
if i == 0:
scores[i] = num
else:
scores[i] = math.sqrt((i - num)**2)
return {"avgdistance": sum(list(scores.values())) // len(scores), "list": list(list({k: v for k, v in... | 3.015625 | 3 |
Crawler4py/Config.py | sivabalan/libSeek | 2 | 53947 | '''
@Author: <NAME> <EMAIL>
'''
import sys
from abc import *
class Config:
__metaclass__ = ABCMeta
def __init__(self):
#Number of Url Data Fetching Threads Allowed
self.MaxWorkerThreads = 8
#Timeout(Seconds) for trying to get the next url from the frontier.
se... | 3 | 3 |
experiments/SUNRGBD_few_shot.py | rkwitt/AGA | 11 | 53948 | """Few-shot object recognition experiments with AGA.
Author(s): rkwitt, mdixit, 2017
"""
import sys
sys.path.append("../")
sys.path.append("liblinear-2.11/python")
import liblinear
import liblinearutil
from misc.tools import build_file_list, balanced_sampling
import scipy
from sklearn.neighbors import KNeighborsCla... | 2.203125 | 2 |
examples/softwarex_article_listing_1.py | adrdrew/virocon | 0 | 53949 | from viroconcom.fitting import Fit
from viroconcom.contours import IFormContour
import numpy as np
prng = np.random.RandomState(42)
# Draw 1000 observations from a Weibull distribution with
# shape=1.5 and scale=3, which represents significant
# wave height.
sample_0 = prng.weibull(1.5, 1000) * 3
# Let the second sa... | 2.84375 | 3 |
expressmanage/products/admin.py | abbas133/expressmanage-free | 0 | 53950 | from django.contrib import admin
from .models import Product, ContainerType, RateSlab
class RateSlabInline(admin.TabularInline):
model = RateSlab
extra = 3
class ContainerTypeAdmin(admin.ModelAdmin):
inlines = [RateSlabInline]
# Register your models here.
admin.site.register(Product)
admin.site.regis... | 1.695313 | 2 |
zeus/vcs/asserts.py | conrad-kronos/zeus | 221 | 53951 | def assert_revision(revision, author=None, message=None):
"""Asserts values of the given fields in the provided revision.
:param revision: The revision to validate
:param author: that must be present in the ``revision``
:param message: message substring that must be present in ``revision``
"""
... | 3.109375 | 3 |
templates/led-button-input/led-button-input.py | elixirbuild/Raspberry-Pi-3-Templates | 0 | 53952 | # modules
import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BCM)
sleepTime = .1
GPIO.setup(4, GPIO.OUT)
GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
GPIO.output(4, GPIO.inout(17))
sleep(sleepTime)
finally:
GPIO.output(4, False)
GPIO.cleanup()
| 2.828125 | 3 |
scraper_factory/core/exceptions.py | machinia/scraper-factory | 0 | 53953 | class ScraperFactoryException(Exception):
pass
class SpiderNotFoundError(ScraperFactoryException):
pass
class InvalidUrlError(ScraperFactoryException):
pass
| 1.710938 | 2 |
tests/test_dim.py | codema-dev/seai_deap | 0 | 53954 | import numpy as np
from numpy.testing import assert_array_equal
from seai_deap import dim
def test_calculate_building_volume() -> None:
expected_output = np.array(4)
output = dim.calculate_building_volume(
ground_floor_area=np.array(1),
first_floor_area=np.array(1),
second_floor_are... | 2.53125 | 3 |
EmailEncrypt.py | brandonskerritt51/Everything | 3 | 53955 | <gh_stars>1-10
"""This program was created on 12/04/2015
It takes an user inputted string
encrypts it with the Transposition Cipher
and emails it to the users choice of person
https://www.facebook.com/AiiYourBaseRBel0ngToUs
"""
# SECURITY NOTICE
# THE EMAIL SENDS THE KEY NUMBER
# GET RID OF "myKey" in msg und... | 3.125 | 3 |
server/server.py | krabo0om/flashcards | 1 | 53956 | <gh_stars>1-10
import http
__author__ = 'pgenssler'
class FlashcardsServer(http.server.HTTPServer):
def __init__(self, server_address, req_handler, cardhandler, config):
super().__init__(server_address, req_handler)
self.config = config
self.cardhandler = cardhandler
| 2.078125 | 2 |
app/entities/new_schemas.py | deepettas/contact-tree | 1 | 53957 | from collections import namedtuple
import graphene
import datetime
import json
from .new_models import Agent, Community, Collection
def _json_object_hook(d):
return namedtuple('X', d.keys())(*d.values())
def json2obj(data):
return json.loads(data, object_hook=_json_object_hook)
class AgentSchema(graphen... | 2.5 | 2 |
gallery/tests.py | aluoch-sheila/GALLERY | 0 | 53958 |
from django.test import TestCase
from .models import Posts,Location,Category
# Create your tests here.
class locationTest(TestCase):
def setUp(self):
self.new_location = Location(location="nairobi")
def test_instance(self):
self.assertTrue(isinstance(self.new_location,Location))
def tes... | 2.5625 | 3 |
main_plot.py | Li-ai-cell/Interpretation_DETR | 8 | 53959 | from pathlib import Path
from util.plot_utils import plot_logs, plot_precision_recall
def main():
logs_path = Path('output/21_09_2021_with_corss_en_loss')
logs_paths_list = [logs_path]
plot_logs(logs_paths_list)
if __name__ == '__main__':
main() | 1.890625 | 2 |
src/processing/canopy_height_models.py | Croydon-Brixton/gedi-biomass-mapping | 0 | 53960 | """Functions for calculating biomass from TCH of canopy height models"""
def longo2016_acd(top_of_canopy_height: float) -> float:
"""
Convert `top_of_canopy_height` (tch) to biomass according to
the formula in Longo et al. 2016.
Source:
https://agupubs.onlinelibrary.wiley.com/action/downloadS... | 3.234375 | 3 |
tests/e2e/test_exception.py | smartcar/python-sdk | 28 | 53961 | <filename>tests/e2e/test_exception.py
import smartcar
import smartcar.smartcar
from smartcar.smartcar import get_user
from smartcar.exception import SmartcarException, exception_factory
def test_bad_access_code_exchange(client):
"""
OAuth Error
"""
try:
client.exchange_code("THIS_SHOULD_NOT_WO... | 2.53125 | 3 |
manage.py | pddg/qkouserver | 0 | 53962 | import argparse
from multiprocessing import Queue, Process
from logging import getLogger
def main():
parser = argparse.ArgumentParser(
description="QkouBot is an application for KIT students. This automatically collect and "
"redistribute information and cancellation of lectures. QkouB... | 2.828125 | 3 |
py/obiwan/decals_sim_randoms.py | manera/legacypipe | 32 | 53963 | import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import os
import pickle
def add_scatter(ax,x,y,c='b',m='o',lab='',s=80,drawln=False,alpha=1):
ax.scatter(x,y, s=s, lw=2.,facecolors='none',edgecolors=c, marker=m,label=lab,alpha=alpha)
if drawln: ax.plot(x,y, c=c,ls='-'... | 2.515625 | 3 |
purchase/migrations/0004_auto_20200928_0513.py | drtweety/busman | 0 | 53964 | <filename>purchase/migrations/0004_auto_20200928_0513.py
# Generated by Django 3.1.1 on 2020-09-28 05:13
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('organization', '0004_auto_20200914_0713'),
('products', '00... | 1.5625 | 2 |
sharpy/managers/roles/__init__.py | MadManSC2/sharpy-sc2 | 1 | 53965 | <filename>sharpy/managers/roles/__init__.py
from .unit_task import UnitTask
from .units_in_role import UnitsInRole
| 1.242188 | 1 |
DataServer/DataServer.py | CodeElixir/geoip-attack-map | 0 | 53966 | #!/usr/bin/python3
"""
AUTHOR: <NAME> - <EMAIL>
"""
# Imports
import json
import maxminddb
import redis
import re
import random
import io
from const import META, PORTMAP
from argparse import ArgumentParser, RawDescriptionHelpFormatter
from sys import exit
from time import localtime, sleep, strftime
from os import ge... | 2.21875 | 2 |
navigation/scripts/rrt_star/utils_scan.py | archit2604/Trotbot | 1 | 53967 | <filename>navigation/scripts/rrt_star/utils_scan.py
#! /usr/bin/env python
import random , numpy as np
import math
import cmath
from shapely.geometry import Polygon, Point, LineString
from descartes import PolygonPatch
import matplotlib.pyplot as plt
PI = np.pi
THRESHOLD = 0.25 # 1/2 of bot length
ALPHA = 10 # Experi... | 2.5625 | 3 |
tests/__init__.py | lennart-damen/api-tutorial | 1 | 53968 | <reponame>lennart-damen/api-tutorial
"""Unit test package for deployment_workshop."""
| 1.03125 | 1 |
code/chaperones/hsphmm.py | DraceniY/Chapevo | 0 | 53969 | <gh_stars>0
import os, sys
import numpy as np
import pandas as pd
import subprocess
import glob
def read_taxid():
"""
read taxid into dict
"""
taxid = {}
with open('taxid.txt', 'r') as f:
for line in f:
current_line = line.split()
current_id = current_line[0]
... | 2.609375 | 3 |
registrar/registrar.py | Zijianlalala/classtable-server | 1 | 53970 | from abc import abstractclassmethod
class Registrar:
@abstractclassmethod
def get_state(self):
pass
@abstractclassmethod
def set_state(self, state):
pass
@abstractclassmethod
def get_captcha_base64(self):
pass
@abstractclassmethod
def start_time(self, year, m... | 3.140625 | 3 |
base_ppo_agent.py | HfutEngine2D/SoccerMARL | 1 | 53971 | <filename>base_ppo_agent.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from ray import tune
from ray.rllib.agents.ppo import PPOTrainer
from ray.tune import grid_search
import hfo_py
from soccer_env.high_action_soccer_env import HighActionSoccerEnv
def on_episode_end(info):
episode = info["episode"]
episo... | 2.109375 | 2 |
check_ticket_update.py | henrymy/redmine_py_client | 0 | 53972 | <filename>check_ticket_update.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import base64
from datetime import datetime, timedelta
from email.mime.text import MIMEText
from email.header import Header
from email.utils import formatdate
import os
import smtplib
import yaml
from redminelib import exceptions as redmin... | 2 | 2 |
cc/count/countcells.py | ixianid/cell_counting | 1 | 53973 | import numpy as np
import skimage as ski
import os
from matplotlib import pyplot as plt
from skimage.feature import blob_dog, blob_log, blob_doh
from skimage.color import rgb2gray
from math import sqrt
log_defaults = {
'min_s': 1,
'max_s': 30,
'num_s': 10,
'thresh':0.1,
'overlap': 0.5,
'log_sca... | 2.5 | 2 |
app/training/models/chromosome.py | TUIASI-AC-enaki/flappy-bird-with-ai | 0 | 53974 | <filename>app/training/models/chromosome.py
from utils import generate_random_range, generate_random_int_range, read_dict_from_json
from .neural_bird import NeuralBird
import random
class Chromosome:
def __init__(self, bird: NeuralBird, fitness=0, generations_alive=0, ancestor_generations=0):
self.bird =... | 2.921875 | 3 |
Dictionary/relativeRanks.py | Abhimanyu210100/Leetcode | 0 | 53975 | <filename>Dictionary/relativeRanks.py
class Solution:
def findRelativeRanks(self, score: List[int]) -> List[str]:
sorted_score = sorted(score,reverse=True)
rankings = {}
for i in range(len(sorted_score)):
if i == 0: rankings[sorted_score[i]] = 'Gold Medal'
elif i == 1... | 3.34375 | 3 |
logflow/logsparser/Cardinality.py | bds-ailab/logflow | 5 | 53976 | # Copyright 2020 BULL SAS All rights reserved #
from collections import Counter
from logflow.logsparser.Pattern import Pattern
from loguru import logger
from typing import Dict, List
class Cardinality:
"""A cardinality is a length of line. The length is defined as the number of words.
Args:
counter_g... | 3.6875 | 4 |
field_calculator/strip_concatenate.py | Dan-Patterson/Tools_for_ArcGIS_Pro | 23 | 53977 | <reponame>Dan-Patterson/Tools_for_ArcGIS_Pro<gh_stars>10-100
d e f s t r i p _ c o n c a t e n a t e ( i n _ f l d s , s t r i p _ l i s t = [ " " , " , " , N o n e ] ) :
" " " P r o v i d e t h e f i e l d s a s a l i s t i e [ a , b , c ] t o s t r i p s p a c e s
... | 2.65625 | 3 |
bloodhound_theme/bhtheme/theme.py | HelionDevPlatform/bloodhound | 0 | 53978 |
# Licensed to the Apache Software Foundation (ASF) 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 ma... | 1.171875 | 1 |
api/models.py | Mutugiii/Awards | 0 | 53979 | from django.db import models
from django.contrib.auth.models import User
from cloudinary.models import CloudinaryField
from django.dispatch import receiver
from django.db.models.signals import post_save
class Project(models.Model):
'''Model class for Projects tha user posts'''
user = models.ForeignKey(User, on... | 2.171875 | 2 |
Lib/site-packages/altendpy/misc.py | fochoao/cpython | 0 | 53980 | <reponame>fochoao/cpython<filename>Lib/site-packages/altendpy/misc.py
import itertools
def identifier_path(it):
return '__' + '_'.join(
it.__module__.split('.') + [it.__qualname__]
)
# https://docs.python.org/3/library/itertools.html
def pairwise(iterable):
's -> (s0,s1), (s1,s2), (s2, s3), ...'... | 3.1875 | 3 |
firmware/check_hardware.py | jonnor/dlock-oslo | 5 | 53981 | <filename>firmware/check_hardware.py<gh_stars>1-10
import dlockoslo
import time
import sys
"""Tool for testing the hardware board
Uses I/O utilities and pin definitions from firmware,
to also ensure that these are correct"""
def check_inputs(delay):
print('check inputs')
for number, pin in dlockoslo.ins.item... | 3.09375 | 3 |
spinner.py | mjholtkamp/spinner | 0 | 53982 | <filename>spinner.py
#!/usr/bin/python
import sys, time
while True:
for i in ['\o/', '\o>', '<o>', '<o/']:
sys.stdout.write('\r%s' % i);
sys.stdout.flush();
time.sleep(0.1)
| 2.578125 | 3 |
karya_ilmiah/urls.py | HilmiZul/epkl3 | 6 | 53983 | <filename>karya_ilmiah/urls.py<gh_stars>1-10
from django.urls import path
from .views import *
from .views_admin import *
urlpatterns = [
# area.siswa
path('judul/submit/', submit_judul, name='submit_judul'),
path('timeline/', show_timeline, name='timeline'),
path('judul/ubah/<int:id>', ubah_judul, name='ubah_... | 1.835938 | 2 |
src/v8unpack/MetaDataObject/Constant.py | saby/v8uncode | 10 | 53984 | from ..MetaDataObject.core.Simple import Simple
class Constant(Simple):
ext_code = {
'mgr': '1', # модуль менеджера Константы
'obj': '0', # модуль менеджера значения Константы
}
@classmethod
def get_decode_header(cls, header_data):
return header_data[0][1][1][1][1]
| 2.109375 | 2 |
src/launcher.py | saiblo/saiblo-local-judger | 4 | 53985 | from gui.gui import Main
Main()
| 1.109375 | 1 |
pybots/src/geodesy/calculations.py | aivian/robots | 0 | 53986 | import pdb
import numpy
import geometry.conversions
import geometry.helpers
import geometry.quaternion
import geodesy.conversions
import environments.earth
import spherical_geometry.vector
import spherical_geometry.great_circle_arc
def line_distance(point_1, point_2, ignore_alt=True):
"""Compute the straight l... | 3.328125 | 3 |
venv/lib/python3.7/site-packages/zope/site/tests/test_folder.py | leanhvu86/matrix-server | 0 | 53987 |
import doctest
import unittest
from zope.site.folder import Folder
from zope.site.testing import siteSetUp, siteTearDown, checker
from zope.site.tests.test_site import TestSiteManagerContainer
def setUp(test=None):
siteSetUp()
def tearDown(test=None):
siteTearDown()
class FolderTest(TestSiteManagerCont... | 2.0625 | 2 |
heroku_cron/worker.py | gomberg5264/amazon-price-watcher | 0 | 53988 | import requests
import os
scrape_key = os.environ['SCRAPE_KEY']
payload = {'key': scrape_key}
headers = {'content-type': 'application/json', 'Accept-Charset': 'UTF-8'}
response = requests.put('https://apw.locrian24.now.sh/api/scrape', headers = headers, json = payload)
print(response)
| 2.53125 | 3 |
qgui/base_frame.py | QPT-Family/QGUI | 50 | 53989 | # Author: <NAME>
# Datetime: 2021/9/14
# Copyright belongs to the author.
# Please indicate the source for reprinting.
import sys
import webbrowser
import time
from typing import List
import tkinter
from tkinter import ttk
from tkinter.scrolledtext import ScrolledText
from qgui.manager import BLACK, FONT
from qgui.... | 2.21875 | 2 |
apps/greencheck/urls.py | denning/admin-portal | 10 | 53990 | <reponame>denning/admin-portal
from django.urls import path
from .views import GreencheckStatsView
urlpatterns = [
path("", GreencheckStatsView.as_view(), name="greencheck-stats-index"),
]
| 1.484375 | 1 |
gease/rest.py | chfw/gease | 1 | 53991 | <reponame>chfw/gease<gh_stars>1-10
"""
rest
~~~~~~~~~~~~~~~~~~~
Only use post interface
:copyright: (c) 2017-2020 by Onni Software Ltd.
:license: MIT License, see LICENSE for more details
"""
import requests
import gease.utils as utils
import gease.constants as constants
import gease.exceptions... | 2.4375 | 2 |
scripts/pfp_cfg.py | OzFlux/PFP_Classic | 1 | 53992 | <reponame>OzFlux/PFP_Classic<filename>scripts/pfp_cfg.py
""" Utility routines for handling control file contents."""
def cfg_string_to_list(input_string):
""" Convert a string containing items separated by commas into a list."""
if "," in input_string:
output_list = input_string.split(",")
else:
... | 2.234375 | 2 |
Regs/Block_1/R1600.py | BernardoB95/Extrator_SPEDFiscal | 1 | 53993 | from ..IReg import IReg
class R1600(IReg):
def __init__(self):
self._header = ['REG',
'COD_PART',
'TOT_CREDITO',
'TOT_DEBITO']
self._hierarchy = "2"
| 1.671875 | 2 |
lyapy/outputs/pd_output.py | vdorobantu/lyapy | 36 | 53994 | """Base class for outputs with proportional and derivative components."""
from .output import Output
class PDOutput(Output):
"""Base class for outputs with proportional and derivative components.
Override eta, proportional, derivative.
Let n be the number of states, k be the proportional/derivative erro... | 3.40625 | 3 |
login.py | cuifan1/test1 | 1 | 53995 |
for j in range(1, 9):
for i in range(1,j+1):
print("%d * %d = %d" % (i,j,i*j),end="\t")
print()
| 3.640625 | 4 |
week1.py | mitchell011/csws-week1 | 0 | 53996 | for x in range(10):
print("Hello world") | 2.625 | 3 |
ooobuild/lo/embed/x_embedded_object.py | Amourspirit/ooo_uno_tmpl | 0 | 53997 | # coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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 applicab... | 1.460938 | 1 |
script.py | rohank63/SEC | 1 | 53998 | import infer_organism
import subprocess as sp
print(infer_organism.infer(
file_1="./first_mate.fastq",
min_match=2,factor=1,
transcript_fasta="transcripts.fasta.zip"
))
print(infer_organism.infer(
file_1="./SRR13496438.fastq.gz",
min_match=2,factor=1,
transcript_fasta="transcripts.fasta.zip"
))
'''
print(... | 1.960938 | 2 |
a3000_rom_emulator/python_lib/arcflash/main.py | mfkiwl/myelin-acorn-electron-hardware-xc6slx25 | 42 | 53999 | from __future__ import print_function
def main():
print("Arcflash - TODO")
| 1.21875 | 1 |