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 |
|---|---|---|---|---|---|---|
wizard/multiple_test_request_wizard.py | IDRISSOUM/hospital_management | 0 | 12797751 | # -*- coding: utf-8 -*-
# Part of BrowseInfo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
from datetime import date,datetime
class wizard_multiple_test_request(models.TransientModel):
_name = 'wizard.multiple.test.request'
request_date = fields.Datetime(... | 2.0625 | 2 |
backend/django/KlasHelper/model.py | Ryulth/KlasHelperRemaster | 7 | 12797752 | # This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table
# Feel free ... | 1.992188 | 2 |
ms/get_citations.py | yoavram-lab/EffectiveNPI | 0 | 12797753 | <reponame>yoavram-lab/EffectiveNPI
import click
@click.command()
@click.argument('aux_filename', default='ms.aux', type=click.Path(exists=True, file_okay=True, dir_okay=False, readable=True))
@click.argument('output_filename', default='citation_keys', type=click.Path(file_okay=True, dir_okay=False, writable=True))
@cl... | 3.0625 | 3 |
utils/estimation_for_grid_Feynman_database.py | smeznar/ProGED | 5 | 12797754 | <reponame>smeznar/ProGED<filename>utils/estimation_for_grid_Feynman_database.py
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 7 11:22:45 2021
@author: jureb
"""
import numpy as np
import pandas as pd
import sys
import os
import pickle
import multiprocessing as mp
sys.path.append(os.getcwd()+"/source")
import ProGE... | 1.992188 | 2 |
tests/util/test_transform.py | xiangze/edward | 5,200 | 12797755 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import edward as ed
import numpy as np
import tensorflow as tf
from collections import namedtuple
from edward.models import (
Beta, Dirichlet, DirichletProcess, Gamma, MultivariateNormalDiag,
Normal, P... | 2.140625 | 2 |
beyond_the_basics/01.organizing_larger_programs/reader/__main__.py | tonper19/PythonDemos | 0 | 12797756 | import sys
import reader
r = reader.Reader(sys.argv[1])
try:
print(r.read())
finally:
r.close()
| 1.96875 | 2 |
commands/server/start.py | dccs-tech/mcmi-cluster | 1 | 12797757 | <reponame>dccs-tech/mcmi-cluster
from systems.commands.index import Command
class Start(Command('server.start')):
def exec(self):
def start_server(server):
self.data("Starting server", str(server))
server.start()
self.run_list(self.server_instances, start_server)
| 2.140625 | 2 |
tr/trans.py | hegistva/sync-reader | 0 | 12797758 | <gh_stars>0
from tr.books import book_manager
from tr.libs.trans import book_mapper
from tr.libs.trans import utils
from tr.libs.speech import aligner
book_id = '20000LeaguesUnderTheSea'
book_id = 'AroundTheWorldIn80Days'
# book_manager.downloadBook(book_id)
# book_mapper.mapChapter(utils.Lang.FRA, utils.Lang.ENG, b... | 2.3125 | 2 |
model/vae.py | kefirski/mnist_cdvae | 1 | 12797759 | import torch as t
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from model.encoder import Encoder
from model.decoder import Decoder
import math
class VAE(nn.Module):
def __init__(self):
super(VAE, self).__init__()
self.encoder = Encoder()
self.d... | 2.5 | 2 |
bdn/verification/tasks/listen_ethereum_ipfs_hash_storage.py | OpenSourceUniversity/bdn | 1 | 12797760 | import logging
from celery import shared_task
from bdn import contract
from bdn import redis
from .perform_ipfs_meta_verifications_array import (
perform_ipfs_meta_verifications_array)
logger = logging.getLogger(__name__)
@shared_task
def listen_ethereum_ipfs_hash_storage():
redis_db = redis.get_redis()
... | 2.1875 | 2 |
tests/test_exception.py | petertriho/prestans | 12 | 12797761 | import unittest
from prestans.http import STATUS
from prestans.http import VERB
from prestans import exception
class ExceptionBase(unittest.TestCase):
def test_http_status(self):
base_value = exception.Base(http_status=STATUS.OK, message="message")
self.assertEqual(base_value.http_status, STATUS... | 2.875 | 3 |
scraper.py | PetterDK/ps5-stock | 0 | 12797762 | <gh_stars>0
import bs4 as bs
import urllib.request
import time
import json
import mail as m
import requests as r
import os
database_ip = os.environ['database']
get_products = 'http://'+database_ip+'/get-all-products'
update_product = 'http://'+database_ip+'/update-product'
headers = {
'User-Agent': '... | 2.78125 | 3 |
day-11/python_alexlyttle/octopus.py | alan-turing-institute/advent-of-code-2021 | 12 | 12797763 | <gh_stars>10-100
import numpy as np
def load_input(file_name):
with open(file_name, 'r') as file:
return file.read()
def party_from_str(s):
lines = s.splitlines()
return np.array([[int(i) for i in line] for line in lines])
def update(party):
"""Update the party of octopuses.
There is pro... | 2.875 | 3 |
data/tools/addon_manager/__init__.py | blackberry/Wesnoth | 12 | 12797764 | # This let's python know about the addon_manager module. | 1.101563 | 1 |
oslash/state.py | stjordanis/OSlash | 668 | 12797765 | <filename>oslash/state.py
from typing import Callable, Tuple, Any, TypeVar, Generic
from .util import Unit
from .typing import Functor
from .typing import Monad
TState = TypeVar("TState")
TSource = TypeVar("TSource")
TResult = TypeVar("TResult")
class State(Generic[TSource, TState]):
"""The state monad.
Wr... | 2.75 | 3 |
flappy.py | Kimhwiwoong/Flappy_Bird_ver.2 | 0 | 12797766 | <reponame>Kimhwiwoong/Flappy_Bird_ver.2
from itertools import cycle
from operator import itemgetter
import random
import sys
import math
import pygame
from pygame.locals import *
import time
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 50, 50)
YELLOW = (255, 255, 0)
GREEN = (0, 255, 50)
BLUE = (50, 50, 255)... | 2.703125 | 3 |
touchtechnology/news/templatetags/news.py | goodtune/vitriolic | 0 | 12797767 | from django.core.paginator import Paginator
from django.template import Library
from django.utils.translation import ugettext_lazy as _
from touchtechnology.news.models import Article, Category
register = Library()
@register.filter("category")
def get_category(slug):
return Category.objects.get(slug=slug)
@reg... | 2.265625 | 2 |
src/flask_bombril/r.py | marcoprado17/flask-bone | 0 | 12797768 | <gh_stars>0
# !/usr/bin/env python
# -*- coding: utf-8 -*-
# ======================================================================================================================
# The MIT License (MIT)
# ==================================================================================================================... | 2.140625 | 2 |
gittip/__init__.py | gchiam/gittip-py | 0 | 12797769 | # -*- coding: utf-8 -*-
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.1.0'
| 1.054688 | 1 |
src/migrations/versions/da911e0e68bc_add_user_roles.py | mstrechen/advanced-news-scraper | 0 | 12797770 | <gh_stars>0
"""add_user_roles
Revision ID: <KEY>
Revises: 8f176326a337
Create Date: 2020-08-09 23:00:56.671372
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '8f176326a337'
branch_labels = None
depends_on = None
ROLES = ['admin', 'user... | 1.171875 | 1 |
tests/integrationtests/mock_data.py | efre-lod/efre-lod-api | 4 | 12797771 | <filename>tests/integrationtests/mock_data.py
import os
import lod_api
import difflib
import json
from collections import OrderedDict
class MockDataHandler():
def __init__(self):
# define path for test data
self.path = os.path.join(lod_api.__path__[0], "../../tests/data/mockout/")
print(se... | 2.609375 | 3 |
fline/utils/logging/base_group.py | asromahin/fline | 5 | 12797772 | class BaseGroup:
def __init__(self, log_type):
self.log_type = log_type
def __call__(self, data):
return data
| 2.265625 | 2 |
benches/tokenizer.py | cgwalters/logreduce-tokenizer | 0 | 12797773 | # Copyright (C) 2022 Red Hat
# SPDX-License-Identifier: Apache-2.0
# A copy of logreduce.tokenizer
import re
import os
DAYS = "sunday|monday|tuesday|wednesday|thursday|friday|saturday"
MONTHS = (
"january|february|march|april|may|june|july|august|september|"
"october|november|december"
)
SHORT_MONTHS = "jan|f... | 2.234375 | 2 |
flink_rest_client/v1/jobs.py | frego-dev/flink-rest-client | 0 | 12797774 | from flink_rest_client.common import _execute_rest_request, RestException
class JobTrigger:
def __init__(self, prefix, type_name, job_id, trigger_id):
self._prefix = prefix
self._type_name = type_name
self.job_id = job_id
self.trigger_id = trigger_id
@property
def status(s... | 2.09375 | 2 |
bin/selectNetwroks.py | ehsanfar/Network_Auctioneer | 2 | 12797775 | """
Copyright 2018, <NAME>, Stevens Institute of Technology
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 ... | 1.859375 | 2 |
Pyrado/pyrado/tasks/sequential.py | jacarvalho/SimuRLacra | 0 | 12797776 | <filename>Pyrado/pyrado/tasks/sequential.py
import numpy as np
from copy import deepcopy
from typing import Sequence
import pyrado
from pyrado.spaces.base import Space
from pyrado.utils.data_types import EnvSpec
from pyrado.tasks.base import Task
from pyrado.tasks.reward_functions import RewFcn
from pyrado.utils.input... | 2.546875 | 3 |
Python/strings/long2bin.py | ebouaziz/miscripts | 0 | 12797777 | <gh_stars>0
#!/usr/bin/env python2.7
# Deal with long integer encoded as binary strings
# sample long integer
l = (2**32-2)*(2**32-3)*(2**32-7)
# input long integer
print "%x" % l
# create a list
ls = []
while l:
# extract each byte of the long integer and store it into the list
bot = l&((1<<8)-1)
l >>= ... | 3.484375 | 3 |
genetic_algorithm.py | Ziggareto/national_cipher_challenge | 0 | 12797778 | import basics
import random
import math
import matplotlib.pyplot as plt
import numpy as np
import cProfile
import pstats
import time
class node():
# Has a keyword that defines it's means ofo decrypting the text
# Can reproduce to make a mutated offspring
def __init__(self, key=None):
s... | 3.3125 | 3 |
nmutils/gui/ptychoViewer/design_rc.py | alexbjorling/nanomax-analysis-utils | 3 | 12797779 | # -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.12.5)
#
# WARNING! All changes made in this file will be lost!
# from PyQt5 import QtCore
from silx.gui import qt as QtCore
qt_resource_data = b"\
\x00\x00\x19\x3d\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d... | 1.109375 | 1 |
deepensemble/layers/dense.py | pdoren/correntropy-and-ensembles-in-deep-learning | 1 | 12797780 | import theano.tensor as T
from .layer import Layer
__all__ = ['Dense']
class Dense(Layer):
""" Typical Layer of MLP.
.. math:: Layer(x) = activation(Wx + b)
where :math:`x \\in \\mathbb{R}^{n_{output}}`, :math:`W \\in \\mathbb{R}^{n_{output} \\times n_{input}}` and
:math:`b \\in \\mathbb{R}^{n_{out... | 3.03125 | 3 |
sztuczna_inteligencja/2-lab/komandos.py | Magikis/Uniwersity | 12 | 12797781 | from sokobanASTAR import taxiDistance
from IO_SI import *
from sokoban import *
targets = set()
board = []
_dirs = {'U': (-1, 0), 'D': (1, 0), 'R': (0, 1), 'L': (0, -1)}
d = {}
def showBoard(state):
for i in range(len(board)):
for j in range(len(board[i])):
tup = (i, j)
if tup in ... | 2.453125 | 2 |
apps/connections/statistics.py | Houston-ARTCC/zhu-core | 1 | 12797782 | from datetime import timedelta
from django.db.models import Sum, Q, DurationField
from django.db.models.functions import Coalesce, Cast
from django.utils import timezone
from .models import ControllerSession
from ..users.models import User, Status
def annotate_hours(query):
"""
Annotates given QuerySet with ... | 2.453125 | 2 |
format_raw_info.py | lihd1003/Booking.com-Scraper | 1 | 12797783 | <reponame>lihd1003/Booking.com-Scraper
from ast import literal_eval
import json
from os import listdir
import pandas as pd
def save_raw_listing_info(folder_in, folder_out):
files = listdir(folder_in)
all_info = []
for f in files:
if "json" not in f or "info" not in f:
continue
... | 2.640625 | 3 |
neuromaps/tests/test_stats.py | VinceBaz/neuromaps | 0 | 12797784 | # -*- coding: utf-8 -*-
"""
For testing neuromaps.stats functionality
"""
import numpy as np
import pytest
from neuromaps import stats
@pytest.mark.xfail
def test_compare_images():
assert False
def test_permtest_metric():
rs = np.random.default_rng(12345678)
x, y = rs.random(size=(2, 100))
r, p = ... | 2.1875 | 2 |
image_classifier.py | springcoil/deep-learning-tutorial-pydata2016 | 0 | 12797785 | <reponame>springcoil/deep-learning-tutorial-pydata2016<gh_stars>0
from __future__ import print_function
# os.environ['THEANO_FLAGS'] = 'device=gpu1'
import numpy as np
import theano
import theano.tensor as T
import lasagne
import trainer, utils
class TemperatureSoftmax (object):
"""
A softmax function with... | 2.75 | 3 |
mugimugi_client_api/search_item/parody.py | JeanMarc-Moly/mugimugi_client_api | 0 | 12797786 | <gh_stars>0
from dataclasses import dataclass
from typing import ClassVar
from mugimugi_client_api_entity import Parody
from mugimugi_client_api_entity import SearchParody as Root
from mugimugi_client_api_entity.enum import ElementPrefix, ItemType
from .abstract import SearchItem
@dataclass
class SearchParody(Searc... | 2.125 | 2 |
src/adasigpy/adasigpy.py | borley1211/aspy | 0 | 12797787 | <reponame>borley1211/aspy<filename>src/adasigpy/adasigpy.py
import numpy as np
from .domain.method import Method, init_w
from .interface.filter import AdaptiveSignalProcesserABC
class AdaptiveSignalProcesser(AdaptiveSignalProcesserABC):
def __init__(self, model, shape, mu, w_init, lambda_):
self.method =... | 2.515625 | 3 |
checkcel/checkerator.py | mboudet/validator | 0 | 12797788 | from openpyxl import Workbook
from checkcel.validators import OntologyValidator, SetValidator, LinkedSetValidator
from openpyxl.utils import get_column_letter
from checkcel.checkplate import Checkplate
class Checkerator(Checkplate):
def __init__(
self,
output,
**kwargs
):
sup... | 2.65625 | 3 |
utils.py | spchung/whenbots | 0 | 12797789 | import datetime
# some wrapper classes for binance websockets and api responses
class WsKline:
# takes in a websocket payload on init -> https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-streams
def __init__(self, ws_kline):
self.eventTime=datetime.datetime.fromtimestamp( float(ws_klin... | 2.671875 | 3 |
continuity/tasks.py | scast/continuity-docker | 0 | 12797790 | <filename>continuity/tasks.py
from dockermap.map.config import ClientConfiguration
from dockermap.api import MappingDockerClient
from fabric.api import (cd, env, execute, hide, local, prefix, prompt, puts,
roles, run, sudo, task)
from fabric.utils import abort
from fabric.colors import cyan, gr... | 2.09375 | 2 |
control_produccion/migrations/0008_auto_20160808_1812.py | asapper/lito-produccion | 0 | 12797791 | <filename>control_produccion/migrations/0008_auto_20160808_1812.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-08-09 00:12
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('control_produccion', '0007... | 1.429688 | 1 |
api/get_numpy_array_from_dbase.py | fmidev/ml-feature-db | 0 | 12797792 | <gh_stars>0
#!/usr/bin/python
# -*- coding: utf-8 -*-
from configparser import ConfigParser
#from lib import mlfb
#from lib import mlfb_test4
from lib import mlfb
def main():
# Example script to use mlfb class
#a = mlfb_test4.mlfb_test4(1)
#a = mlfb.mlfb_test4(1)
a = mlfb.mlfb(1)
#input1=999
... | 2.109375 | 2 |
setup.py | RLMarvin/RLBotTraining | 0 | 12797793 | <gh_stars>0
import setuptools
import importlib
# Avoid native import statements as we don't want to depend on the package being created yet.
def load_module(module_name, full_path):
spec = importlib.util.spec_from_file_location(module_name, full_path)
module = importlib.util.module_from_spec(spec)
spec.loa... | 1.671875 | 2 |
check_normals.py | panmari/seeing3d | 56 | 12797794 | <reponame>panmari/seeing3d<filename>check_normals.py
#!/usr/bin/env python
"""
see if normals are plausible by looking at their norm.
"""
import sys
import Image
import numpy as np
import matplotlib.pyplot as pl
img_fname = sys.argv[1]
img = Image.open(img_fname)
imgarr = np.array(img).astype(np.float)/255.
print i... | 2.46875 | 2 |
Instances/Final-Task/processFile.py | namespace-Pt/Algorithm | 0 | 12797795 | path_save = r'D:\Data\Class_data\Alg_data\FinalTask\l_1.txt'
path = r'D:\Data\Class_data\Alg_data\FinalTask\F.txt'
with open(path,'r',encoding='utf-8',errors='ignore') as f:
string = ''
# for line in f:
# string += line.strip()
# except:
# continue
string = f.read()
... | 2.8125 | 3 |
convertmask/utils/auglib/optional/resize.py | wwdok/mask2json | 27 | 12797796 | <filename>convertmask/utils/auglib/optional/resize.py
'''
lanhuage: python
Descripttion:
version: beta
Author: xiaoshuyui
Date: 2020-10-26 08:31:13
LastEditors: xiaoshuyui
LastEditTime: 2020-11-20 14:12:40
'''
import os
import xml.etree.ElementTree as ET
import numpy as np
import skimage
from convertmask.utils.method... | 2.5625 | 3 |
docker_loader/image.py | msiedlarek/docker-loader | 4 | 12797797 | <filename>docker_loader/image.py<gh_stars>1-10
import gzip
import shutil
import logging
logger = logging.getLogger(__name__)
class Image:
def __init__(self, client, id):
self.client = client
self.id = id
self.repository_tag = None
def __str__(self):
return self.repository_t... | 2.515625 | 3 |
authors/apps/comments/models.py | MuhweziDeo/Ah-backend-xmen | 4 | 12797798 | from django.dispatch import receiver
from django.db.models.signals import pre_save
from django.db import models
from authors.apps.articles.models import Article
from authors.apps.profiles.models import Profile
from simple_history.models import HistoricalRecords
class Comment(models.Model):
"""
Handles CRUD on ... | 2.21875 | 2 |
example_tf_loader_def.py | chunish/c- | 0 | 12797799 | # _*_ coding: utf-8 _*_
import os
import time
import numpy as np
import tensorflow as tf
class loader(object):
def __init__(self, batch_size=1, img_width=0, img_height=0):
self.batch_size = batch_size
self.img_w = img_width
self.img_h = img_height
self.batch_total = 0
def load_... | 2.59375 | 3 |
deepnlpf/core/execute.py | deepnlpf/deepnlpf | 3 | 12797800 | <filename>deepnlpf/core/execute.py<gh_stars>1-10
# -*- coding: utf-8 -*-
import deepnlpf.log as log
class Execute (object):
""" Execute Scripts External in Outher Language Programation. """
def __init__(self):
pass
def run_r(self, script, *args):
import rpy2.robjects as ro
... | 2.546875 | 3 |
website/basics/forms.py | apoorv-x12/Django-Arunachala | 0 | 12797801 | from django import forms
class InterestForm(forms.Form):
amount=forms.FloatField(label='Amount')
rate=forms.FloatField(label="Interest rate" ,min_value=5 ,max_value=50)
| 2.625 | 3 |
streamz_ml/tests/test_stream_estimator.py | remiadon/streamz-ml | 7 | 12797802 | <filename>streamz_ml/tests/test_stream_estimator.py
import pytest
from itertools import product
from streamz_ml import StreamEstimator
import numpy as np
from streamz import Stream
import pandas as pd
from streamz.dataframe import DataFrame, Series
from streamz.utils_test import wait_for, await_for
def test_no_fit... | 2.421875 | 2 |
tests/test_geckodriver.py | ramonmedeiros/geckodriver-binary | 0 | 12797803 | from selenium import webdriver
import geckodriver_binary # Adds geckodriver binary to path
def test_driver():
driver = webdriver.Firefox()
driver.get("http://www.python.org")
assert "Python" in driver.titl
driver.quit()
| 2.53125 | 3 |
Connector/info/__init__.py | bridgedragon/NodeChain | 0 | 12797804 | <reponame>bridgedragon/NodeChain
#!/usr/bin/python
from . import endpoints
| 0.832031 | 1 |
bapsflib/utils/exceptions.py | BaPSF/bapsflib | 11 | 12797805 | # This file is part of the bapsflib package, a Python toolkit for the
# BaPSF group at UCLA.
#
# http://plasma.physics.ucla.edu/
#
# Copyright 2017-2018 <NAME> and contributors
#
# License: Standard 3-clause BSD; see "LICENSES/LICENSE.txt" for full
# license terms and contributor agreement.
#
"""Exceptions specific t... | 2.078125 | 2 |
src/create_db.py | keshik6/deep-image-retrieval | 31 | 12797806 | <gh_stars>10-100
from tqdm import tqdm
import torch
import gc
import os
import numpy as np
from sklearn.metrics import cohen_kappa_score
from model import TripletNet, create_embedding_net
from dataset import QueryExtractor, EmbeddingDataset
from torchvision import transforms
import torchvision.models as models
from tor... | 2.203125 | 2 |
ansible_nwd/utilities/utilities.py | VasseurLaurent/ansible-nwd | 8 | 12797807 | <reponame>VasseurLaurent/ansible-nwd
import glob
import os
def get_list_files(path,list_files):
for filename in glob.iglob(path + '**/*', recursive=True):
if os.path.isfile(filename):
relative_paths = os.path.relpath(filename, path)
list_files.append(relative_paths)
return list... | 2.5625 | 3 |
random surface growth/generate_anim_with_one_amoeba.py | ricsirke/simulations | 0 | 12797808 | <gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
N = 100
world = np.zeros((N, N))
def get_neighs(i,j):
neighs = []
if i+1 < N:
neighs.append([i+1,j])
if j+1 < N:
neighs.append([i,j+1])
if 0 <= i-1:
neighs.append([... | 3.203125 | 3 |
system/models/collect.py | u-n-i-c-o-rn/jimi | 2 | 12797809 | <gh_stars>1-10
import time
from core.models import action, conduct, webui
from core import helpers, logging, cache, settings
class _collect(action._action):
limit = int()
# class _properties(webui._properties):
# def generate(self,classObject):
# formData = []
# formData.append({"type" : "input", "schemait... | 2.03125 | 2 |
face_applications_dlib/face_headpose_dlib.py | AlbertaBeef/vitis_ai_python_examples | 1 | 12797810 | <reponame>AlbertaBeef/vitis_ai_python_examples<gh_stars>1-10
'''
Copyright 2021 Avnet Inc.
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 req... | 2.1875 | 2 |
PyTeacher/bgui/progress_bar.py | Banshee1221/PyRob | 40 | 12797811 | from .gl_utils import *
from .widget import Widget, BGUI_DEFAULT
class ProgressBar(Widget):
"""A solid progress bar.
Controlled via the 'percent' property which assumes percent as a 0-1 floating point number."""
theme_section = 'ProgressBar'
theme_options = {
'FillColor1': (0.0, 0.42, 0.02, 1.0),
'FillCol... | 2.859375 | 3 |
study_sample/enchance_oop/use_type/enhance_oop_type.py | dantefung/Python-Codebase | 0 | 12797812 | ############
# use_type
############
# type()
'''
动态语言和静态语言最大的不同,就是函数和类的定义,【不是编译时定义的,而是运行时动态创建的。】
'''
# 比方说我们要定义一个Hello的class,就写一个hello.py模块:
'''
class Hello(object):
def hello(self, name='world'):
print('Hello, %s.' % name)
'''
# 当Python解释器载入hello模块时,就会依次执行该模块的所有语句,执行结果就是动态创建出一个
# Hello的class对象,测试如下:
fro... | 4.40625 | 4 |
tests/snc/agents/general_heuristics/test_priority_agents.py | dmcnamee/snc | 5 | 12797813 | import numpy as np
import pytest
import snc.environments.job_generators.discrete_review_job_generator \
as drjg
import snc.environments.controlled_random_walk as crw
import snc.environments.state_initialiser as si
import snc.agents.general_heuristics.random_nonidling_agent \
as random_nonidling_agent
import sn... | 1.960938 | 2 |
src/dataloader/transforms.py | Rahul-fix/stereo-depth | 0 | 12797814 | import torch
from torchvision.transforms import Compose,Normalize,RandomCrop,RandomResizedCrop,Resize,RandomHorizontalFlip, ToTensor
from torchvision import transforms
def get_transforms():
normalize = Normalize(mean=[0.485, 0.456, 0.406],std=[0.229, 0.224, 0.225])
transform = Compose([normalize])
return ... | 2.140625 | 2 |
src/linear_model.py | vignesh-pagadala/linear-regression | 0 | 12797815 | import numpy as np
import matplotlib.pyplot as plt
import pprint
def missingIsNan(s):
return np.nan if s == b'?' else float(s)
def makeStandardize(X):
means = X.mean(axis = 0)
stds = X.std(axis = 0)
def standardize(origX):
return (origX - means) / stds
def unstandardize(stdX):
return stds * ... | 3 | 3 |
practice1/5.1.py | StanislavDanilov/python3_course | 0 | 12797816 | <gh_stars>0
day = int(input(": "))
m = int(input(": "))
year = int(input(": "))
if m == 2:
m = 12
elif m == 1:
m = 11
else:
m -= 2
c = year%100
print((day + ((13*m -1) //5) + year + year + (year //4 + c//4 - 2*c + 777)) % 7 )
#not job !!!!
| 3.578125 | 4 |
dev/debug/sqllite_client.py | anderslaunerbaek/abc-core | 0 | 12797817 | import logging
from abc_core.database.sqllite_client import SQLLite
from abc_core.utils.logger_client import get_basis_logger_config
def main():
logging.basicConfig(**get_basis_logger_config())
db = SQLLite(filename="../../data/application.db")
res = db.select("SELECT * FROM blogs1")
print(res)
... | 3.03125 | 3 |
prvsnlib/context.py | acoomans/prvsn | 0 | 12797818 | <gh_stars>0
class ProvisioningContext:
def __init__(self):
self.runbook = None
self.role = None
context = ProvisioningContext() | 1.53125 | 2 |
Image Recognition/utils/BayesianModels/BayesianSqueezeNet.py | EvenStrangest/PyTorch-BayesianCNN | 1 | 12797819 | import torch.nn as nn
from utils.BBBlayers import BBBConv2d, FlattenLayer, BBBLinearFactorial
class BBBSqueezeNet(nn.Module):
"""
SqueezeNet with slightly modified Fire modules and Bayesian layers.
"""
def __init__(self, outputs, inputs):
super(BBBSqueezeNet, self).__init__()
self.con... | 2.25 | 2 |
src/python/validators/test_email_validator.py | phoffmeister/polyglot-registration | 3 | 12797820 | <filename>src/python/validators/test_email_validator.py
import unittest
from email_validator import EmailValidator
class TestEmailValidator(unittest.TestCase):
def test_validates_document(self):
email_validator = EmailValidator()
test_data = [
("<EMAIL>", True),
("<EMAIL>",... | 3.390625 | 3 |
apps/account/admin.py | JoseTorquato/projeto_enif | 0 | 12797821 | from django.contrib import admin
from .models import Balance
class BalanceAdmin(admin.ModelAdmin):
list_display = ('balance',)
admin.site.register(Balance) | 1.484375 | 1 |
convlab/modules/nlu/multiwoz/error.py | ngduyanhece/ConvLab | 405 | 12797822 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
"""
"""
class ErrorNLU:
"""Base model for generating NLU error."""
def __init__(self, act_type_rate=0.0, slot_rate=0.0):
"""
Args:
act_type_rate (float): The error rate applied on dialog act type.
... | 2.484375 | 2 |
cogs/weather.py | mmmalk/saberbot | 0 | 12797823 | import discord
from discord.ext import commands
import json, requests, io, re
class Weather:
"""Weather class handles weather using openweather api
params:
attributes:
apikey: api key for openweather
config_location: configuration location for saberbot
locations: json file ... | 3.234375 | 3 |
pyspark_db_utils/ch/__init__.py | osahp/pyspark_db_utils | 7 | 12797824 | <gh_stars>1-10
from .write_to_ch import write_to_ch
from .read_from_ch import read_from_ch
| 1.179688 | 1 |
winearb/articles/admin.py | REBradley/WineArb | 1 | 12797825 | from django.contrib import admin
from .models import Article
class ArticleAdmin(admin.ModelAdmin):
model = Article
admin.site.register(Article)
| 1.539063 | 2 |
startup/33-CBFhandler.py | NSLS-II-LIX/profile_collection | 0 | 12797826 | import os
from databroker.assets.handlers_base import HandlerBase
from databroker.assets.base_registry import DuplicateHandler
import fabio
# for backward compatibility, fpp was always 1 before Jan 2018
#global pilatus_fpp
#pilatus_fpp = 1
# this is used by the CBF file handler
from enum import Enum
class tri... | 2.015625 | 2 |
api/serializers.py | V-Holodov/pets_accounting | 0 | 12797827 | <reponame>V-Holodov/pets_accounting
from rest_framework import serializers
from api.models import Pet, PetPhoto
class PetPhotoSerializer(serializers.ModelSerializer):
"""Serialization of pet photos."""
url = serializers.ImageField(source="photo")
class Meta:
model = PetPhoto
fields = ("... | 2.171875 | 2 |
utils.py | marka17/vqvae | 11 | 12797828 | from typing import Tuple, Dict
import random
import numpy as np
import torch
from torchvision import datasets, transforms
from sklearn.metrics.pairwise import cosine_distances
from matplotlib import pyplot as plt
try:
from torch.utils.tensorboard import SummaryWriter
except ImportError:
from tensorboardX im... | 2.640625 | 3 |
tests/fson_files/src/event_A_B.py | NVinity/fson | 0 | 12797829 | #&&&#
source_file_name = 'data/A/event.txt'
sink_file_name = 'data/B/event.txt'
#
with open(source_file_name, "r") as source_file:
data = source_file.read()
key = 'b'
#
context = {'b': 2}
value = context[key]
#
print(value)
#&&&#
print(data)
#
with open(sink_file_name, "w") as sink_file:
sink_file.write(data)
| 2.6875 | 3 |
councilmatic_core/migrations/0013_auto_20160707_1957.py | tor-councilmatic/django-councilmatic | 1 | 12797830 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-07 23:57
from __future__ import unicode_literals
from django.db import migrations
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [
('councilmatic_core', '0012_auto_20160707_1859'),
]
operations = [
... | 1.703125 | 2 |
pip/commands/show.py | mindw/pip | 0 | 12797831 | from __future__ import absolute_import
from email.parser import FeedParser
import logging
import os
from pip.basecommand import Command
from pip.status_codes import SUCCESS, ERROR
from pip._vendor import pkg_resources
logger = logging.getLogger(__name__)
class ShowCommand(Command):
"""Show information about on... | 2.328125 | 2 |
swiftst/node/__init__.py | btorch/swift-setuptools | 0 | 12797832 | <reponame>btorch/swift-setuptools
""" Location for deploying swift nodes """
| 0.644531 | 1 |
course_link/__init__.py | arindampradhan/course_link | 0 | 12797833 | __version__ = "0.2.0"
__author__='<NAME>',
__author_email__='<EMAIL>',
__maintainer__='<NAME>',
__maintainer_email__='<EMAIL>',
__url__='https://github.com/arindampradhan/course_link', | 1.132813 | 1 |
AutomationKit_InfrastructureServices@SVU/helpers/BuildConfig/Pcre/PcreConfig.py | dipAch/Infrastructure-Automation-Kit | 0 | 12797834 | <filename>AutomationKit_InfrastructureServices@SVU/helpers/BuildConfig/Pcre/PcreConfig.py<gh_stars>0
##############################################################
# Module Import Section.
# Make all the necessary imports here.
##############################################################
import helpers.BuildCon... | 2.09375 | 2 |
bin/get_pos_data.py | desihub/desiperf | 0 | 12797835 | <reponame>desihub/desiperf
"""
Get Positioner data
"""
import data_mgt.get_pos_data
import argparse
from itertools import repeat
import os
import pandas as pd
import numpy as np
from datetime import datetime
import multiprocessing
#os.environ['DATA_DIR'] = '/global/cscratch1/sd/parkerf/data_local'
#os.environ['DATA_... | 2.5 | 2 |
pruning/pytorch_snip/network.py | zwxu064/RANP | 9 | 12797836 | import torch.nn as nn
import torch.nn.functional as F
import scipy.io as scio
from torchvision.models import vgg19_bn, resnet152, densenet161
class LeNet_300_100(nn.Module):
def __init__(self, enable_bias=True): # original code is true
super().__init__()
self.fc1 = nn.Linear(784, 300, bias=enable_bias)
... | 2.5 | 2 |
utest/x3270/test_assertions.py | MichaelSeeburger/Robot-Framework-Mainframe-3270-Library | 3 | 12797837 | <reponame>MichaelSeeburger/Robot-Framework-Mainframe-3270-Library
import re
import pytest
from pytest_mock import MockerFixture
from robot.api import logger
from Mainframe3270.x3270 import x3270
def test_page_should_contain_string(mocker: MockerFixture, under_test: x3270):
mocker.patch("Mainframe3270.py3270.Emu... | 2.296875 | 2 |
tests/test_series/__init__.py | smok-serwis/firanka | 0 | 12797838 | <gh_stars>0
import math
import unittest
from firanka.exceptions import NotInDomainError, DomainError
from firanka.intervals import Interval
from firanka.series import DiscreteSeries, FunctionSeries, ModuloSeries, \
LinearInterpolationSeries, Series
from .common import NOOP, HUGE_IDENTITY
class TestBase(unittest.... | 2.421875 | 2 |
src/utils/remote/remote_api/routes.py | devs-7/bible-projector-python | 0 | 12797839 | <filename>src/utils/remote/remote_api/routes.py
from typing import Any, Callable, Dict, Optional, Union
from flask import Blueprint, request
from src.utils.remote import Command
from werkzeug.utils import send_from_directory
api_routes_blueprint = Blueprint('api_routes', __name__)
execute: Callable[[Union[Command, s... | 2.390625 | 2 |
test/test_workspace.py | fkie/rosrepo | 5 | 12797840 | <reponame>fkie/rosrepo
# coding=utf-8
#
# ROSREPO
# Manage ROS workspaces with multiple Gitlab repositories
#
# Author: <NAME>
#
# Copyright 2016 <NAME>
#
# 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 L... | 1.765625 | 2 |
gym/common/profiler/profiler.py | intrig-unicamp/gym | 8 | 12797841 | <gh_stars>1-10
import os
import json
import logging
from gym.common.process import Actuator
logger = logging.getLogger(__name__)
class Profiler:
FILES = 'info'
FILES_PREFIX = 'info_'
FILES_SUFFIX = 'py'
def __init__(self):
self.profiles = {}
self._outputs = []
self.actuator =... | 2.3125 | 2 |
tests/scripts/thread-cert/pktverify/null_field.py | AdityaHPatwardhan/openthread | 2,962 | 12797842 | #!/usr/bin/env python3
#
# Copyright (c) 2019, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# ... | 1.6875 | 2 |
utils/device_util.py | zhangxdnw/pc_remote_android | 0 | 12797843 | <gh_stars>0
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@File : device_util.py
@Contact : <EMAIL>
@License : MIT
@Modify Time @Author @Version @Description
------------ ------- -------- -----------
2021/10/25 10:23 zxd 1.0 None
"""
from adbutils import adb
... | 2.515625 | 3 |
jupyter_rsession_proxy/__init__.py | uc-cdis/jupyter-rsession-proxy | 0 | 12797844 | import os
import tempfile
import subprocess
import getpass
import shutil
from textwrap import dedent
def get_r_env():
env = {}
executable = 'R'
try:
# get notebook app
from notebook.notebookapp import NotebookApp
nbapp = NotebookApp.instance()
kernel_name = nbapp.kernel_man... | 2.21875 | 2 |
chapter_1/08.py | takumi34/nlp_100 | 0 | 12797845 | def cipher(s):
res = []
for i in s:
if (i.islower()):
res.append(chr(219 - ord(i)))
else:
res.append(i)
return ''.join(res)
text = "chika chika"
a = cipher(text)
print(a)
b = cipher(a)
print(b)
| 3.734375 | 4 |
analysis_data.py | leeh43/MULAN_universal_lesion_analysis | 6 | 12797846 | <reponame>leeh43/MULAN_universal_lesion_analysis
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 29 02:29:53 2019
@author: leeh43
"""
import os
import numpy as np
import json
import matplotlib.pyplot as plt; plt.rcdefaults()
import matplotlib.pyplot as plt
import random
def get_files_endswith... | 2.3125 | 2 |
pydash/Dash/Measurement/Metric/__init__.py | ensomniac/dash | 0 | 12797847 | #!/usr/bin/python
#
# 2022 <NAME>, <EMAIL>
# <NAME>, <EMAIL>
class _Metric:
def __init__(self):
pass
@property
def DisplayName(self):
return "Metric"
@property
def AssetPath(self):
return "metric"
@property
def UnitModules(self):
return [
... | 2.34375 | 2 |
suministrospr/utils/models.py | amberlowh/suministrospr | 42 | 12797848 | from django.db import models
from .fields import DateTimeCreatedField, DateTimeModifiedField
class BaseModel(models.Model):
created_at = DateTimeCreatedField()
modified_at = DateTimeModifiedField()
class Meta:
get_latest_by = "modified_at"
ordering = ("-modified_at", "-created_at")
... | 2.40625 | 2 |
bank_api.py | blizzarac/BankTransferTools | 0 | 12797849 | __author__ = 'alexanderstolz'
import hib_sql_connection
def getAllTransfers():
connection = hib_sql_connection.connectToHibiscus()
return hib_sql_connection.queryToHibiscus(connection, "select * from umsatz;")
def getOutgoingTransfers():
connection = hib_sql_connection.connectToHibiscus()
return hi... | 2.328125 | 2 |
libs/indicators/ema.py | meetri/cryptolib | 0 | 12797850 | import os,sys,talib,numpy,math,logging,time,datetime,numbers
from collections import OrderedDict
from baseindicator import BaseIndicator
class EMA(BaseIndicator):
def __init__(self,csdata, config = {}):
config["period"] = config.get("period",30)
config["metric"] = config.get("metric","closed")
... | 2.328125 | 2 |