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 |
|---|---|---|---|---|---|---|
scripts/evaluate_hatexplain.py | GKingA/POTATO | 26 | 21700 | <reponame>GKingA/POTATO
from typing import List, Dict
import json
import numpy as np
from pandas import DataFrame
import logging
from argparse import ArgumentParser, ArgumentError
from sklearn.metrics import classification_report
from xpotato.graph_extractor.extract import FeatureEvaluator
from xpotato.dataset.explaina... | 2.84375 | 3 |
agency/memory/__init__.py | jackharmer/agency | 2 | 21701 | <reponame>jackharmer/agency
from .episodic import EpisodicMemory, EpisodicBuffer
| 0.960938 | 1 |
examples/car_on_hill_fqi.py | doroK/mushroom | 0 | 21702 | <reponame>doroK/mushroom<filename>examples/car_on_hill_fqi.py<gh_stars>0
import numpy as np
from joblib import Parallel, delayed
from sklearn.ensemble import ExtraTreesRegressor
from mushroom.algorithms.value import FQI
from mushroom.core import Core
from mushroom.environments import *
from mushroom.policy import EpsG... | 2.234375 | 2 |
db.py | dashimaki360/mahjong-line-bot | 0 | 21703 | import os
from datetime import datetime
from flask_sqlalchemy import SQLAlchemy
# heroku postgresql setting
app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('DATABASE_URL', None)
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
db = SQLAlchemy(app)
class usermessage(db.Model):
'''
user message and reply d... | 2.609375 | 3 |
loss/voxel_match_loss.py | sennnnn/Refer-it-in-RGBD | 28 | 21704 | import torch
import torch.nn as nn
class voxel_match_loss(nn.Module):
def __init__(self):
super().__init__()
self.criterion=nn.MSELoss()
def forward(self,output,label):
positive_mask=torch.zeros(label.shape).cuda()
positive_mask=torch.where(label>0.2,torch.ones_like(positive_mas... | 2.59375 | 3 |
app/cachedmodel/migrations/0001_initial.py | Uniquode/uniquode2 | 0 | 21705 | <reponame>Uniquode/uniquode2
# Generated by Django 3.2.7 on 2021-09-19 03:41
from django.db import migrations, models
import django.db.models.deletion
import django.db.models.manager
class Migration(migrations.Migration):
initial = True
dependencies = [
('contenttypes', '0002_remove_content_type_na... | 1.679688 | 2 |
conduit/utils/awsbatch_operator.py | elenimath/saber | 12 | 21706 | # Copyright 2019 The Johns Hopkins University Applied Physics Laboratory
#
# 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 ... | 1.84375 | 2 |
csapi.py | ria-ee/X-Road-cs-api | 1 | 21707 | <reponame>ria-ee/X-Road-cs-api<gh_stars>1-10
#!/usr/bin/env python3
"""This is a module for X-Road Central Server API.
This module allows:
* adding new member to the X-Road Central Server.
* adding new subsystem to the X-Road Central Server.
"""
import json
import logging
import re
import psycopg2
from flask... | 2.234375 | 2 |
dotacni_matice/migrations/0002_history.py | CzechInvest/ciis | 1 | 21708 | <gh_stars>1-10
# Generated by Django 2.2.3 on 2019-12-27 18:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dotacni_matice', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='dotacnititul',
... | 1.523438 | 2 |
telegrambotapiwrapper/printpretty.py | pynista/telegrambotapiwrapper | 1 | 21709 | from collections import OrderedDict
from dataclasses import (
fields,
)
from prettyprinter.prettyprinter import pretty_call, register_pretty
def is_instance_of_dataclass(value):
try:
fields(value)
except TypeError:
return False
else:
return True
def pretty_dataclass_instance... | 2.890625 | 3 |
bot.py | ctrezevant/GEFS-bot | 0 | 21710 | <filename>bot.py
"""
GEFS Chart Bot
Polls https://www.tropicaltidbits.com/storminfo/11L_gefs_latest.png, but it can
really be used to monitor/notify about changes to any file on the web.
(c) <NAME> 2017
MIT License
Enjoy!
"""
import time, sys
sys.dont_write_bytecode = True
sys.path.insert(0, ... | 2.671875 | 3 |
tests/test_periodbase.py | pierfra-ro/astrobase | 45 | 21711 | <reponame>pierfra-ro/astrobase
'''test_periodbase.py - <NAME> (<EMAIL>) - Feb 2018
License: MIT - see the LICENSE file for details.
This tests the following:
- downloads a light curve from the github repository notebooks/nb-data dir
- reads the light curve using astrobase.hatlc
- runs the GLS, WIN, PDM, AoV, BLS, AoV... | 2.15625 | 2 |
tests/sdict/test_sdict_substitutor.py | nikitanovosibirsk/district42-exp-types | 0 | 21712 | <filename>tests/sdict/test_sdict_substitutor.py
from _pytest.python_api import raises
from baby_steps import given, then, when
from district42 import schema
from revolt import substitute
from revolt.errors import SubstitutionError
from district42_exp_types.sdict import schema_sdict
def test_sdict_substitution():
... | 2.328125 | 2 |
algo/problems/pascal_triangle.py | avi3tal/knowledgebase | 0 | 21713 | """
Pascal's Triangle
1
11
121
1331
14641
Question:
Find the value in given row and column
First solution: brute force
Second solution: Dynamic programming
alternative
def pascal(r, c):
print(f"row: {r}, col: {c}")
if r == 0 or r == 1 or c == 0:
return 1
return pascal(r-1, c-1) + pascal(r-1, c... | 3.859375 | 4 |
drf_ujson/parsers.py | radzhome/drf-ujson-renderer | 0 | 21714 | from __future__ import unicode_literals
import codecs
from django.conf import settings
from rest_framework.compat import six
from rest_framework.parsers import BaseParser, ParseError
from rest_framework import renderers
from rest_framework.settings import api_settings
import ujson
class UJSONParser(BaseParser):
... | 2.109375 | 2 |
Software_University/python_basics/exam_preparation/4_exam_prep/renovation.py | Ivanazzz/SoftUni-W3resource-Python | 1 | 21715 | <gh_stars>1-10
from math import ceil
walls_hight = int(input())
walls_witdh = int(input())
percentage_walls_tottal_area_not_painted = int(input())
total_walls_area = walls_hight * walls_witdh * 4
quadratic_meters_left = total_walls_area - ceil(total_walls_area * percentage_walls_tottal_area_not_painted / 100)
while ... | 3.4375 | 3 |
Order_Managment/GEMINI_OM/Order.py | anubhavj880/Jack | 0 | 21716 | class Order():
def __init__(self, exchCode, sym_, _sym, orderType, price, side, qty, stopPrice=''):
self.odid = None
self.status = None
self.tempOdid = None
self.sym_ = sym_
self._sym = _sym
self.symbol = sym_ + _sym
self.exchCode = exchCode.upper()
se... | 2.796875 | 3 |
Commands.py | ehasting/psybot | 0 | 21717 | import datetime
import re
import os
import requests
import json
import uuid
import random
import calendar
import time
import libs.SerializableDict as SerializableDict
import libs.StorageObjects as StorageObjects
import libs.Models as Models
import libs.Loggiz as Loggiz
from pytz import timezone
import pytz
import teleg... | 1.726563 | 2 |
aim/pytorch.py | avkudr/aim | 2,195 | 21718 | <reponame>avkudr/aim
# Alias to SDK PyTorch utils
from aim.sdk.adapters.pytorch import track_params_dists, track_gradients_dists # noqa
| 1.351563 | 1 |
src/tools/checkDeckByUrl.py | kentokura/xenoparts | 0 | 21719 | <gh_stars>0
# coding: utf-8
# Your code here!
import csv
def encode_cardd_by_url(url: str) -> dict:
"""
入力:デッキURL
出力:{ card_id, num }
処理:
URLから、カードidごとの枚数の辞書を作成する
"""
site_url, card_url = url.split("c=")
card_url, key_card_url = card_url.split("&")
arr_card_id = card_url.s... | 3.25 | 3 |
kleeneup/__init__.py | caiopo/kleeneup | 0 | 21720 | from .regular_grammar import RegularGrammar
from .finite_automaton import FiniteAutomaton, State, Symbol, Sentence
from .regular_expression import RegularExpression, StitchedBinaryTree, Lambda
| 1.328125 | 1 |
recipe_backend/recipes/apps.py | jbernal0019/Recipe_site | 0 | 21721 | <filename>recipe_backend/recipes/apps.py
from django.apps import AppConfig
class PluginsConfig(AppConfig):
name = 'recipes'
| 1.164063 | 1 |
mass_circular_weighing/constants.py | MSLNZ/Mass-Circular-Weighing | 1 | 21722 | <filename>mass_circular_weighing/constants.py
"""
A repository for constants and symbols used in the mass weighing program
Modify default folder paths as necessary
"""
import os
MU_STR = 'µ' # ALT+0181 or 'µ'. use 'u' if running into issues
SIGMA_STR = 'σ' # \u03C3 for sigma sign
DEL... | 2.390625 | 2 |
UsbVibrationDevice.py | Suitceyes-Project-Code/Vibration-Pattern-Player | 0 | 21723 | <gh_stars>0
import PyCmdMessenger
from VestDeviceBase import VestDevice
class UsbVestDevice(VestDevice):
"""
Basic interface for sending commands to the vest using a
serial port connection.
"""
commands = [["PinSet","gg"],
["PinMute","g"],
["GloveSet","gg*"],
... | 3.03125 | 3 |
webapi/tests/test_models.py | c2masamichi/webapp-example-python-django | 0 | 21724 | <filename>webapi/tests/test_models.py
from django.core.exceptions import ValidationError
import pytest
from api.models import Product
@pytest.mark.django_db
@pytest.mark.parametrize(
('name', 'price'),
(
('aa', 1000),
('a' * 21, 1000),
('house', 1000000001),
('minus', -1),
... | 2.46875 | 2 |
tests/app/main/views/test_users.py | AusDTO/dto-digitalmarketplace-admin-frontend | 1 | 21725 | <gh_stars>1-10
import mock
import pytest
import copy
import six
from lxml import html
from ...helpers import LoggedInApplicationTest
from dmapiclient import HTTPError
@mock.patch('app.main.views.users._user_info')
@mock.patch('app.main.views.users.data_api_client')
class TestUsersView(LoggedInApplicationTest):
... | 2.328125 | 2 |
code/makestellar.py | gitter-badger/DHOD | 0 | 21726 | <reponame>gitter-badger/DHOD
import numpy as np
import sys, os
from scipy.optimize import minimize
import json
import matplotlib.pyplot as plt
#
sys.path.append('./utils')
import tools
#
bs, ncf, stepf = 400, 512, 40
path = '../data/z00/'
ftype = 'L%04d_N%04d_S%04d_%02dstep/'
ftypefpm = 'L%04d_N%04d_S%04d_%02dstep_f... | 1.921875 | 2 |
mem_py/login/forms.py | Ciuel/Proyecto-Django | 0 | 21727 | from django import forms
from django.contrib.auth.forms import UserCreationForm,AuthenticationForm
from .models import UserProfile
# Create your forms here
class LoginForm(AuthenticationForm):
def __init__(self, request, *args, **kwargs):
super().__init__(self, request, *args, **kwargs)
self.fiel... | 2.796875 | 3 |
diagrams/alibabacloud/analytics.py | bry-c/diagrams | 17,037 | 21728 | <reponame>bry-c/diagrams
# This module is automatically generated by autogen.sh. DO NOT EDIT.
from . import _AlibabaCloud
class _Analytics(_AlibabaCloud):
_type = "analytics"
_icon_dir = "resources/alibabacloud/analytics"
class AnalyticDb(_Analytics):
_icon = "analytic-db.png"
class ClickHouse(_Analy... | 1.351563 | 1 |
numpy_examples/basic_5_structured_arrays.py | stealthness/sklearn-examples | 0 | 21729 | """
Purpose of this file is to give examples of structured arrays
This script is partially dirived from the LinkedIn learning course
https://www.linkedin.com/learning/numpy-data-science-essential-training/create-arrays-from-python-structures
"""
import numpy as np
person_data_def = [('name', 'S6'), ('height', 'f8'),... | 4.15625 | 4 |
scripts/ebook_meta_rename.py | mcxiaoke/python-labs | 7 | 21730 | '''
File: ebook_fix.py
Created: 2021-03-06 15:46:09
Modified: 2021-03-06 15:46:14
Author: mcxiaoke (<EMAIL>)
License: Apache License 2.0
'''
import sys
import os
from pprint import pprint
from types import new_class
from mobi import Mobi
from ebooklib import epub
import argparse
from multiprocessing.dummy import Pool
f... | 2.59375 | 3 |
sources/boltun/util/collections.py | meiblorn/boltun | 1 | 21731 | <filename>sources/boltun/util/collections.py
from __future__ import absolute_import, division, print_function
import attr
@attr.s
class Stack(object):
__items = attr.ib(type=list, factory=list)
def push(self, item):
self.__items.append(item)
def pop(self):
return self.__items.pop()
... | 2.421875 | 2 |
test/python/echo_hi_then_error.py | WrkMetric/Python--NodeJS | 1,869 | 21732 | <reponame>WrkMetric/Python--NodeJS
print('hi')
raise Exception('fibble-fah') | 1.960938 | 2 |
lamdata_baisal89/df_util.py | Baisal89/ds_8_lamdata | 0 | 21733 | <reponame>Baisal89/ds_8_lamdata<filename>lamdata_baisal89/df_util.py
"""
Utility functions for working with DataFrame
"""
import pandas
TEST_DF = pandas.DataFrame([1,2,3])
| 1.703125 | 2 |
lab05/parsePhoneNrs.py | peter201943/pjm349-CS265-winter2019 | 0 | 21734 | #!/usr/bin/env python3
#
#<NAME>
#
# <NAME>
# 7/06
#
#
# parsePhoneNrs.py - an example of 'grouping' - extracting parts of a match
#
# Python 3.5.2
# on Linux 4.4.0-36-generic x86_64
#
# Demonstrates: regexp, re, search, groups
#
# Usage: By default, reads telNrs.txt . You may supply a different filename
#
# Notes:
... | 3.859375 | 4 |
board/gpio.py | JonathanItakpe/realtime-office-light-dashboard | 1 | 21735 | import RPi.GPIO as gpio
from pusher import Pusher
import time
pusher = Pusher(app_id=u'394325', key=u'<KEY>', secret=u'02ae96830fe03a094573', cluster=u'eu')
gpio.setmode(gpio.BCM)
gpio.setup(2, gpio.OUT)
# TODO: Map each gpio pin to a room eg 2: HNG Main
while True:
gpio.output(2, gpio.OUT)
passcode = raw_input('Wh... | 3.171875 | 3 |
courses/python/mflac/vuln_app/patched_admin.py | tank1st99/securitygym | 49 | 21736 | import functools
from flask import Blueprint
from flask import render_template
from flask import g
from flask import redirect
from flask import url_for
from flask import flash
from mflac.vuln_app.db import get_db
bp = Blueprint("admin", __name__, url_prefix="/admin")
def admin_required(view):
@functools.wraps(... | 2.359375 | 2 |
inpainting/common/eval_test.py | yuyay/ASNG-NAS | 96 | 21737 | <filename>inpainting/common/eval_test.py
import os
import pandas as pd
import torch
from torch import nn
import common.utils as util
import scipy.misc as spmi
def save_img(img_np, file_name, out_dir='./'):
if not os.path.exists(out_dir):
os.makedirs(out_dir)
image = img_np.copy().transpose(1, 2, 0)
... | 2.15625 | 2 |
connectivity/connectivity.py | vagechirkov/NI-project | 1 | 21738 | <filename>connectivity/connectivity.py<gh_stars>1-10
import numpy as np
import matplotlib.pyplot as plt
import networkx as nx
from nxviz import CircosPlot
from neurolib.utils import atlases
# https://doi.org/10.1016/j.neuroimage.2015.07.075 Table 2
# number corresponds to AAL2 labels indices
CORTICAL_REGIONS = {
... | 2.640625 | 3 |
secao5/exercicio6.py | robinson-1985/exercicios_python_geek_university | 0 | 21739 | <filename>secao5/exercicio6.py
'''6. Escreva um programa que, dados dois números inteiros, mostre na tela o maior deles,
assim como a diferença existente entre ambos.'''
| 2.28125 | 2 |
src/conf.py | RJTK/dwglasso_cweeds | 0 | 21740 | <reponame>RJTK/dwglasso_cweeds
'''
This is the config file for the code in src/. Essentially it
holds things like file and variable names.
'''
# The folder locations of the below files are specified by the
# cookie cutter data science format and are hardcoded into the code.
# I'm not entirely sure that that was the b... | 2.453125 | 2 |
HackerEarth/Python/BasicProgramming/InputOutput/BasicsOfInputOutput/MinimizeCost.py | cychitivav/programming_exercises | 0 | 21741 | #!/Usr/bin/env python
"""
You are given an array of numbers Ai which contains positive as well as negative numbers . The cost of the array can be defined as C(X)
C(x) = |A1 + T1| + |A2 + T2| + ... + |An + Tn|, where T is the transfer array which contains N zeros initially.
You need to minimize this cost. You ca... | 4.125 | 4 |
pava/implementation/natives/java/net/TwoStacksPlainSocketImpl.py | laffra/pava | 4 | 21742 | def add_native_methods(clazz):
def initProto____():
raise NotImplementedError()
def socketCreate__boolean__(a0, a1):
raise NotImplementedError()
def socketConnect__java_net_InetAddress__int__int__(a0, a1, a2, a3):
raise NotImplementedError()
def socketBind__java_net_InetAddres... | 2.03125 | 2 |
ansible/utils/check_droplet.py | louis-pre/NewsBlur | 3,073 | 21743 | <reponame>louis-pre/NewsBlur
import sys
import time
import digitalocean
import subprocess
def test_ssh(drop):
droplet_ip_address = drop.ip_address
result = subprocess.call(f"ssh -o StrictHostKeyChecking=no root@{droplet_ip_address} ls", shell=True)
if result == 0:
return True
return False
TOKE... | 2.609375 | 3 |
logmappercommon/definitions/logmapperkeys.py | abaena78/logmapper-master | 0 | 21744 | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 8 09:45:29 2018
@author: abaena
"""
DATATYPE_AGENT = 'agent'
DATATYPE_PATH_METRICS = 'pathmet'
DATATYPE_LOG_EVENTS = 'logeve'
DATATYPE_LOG_METRICS = 'logmet'
DATATYPE_MONITOR_HOST = 'host'
DATATYPE_MONITOR_MICROSERVICE = 'ms'
DATATYPE_MONITOR_TOMCAT = 'tomc'
DATATYPE_... | 1.234375 | 1 |
construct/expr.py | DominicAntonacci/construct | 57 | 21745 | <gh_stars>10-100
import operator
if not hasattr(operator, "div"):
operator.div = operator.truediv
opnames = {
operator.add : "+",
operator.sub : "-",
operator.mul : "*",
operator.div : "/",
operator.floordiv : "//",
operator.mod : "%",
operator.pow : "**",
operator.xor : "^",
o... | 2.59375 | 3 |
ci/unit_tests/functions_deploy/main_test.py | xverges/watson-assistant-workbench | 1 | 21746 | """
Copyright 2019 IBM Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... | 1.867188 | 2 |
python_scripts/tip_loss/tip_loss.py | lawsonro3/python_scripts | 0 | 21747 | import numpy as np
import matplotlib.pyplot as plt
plt.close('all')
# From section 3.8.3 of wind energy explained
# Prandlt tip loss calc
B = 3 # number of blades
R = 1 # blade length
phi = np.deg2rad(10) # relative wind angle
r = np.linspace(0,R,100)
F = 2/np.pi * np.arccos(np.exp(-((B/2)*(1-(r/R)))/((r/R)*np.sin(phi... | 3.234375 | 3 |
filter/mot.py | oza6ut0ne/CVStreamer | 0 | 21748 | <filename>filter/mot.py
import time
import cv2
import numpy as np
class Filter(object):
'''detects motions with cv2.BackgroundSubtractorMOG2'''
def __init__(self, params):
self.params = params
try:
varThreshold = float(params[0])
if varThreshold <= 0:
v... | 2.84375 | 3 |
social_auth/backends/contrib/vkontakte.py | ryr/django-social-auth | 0 | 21749 | """
VKontakte OpenAPI and OAuth 2.0 support.
This contribution adds support for VKontakte OpenAPI and OAuth 2.0 service in the form
www.vkontakte.ru. Username is retrieved from the identity returned by server.
"""
from django.conf import settings
from django.contrib.auth import authenticate
from django.utils import s... | 2.390625 | 2 |
main.py | Harmanjit14/face-distance-detector | 0 | 21750 | <reponame>Harmanjit14/face-distance-detector
import cv2
import cvzone
from cvzone.FaceMeshModule import FaceMeshDetector
import numpy as np
cap = cv2.VideoCapture(0)
detector = FaceMeshDetector()
text = ['Hello there.', 'My Name is Harman', 'I am bored!']
while True:
success, img = cap.read()
img, faces = de... | 3.0625 | 3 |
bokeh/util/terminal.py | kinghows/bokeh | 1 | 21751 | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... | 1.804688 | 2 |
exp.py | SOPSLab/SwarmAggregation | 0 | 21752 | # Project: SwarmAggregation
# Filename: exp.py
# Authors: <NAME> (<EMAIL>) and <NAME>
# (<EMAIL>).
"""
exp: A flexible, unifying framework for defining and running experiments for
swarm aggregation.
"""
import argparse
from aggregation import aggregation, ideal
from itertools import produ... | 2.546875 | 3 |
pychron/experiment/tests/comment_template.py | ael-noblegas/pychron | 1 | 21753 | <filename>pychron/experiment/tests/comment_template.py<gh_stars>1-10
from __future__ import absolute_import
__author__ = 'ross'
import unittest
from pychron.experiment.utilities.comment_template import CommentTemplater
class MockFactory(object):
irrad_level = 'A'
irrad_hole = '9'
class CommentTemplaterTe... | 2.578125 | 3 |
apps/roles/views.py | andipandiber/CajaAhorros | 0 | 21754 | <filename>apps/roles/views.py
from django.shortcuts import render
from django.urls import reverse_lazy
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic import CreateView, ListView, UpdateView, DeleteView, TemplateView
from .models import Role
class baseView(LoginRequiredMixin, Tem... | 2.078125 | 2 |
vjezba5/DPcli-part.py | vmilkovic/primjena-blockchain-tehnologije | 0 | 21755 | import rpyc
from Crypto.Signature import pkcs1_15
from Crypto.Hash import SHA256
from Crypto.PublicKey import RSA
#############
## KLIJENT ##
#############
def generiraj_kljuceve():
key = RSA.generate(2048)
#stvaranje i spremanje privatnog ključa u datoteku
file_out = open("private_key.pem", "wb")
fil... | 2.53125 | 3 |
waiguan/layers/modules/__init__.py | heixialeeLeon/SSD | 0 | 21756 | <gh_stars>0
from .l2norm import L2Norm
from .multibox_loss import MultiBoxLoss
from .multibox_focalloss import MultiBoxFocalLoss
__all__ = ['L2Norm', 'MultiBoxLoss', 'MultiBoxFocalLoss'] | 1.125 | 1 |
hlwtadmin/migrations/0035_location_disambiguation.py | Kunstenpunt/havelovewilltravel | 1 | 21757 | <filename>hlwtadmin/migrations/0035_location_disambiguation.py
# Generated by Django 3.0 on 2020-07-22 08:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hlwtadmin', '0034_auto_20200722_1000'),
]
operations = [
migrations.AddField(
... | 1.460938 | 1 |
819. Rotate Array/Slicing.py | tulsishankarreddy/leetcode | 1 | 21758 | ''' This can be solved using the slicing method used in list. We have to modify the list by take moving the
last part of the array in reverse order and joining it with the remaining part of the list to its right'''
class Solution:
def rotate(self, nums: List[int], k: int) -> None:
"""
Do not return... | 4.15625 | 4 |
src/pdfOut.py | virus-on/magister_work | 2 | 21759 | <reponame>virus-on/magister_work
#!/usr/bin/env python3
import subprocess
import time
class PDFOutput:
def __init__(self, title_template_file, template_file, output_file):
self.title_template_file = title_template_file
self.template_file = template_file
self.output_file = output_file
... | 2.40625 | 2 |
ecs/notifications/models.py | programmierfabrik/ecs | 9 | 21760 | from importlib import import_module
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ugettext
from django.template import loader
from django.utils.text import slugify
from django.utils import timezone
from revers... | 1.90625 | 2 |
event/event_handler.py | rafty/ServerlessEventSoutcing | 0 | 21761 | <filename>event/event_handler.py
# -*- coding: utf-8 -*-
import logging
from functools import reduce
from retrying import retry
from model import EventStore, Snapshot
from error import ItemRanShort, IntegrityError
from retry_handler import is_integrity_error, is_not_item_ran_short
logger = logging.getLogger()
logger.s... | 2.15625 | 2 |
iwjam_import.py | patrickgh3/iwjam | 0 | 21762 | <reponame>patrickgh3/iwjam<filename>iwjam_import.py
from lxml import etree
import os
import sys
import shutil
import iwjam_util
# Performs an import of a mod project into a base project given a
# previously computed ProjectDiff between them,
# and a list of folder names to prefix
# ('%modname%' will be replaced with t... | 2.375 | 2 |
subspacemethods/basesubspace.py | AdriBesson/spl2018_joint_sparse | 2 | 21763 | from abc import ABCMeta, abstractmethod
import numpy as np
class BaseSubspace(metaclass=ABCMeta):
def __init__(self, measurements=None, A=None, k=None, rank=None, pks=[], name=''):
# Check A
if A is None:
self.__A = np.asarray(a=1, dtype=measurements.dtype)
else:
# C... | 3.015625 | 3 |
glow/generate_data_sources.py | tomcent-tom/glow | 0 | 21764 | from connectors.tableau.tableau import TableauConnector
from posixpath import join
from typing import List, Dict, Tuple
import argparse
import connectors.tableau
import os
import utils
import logging
import sys
import yaml
logging.basicConfig(level=logging.INFO)
MAIN_PATH = '/Users/tomevers/projects/airglow'
CONNEC... | 2.484375 | 2 |
src/app/views/cookbook/recipe.py | rico0821/fridge | 0 | 21765 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
app.views.cookbook.recipe
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module for handling recipe view and upload.
--
:copyright: (c)2020 by rico0821
"""
from bson.objectid import ObjectId
from datetime import datetime
from flask import abort, request
from... | 2.03125 | 2 |
modules/password.py | MasterBurnt/ToolBurnt | 1 | 21766 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# @name : PassList
# @url : http://github.com/MasterBurnt
# @author : MasterBurnt
#Libraries
from concurrent.futures import ThreadPoolExecutor
import datetime,os,sys,random,time
from colorama import Fore,init,Style
#C&B&I
init()
c1 = Style.BRIGHT + F... | 2.40625 | 2 |
dvc/parsing/__init__.py | mbraakhekke/dvc | 0 | 21767 | import logging
from itertools import starmap
from funcy import join
from .context import Context
from .interpolate import resolve
logger = logging.getLogger(__name__)
STAGES = "stages"
class DataResolver:
def __init__(self, d):
self.context = Context()
self.data = d
def _resolve_entry(sel... | 2.5625 | 3 |
Mundo 2/Aula14.Ex59.py | uirasiqueira/Exercicios_Python | 0 | 21768 | <reponame>uirasiqueira/Exercicios_Python<gh_stars>0
'''Crie um programa que leia dois valores e mostre um menu na tela:
[1] somar
[2] multiplicar
[3] maior
[4] novos numeros
[5] sair do programa
Seu programa devera realizar a operação solicitada em cada caso'''
v1= int(input('Digite um numero:... | 4.21875 | 4 |
interviewbit/TwoPointers/kthsmallest.py | zazhang/coding-problems | 0 | 21769 | <gh_stars>0
#!usr/bin/env ipython
"""Coding interview problem (array, math):
See `https://www.interviewbit.com/problems/kth-smallest-element-in-the-array/`
Find the kth smallest element in an unsorted array of non-negative integers.
Definition of kth smallest element:
kth smallest element is the minimum possible n... | 3.875 | 4 |
grab_screen/__init__.py | andrei-shabanski/grab-screen | 9 | 21770 | <reponame>andrei-shabanski/grab-screen
from .cli import main
from .version import __version__
__all__ = ['__version__', 'main']
| 0.914063 | 1 |
Test/test_conf_ap/conf_hostapd/create_config.py | liquidinvestigations/wifi-test | 0 | 21771 | <gh_stars>0
#!/usr/bin/env python
from hostapdconf.parser import HostapdConf
from hostapdconf import helpers as ha
import subprocess
def create_hostapd_conf(ssid, password, interface):
"""
Create a new hostapd.conf with the given ssid, password, interface.
Overwrites the current config file.
"""
... | 2.609375 | 3 |
tests/test_paddle.py | ankitshah009/MMdnn | 3,442 | 21772 | from __future__ import absolute_import
from __future__ import print_function
import os
import sys
from conversion_imagenet import TestModels
from conversion_imagenet import is_paddle_supported
def get_test_table():
return { 'paddle' : {
'resnet50' : [
TestModels.onnx_emit,
... | 2.171875 | 2 |
cabinet/tools.py | cauabernardino/cabinet | 0 | 21773 | <reponame>cauabernardino/cabinet
import pathlib
import shutil
from typing import Dict, List, Union
from cabinet.consts import SUPPORTED_FILETYPES
def dir_parser(path_to_dir: str) -> Dict[str, Dict[str, str]]:
"""
Parses the given directory, and returns the path, stem and suffix for files.
"""
files =... | 2.734375 | 3 |
stickyuploads/utils.py | caktus/django-sticky-uploads | 11 | 21774 | <filename>stickyuploads/utils.py<gh_stars>10-100
from __future__ import unicode_literals
import os
from django.core import signing
from django.core.exceptions import ImproperlyConfigured
from django.core.files.storage import get_storage_class
from django.utils.functional import LazyObject
def serialize_upload(name,... | 2.234375 | 2 |
build/beginner_tutorials/cmake/beginner_tutorials-genmsg-context.py | aracelis-git/beginner_tutorials | 0 | 21775 | <reponame>aracelis-git/beginner_tutorials
# generated from genmsg/cmake/pkg-genmsg.context.in
messages_str = "/home/viki/catkin_ws/src/beginner_tutorials/msg/Num.msg"
services_str = "/home/viki/catkin_ws/src/beginner_tutorials/srv/ResetCount.srv;/home/viki/catkin_ws/src/beginner_tutorials/srv/AddTwoInts.srv"
pkg_name ... | 1.21875 | 1 |
demo/utils.py | NguyenTuan-Dat/Custom_3D | 41 | 21776 | <reponame>NguyenTuan-Dat/Custom_3D
import os
import cv2
import numpy as np
import torch
import torch.nn as nn
import yaml
class Encoder(nn.Module):
def __init__(self, cin, cout, nf=64, activation=nn.Tanh):
super(Encoder, self).__init__()
network = [
nn.Conv2d(cin, nf, kernel_size=4, s... | 2.609375 | 3 |
examples/scannet_normals/data.py | goodok/fastai_sparse | 49 | 21777 | <filename>examples/scannet_normals/data.py
# -*- coding: utf-8 -*-
from functools import partial
from fastai_sparse.data import SparseDataBunch
merge_fn = partial(SparseDataBunch.merge_fn, keys_lists=['id', 'labels_raw', 'filtred_mask', 'random_seed', 'num_points'])
| 1.671875 | 2 |
plugins/okta/komand_okta/actions/reset_password/schema.py | lukaszlaszuk/insightconnect-plugins | 46 | 21778 | # GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Component:
DESCRIPTION = "This action resets password for Okta user and transitions user status to PASSWORD_EXPIRED, so that the user is required to change their password at their next login"
class Input:
TEMP_PASSWORD = "<PASSWORD>"
... | 2.65625 | 3 |
Recursion/recursiopow.py | TheG0dfath3r/Python | 0 | 21779 | x=int(input("no 1 "))
y=int(input("no 2 "))
def pow(x,y):
if y!=0:
return(x*pow(x,y-1))
else:
return 1
print(pow(x,y))
| 3.953125 | 4 |
scripts/egomotion_kitti_eval/old/generate_grid_search_validation_freak_stage2.py | bartn8/stereo-vision | 52 | 21780 | <reponame>bartn8/stereo-vision<filename>scripts/egomotion_kitti_eval/old/generate_grid_search_validation_freak_stage2.py
#!/usr/bin/python
hamming_threshold = [50, 60]
pattern_scale = [4.0, 6.0, 8.0, 10.0]
fp_runscript = open("/mnt/ssd/kivan/cv-stereo/scripts/eval_batch/run_batch_validation.sh", 'w')
fp_runscript.wri... | 2.171875 | 2 |
tensorflow_tts/processor/baker_online_tts.py | outman2008/TensorFlowTTS | 0 | 21781 | <filename>tensorflow_tts/processor/baker_online_tts.py
#!/usr/bin/env python
# coding: utf-8
# 调用方式
# python online_tts.py -client_secret=你的client_secret -client_id=你的client_secret -file_save_path=test.wav --text=今天天气不错哦 --audiotype=6
from typing import TextIO
import requests
import json
import argparse
import os
impo... | 2.34375 | 2 |
gnuradio-3.7.13.4/gr-qtgui/apps/plot_spectrogram_base.py | v1259397/cosmic-gnuradio | 1 | 21782 | <reponame>v1259397/cosmic-gnuradio
#!/usr/bin/env python
#
# Copyright 2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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; eithe... | 1.78125 | 2 |
unused/csv_slicer_crop_threshold.py | eufmike/storm_image_processing | 0 | 21783 | <filename>unused/csv_slicer_crop_threshold.py
# %%
# slice the csv according to the frame size
import os, sys
import pandas as pd
# from tkinter import *
# Functions Section Begins ----------------------------------------------------- #
def dircheck(targetpaths):
"""
dircheck checks the target folder and create the ... | 3.09375 | 3 |
doodle.py | plasticuproject/DoodleNet | 2 | 21784 | <reponame>plasticuproject/DoodleNet
import pygame
import random
import numpy as np
import cv2
from dutil import add_pos
#User constants
device = "gpu"
model_fname = 'Model.h5'
background_color = (210, 210, 210)
input_w = 144
input_h = 192
image_scale = 3
image_padding = 10
mouse_interps = 10
#Derived constants
drawi... | 2.375 | 2 |
tests/dmon/test_dmon.py | Bounti/avatar2_dmon | 0 | 21785 | <reponame>Bounti/avatar2_dmon
from avatar2 import *
import sys
import os
import logging
import time
import argparse
import subprocess
import struct
import ctypes
from random import randint
# For profiling
import pstats
import numpy as np
import numpy.testing as npt
logging.basicConfig(filename='/tmp/inception-tests.... | 2.265625 | 2 |
lexer/scanner.py | lohhans/Compiladores-2020.4 | 3 | 21786 | from lexer.token import Token
class Scanner:
# Construtor da classe
def __init__(self, programa):
self.inicio = 0
self.atual = 0
self.linha = 1
self.tokens = []
self.programa = programa
# Busca caracteres, passa para o próximo char (atual é o char a frente do que ... | 3.71875 | 4 |
tests/test_laser.py | chiragjn/laserembeddings | 0 | 21787 | import os
import pytest
import numpy as np
from laserembeddings import Laser
SIMILARITY_TEST = os.getenv('SIMILARITY_TEST')
def test_laser():
with open(Laser.DEFAULT_ENCODER_FILE, 'rb') as f_encoder:
laser = Laser(
Laser.DEFAULT_BPE_CODES_FILE,
None,
f_encoder,
... | 2.3125 | 2 |
alipay/aop/api/domain/TaxReceiptOnceInfo.py | antopen/alipay-sdk-python-all | 0 | 21788 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class TaxReceiptOnceInfo(object):
def __init__(self):
self._cognizant_mobile = None
self._ep_tax_id = None
@property
def cognizant_mobile(self):
return self... | 2.046875 | 2 |
Make-Sense-of-Census/code.py | NishantNair14/greyatom-python-for-data-science | 0 | 21789 | # --------------
# Importing header files
import numpy as np
# Path of the file has been stored in variable called 'path'
#New record
new_record=[[50, 9, 4, 1, 0, 0, 40, 0]]
#Code starts here
data_file='subset_1000.csv'
data=np.genfromtxt(path,delimiter=",",skip_header=1)
print(data)
census=np.conc... | 3.375 | 3 |
scripts/rgb2labels.py | theRealSuperMario/supermariopy | 36 | 21790 | import numpy as np
from matplotlib import pyplot as plt
"""
https://stackoverflow.com/questions/42750910/convert-rgb-image-to-index-image/62980021#62980021
convert semantic labels from RGB coding to index coding
Steps:
1. define COLORS (see below)
2. hash colors
3. run rgb2index(segmentation_rgb)
see example below
T... | 3.75 | 4 |
app/models/template.py | FireFragment/memegen | 0 | 21791 | import asyncio
import shutil
from functools import cached_property
from pathlib import Path
import aiopath
from datafiles import datafile, field
from furl import furl
from sanic import Request
from sanic.log import logger
from .. import settings, utils
from ..types import Dimensions
from .overlay import Overlay
from ... | 2.046875 | 2 |
corpora_toolbox/utils/io.py | laurahzdz/corpora_toolbox | 0 | 21792 | import codecs
import os
# Function to save a string into a file
def save_string_in_file(string_text, file_name):
with codecs.open(file_name, "w", "utf-8") as f:
f.write(string_text)
f.close()
# Function to read all files in a dir with a specific extension
def read_files_in_dir_ext(dir_route, exten... | 3.84375 | 4 |
Games/WarCardGame.py | AyselHavutcu/PythonGames | 0 | 21793 | <reponame>AyselHavutcu/PythonGames<gh_stars>0
import random
suits = ('Hearts', 'Diamonds', 'Spades', 'Clubs')
ranks = ('Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Jack', 'Queen', 'King', 'Ace')
values = {'Two':2, 'Three':3, 'Four':4, 'Five':5, 'Six':6, 'Seven':7, 'Eight':8,
'Ni... | 4.09375 | 4 |
startracker/beast/beast.py | Oregon-Tech-Rocketry-and-Aerospace/space-debris-card | 0 | 21794 | # This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.2
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0):
raise Runtime... | 1.96875 | 2 |
development_playgrounds/transformation_planar_flow_test.py | ai-di/Brancher | 208 | 21795 | <filename>development_playgrounds/transformation_planar_flow_test.py
import matplotlib.pyplot as plt
import numpy as np
import torch
from brancher.variables import ProbabilisticModel
from brancher.standard_variables import NormalVariable, DeterministicVariable, LogNormalVariable
import brancher.functions as BF
from br... | 2.390625 | 2 |
src/onegov/people/models/membership.py | politbuero-kampagnen/onegov-cloud | 0 | 21796 | from onegov.core.orm import Base
from onegov.core.orm.mixins import ContentMixin
from onegov.core.orm.mixins import TimestampMixin
from onegov.core.orm.mixins import UTCPublicationMixin
from onegov.core.orm.types import UUID
from onegov.search import ORMSearchable
from sqlalchemy import Column
from sqlalchemy import Fo... | 2.375 | 2 |
setup.py | drrobotk/multilateral_index_calc | 3 | 21797 | <reponame>drrobotk/multilateral_index_calc<gh_stars>1-10
from gettext import find
from setuptools import setup, find_packages
setup(
name='PriceIndexCalc',
version='0.1-dev9',
description='Price Index Calculator using bilateral and multilateral methods',
author='Dr. <NAME>',
url='https://github.com... | 1.40625 | 1 |
cryptofeed_werks/bigquery_storage/constants.py | globophobe/crypto-tick-data | 0 | 21798 | import os
try:
from google.cloud import bigquery # noqa
except ImportError:
BIGQUERY = False
else:
BIGQUERY = True
GOOGLE_APPLICATION_CREDENTIALS = "GOOGLE_APPLICATION_CREDENTIALS"
BIGQUERY_LOCATION = "BIGQUERY_LOCATION"
BIGQUERY_DATASET = "BIGQUERY_DATASET"
def use_bigquery():
return (
B... | 1.921875 | 2 |
todoapp/todos/models.py | Buddheshwar-Nath-Keshari/test-ubuntu | 0 | 21799 | <filename>todoapp/todos/models.py<gh_stars>0
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import smart_text as smart_unicode
from django.utils.translation import ugettext_lazy as _
class Todo(models.Model):
"""
Needed fields
- user (fk to User Mo... | 2.140625 | 2 |