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 |
|---|---|---|---|---|---|---|
machine/exceptions/machine.py | kraglik/machine | 0 | 12776551 | <gh_stars>0
from abc import ABC
class MachineError(Exception, ABC):
message = "Abstract error"
status_code = 500
def __init__(self) -> None:
super().__init__(self.message)
def __str__(self) -> str:
return self.message
class MachineSuspiciousOperationError(MachineError):
message... | 2.765625 | 3 |
SemiSupervisedLearning/Autoencoder.py | martahal/DeepLearning | 0 | 12776552 | #from Encoder import Encoder
#from Decoder import Decoder
#from Trainer import Trainer
#from Dataloader import load_fashion_mnist
from torch import nn
class Autoencoder(nn.Module):
def __init__(self,
encoder,
decoder,
reconstructed_image_shape):
super()... | 2.71875 | 3 |
brml/multpots.py | herupraptono/pybrml | 136 | 12776553 | <reponame>herupraptono/pybrml
#!/usr/bin/env python
"""
MULTPOTS Multiply potentials into a single potential
newpot = multpots(pots)
multiply potentials : pots is a cell of potentials
potentials with empty tables are ignored
if a table of type 'zero' is encountered, the result is a table of type
'zero' with table 0, ... | 2.859375 | 3 |
solrSource.py | o19s/solr_dump | 6 | 12776554 | import pysolr
class InvalidPagingConfigError(RuntimeError):
def __init__(self, message):
super(RuntimeError, self).__init__(message)
class _SolrCursorIter:
""" Cursor-based iteration, most performant. Requires a sort on id somewhere
in required "sort" argument.
This is recommended ap... | 2.765625 | 3 |
2015/day17/day17.py | e-jameson/aoc | 0 | 12776555 | import sys
from itertools import combinations
from helpers import as_list_ints
containers = as_list_ints('2015/day17/input.txt')
# containers = as_list_ints('2015/day17/example-input.txt')
total = 150
count = 0
min_containers = sys.maxsize
min_count = 0
for i in range(len(containers)):
for c in combinations(cont... | 3.09375 | 3 |
development/db_setup/process_frames.py | ocean-data-factory-sweden/koster_lab_development | 0 | 12776556 | import os, io, csv, json
import requests, argparse
import pandas as pd
import numpy as np
from ast import literal_eval
from datetime import datetime
from panoptes_client import Project, Panoptes
from collections import OrderedDict, Counter
from sklearn.cluster import DBSCAN
import kso_utils.db_utils as db_utils
from ks... | 2.171875 | 2 |
Python/budget_app/budget.py | nehera/tutorials | 0 | 12776557 | class Category:
def __init__(self, name):
self.name = name
self.ledger = []
def __str__(self):
l = len(self.name)
n1 = 15-int(l/2)
n2 = 30-(n1+l)
title = "*"*n1+self.name+"*"*n2+"\n"
summary = ""
for item in self.ledger:
a= format(item[... | 3.203125 | 3 |
configs/deepim/lmPbrSO/FlowNet512_1.5AugCosyAAEGray_AggressiveV2_Flat_lmPbr_SO/cfg_1_to_all.py | THU-DA-6D-Pose-Group/self6dpp | 33 | 12776558 | <filename>configs/deepim/lmPbrSO/FlowNet512_1.5AugCosyAAEGray_AggressiveV2_Flat_lmPbr_SO/cfg_1_to_all.py
from mmcv import Config
import os.path as osp
import os
from tqdm import tqdm
cur_dir = osp.normpath(osp.dirname(osp.abspath(__file__)))
base_cfg_name = "FlowNet512_1.5AugCosyAAEGray_AggressiveV2_Flat_Pbr_01_ape.p... | 2.109375 | 2 |
blog/signals.py | Vicky-Rathod/django-blog | 0 | 12776559 | <reponame>Vicky-Rathod/django-blog<gh_stars>0
from django.db.models.signals import post_save, pre_save
from django.dispatch import receiver
from .models import Post
from .utils import random_string_generator
@receiver(post_save, sender=Post)
def create_user_profile(sender, instance, created, **kwargs):
if not inst... | 2.359375 | 2 |
tests/meh.py | awlange/brainsparks | 3 | 12776560 | """
Script entry point
"""
from src.sandbox.network import Network
from src.sandbox.dense import Dense
import src.sandbox.linalg as linalg
import numpy as np
import time
def main():
n = 6000
v = [x for x in range(n)]
m = [[x for x in range(n)] for _ in range(n)]
time_start = time.time()
for _... | 2.671875 | 3 |
scripts/light_server.py | jing-vision/lightnet | 83 | 12776561 | '''
pip install flask gevent requests pillow
https://github.com/jrosebr1/simple-keras-rest-api
https://gist.github.com/kylehounslow/767fb72fde2ebdd010a0bf4242371594
'''
''' Usage
python ..\scripts\classifier.py --socket=5000 --weights=weights\obj_last.weights
curl -X POST -F image=@dog.png http://localho... | 2.15625 | 2 |
tests/test_manage.py | rosshamish/classtime-implementation | 1 | 12776562 | <filename>tests/test_manage.py
from __future__ import absolute_import
import unittest
import manage
class Arguments(object): # pylint: disable=R0903
def __init__(self, command, term, startfrom):
self.command = command
self.term = term
self.startfrom = startfrom
class TestManageDatabase(... | 2.515625 | 3 |
Chapter06/Ch6/demo/indexing.py | henrryyanez/Tkinter-GUI-Programming-by-Example | 127 | 12776563 | import tkinter as tk
win = tk.Tk()
current_index = tk.StringVar()
text = tk.Text(win, bg="white", fg="black")
lab = tk.Label(win, textvar=current_index)
def update_index(event=None):
cursor_position = text.index(tk.INSERT)
cursor_position_pieces = str(cursor_position).split('.')
cursor_line = cursor_pos... | 3.65625 | 4 |
MobileRevelator/python/android_quizkampen.py | ohunecker/MR | 98 | 12776564 | #Pluginname="Quizkampen (Android)"
#Filename="quizkampen"
#Type=App
import struct
import xml.etree.ElementTree
import tempfile
def convertdata(db):
#ctx.gui_clearData()
ctx.gui_setMainLabel("Quizkampen: Extracting userid");
tmpdir = tempfile.mkdtemp()
outuid = os.path.join(tmpdir, "userid"... | 2.40625 | 2 |
groups/bal/baljsn/generate_baljsn_encoder_testtypes.py | eddiepierce/bde | 1 | 12776565 | #!/opt/bb/bin/python3.7
"""This module defines a program that generates the 'baljsn_encoder_testtypes'
component and replace all uses of 'bdes' with 'bsls' within its files.
"""
from asyncio import create_subprocess_exec as aio_create_subprocess_exec
from asyncio import run as aio_run
from asyncio import subprocess as... | 2.265625 | 2 |
ownblock/ownblock/apps/amenities/serializers.py | danjac/ownblock | 3 | 12776566 | from django.db.models.query import Q
from django.utils import timezone
from rest_framework import serializers
from ..accounts.serializers import UserSerializer
from .models import Amenity, Booking
class AmenityRelatedField(serializers.RelatedField):
def to_native(self, value):
return {
'id... | 2.078125 | 2 |
tests/examples/web_driver_wait/web_driver_wait_test.py | bbornhau/python-opensdk | 38 | 12776567 | # Copyright 2020 TestProject (https://testproject.io)
#
# 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 ... | 2.21875 | 2 |
app/cascade/session.py | jillmnolan/cascade-server | 0 | 12776568 | # NOTICE
#
# This software was produced for the U. S. Government
# under Basic Contract No. W15P7T-13-C-A802, and is
# subject to the Rights in Noncommercial Computer Software
# and Noncommercial Computer Software Documentation
# Clause 252.227-7014 (FEB 2012)
#
# (C) 2017 The MITRE Corporation.
from __future__ import... | 1.992188 | 2 |
tests/integration/controller/test_stationelement_controller.py | faysal-ishtiaq/climsoft-api | 0 | 12776569 | <filename>tests/integration/controller/test_stationelement_controller.py
from datetime import datetime
import json
import pytest
from sqlalchemy.orm.session import Session
from opencdms.models.climsoft import v4_1_1_core as climsoft_models
from climsoft_api.api.stationelement import schema as stationelement_schema
from... | 2.21875 | 2 |
py/Logical/min_number.py | antoniotorresz/python | 0 | 12776570 | <reponame>antoniotorresz/python
#Max value from a list
numbers = []
lenght = int(input("Enter list lenght...\n"))
for i in range(lenght):
numbers.append(float(input("Enter an integer or decimal number...\n")))
print("The min value is: " + str(min(numbers)))
| 4.21875 | 4 |
Crypto/Encryption.py | alouks/utilities | 0 | 12776571 | import base64
import hashlib
from Crypto import Random
from Crypto.Cipher import AES
'''
Encryption
@description For arbitrary encryption and decryption of data
@author <NAME>
Usage:
e = Encryption()
encrypted_string = e.encrypt("Encrypt me!", "password")
decrypted = e.decrypt(encrypted_str... | 3.4375 | 3 |
Lab_10/all_users_jaccard.py | Bartosz-Gorka-Archive/processing-massive-datasets | 5 | 12776572 | <gh_stars>1-10
import csv
from itertools import combinations
from heapq import heappush, heappushpop
SOURCE_FILE_NAME = 'facts3.csv'
RESULTS_FILE_NAME = 'results.txt'
NEAREST_NEIGHBOR_SIZE = 100
def sort_by_similarity(similarity_list):
return sorted(similarity_list, key=lambda record: (record[0], record[1]), rev... | 3.28125 | 3 |
judi/utils.py | johanneskoester/JUDI | 0 | 12776573 | import pandas as pd
import os
def ensure_dir(file_path):
directory = os.path.dirname(file_path)
if directory and not os.path.exists(directory):
print("Creating new directory", directory)
os.makedirs(directory)
import json
def get_cfg_str(x):
# json.dumps(r.to_dict(), sort_keys=True, separators = (',', ... | 2.671875 | 3 |
patch_manager_sdk/api/patch_task/create_task_pb2.py | easyopsapis/easyops-api-python | 5 | 12776574 | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: create_task.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf... | 1.171875 | 1 |
stamps/includes/W_hotbox/Rules/Stamps/001.py | adrianpueyo/stamps | 18 | 12776575 | <filename>stamps/includes/W_hotbox/Rules/Stamps/001.py
#----------------------------------------------------------------------------------------------------------
#
# AUTOMATICALLY GENERATED FILE TO BE USED BY W_HOTBOX
#
# NAME: Reconnect by Title
# COLOR: #6b4930
#
#----------------------------------------------------... | 2.28125 | 2 |
federation/utils/text.py | hoseinfzad/federation | 0 | 12776576 | <gh_stars>0
import re
from urllib.parse import urlparse
def decode_if_bytes(text):
try:
return text.decode("utf-8")
except AttributeError:
return text
def encode_if_text(text):
try:
return bytes(text, encoding="utf-8")
except TypeError:
return text
def get_path_from... | 3 | 3 |
venv/lib/python2.7/site-packages/image/views.py | deandunbar/html2bwml | 0 | 12776577 | <filename>venv/lib/python2.7/site-packages/image/views.py<gh_stars>0
# -*- coding: UTF-8 -*-
from django.core.files.base import ContentFile
from encodings.base64_codec import base64_decode
import os
import urllib
import traceback
from django.http import HttpResponse, QueryDict
from django.http.response import Http404
... | 2.21875 | 2 |
bin/tower_api.py | coreywan/splunk-alert_ansible-tower | 0 | 12776578 | #!/usr/bin/python
import sys, json, os, datetime
import logging, logging.handlers
import splunk.entity as entity
import splunk
import requests
# Tower Connect
#
# This script is used as wrapper to connect to Ansible Tower API.
## Original from:
# __author__ = "<NAME>"
# __email__ = "<EMAIL>"
# __version__ = "1.0"
#... | 2.3125 | 2 |
optimus/data/__init__.py | IanTayler/tao-exercises | 3 | 12776579 | """Module for manipulation of physical data. Mostly conveniences for reading and writing files."""
| 1.1875 | 1 |
models.py | magicwenli/db-generater | 0 | 12776580 | import os
from dotenv import load_dotenv
from sqlalchemy import create_engine, Column, String, Date, Numeric, ForeignKey
from sqlalchemy.ext.declarative import declarative_base
load_dotenv(verbose=True)
db_link = os.getenv("DB_LINK")
db = create_engine(db_link)
base = declarative_base()
class JS020(base):
__ta... | 2.4375 | 2 |
tests/test_cloudfoundryutil.py | jan-randis/php-db2-mysql-buildpack | 0 | 12776581 | <reponame>jan-randis/php-db2-mysql-buildpack
from nose.tools import eq_
from build_pack_utils.cloudfoundry import CloudFoundryUtil
from build_pack_utils import utils
import tempfile
import shutil
import os
def buildpack_directory():
directory = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')
ret... | 2.28125 | 2 |
LotteryResult.py | emmmmmmmmmmmmmmmmm/bilibili-live-tools | 1 | 12776582 | from bilibili import bilibili
import requests
import asyncio
import time
class LotteryResult(bilibili):
async def query(self):
while 1:
print(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())), "检查抽奖结果")
# print(self.activity_raffleid_list)
if s... | 2.609375 | 3 |
python/234_Palindrome_Linked_List.py | dvlpsh/leetcode-1 | 4,416 | 12776583 | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
# def __init__(self):
# self.curr_head = None
#
# def isPalindrome(self, head):
# """
# :type head: ListNode
# ... | 3.9375 | 4 |
pymcdyes.py | pudquick/pyMCdyes | 5 | 12776584 | <gh_stars>1-10
import zipfile, sys, os.path, exceptions, time
from collections import namedtuple
from itertools import imap
col = namedtuple('col', 'r g b')
color_map, base_colors, base_mods = None, None, None
try:
from itertools import combinations_with_replacement
except:
# Replacement recipe for python 2.6
... | 2.546875 | 3 |
lib/telegram/message.py | yosit/kinnernet_bot | 0 | 12776585 | #!/usr/bin/env python
from telegram import TelegramObject
class Message(TelegramObject):
def __init__(self,
message_id,
from_user,
date,
chat,
forward_from=None,
forward_date=None,
... | 2.734375 | 3 |
cyanobyte/validator.py | isabella232/cyanobyte | 70 | 12776586 | <filename>cyanobyte/validator.py
"""CyanoByte Validator
The CyanoByte validator is used to ensure that a CyanoByte
document meets the specification.
"""
import sys
import json
import click
import os
import os.path as path
import yaml
from yaml.constructor import ConstructorError
try:
from yaml import CLoader as L... | 3.078125 | 3 |
src/nn_job_processor.py | jsphweid/annhouga | 1 | 12776587 | <reponame>jsphweid/annhouga<filename>src/nn_job_processor.py
import boto3, json
from nn_processors import basic_nn_processor
sqs = boto3.resource('sqs')
nn_job_queue = sqs.get_queue_by_name(QueueName='annhouga-nn-jobs')
rds_job_queue = sqs.get_queue_by_name(QueueName='annhouga-rds-jobs')
while 1:
print('[*] Waiti... | 2.25 | 2 |
setup.py | steveharwell1/linearGraph-flask | 0 | 12776588 | from setuptools import setup
setup(
name='graphs',
packages=['graphs'],
include_package_data=True,
install_requires=[
'flask',
'matplotlib',
]
) | 1.078125 | 1 |
idpy/LBM/SCThermo.py | lullimat/idea.deploy | 1 | 12776589 | __author__ = "<NAME>"
__copyright__ = "Copyright (c) 2020 <NAME> (lullimat/idea.deploy), <EMAIL>"
__credits__ = ["<NAME>"]
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without ... | 1.460938 | 1 |
app/main/views.py | Kadas36/NEWS-App | 0 | 12776590 | from flask import render_template,request,redirect,url_for
from . import main
from ..requests import get_news, get_articles
from ..models import Source, Article
# Views
@main.route('/')
def index():
'''
Function that returns the index page and its data
'''
general_list = get_news('general')
health... | 2.640625 | 3 |
src/units/__init__.py | sunoru/units | 1 | 12776591 | # -*- coding:utf-8 -*-
# filename: units/__init__.py
# by スノル
__version__ = "0.2.0"
__all__ = []
| 0.945313 | 1 |
inst/python/rpytools/help.py | flyaflya/reticulate | 1,476 | 12776592 |
import sys
import types
import inspect
def isstring(s):
# if we use Python 3
if (sys.version_info[0] >= 3):
return isinstance(s, str)
# we use Python 2
return isinstance(s, basestring)
def normalize_func(func):
# return None for builtins
if (inspect.isbuiltin(func)):
return N... | 2.65625 | 3 |
day2-4.py | Par1Na/Twowaits | 2 | 12776593 | # Twowaits
Twowaits Problem
def upPattern(n):
for i in range(n):
for j in range(i,n):
print('* ',end='')
for m in range(0,4*i+1):
print(end=' ')
for p in range(i,n):
print('* ',end='')
print('\r')
def lowPattern(n):
s=4*n-3
for i in range(... | 3.375 | 3 |
bibliopixel/commands/devices.py | rec/leds | 253 | 12776594 | <reponame>rec/leds
"""
Find serial devices and update serial device IDs
"""
from .. util import log
CONNECT_MESSAGE = """
Connect just one Serial device (AllPixel) and press enter..."""
def run(args):
from ..drivers.serial.driver import Serial
from ..drivers.serial.devices import Devices
import serial
... | 3.0625 | 3 |
ufit/models/peaks.py | McStasMcXtrace/ufit | 0 | 12776595 | # -*- coding: utf-8 -*-
# *****************************************************************************
# ufit, a universal scattering fitting suite
#
# Copyright (c) 2013-2019, <NAME> and contributors. All rights reserved.
# Licensed under a 2-clause BSD license, see LICENSE.
# **************************************... | 2.25 | 2 |
tanker/cli.py | bertrandchenal/tanker | 1 | 12776596 | <filename>tanker/cli.py
import argparse
import csv
import os
import sys
from .utils import logger, __version__, yaml_load, ctx
from .context import connect, create_tables
from .view import View
from .table import Table
def cli():
parser = argparse.ArgumentParser(description='Tanker CLI')
parser.add_argument(... | 2.59375 | 3 |
dataikuapi/dss/admin.py | dataiku/dataiku-api-client-python | 28 | 12776597 | <reponame>dataiku/dataiku-api-client-python
from .future import DSSFuture
import json, warnings
class DSSConnectionInfo(dict):
"""A class holding read-only information about a connection.
This class should not be created directly. Instead, use :meth:`DSSConnection.get_info`
The main use case of this class... | 2.96875 | 3 |
app/myCarApp/migrations/0007_auto_20200312_1505.py | irokas/myCarApp | 0 | 12776598 | # Generated by Django 2.1 on 2020-03-12 15:05
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('myCarApp', '0006_auto_20200312_1502'),
]
operations = [
migrations.RemoveField(
model_name='user',
name='groups',
),
... | 1.617188 | 2 |
computations/plot_teacher_action.py | matthiasgruber/supervisor | 3 | 12776599 | import numpy as np
from skopt.space import Space
from skopt.sampler import Grid
import matplotlib.pyplot as plt
import seaborn as sns
def plot_teacher_action():
space = Space([(-1., 1.), (-1., 1.)])
grid = Grid(border="include", use_full_layout=False)
action_manipulated = grid.generate(space.dimensions, 1... | 2.28125 | 2 |
src/adversaries/momentum_fgsm_transfer.py | googleinterns/out-of-distribution | 0 | 12776600 | import json
import os
import torch
from torch import nn
from root import from_root
from src.adversaries.adversary import Adversary, AdversaryOutput
from src.experiments.config import create_resnet
from src.misc.collection_object import DictObject
from src.misc.utils import model_device
class MomentumFgsmTransfer(Ad... | 2.234375 | 2 |
core/BuildRelationModel.py | jakelever/VERSE | 14 | 12776601 | import sys
import fileinput
import argparse
import time
import itertools
import pickle
import random
import codecs
from collections import defaultdict
from sklearn import svm
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction import DictVectorizer
from scipy.sparse import coo_ma... | 2.390625 | 2 |
myclass/class_mysql_backup_to_zip_files.py | ysh329/mysql-backup | 0 | 12776602 | # -*- coding: utf-8 -*-
# !/usr/bin/python
################################### PART0 DESCRIPTION #################################
# Filename: class_mysql_backup_to_zip_files.py
# Description:
# Author: <NAME>
# E-mail: <EMAIL>
# Create: 2015-9-24 17:50:39
# Last:
__author__ = 'yuens'
#################################... | 2.84375 | 3 |
Exercicios/ex045.py | MateusBarboza99/Python-03- | 0 | 12776603 | from random import randint
from time import sleep
itens = ('Pedra', 'Papel','Tesoura')
computador = randint(0, 2)
print('''\033[1;31mSuas opções\033[m:
[ 0 ] PEDRA
[ 1 ] PAPEL
[ 2 ] TESOURA''')
jogador = int(input('\033[1;34mQual é a sua Jogada?\033[m '))
print('\033[1;30mJO\033[m')
sleep(1)
print('\033[1;34mKEN\033[m'... | 3.5 | 4 |
setup.py | TylerTemp/docpie | 18 | 12776604 | # from distutils.core import setup
from setuptools import setup
import os
from docpie import __version__
setup(
name="docpie",
packages=["docpie"],
package_data={
'': [
'README.rst',
'LICENSE',
'CHANGELOG.md'
],
'docpie': [
'example/*... | 1.429688 | 1 |
venv/Lib/site-packages/PIL/_version.py | deerajnagothu/pyenf_extraction | 6 | 12776605 | # Master version for Pillow
__version__ = '5.3.0'
| 1.0625 | 1 |
custom_components/reef_pi/sensor.py | tdragon/reef-pi-hass-custom | 3 | 12776606 | <gh_stars>1-10
"""Platform for reef-pi sensor integration."""
from homeassistant.const import (
TEMP_CELSIUS,
TEMP_FAHRENHEIT,
DEGREE)
from homeassistant.components.sensor import SensorDeviceClass, SensorStateClass
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from homeassistant.c... | 2.03125 | 2 |
generated-libraries/python/netapp/sis/sis_chkpoint_op_type.py | radekg/netapp-ontap-lib-get | 2 | 12776607 | <filename>generated-libraries/python/netapp/sis/sis_chkpoint_op_type.py
class SisChkpointOpType(basestring):
"""
Checkpoint type
Possible values:
<ul>
<li> "scan" - Scanning volume for fingerprints,
<li> "start" - Starting a storage efficiency
operation,
<li> "check" ... | 1.898438 | 2 |
octotribble/Convolution/Test_convolution_between_different_resolutions.py | jason-neal/equanimous-octo-tribble | 1 | 12776608 | # Test convolving to different resolutions
# Test the effect of convolving straight to 20000 and convolving first to an intermediate resolution say 80000.
import matplotlib.pyplot as plt
import numpy as np
from IP_multi_Convolution import ip_convolution, unitary_Gauss
def main():
# fwhm = lambda/R
fwhm = 2... | 2.71875 | 3 |
keras/train.py | TheWh1teRose/AI-Robot-for-industrial-automation | 0 | 12776609 | <reponame>TheWh1teRose/AI-Robot-for-industrial-automation
import numpy as np
import tensorflow as tf
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import normalize
import glob
import CNN_utils as cnn
import pickle
import time
import datetime
import functools
import VGG_modells
import k... | 2.5 | 2 |
api/v1/views/index.py | ricarhincapie/Torre_Dev | 0 | 12776610 | #!/usr/bin/env python3
""" Module to define API routes
"""
from api.v1.views import app_views
from flask import jsonify, request, abort, make_response
from engine.score_engine import score_engine
import requests
@app_views.route('/status', methods=['GET'], strict_slashes=False)
def status():
""" Status of API """... | 2.953125 | 3 |
tests/models/test_trading_account.py | ppawel/tastyworks_api | 6 | 12776611 | <filename>tests/models/test_trading_account.py
import datetime
import unittest
from decimal import Decimal
from tastyworks.models import option, order, underlying, trading_account
class TestTradingAccount(unittest.TestCase):
def setUp(self):
self.order_details = order.OrderDetails(
type=order... | 2.484375 | 2 |
lib/models/RefineNet.py | TheRevanchist/DeepWatershedDetection | 0 | 12776612 | <gh_stars>0
import tensorflow as tf
from tensorflow.contrib import slim
import models.resnet_v1 as resnet_v1
import os, sys
def Upsampling(inputs,scale):
return tf.image.resize_bilinear(inputs, size=[tf.shape(inputs)[1]*scale, tf.shape(inputs)[2]*scale])
def ConvBlock(inputs, n_filters, kernel_size=[3, 3]):
... | 2.765625 | 3 |
labelme_tools/create_text_sample.py | dikers/ocr-train-data-generator | 0 | 12776613 |
import random
import time
random.seed(time.time())
def create_zero(count):
char_list = '0Oo***.\、.----。、~!O@0o/L#$%0/LOg/Lo^./L**&00.00*()0。g/L、、--/L---+|/0Oo[]#%$¥0~-/L--!/L@#oo*~~~¥0O%&*OO。[]0Oog/L'
lines = ''
for i in range(count):
# print("{} random {}".format(i, random.randint(3, 10)))
... | 3.453125 | 3 |
ospath/ospath_abspath.py | dineshkumar2509/learning-python | 86 | 12776614 | #!/usr/bin/env python
# encoding: utf-8
"""Compute an absolute path from a relative path.
"""
import os.path
for path in ['.', '..', './one/two/three', '../one/two/three']:
print '"%s" : "%s"' % (path, os.path.abspath(path))
| 2.796875 | 3 |
ch10/recipe2/recognize_action_tfhub.py | ArjunVarma39/Tensorflow-2.0-Computer-Vision-Cookbook | 1 | 12776615 | import os
import random
import re
import ssl
import tempfile
from urllib import request
import cv2
import imageio
import numpy as np
import tensorflow as tf
import tensorflow_hub as tfhub
UCF_ROOT = 'https://www.crcv.ucf.edu/THUMOS14/UCF101/UCF101/'
KINETICS_URL = ('https://raw.githubusercontent.com/deepmind/'
... | 2.390625 | 2 |
cracking-the-code-interview/trees/02-minimal-tree.py | vtemian/interviews-prep | 8 | 12776616 | from typing import List
class BST:
def __init__(self, val: int, left: 'BST', right: 'BST'):
self.val = val
self.left = left
self.right = right
def __str__(self) -> str:
if not self.val:
return ""
return " {} {} {} ".format(self.left, self.val, self.right)
... | 3.765625 | 4 |
scripts/parse_results2.py | pfritzgerald/nusassifi | 2 | 12776617 | <reponame>pfritzgerald/nusassifi<filename>scripts/parse_results2.py<gh_stars>1-10
###################################################################################
# Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are... | 1.28125 | 1 |
htm_rl/htm_rl/envs/biogwlab/wrappers/entity_map_provider.py | cog-isa/htm-rl | 1 | 12776618 | <reponame>cog-isa/htm-rl
import numpy as np
from htm_rl.envs.biogwlab.environment import Environment
from htm_rl.envs.biogwlab.module import EntityType
from htm_rl.envs.env import Wrapper
class EntityMapProvider(Wrapper):
root_env: Environment
entities: dict[EntityType, np.array]
def __init__(self, ent... | 2.15625 | 2 |
tests/multipart_test.py | SanthoshBala18/filestack-python | 0 | 12776619 | import io
import json
from collections import defaultdict
from unittest.mock import patch
import responses
from httmock import HTTMock, response, urlmatch
from tests.helpers import DummyHttpResponse
from filestack import Client
from filestack.config import MULTIPART_START_URL
from filestack.uploads.multipart import u... | 2.375 | 2 |
rocksmith/sng.py | 0x0L/rocksmith | 25 | 12776620 | from construct import (
Float32l,
Float64l,
If,
Int8sl,
Int16sl,
Int16ul,
Int32sl,
Int32ul,
PaddedString,
Padding,
PrefixedArray,
Struct,
len_,
this,
)
def array(subcon):
return PrefixedArray(Int32ul, subcon)
Bend = Struct("time" / Float32l, "step" / Float... | 2.265625 | 2 |
azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/identify_candidate_py3.py | JonathanGailliez/azure-sdk-for-python | 1 | 12776621 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 2.328125 | 2 |
chapter13/asyncgmaps.py | lixin940207/expert_python_programming | 189 | 12776622 | <reponame>lixin940207/expert_python_programming<gh_stars>100-1000
# -*- coding: utf-8 -*-
import aiohttp
session = aiohttp.ClientSession()
async def geocode(place):
params = {
'sensor': 'false',
'address': place
}
async with session.get(
'https://maps.googleapis.com/maps/api/geoco... | 2.609375 | 3 |
AC_TD3_code/utils/__init__.py | Jiang-HB/AC_CDQ | 7 | 12776623 | from .attr_dict import AttrDict
from .commons import *
from .options import opts
from .recorder import Recoder
from .replay_buffer import ReplayBuffer
from .eval_policy import eval_policy
from .run import run | 0.957031 | 1 |
03_join.py | Madhav2204/Python-vs-code | 0 | 12776624 | <filename>03_join.py
l = ["Camera", "Laptop", "Phone", "ipad", "Hard Disk", "Nvidia Graphic 3080 card"]
# sentence = "~~".join(l)
# sentence = "==".join(l)
sentence = "\n".join(l)
print(sentence)
print(type(sentence)) | 2.53125 | 3 |
enqueuer_thread.py | shriya999/MultiStage-ActionDetection | 0 | 12776625 | # coding=utf-8
"""Given the dataset object, make a multithread enqueuer"""
import os
import queue
import threading
import contextlib
import multiprocessing
import time
import random
import sys
import utils
import traceback
import cv2
# modified from keras
class DatasetEnqueuer(object):
def __init__(
self,
... | 3.0625 | 3 |
tests/unit/test_events.py | ChristChurchMayfair/ccm-assistant | 0 | 12776626 | import unittest
import events
from tests.testing_utils import is_valid_response, ValidResponseObjectTester
class TestEvents(unittest.TestCase):
def test_on_launch(self):
response = events.on_launch()
self.assertTrue(is_valid_response(response))
response_tester = ValidResponseObjectTester(... | 3.03125 | 3 |
run.py | LauryneL/Pipographe-v2 | 1 | 12776627 | <reponame>LauryneL/Pipographe-v2<filename>run.py
from app.app import config_app
if __name__ == "__main__":
app = config_app()
app.run(debug=True)
| 1.320313 | 1 |
passenger_wsgi.py | fraigo/python-cors-proxy | 0 | 12776628 | import imp
import os
import sys
from corsproxy.wsgi import application
sys.path.insert(0, os.path.dirname(__file__))
# wsgi = imp.load_source('wsgi', 'passenger_wsgi.py')
# application = wsgi.application
| 1.601563 | 2 |
t10/A10httprest/ta.py | THS-on/AttestationEngine | 7 | 12776629 | <gh_stars>1-10
# Copyright 2021 Nokia
# Licensed under the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
from flask import Flask, request, jsonify
from endpoints.tpm2.tpm2_endpoint import tpm2_endpoint
from endpoints.uefi.uefi_endpoint import uefi_endpoint
import sys
import os
VERSION = "0.3"
ta =... | 2.078125 | 2 |
LeetCode/234 Palindrome Linked List.py | gesuwen/Algorithms | 0 | 12776630 | # Linked List, Two Pointers
# Given a singly linked list, determine if it is a palindrome.
#
# Example 1:
#
# Input: 1->2
# Output: false
# Example 2:
#
# Input: 1->2->2->1
# Output: true
# Follow up:
# Could you do it in O(n) time and O(1) space?
# Definition for singly-linked list.
# class ListNode(object):
# d... | 4.125 | 4 |
3.7.0/lldb-3.7.0.src/test/functionalities/inline-stepping/TestInlineStepping.py | androm3da/clang_sles | 3 | 12776631 | <gh_stars>1-10
"""Test stepping over and into inlined functions."""
import os, time, sys
import unittest2
import lldb
import lldbutil
from lldbtest import *
class TestInlineStepping(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipUnlessDarwin
@python_api_test
@dsym_test
def test_with_ds... | 2 | 2 |
src/shootadoc/cli.py | akaihola/shootadoc | 0 | 12776632 | #!/usr/bin/env python
from dataclasses import dataclass
from math import log2
from typing import Callable, Optional, Tuple, Union
import click
import PIL.Image
import PIL.ImageMath
from PIL.Image import Image
from PIL.ImageChops import darker, lighter
def _normalize_offset(offset: int, size: int) -> int:
return... | 2.5625 | 3 |
server_dev/example_app/schemes/__init__.py | elishakrasz1/effort | 0 | 12776633 | from .user import UserCreateMutation, UserUpdateMutation
| 1.109375 | 1 |
lib/schemas.py | xjdrlabs/rcs_demo_code | 0 | 12776634 | <filename>lib/schemas.py
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 1.929688 | 2 |
queens_puzzle/database/__init__.py | mauricio-chavez/queens_puzzle_solver | 0 | 12776635 | <filename>queens_puzzle/database/__init__.py
"""Project database manager"""
from .sessions import _SessionFactory, Base, engine
from .models import Solution, SolutionQuery
def session_factory():
"""Retrives sessions"""
Base.metadata.create_all(engine)
return _SessionFactory()
def create_solution(n, sol... | 2.5625 | 3 |
example/tasks/__init__.py | FranciscoCarbonell/flask-task | 0 | 12776636 | from flask_task import Task
from models import *
import time
task = Task()
print(task)
@task.decorator
def proceso():
users = Users.query.all()
print(users)
time.sleep(7) | 2.25 | 2 |
jaseci_serv/jaseci_serv/jac_api/tests/test_jac_admin_api.py | seed4600/jaseci | 0 | 12776637 | <reponame>seed4600/jaseci<filename>jaseci_serv/jaseci_serv/jac_api/tests/test_jac_admin_api.py
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework.test import APIClient
from rest_framework import status
from jaseci.utils.utils import TestCaseHelper
from django.test impor... | 2.296875 | 2 |
websocks/rule.py | abersheeran/websocks | 91 | 12776638 | <filename>websocks/rule.py<gh_stars>10-100
import os
import base64
import typing
import logging
from urllib import request
from .utils import Singleton
root = os.path.dirname(os.path.abspath(__file__))
if not os.path.exists(root):
os.makedirs(root)
gfwlist_path = os.path.join(root, "gfwlist.txt")
whitelist_path... | 2.421875 | 2 |
CalibrateTransfer/data_preprocess.py | IMBINGO95/FairMOT | 0 | 12776639 | <filename>CalibrateTransfer/data_preprocess.py<gh_stars>0
import cv2
import json
import codecs
import os
import torch
import time
import shutil
import re
import argparse
# from M2Det.utils.core import print_info
from CalibrateTransfer.class_set import *
from CalibrateTransfer.img_operation import ScreenSHot
# from Co... | 2.359375 | 2 |
infobot/storage/file.py | otuk/infobot | 0 | 12776640 | <filename>infobot/storage/file.py
import os
import yaml
import infobot.konstants as K
from infobot.storage.template import Admin
from infobot.config import Admin as ConfigAdm
from infobot.brains import Brains
class FileAdminConf():
def __init__(self, fileadmindetails):
"Configurations Object for File bas... | 2.734375 | 3 |
test_fields_ip.py | kezabelle/django-strictmodels | 2 | 12776641 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from django.core.exceptions import ValidationError
from django.forms.models import model_to_dict, modelform_factory
from model_mommy.mommy import M... | 2.03125 | 2 |
database.py | dorlneylon/itfy-feed-to-chat | 7 | 12776642 | from peewee import SqliteDatabase, Model
from peewee import IntegerField, CharField, PrimaryKeyField, TimestampField
from pathlib import Path
from configparser import ConfigParser
config = ConfigParser()
config.read("config.ini", encoding="utf-8")
db = SqliteDatabase(Path.cwd() / config.get('main', 'database_... | 2.765625 | 3 |
src/utils.py | SpirinEgor/gnn_pretraining | 2 | 12776643 | from warnings import filterwarnings
PAD = "<PAD>"
UNK = "<UNK>"
MASK = "<MASK>"
BOS = "<BOS>"
EOS = "<EOS>"
def filter_warnings():
# "The dataloader does not have many workers which may be a bottleneck."
filterwarnings("ignore", category=UserWarning, module="pytorch_lightning.trainer.data_loading", lineno=10... | 2.421875 | 2 |
_cihub/auth.py | gocept/cihub | 1 | 12776644 | <filename>_cihub/auth.py
from _cihub.config import config
from starlette.authentication import AuthCredentials
from starlette.authentication import AuthenticationBackend
from starlette.authentication import AuthenticationError
from starlette.authentication import SimpleUser
from starlette.responses import PlainTextResp... | 2.328125 | 2 |
first.py | HelloEI/accountbook.py | 5 | 12776645 | #!/usr/bin/env python3
import mysql.connector
class Student(object):
def aMethod(name):
print("hello world!,my name is %s"%name)
def doubleNum(number,n):
total = 0
while n > 1:
total = ( number * number ) if total==0 else (total * number)
n = n - 1
return total
def getData():
conn = mysql.conne... | 3.546875 | 4 |
scripts/eval_obj_stats.py | albert-yue/objectnav | 15 | 12776646 | <reponame>albert-yue/objectnav
#%%
# This notebook analyzes misc episode-level statistics; i.e. reproduces Fig A.1.
import numpy as np
import pandas as pd
import os
import os.path as osp
import json
import matplotlib.pyplot as plt
import seaborn as sns
import PIL.Image
import torch
from obj_consts import get_variant_la... | 1.554688 | 2 |
merlin/spec/override.py | robinson96/merlin | 0 | 12776647 | import logging
import re
import yaml
LOG = logging.getLogger(__name__)
def error_override_vars(override_vars, spec_filepath):
"""
Warn user if any given variable name isn't found in the original spec file.
"""
if override_vars is None:
return
original_text = open(spec_filepath, "r").rea... | 3.15625 | 3 |
src/oci/oda/models/resource_type_metadata.py | pabs3/oci-python-sdk | 0 | 12776648 | # coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 2.03125 | 2 |
stinger_client.py | wisdark/pystinger | 973 | 12776649 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# @File : client.py
# @Date : 2019/8/28
# @Desc :
# @license : Copyright(C), funnywolf
# @Author: funnywolf
# @Contact : github.com/FunnyWolf
import argparse
import struct
import threading
import time
from socket import AF_INET, SOCK_STREAM
from threading import Thread
i... | 2.21875 | 2 |
project/core/renderer.py | MarkKoz/code-jam-3 | 1 | 12776650 | import pygame
import pyscroll
from project.entities.player import Player
from .constants import FONTS, SCREEN_SCALE
from .world import World
class Renderer:
def __init__(self, width: int, height: int):
self.screen: pygame.Surface = None
self.surface: pygame.Surface = None
self._set_screen... | 2.9375 | 3 |