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 |
|---|---|---|---|---|---|---|
api/needley/models.py | kino-ma/needley | 0 | 31200 | <gh_stars>0
from django.db import models
from django.utils import timezone
from django.core.validators import MinLengthValidator
from django.contrib.auth.models import AbstractUser
class User(AbstractUser):
email = models.EmailField(unique=True)
# Nickname is display name
nickname = models.CharField(
... | 2.46875 | 2 |
app.py | tomachalek/riki | 1 | 31201 | # Copyright 2014 <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | 1.84375 | 2 |
app/src/modeling/predict_model.py | joaofracasso/banknoteBrazil | 8 | 31202 | import io
import torchvision.transforms as transforms
from PIL import Image
import onnxruntime as ort
import numpy as np
class_map = {
0: "10 Reais Frente",
1: "10 Reais Verso",
2: "20 Reais Frente",
3: "20 Reais Verso",
4: "2 Reais Frente",
5: "2 Reais Verso",
6: "50 Reais Frente",
... | 2.71875 | 3 |
arcpy_ListDatasets.py | geocot/Python_ArcGIS_Desktop | 0 | 31203 | import arcpy
arcpy.env.workspace = "c:/temp/Donnees.gdb"
arcpy.env.overwriteOutput = True
listes = arcpy.ListDatasets()
for d in listes:
print(d) | 1.75 | 2 |
src/server.py | ForgedSnow/Frontiersman | 0 | 31204 | import random
import socket
import time
class client:
def __init__(self, name, address, socket, color):
self.name = name
self.address = address
self.socket = socket
self.color = color
sep = '\n'
def dice_roll():
return (str(random.randint(1, 6)) + ',' + str(random.randint(1... | 3.125 | 3 |
adminCustom/templatetags/sort_app.py | Kiri23/DECE-Backend-Project | 0 | 31205 | <gh_stars>0
from django import template
from django.conf import settings
register = template.Library()
@register.filter
def sort_apps(apps):
count = len(apps)
print(f'count del index admin page: {count}')
apps.sort(
key=lambda x:
settings.APP_ORDER.index(x['app_label'])
if ... | 2.21875 | 2 |
A_MIA_R3_Core/Graphproc/Graphmod.py | nao0423/A_MIA_R3 | 0 | 31206 | import os
import numpy as np
from matplotlib import pyplot as plt
class DrawGraphs:
def __init__(self,path_ONLY):
self.path_ONLY=path_ONLY
if not os.path.exists("./MakeGraph/graphs/"):
os.makedirs("./MakeGraph/graphs/")
def DrawEmotion(self,emotiondataarray):
colors = ["#... | 3.015625 | 3 |
zkay/transaction/int_casts.py | nibau/zkay | 0 | 31207 | <reponame>nibau/zkay<filename>zkay/transaction/int_casts.py
from enum import IntEnum
from typing import Optional, Any
from zkay.compiler.privacy.library_contracts import bn128_scalar_field
from zkay.transaction.types import AddressValue
def __convert(val: Any, nbits: Optional[int], signed: bool) -> int:
if isins... | 2.28125 | 2 |
reid/evaluation_metrics/__init__.py | xueping187/weakly-supervised-person-re-id | 2 | 31208 | <filename>reid/evaluation_metrics/__init__.py<gh_stars>1-10
from __future__ import absolute_import
from .classification import accuracy
from .ranking_1 import cmc, mean_ap
__all__ = [
'accuracy',
'cmc',
'mean_ap',
]
| 1.164063 | 1 |
Modules/secreat-message.py | cclauss/pythonCodes | 0 | 31209 | #This file contain examples for os module
#What is os module?
#is a module using for list files in folder, we can get name of current working directory
#rename files , write on files
import os
def rename_files():
# (1) get file names from a folder
file_list = os.listdir(r"C:\Users\user\Desktop\python\pythonCodes\... | 4.03125 | 4 |
backend/database/db_result.py | Mancid/mancid_project | 2 | 31210 | <reponame>Mancid/mancid_project
import logging
def result_db(database):
""" This function return the result of database.
They return a dict
:returns: a dict with all rows in database
:rtype: dict
"""
logging.info("The result of filter")
return list(database.find({}, {"_id": 0}))
| 2.9375 | 3 |
donkeycar/parts/angle_adjust.py | hironorinaka99/donkeycar | 0 | 31211 | class angle_adjustclass(): #ステアリングの切れ角を調整する
def __init__(self):
self.angle_adjust = 1.0
return
def angleincrease(self):
self.angle_adjust = round(min(2.0, self.angle_adjust + 0.05), 2)
print("In angle_adjust increase",self.angle_adjust)
def angledecrease(self):
self... | 3.625 | 4 |
sem_seg/train_pyramid.py | Hao-FANG-92/3D_PSPNet | 6 | 31212 | <reponame>Hao-FANG-92/3D_PSPNet
import argparse
import math
import h5py
import numpy as np
import tensorflow as tf
import socket
import time
import resource
import os
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = os.path.dirname(BASE_DIR)
sys.path.append(BASE_DIR)
sys.path.append(ROOT_DIR... | 1.828125 | 2 |
tests/pyre/components/protocol.py | BryanRiel/pyre | 0 | 31213 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# <NAME>. aïvázis
# orthologue
# (c) 1998-2018 all rights reserved
#
"""
Check that declarations of trivial protocols produce the expected layout
"""
def test():
import pyre
# declare
class protocol(pyre.protocol):
"""a trivial protocol"""
#... | 2.609375 | 3 |
Modules/init_logging.py | LoveBootCaptain/WeatherPi | 7 | 31214 | <filename>Modules/init_logging.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# create some logger details
import logging.handlers
# create a weather logger
weather_path = '/home/pi/WeatherPi/logs/Weather_Log_Data.log'
WEATHER_LOG_FILENAME = weather_path
# Set up a specific logger with our desired output level
weather... | 2.984375 | 3 |
tests/functional/step_defs/test_predictions.py | carlos10seg/rec-service | 1 | 31215 | <reponame>carlos10seg/rec-service<filename>tests/functional/step_defs/test_predictions.py
import pytest
import requests
import logging
from pytest_bdd import scenarios, given, then, parsers
from requests.exceptions import ConnectionError
def is_responsive(url):
try:
response = requests.get(url)
if... | 2.328125 | 2 |
meiduo_mall/meiduo_mall/apps/contents/views.py | hgztlmb/meiduo_project | 2 | 31216 | <filename>meiduo_mall/meiduo_mall/apps/contents/views.py
from django.shortcuts import render
from django.views import View
from goods.models import GoodsChannel
from contents.models import ContentCategory
from .utils import get_categories
class IndexView(View):
def get(self, request):
# 定义一个字典categories包装... | 2.21875 | 2 |
examples/ticker.py | rstms/txtrader-monitor | 0 | 31217 | <reponame>rstms/txtrader-monitor<gh_stars>0
from txtrader_monitor import Monitor
import json
from pprint import pprint
m = Monitor(log_level='WARNING')
def status(channel, data):
print(f"{channel}: {data}")
if data.startswith('.Authorized'):
pass
return True
def ticker(channel, data):
print... | 2.484375 | 2 |
code/models/maxEnt.py | trenslow/thesis | 0 | 31218 | <reponame>trenslow/thesis<gh_stars>0
import tensorflow as tf
import numpy as np
import itertools
import time
import random
import sys
def chunks(l, n):
# for efficient iteration over whole data set
for i in range(0, len(l), n):
yield l[i:i + n]
def read_file(file):
feats = []
wrds = []
v... | 2.46875 | 2 |
scripts/boot-sequence.py | kaynarov/commun.contracts | 0 | 31219 | <filename>scripts/boot-sequence.py
#!/usr/bin/env python3
import os
import sys
import subprocess
default_contracts_dir = '/opt/cyberway/bin/data-dir/contracts/'
nodeos_url = os.environ.get('CYBERWAY_URL', 'http://nodeosd:8888')
os.environ['CYBERWAY_URL'] = nodeos_url
os.environ['CLEOS'] = '/opt/cyberway/bin/cleos'
a... | 1.890625 | 2 |
ds-udacity/curso 2/tutorial/exercicio4/mapper_1/reduce.py | tassotirap/data-science | 0 | 31220 | <reponame>tassotirap/data-science
#!/usr/bin/python
import sys
import csv
reader = csv.reader(sys.stdin, delimiter='\t')
writer = csv.writer(sys.stdout, delimiter='\t', quotechar='"', quoting=csv.QUOTE_ALL)
userInfo = None
for line in reader:
thisType = line[1]
if thisType == 'A':
userInfo = line
... | 2.890625 | 3 |
node/node.py | abudnik/prun | 20 | 31221 | <reponame>abudnik/prun
import sys
import os
NODE_SCRIPT_EXEC_FAILED = -5
errCode = 0
try:
readFifo = sys.argv[2]
scriptLen = int(sys.argv[3])
taskId = int(sys.argv[4])
numTasks = int(sys.argv[5])
jobId = sys.argv[6]
fifo = os.open(readFifo, os.O_RDONLY)
bytes = bytearray()
while len(b... | 2.078125 | 2 |
dist/Basilisk/fswAlgorithms/rwMotorVoltage/rwMotorVoltage.py | ian-cooke/basilisk_mag | 0 | 31222 | <gh_stars>0
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.12
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info >= (2, 7, 0):
... | 1.875 | 2 |
prowl/__main__.py | SoorajModi/PrOwl | 0 | 31223 | """Begin PrOwl
"""
from .prowl import watch
if __name__ == '__main__':
watch()
| 0.921875 | 1 |
app/main/__init__.py | sundayliu/flask-tutorial | 0 | 31224 | <reponame>sundayliu/flask-tutorial
# -*- coding:utf-8 -*-
from flask import Blueprint
main = Blueprint('main',__name__)
from . import views,errors
from ..models import Permission
@main.app_context_processor
def inject_permissions():
return dict(Permission=Permission) | 1.75 | 2 |
setup.py | sgykfjsm/flask-logging-decorator | 5 | 31225 | #!/usr/bin/env python
from setuptools import setup
from os.path import abspath, dirname, join
from codecs import open
here = abspath(dirname(__file__))
long_description = ''
with open(join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='flask_logging_decorator',
versi... | 1.4375 | 1 |
contracts/doe_token_contract.py | pettitpeon/doe-nft-contract | 0 | 31226 | from web3 import Web3
import contracts.doe_token_abi as doe_token_abi
def get_main_balance(w3, wallet):
contract_address = "0xf8E9F10c22840b613cdA05A0c5Fdb59A4d6cd7eF"
contract = w3.eth.contract(address=contract_address, abi=doe_token_abi.get_abi())
balanceOf = contract.functions.balanceOf(wallet).call()
... | 2.078125 | 2 |
bin/analytic/catalog/_mypath.py | DarkEnergyScienceCollaboration/chroma | 3 | 31227 | import os, sys
thisdir = os.path.dirname(os.path.abspath(__file__))
libdir = os.path.abspath(os.path.join(thisdir, '../../../'))
if libdir not in sys.path:
sys.path.insert(0, libdir)
| 2.203125 | 2 |
Code_Challenges/array_replace.py | mvkumar14/Practice | 0 | 31228 | <reponame>mvkumar14/Practice
# 072220
# CodeSignal
# https://app.codesignal.com/arcade/intro/level-6/mCkmbxdMsMTjBc3Bm/solutions
def array_replace(inputArray, elemToReplace, substitutionElem):
# loop through input array
# if element = elemToReplace
# replace that element
for index,i in enumerate(input... | 3.4375 | 3 |
sms.py | varunotelli/Gujarat | 2 | 31229 | import urllib.request, urllib.error, urllib.parse
import http.cookiejar
from getpass import getpass
import sys
def send(number,scheme):
username="9791011603"
passwd="<PASSWORD>"
message="You have successfully been enrolled for "+scheme
'''
username = input("Enter Username: ")
passwd = getpass()
message = input... | 2.734375 | 3 |
tests/python-playground/tv_1d_0.py | marcocannici/scs | 25 | 31230 | <gh_stars>10-100
# This is automatically-generated code.
# Uses the jinja2 library for templating.
import cvxpy as cp
import numpy as np
import scipy as sp
# setup
problemID = "tv_1d_0"
prob = None
opt_val = None
# Variable declarations
np.random.seed(0)
n = 100000
k = max(int(np.sqrt(n)/2), 1)
x0 = np.ones... | 2.5 | 2 |
src/pipeline.py | iyunbo/logz | 0 | 31231 | <filename>src/pipeline.py<gh_stars>0
"""Construction of the master pipeline.
"""
from typing import Dict
from kedro.pipeline import Pipeline
from .data import pipeline as de
from .models import pipeline as ds
###########################################################################
# Here you can find an example... | 2.46875 | 2 |
aiochclient/types.py | maxifom/aiochclient | 0 | 31232 | import datetime as dt
import re
from abc import ABC, abstractmethod
from decimal import Decimal
from typing import Any, Callable, Generator, Optional
from uuid import UUID
from aiochclient.exceptions import ChClientError
try:
import ciso8601
datetime_parse = date_parse = ciso8601.parse_datetime
... | 2.640625 | 3 |
pets/meupet/migrations/0016_auto_20160105_2019.py | diogum/pets | 57 | 31233 | <filename>pets/meupet/migrations/0016_auto_20160105_2019.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [("meupet", "0015_pet_published")]
... | 1.640625 | 2 |
space_api/db/update.py | AliabbasMerchant/space-api-python | 8 | 31234 | from space_api.utils import generate_find, AND
from space_api.transport import Transport
from space_api.response import Response
class Update:
"""
The DB Update Class
::
from space_api import API, AND, OR, COND
api = API("My-Project", "localhost:4124")
db = api.mongo() # For a Mon... | 2.921875 | 3 |
OpenCV/Histogramas/h6.py | matewszz/Python | 0 | 31235 | <reponame>matewszz/Python
import dlib
import cv2
image = cv2.imread("../testeOpenCV.jpg")
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
hogFaceDetector = dlib.get_frontal_face_detector()
faces = hogFaceDetector(gray, 1)
for (i, rect) in enumerate(faces):
x = rect.left()
y = rect.top()
w = rect.right() - ... | 2.984375 | 3 |
preacher/compilation/yaml/tag/argument.py | ymoch/preacher | 3 | 31236 | <reponame>ymoch/preacher
from yaml import Node
from yamlen import Tag, TagContext
from preacher.compilation.argument import Argument
class ArgumentTag(Tag):
def construct(self, node: Node, context: TagContext) -> object:
key = context.constructor.construct_scalar(node) # type: ignore
return Argu... | 2.3125 | 2 |
Drivers/PS-228xS/PS228xS_Python_Sockets_Driver/PS228xS_Example.py | 398786172/keithley | 31 | 31237 | #!/usr/bin/python
import socket
import struct
import math
import time
import Keithley_PS228xS_Sockets_Driver as ps
echoCmd = 1
#===== MAIN PROGRAM STARTS HERE =====
ipAddress1 = "192.168.127.12"
ipAddress2 = "172.16.17.32"
ipAddress3 = "192.168.127.12"
port = 5025
timeout = 20.0
t1 = time.time()
#ps.instrConnect(... | 2.578125 | 3 |
saveimage.py | NaviRice/HeadTracking | 1 | 31238 | <reponame>NaviRice/HeadTracking<gh_stars>1-10
import OpenEXR
from navirice_get_image import KinectClient
from navirice_helpers import navirice_image_to_np
DEFAULT_HOST= 'navirice'
DEFAULT_PORT=29000
kin = KinectClient(DEFAULT_HOST, DEFAULT_PORT)
kin.navirice_capture_settings(rgb=False, ir=True, depth=True)
last_co... | 2.0625 | 2 |
nonebot_plugin_arcaea/crud/crud_user.py | iyume/nonebot-plugin-arcaea | 35 | 31239 | <gh_stars>10-100
from typing import Optional
from datetime import datetime
from sqlite3.dbapi2 import Cursor
from ..config import config
from .. import schema
class CRUDUser():
model = schema.User
def create(
self,
db: Cursor,
qq: int,
code: str
) -> None:
user_di... | 2.734375 | 3 |
baseline/eval_sent.py | parallelcrawl/DataCollection | 8 | 31240 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from strip_language_from_uri import LanguageStripper
import urlparse
correct, wrong = [], []
def strip_uri(uri, language_stripper):
parsed_uri = urlparse.urlparse(uri)
matched_language = language_stripper.match(parsed_uri.path)
if n... | 3.015625 | 3 |
dz/dz-05/src/integrators/implicit.py | Yalfoosh/AIPR | 0 | 31241 | <reponame>Yalfoosh/AIPR
import copy
from typing import Callable
import numpy as np
from .explicit import ExplicitIntegrator
from .integrator import Integrator
class ImplicitIntegrator(Integrator):
def generate_correct_function(
self, *args, **kwargs
) -> Callable[[np.ndarray, np.ndarray, float], np.... | 2.34375 | 2 |
result_service_gui/services/result_adapter.py | abdulfahad66/result-service-gui | 0 | 31242 | <filename>result_service_gui/services/result_adapter.py
"""Module for results adapter."""
import logging
import os
from typing import List
from aiohttp import ClientSession
from aiohttp import hdrs
from aiohttp import web
from multidict import MultiDict
RACE_HOST_SERVER = os.getenv("RACE_HOST_SERVER", "localhost")
RA... | 2.59375 | 3 |
todo/search.py | ruslan-ok/ServerApps | 1 | 31243 | from django.db.models import Q
from hier.search import SearchResult
from hier.grp_lst import search as hier_search
from hier.params import get_search_mode
from .models import app_name, Task
def search(user, query):
result = SearchResult(query)
search_mode = get_search_mode(query)
lookups = None
if (se... | 1.976563 | 2 |
usrobj_src/pyembroideryGH_AddStitchblock.py | fstwn/pyembroideryGH | 4 | 31244 | """
Adds one or many StitchBlocks to an embroidery pattern supplied as
pyembroidery.EmbPattern instance
Inputs:
Pattern: The pattern to be modified as pyembroidery.EmbPattern
instance.
{item, EmbPattern}
StitchBlock: The stitchblock(s) to add to the pattern.
... | 2.6875 | 3 |
api.py | brannonvann/neato-driver-python | 1 | 31245 | # Script used to read all help text from Neato.
# Simply connect Neato, update your port
# name ('/dev/neato') and run this script.
# All help markdown is written to a file in the
# same directory called neato_help.md
# Author: <NAME> <EMAIL>
# License: MIT
# Run this script: python api.py
# Note: This script does n... | 2.765625 | 3 |
UseImportJumpCommand.py | tinwatchman/Sublime-UseImport | 0 | 31246 | import sublime, sublime_plugin
import json
import useutil
class UseImportJumpCommand(sublime_plugin.TextCommand):
def description(self):
return 'Jump to File (Use-Import)'
def is_enabled(self):
return self.is_javascript_view()
def is_visible(self):
return self.is_javascrip... | 2.203125 | 2 |
ExerciciosPython/67- Tabuada.py | lucadomingues/Python | 0 | 31247 | <gh_stars>0
while True:
print('\n--- MULTIPLICATION TABLE ---')
num = int(input('Type a number integer: '))
if num < 0:
break
for c in range(1, 11):
print(f'{c} X {num} = {c*num}')
print('END PROGRAM') | 3.875 | 4 |
154/main.py | pauvrepetit/leetcode | 0 | 31248 | # 154. 寻找旋转排序数组中的最小值 II
# 剑指 Offer 11. 旋转数组的最小数字
#
# 20200722
# huao
# 这个其实还真是不好做呀
# O(n)的算法自然是非常简单的,直接扫一遍就完了
# 但是这个list本身是由两段排好序的list组合而成的,这个条件实在是不太好用上啊
from typing import List
class Solution:
def findMin(self, nums: List[int]) -> int:
minNum = nums[0]
for i in range(len(nums)):
minN... | 3.859375 | 4 |
lume_model/tests/keras/test_layers.py | slaclab/lume-model | 2 | 31249 | <reponame>slaclab/lume-model<gh_stars>1-10
import pytest
import sys
# test value and failed initialization with characters
@pytest.mark.parametrize(
"offset,scale,lower,upper",
[
(1, 2, 0, 1),
(5, 4, -1, 1),
pytest.param("t", "e", "s", "t", marks=pytest.mark.xfail),
],
)
def test_sc... | 2.015625 | 2 |
pyswrve/export_api.py | badanin-dmitry-playrix/pyswrve | 4 | 31250 | <reponame>badanin-dmitry-playrix/pyswrve<filename>pyswrve/export_api.py
# -*- coding: utf-8 -*-
from urllib.parse import urljoin
from datetime import datetime, timedelta
from .api import SwrveApi
class SwrveExportApi(SwrveApi):
""" Class for requesting stats with Swrve Export API
https://docs.swrve.com/swr... | 2.140625 | 2 |
makerHello/OpenCV-Face-detection/database/ImportLog.py | lingdantiancai/face-FD-FR | 0 | 31251 | #创建数据库并把txt文件的数据存进数据库
import sqlite3 #导入sqlite3
cx = sqlite3.connect('FaceRes.db') #创建数据库,如果数据库已经存在,则链接数据库;如果数据库不存在,则先创建数据库,再链接该数据库。
cu = cx.cursor() #定义一个游标,以便获得查询对象。
#cu.execute('create table if not exists train4 (id integer primary key,name text)') #创建表
fr = open('log.txt') #打开要读取的txt文件
for line... | 3.46875 | 3 |
plot_gen.py | XanaduAI/kerr-squeezing | 1 | 31252 | <gh_stars>1-10
import numpy as np
import matplotlib.pyplot as plt
import glob
from strawberryfields.decompositions import takagi
def jsa_from_m(m):
"""Given a phase sensitive moment m returns the joint spectral amplitude associated with it.
Args:
m (array): phase sentive moment
Returns:
... | 2.359375 | 2 |
src/2/2997.py | youngdaLee/Baekjoon | 11 | 31253 | """
2997. 네 번째 수
작성자: xCrypt0r
언어: Python 3
사용 메모리: 29,380 KB
소요 시간: 68 ms
해결 날짜: 2020년 9월 26일
"""
def main():
num = sorted(map(int, input().split()))
d1 = num[1] - num[0]
d2 = num[2] - num[1]
if d1 == d2: res = num[2] + d1
elif d1 > d2: res = num[0] + d2
else: res = num[1] + d1
print(re... | 3.296875 | 3 |
python/convertSVGs.py | JustgeekDE/imdb-visualizations | 0 | 31254 | <reponame>JustgeekDE/imdb-visualizations<gh_stars>0
'''
Created on 10.08.2014
@author: <NAME> <<EMAIL>>
As long as you retain this notice you can do whatever you want with this stuff.
If we meet some day, and you think this stuff is worth it, you can buy me a
beer in return
<NAME>
'''
import os
if __name__ == '__ma... | 2.359375 | 2 |
game/management/commands/player-video.py | atadams/bbstuff | 0 | 31255 | <filename>game/management/commands/player-video.py<gh_stars>0
from decimal import Decimal
from pathlib import Path
import requests
from django.core.management import BaseCommand
from django.db.models import F
from django.db.models.aggregates import Max, Min
from moviepy.video.VideoClip import ColorClip, TextClip
from ... | 2 | 2 |
nlabel/importers/server.py | poke1024/nlabel | 1 | 31256 | from wsgiref.simple_server import make_server
from nlabel.io.carenero.schema import create_session_factory, \
Text, ResultStatus, Result, Tagger, Vector, Vectors
from nlabel.io.carenero.common import ExternalKey
from nlabel.io.common import ArchiveInfo, text_hash_code
from nlabel.io.carenero.common import json_to_... | 1.992188 | 2 |
tests/integration/test_eden_unmount.py | tiguchi/watchman | 2 | 31257 | <gh_stars>1-10
# vim:ts=4:sw=4:et:
# Copyright 2012-present Facebook, Inc.
# Licensed under the Apache License, Version 2.0
# no unicode literals
from __future__ import absolute_import, division, print_function
import os
import pywatchman
import WatchmanEdenTestCase
class TestEdenUnmount(WatchmanEdenTestCase.Watch... | 2.046875 | 2 |
python/testData/resolve/SuperPy3k.py | truthiswill/intellij-community | 2 | 31258 | <gh_stars>1-10
class A(object):
def foo(self):
print "foo"
class B(A):
def foo(self):
super().foo()
# <ref>
B().foo()
| 2.9375 | 3 |
python/displaywidget.py | karlssonper/gpuip | 10 | 31259 | <reponame>karlssonper/gpuip
from PySide import QtGui, QtOpenGL, QtCore
from OpenGL import GL
from OpenGL import GL
from OpenGL.GL import shaders
from OpenGL.arrays import vbo
from OpenGL.GL.ARB import texture_rg
from OpenGL.GL.ARB import half_float_vertex
from ctypes import c_void_p
import numpy
import math
vert_src =... | 2.03125 | 2 |
fiftyone/utils/eval/coco.py | vinayya/fiftyone | 1 | 31260 | <filename>fiftyone/utils/eval/coco.py
"""
COCO-style detection evaluation using
`pycocotools <https://github.com/cocodataset/cocoapi/tree/master/PythonAPI/pycocotools>`_.
| Copyright 2017-2020, Voxel51, Inc.
| `voxel51.com <https://voxel51.com/>`_
|
"""
# pragma pylint: disable=redefined-builtin
# pragma pylint: disab... | 2.125 | 2 |
python/NSTEPS.py | feliposz/spoj-solutions | 0 | 31261 | def plot(width, height):
for j in range(height):
y = height - j - 1
print("y = {0:3} |".format(y), end="")
for x in range(width):
print("{0:3}".format(f(x,y)), end="")
print()
print(" +", end="")
for x in range(width):
print("---", end="")
prin... | 3.921875 | 4 |
examples/add_annotation_links.py | Cytomine-ULiege/Cytomine-python-client | 8 | 31262 | # -*- coding: utf-8 -*-
# * Copyright (c) 2009-2018. Authors: see NOTICE file.
# *
# * 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... | 2.3125 | 2 |
monasca_api/tests/test_a_repository.py | zhangjianweibj/monasca-api | 50 | 31263 | # Copyright 2015 Cray
# Copyright 2016 FUJITSU LIMITED
# Copyright 2017 Hewlett Packard Enterprise Development LP
#
# 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/lic... | 1.757813 | 2 |
uniflocpy/uTemperature/temp_cable_NS.py | Shabonasar/unifloc | 4 | 31264 |
"""ГОСТ Р 51777-2001 Кабели для установок погружных электронасосов.
Общие технические условия (с Поправкой) """
import math
from scipy.optimize import fsolve
# TODO реализовать нормально ГОСТ, отрефакторить, учитывать разные формы кабеля
# TODO толщины слоев сделать
# TODO рисунок кабеля при инициализации
class ... | 2.8125 | 3 |
user_orders/models/__init__.py | Vitamal/shop | 0 | 31265 | from .order import Order
from .user import User
| 1.0625 | 1 |
src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/_exception_handler.py | viananth/azure-cli | 0 | 31266 | <gh_stars>0
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------... | 1.953125 | 2 |
examples/EarthInterior/makeplot.py | alex-w/vplanet | 0 | 31267 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import vplot
import scipy.signal as sig
#plt.rcParams["text.usetex"]=True
#plt.rcParams["text.latex.unicode"]=True
plt.rcParams.update({'font.size':16,'legend.fontsize':15})
import sys
# Check correct number of arguments
if (len(sys.argv) != ... | 2.125 | 2 |
numcodecs/tests/test_compat.py | rabernat/numcodecs | 0 | 31268 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division
import array
import numpy as np
from numcodecs.compat import buffer_tobytes
def test_buffer_tobytes():
bufs = [
b'adsdasdas',
bytes(20),
np.arange(100),
array.array('l', b'qwertyuiqwertyui'... | 2.5625 | 3 |
unittest/scripts/py_dev_api_examples/working_with_collections/Working_with_Existing_Collections.py | mueller/mysql-shell | 119 | 31269 | # Get a collection object for 'my_collection'
myColl = db.get_collection('my_collection')
| 1.570313 | 2 |
app/decorators/cacheable.py | matrufsc2/matrufsc2 | 4 | 31270 | from app.cache import get_from_cache, set_into_cache, delete_from_cache
import logging as _logging
import hashlib, json
logging = _logging.getLogger("matrufsc2_decorators_cacheable")
logging.setLevel(_logging.DEBUG)
__author__ = 'fernando'
CACHE_CACHEABLE_KEY = "cache/functions/%s/%s"
def cacheable(consider_only=No... | 2.609375 | 3 |
falkon/mmv_ops/keops.py | mohamad-amin/falkon | 130 | 31271 | import warnings
from dataclasses import dataclass
from typing import List, Optional
import torch
from falkon.utils.stream_utils import sync_current_stream
from falkon.mmv_ops.utils import _get_gpu_info, create_output_mat, _start_wait_processes
from falkon.options import FalkonOptions, BaseOptions
from falkon.utils i... | 2.53125 | 3 |
ancilla/ancilla/foundation/node/api/node.py | frenzylabs/ancilla | 7 | 31272 | '''
node.py
ancilla
Created by <NAME> (<EMAIL>) on 01/14/20
Copyright 2019 FrenzyLabs, LLC.
'''
import time
from .api import Api
from ..events import Event
from ...data.models import Service, Printer, Camera, ServiceAttachment, CameraRecording, Node
from ..response import AncillaError, AncillaResponse
import re... | 1.8125 | 2 |
tensorflow_in_action/nlp/2_ptb_gen_idword.py | wdxtub/deep-learning-note | 37 | 31273 | import codecs
import sys
RAW_DATA = "../data/ptb/ptb.train.txt"
VOCAB = "data/ptb.vocab"
OUTPUT_DATA = "data/ptb.train"
# 读取词汇表并建立映射
with codecs.open(VOCAB, "r", "utf-8") as f_vocab:
vocab = [w.strip() for w in f_vocab.readlines()]
word_to_id = {k: v for (k, v) in zip(vocab, range(len(vocab)))}
# 如果出现了被删除的低频词,替换... | 2.9375 | 3 |
racoon/view/error/custom.py | onukura/Racoon | 3 | 31274 | # -*- coding: utf-8 -*-
from flask import Blueprint, render_template
bp_error = Blueprint("bp_error", __name__, url_prefix="/error")
# Specific Error Handlers
@bp_error.route("/default")
def default():
return render_template(
"error/error_base.html",
error_code=500,
header_n... | 2.5 | 2 |
modules/d_functions.py | william-stearns/E_ink_dashboard | 0 | 31275 |
import time
import datetime
from waveshare_epd import epd7in5_V2
from PIL import Image, ImageDraw, ImageFont
import calendar
import random
import os
picdir = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'pic')
fontdir = os.path.join(os.path.dirname(os.path.dirname(os.path.rea... | 2.90625 | 3 |
v2.5.7/toontown/racing/DistributedKartPadAI.py | TTOFFLINE-LEAK/ttoffline | 4 | 31276 | <gh_stars>1-10
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedKartPadAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedKartPadAI')
def __init__(self, air):
DistributedObj... | 2.15625 | 2 |
main.py | leo0123456/Smart-camera | 9 | 31277 | <reponame>leo0123456/Smart-camera
from PyQt5 import Qt
from PyQt5 import QtCore,QtWidgets,QtGui
import sys
import PyQt5
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QFileDialog, QGraphicsRectItem, QGraphicsScene
from PyQt5.QtGui import QPixmap, QImage
from PyQt5.QtCore import QSize
import cv2
import numpy... | 2.25 | 2 |
classes/Friend.py | brandonwarech/book-tracker-capstone | 0 | 31278 | import logging
import sys
import classes.iDb as db
# Set Logging Level
logging.basicConfig(level=logging.INFO)
class Friend:
def __init__(self, User, Friend):
self.user_id = User.user_id
self.friend_id = Friend.user_id
pass
def addFriend(self):
pass
def removeFriend(self)... | 2.71875 | 3 |
src/video_retrieval/FrameSaver.py | DoodleBobBuffPants/EyesInTheSky | 0 | 31279 | # save frames asynchronously
import cv2 as cv
def frame_saver(queue, lock):
while True:
lock.take_lock()
cv.imwrite("frame.jpg", queue.peek()) # peek non existent
lock.release_lock()
| 2.859375 | 3 |
zhiwehu/post/urls.py | zhiwehu/zhiwehu | 1 | 31280 | # -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from .views import PostListView, PostDetailView
urlpatterns = patterns('',
# URL pattern for the PostListView # noqa
url(
regex=r'^$',
view=PostListVi... | 2.140625 | 2 |
iseq/_cli/hscan.py | EBI-Metagenomics/iseq | 0 | 31281 | <gh_stars>0
import os
import click
from fasta_reader import read_fasta
from hmmer_reader import open_hmmer
from iseq.alphabet import alphabet_name
from iseq.hmmer3 import create_profile
from iseq.hmmer_model import HMMERModel
from iseq.model import EntryDistr
from .debug_writer import DebugWriter
from .output_writer... | 2.140625 | 2 |
commands/playbackjoystick.py | randbrown/robotpy_recordplayback | 0 | 31282 | <gh_stars>0
'''
Psuedo-joystick object for playback of recorded macros
'''
class PlaybackJoystick():
def __init__(self, playback_data):
self.playback_data = playback_data
self.t = 0
def setTime(self, t=0):
self.t = t
def getRawAxis(self, axis):
#TODO fix me, get correc... | 2.84375 | 3 |
link_grib.py | martinremy/wps | 5 | 31283 | <gh_stars>1-10
#!/usr/bin/env python
# WRF-CMake (https://github.com/WRF-CMake/wps).
# Copyright 2018 <NAME> and <NAME>. Licensed under the MIT License.
import os
import sys
import shutil
import glob
import string
import itertools
import argparse
def link(src_path, link_path):
assert os.path.isfile(src_path)
... | 2.265625 | 2 |
freight/__init__.py | buahaha/aa-freight | 0 | 31284 | default_app_config = "freight.apps.FreightConfig"
__version__ = "1.5.1"
__title__ = "Freight"
| 1.226563 | 1 |
platform/hwconf_data/efr32bg1p/modules/WDOG/__init__.py | lenloe1/v2.7 | 0 | 31285 | <reponame>lenloe1/v2.7
import efr32bg1p.halconfig.halconfig_types as halconfig_types
import efr32bg1p.halconfig.halconfig_dependency as halconfig_dependency
import efr32bg1p.PythonSnippet.ExporterModel as ExporterModel
import efr32bg1p.PythonSnippet.RuntimeModel as RuntimeModel
import efr32bg1p.PythonSnippet.Metadata a... | 1.125 | 1 |
dataart.py | heerdyes/tortoises | 0 | 31286 | <reponame>heerdyes/tortoises<filename>dataart.py
import turtle
# initialization
t=turtle.Turtle()
t.speed(0)
t.up()
t.bk(200)
t.down()
# ask for data file name
fname=input('enter data file name: ')
print('reading from file: '+fname)
# create an empty list datalines
datalines=[]
# read lines from the data file into ... | 4 | 4 |
setup.py | ovod88/studentsdb | 0 | 31287 | from setuptools import find_packages, setup
setup(
name='django-studentsdb-app',
version='1.0',
author=u'<NAME>',
author_email='<EMAIL>',
packages=find_packages(),
license='BSD licence, see LICENCE.txt',
description='Students DB application',
long_description=open('README.txt').read(),
... | 1.078125 | 1 |
nlpproject/main/Node.py | Hrishi2312/IR-reimagined | 0 | 31288 | <filename>nlpproject/main/Node.py
from .words import *
class Node:
def __init__(self ,docId, freq = None):
self.freq = freq
self.doc = docId
self.nextval = None
class SlinkedList:
def __init__(self ,head = None):
self.head = head
linked_list_data = {}
for word in unique_words_... | 2.890625 | 3 |
_open_source/examples/state_space_explain.py | daviddewhurst/daviddewhurst.github.io | 0 | 31289 | #!/usr/bin/env python
import pathlib
import matplotlib.pyplot as plt
import torch
import pyro
from state_space import state_space_model
SEED = 123
torch.manual_seed(SEED)
pyro.set_rng_seed(SEED)
def main():
figdir = pathlib.Path('./figures')
figdir.mkdir(exist_ok=True)
# demo predictive capacity
... | 2.125 | 2 |
modred/tests/testera.py | shubhamKGIT/modred | 0 | 31290 | #!/usr/bin/env python
"""Test era module"""
import unittest
import os
from os.path import join
from shutil import rmtree
import numpy as np
from modred import era, parallel, util
from modred.py2to3 import range
def make_time_steps(num_steps, interval):
"""Helper function to find array of integer time steps.
... | 2.75 | 3 |
tests/resources/ok/ok.py | lleites/topyn | 10 | 31291 | <reponame>lleites/topyn
def my_function() -> str:
return "todo bien"
| 1.523438 | 2 |
copycat01.py | OneOfaKindGeek/mycode | 0 | 31292 | #!/usr/bin/env python3
# import additional code to complete our task
import shutil
import os
# move into the working directory
os.chdir("/home/student/mycode/")
# copy the fileA to fileB
shutil.copy("5g_research/sdn_network.txt", "5g_research/sdn_network.txt.copy")
# copy the entire directoryA to directoryB
shutil.... | 2.765625 | 3 |
Scripts-python/addRulesIptables.py | Brotic66/Script-Python | 0 | 31293 | # coding=utf-8
'''
Ce fichier contient un script permettant de lier une application web en, PHP 5.6 avec Symfony et doctrine, avec l'administration d'un serveur et nottament de son pare-feu (iptables)
Permet d'ouvrir des ports pour des adresses IPs récupérer en base de données et ajouté via l'application web.
'''
__au... | 2.375 | 2 |
src/vardb/deposit/annotation_config.py | Dabble-of-DevOps-Bio/ella | 0 | 31294 | from typing import Any, List, Mapping, Sequence
import jsonschema
from dataclasses import dataclass, field
from sqlalchemy.orm import scoped_session
from vardb.datamodel.jsonschemas.load_schema import load_schema
from vardb.datamodel import annotation
@dataclass
class ConverterConfig:
elements: Sequence[Mapping[s... | 2.3125 | 2 |
yolov5/temp.py | shuyansy/A-detection-and-recognition-pipeline-of-complex-meters-in-wild | 17 | 31295 | <gh_stars>10-100
import os
import cv2
import numpy as np
from utils.augmentations import Albumentations, augment_hsv, copy_paste, letterbox
from models.common import DetectMultiBackend
from utils.datasets import IMG_FORMATS, VID_FORMATS, LoadImages, LoadStreams
from utils.general import (LOGGER, check_file, check_img_s... | 1.835938 | 2 |
Devashish/PythonScriptExecution/PythonScriptExecution/PyScript.py | ishmeet1995/AutomationHour | 0 | 31296 | #!/usr/bin/env python
# coding: utf-8
import pandas as pd
def get_age(name):
df = pd.read_excel("test.xlsx", sheet_name="Sheet1", headers=True)
print("*"*20)
print(df)
print("*"*20)
rows, cols = df[df['Name']==name].shape
print(rows, cols, "^^^")
if rows==1:
age = df[df['Name... | 3.640625 | 4 |
ros/src/tl_detector/light_classification/tl_classifier.py | AaronLPS/CarND-Capstone | 0 | 31297 | import tensorflow as tf
import numpy as np
import cv2
import os
import rospy
from timeit import default_timer as timer
from styx_msgs.msg import TrafficLight
CLASS_TRAFFIC_LIGHT = 10
MODEL_DIR = 'light_classification/models/'
IMG_DIR = 'light_classification/img/'
DEBUG_DIR = 'light_classification/result/'
class TL... | 2.484375 | 2 |
src/lib/training/scene_sampler.py | pfnet-research/kaggle-lyft-motion-prediction-4th-place-solution | 44 | 31298 | <reponame>pfnet-research/kaggle-lyft-motion-prediction-4th-place-solution
import math
import torch
from torch.utils.data import Sampler
import torch.distributed as dist
import numpy as np
def get_valid_starts_and_ends(get_frame_arguments: np.ndarray, min_state_index: int = 0):
get_frame_arguments = get_frame_arg... | 1.984375 | 2 |
aiovault/client.py | johnnoone/aiovault | 1 | 31299 | from . import v1
from .request import Request
from .util import task, extract_id
class Vault(v1.SysEndpoint):
def __init__(self, addr, token=None, cert=None, verify=True):
token = extract_id(token)
self.req_handler = Request(addr, 'v1', token=token,
cert=cert, v... | 2.1875 | 2 |