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 |
|---|---|---|---|---|---|---|
src/experiments_practical.py | rafcc/aaai-20.1534 | 1 | 12774251 | <filename>src/experiments_practical.py<gh_stars>1-10
# -*- coding: utf-8 -*-
import random
import time
from itertools import combinations
import yaml
import data
import model
import sampling
import subfunction
import trainer
def convert_params_to_string(
dimension_simplex, dimension_space, degree, N, num_sample... | 2.546875 | 3 |
src/utils.py | Filco306/ds-project-template | 0 | 12774252 | <filename>src/utils.py<gh_stars>0
import os
def fix_filename(filename):
return os.path.join("config", filename) if filename[:6] != "config" else filename
| 2.203125 | 2 |
detectVideoMod.py | tasanuma714/Raspberry-Pi-Security-Camera-using-Google-Coral-USB-Accelerator | 2 | 12774253 | """
<NAME>
7-19-2019
Version 1.0
https://github.com/tasanuma714/Raspberry-Pi-Security-Camera-using-Google-Coral-USB-Accelerator
***Big Credit to Adrian at PyImageSearch for the base code of this file.
https://www.pyimagesearch.com/2019/04/22/getting-started-with-google-corals-tpu-usb-accelerator/
https://w... | 2.984375 | 3 |
singl/utils.py | mpff/hpa-single-cell-classification | 0 | 12774254 | import os
import numpy
import pandas
from skimage import io
def read_ids_from_csv(csv_file):
""" Reads a column named 'ID' from csv_file. This function was
created to make sure basic I/O works in unit testing.
"""
csv = pandas.read_csv(csv_file)
return csv.ID
def read_hpa_image(image_id, roo... | 3 | 3 |
convert.py | Brandiep/Web-Design-Challenge | 0 | 12774255 | import pandas as pd
cities_df = pd.read_csv("Resources/cities.csv")
cities_df.to_html('Resources/cities.html', index=False) | 2.453125 | 2 |
unittests/test_TFSingleOrigin.py | maptube/UMaaS | 0 | 12774256 | <gh_stars>0
"""
This is a test for working functionality of TFSingleDest.
The TensorFlow version is compared against the regular python version to verify that CBar, Oi, Dj etc
are all equal when calculated using the different platforms.
SingleDest.py is taken as the gold standard.
"""
import os.path
import math
import... | 2.328125 | 2 |
uncertainty/learning/base_self.py | sangdon/intern2020_cocal | 0 | 12774257 | <reponame>sangdon/intern2020_cocal
import os, sys
import time
import numpy as np
import tensorflow as tf
import model
from learning import LearnerCls, LearnerDACls, LearnerConfPred
from learning import TempScalingCls as CalibratorCls
class BaseLearnerSelf:
def __init__(self, params, params_base, model_s, model_t... | 2.765625 | 3 |
topCoder/srms/300s/srm373/div2/the_equation.py | gauravsingh58/algo | 1 | 12774258 | class TheEquation:
def leastSum(self, X, Y, P):
m = 2*P
for i in xrange(1, P+1):
for j in xrange(1, P+1):
if (X*i + Y*j)%P == 0:
m = min(m, i+j)
return m
| 3.125 | 3 |
drift/core/extensions/debughelpers.py | dgnorth/drift | 6 | 12774259 | <reponame>dgnorth/drift
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import logging
from flask import g
log = logging.getLogger(__name__)
def before_request():
g.client_debug_messages = []
def after_request(response):
if hasattr(g, "client_debug_messages") and len(g.client_debug_messag... | 1.984375 | 2 |
Leetcode/125. Valid Palindrome/solution2.py | asanoviskhak/Outtalent | 51 | 12774260 | class Solution:
def isPalindrome(self, s: str) -> bool:
s = re.sub('[^a-zA-Z0-9]', '', s).lower()
return s == s[::-1] | 3.3125 | 3 |
ydk/ydk-example-1.py | sambyers/devnet_learning | 0 | 12774261 | <filename>ydk/ydk-example-1.py
from ydk.providers import NetconfServiceProvider
from ydk.services import CRUDService
from ydk.models.openconfig import openconfig_bgp
import json
def config_native(native):
"""Add config data to native object."""
loopback = native.interface.Loopback()
loopback.name = 0
... | 2.5625 | 3 |
sparse/_compressed/__init__.py | pettni/sparse | 0 | 12774262 | <filename>sparse/_compressed/__init__.py
from .compressed import GXCS
| 1.164063 | 1 |
enn/losses/prior_losses.py | MaxGhenis/enn | 130 | 12774263 | # python3
# pylint: disable=g-bad-file-header
# Copyright 2021 DeepMind Technologies Limited. All Rights Reserved.
#
# 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... | 2.421875 | 2 |
application.py | jbzdarkid/witness-puzzles | 24 | 12774264 | import os
from base64 import b64decode
from flask import render_template, request
from io import BytesIO
from json import dumps as to_json_string
from traceback import format_exc
from flask_wtf.csrf import CSRFError
from sqlalchemy.exc import SQLAlchemyError
from werkzeug.exceptions import HTTPException
from applicat... | 1.867188 | 2 |
homeassistant/components/melcloud/const.py | mengwangk/home-assistant | 4 | 12774265 | <filename>homeassistant/components/melcloud/const.py
"""Constants for the MELCloud Climate integration."""
import pymelcloud.ata_device as ata_device
from pymelcloud.const import UNIT_TEMP_CELSIUS, UNIT_TEMP_FAHRENHEIT
from homeassistant.components.climate.const import (
HVAC_MODE_COOL,
HVAC_MODE_DRY,
HVAC... | 1.921875 | 2 |
test/SearchSpaceAdv/ShapeClassification/shape_class.py | schroeder-dewitt/polyomino-self-assembly | 0 | 12774266 | import math
#Single Block
list = [[0,0]]
sum_x = 0
sum_y = 0
for i in list:
sum_x += i[0]
sum_y += i[1]
sum_x /= len(list)
sum_y /= len(list)
print "SingleBlock: Grav. (", sum_x, ", ", sum_y, ")"
d_sum_x = 0
d_sum_y = 0
for i in list:
d_sum_x += (i[0]-sum_x)*(i[0]-sum_x)
d_sum_y += (i[1]-sum_y)*(i[1]-s... | 3.296875 | 3 |
autotest/test_016.py | pygsflow/pygsflow | 17 | 12774267 | # test sfr renumbering schemes and other random utilities
import gsflow
import os
from gsflow.utils import SfrRenumber
ws = os.path.abspath(os.path.dirname(__file__))
def test_sfr_renumber():
# simple test to ensure no crashes in the renumbering schemes
# expand this later to test LAK, AG, and GA... | 2.078125 | 2 |
excel.py | Zuoxiaoxian/Excel_Oracle_conf_log | 0 | 12774268 | <gh_stars>0
# -*- coding: utf-8 -*-
# 作者 :xiaoxianzuo.zuo
# QQ :1980179070
# 文件名 : excel_01.py
# 新建时间 :2018/4/12/012 18:20
import os
import openpyxl
import re
#example.xlsx需要位于当前工作目录中才能使用它,不是就要绝对路径!
# 默认行高、列宽
# default_row_h = 20
# default_col_w = 10
class ParseSheetZxx(object):
def __ini... | 2.796875 | 3 |
pyLMS7002Soapy/LMS7002_DCCAL.py | Surfndez/pyLMS7002Soapy | 46 | 12774269 | <filename>pyLMS7002Soapy/LMS7002_DCCAL.py
#***************************************************************
#* Name: LMS7002_DCCAL.py
#* Purpose: Class implementing LMS7002 DCCAL functions
#* Author: <NAME> ()
#* Created: 2017-02-10
#* Copyright: <NAME> (limemicro.com)
#* License:
#**************************... | 2.4375 | 2 |
salts/migrations/0030_auto_20160712_1511.py | sputnik-load/salts | 1 | 12774270 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('salts', '0029_shooting_ticket_id'),
]
operations = [
migrations.RenameField('TestResult', 'test_id', 'session_id'),
... | 1.578125 | 2 |
UnityEngine/ParticleSystemRingBufferMode/__init__.py | Grim-es/udon-pie-auto-completion | 0 | 12774271 | <gh_stars>0
from UdonPie import UnityEngine
from UdonPie.Undefined import *
class ParticleSystemRingBufferMode:
def __new__(cls, arg1=None):
'''
:returns: ParticleSystemRingBufferMode
:rtype: UnityEngine.ParticleSystemRingBufferMode
'''
pass
| 1.929688 | 2 |
3/sender.py | MrRezoo/rabbitmq-python | 1 | 12774272 | import pika
connection = pika.BlockingConnection(
pika.ConnectionParameters(host='localhost'))
ch = connection.channel()
ch.exchange_declare(exchange='logs', exchange_type='fanout')
ch.basic_publish(exchange='logs', routing_key='', body='this is testing fanout')
print('message sent')
connection.close()
| 2.140625 | 2 |
nameko/dependency_providers.py | vlcinsky/nameko | 3,425 | 12774273 | """ Nameko built-in dependencies.
"""
from nameko.extensions import DependencyProvider
class Config(DependencyProvider):
""" Dependency provider for accessing configuration values.
"""
def get_dependency(self, worker_ctx):
return self.container.config.copy()
| 1.6875 | 2 |
ornl/MasterNode-and-ModelNode-Agents/ModelNode/modelnode/agent.py | ChargePoint/volttron-applications | 0 | 12774274 | <filename>ornl/MasterNode-and-ModelNode-Agents/ModelNode/modelnode/agent.py
# Copyright (c) 2014 Oak Ridge National Laboratory 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 restrictio... | 1.875 | 2 |
get_autologin/tests.py | mazlumagar/django-get-autologin | 1 | 12774275 | from django.contrib.auth.models import AnonymousUser
from django.test import TestCase, RequestFactory, Client
from django.contrib.auth import get_user_model
from django.urls.base import reverse
from django.conf import settings
from .models import Token
from .views import user_auth
UserModel = get_user_model()
class... | 2.375 | 2 |
examples/rl_dqgnn/plot_test_curve.py | Sirui-Xu/Arena | 1 | 12774276 | from matplotlib import pyplot as plt
import pickle
import numpy as np
import os,sys
'''
results = []
for i in range(10):
with open(f'/home/yiran/pc_mapping/arena-v2/examples/bc_saved_models/refactor_success_max_mine/run{i}/test_result.npy', 'rb') as f:
result_i = pickle.load(f)
result_number = [v for (k... | 2.328125 | 2 |
src/mandelbrot.py | poseen/pyMandelbrot | 0 | 12774277 | #!/usr/bin/python
"""
This is the main python file to run.
"""
import sys
from application import Application
# -- Functions ---------------------------------------------------------------
def main():
"""
The main function.
"""
app = Application(sys.argv)
app.run()
# -- Main ent... | 2.9375 | 3 |
python_developer_tools/cv/detection/CenterNet2/__init__.py | carlsummer/python_developer_tools | 32 | 12774278 | # !/usr/bin/env python
# -- coding: utf-8 --
# @Author zengxiaohui
# Datatime:5/18/2021 11:16 AM
# @File:__init__.py
| 1.09375 | 1 |
bomber_monkey/features/display/score_display_system.py | MonkeyPatchIo/bomber-monkey | 0 | 12774279 | <reponame>MonkeyPatchIo/bomber-monkey<gh_stars>0
import pygame as pg
from bomber_monkey.features.player.player import Player
from bomber_monkey.game_config import GameConfig, GAME_FONT
from bomber_monkey.utils.vector import Vector
from python_ecs.ecs import System, Simulator
FONT_SIZE = 35
MARGIN = 5
class PlayerSc... | 2.59375 | 3 |
py/bitbox02/bitbox02/util.py | conte91/bitbox02-firmware | 0 | 12774280 | <reponame>conte91/bitbox02-firmware<filename>py/bitbox02/bitbox02/util.py
# Copyright 2019 Shift Cryptosecurity AG
#
# 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.o... | 2.03125 | 2 |
project03/main.py | PatrickKalkman/pirplepython | 0 | 12774281 | <reponame>PatrickKalkman/pirplepython
"""
Python Is Easy course @P<EMAIL>
Project #3: Pick a Card Game!
<NAME> / <EMAIL>
Details:
Everyone has their favorite card game. What's yours? For this assignment,
choose a card game (other than Blackjack), and turn it into a Python program.
It doesn't matter if it's a 1-player... | 4.15625 | 4 |
django/contrib/formtools/wizard/storage/exceptions.py | pomarec/django | 285 | 12774282 | <reponame>pomarec/django
from django.core.exceptions import ImproperlyConfigured
class MissingStorage(ImproperlyConfigured):
pass
class NoFileStorageConfigured(ImproperlyConfigured):
pass
| 1.609375 | 2 |
code/src.py | oShadow05/ftp_most_update_files | 0 | 12774283 | import subprocess
import ftplib
import os
import time
from hide_data import *
from datetime import datetime
# Creazione delle cartelle nominate per giorno, mese, anno, ora, minuti, secondi
def create_path_folder(init_path):
day = time.strftime("%d", time.localtime())
month = time.strftime("%m", time.... | 2.515625 | 3 |
mapscraper/google.py | Armadillomon/google-trips | 0 | 12774284 | <reponame>Armadillomon/google-trips
import re
import locale
import datetime
import time
import io
import os
from selenium import webdriver
from selenium.webdriver.support import expected_conditions
from PIL import Image
import mapscraper.metrics
from .captions import *
class GoogleDateParser:
PATTERN = r"(\w+),\s+(\d... | 2.65625 | 3 |
neurokit2/complexity/complexity_hjorth.py | BelleJohn/neuropsychology-NeuroKit | 1 | 12774285 | import numpy as np
import pandas as pd
def complexity_hjorth(signal):
"""Hjorth's Complexity and Parameters
Hjorth Parameters are indicators of statistical properties used in signal processing in the
time domain introduced by Hjorth (1970). The parameters are activity, mobility, and complexity.
Neuro... | 3.46875 | 3 |
sdk/python/pulumi_exoscale/security_group_rule.py | secustor/pulumi-exoscale | 0 | 12774286 | <gh_stars>0
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
fr... | 1.921875 | 2 |
stock.py | ak4stock/ths_tdx_stock_xueqiu_guoren | 2 | 12774287 | /**
和谐完全加密
通达信加密公式解密和谐
通达信超赢版和谐
涨停密码
股票程序化交易
股票自动交易
首板套利
一进二
二进三
三进四
妖股龙头
擒龙捉妖
A股股票量化交易
下单跟单服务器搭建
文华财经
通达信
同花顺
雪球跟单下单
聚宽跟单下单
果仁跟单下单
掘金跟单下单
海龟策略
均线策略
网格交易
马丁格尔
Python量化交易
东方财富量化交易
证券量化交易
策略代写合作
股票指标公式代写
选股指标公式代写
股票量化交易
万1免5
万一免五
万1.5免5
万1.5免五
开户
数据抓取爬虫
... | 2.59375 | 3 |
model/RPNet.py | zha-hengfeng/EACNet | 1 | 12774288 | # ERFNet full model definition for Pytorch
# Sept 2017
# <NAME>
#######################
import torch
import torch.nn as nn
import torch.nn.init as init
import torch.nn.functional as F
class DownsamplerBlock(nn.Module):
def __init__(self, ninput, noutput):
super().__init__()
self.c... | 3 | 3 |
build/lib/nhps/distance/remove_base.py | Anirudh-Murali/neural-hawkes-particle-smoothing | 37 | 12774289 | import numpy as np
import warnings
def remove_base(seq, base, tolerance=1e-4):
"""
Functionality: Remove x from (x \sqcup z)
Since there might be some float errors, I allow for a mismatch of the time_stamps between
two seqs no larger than a threshold.
The threshold value: tolerance * max_time_stam... | 2.421875 | 2 |
2015/day05/solve.py | greenbender/aoc2018 | 0 | 12774290 | import sys
strings = [l.strip() for l in sys.stdin]
def nice1(string):
vowels, double = 0, False
for i in range(len(string)):
if i > 0:
if string[i-1:i+1] in ('ab', 'cd', 'pq', 'xy'):
return False
if not double and string[i-1] == string[i]:
do... | 3.609375 | 4 |
config/asgi.py | vendari12/django-ai-algotrade | 0 | 12774291 | """
ASGI config for stockze project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/dev/howto/deployment/asgi/
"""
import os
import sys
from pathlib import Path
from django.core.asgi import get_asgi_application
... | 2.453125 | 2 |
xml_text/xml_test.py | INSPIRE-5Gplus/i5p-wp3-netslice4ssla | 0 | 12774292 | <filename>xml_text/xml_test.py
#!/usr/local/bin/python3.4
import os, sys, logging, json, argparse, time, datetime, requests, uuid
import xml.etree.ElementTree as ET
#XML content is parse to a tree structure and its ROOT is retrieved
tree = ET.parse('xml_text/items.xml')
root = tree.getroot()
## READING XML DOCUMENT... | 3.59375 | 4 |
plots/plot_profiles.py | cebarbosa/hydraimf | 0 | 12774293 | <reponame>cebarbosa/hydraimf<filename>plots/plot_profiles.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on 24/04/2020
Author : <NAME>
"""
import os
import itertools
import numpy as np
from astropy.table import Table
import matplotlib.pyplot as plt
import matplotlib
import matplotlib.cm as cm
import matplotlib.g... | 1.9375 | 2 |
data-gen.py | SigmaX-ai/tidre-demo | 1 | 12774294 | import pyarrow as pa
import rstr
import random
# Each tuple specifies a type of string to generate. The first entry specifies
# how many unique strings to generate (rstr is pretty slow). The second
# specifies how often to insert a string from that pool of unique strings into
# the actual dataset compared to inserting... | 2.75 | 3 |
src/VAC_GAN/models/Discriminator.py | duartegalvao/Image-Colorization-with-Deep-Learning | 2 | 12774295 | <gh_stars>1-10
import tensorflow as tf
class Discriminator:
def __init__(self, seed):
"""
Architecture:
[?, 32, 32, ch] => [?, 16, 16, 64]
[?, 16, 16, 64] => [?, 8, 8, 128]
[?, 8, 8, 128] => [?, 4, 4, 256]
[?, 4, 4, 256] => [?, 4,... | 2.59375 | 3 |
mini python projects/habbit_tracking/add_pixel.py | aliammarkhan/Mini_python_projects | 0 | 12774296 | <filename>mini python projects/habbit_tracking/add_pixel.py
import datetime
import requests
# docs https://docs.pixe.la/entry/post-pixel
USERNAME = "YOUR_USERNAME_GOES_HERE"
TOKEN = "YOUR_TOKEN_ID_GOES_HERE"
GRAPH_ID = "GRAPH_ID_GOES_HERE"
#graph endpoint where we want to store our data
endpoint = "https:/... | 3.203125 | 3 |
passgen/forms.py | diyajaiswal11/HackCorona | 7 | 12774297 | <gh_stars>1-10
from django import forms
from django.forms import ModelForm
from .models import PassModel
class PassForm(ModelForm):
class Meta:
model= PassModel
fields='__all__'
exclude=['issuedate','uniquenumber','checked']
class DownloadForm(ModelForm):
class Meta:
model=Pas... | 1.890625 | 2 |
littlecheck/__init__.py | faho/littlecheck | 26 | 12774298 | <reponame>faho/littlecheck
from .littlecheck import *
| 1.015625 | 1 |
training/training/doctype/associate_performance_monitoring_check_sheet/associate_performance_monitoring_check_sheet.py | vhrspvl/Minda-Training | 0 | 12774299 | <gh_stars>0
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Ramya and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
import json
from datetime import datetime, date
from frappe.utils import flt, getdate
clas... | 2.109375 | 2 |
xbmanIntegrated/Aclsm-master/jump/migrations/0001_initial.py | suntao789/Aclsm | 0 | 12774300 | <filename>xbmanIntegrated/Aclsm-master/jump/migrations/0001_initial.py<gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-10-10 21:13
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migratio... | 1.546875 | 2 |
src/PSTs.py | cosmobobak/Viridithas-Chess | 0 | 12774301 | <filename>src/PSTs.py
from dataclasses import dataclass
import chess
# import numpy as np
p, n, b, r, q, k, P, N, B, R, Q, K = range(12)
piece_values = [[126, 781, 825, 1276, 2538, 0], [208, 854, 915, 1380, 2682, 0]]
@dataclass
class S:
midgame: int
endgame: int
PAWN_NORM: int = 1000 // 126
# 'Bonus' cont... | 2.34375 | 2 |
model-optimizer/extensions/middle/PixelLinkReshape_test.py | apexxs/dldt | 2 | 12774302 | <filename>model-optimizer/extensions/middle/PixelLinkReshape_test.py
"""
Copyright (c) 2018 Intel Corporation
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/license... | 1.898438 | 2 |
backend/app/src/v1/routes.py | alexandersumer/Notare | 2 | 12774303 | # -*- coding: utf-8 -*-
###
### DO NOT CHANGE THIS FILE
###
### The code is auto generated, your change will be overwritten by
### code generating.
###
from __future__ import absolute_import
from .api.logout import Logout
from .api.login import Login
from .api.createAccount import Createaccount
from .api.notes import... | 1.695313 | 2 |
0x0D-NoSQL/101-students.py | JoseAVallejo12/holbertonschool-web_back_end | 0 | 12774304 | #!/usr/bin/env python3
""" Top students """
def top_students(mongo_collection: object):
"""function that returns all students sorted by average score"""
top = mongo_collection.aggregate([
{
"$project": {
"name": "$name",
"averageScore": {"$avg": "$topics.sc... | 3.375 | 3 |
cronicl/triggers/cron_trigger.py | joocer/cronicl | 0 | 12774305 | <reponame>joocer/cronicl
"""
cron based trigger
Partial implementation of scheduled trigger using cron notation.
"""
from .base_trigger import BaseTrigger
import datetime
from datetime import timedelta
from ..utils.cron import is_now
from ..exceptions import MissingInformationError
import threading
sleep = threading... | 2.859375 | 3 |
setup.py | truthiswill/wait4disney | 106 | 12774306 | from setuptools import setup, find_packages
setup(
name = "disney",
version = "1.0",
description = "A history of Shanghai Disney waiting time",
long_description = "A history of Shanghai Disney waiting time",
license = "Apache License",
url = "http://s.gaott.info",
author = "gtt116",
au... | 1.375 | 1 |
excel_helper.py | MrBigBang/android_strings_translator_py | 4 | 12774307 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
' excel_helper.py '
__author__ = '<NAME>'
############## main code ###############
from openpyxl import Workbook
from openpyxl import load_workbook
import os
import const
import datetime
class ExcelHelper(object):
"""Excel 文件操作类"""
def __init__(self, path, fil... | 2.84375 | 3 |
examples/tsne/data.py | e-/ANN | 19 | 12774308 | <reponame>e-/ANN
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
import argparse
import sys
import struct
parser = argparse.ArgumentParser(description='Generate input data for the tsne example')
parser.add_argument('path', type=str, help='output path')
parser.add_argument('--sample', type=str, help='samp... | 2.671875 | 3 |
transient/linux.py | sruffell/transient | 0 | 12774309 | <gh_stars>0
import ctypes
from typing import cast
PR_SET_PDEATHSIG = 1
_PRCTL_SYSCALL = 157
def prctl(option: int, arg2: int = 0, arg3: int = 0, arg4: int = 0, arg5: int = 0) -> int:
prctl = ctypes.CDLL(None).syscall # type: ignore
prctl.restype = ctypes.c_int
prctl.argtypes = (
ctypes.c_long,... | 2.75 | 3 |
transfo/utils.py | qianyingw/rob-kiwi | 1 | 12774310 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 31 16:55:35 2019
From CS230 Code Examples
@author: qwang
"""
import os
import logging
import shutil
import torch
import json
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#%%
def save_dict_to_json(d... | 2.453125 | 2 |
user/analysis.py | boyayun/tushare | 0 | 12774311 | #!/usr/bin/python3
# -*- coding:utf-8 -*-
import os
import sys
import signal
import time
from datetime import datetime
from datetime import timedelta
# import cv2 as cv
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt # 导入模块 matplotlib.pyplot,并简写成 plt
import numpy as np # 导入... | 2.03125 | 2 |
src/test/test_xml2fasta.py | yutake27/HMDM | 2 | 12774312 | <filename>src/test/test_xml2fasta.py
import os
import sys
sys.path.append(os.path.abspath('..'))
import xml2fasta
xml_path = '../../blast-xml/pdbaa_20200712/1bxo_1.xml'
fasta_path = '../../blast-xml/pdbaa_20200712/1bxo_1.fasta'
xml2fasta.xml2fasta(xml_path, fasta_path)
xml_path = '../../blast-xml/pdbaa_20200712/4gg... | 1.875 | 2 |
tests/unit/datasources_test.py | jamesmistry/weaveq | 0 | 12774313 | <reponame>jamesmistry/weaveq
# -*- coding: utf-8 -*-
"""@package datasources_test
Tests for weaveq.datasources
"""
import unittest
import tempfile
import json
import os
import types
import sys
from weaveq.datasources import AppDataSourceBuilder, JsonLinesDataSource, JsonDataSource, CsvDataSource, ElasticsearchDataSo... | 2.390625 | 2 |
src/toil/lib/threading.py | danieldanciu/toil | 0 | 12774314 | <filename>src/toil/lib/threading.py
# Copyright (C) 2015-2018 Regents of the University of California
#
# 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/LI... | 2.296875 | 2 |
grid/utils.py | parthatom/Grid | 0 | 12774315 | """Utility functions."""
import os
def exec_os_cmd(command):
return os.popen(command).read()
| 2.125 | 2 |
__init__.py | ishay2b/KittiBox | 0 | 12774316 | <filename>__init__.py<gh_stars>0
def git_root():
''' return the root location of git rep
'''
import subprocess
gitroot = subprocess.Popen(['git', 'rev-parse', '--show-toplevel'], stdout=subprocess.PIPE).communicate()[0].rstrip().decode('utf-8')
return gitroot
| 2.25 | 2 |
services/backend/project/api/search.py | kzkaneoka/custom-job-search | 0 | 12774317 | <gh_stars>0
from flask import Blueprint, jsonify, request
from project.api.sites import Indeed
search_blueprint = Blueprint("search", __name__)
@search_blueprint.route("/search", methods=["POST"])
def search_jobs():
post_data = request.get_json()
response_object = {"status": "fail", "message": "Invalid payl... | 2.71875 | 3 |
tests/tpath/dn3/conf.py | kajigga/pop | 48 | 12774318 | DYNE = {'dn1': ['dn1']}
| 1.273438 | 1 |
2015/15_ScienceforHungryPeople/ingredient.py | deanearlwright/AdventOfCode | 1 | 12774319 | # ======================================================================
# Science for Hungry People
# Advent of Code 2015 Day 15 -- <NAME> -- https://adventofcode.com
#
# Python implementation by Dr. <NAME> III
# ======================================================================
# ==============================... | 2.515625 | 3 |
utils/data.py | liuaoy/deep-time-series | 0 | 12774320 | from torch import Tensor, Generator
from typing import TypeVar, List, Optional, Tuple, Sequence
from torch import default_generator
from torch.utils.data import Dataset, Subset
T_co = TypeVar('T_co', covariant=True)
T = TypeVar('T')
from torch._utils import _accumulate
from torch import randperm
import torch
class Subs... | 2.78125 | 3 |
molsysmt/_private/digestion/group_indices.py | uibcdf/MolModMTs | 0 | 12774321 | <reponame>uibcdf/MolModMTs
import numpy as np
def digest_group_indices(group_indices):
if type(group_indices)==str:
if group_indices in ['all', 'All', 'ALL']:
group_indices = 'all'
else:
raise ValueError()
elif type(group_indices) in [int, np.int64, np.int32]:
g... | 2.8125 | 3 |
octopus/api/graph.py | ZarvisD/octopus | 2 | 12774322 | from graphviz import Digraph
from octopus.api.edge import (EDGE_UNCONDITIONAL,
EDGE_CONDITIONAL_TRUE, EDGE_CONDITIONAL_FALSE,
EDGE_FALLTHROUGH, EDGE_CALL)
import logging
log = logging.getLogger(__name__)
log.setLevel(level=logging.DEBUG)
def insert_edges_t... | 2.75 | 3 |
qc/__init__.py | awohns/stdpopsim | 0 | 12774323 | <gh_stars>0
# Main entry point for stdpopsim_qc
# Species definitions.
from . import homo_sapiens_qc # NOQA
from . import drosophlia_melanogaster_qc # NOQA
| 1.15625 | 1 |
pyro/contrib/bnn/__init__.py | Capri2014/pyro | 10 | 12774324 | from pyro.contrib.bnn.hidden_layer import HiddenLayer
__all__ = [
"HiddenLayer",
]
| 1.0625 | 1 |
Curso/paquete/42_map.py | jsalmoralp/Python-Proyecto-Apuntes | 0 | 12774325 | """
Map: Aplica una función a dcada elemento de una lista iterable, dvolviendo otra lista.
"""
def elevar_cuadrado(num):
# return num * num
return pow(num, 2)
# numeros = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
numeros = list(range(1, 11)) # Del 1 al 10
print(numeros)
numeros_elevados = list(map(elevar_cuadrado, ... | 4.125 | 4 |
quarkchain/experimental/random_sampling_simulator.py | QuarkChain/pyquarkchain | 237 | 12774326 | <filename>quarkchain/experimental/random_sampling_simulator.py
import random
committee_size = 150
shard_size = 1024
pool_size = 150 * 1024
# Percentage of attackers in pool
attacker_p = 0.15
attacker_n = int(attacker_p * pool_size)
# Attack threshold (a committee with t percent of attackers)
attacker_tn = int(commit... | 2.71875 | 3 |
example_project/development.py | EnvSys/django-moderation | 97 | 12774327 | from example_project.settings import *
DEBUG = True
TEMPLATES[0]['OPTIONS']['debug'] = DEBUG
| 1.21875 | 1 |
systrade/trading/brokers.py | pdghawk/systrade | 1 | 12774328 | """ Module for Brokers
Brokers hold data, and provide it or subsets of it on request
when requesting price for buying and selling, prices will likely differ
"""
import copy
import pandas as pd
from pandas.tseries.offsets import DateOffset
class PaperBroker:
def __init__(self,
data_df,
... | 3.21875 | 3 |
htpt/frame.py | ben-jones/facade | 0 | 12774329 | # <NAME>
# Fall 2013
# htpt
# frame.py: ensure in-order delivery of frames for the htpt project
import threading
import struct
#from random import randint
from buffers import Buffer
from constants import *
class FramingException(Exception):
pass
class SeqNumber():
# initialize this to -1 so that the first seq... | 2.703125 | 3 |
tests/fakes/serial.py | ltowarek/arinna | 0 | 12774330 | <reponame>ltowarek/arinna<filename>tests/fakes/serial.py
#!/usr/bin/env python3
class FakeSerial:
def __init__(self):
self._last_written_data = None
self._response = None
self.read_data = []
@property
def last_written_data(self):
return self._last_written_data
@proper... | 2.78125 | 3 |
day4/openCVEx.9.py | minssoj/Learning_cnn | 0 | 12774331 | import cv2
# cap = cv2.VideoCapture(0)
cap = cv2.VideoCapture('../datasets/opencv/fish.mp4')
while True:
_ret, frame = cap.read()
frame = cv2.resize(frame, (500,400))
cv2.imshow('opencv camera', frame)
k = cv2.waitKey(1) #1msec 대기
if k==27 or k==13 : break
cap.release()
cv2.destroyAllWindows()
imp... | 2.984375 | 3 |
tests/test_node.py | account-login/arggen | 2 | 12774332 | <filename>tests/test_node.py<gh_stars>1-10
from arggen import Root, Block, Condition, If, ElseIf, Else, Context, collect_node
def test_block():
block = Block('head')
block.add_child('asdf')
block.add_child('1234')
assert '\n'.join(block.to_source(0)) == '''
head {
asdf
1234
}'''[1:]
def tes... | 2.625 | 3 |
sparql-client/tests/genquery.py | vlastocom/sparql-client | 28 | 12774333 | <reponame>vlastocom/sparql-client<filename>sparql-client/tests/genquery.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import six.moves.urllib.request
import six.moves.urllib.parse
import six.moves.urllib.error
import six.moves.urllib.request
import six.moves.urllib.error
import six.moves.urllib.parse
statement = o... | 2.125 | 2 |
python/src/data_structure/data_structure.py | yipwinghong/Algorithm | 9 | 12774334 | # coding=utf-8
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x, next=None):
self.val = x
self.next = next
class DoubleNode(object):
def __init__(self, key, val, pre=None, next=None):
self.key = key
self.val = val
self.pre = pre
... | 3.84375 | 4 |
final_project/poi_id.py | puthli/Udacity_ud120 | 0 | 12774335 | <reponame>puthli/Udacity_ud120
#!/usr/bin/python
# poi_id.py
# Creates a dataset and classifier definition fot the
# final project in the udacity ud120 machine learning introduction course
# Note: script changed to run on python 3.6
#
# to run: python3 poi_id.py
import matplotlib.pyplot as plt
import numpy
#
from skl... | 2.953125 | 3 |
binlin/utils/log.py | UKPLab/inlg2019-revisiting-binlin | 1 | 12774336 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import logging
import sys
def setup_logging():
logger = get_main_logger()
add_console_handler(logger, level=logging.DEBUG)
mute_matplotlib_handler()
return logger
def get_main_logger(level=logging.DEBUG):
# get a top-level "mypackage" logge... | 2.984375 | 3 |
lib/LineNotify.py | fukuyama012/watch_angle | 1 | 12774337 | # -*- coding: utf-8 -*-
import requests
from config import config
class LineNotify(object):
"""NotifyClass for LINE"""
NOTIFY_API_URL = "https://notify-api.line.me/api/notify"
def __init__(self, api_url = NOTIFY_API_URL, authority = config.AUTHORITY_TOKEN):
self.apiUrl = api_url
self... | 2.828125 | 3 |
RestAdm/utils/log_middleware.py | xeroCBW/testmodel | 0 | 12774338 | <filename>RestAdm/utils/log_middleware.py<gh_stars>0
import json
import socket
import time
import logging
from django.http import QueryDict
from django.utils.deprecation import MiddlewareMixin
class RequestLogMiddleware(MiddlewareMixin):
def __init__(self, get_response=None):
self.get_response = get_resp... | 2.09375 | 2 |
custom_components/sg_renamer.py | swissglider/homeassistant_custome_components | 0 | 12774339 | <gh_stars>0
"""
Renames the friendly_name from entity_name and writtes it into the entity_registry.
Version V.0.0.1
Package:
sg_renamer.py
configuration.yaml:
# entity_name musst be --> <<group_name>> --> without spaces and
sg_renamer:
- platform_name: hue --> plattform_name to rename all ent... | 2.375 | 2 |
utils.py | hyang1990/model_based_energy_constrained_compression | 16 | 12774340 | <gh_stars>10-100
import os
import torch
from torch.utils.data.sampler import SubsetRandomSampler, Sampler
from torchvision import datasets, transforms
import torch.nn.functional as F
class SubsetSequentialSampler(Sampler):
r"""Samples elements sequentially from a given list of indices, without replacement.
A... | 2.5 | 2 |
Algorithms/max_unique.py | ridwanmsharif/Algorithms | 2 | 12774341 | seen = []
# Prduces the length of the longest Substring
# thats comprised of just unique characters
def max_diff(string):
seen = [0]*256
curr_start = 0
max_start = 0
unique = 0
max_unique = 0
for n,i in enumerate(string):
if seen[assn_num(i)] == 0:
unique += 1 ... | 3.375 | 3 |
toutiao-backend/Test/6-cache/test_cache.py | weiyunfei520/toutiao | 0 | 12774342 | import requests, json
"""登录测试 POST /v1_0/authorizations"""
url = 'http://127.0.0.1:5000/v1_0/authorizations'
REDIS_SENTINELS = [('127.0.0.1', '26380'),
('127.0.0.1', '26381'),
('127.0.0.1', '26382'),]
REDIS_SENTINEL_SERVICE_NAME = 'mymaster'
from redis.sentinel import Sentinel
_se... | 2.921875 | 3 |
skills_taxonomy_v2/pipeline/tk_data_analysis/get_bulk_metadata.py | nestauk/skills-taxonomy-v2 | 3 | 12774343 | <filename>skills_taxonomy_v2/pipeline/tk_data_analysis/get_bulk_metadata.py
"""
The TextKernel data is stored in 686 separate files each with 100k job adverts.
In this script we extract some key metadata for each job advert to be stored in a single dictionary.
This will be useful for some analysis pieces.
"""
import ... | 2.515625 | 3 |
cisco-ios-xe/ydk/models/cisco_ios_xe/Cisco_IOS_XE_poe_oper.py | Maikor/ydk-py | 0 | 12774344 | """ Cisco_IOS_XE_poe_oper
This module contains a collection of YANG definitions for
monitoring power over ethernet feature in a Network Element.
Copyright (c) 2016\-2018 by Cisco Systems, Inc.
All rights reserved.
"""
from collections import OrderedDict
from ydk.types import Entity, EntityPath, Identity, Enum, YTyp... | 1.976563 | 2 |
Twitter_Sentiment_Analysis.py | FiazBinSayeed/Twitter-Sentiment-Analysis | 1 | 12774345 | <filename>Twitter_Sentiment_Analysis.py
import tweepy
from textblob import TextBlob
import pandas as pd
import numpy as np
import re
import matplotlib.pyplot as plt
import sys
plt.style.use('fivethirtyeight')
api_key = ""
api_secret_key = ""
access_token = ""
access_token_secret = ""
auth_handler = twee... | 3.125 | 3 |
train.py | ihsangkcl/RFM | 0 | 12774346 | <filename>train.py
import torch
from utils.utils import data_prefetcher_two, cal_fam, setup_seed, calRes
from pretrainedmodels import xception
import utils.datasets_profiles as dp
from torch.utils.data import DataLoader
from torch.optim import Adam
import numpy as np
import argparse
import random
import time
... | 1.976563 | 2 |
calibration/StereographicCalibration.py | sebalander/sebaPhD | 6 | 12774347 | # -*- coding: utf-8 -*-
"""
Created on Tue Sep 13 19:00:40 2016
@author: sebalander
"""
from numpy import zeros, sqrt, array, tan, arctan, prod, cos
from cv2 import Rodrigues
from lmfit import minimize, Parameters
#from calibration import calibrator
#xypToZplane = calibrator.xypToZplane
#
## %% ========== ========== ... | 2.15625 | 2 |
org/apache/helix/messaging/handling/HelixTaskResult.py | davzhang/helix-python-binding | 3 | 12774348 | # package org.apache.helix.messaging.handling
#from org.apache.helix.messaging.handling import *
#from java.util import HashMap
#from java.util import Map
class HelixTaskResult:
def __init__(self):
self._success = False
self._message = ""
self._taskResultMap = {}
self._interrupte... | 2.171875 | 2 |
tests/test_unpipe.py | python-pipe/hellp | 123 | 12774349 | from sspipe import p, px, unpipe
def test_unpipe_active():
a_pipe = px + 1 | px * 5
func = unpipe(a_pipe)
assert func(0) == 5
def test_unpipe_passive():
func = lambda x: (x + 1) * 5
func = unpipe(func)
assert func(0) == 5
| 2.75 | 3 |
src/scripts/x+y2kmeans.py | ai-ku/upos | 4 | 12774350 | <filename>src/scripts/x+y2kmeans.py
#!/usr/bin/env python
import sys, gzip #argparse
from optparse import OptionParser
from collections import defaultdict as dd
parser = OptionParser()
#parser = argparse.ArgumentParser(description='Finds unique x-y pairs and concatenates their vectors. Requires scode output to stdin.... | 2.421875 | 2 |