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 |
|---|---|---|---|---|---|---|
test_autolens/plot/grids/regular_grid.py | rakaar/PyAutoLens | 0 | 12790151 | import autolens as al
grid = al.Grid.uniform(shape_2d=(10, 10), pixel_scales=1.0)
aplt.Grid(grid=grid)
grid = al.Grid.uniform(shape_2d=(10, 10), pixel_scales=1.0, origin=(5.0, 5.0))
aplt.Grid(grid=grid, symmetric_around_centre=False)
| 2.234375 | 2 |
data_utils.py | camille1874/ads_classify | 0 | 12790152 | <reponame>camille1874/ads_classify
import tensorflow as tf
import pandas as pd
from collections import Counter
from imblearn.combine import SMOTEENN
from imblearn.combine import SMOTETomek
from imblearn.under_sampling import NearMiss
import numpy as np
def scale(df, column):
df[column] = (df[column] - df[column].... | 2.484375 | 2 |
dolo/algos/dtmscc/accuracy.py | zlqs1985/dolo | 0 | 12790153 | from __future__ import division
def compute_residuals(model, dr, grid):
ff = model.functions['arbitrage']
gg = model.functions['transition']
aa = model.functions['auxiliary']
f = lambda m,s,x,M,S,X,p: ff(m,s,x,aa(m,s,x,p),M,S,X,aa(M,S,X,p),p)
g = lambda m,s,x,M,p: gg(m,s,x,aa(m,s,x,p),M,p)
P... | 2.21875 | 2 |
app/views/members/routes.py | sagarkaurav/worktable | 3 | 12790154 | import datetime
from app import db, mail
from app.models import Member, MemberInvite
from flask import Blueprint, flash, redirect, render_template, request, url_for
from flask_login import current_user, login_required, login_user
from flask_mail import Message
from .forms import MemberInviteForm, MemberJoinForm
memb... | 2.390625 | 2 |
HLTrigger/Configuration/python/HLT_75e33/tasks/pfClusteringECALTask_cfi.py | PKUfudawei/cmssw | 1 | 12790155 | <reponame>PKUfudawei/cmssw
import FWCore.ParameterSet.Config as cms
from ..modules.particleFlowClusterECALUncorrected_cfi import *
from ..modules.particleFlowRecHitECAL_cfi import *
from ..tasks.particleFlowClusterECALTask_cfi import *
pfClusteringECALTask = cms.Task(
particleFlowClusterECALTask,
particleFlow... | 1.0625 | 1 |
examples/dataflow-python-examples/streaming-examples/slowlychanging-sideinput/sideinput_refresh/dofns.py | ruchirjain86/professional-services | 2,116 | 12790156 | # Copyright 2020 Google 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 required by applicable law or agreed to in writing,... | 2.140625 | 2 |
backend/apps/mails/views.py | KuanWeiLee/froggy-service | 174 | 12790157 | <gh_stars>100-1000
from django.shortcuts import redirect
from django.urls import reverse
from rest_framework.viewsets import ModelViewSet
from rest_framework.decorators import action
from rest_framework.permissions import IsAdminUser
from .models import SendGridMail
from .serializers import SendGridMailSerializer
cla... | 1.789063 | 2 |
Collection/ms/01 Arrays/01_two_sum.py | kmanadkat/leetcode-101 | 0 | 12790158 | from typing import List
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
dt = {}
for index, num in enumerate(nums):
# Check If Complement Exists in dictionary
complement = target - num
if complement in dt and dt[complement] != index:... | 3.421875 | 3 |
app/auth_app/views.py | ganggas95/simdus_app | 0 | 12790159 | from flask import (
render_template,
request,
redirect,
url_for)
from flask_login import login_user, logout_user
from app.helpers import BaseView
from .models import LoginForm, User
class AuthView(BaseView):
def dispatch_request(self):
form = LoginForm(request.form)
if request.meth... | 2.5 | 2 |
curiosity/interaction/update_step.py | neuroailab/curiosity_deprecated | 0 | 12790160 | <reponame>neuroailab/curiosity_deprecated
'''
Defines the training step.
'''
import sys
sys.path.append('tfutils')
import tensorflow as tf
from tfutils.base import get_optimizer, get_learning_rate
import numpy as np
import cv2
from curiosity.interaction import models
import h5py
import json
class RawDepthDiscreteAc... | 2.078125 | 2 |
tests/conftest.py | alex-torok/pybuildkite | 1 | 12790161 | <filename>tests/conftest.py
import pytest
from unittest.mock import Mock
@pytest.fixture
def fake_client() -> Mock:
"""
Build a fake API client
"""
return Mock(get=Mock())
| 2.28125 | 2 |
ImgOperator/Oporation.py | keyofdeath/AugmentedReality | 0 | 12790162 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class Oporation():
def __init__(self):
pass
def apply(self, img):
pass
if __name__ == "__main__":
pass | 1.398438 | 1 |
worknoteBookHelpers.py | JanKrAppel/worknoteBook | 0 | 12790163 | <reponame>JanKrAppel/worknoteBook
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 2 18:06:23 2015
@author: appel
"""
def parse_index(index):
from worknote.items import parse_index
return parse_index(index)[0:2]
def gen_index(index):
try:
return u':'.join([str(i) for i in index[0:2]])
exce... | 2.421875 | 2 |
gpytorch/utils/grid.py | yushangdi/gpytorch | 0 | 12790164 | <filename>gpytorch/utils/grid.py<gh_stars>0
#!/usr/bin/env python3
import math
import torch
def scale_to_bounds(x, lower_bound, upper_bound):
"""
Scale the input data so that it lies in between the lower and upper bounds.
Args:
:attr:`x` (Tensor `n` or `b x n`):
the input
:at... | 2.78125 | 3 |
cookbook/c07/p11_inline_callback.py | Xiao-jiuguan/python3-cookbook | 3 | 12790165 | <reponame>Xiao-jiuguan/python3-cookbook
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
Topic: 内联回调函数
Desc :
"""
from queue import Queue
from functools import wraps
def apply_async(func, args, *, callback):
# Compute the result
result = func(*args)
# Invoke the callback with the result
callback(... | 3.625 | 4 |
huggingface_transformers/preprocessing_fn.py | ML3ngiRNErT/funniness-regression | 0 | 12790166 | import pandas as pd
import re
import nltk
import spacy
import torch
from nltk.corpus import stopwords
from cleantext import clean
from ekphrasis.classes.preprocessor import TextPreProcessor
from torch.utils.data import Dataset
# Params for
clean_text_param = {
"lower":False, # lowercase text
... | 2.6875 | 3 |
projecto/urls.py | bfaguiar/Venda-d-Garagem | 0 | 12790167 | """projecto URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-base... | 2.75 | 3 |
models/support_vector_machine_regression_poly3.py | jtbai/glo-7027 | 0 | 12790168 | from models.basemodel import BaseModel
from sklearn import model_selection, svm
class SupportVectorMachineRegressionPoly3(BaseModel):
def _train(self, X_train, y_train):
parametres = {'gamma': [0.01, 0.1, 1], 'C': [1, 10, 100], 'degree': [2,3,4,5,6]}
grid_search = model_selection.GridSearchCV(svm... | 2.5 | 2 |
tests/integration/load_balancer_types/test_load_balancer_types.py | cenkalti/hcloud-python | 0 | 12790169 | <filename>tests/integration/load_balancer_types/test_load_balancer_types.py
class TestLoadBalancerTypesClient(object):
def test_get_by_id(self, hetzner_client):
load_balancer_type = hetzner_client.load_balancer_types.get_by_id(1)
assert load_balancer_type.id == 1
assert load_balancer... | 2.28125 | 2 |
nets/zoo/hrnet_config.py | hin1115/building_extraction_in_satellite_image | 7 | 12790170 | <reponame>hin1115/building_extraction_in_satellite_image
import yaml
import sys
import os
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname("__file__"))))
def parse(path):
with open(path, 'r') as f:
config = yaml.safe_load(f)
f.close()
return config
| 2.546875 | 3 |
src/player.py | thacd/tennis-scoring-system | 0 | 12790171 | <filename>src/player.py<gh_stars>0
class Player:
def __init__(self, name, set_point=0, game_point=0):
self.name = name
self.set_point = set_point
self.game_point = game_point
@property
def set_point(self):
return self.__set_point
@set_point.setter
def set_point(self... | 3.34375 | 3 |
example.py | jlenain/PhotALPsConv | 1 | 12790172 | #Example script to show use of PhotALPsConv.calc_conversion module.
# ---- Imports ------------------------------------- #
import numpy as np
import matplotlib.pyplot as plt
import PhotALPsConv.calc_conversion as CC
from PhotALPsConv.tools import median_contours
from optparse import OptionParser
# --------------------... | 2 | 2 |
daps/utils/deprecated/video.py | escorciav/deep-action-proposals | 28 | 12790173 | <filename>daps/utils/deprecated/video.py
import cv2
def dump_video(filename, clip, fourcc_str='X264', fps=30.0):
"""Write video on disk from a stack of images
Parameters
----------
filename : str
Fullpath of video-file to generate
clip : ndarray
ndarray where first dimension is us... | 3.046875 | 3 |
mathematics/number-theory/john-and-gcd-list.py | PingHuskar/hackerrank | 41 | 12790174 | # Mathematics > Number Theory > John and GCD list
# Help John in making a list from GCD list
#
# https://www.hackerrank.com/challenges/john-and-gcd-list/problem
#
import math
import functools
def gcd(*numbers):
""" greatest common divisor """
return functools.reduce(math.gcd, numbers)
def lcm(*numbers):
... | 3.78125 | 4 |
Python Advanced/Advanced/Exams/19 August 2020/Task03.py | IvanTodorovBG/SoftUni | 1 | 12790175 | def numbers_searching(*args):
answer = []
duplicate_nums = []
min_num, max_num = min(args), max(args)
for search_num in range(min_num, max_num + 1):
if search_num not in args:
answer.append(search_num)
for number in set(args):
if args.count(number) > 1:
duplic... | 3.703125 | 4 |
examples/eeprom_example.py | melopero/Melopero_RV-3028 | 1 | 12790176 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
import melopero_RV_3028 as mp
import time
def main():
# First initialize and create the rtc device
rtc = mp.RV_3028()
# setup the rtc to use the eeprom memory (disables the automatic configuration refresh)
rtc.use_eeprom()
my... | 3.109375 | 3 |
promort/clinical_annotations_manager/migrations/0018_auto_20211128_1525.py | mdrio/ProMort | 3 | 12790177 | # Generated by Django 3.1.13 on 2021-11-28 15:25
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('clinical_annotations_manager', '0017_auto_20210424_1321'),
]
operations = [
migrations.RenameField(
model_name='coreannotation',
... | 1.601563 | 2 |
ChallengeJinja/challengejinja.py | subash-kc/2022-01-04-Python | 1 | 12790178 | """
192.168.30.22 hostA.localdomain # hostA
192.168.30.33 hostB.localdomain # hostB
192.168.30.44 hostC.localdomain # hostB
"""
"""
groups = [{"hostname": "hostA","ip": "192.168.30.22", "fqdn": "hostA.localdomain"},
{"hostname": "hostB", "ip": "192.168.30.33", "fqdn": "hostB.localdomain"},
{"hostn... | 2.8125 | 3 |
CNN.py | tahanakabi/Deep-Reinforcenment-learning-for-TCL-control | 6 | 12790179 | import numpy as np
import tensorflow as tf
from read_data import get_X_y
from sklearn.preprocessing import MinMaxScaler
import matplotlib.pyplot as plt
import pickle
class NN():
def __init__(self, batch_size = 300, graph = tf.get_default_graph(),test_size = 0.1, steps_back=8, num_TCL=30):
self.... | 2.75 | 3 |
_untuned_modeling.py | mcvenkat/Python-Programs | 1 | 12790180 | <reponame>mcvenkat/Python-Programs<filename>_untuned_modeling.py
######################################################
# _untuned_modeling.py
# author: <NAME>, <EMAIL>
# licence: FreeBSD
"""
Copyright (c) 2015, <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without modificatio... | 1.757813 | 2 |
tests/test_key.py | dajiaji/pyseto | 25 | 12790181 | <filename>tests/test_key.py
from secrets import token_bytes
import pytest
from pyseto import DecryptError, Key, NotSupportedError
from pyseto.key_interface import KeyInterface
from pyseto.utils import base64url_decode
from .utils import load_jwk, load_key
class TestKey:
"""
Tests for Key.
"""
@pyt... | 2.3125 | 2 |
week4_2.py | SwapnilNair/Algorithms | 0 | 12790182 | def DFSInit(adjMAT):
(rows,cols) = adjMAT.shape
(visited,parents) = ({},{})
for i in range rows:
visited[i] = False
parents[i] = -1
return (visited,parents)
def DFS(adjMAT,visited,parent,v):
visited[v] = True
for k in neighbours(v):
if (not visited[k]):
parent[k] = v
(visited,parent) = DFS(adjMAT,visit... | 3.359375 | 3 |
solutions/067_add_binary.py | abawchen/leetcode | 0 | 12790183 | # Given two binary strings, return their sum (also a binary string).
# For example,
# a = "11"
# b = "1"
# Return "100".
class Solution:
# @param {string} a
# @param {string} b
# @return {string}
def addBinary(self, a, b):
if len(a) > len(b):
b = "0" * (len(a)-len... | 3.546875 | 4 |
Stack/Tower_of_Hanoi.py | harshil2004/Data-Structures-and-Algorithms | 14 | 12790184 | <gh_stars>10-100
#Contribiuted by <NAME> [github/YA12SHYAM]
#implementing recusion solution of Tower of Hanoi in python
def solve_hanoi(n,from_rod,to_rod,use_rod):
if(n==1):
print("Move disk 1 from rod {} to_rod {}".format(from_rod,to_rod))
else:
#solve top n-1 disc from source rod to auxillary/Using rod
... | 4.03125 | 4 |
scripts/resources/config.py | KoMaTo3/Biominator | 0 | 12790185 | <gh_stars>0
config_platform = 'win32'
#config_platform = 'android'
#config_platform = 'linux'
| 1.101563 | 1 |
17B-162/HI/imaging/feather_comparisons.py | e-koch/VLA_Lband | 1 | 12790186 |
'''
Compare the data where they overlap in the uv plane.
No offset correction is needed.
'''
from spectral_cube import SpectralCube
import numpy as np
import astropy.units as u
import matplotlib.pyplot as plt
import os
import scipy.ndimage as nd
from uvcombine.scale_factor import find_scale_factor
from cube_analys... | 2.21875 | 2 |
Shellcodes/Encoder-Scripts/xor_encoder.py | noamts/Malware | 6 | 12790187 | <filename>Shellcodes/Encoder-Scripts/xor_encoder.py
#! /bin/python
original_shellcode=("Enter the shellcode")
encoder_byte="Enter the encoder byte"
encoded_shellcode_format1=[]
encoded_shellcode_format2=[]
for byt in bytearray(original_shellcode):
xor=byt^encoder_byte
xor="%02x" %xor
xor1="\\x" + xor
xor2="0x... | 3.15625 | 3 |
a.py | Pzzzzz5142/My-Music | 2 | 12790188 | <filename>a.py
from tqdm import tqdm
from random import randint
class A(object):
def __init__(self):
self.a=self.aa()
def aa(self):
return 'aaa'
class B(A):
def __init__(self):
super().__init__()
def aa(self):
return 'aaaaaa'
a=A()
print(a.a) | 2.984375 | 3 |
exams/migrations/0020_auto_20210805_1401.py | ankanb240/otis-web | 15 | 12790189 | # Generated by Django 3.2.5 on 2021-08-05 18:01
import django.core.validators
from django.db import migrations, models
import re
class Migration(migrations.Migration):
dependencies = [
('exams', '0019_auto_20210805_1334'),
]
operations = [
migrations.AlterField(
model_name='... | 1.585938 | 2 |
utils/dirty.py | chua-n/particle | 1 | 12790190 | <gh_stars>1-10
import time
from functools import wraps
import numpy as np
import scipy
from scipy.spatial import ConvexHull
from scipy.spatial.distance import jensenshannon
from skimage import io, filters
from skimage.color import rgb2gray
from skimage.util import img_as_ubyte
from skimage.filters import t... | 1.84375 | 2 |
script/compile_fit_result.py | Wangyiquan95/NA_EPI | 1 | 12790191 | <filename>script/compile_fit_result.py<gh_stars>1-10
#!/usr/bin/python
import os
import sys
import glob
import numpy as np
from Bio import SeqIO
from collections import defaultdict
from Bio.SeqUtils.ProtParam import ProteinAnalysis as PA
def Mut2ID(Mut, WTseq, residues):
ID = ''
for residue, aa in zip(residues, WT... | 2.359375 | 2 |
test/tests/api/redfish_1_0/schema_tests.py | smiller171/RackHD | 0 | 12790192 | <filename>test/tests/api/redfish_1_0/schema_tests.py
from config.redfish1_0_config import *
from modules.logger import Log
from on_http_redfish_1_0 import RedfishvApi as redfish
from on_http_redfish_1_0 import rest
from datetime import datetime
from proboscis.asserts import assert_equal
from proboscis.asserts import as... | 2.171875 | 2 |
sdk/python/pulumi_okta/app/get_app.py | brinnehlops/pulumi-okta | 0 | 12790193 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Dict, List, Mapping, Optional, Tuple, Union
from .. import ... | 1.851563 | 2 |
tutorials/W0D1_PythonWorkshop1/solutions/W0D1_Tutorial1_Solution_01b86875.py | amita-kapoor/course-content | 1 | 12790194 | <gh_stars>1-10
# set random number generator
np.random.seed(2020)
# initialize step_end, t_range, v and syn
step_end = int(t_max/dt)
t_range = np.linspace(0, t_max, num=step_end)
v = el * np.ones(step_end)
syn = i_mean * (1 + 0.1*(t_max/dt)**(0.5)*(2*np.random.random(step_end)-1))
# loop for step_end values of syn
f... | 2.5 | 2 |
modifications/2020-03-11-ASCDB/add_dataset.py | PierMorgante/MQCAS | 4 | 12790195 | #!/usr/bin/env Python # This line is needed only for unix-based systems.
# Written by <NAME>, <NAME>, <NAME>.
# March 2020.
#
import qcportal as ptl
from qcfractal import FractalSnowflake
import pandas as pd
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--dry-run", action="store_true")
... | 1.953125 | 2 |
resource_daily_scheduler/booking_req_views.py | weijia/resource-daily-scheduler | 0 | 12790196 | <filename>resource_daily_scheduler/booking_req_views.py
import json
from compat import View
import datetime
from django import forms
from django.db.models import Q
from django.http import HttpResponse
from django.views.generic.edit import CreateView, UpdateView
import pytz
from djangoautoconf.class_based_views.ajax_vie... | 2.015625 | 2 |
transcrypt/development/automated_tests/transcrypt/classes/__init__.py | JMCanning78/Transcrypt | 1 | 12790197 | def run (autoTester):
autoTester.check ('<br>General<br>')
class A:
p = 123
def __init__ (self, x):
self.x = x
autoTester.check (self.p)
def show (self, label):
autoTester.check ('A.show', label, self.x)
def show2 (self, label):
... | 2.796875 | 3 |
polybius/utils/font.py | TStalnaker44/flappy_bird_game | 0 | 12790198 |
import pygame
class Font():
def __init__(self, name, size):
self._name = name
self._size = size
self._font = pygame.font.SysFont(name, size)
#TODO Add support for font files
def getFontName(self):
return self._name
def getFontSize(self):
return self._siz... | 3.03125 | 3 |
test/mocks/mock_direct_receiver.py | markgreene74/mite | 17 | 12790199 | from mite.utils import pack_msg
class DirectReceiverMock:
def __init__(self):
self._listeners = []
self._raw_listeners = []
def __call__(self, msg):
return
def add_listener(self, listener):
self._listeners.append(listener)
def add_raw_listener(self, raw_listener):
... | 2.3125 | 2 |
statusbar.py | rmayherr/python | 0 | 12790200 | <gh_stars>0
#!/usr/bin/env python3
import time, subprocess,os
class Progressbar():
def __init__(self):
self.line = ""
self.arrow = ""
self.initbar()
def initbar(self):
print(("{0:143}{1}").format("[","]"))
def terminal_length(self):
cols,rows = os.get_terminal_size... | 2.8125 | 3 |
inheritance/Multilevel.py | Anilkumar95/python-75-hackathon | 0 | 12790201 | class My(object):
y = 5988
class Mt(My):
z = 598
class Mat(Mt):
x = 54
p1=Mat()
print(p1.x)
print(p1.y)
print(p1.z)
| 3.265625 | 3 |
airmozilla/main/tests/test_views.py | peterbe/airmozilla | 0 | 12790202 | <filename>airmozilla/main/tests/test_views.py<gh_stars>0
import datetime
import uuid
from django.contrib.auth.models import Group
from django.test import TestCase
from django.utils.timezone import utc
from funfactory.urlresolvers import reverse
from nose.tools import eq_, ok_
from airmozilla.main.models import (
... | 2.0625 | 2 |
neurolab/data/caltech101.py | udday2014/HebbianLearning | 6 | 12790203 | <gh_stars>1-10
from torchvision.datasets.utils import extract_archive
from torchvision.datasets import ImageFolder
from torch.utils.data import Subset, WeightedRandomSampler
import random
import os
from ..utils import download_large_file_from_drive
from .data import DataManager
from .. import params as P
# Caltech1... | 2.359375 | 2 |
users/schema.py | theNegativeEntropy/digitalmenu | 0 | 12790204 | from django.contrib.auth import authenticate, login
import graphene
import django_filters
from graphene_django import DjangoObjectType, DjangoListField
from graphene_django.filter import DjangoFilterConnectionField
from graphql_jwt.decorators import login_required
from .models import User
class UserType(DjangoObject... | 2.265625 | 2 |
src/scheduler/cli.py | PyconUK/ConferenceScheduler-cli | 0 | 12790205 | """Procedures to define the Command Line Interface (cli)"""
from pathlib import Path
import click
from conference_scheduler.scheduler import event_schedule_difference
from conference_scheduler.converter import solution_to_schedule
from conference_scheduler.validator import (
is_valid_solution, solution_violations)... | 2.4375 | 2 |
api/save_containers_stats_job.py | NathanReis/BaleiaAzul | 1 | 12790206 | <reponame>NathanReis/BaleiaAzul
from datetime import datetime
from src.database.connection import DBConnection
from src.helpers.docker_helper import extract_stats_container_data
from src.services import container_service
import schedule
import time
def save_containers_stats():
db_connection = DBConnection()
d... | 2.40625 | 2 |
src/questrade/api/streamer/JSONStreamObserver.py | stvhwrd/QuestradeAPI_PythonWrapper | 31 | 12790207 | <filename>src/questrade/api/streamer/JSONStreamObserver.py
'''JSON Stream Observer
@summary: An Observer in the Publish/Subscriber design pattern. This
observer prints the JSON object returned from the stream.
@see: http://www.questrade.com/api/documentation/streaming
@copyright: 2016
@author: <NAME>
@... | 2.3125 | 2 |
documents/views.py | livcarman/spekit | 0 | 12790208 | <reponame>livcarman/spekit<gh_stars>0
from rest_framework import viewsets
from rest_framework import permissions
from documents.models import Document, Folder, Topic
from documents.serializers import DocumentSerializer, FolderSerializer, TopicSerializer
from documents.filters import DocumentFilter, FolderFilter, Topic... | 2.3125 | 2 |
benchmarks/ligra-partition/graphtools/cilkpub_v105/perf_scripts/perf_summarize_file.py | jordanjohnston/manseglib | 4 | 12790209 | # Copyright (C) 2013 Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of cond... | 1.164063 | 1 |
pybiotools4p/utils.py | btrspg/pybiotools4p | 0 | 12790210 | # AUTOGENERATED! DO NOT EDIT! File to edit: utils.ipynb (unless otherwise specified).
__all__ = ['load_config', 'config', 'load_yaml', 'default_yaml', 'dict_to_paras']
# Cell
import pkg_resources
import configparser
import yaml
# Cell
def load_config(*configs):
config = configparser.ConfigParser()
config.r... | 2.3125 | 2 |
oembed/tests/tests/base.py | ericholscher/djangoembed | 1 | 12790211 | <reponame>ericholscher/djangoembed<filename>oembed/tests/tests/base.py
import simplejson
from django.conf import settings
from django.core.urlresolvers import reverse, NoReverseMatch
from django.test import TestCase
import oembed
from oembed.providers import BaseProvider
from oembed.resources import OEmbedResource
f... | 2.125 | 2 |
tests/validation.py | GeoscienceAustralia/sira | 1 | 12790212 | <filename>tests/validation.py
"""
Params lists and functions for validation testing of models and config files
Validates model and config files based on rules
"""
from pathlib import Path
# -----------------------------------------------------------------------------
# Paths
SIRA_ROOT_DIR = Path(__file__).resolve().... | 2.5625 | 3 |
server/blogsley/security.py | blogsley/blogsley-next | 2 | 12790213 | import os
import hashlib
def generate_password_hash(password):
salt = os.urandom(32)
key = hashlib.pbkdf2_hmac('sha256', password.encode('utf-8'), salt, 100000)
return (salt, key)
def check_password_hash(password, salt, key):
# Use the exact same setup you used to generate the key, but this time put ... | 3.46875 | 3 |
archives/histograma01.py | LBarros77/Python | 0 | 12790214 | '''
Pasos:
Pida al usuario el nombre del archivo de entrada.
Lea el archivo (si es posible) y cuente todas las letras latinas (las letras mayúsculas y minúsculas se tratan como iguales).
Imprima un histograma simple en orden alfabético (solo se deben presentar recuentos distintos de cero).
Questión:
Crea un archivo de... | 3.453125 | 3 |
node/blockchain/inner_models/signed_change_request/base.py | thenewboston-developers/Node | 18 | 12790215 | <filename>node/blockchain/inner_models/signed_change_request/base.py
from typing import Type as TypingType
from typing import TypeVar, cast
from pydantic import root_validator
from node.blockchain.constants import BLOCK_LOCK
from node.blockchain.mixins.crypto import HashableMixin, validate_signature_helper
from node.... | 2.28125 | 2 |
src/straitjacket/__main__.py | pombredanne/gitlab.com-mbarkhau-straitjacket | 0 | 12790216 | #!/usr/bin/env python
# This file is part of the straitjacket project
# https://gitlab.com/mbarkhau/straitjacket
#
# Copyright (c) 2018 <NAME> (<EMAIL>) - MIT License
# SPDX-License-Identifier: MIT
try:
import backtrace
# To enable pretty tracebacks:
# echo "export ENABLE_BACKTRACE=1;" >> ~/.bashrc
... | 1.375 | 1 |
terraform_to_ansible/parser.py | mrlesmithjr/terraform-to-ansible | 16 | 12790217 | """terraform_to_ansible/parser.py"""
import json
import logging
import os
import subprocess
import sys
class Parser:
"""Main Terraform tfstate parser."""
def __init__(self, args):
"""Init a thing."""
# Define dictionary to hold all parsed resources
self.all_resources = {}
#... | 2.65625 | 3 |
setup.py | sam-bailey/tyme | 0 | 12790218 | #!/usr/bin/env python3
# Set this to True to enable building extensions using Cython.
# Set it to False to build extensions from the C file (that
# was previously created using Cython).
# Set it to 'auto' to build with Cython if available, otherwise
# from the C file.
import sys
from setuptools import setup, find_pac... | 2.015625 | 2 |
peek_plugin_base/agent/PluginAgentEntryHookABC.py | Synerty/peek_plugin_base | 0 | 12790219 | from typing import Optional
from peek_plugin_base.PluginCommonEntryHookABC import PluginCommonEntryHookABC
from peek_plugin_base.agent.PeekAgentPlatformHookABC import PeekAgentPlatformHookABC
class PluginAgentEntryHookABC(PluginCommonEntryHookABC):
def __init__(self, pluginName: str, pluginRootDir: str, platfor... | 2.203125 | 2 |
test/testers/winforms/panel-regression.py | ABEMBARKA/monoUI | 1 | 12790220 | <filename>test/testers/winforms/panel-regression.py
#!/usr/bin/env python
# vim: set tabstop=4 shiftwidth=4 expandtab
##############################################################################
# Written by: <NAME> <<EMAIL>>
# Date: 10/21/2008
# Description: main test script of panel
# ../sample... | 1.820313 | 2 |
tests/generated_test_extensions/extend_test_compute.py | rosalexander/oci-cli | 0 | 12790221 | # coding: utf-8
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
# These mappings are used by generated tests to look up operations that have been moved in code in the CLI.
MOVED_COMMANDS = {
('compute', 'app_catalog_listing', 'get'): ['compute', 'pic', 'listing', 'get'],
('comput... | 1.625 | 2 |
contrib/cookiecutter/ckan_extension/{{cookiecutter.project}}/ckanext/{{cookiecutter.project_shortname}}/logic/schema.py | gg2/ckan | 2,805 | 12790222 | <reponame>gg2/ckan
import ckan.plugins.toolkit as tk
def {{cookiecutter.project_shortname}}_get_sum():
not_empty = tk.get_validator("not_empty")
convert_int = tk.get_validator("convert_int")
return {
"left": [not_empty, convert_int],
"right": [not_empty, convert_int]
}
| 1.859375 | 2 |
src/hots/count_words.py | Brokenwind/hots | 0 | 12790223 | <reponame>Brokenwind/hots<filename>src/hots/count_words.py<gh_stars>0
# -*- coding: utf-8 -*-
# @Time : 2020/9/1 18:00
# @Author : WangKun
# @Email : <EMAIL>
import os
import pickle
import sys
from collections import Counter
import numpy as np
from joblib import Parallel, delayed
from sklearn.featur... | 2.1875 | 2 |
udacity.py | davidvartanian/dand-ml-identify-fraud-enron-email | 0 | 12790224 | """
Code provided by Udacity
"""
import numpy as np
def featureFormat( dictionary, features, remove_NaN=True, remove_all_zeroes=True, remove_any_zeroes=False, sort_keys = False):
""" convert dictionary to numpy array of features
remove_NaN = True will convert "NaN" string to 0.0
remove_all_zeroes... | 3.40625 | 3 |
emonitor/modules/settings/settings.py | Durburz/eMonitor | 21 | 12790225 | import os, math, yaml
from emonitor.extensions import db
class Struct(dict):
def __init__(self, **entries):
self.__dict__.update(entries)
class Settings(db.Model):
"""Settings class"""
__tablename__ = 'settings'
__table_args__ = {'extend_existing': True}
id = db.Column(db.Integer, prima... | 2.453125 | 2 |
tests/test_ark.py | DerekRies/arkpy | 19 | 12790226 | <gh_stars>10-100
import pytest
import pep8
import random
import os
from context import arktypes, ark, binary, utils
data_dir = 'data/'
output_dir = 'tests/output/'
class TestArkProfile:
def test_write_read(self):
profile = ark.ArkProfile()
profile.map_name = ark.GameMapMap.the_center
p... | 2.328125 | 2 |
onadata/kobocat/__init__.py | BuildAMovement/whistler-kobocat | 38 | 12790227 | <reponame>BuildAMovement/whistler-kobocat<filename>onadata/kobocat/__init__.py
from onadata.koboform import context_processors
# remove this file when all servers are using new settings
print """
context_processors setting must be changed from
kobocat.context_processors to koboform.context_processors
""" | 1.3125 | 1 |
scripts/sources/s_checklist_scenariobased_step04.py | dpopadic/arpmRes | 6 | 12790228 | # ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.1.5
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # s_checklist_scenariobased_step04 [<img src="https:/... | 1.945313 | 2 |
functions/proto_optim.py | jwen307/diamondintherough | 4 | 12790229 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 4 08:24:48 2021
proto_optim.py
- Find the protoimage vectors
"""
import torch
import torch.optim as optim
import torch.nn as nn
import math
from tqdm import tqdm
from . import utils
#Optimization to get the protoimages
def proto_optim(... | 2.640625 | 3 |
tfc/tfc.py | emregeldegul/tfc | 29 | 12790230 | <reponame>emregeldegul/tfc
from .notify import Notify
from googletrans import Translator
from time import sleep
from xerox import paste
class Translation:
def __init__(self, dest, src):
self.translate = Translator()
self.notify = Notify()
self.dest = dest
self.src = src
def s... | 2.484375 | 2 |
scripts/gen_key_label.py | hua1024/OpenOCR | 3 | 12790231 | # coding=utf-8
# @Time : 2021/5/11 11:20
# @Auto : zzf-jeff
train_list_file = '../test/train_rec_05.txt'
test_list_file = '../test/test_rec_05.txt'
keys_file = './key.txt'
fid_key = open(keys_file, 'a+', encoding='utf-8')
keys = ''
def read_txt(txt_path, split_type):
'''
读取txt文件的标注信息,格式为
xxx/a/1.... | 2.78125 | 3 |
bblfsh_sonar_checks/checks/java/RSPEC-1215.py | stg-tud/sonar-checks | 3 | 12790232 | import bblfsh_sonar_checks.utils as utils
import bblfsh
def check(uast):
findings = []
fin_calls = bblfsh.filter(uast, "//MethodInvocation//"
"Identifier[@roleCall and @roleReceiver and @Name='System']/parent::MethodInvocation/"
"Identifier[@roleCall and @roleCallee and @Name='gc']/pa... | 2.15625 | 2 |
Exercicios/tempCodeRunnerFile.py | eduardodarocha/Introducao_Ciencia_da_Computacao_com_Python_Parte_2_Coursera | 1 | 12790233 | print(elefantes(4)) | 1.1875 | 1 |
polymorphism.py | Sp-X/PCAP | 0 | 12790234 | <reponame>Sp-X/PCAP
class One:
def do_it(self):
print("do_it from One")
def doanything(self):
self.do_it()
class Two(One):
def do_it(self):
print("do_it from Two")
one = One()
two = Two()
one.doanything()
two.doanything()
| 2.53125 | 3 |
boundary/plugin_manifest.py | jdgwartney/boundary-api-cli | 0 | 12790235 | <filename>boundary/plugin_manifest.py<gh_stars>0
#
# Copyright 2015 BMC Software, 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
#
# U... | 2.34375 | 2 |
setup.py | btcfy/cloudify-utilities-plugin | 0 | 12790236 | <filename>setup.py
# Copyright (c) 2017 GigaSpaces Technologies Ltd. All rights reserved
#
# 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
... | 1.164063 | 1 |
math/iteration_power.py | dimascapella/Python | 1 | 12790237 | <filename>math/iteration_power.py
def iteration_power(number: int, exp: int) -> int:
"""
Perpangkatan dengan metode iteratif atau perulangan
rumus matematika: number^exp
>>> iteration_power(2, 5)
32
>>> iteration_power(100, 0)
1
>>> iteration_power(0, 100)
0
>>> iteration_power(1... | 4.375 | 4 |
webtul/img.py | zagfai/webtul | 1 | 12790238 | <filename>webtul/img.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
""" Image tools
"""
__author__ = 'Zagfai'
__date__ = '2018-02'
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
class BoxWrapper(object):
"""BoxWrapper for Chinese and Alphas text wrapping"""
def __init__(self, font_pa... | 3.046875 | 3 |
tools/dox.py | RyanSchuster/vos64 | 1 | 12790239 | <gh_stars>1-10
#!/usr/bin/env python3
import os
import sys
import scanner
import codemap
# ------------------------------------------------------------------------------
# Parameterized output filenames
def func_index_name():
return 'Function-Index.md'
def func_index_graph_name():
return 'func_index_graph.dot'... | 2.25 | 2 |
setup.py | ndraeger/rt1 | 0 | 12790240 | # -*- coding: UTF-8 -*-
"""
This file is part of RT1.
(c) 2016- <NAME>
For COPYING and LICENSE details, please refer to the LICENSE file
"""
from setuptools import setup
#from setuptools import find_packages
from rt1 import __version__
setup(name='rt1',
version=__version__,
description='RT1 - bistatic ... | 1.523438 | 2 |
sdk/python/pulumi_ucloud/vpc/vpc.py | AaronFriel/pulumi-ucloud | 4 | 12790241 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | 2.125 | 2 |
Sparse Representation/compute_PSNR_SSIM.py | ashishpatel26/SuperResolution-Medical-Imaging-using-SRGAN | 1 | 12790242 | <reponame>ashishpatel26/SuperResolution-Medical-Imaging-using-SRGAN
import scipy
import numpy as np
import skimage
import scipy.misc
import skimage.measure
image_list = ['27', '78', '403', '414', '480', '579', '587', '664', '711', '715', '756', '771', '788', '793', '826', '947', '994', '1076', '1097', '1099', '1141',... | 2.640625 | 3 |
nlutestframework/__main__.py | emundo/nlutestframework | 0 | 12790243 | <gh_stars>0
import argparse
import asyncio
import logging
from signal import SIGINT, SIGTERM
import sys
from typing import Any
import yaml
from .nlu_benchmarker import NLUBenchmarker
def eprint(*args: Any, **kwargs: Any) -> None:
print(*args, file=sys.stderr, **kwargs)
def main() -> None:
parser = argparse.... | 2.375 | 2 |
lpot/utils/logger.py | intelkevinputnam/lpot-docs | 172 | 12790244 | <reponame>intelkevinputnam/lpot-docs
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021 Intel 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.ap... | 2.328125 | 2 |
models/tl/ex1.py | bhneo/SparsePooling | 0 | 12790245 | import os
import sys
sys.path.append(os.getcwd())
import tensorflow as tf
tf.get_logger().setLevel('ERROR')
from tensorflow import keras
from common.inputs.voc2010 import voc_parts
from common import layers, losses, utils, train, attacks
from common.ops.routing import activated_entropy, coupling_entropy
import numpy... | 1.890625 | 2 |
code/ml/preprocessing/show_augmented_images.py | lbechberger/LearningPsychologicalSpaces | 6 | 12790246 | # -*- coding: utf-8 -*-
"""
Displays some of the augmented images. Can be used to visually check that augmentation is working fine.
Created on Wed May 8 12:12:26 2019
@author: lbechberger
"""
import argparse, pickle
import matplotlib.pyplot as plt
import tensorflow as tf
parser = argparse.ArgumentParser(descriptio... | 3.328125 | 3 |
main.py | HelParadox/Nagito-Bot | 0 | 12790247 | <filename>main.py
import discord, keep_alive, os, random, time
from discord.ext import commands, tasks
from asyncio import sleep
import urllib.parse
import urllib.request
bot = commands.Bot(command_prefix="n!", case_insensitive=True)
client = discord.Client()
@bot.event
async def on_ready():
print("bot ready!")... | 2.8125 | 3 |
p100-109/p105.py | kbrose/project_euler | 1 | 12790248 | from itertools import combinations
f = open("p105_text.txt")
fr = f.readline()
sets = []
while fr:
fs = (fr.strip()).split()
for i in range(len(fs)):
fs[i] = int(fs[i])
fs.sort()
sets.append(fs)
fr = f.readline()
def test_rest(set, com):
ret_set = list(set)
for num in com:
... | 3 | 3 |
humanlikehearing/library/__init__.py | neural-reckoning/HumanlikeHearing | 6 | 12790249 | <reponame>neural-reckoning/HumanlikeHearing
from . import a_weighting
from . import audio_format
from . import speech_voltmeter_svp56
from . import voice_activity_detection | 1.015625 | 1 |
wk_camera_pylon.py | WAKU-TAKE-A/pypylon_sample001 | 1 | 12790250 | <filename>wk_camera_pylon.py<gh_stars>1-10
# -*- coding: utf-8 -*-
import time
from pypylon import pylon
import cv2
class CameraPylon:
def __init__(self, id=0, exposure_us=30000, gain=0.0):
"""
Init
* When exposure_us is zero, auto exposure is enabled.
* When gain is zero,... | 2.859375 | 3 |