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 |
|---|---|---|---|---|---|---|
004/main.py | alexprengere/euler | 0 | 54500 | #!/usr/bin/env python
"""
$ python main.py 3
906609 = 913 * 993
"""
import sys
from math import sqrt
def is_palindrome(i):
return str(i) == str(i)[::-1]
def get_divisors(i):
for j in range(1, 1 + int(sqrt(i))):
if i % j == 0:
yield j, i // j
def find_palindrome(digits):
for i in ... | 3.875 | 4 |
window-functions/part-3/00-the-data.py | yorek/databricks-samples | 0 | 54501 | # Databricks notebook source
# MAGIC %md
# MAGIC # Project Timesheet Source Data
# COMMAND ----------
# MAGIC %md
# MAGIC *Access to csv data source has been configured at the cluster level so that you don't need to set the Azure Blob auth info in every workbook*
# COMMAND ----------
# MAGIC %sql
# MAGIC describe t... | 1.617188 | 2 |
tests/test_markup.py | stesla/enview | 0 | 54502 | <filename>tests/test_markup.py<gh_stars>0
from enview.markup import parse, Text
def test_parse_empty():
assert parse('') == []
def test_parse_plain():
assert parse('plaintext') == [Text('plaintext')]
def test_parse_low_colors():
assert parse('some\x1b[36;44mcolor') == [Text('some'), Text('color', bg='#00... | 2.640625 | 3 |
migrations/versions/d472e8cc6100_new_subscription_table.py | ourresearch/journalsdb | 8 | 54503 | <filename>migrations/versions/d472e8cc6100_new_subscription_table.py
"""new subscription table
Revision ID: d472e8cc6100
Revises: <KEY>
Create Date: 2021-08-28 10:34:02.566215
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "d472e8cc6100"
down_revision = "<KEY>... | 1.4375 | 1 |
pinball/master/blessed_version.py | DotModus/pinball | 1,143 | 54504 | # Copyright 2015, Pinterest, 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 writ... | 2.28125 | 2 |
cogs/calculate.py | mome0320/EZ-Bot | 1 | 54505 | <gh_stars>1-10
import discord
from discord.ext import commands
import wolframalpha
class Calculate(commands.Cog):
def __init__(self, client):
self.client = client
# Commands
@commands.command()
async def 계산(self, ctx):
await ctx.trigger_typing()
reply = ctx.message.content.spl... | 2.828125 | 3 |
TDOANTF/BlindDereverb_100files_filelist_h1_quick.py | TeunKrikke/SourceSeparationNMF | 1 | 54506 | <reponame>TeunKrikke/SourceSeparationNMF
import numpy as np
import matplotlib.pyplot as plt
from scipy.io import wavfile
from scipy.signal import fftconvolve
from librosa.core import load
from librosa.core import stft
from librosa.core import istft
from librosa import amplitude_to_db, db_to_amplitude
from librosa.disp... | 2.078125 | 2 |
lang/Python/loops-downward-for-1.py | ethansaxenian/RosettaDecode | 0 | 54507 | <filename>lang/Python/loops-downward-for-1.py
for i in range(10, -1, -1):
print(i)
| 3.28125 | 3 |
main.py | ARCJ137442/makeFolderTenser | 0 | 54508 | <gh_stars>0
'''
README:
本程序用于创建一系列的「索引文件夹」,
其相当于一个索引矩阵(可能是「张量」),其包含的值(本质上是集合,但一般是文件)使用一个特定的序列(等价于一个向量)进行访问;
原理/作用/用途:通过增大其他用户逐一检索文件夹之难度以「隐藏」部分文件夹或文件
待补
'''
import os
#此函数来源于网络
def mkdir(path):
# 引入模块
import os
# 去除首尾空格
path=path.strip()
# 去除尾部 \ 符号
path=path.rstrip("\\")
# 判断路径是否存在
... | 3.234375 | 3 |
utilities/color_traceback.py | petermchale/trfermik | 9 | 54509 | <gh_stars>1-10
import colored_traceback
# TODO: create a custom pygments style using: https://pygments.org/docs/styles/
colored_traceback.add_hook(always=True, style='solarized-dark')
| 1.632813 | 2 |
ml_with_web_optimization/chapter_01.py | hyoshizawa/playground | 0 | 54510 | """
Some notes:
HDI: Highest Density Interval.
ROPE: Region of Practical Equivalence.
"""
import numpy as np
from matplotlib import pyplot as plt
def ch01_01():
"""
"""
thetas = np.linspace(0, 1, 1001)
print(thetas)
likelihood = lambda r: thetas if r else (1 - thetas)
def posterio... | 3.328125 | 3 |
ego/optimization/neighborhood_node_remove.py | fabriziocosta/EGO | 0 | 54511 | #!/usr/bin/env python
"""Provides scikit interface."""
import networkx as nx
import random
from itertools import combinations
import logging
logger = logging.getLogger(__name__)
class NeighborhoodNodeRemove(object):
def __init__(self, n_nodes=1, n_neighbors=10, part_importance_estimator=None):
self.part... | 2.671875 | 3 |
tolaat/website/infrastructure.py | tolaat-com/tolaat | 0 | 54512 | <reponame>tolaat-com/tolaat
import os
import socket
import logging
from flask import render_template, request, Response, g, redirect, abort
from . import db
from . import hebrew
def add_infrastructure(app):
def user_agent_parsing():
if 'User-Agent' in request.headers:
ua = request.headers['Us... | 2.375 | 2 |
test/test_tarlite.py | G-AshwinKumar/experiment-notebook | 0 | 54513 | <reponame>G-AshwinKumar/experiment-notebook<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Test the tarlite module
"""
__author__ = "<NAME> <<EMAIL>>"
__date__ = "08/04/2020"
import os
import glob
import tempfile
import filecmp
import unittest
__file__ = os.path.abspath(__file__)
import test_all
import... | 2.421875 | 2 |
mac/pyobjc-framework-Quartz/Examples/Programming with Quartz/BasicDrawing/ColorAndGState.py | albertz/music-player | 132 | 54514 | import sys
from Quartz import *
import Utilities
import array
def doColorSpaceFillAndStroke(context):
theColorSpace = Utilities.getTheCalibratedRGBColorSpace()
opaqueRed = ( 0.663, 0.0, 0.031, 1.0 ) # red,green,blue,alpha
aBlue = ( 0.482, 0.62, 0.871, 1.0 ) # red,green,blue,alpha
# Set the fill ... | 2.59375 | 3 |
Python/6 - Dictionaries/Extra Exercises/extra4.py | SimaDinisVC/GPSI-Course-at-ESEN | 3 | 54515 | produtos = {1273961531:{'Preço':0.78, 'IVA':13, 'Descrição':'Leite magro da marca Bio.'}} #####Estilo do Dicio#####
# Menú #
while True:
print('|Menú|\n0 - Sair\n1 - Inserir Produto\n2 - Alterar o Preço do produto dado o código\n3 - Aumentar ou diminuir o Preço de todos os Produtos com igual %\n4 - Listar Produtos... | 3.734375 | 4 |
complex_performance_metrics/expt.py | hnarasimhan/constrained-classification | 9 | 54516 | <reponame>hnarasimhan/constrained-classification
import numpy as np
from time import time
from sklearn.preprocessing import MinMaxScaler
from sklearn.linear_model import LogisticRegressionCV
from models.constrained import COCOClassifier, FRACOClassifier
from models.unconstrained import FrankWolfeClassifier, BisectionCl... | 2.875 | 3 |
models/utils.py | asurt-shell-ai/Pitch-The-Future | 5 | 54517 | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
def uniform_dist(a, b, size):
'''
Sample from a uniform distribution Unif(a,b)
'''
std_unif = torch.rand(size)
return std_unif*(b-a)+a
def safe_log(tens, epsilon:float=1e-5):
'''
Safe log to prevent infi... | 3.0625 | 3 |
fibra/views.py | coyotevz/fibra | 0 | 54518 | # -*- coding: utf-8 -*-
from datetime import date
from flask import render_template, redirect, url_for, flash, request, make_response
from werkzeug.urls import url_unquote
from fibra import app
from fibra.models import db, Customer, Contact, Invoice, Payment, STATES
from fibra.forms import (
CustomerForm, Co... | 2.171875 | 2 |
post_processing/processing.py | oldbridge/android_scanner | 0 | 54519 | <filename>post_processing/processing.py
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
from datetime import datetime, timedelta
from ipyleaflet import Map, Polyline, Circle, CircleMarker, MarkerCluster, Heatmap, Marker
class SniffedData():
def __init__(self, filenam... | 2.71875 | 3 |
blog_blog/migrations/0010_remove_post_body.py | hossshakiba/Django-Personal-Website-Blog | 2 | 54520 | <gh_stars>1-10
# Generated by Django 3.1 on 2020-11-04 10:08
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('blog_blog', '0009_auto_20201103_1823'),
]
operations = [
migrations.RemoveField(
model_name='post',
name='body'... | 1.398438 | 1 |
teamB/player.py | trun/redux | 2 | 54521 | class RobotPlayer(object):
def __init__(self, rc):
self.rc = rc
def run(self):
while True:
print 'DO RE ME'
self.rc.yield_execution()
| 2.75 | 3 |
tests/unittests/core/test_utils_format.py | christopher-beckham/orion | 3 | 54522 | <reponame>christopher-beckham/orion<filename>tests/unittests/core/test_utils_format.py<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Example usage and tests for :mod:`orion.core.utils.format`."""
import pytest
from orion.core.utils.format_trials import (trial_to_tuple, tuple_to_trial)
from orion.core... | 2.6875 | 3 |
dashboard/fabric-plugins/status_couchdb.py | CornerstoneLabs/service-dashboard | 0 | 54523 | """Get status of CouchDB."""
import json
from status_base import save, setup_environment, schedule_log, safe_run, mongo_collection, mongo_database, get_parameters
setup_environment()
def status():
"""Run check on CouchDB."""
schedule_log("Starting CouchDB Monitor")
databases = get_parameters()
sto... | 2.609375 | 3 |
service/impl/city_service.py | LianGee/akalid | 0 | 54524 | <reponame>LianGee/akalid<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File : city_service.py
# @Author: zaoshu
# @Date : 2020-02-07
# @Desc :
import math
from datetime import datetime, timedelta
from model.city import City
from service.city_service_api import CityServiceApi
class CityService(CitySe... | 2.28125 | 2 |
split_variants.py | shiandy/epi507-project | 0 | 54525 | <gh_stars>0
# split the Neale Lab UK Biobank summary statistics by chromosome
import argparse
CHROM = list(map(str, range(1, 23)))
CHROM.append("X")
def main():
parser = argparse.ArgumentParser()
parser.add_argument("fname", help = "Input variants file")
args = parser.parse_args()
# open all the out... | 2.90625 | 3 |
poll/education/migrations/0002_lectureday_lecturepoll.py | bilbeyt/otokon-workshop | 0 | 54526 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-22 12:03
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
dependencies = [
migrations.swappab... | 1.773438 | 2 |
monobit/formats/mac.py | robhagemans/monobit | 74 | 54527 | """
monobit.mac - MacOS suitcases and resources
(c) 2019--2021 <NAME>
licence: https://opensource.org/licenses/MIT
"""
import logging
from ..binary import bytes_to_bits
from ..struct import bitfield, big_endian as be
from .. import struct
from ..storage import loaders, savers
from ..font import Font, Glyph, Coord
... | 1.59375 | 2 |
Assignment2/util/metrics.py | parthjindal/CS60050 | 0 | 54528 | import numpy as np
from typing import List, Dict, Tuple
def get_metrics(
y_pred=None,
y_true=None,
metrics: List[str] = ["Accuracy"],
classes: List[str] = ["Ham", "Spam"]
) -> Dict:
if isinstance(y_pred, np.ndarray) == False:
y_pred = y_pred.to_numpy()
if isinstance(y_true, np.ndarray... | 3.109375 | 3 |
sb_code/ttt_action_all_check.py | tpvt99/sbcs5478 | 0 | 54529 | from gym_duckietown.envs.duckietown_env import DuckietownEnv
from sb_code.wrapper import NormalizeWrapper, ResizeWrapper, RewardWrapper, FinalLayerObservationWrapper, \
DiscreteWrapper, PositiveVelocityActionWrapper, InfoWrapperEval
from aido_code.reward_wrappers import DtRewardPosAngle, DtRewardVelocity
from stabl... | 1.867188 | 2 |
pyi2.py | Prabuatcontec/pm | 0 | 54530 | import tkinter as tk
import psycopg2
import pickle
import time, calendar, requests, datetime
try:
conn = psycopg2.connect(database="postgres", user="postgres", password="<PASSWORD>", host="10.10.100.120")
print("connected")
except:
print ("I am unable to connect to the database")
motions = []
stationMotions = {}... | 2.953125 | 3 |
tf_infer.py | 137996047/DeepLearningFrameworks | 1 | 54531 | # -*- coding: utf-8 -*-
"""
Created on Thu Jul 11 19:06:49 2019
@author: WaterWood
"""
import time
import tensorflow as tf
import os.path as osp
import pandas as pd
from tqdm import tqdm
from utils import give_fake_data, ITER_NUMS
from tensorflow.contrib.slim.nets import resnet_v2 as models
class Mo... | 1.976563 | 2 |
Operators/ArithmeticOperators.py | dsabhrawal/python-examples | 1 | 54532 | <filename>Operators/ArithmeticOperators.py
#Following are the operators supported
# + Addition
# - Subration
# * Multiplication
# / Division
# % Modulus
# // Integer Division
# ** Exponential
#
#If any of operand is float the result is float
print(3+2) #prints 5
print(3-2) #prints 1
print(3*2) #prints 6
print(2.5... | 4.3125 | 4 |
boucanpy/db/factories/dns_record.py | bbhunter/boucanpy | 34 | 54533 | <reponame>bbhunter/boucanpy
import random
import uuid
from factory import Faker, LazyFunction, SubFactory
from .base import BaseFactory, fake
from boucanpy.db.models.dns_record import DnsRecord
from boucanpy.dns.types import TYPES
from boucanpy.db.factories.dns_server import DnsServerFactory
from boucanpy.db.factories.... | 2.375 | 2 |
kivyic/fileexplorer.py | InfinityCliff/kivyic | 0 | 54534 | # -*- coding: utf-8 -*-
'''
FileExplorer
============
The :class:`FileExplorer` widget is an advanced file browser. You use it
similarly to FileChooser usage.
It provides a shortcut bar with links to special and system directories.
When touching next to a shortcut in the links bar, it'll expand and show
all the direc... | 3.09375 | 3 |
linkprediction/prediction_methods/prediction/similarity_indices.py | ESM-analytics/Tie-Prediction-Tool | 1 | 54535 | <filename>linkprediction/prediction_methods/prediction/similarity_indices.py
from math import sqrt
from networkx import (
Graph, adamic_adar_index, common_neighbors, jaccard_coefficient,
preferential_attachment, resource_allocation_index, community,
shortest_path_length)
from .predictor import \
LinkP... | 2.578125 | 3 |
src/about/views.py | parezj/PartsView | 3 | 54536 | <reponame>parezj/PartsView
from django.shortcuts import render
class NameValue:
def __init__(self, name, value):
self.name = name
self.value = value
def about(request):
return render(request, 'about/about.html')
| 2.046875 | 2 |
bitbucket/__init__.py | c9s/bitbucket-client | 3 | 54537 | <filename>bitbucket/__init__.py
import oauthlib
from requests_oauthlib import OAuth1Session, OAuth2Session
from oauthlib.oauth2 import BackendApplicationClient
import click
import pickle
import os
import sys
import yaml
import json
authorization_base_url = 'https://bitbucket.org/site/oauth2/authorize'
token_url = 'h... | 2.625 | 3 |
src/script_manager.py | pekzeki/stlthmd_task | 0 | 54538 | from features import build_features
from models import train_model
import pandas as pd
from dotenv import find_dotenv, load_dotenv
import os
def main():
# Read final data set
df = pd.read_csv(os.environ.get('FINAL_DATASET_PATH'),
sep='\t',
lineterminator='\n',
... | 2.734375 | 3 |
main/util/dto.py | emhayusa/4d_api | 0 | 54539 | from flask_restplus import Namespace, fields
class StatusDto:
api = Namespace('status', description='status related operations')
schema = api.model('status', {
'id': fields.Integer(dump_only=True),
'status_name': fields.String(required=True, description='status name')
})
entry = api.m... | 2.375 | 2 |
GUI.py | NA1384/PythonGUI | 2 | 54540 | # Importing all required libraries for the code to function
import tkinter
from matplotlib.backends.backend_tkagg import (FigureCanvasTkAgg)
from matplotlib import pyplot as plt, animation
from mpl_toolkits import mplot3d
from stl import mesh
import numpy as np
import serial
from serial.tools import list_ports
import t... | 2.46875 | 2 |
world_lenses_v2/main.py | VlederDiger/FDTD_Solver_TM | 0 | 54541 | # -*- coding: utf-8 -*-
import argparse
import os
from .helpers.aspherical_lens import check_point as check_point_asph
from .helpers.spherical_lens import check_point as check_point_sph
from .helpers.plate import check_point as check_point_plate
from .helpers.dimensions import mm2px
from .helpers.config import generat... | 2.75 | 3 |
test.py | markmelnic/Car-Indexes-Scraper | 2 | 54542 |
import os
import json
import subprocess
import mobile_de
import autoscout24_ch
import anibis_ch
if __name__ == '__main__':
try:
#autoscout24_ch.scrape_makes()
#autoscout24_ch.scrape_models()
#mobile_de.scrape_makes()
#mobile_de.scrape_models()
anibis_ch.scrape_makes()
... | 1.882813 | 2 |
scripts/measure_with_fitting.py | mrmh2/stacktools | 0 | 54543 | <reponame>mrmh2/stacktools
import logging
import click
import pandas as pd
from stacktools import DataLoader
from stacktools.measure import measure_by_obsphere_fit_brute
def measure_single_region(segmentation, measure_stack, rid):
logging.info(f"Measuring region {rid}")
m, p_sphere, p_cell = measure_by_ob... | 2.359375 | 2 |
Apb3.py | Readon/CocotbLib | 12 | 54544 | import random
import cocotb
from cocotb.decorators import coroutine
from cocotb.result import TestFailure, ReturnValue
from cocotb.triggers import RisingEdge, Edge
from cocotblib.misc import log2Up, BoolRandomizer, assertEquals, waitClockedCond, randSignal
class Apb3:
def __init__(self, dut, name, clk = None):
... | 2.3125 | 2 |
model/__init__.py | limberc/SelectiveBackprop | 0 | 54545 | <gh_stars>0
from .resnet import ResNet18
from .wide_resnet import WideResNet | 1 | 1 |
A2OJ-11/078_A_Two_Bags_of_Potatoes.py | vendyv/A2OJ-Ladders | 0 | 54546 | """
78 Two bags of Potatoes - https://codeforces.com/problemset/problem/239/A
"""
y,k,n = map(int,input().split())
f=[]
x=k-y%k
while(x<n-y+1):
f.append(str(x))
x+=k
if len(f):
print(' '.join(f))
else:
print('-1') | 2.703125 | 3 |
shopify/products/objects/image.py | alikhan126/python-shopify-api | 10 | 54547 | import base64
from ...base import BaseParser, datetime_to_string, string_to_datetime
class Image(BaseParser):
def __init__(self, d=None, **kwargs):
BaseParser.__init__(self, d, **kwargs)
self.image_location = None
@property
def product_id(self):
return self._dict.get('product_id... | 3.03125 | 3 |
dataset/data.py | humanpose1/KPConvTorch | 9 | 54548 | import re
import torch
import torch_geometric
from torch_geometric.data import Data, Batch
class MultiScaleData(Data):
r"""A plain old python object modeling a singlemulti scale graph with various
(optional) attributes:
Args:
x (Tensor, optional): Node feature matrix with shape :obj:`[num_nodes,
... | 2.828125 | 3 |
dataset/fin_qa/util_scripts/replace_reserved_tokens.py | dream-catcher/biseq2seq | 6 | 54549 | <reponame>dream-catcher/biseq2seq<gh_stars>1-10
#!/usr/bin/env python3
import re
pattern = r"\$\{([A-Z_]+)\}"
FIN = "a.txt"
FOUT = "a_new.txt"
def replace(fin, fout):
symbols = set()
with open(fin) as fi, open(fout, "w") as fo:
for l in fi:
result = re.findall(pattern, l.strip())
... | 3.046875 | 3 |
src/szz/manipulate_sql_tables/add_depth_to_BT_table.py | dSar-UVA/repoMiner | 9 | 54550 | """
This script adds a specific column to the `bug_typedata_projectname_ss` tables. The added column contains the nesting depth (>=0) of each line. (BT stands for bug_type)
"""
import os, sys, psycopg2, ntpath, traceback, subprocess
from pprint import pprint
#-----------------------------------------------------------... | 2.765625 | 3 |
novice/2_digits.py | rocket3989/ACCA2020 | 0 | 54551 | <filename>novice/2_digits.py
from collections import defaultdict
while True:
vals = input().split()
counter = defaultdict(int)
for val in vals:
sumOf = 0
for digit in val:
sumOf += int(digit)
counter[sumOf] += 1
for k, v in sorted(counter.items()):
p... | 3.625 | 4 |
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ipv6_nd_subscriber_cfg.py | Maikor/ydk-py | 0 | 54552 | """ Cisco_IOS_XR_ipv6_nd_subscriber_cfg
This module contains a collection of YANG definitions
for Cisco IOS\-XR ipv6\-nd\-subscriber package configuration.
This YANG module augments the
Cisco\-IOS\-XR\-subscriber\-infra\-tmplmgr\-cfg
module with configuration data.
Copyright (c) 2013\-2018 by Cisco Systems, Inc.
... | 1.6875 | 2 |
ipcserver.py | xyzz/rop-rpc | 88 | 54553 | <gh_stars>10-100
import socket
import pickle
from util import u32, p32
def ipcserver(port, rpc):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind(("127.0.0.1", port))
s.listen(10)
while True:
c, addr = s.accept()
... | 2.765625 | 3 |
src/chapter 5/exercise 1.py | group7BSE1/BSE-2021 | 0 | 54554 | num = 0
total = 0
while True:
number = input("Enter a number: ")
if number == "done":
break
try:
numb = float(number)
except:
print("invalid input")
continue
num = num + 1
total = total + numb
print(int(total), num, total/num)
| 3.96875 | 4 |
src/test/python/nht_exit.py | mike10004/subprocess-java | 1 | 54555 | <reponame>mike10004/subprocess-java<filename>src/test/python/nht_exit.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
"""Exits with a status code specified by the first argument"""
if __name__ == '__main__':
args = sys.argv[1:]
code = 0
if args:
t... | 2.671875 | 3 |
tinynumpy/benchmark.py | Kramer84/tinynumpy | 168 | 54556 | <reponame>Kramer84/tinynumpy<filename>tinynumpy/benchmark.py
# -*- coding: utf-8 -*-
# Copyright (c) 2014, <NAME> and <NAME>
# tinynumpy is distributed under the terms of the MIT License.
""" Benchmarks for tinynumpy
Findings:
* A list of floats costs about 33 bytes per float
* A list if ints costs anout 41 bytes pe... | 3.046875 | 3 |
apps/job/admin.py | matheuslins/cuzjobs | 1 | 54557 | from django.contrib import admin
from .models import Job
from .models import JobCandidate
class JobAdmin(admin.ModelAdmin):
ordering = ['date_created']
search_fields = ['title']
admin.site.register(Job, JobAdmin)
admin.site.register(JobCandidate)
| 1.734375 | 2 |
geotest.py | stephensheridan/ipregex | 0 | 54558 | import geoip2.database
reader = geoip2.database.Reader('GeoLite2-City.mmdb')
response = reader.city('172.16.58.3')
country = response.country.name
city = response.city.name
print country + " " + city
| 2.625 | 3 |
pwdcheck/pwdcheck.py | pavdmyt/pwdcheck | 0 | 54559 | <filename>pwdcheck/pwdcheck.py
# -*- coding: utf-8 -*-
"""
pwdcheck.pwdcheck
~~~~~~~~~~~~~~~~~
"""
from __future__ import absolute_import
from pwdcheck.helpers import Dotdict
from .compat import builtin_str
from .cxty import Complexity
from .exceptions import PolicyError, PolicyParsingError
from .extras import Ext... | 2.265625 | 2 |
cmkinitramfs/init.py | lleseur/cmkinitramfs | 0 | 54560 | """Module providing functions to build an init script
The :func:`mkinit` function will generate a ``/init`` script.
``do_foo()`` functions write a string performing the foo action into a
stream. This stream should be the init script.
``_fun_foo()`` functions write a string defining the foo function into a
stream. Th... | 2.765625 | 3 |
src/djanban/apps/repositories/migrations/0014_auto_20161006_0143.py | diegojromerolopez/djanban | 33 | 54561 | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-10-05 23:43
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('boards', '0030_auto_20160925_1843'),
('repositories', '0013_auto_20160927_1935'),
]
o... | 1.53125 | 2 |
RNAPuzzles/rnapuzzles/models/puzzles.py | whinyadventure/RNA-Puzzles | 0 | 54562 | <reponame>whinyadventure/RNA-Puzzles
from django.core.validators import FileExtensionValidator
from django.db import models
from django.utils import timezone
from .user import CustomUser
import datetime
from six import text_type
import os
def puzzle_info_img_filename(instance, filename):
return 'puzzle_{}_img{}'... | 2.296875 | 2 |
full-problems/sortTheFiles.py | vikas-t/DS-Algo | 0 | 54563 | #!/usr/bin/python
# https://www.hiredintech.com/classrooms/algorithm-design/lesson/19/task/16
def sort_the_files(n, result):
def printr(s, e, result):
cnt = len(result)
for i in xrange(s, e):
if cnt <= 1000:
result.append(i)
cnt = cnt + 1
else:
... | 3.484375 | 3 |
language/resources/tokens/token_types.py | Shom770/sparrow | 0 | 54564 | <reponame>Shom770/sparrow
from enum import Enum
class TokenType(Enum):
"""An Enum-derived class that defines token types in the language."""
IDENTIFIER = 1
KEYWORD = 2
BLOCK_OPEN = 3
BLOCK_CLOSE = 4
METHOD = 5
EQ = 6
INT = 7
FLOAT = 8
PLUS = 9
MINUS = 10
MULT = 11
D... | 3.53125 | 4 |
provider/__init__.py | Ritvik29/lts-investment | 0 | 54565 | from .stockinfo import get_stock_info_provider, StockInfoProvider
from .utils import billion_to_million, to_million, from_any_to_million, first_valid_index, last_valid_index
| 1.148438 | 1 |
extract_payload.py | SalikLP/classification-of-encrypted-traffic | 35 | 54566 | import datetime
import utils
import glob
import os
import numpy as np
import pandas as pd
if __name__ == '__main__':
loaddir = "E:/Data/h5/"
labels = ['https', 'netflix']
max_packet_length = 1514
for label in labels:
print("Starting label: " + label)
savedir = loaddir + label + "/"
... | 2.65625 | 3 |
merlin/models/data/movielens.py | rhdong/models | 0 | 54567 | import logging
import os
import shutil
from os import path
import numpy as np
import nvtabular as nvt
import pandas as pd
from nvtabular import ops
import merlin.io
# Get dataframe library - cudf or pandas
from merlin.core.dispatch import get_lib
from merlin.core.utils import download_file
df_lib = get_lib()
loggi... | 2.75 | 3 |
users/permissions.py | emushell/django-rest-react-todo-app | 0 | 54568 | from rest_framework import permissions
class UserIsOwnerUserProfile(permissions.BasePermission):
def has_object_permission(self, request, view, obj):
return request.user.id == obj.user.id
| 2.21875 | 2 |
tednet/tnn/cp/__init__.py | perryuu/tednet | 31 | 54569 | # -*- coding: UTF-8 -*-
from .base import CPConv2D, CPLinear
from .cp_lenet import CPLeNet5
from .cp_resnet import CPResNet20, CPResNet32
from .cp_rnn import CPLSTM
__all__ = ["CPConv2D", "CPLinear",
"CPLeNet5",
"CPResNet20", "CPResNet32",
"CPLSTM"
]
| 0.96875 | 1 |
king/main.py | Xminent/king | 0 | 54570 | import logging
from pathlib import Path
from discord import Intents
from core.bot import KingBot
# LOGS
log = logging.getLogger('king')
log.setLevel(logging.INFO)
# INTENTS
intents = Intents.all()
# CONFIG YAML
config = Path("config.yaml")
bot = KingBot(
command_prefix=KingBot.get_prefix,
intents=intents,... | 2.15625 | 2 |
GUI_Qt/GUI_DATOS.py | LASER-UD/Open_BCI_and_MYO_UD | 0 | 54571 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'GUI_DATOS_PACIENTE.ui'
#
# Created by: PyQt5 UI code generator 5.14.1
#
# WARNING! All changes made in this file will be lost!
import os
from PyQt5.QtWidgets import QMessageBox
import subprocess
from PyQt5 import QtCore, QtGui, QtWidgets... | 1.96875 | 2 |
blog/urls.py | PrasadRaoJammuna/Personal-Blog | 3 | 54572 | """blog URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/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-... | 2.71875 | 3 |
14/python/collatz.py | tylermumford/euler | 1 | 54573 | #!/usr/bin/env python3
collatz_memo = {1: 1}
def collatz(n):
'''Return the length of the Collatz sequence for the given input'''
if n in collatz_memo:
result = collatz_memo[n]
elif n % 2 == 0:
collatz_memo[n] = 1 + collatz(n / 2)
result = collatz_memo[n]
else:
collatz_... | 4.34375 | 4 |
Challenges/Space/bof_libc_leak.py | limitedeternity/HackTheBox | 0 | 54574 | <reponame>limitedeternity/HackTheBox<filename>Challenges/Space/bof_libc_leak.py
# coding: utf-8
from pwn import *
HOST, PORT = "172.16.17.32", 30203
elf = context.binary = ELF("./space")
r = elf.process()
r.recvuntil(">")
r.sendline(cyclic(1024))
r.wait()
r.close()
core = Coredump("./core")
buffer_size = cyclic_find... | 2.21875 | 2 |
tests/test_config.py | Hellowlol/bw_plex | 371 | 54575 | <reponame>Hellowlol/bw_plex
import os
from conftest import TEST_DATA
from bw_plex.config import read_or_make
def test_config():
conf = read_or_make(os.path.join(TEST_DATA, 'test_config.ini'))
assert 'level' not in conf['general']
assert conf['general']['loglevel'] == 'info'
| 2.0625 | 2 |
config/webserver_config.py | pthacker22/docker-airflow | 0 | 54576 | import os
from airflow import configuration as conf
from flask_appbuilder.security.manager import AUTH_LDAP
basedir = os.path.abspath(os.path.dirname(__file__))
SQLALCHEMY_DATABASE_URI = conf.get('core', 'SQL_ALCHEMY_CONN')
CSRF_ENABLED = True
AUTH_TYPE = AUTH_LDAP
AUTH_ROLE_ADMIN = 'Admin'
AUTH_USER_REGISTRATION = ... | 2.015625 | 2 |
fabfile/prodreproc/__init__.py | omeyn/fabric | 0 | 54577 | <reponame>omeyn/fabric
from fabric.api import *
@task
@parallel
@roles('prod_reproc')
def stop():
sudo('sh -c "cd /home/crap/prod_reproc/bin && /home/crap/prod_reproc/bin/stop-processors.sh"')
@task
@parallel
@roles('prod_reproc')
def start_verbatim():
sudo('sh -c "cd /home/crap/prod_reproc/bin && /home/crap/pr... | 1.859375 | 2 |
geo/views.py | Three-Dev-Musketeers/Mumbai_Police | 5 | 54578 | <filename>geo/views.py
from django.contrib.gis.db.models.functions import Distance
from django.contrib.gis.geos import Point
from django.shortcuts import render
from .models import Maha1, Incidences
from django.views.generic import TemplateView
from django.core.serializers import serialize
from django.contrib.gis.geoip... | 2.15625 | 2 |
response_operations_ui/views/passwords.py | ONSdigital/response-operations-ui | 3 | 54579 | import logging
from flask import Blueprint, abort
from flask import current_app as app
from flask import redirect, render_template, request, url_for
from itsdangerous import BadData, BadSignature, SignatureExpired, URLSafeSerializer
from structlog import wrap_logger
from response_operations_ui.common import token_dec... | 2.25 | 2 |
src/diameter.py | jkunimune15/kodi-analysis | 0 | 54580 | import numpy as np
import matplotlib.pyplot as plt
""" E is in MeV, D in μm, vB in μm/h, τ in h, and k in (MeV)^-1 """
def E(D, τ=5, vB=2.66, k=.8, n=1.2, a=1, z=1):
return z**2*a*((2*τ*vB/D - 1)/k)**(1/n)
def D(E, τ=5, vB=2.66, k=.8, n=1.2, a=1, z=1):
return np.where(E > 0,
2*τ*vB/(1 + k*(E/(z**2*a))**n),
np.na... | 2.65625 | 3 |
tdlda/vendoring/ceat.py | jsosulski/time-decoupled-lda | 5 | 54581 | <filename>tdlda/vendoring/ceat.py
import inspect
import sklearn.pipeline
from sklearn.base import clone
from sklearn.utils.metaestimators import if_delegate_has_method
from sklearn.utils import _print_elapsed_time
from sklearn.utils.validation import check_memory
import pyriemann.tangentspace
import pyriemann.classif... | 1.96875 | 2 |
groups_model/DNNClassTester.py | SergioRoldan/DNNClassifier | 1 | 54582 | import groupDNNClassifier as DNNC
import os
from datetime import datetime
import time
start = time.clock()
now = str(datetime.now()).split('.')[0].replace(" ", "_").replace(":", "_").replace("-", "_")
directory = "runs/" + now
learning_rate = 0.000013
if not os.path.exists(directory):
os.makedirs(directory)
fo... | 2.546875 | 3 |
examples/AgentTester.py | henrydeng/MonkeyHelper | 5 | 54583 | #
# Copyright 2014 <NAME> (http://mxia.me) and others
#
# 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 a... | 2.015625 | 2 |
userManagment/apps.py | uzairAK/serverom-panel | 0 | 54584 | # -*- coding: utf-8 -*-
from django.apps import AppConfig
class UsermanagmentConfig(AppConfig):
name = 'userManagment'
| 1 | 1 |
main.py | darkrilin/compsci-assignment | 1 | 54585 | from math import floor
import scipy.io as sio
from bokeh.plotting import figure, show, output_file, save, ColumnDataSource
from bokeh.models import HoverTool, CrosshairTool, PanTool, WheelZoomTool, ResetTool, SaveTool, CustomJS
from bokeh.models.widgets import Button
from bokeh.layouts import widgetbox, row, column, ... | 2.3125 | 2 |
apps/utils/shopify_upload_product_utility/import_partspal.py | crisariasgg/RepinSolution | 0 | 54586 | # Local imports
import datetime
# Third party
import pandas as pd
import pymysql
from sqlalchemy import create_engine
class PartsPalImport():
def __init__(self,name,user,host,port,password):
self.user = user
self.password = password
self.host = host
self.port = port
self.name = name
self.connecti... | 3.09375 | 3 |
fc19/client/test_contract_primitives.py | alexisVandewalle/ethdkg | 26 | 54587 | import utils
import vss
from crypto import G1, G2, add, neg, multiply, random_scalar, check_pairing
w3 = utils.connect()
contract = utils.deploy_contract('DKG')
def test_add():
a = multiply(G1, 5)
b = multiply(G1, 10)
s = add(a, b)
assert contract.bn128_add([a[0], a[1], b[0], b[1]]) == list(s)
def... | 2.359375 | 2 |
Python Class ---- Estrutura de Sequencial/Exercicio 4.py | DouglasCarvalhoPereira/Python-Class---Versionado | 1 | 54588 | number_1 = int(input("Digite a nota 1: "))
number_2 = int(input("Digite a nota 1: "))
number_3 = int(input("Digite a nota 1: "))
number_4 = int(input("Digite a nota 1: "))
media = (number_1 + number_2 + number_3 + number_4) / 4
print("A média é {}.".format(media)) | 3.828125 | 4 |
tests/test_exit_handler.py | TBeijen/klutch | 1 | 54589 | import signal
from unittest.mock import MagicMock
from klutch.exit_handler import ExitHandler
def test_initial_state():
handler = ExitHandler()
assert not handler.safe_to_exit
assert not handler.should_exit
def test_traps_signals(monkeypatch):
mock_signal = MagicMock()
monkeypatch.setattr("sign... | 2.734375 | 3 |
commands/dice.py | apauna/RASSH | 3 | 54590 | # Copyright (c) 2009 <NAME> <<EMAIL>>
# See the COPYRIGHT file for more information
# Random commands when running new executables
from rassh.core.honeypot import HoneyPotCommand
commands = {}
clist = []
class command_orly(HoneyPotCommand):
def start(self):
self.orly()
def orly(self):
self.... | 2.484375 | 2 |
sdk/packages/pyalice/gui/composite_widget.py | ddr95070/RMIsaac | 0 | 54591 | <filename>sdk/packages/pyalice/gui/composite_widget.py
'''
Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
NVIDIA CORPORATION and its licensors retain all intellectual property
and proprietary rights in and to this software, related documentation
and any modifications thereto. Any use, reproduction, discl... | 2.3125 | 2 |
safe/admin.py | JoeJasinski/password-safe | 0 | 54592 | from django.contrib import admin
from safe.models import PublicKey, Credential, UserSecret
class PublicKeyAdmin(admin.ModelAdmin):
raw_id_fields = ['user']
readonly_fields = ['created', 'modified']
list_display = ['user', 'created', 'modified']
class UserSecretInline(admin.StackedInline):
model = U... | 1.945313 | 2 |
tests/test_basic.py | dongsam/dongsam | 0 | 54593 | # -*- coding: utf-8 -*-
import pytest
from dongsam.basic import *
from dongsam import basic
word_type = {
0: 'eng',
1: 'kor',
2: 'chi'
}
class TestBasic:
def test_get_key_from_value(self):
assert get_key_from_value(word_type, 'kor') == 1
def test_get_key_from_value_not_exist(self):
... | 2.734375 | 3 |
configs/aitod/v001.14.09_aitod_faster_rcnn_r50_giou_nms_only_train.py | jwwangchn/mmdet-aitod | 2 | 54594 | <reponame>jwwangchn/mmdet-aitod
"""
Faster R-CNN with Wasserstein NMS (only train)
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=1500 ] = 0.115
Average Precision (AP) @[ IoU=0.25 | area= all | maxDets=1500 ] = -1.000
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=1500 ] = 0... | 1.53125 | 2 |
pype/plugins/maya/publish/collect_mayaascii.py | kalisp/pype | 0 | 54595 | from maya import cmds
import pyblish.api
class CollectMayaAscii(pyblish.api.InstancePlugin):
"""Collect May Ascii Data
"""
order = pyblish.api.CollectorOrder + 0.2
label = 'Collect Model Data'
families = ["mayaAscii"]
def process(self, instance):
# Extract only current frame (overr... | 2.265625 | 2 |
src/batch_set_log_clf.py | wailamjonathanlee/predicting-alignment-algorithm-performance-using-machine-learning | 1 | 54596 | #!/usr/bin/env python
import os, logging
from alignclf import set_log_clf
from alignclf.utils import setup_logging
logger = logging.getLogger(__name__)
if __name__ == '__main__':
setup_logging(default_path='')
datadir = os.path.join('.', 'data', 'synthetic', 'BPI2018', 'net5')
dirty_datadir = os.path... | 2.109375 | 2 |
scripts/addons/animation_nodes/graphics/interpolation_preview.py | Tilapiatsu/blender-custom_conf | 2 | 54597 | import gpu
import numpy
from bgl import *
from . rectangle import Rectangle
from gpu_extras.batch import batch_for_shader
shader = gpu.shader.from_builtin('2D_UNIFORM_COLOR')
class InterpolationPreview:
def __init__(self, interpolation, position, width, resolution):
self.interpolation = interpolation
... | 2.53125 | 3 |
addons/generic_request/migrations/11.0.1.0.0/post-migrate.py | marionumza/vocal_v12 | 0 | 54598 | <reponame>marionumza/vocal_v12<filename>addons/generic_request/migrations/11.0.1.0.0/post-migrate.py
def migrate(cr, installed_version):
cr.execute("""
DROP TABLE IF EXISTS request_wizard_assign CASCADE;
DELETE FROM ir_model WHERE model = 'request.wizard.assign';
""")
| 1.5 | 2 |
apps/research/managers.py | sebfest/homepage | 0 | 54599 | from django.db import models
from django.db.models import Q
class PaperQuerySet(models.QuerySet):
def published(self):
"""Get all published items."""
return self.filter(Q(publish=True))
| 2.109375 | 2 |