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 |
|---|---|---|---|---|---|---|
HW 1/P1.py | minotaur487/MIT-OCW-Problem-Sets | 0 | 12793151 | # Problem 1
def remaining_balance(min_monthly_payment_rate, balance, ann):
payment = round(min_monthly_payment_rate*balance, 2)
interest_paid = round(ann / 12 * balance, 2)
principal_paid = payment - interest_paid
return balance - principal_paid, payment, principal_paid
bal = float(input("Ente... | 4.0625 | 4 |
pypykatz/kerberos/functiondefs/asn1structs.py | wisdark/pypykatz | 1,861 | 12793152 |
from asn1crypto import core
from minikerberos.protocol.asn1_structs import krb5int32, APOptions, Ticket, EncryptedData, AP_REQ
UNIVERSAL = 0
APPLICATION = 1
CONTEXT = 2
TAG = 'explicit'
class MechType(core.ObjectIdentifier):
_map = {
#'': 'SNMPv2-SMI::enterprises.311.2.2.30',
'1.3.6.1.4.1.311.2.2.10': 'NTLMSSP... | 1.773438 | 2 |
KitchenMLTest.py | shyampurk/kitchenML | 0 | 12793153 | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 19 12:14:06 2018
@author: Admin
"""
#from pandas import Series
#from statsmodels.graphics.tsaplots import plot_acf
#from statsmodels.graphics.tsaplots import plot_pacf
#from matplotlib import pyplot
#from pandas import DataFrame
#from pandas import read_csv
#from pandas ... | 2.765625 | 3 |
tf1x/tests/analysis/atas_test.py | dpaiton/DeepSparseCoding | 12 | 12793154 | import os
import sys
ROOT_DIR = os.path.dirname(os.path.dirname(os.getcwd()))
if ROOT_DIR not in sys.path: sys.path.append(ROOT_DIR)
import numpy as np
import tensorflow as tf
from DeepSparseCoding.tf1x.analysis.base_analyzer import Analyzer
"""
Test for activity triggered analysis
NOTE: Should be executed from th... | 2.390625 | 2 |
trainer/train_forward.py | deanzadok/finemotions | 0 | 12793155 | <gh_stars>0
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
from tensorflow.python.framework.ops import prepend_name_scope
sys.path.append('.')
sys.path.append('..')
import os
import argparse
import numpy as np
import pandas as pd
import tensorflow as tf
from data.load impo... | 1.9375 | 2 |
adept_envs/utils/registration.py | isabella232/DBAP-simulation | 2 | 12793156 | """
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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
d... | 2.234375 | 2 |
moztrap/settings/default.py | yifanjiang/moztrap | 1 | 12793157 | <filename>moztrap/settings/default.py
from .base import *
try:
from .local import *
except ImportError:
pass
CACHES["default"]["VERSION"] = 1
if DEBUG:
MIDDLEWARE_CLASSES.insert(
0, "moztrap.debug.middleware.AjaxTracebackMiddleware")
try:
HMAC_KEYS
except NameError:
HMAC_KEYS = {"default... | 1.585938 | 2 |
Analysis Scripts/supply_demand_mismatch.py | bonesbb/HASPR | 1 | 12793158 | <reponame>bonesbb/HASPR<filename>Analysis Scripts/supply_demand_mismatch.py
# HASPR - High-Altitude Solar Power Research
# Script to get alleviation of supply/demand mismatch given generation profiles
# Version 0.1
# Author: neyring
from os import walk
import haspr
from haspr import Result
from haspr import Da... | 2.734375 | 3 |
lambda/exercices/PhotoCollector/getAllSubjectLambda.py | Mythridor/aws-scripting | 0 | 12793159 | <gh_stars>0
import boto3
def lambda_handler(event, context):
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('<DBName>')
result = table.scan(
ProjectionExpression='subject',
)
return (result['Items'])
| 2.21875 | 2 |
network/tests/test_integration.py | glasser/integrations-core | 2 | 12793160 | <reponame>glasser/integrations-core<gh_stars>1-10
# (C) Datadog, Inc. 2019
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
import platform
import pytest
from . import common
pytestmark = pytest.mark.integration
@pytest.mark.usefixtures("dd_environment")
def test_check(aggregator, check,... | 2.015625 | 2 |
counternet/dataset.py | BirkhoffG/counternet | 0 | 12793161 | <gh_stars>0
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/01b_data.ipynb (unless otherwise specified).
__all__ = ['dict2json', 'load_configs', 'update_json_file', 'bn_func', 'x1_to_x3', 'x1x2_to_x4', 'bn_gen',
'load_adult_income_dataset', 'load_learning_analytic_data', 'describe']
# Cell
from .import_ess... | 2.296875 | 2 |
v1/cs/download.py | imhele/django-example | 1 | 12793162 | # -*- coding: utf-8 -*-
# API - cs
# FileName: download.py
# Version: 1.0.0
# Create: 2018-10-27
# Modify: 2018-11-07
import mimetypes
from .auth import OSS
from .util import Check
from act import StoreData
from .upload import FolderFile, Source
from .exception import CSCommonErr, CSDownloadErr
class Do... | 2.40625 | 2 |
awspider/servers/data.py | wehriam/awspider | 2 | 12793163 | from twisted.internet.defer import Deferred, DeferredList
from twisted.web import server
from twisted.internet import reactor
from .base import BaseServer, LOGGER
from ..resources import DataResource
class DataServer(BaseServer):
def __init__(self,
aws_access_key_id,
aws_sec... | 1.9375 | 2 |
app/tests/utils/test_utils.py | onap/sdc-dcae-d-tosca-lab | 1 | 12793164 | <filename>app/tests/utils/test_utils.py
from toscalib.templates.topology import ToscaTopology
from toscalib.templates.database import ToscaDB
from toscalib.types.node import NodeType
from toscalib.types.capability import CapabilityType
from toscalib.tosca_builder import ToscaBuilder
import os
CURR_DIR = os.path.dirnam... | 2.03125 | 2 |
lmp/util/validate.py | ProFatXuanAll/char-RNN | 0 | 12793165 | """Checking types and values."""
import os
from typing import Any, List, Type, Union
def raise_if_empty_str(*, val: str, val_name: str) -> None:
"""Raise if ``val`` is an empty :py:class:`str`.
Parameters
----------
val: str
Test target.
val_name: str
Test target name. Mainly used to create error... | 3.6875 | 4 |
part2.py | AybukeYALCINER/image_classification | 9 | 12793166 | <reponame>AybukeYALCINER/image_classification<filename>part2.py
from __future__ import print_function
from __future__ import division
import torch
import torch.nn as nn
import torch.optim as optim
import tensorflow as tf
import numpy as np
import torchvision
from torchvision import datasets, models, transforms
... | 2.765625 | 3 |
submission_broker/submission/submission.py | ebi-ait/submission-broker | 0 | 12793167 | <reponame>ebi-ait/submission-broker
from enum import Enum
from typing import List, Set, KeysView, Dict, ValuesView
from submission_broker.submission.entity import Entity
class HandleCollision(Enum):
UPDATE = 1
OVERWRITE = 2
ERROR = 3
class Submission:
def __init__(self, collider: HandleCollision = ... | 2.109375 | 2 |
PythonGlobalOptimizationLib/PythonGlobalOptimizationLib/DataDownload/GetYahooFinanceTimeSeriesData.py | zhenshaoaixixi0507/PythonGlobalOptimizationLib | 0 | 12793168 | <gh_stars>0
from yahoofinancials import YahooFinancials
import pandas as pd
import numpy as np
def GetYahooFinanceData(ticker:str,startdate:str,enddate:str,timeinterval:str,datatype:str)->np.ndarray:
yahoo_financials = YahooFinancials(ticker)
data = yahoo_financials.get_historical_price_data(start_date=startdate,
... | 2.96875 | 3 |
leetcode/RansomNote.py | mahendra-rk/coding-interview-prep | 0 | 12793169 | <filename>leetcode/RansomNote.py
# Leetcode
# 383. Ransom Note
class Solution:
def canConstruct(self, ransomNote: str, magazine: str) -> bool:
if len(magazine) < len(ransomNote):
return False
mag_counter = collections.Counter(magazine)
ransom_counter = collections.Counte... | 3.390625 | 3 |
Grammys/src/data/run_crawlers.py | kelvingakuo/INCITEFUL-DATA | 1 | 12793170 | <reponame>kelvingakuo/INCITEFUL-DATA
import subprocess
def runCrawler(what):
if(what == 'lyrics'):
command = 'cd LyricsFreakCrawler/LyricsFreakCrawler/ && scrapy crawl lyricsfreak -o lyrics.json'
elif(what == 'artistData'):
command = 'cd WikipediaCrawler/WikipediaCrawler/ && scrapy crawl artistInfo -o artist_dat... | 2.265625 | 2 |
example/benchmark/counter.py | dendisuhubdy/ijson | 0 | 12793171 | <filename>example/benchmark/counter.py
from bottle import post, run, request
import threading
import time
count = 0
@post('/')
def index():
global count
count += int(request.body.read())
return b''
def show():
prev = 0
while True:
start = time.time()
time.sleep(1)
now =... | 2.5625 | 3 |
django_ancestry_relation/managers.py | aaronmarkey/django-ancestry-relation | 2 | 12793172 | <reponame>aaronmarkey/django-ancestry-relation
from django.db import models
class NodeManager(models.Manager):
def create_node(self, *args, **kwargs):
'''
Create a Node object. Generates level and path automatically if ones are
not supplied in kwargs.
RETURNS
-------
... | 2.6875 | 3 |
download.py | felipefelixarias/a2cat-vn-pytorch | 7 | 12793173 | <filename>download.py
import requests
import io
import zipfile
from collections import namedtuple
import os
def _convert_name(name, acc = ''):
if len(name) == 0:
return acc
if name[0].isupper():
acc += ('-' if len(acc) > 0 else '') + name[0].lower()
elif name[0] == '_':
acc += '-'
... | 2.890625 | 3 |
leonardo_form_roudnyresl/models.py | dresl/leonardo-form-roudnyresl | 0 | 12793174 | # encoding: utf-8
from leonardo.module.web.models import Widget
from leonardo.module.media.fields.image import ImageField
from django.db import models
from django.conf import settings
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
import datetime
from django.utils.encoding imp... | 1.710938 | 2 |
packages/w3af/w3af/core/data/parsers/tests/test_parser_cache.py | ZooAtmosphereGroup/HelloPackages | 3 | 12793175 | <reponame>ZooAtmosphereGroup/HelloPackages
"""
test_parser_cache.py
Copyright 2012 <NAME>
This file is part of w3af, http://w3af.org/ .
w3af is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the Licen... | 2.046875 | 2 |
xtools/main.py | hxler123/tools | 2 | 12793176 | import sys
import binascii
import hashlib
from PyQt5.QtWidgets import QApplication,QMainWindow,QFileDialog
from xtui import Ui_Form
from xtoolsfunc import XToolsFunc
base64_method = ["encode","decode"]
hash_available = hashlib.algorithms_guaranteed
class MainUi(QMainWindow,QFileDialog,Ui_Form):
def __init__(self... | 2.484375 | 2 |
faucet.py | thecaliconoire/aepp-faucet | 0 | 12793177 | <reponame>thecaliconoire/aepp-faucet<filename>faucet.py
#!/usr/bin/env python3
import os
import sys
import logging
import argparse
# flask
from flask import Flask, jsonify, render_template
# aeternity
from aeternity.epoch import EpochClient
from aeternity.signing import KeyPair, is_valid_hash
from aeternity.config i... | 2.15625 | 2 |
src/nirvana/coalesce/coalesce_strategies.py | jimmylchen/nirvana | 0 | 12793178 | from statistics import mean
# Weighted by api name
def coalesce_weighted_mean(api_responses):
weights = {
"api1": 0.5,
"api2": 0.3,
"api3": 0.2,
}
weighted_mean = 0
for api, value in api_responses.items():
weighted_mean += weights[api] * value
return weig... | 3.453125 | 3 |
src/library/__init__.py | oschusler/libqasm | 0 | 12793179 | # Author <NAME>
# The import syntax changes slightly between python 2 and 3, so we
# need to detect which version is being used:
from sys import version_info
if version_info[0] == 3:
PY3 = True
# elif version_info[0] == 2:
# PY3 = False
else:
raise EnvironmentError("sys.version_info refers to a version of ... | 2.46875 | 2 |
kunai/dnsquery.py | vijayanant/kunai | 1 | 12793180 | import re
import socket
pattern = r"((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)([ (\[]?(\.|dot)[ )\]]?(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3})"
ipv4pattern = re.compile(pattern)
class DNSQuery:
def __init__(self, data):
self.data = data
self.domain = ''
t = (ord(data[2]) >> 3) & 15 # Opco... | 2.78125 | 3 |
02-Scripting/05-Twitter_Bot/twitter.py | suzynakayama/udemy-python-dev | 1 | 12793181 | <filename>02-Scripting/05-Twitter_Bot/twitter.py
import tweepy
import os
import time
from dotenv import load_dotenv
load_dotenv()
consumer_key = os.getenv('consumer_key')
consumer_secret = os.getenv('consumer_secret')
access_token = os.getenv('access_token')
access_token_secret = os.getenv('access_token_secret')
aut... | 2.953125 | 3 |
main.py | DeerChen/ip2host | 1 | 12793182 | '''
Description: ip反查域名
Author: Senkita
Date: 2020-10-09 10:23:52
LastEditors: Senkita
LastEditTime: 2020-10-09 15:01:39
'''
import os
from utils.Query import batch_query
if __name__ == "__main__":
os.makedirs('./Log', exist_ok=True)
filename = 'public.txt'
save_filename = 'domain_name.txt'
... | 2.109375 | 2 |
metrics/serializers.py | cybrvybe/AU7OMA7A-BI | 0 | 12793183 | from rest_framework import serializers
from .models import Metric
class MetricSerializer(
serializers.ModelSerializer
):
class Meta:
model = Metric
fields = (
"title",
"created_at",
"metric"
) | 2.0625 | 2 |
fdm-devito-notebooks/02_wave/exer-wave/wave_spectra.py | devitocodes/devito_book | 7 | 12793184 | import numpy as np
import matplotlib.pyplot as plt
def spectrum(f, x):
# Discrete Fourier transform
A = np.fft.rfft(f(x))
A_amplitude = np.abs(A)
# Compute the corresponding frequencies
dx = x[1] - x[0]
freqs = np.linspace(0, np.pi/dx, A_amplitude.size)
plt.plot(freqs[:len(freqs)/2], A_am... | 2.875 | 3 |
9term/fipt/P2PLending/reviews/forms.py | nik-sergeson/bsuir-informatics-labs | 0 | 12793185 | <reponame>nik-sergeson/bsuir-informatics-labs<gh_stars>0
from django.forms import ModelForm
from P2PLending.reviews.models import Review
class ReviewForm(ModelForm):
class Meta:
model = Review
fields = ['text']
| 1.609375 | 2 |
cli/src/klio_cli/commands/job/stop.py | gaybro8777/klio | 705 | 12793186 | # Copyright 2019-2020 Spotify AB
#
# 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 agreed to in writin... | 1.945313 | 2 |
VecMap/vec_map.py | matao1984/vec-map | 0 | 12793187 | # -*- coding: utf-8 -*-
#VecMap0.1
#The first versio of VecMap
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
import matplotlib
matplotlib.use('Qt5Agg')
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.back... | 2.234375 | 2 |
count_subset_occurrences.py | will-r-wang/opencv-object-detection | 0 | 12793188 | import numpy as np
def count_subset_occurrences(array, subset_array):
occurrences = 0
for idx in range(len(array) - len(subset_array) + 1):
if np.array_equal(array[idx:(idx + len(subset_array))], subset_array):
occurrences += 1
return occurrences
def test_base_case():
assert count_... | 3.421875 | 3 |
output/models/nist_data/list_pkg/name/schema_instance/nistschema_sv_iv_list_name_length_3_xsd/__init__.py | tefra/xsdata-w3c-tests | 1 | 12793189 | <reponame>tefra/xsdata-w3c-tests
from output.models.nist_data.list_pkg.name.schema_instance.nistschema_sv_iv_list_name_length_3_xsd.nistschema_sv_iv_list_name_length_3 import NistschemaSvIvListNameLength3
__all__ = [
"NistschemaSvIvListNameLength3",
]
| 0.925781 | 1 |
cv2/select-pixels-by-RGB/main.py | whitmans-max/python-examples | 140 | 12793190 | <gh_stars>100-1000
#!/usr/bin/env python3
# date: 2019.09.24
# https://stackoverflow.com/questions/58085439/opencv-extract-pixels-with-rbg/
# replaca pixel when `R > G > B`
import cv2
import numpy as np
img = cv2.imread('/home/furas/Obrazy/images/image.png')
# img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
img[ (img[... | 3.09375 | 3 |
src/gui/actions.py | iosetek/CommandRecognition | 0 | 12793191 | <gh_stars>0
from src.api import Api
from src.gui.appJar.appjar import gui
class ActionsUI:
def __init__(self, app):
self.__app = app
def append_its_content(self):
"""
Creates view designed to create action and attach it to
particular command. Action can be defined as executing... | 2.765625 | 3 |
PySARibbon/__init__.py | Bllose/SARibbon-pyqt5 | 3 | 12793192 | # -*- coding: utf-8 -*-
"""
@Module __init__.py
@Author ROOT
"""
from .SAFramelessHelper import SAFramelessHelper
from .SARibbonBar import SARibbonBar
from .SARibbonButtonGroupWidget import SARibbonButtonGroupWidget
from .SARibbonCategory import SARibbonCategory
from .SARibbonCategoryLayout import SARibbonCate... | 0.992188 | 1 |
app/models/user.py | nickobrad/blogs | 0 | 12793193 | from .. import db
from flask_login import UserMixin, login_manager, LoginManager
from werkzeug.security import generate_password_hash, check_password_hash
from .. import login_manager
from datetime import date, datetime
@login_manager.user_loader
def load_user(id):
return User.query.get(int(id))
class User(UserMi... | 2.59375 | 3 |
sitykelib/modifyer.py | DistinctWind/SITYKE | 2 | 12793194 | <filename>sitykelib/modifyer.py
from sitykelib.sercher import perfix
import os
def get_pdf_name(original_name):
return perfix(original_name)+'.pdf'
def cut_ppt(pptfiles):
new_pptfiles = list()
arg = ' -fc- -odpi 300 -mode copy -w 1364 -h 1016 -o [Cut]%s '
for pptfile in pptfiles:
pdfname = get... | 2.671875 | 3 |
blog/models.py | bibibricodeur/django-bibi | 0 | 12793195 | <gh_stars>0
from django.db import models
# https://docs.djangoproject.com/fr/3.1/intro/tutorial02/
# Cette fonction est utilisée pour formater les URL
from django.urls import reverse
from django.contrib.auth.models import User
# Create your models here.
class BlogCategory(models.Model):
# Fields
category_n... | 2.640625 | 3 |
packages/pyright-internal/src/tests/samples/paramSpec19.py | kihoonim/pyright | 1 | 12793196 | <reponame>kihoonim/pyright
# This sample tests the case where a ParamSpec is used within a generic
# type alias with a Callable.
from typing import Any, Callable, Generic, Protocol
from typing_extensions import Concatenate, ParamSpec
P = ParamSpec("P")
# Example 1: Callable generic type alias
CommandHandler1 = Call... | 2.59375 | 3 |
run.py | Originofamonia/mcan-vqa | 0 | 12793197 | # --------------------------------------------------------
# mcan-vqa (Deep Modular Co-Attention Networks)
# modify this to our VQA dataset
# --------------------------------------------------------
import os
from copy import copy
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Rectan... | 2.609375 | 3 |
app/core/serializers.py | jblanquicett92/activo-django-docker-postgres | 0 | 12793198 | <gh_stars>0
from django.contrib.auth import get_user_model
from django.contrib.auth import authenticate
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
from .models import Departamento, EstatusUsuario, Historial_Turno, Idioma, Puesto, Scope, Tipo_Rol, Rol
from .models imp... | 2.15625 | 2 |
examples/plot_transport_laws.py | Cgadal/PyDune | 0 | 12793199 | r"""
===========
Transport laws
===========
Create a plot comparing the different transport laws.
"""
import matplotlib.pyplot as plt
import numpy as np
from PyDune.physics.sedtransport import transport_laws as TL
theta = np.linspace(0, 0.4, 1000)
theta_d = 0.035
omega = 8
plt.figure()
plt.plot(theta, TL.quadrati... | 3.109375 | 3 |
#7 Kelas Dan Object/Decorator/decorator.py | HudaFiqri/belajarPython | 5 | 12793200 | '''
decorator
jadi agar memudahkan dalam pembungkusan fungsi maka python menyediakan yang namanya decorator.
sumber referensi: https://www.youtube.com/watch?v=r7Dtus7N4pI
direvisi pada: 26-02-2021
'''
'''
membuat fungsi yang akan dipanggil.
jadi di decorator pada python harus fungsi rekursif untuk mengembalikan valu... | 3.734375 | 4 |
widgets/tests_list.py | alexoff13/QTpost-machine | 1 | 12793201 | <reponame>alexoff13/QTpost-machine
from typing import Union
from time import time
from PyQt5 import QtCore
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QListWidget, QAbstractItemView, QListWidgetItem
from widgets.tape import Tape
class Data:
test: QListWidgetItem
state: dict
saved_state: dic... | 2.625 | 3 |
CSV Chunker & Sorter/utils/folderUtil.py | momoji123/Tools | 0 | 12793202 | <gh_stars>0
import os, shutil
from datetime import datetime;
SOURCE_FOLDER = "./temp";
TARGET_FOLDER = "./RESULT";
BACKUP_FOLDER = "./STAGING";
def printAction(action, fileNames):
print("\n" + action + " " + str(len(fileNames)) + " files");
def countFiles(pathToFolder):
fileNames = os.listdir(pathToFold... | 2.75 | 3 |
lib/file_system.py | dhung09/KiteSublime | 81 | 12793203 | import sys
if sys.platform == 'darwin':
from ..lib.platform.darwin.file_system import *
elif sys.platform == 'win32':
from ..lib.platform.win32.file_system import *
elif sys.platform in ('linux', 'linux2'):
from ..lib.platform.linux.file_system import *
else:
from ..lib.platform.unsupported.file_system... | 2.484375 | 2 |
automatization_of_data_mining_project/data_set_loader/exceptions/loader_exceptions.py | Sale1996/automatization_of_data_mining_project | 0 | 12793204 | <reponame>Sale1996/automatization_of_data_mining_project<gh_stars>0
class Error(Exception):
"""Base class for other exceptions"""
pass
class WrongPathNameFormatError(Error):
"""Raised when the path name has wrong format"""
pass
class FileIsNotFoundError(Error):
"""Raised when the input file from... | 2.203125 | 2 |
addons/website_event_meet/models/event_event.py | SHIVJITH/Odoo_Machine_Test | 0 | 12793205 | <filename>addons/website_event_meet/models/event_event.py
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class Event(models.Model):
_inherit = "event.event"
meeting_room_ids = fields.One2many("event.meeting.room", "even... | 2.03125 | 2 |
build_tiles.py | anthonyrandell-madetech/tiles-builder | 0 | 12793206 | <reponame>anthonyrandell-madetech/tiles-builder<filename>build_tiles.py
import argparse
import sqlite3
import subprocess
import multiprocessing as mp
from pathlib import Path
from itertools import repeat
def run(command):
proc = subprocess.run(command, capture_output=True, text=True)
try:
proc.check_r... | 2.40625 | 2 |
office365/sharepoint/portal/SPSiteManager.py | stardust85/Office365-REST-Python-Client | 0 | 12793207 | from office365.runtime.client_object import ClientObject
from office365.runtime.serviceOperationQuery import ServiceOperationQuery
from office365.runtime.http.http_method import HttpMethod
from office365.runtime.resource_path import ResourcePath
from office365.sharepoint.portal.SPSiteCreationResponse import SPSiteCreat... | 2.1875 | 2 |
backend/app/datastores.py | ikumen/notas | 0 | 12793208 | <reponame>ikumen/notas
from bson import json_util, objectid
from pymongo import MongoClient, database
from typing import List
from backend.app import settings
class MongoCollection:
"""Generic class wrapper around Mongo DB operations around a collection.
"""
def __init__(self, collection_name: str, db: da... | 2.734375 | 3 |
vision/src/VisionTest/BroadcasterTEST.py | victoriapc/HockusPockus | 0 | 12793209 | <reponame>victoriapc/HockusPockus<gh_stars>0
from VisionInterfaces.Broadcaster import Broadcaster
import cv2
class BroadcasterTEST(Broadcaster) :
def __init__(self):
self.m_currentFrame = 0
def broadcastCoordinatesOfPuck(self,i_xPos,i_Ypos):
"""
This implementation does nothing, as the... | 2.734375 | 3 |
test.py | matchagreen/fkom-inventory-management-system | 0 | 12793210 | <gh_stars>0
import numpy as np
import pandas as pd
staff_planning = [
[[0, 0, 8], [1, 0, 8], [2, 0, 8], [3, 0, 8], [4, 0, 8], [5, 0, 8], [6, 0, 8], [7, 0, 8], [8, 0, 8], [9, 0, 8], [10, 0, 8], [11, 0, 8], [12, 0, 8], [13, 0, 8], [14, 0, 8], [
15, 0, 8], [16, 0, 8], [17, 0, 8], [18, 0, 8], [19, 0, 8], [20,... | 1.75 | 2 |
wtss_plugin/help/source/conf.py | AbnerErnaniADSFatec/wtss-qgis | 1 | 12793211 | """
WTSS QGIS Plugin.
Python Client Library for Web Time Series Service.
Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/.
-------------------
begin : 2019-05-04
git sha : $Format:%H$
copyright : (C) 2020 by INPE
email ... | 1.515625 | 2 |
model/signalgenerator.py | shuaiwng/python | 1 | 12793212 | import random
import numpy as np
import time
class Signalgenerator():
def __init__(self):
self.Fs = 8000
self.f = 2
self.sample = 8000
self.x = np.arange(1, self.sample+1)
self.y = np.empty(self.sample)
self.level = 0
self.filename = ''
def set_filename... | 2.9375 | 3 |
server/tests/mod_auth/test_auth.py | Synergize-Southwest-Detroit/api | 2 | 12793213 | from server.mod_auth.auth import load_user # , register, login
from server.tests.helpers import FlaskTestCase, fixtures
class TestAuth(FlaskTestCase):
@fixtures('single_user.json')
def test_load_existing_user(self):
"""Test loading a single valid user"""
with self.flaskapp.test_request_contex... | 2.375 | 2 |
normVirReads.py | gstarrett/oncovirus_tools | 2 | 12793214 | <gh_stars>1-10
#!/usr/bin/env python3
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("g", type=str, help="The virus bedgraph file")
parser.add_argument("s", type=str, help="the bamindexstat file")
args = parser.parse_args()
# this can be simplified by just importing the bam file and then runnin... | 2.6875 | 3 |
progress/home/migrations/0001_initial.py | Andrew0701/web-coursework | 4 | 12793215 | <reponame>Andrew0701/web-coursework
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
oper... | 2.015625 | 2 |
vireoSNP/utils/vireo_model_v02.py | andr-kun/vireo | 0 | 12793216 | # Core functions for Vireo model
# Author: <NAME>
# Date: 30/08/2019
# http://edwardlib.org/tutorials/probabilistic-pca
# https://github.com/allentran/pca-magic
import sys
import itertools
import numpy as np
from scipy.stats import entropy
from scipy.special import digamma
from .vireo_base import normalize, loglik_am... | 2.375 | 2 |
Python/Programming Fundamentals/Exams/05. Contact list.py | teodoramilcheva/softuni-software-engineering | 0 | 12793217 | contacts = input().split()
while True:
line = input()
tokens = line.split()
command = tokens[0]
if command == 'Add':
name = tokens[1]
index = int(tokens[2])
if name not in contacts:
contacts.append(name)
else:
if 0 <= index < len(con... | 3.671875 | 4 |
__SocialMedia_Sites.py | elithaxxor/pi_repo | 0 | 12793218 | <reponame>elithaxxor/pi_repo
#import socialmedia
#from socialmedia import USERNAME
USERNAME = input(f'[sys] Enter Username:' )
# INSTAGRAM
instagram = f'https://www.instagram.com/{USERNAME}'
# FACEBOOK
facebook = f'https://www.facebook.com/{USERNAME}'
#TWITTER
twitter = f'https://www.twitter.com/{USERNAME}'
# YOUTUB... | 2.15625 | 2 |
shadowsocks/objects/user.py | PaperDashboard/shadowsocks-vanilla | 1 | 12793219 | class User(object):
def __init__(self, config):
self.port = int(config["port"])
self.password = str(config["password"])
self.method = str(config["method"])
if "_id" in config:
self.id = config["_id"]["$oid"]
else:
self.id = str(self.port)
... | 3.296875 | 3 |
tests/test_utilities.py | zachdj/team-crux-p1 | 1 | 12793220 | <filename>tests/test_utilities.py
"""
Unit tests for functions in the src.utilities package
"""
import unittest
import warnings
from pyspark import SparkContext, SparkConf
import src.utilities.preprocess as preprocess
import src.utilities.utils as utils
class TestPreprocess(unittest.TestCase):
def setUp(self):
... | 3 | 3 |
scripts/morphware_data_sizes.py | QuintusTheFifth/telliot-core | 9 | 12793221 | <filename>scripts/morphware_data_sizes.py
"""Print the size of the data returned by a Morphware query (data reported)."""
import json
import sys
import requests
from telliot_core.queries.morphware import Morphware
def main():
"""
Print the size of the data returned by a Morphware query
using Morphare-pr... | 2.875 | 3 |
mtse/model_utils.py | FractalySyn/mtse | 1 | 12793222 | <filename>mtse/model_utils.py
import torch
import torch.nn as nn
import torch.nn.functional as F
def rmspe(pred, true):
"""Computes RMSPE"""
return torch.mean(((true - pred) / true)**2)**0.5
def rmse(pred, true):
"""Computes RMSE"""
return torch.mean((true - pred)**2)**0.5
def mape(pred, ... | 2.5625 | 3 |
train_seg.py | Debatrix/AquulaCam | 2 | 12793223 | <filename>train_seg.py<gh_stars>1-10
import os
from scipy import stats
import numpy as np
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from base_train import train
from util import LoadConfig
from dataset import HUTDataset
from model.network import UNetLike
from model.framework import Se... | 2.078125 | 2 |
transistor/persistence/__init__.py | awesome-archive/transistor | 232 | 12793224 | # -*- coding: utf-8 -*-
"""
transistor.persistence
~~~~~~~~~~~~
This module implements classes and methods to aid persistence, including
database, spreadsheet export, write to file.
:copyright: Copyright (C) 2018 by BOM Quote Limited
:license: The MIT License, see LICENSE for more details.
~~~~~~~~~~~~
"""
from .expo... | 1.992188 | 2 |
convolution_matrices/convmat3D.py | zhaonat/RCWA | 66 | 12793225 | import numpy as np
import matplotlib.pyplot as plt
## preliminary tests
#inputs: A, P, Q, R
# A is the discrete representation of epsilon
#number of spatial harmonics (or orders)
P = 6;
Q = 6;
R = 6;
Nx = 20; Ny = 20; Nz = 1; #this is fundamentally 3D...not sure how to make general for 2D
N = np.array([Nx, Ny, Nz]);
... | 2.671875 | 3 |
pyassim/llock.py | ZoneTsuyoshi/pyassim | 0 | 12793226 | <reponame>ZoneTsuyoshi/pyassim<filename>pyassim/llock.py
"""
=====================================================================
Inference with Local Linear Operator Construction with Kalman Filter
=====================================================================
This module implements the Local LOCK
for Linear-G... | 2.140625 | 2 |
__init__.py | pslustig/galfitwrap | 0 | 12793227 | <gh_stars>0
from .galaxywrap import *
| 1.21875 | 1 |
lib/spot-2.8.1/tests/python/sum.py | AlessandroCaste/SynkrisisJupyter | 0 | 12793228 | <filename>lib/spot-2.8.1/tests/python/sum.py
# -*- mode: python; coding: utf-8 -*-
# Copyright (C) 2017, 2018 Laboratoire de Recherche et Développement de l'Epita
#
# This file is part of Spot, a model checking library.
#
# Spot is free software; you can redistribute it and/or modify it
# under the terms of the GNU Gen... | 2.609375 | 3 |
server/resources/api/__init__.py | Saakshaat/umass-match | 0 | 12793229 | from fastapi import APIRouter
main_router = APIRouter()
from resources.db import session_dependency
session_dep = session_dependency()
@main_router.get("/", status_code=200)
async def root():
return {"msg": "Welcome to UMass Match!"}
from .user import user_router
from .match import match_router
# add indivi... | 2.265625 | 2 |
attention_model.py | qiaoliuhub/AttnToCrispr | 8 | 12793230 | import torch.nn as nn
from torch import cat, transpose
import torch
import torch.nn.functional as F
from Layers import EncoderLayer, DecoderLayer
from Sublayers import Norm, OutputFeedForward
import copy
import attention_setting
import numpy as np
import crispr_attn
import math
import OT_crispr_attn
import sys
import i... | 2.375 | 2 |
main_deep_feat_select_mlp_l21norm.py | yifeng-li/DECRES | 42 | 12793231 | <gh_stars>10-100
#!/usr/bin/env python
"""
An example of running DFS for MLP based on L2,1-norm.
<NAME>
NRC, Ottawa
Aug. 06, 2015
Contact: <EMAIL>
"""
#qsub -l procs=1,pmem=2000mb,walltime=36:00:00 -r n -N main_DFS_feature_selection_l21norm -o main_DFS_feature_selection_l21norm.out -e main_DFS_feature_selection_l21norm... | 2.515625 | 3 |
client/hotbox.py | odontomachus/hotbox | 0 | 12793232 | <filename>client/hotbox.py
if __name__ == "__main__":
from gui import App
app = App()
app.mainloop()
| 1.695313 | 2 |
library/example-exceptions.py | kensoi/testcanarybot | 0 | 12793233 | import random
from testcanarybot import objects
from testcanarybot import exceptions
# Copyright 2021 kensoi
class Main(objects.libraryModule):
@objects.priority(commands = ['quit']) # @testcanarybot quit
async def second(self, tools: objects.tools, package: objects.package):
await tools.api.messages.... | 2.296875 | 2 |
src/kivy_garden/qrcode/version.py | kivy-garden/qrcode | 7 | 12793234 | __version__ = '2021.0314'
| 1.0625 | 1 |
neuron_models/rvlm_model.py | joetaylor94/reservoir-computing | 1 | 12793235 | '''
<NAME> (<EMAIL>)
Department of Physics
University of Bath, UK
May 1st, 2020
Conductance model of an RVLM neuron for use with reservoir computing
using a modified Hodgkin-Huxley framework of ion channel gating.
Model parameters are chosen so as to replicate the behaviour of
the thalamocortical relay ne... | 2.90625 | 3 |
firetail/extensions/fleet_up/__init__.py | evidex/Firetail | 29 | 12793236 | <filename>firetail/extensions/fleet_up/__init__.py
from .fleet_up import FleetUp
def setup(bot):
bot.add_cog(FleetUp(bot))
| 1.570313 | 2 |
byte-adder.py | sandeshpoudel995/Byte-adder | 0 | 12793237 | # byte-adder.py
# A simple python program which simulates the behaviour of a digital circuit performing integer addition.
# It adds two 8 bit binary numbers using different logical gates.
import sys
import os
#defining input
def Input():
upper_bit_int = int(input("Enter \'first integer\' from 0 to 255 : ")) # first ... | 4.28125 | 4 |
bin/premcce.py | newbooks/Develop-MCCE | 0 | 12793238 | #!/usr/bin/env python
import sys
from pymccelib import *
import logging
logging.basicConfig(level=logging.DEBUG, format='%(levelname)-s: %(message)s')
if __name__ == "__main__":
env.init()
prot = Protein()
prot.load_nativepdb(env.prm["INPDB"])
# identify N and C terminal
if env.prm["TERMINALS"].... | 2.15625 | 2 |
kunquat/tracker/ui/model/orderlistmanager.py | kagu/kunquat | 13 | 12793239 | # -*- coding: utf-8 -*-
#
# Author: <NAME>, Finland 2015
#
# This file is part of Kunquat.
#
# CC0 1.0 Universal, http://creativecommons.org/publicdomain/zero/1.0/
#
# To the extent possible under law, Kunquat Affirmers have waived all
# copyright and related or neighboring rights to Kunquat.
#
class OrderlistManage... | 1.84375 | 2 |
src/phat/learn/__init__.py | rskene/phat | 2 | 12793240 | from .phatnet import PhatNet, PhatLoss, PhatMetric
from .utils import DataSplit
| 1.070313 | 1 |
DeepLearningArchitectures/UNet/models/unet1.py | SCCH-KVS/NuclearSegmentationPipeline | 13 | 12793241 | #!/usr/bin/env python
import lasagne
from lasagne.layers.conv import Conv2DLayer as Conv2DLayer
from lasagne.layers import MaxPool2DLayer, ConcatLayer, TransposedConv2DLayer
from lasagne.nonlinearities import elu, sigmoid, rectify
from lasagne.layers import batch_norm
from lasagne_wrapper.network import SegmentationN... | 2.8125 | 3 |
pkg/R/late.py | cnk113/ESCAPE | 0 | 12793242 | #!/usr/bin/python
import sys
import os
import numpy as np
import pandas as pd
import argparse
import tensorflow as tf
from importlib.machinery import SourceFileLoader
import math
import psutil
import time
from scipy.sparse import csr_matrix
import gc
import matplotlib
matplotlib.use('Agg')
import scimpute
def learnin... | 2.328125 | 2 |
irc/messages/message.py | AlexGustafsson/irc-news-bot | 0 | 12793243 | """IRC message."""
import re
from typing import Optional
from irc.messages.base import IRCBaseMessage
# Regex for matching the individual parts of an IRC message
private_message_regex = re.compile("^:([^!]+)!(.*?) (PRIVMSG|NOTICE) ([^ ]+) :(.*)")
class IRCMessage(IRCBaseMessage):
"""An IRC private message."""
... | 3.21875 | 3 |
main/calendar-module/calendar-module.py | EliahKagan/old-practice-snapshot | 0 | 12793244 | #!/usr/bin/env python3
from calendar import day_name, weekday
month, day, year = map(int, input().split())
print(day_name[weekday(year, month, day)].upper())
| 4.125 | 4 |
tests/class/method06.py | ktok07b6/polyphony | 83 | 12793245 | <reponame>ktok07b6/polyphony<gh_stars>10-100
from polyphony import testbench
class C:
def __init__(self, x):
self.x = x * x
def calc(self, x):
for i in range(x):
self.x += 1
return self.x
def method06(x):
return C(x).calc(x)
@testbench
def test():
assert 2 == meth... | 2.71875 | 3 |
plugins/nmap.py | hack654a/w12scan-client | 159 | 12793246 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2019/1/21 10:05 PM
# @Author : w8ay
# @File : nmap.py
import nmap
from lib.data import logger
def nmapscan(host, ports):
# 接受从masscan上扫描出来的结果
# 为了可以多线程使用,此函数支持多线程调用
nm = nmap.PortScanner()
argument = "-sV -sS -Pn --host-timeout 1m -p{}".f... | 2.734375 | 3 |
Fig6-splocs/plotenergy.py | YuePengUSTC/AADR | 7 | 12793247 | <filename>Fig6-splocs/plotenergy.py<gh_stars>1-10
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
import os
from IPython.core.pylabtools import figsize
font1 = {'family': 'Times New Roman', 'weight': 'normal', 'size': 20}
font2 = {'family': 'Times New Roman', 'weight': 'normal', 'size':... | 2.203125 | 2 |
mysite/apps/repo/migrations/0002_auto_20190811_2046.py | lirixiang123/question_repo | 0 | 12793248 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-08-11 12:46
from __future__ import unicode_literals
import ckeditor_uploader.fields
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
... | 1.742188 | 2 |
route.py | PeterRyder/EveTradeRoute | 0 | 12793249 | <gh_stars>0
class Route:
def __init__(self, c, s, e):
self.client = c
self.start = s
self.end = e
#self.start = self.get_system(s)
#self.end = self.get_system(e)
def __repr__(self):
return str(self)
def __str__(self):
system_ids = self.get_distance()
return str([self.get_system(... | 2.78125 | 3 |
centrality.py | cerebis/MetaCarvel | 0 | 12793250 | import tqdm
import networkx as nx
import argparse
import numpy as np
import multiprocessing
import graph_tool as gt
from graph_tool.centrality import betweenness
parser = argparse.ArgumentParser()
parser.add_argument("-g", "--graph", help='bundled graph')
parser.add_argument("-l","--length",help="contig length")
parse... | 2.328125 | 2 |