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 |
|---|---|---|---|---|---|---|
ngcccbase/tests/test_verifier.py | killerstorm/ngcccbase | 31 | 12780151 | <filename>ngcccbase/tests/test_verifier.py
#!/usr/bin/env python
import unittest
from ngcccbase.verifier import Verifier, hash_decode
from ngcccbase.services.electrum import (
ElectrumInterface, EnhancedBlockchainState)
class FakeBlockchainState(object):
def get_height(self):
return 100
def get_... | 2.484375 | 2 |
scripts/plot.py | Rabscuttler/heat | 3 | 12780152 | # general plotting functions
import matplotlib.pyplot as plt
# plot the given hourly profile
def hourly_profile(profile):
hourly_profile_building('SFH',profile)
hourly_profile_building('MFH',profile)
hourly_profile_building('COM',profile)
def hourly_profile_building(building,profile):
for(name,data) ... | 3.578125 | 4 |
python/435.non-overlapping-intervals.py | Zhenye-Na/leetcode | 10 | 12780153 | #
# @lc app=leetcode id=435 lang=python3
#
# [435] Non-overlapping Intervals
#
class Solution:
def eraseOverlapIntervals(self, intervals: List[List[int]]) -> int:
if not intervals:
return 0
intervals = sorted(intervals, key=lambda x: x[1])
self.index = 0
self... | 3.375 | 3 |
backend/flask-api/migrations/versions/d77d5b7c3921_.py | lucasbibianot/inova-cnj-time16 | 0 | 12780154 | <filename>backend/flask-api/migrations/versions/d77d5b7c3921_.py
"""Retirando complemento 5008
Revision ID: d77d5b7c3921
Revises: 495061e1bbe4
Create Date: 2020-10-18 14:28:57.319452
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '49506... | 1.460938 | 1 |
pythonAlgorithm/highlevel/Big Integer Addition.py | Sky-zzt/lintcodePractice | 1 | 12780155 | class Solution:
"""
@param num1: a non-negative integers
@param num2: a non-negative integers
@return: return sum of num1 and num2
以字符串的形式给出两个非负整数 num1 和 num2,返回 num1 和 num2 的和。
Example
样例 1:
输入 : num1 = "123", num2 = "45"
输出 : "168"
Notice
num1 和 num2 的长度都小于5100。
num1 和 num2 都只包含数字 0-9。
num1 和 nu... | 3.921875 | 4 |
src/utils/dictutils.py | sourav1122/foremast-brain | 23 | 12780156 |
def retrieveKVList(dicts):
keys=[]
values=[]
for key ,value in dicts.items():
keys.append(key)
values.append(value)
return keys, values
def convertDictKey(mydict,replacefrom, replaceto):
for key in mydict:
mydict[key.replace(replacefrom,replaceto)] = mydict.pop(key)
... | 3.359375 | 3 |
migrations/versions/eeafa5624ec7_artpiece_slug.py | cclrobotics/ARTBot | 5 | 12780157 | <gh_stars>1-10
"""artpiece_slug
Revision ID: eeafa5624ec7
Revises: a<PASSWORD>
Create Date: 2020-02-09 05:42:17.894691
"""
# revision identifiers, used by Alembic.
revision = 'eeafa5624ec7'
down_revision = '<KEY>'
branch_labels = None
depends_on = None
from slugify import slugify
from alembic import op
import sqlal... | 1.703125 | 2 |
src/voter.py | keyan/e2e_voting | 1 | 12780158 | import random
from typing import Optional
from src.tablet import Tablet
from src.sbb import SBBContents
from src.sv_vote import SVVote
DEFAULT_NUM_CANDIDATES = 2
class Voter:
def __init__(self, voter_id: int, M: int, vote: Optional[int] = None):
self.voter_id: int = voter_id
self.ballot_hash: s... | 2.96875 | 3 |
test_herencia.py | Ivan395/Python | 0 | 12780159 | #! /usr/bin/python3
# -*- coding: utf-8 -*-
from cuadrado import Cuadrado
def run():
cuad = Cuadrado(1,2,3)
print(cuad.show())
if __name__ == '__main__':
run()
| 2.53125 | 3 |
problem/01000~09999/02004/2004.py3.py | njw1204/BOJ-AC | 1 | 12780160 | <reponame>njw1204/BOJ-AC
MIN=lambda a,b: a if a<b else b
def FactoPowerCount(n,x):
count = 0
while n//x>0:
count+=n//x
n//=x
return count
n,m=map(int,input().split())
print(MIN(FactoPowerCount(n,2)-FactoPowerCount(m,2)-FactoPowerCount(n-m,2),
FactoPowerCount(n,5)-FactoPowerCount(m,5)-FactoPowerCount(... | 3.015625 | 3 |
lbm/src/core/obstacle.py | jviquerat/lbm | 32 | 12780161 | ### ************************************************
### Class defining an obstacle in the lattice
class obstacle:
def __init__(self, name, n_pts, n_spts, type, size, pos):
self.name = name
self.n_pts = n_pts
self.n_spts = n_spts
self.type = type
self.size = size
... | 3.15625 | 3 |
events/views.py | wwangwe/Team-213-A-Back-End | 0 | 12780162 | from __future__ import unicode_literals
from django.shortcuts import render
from datetime import date, timedelta
# django:
from django.views.generic import ListView, DetailView
from django.conf import settings
from django.shortcuts import get_object_or_404
from django.utils.dates import MONTHS_ALT
# thirdparties:
im... | 1.90625 | 2 |
tests/test_evaluate.py | Tommo565/titanic-mlflow | 1 | 12780163 | <reponame>Tommo565/titanic-mlflow
import os
import mlflow
import sklearn
from src.utils import (
load_config,
load_logger,
load_parameters,
)
from src.ingest_split import ingest_split
from src.preprocessing_pipeline import create_preprocessing_pipeline
from src.models import create_logreg_model
from src.mod... | 2.53125 | 3 |
src/kusto/azext_kusto/vendored_sdks/kusto/aio/_kusto_management_client_async.py | tilnl/azure-cli-extensions | 0 | 12780164 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 1.757813 | 2 |
Python/test/currencies.py | yrtf/QuantLib-SWIG | 231 | 12780165 | """
Copyright (C) 2021 <NAME>
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modify it
under the terms of the QuantLib license. You should have received a
copy... | 3.09375 | 3 |
example_racktests/6_create_host_with_minimum_bigger_disk_to_verify_rackattack_virtual.py | eyal-stratoscale/pyracktest | 0 | 12780166 | from strato.racktest.infra.suite import *
class Test:
HOSTS = dict(it=dict(rootfs="rootfs-basic", minimumDisk1SizeGB=20))
def run(self):
partitions = host.it.ssh.run.script("cat /proc/partitions")
vdaSizeKB = int(partitions.split('\n')[2][13:13 + 12].strip())
TS_ASSERT_LESS_THAN(18, v... | 1.921875 | 2 |
Python/detect_loop_in_linkedList.py | Shrenik811rp/Hacktoberfest | 1 | 12780167 | <gh_stars>1-10
# Python Demonstration to detect loop/circle in linked list in two different approches:
# 1. Two pointer approch
# 2. Hashing approch
# 3. Normal approch by marking visited nodes and checking if a cycle exists.
# Two pointer approch
def detectLoop_TwoPointer(head):
slow = head # initializing slow ... | 3.875 | 4 |
src/apps/devices/discoball.py | ajintom/music_sync | 0 | 12780168 | <reponame>ajintom/music_sync
import device
from phosphene.signal import *
from phosphene.signalutil import *
from phosphene.graphs import *
class DiscoBall(device.Device):
def __init__(self, port):
device.Device.__init__(self, "DiscoBall", port)
def setupSignal(self, signal):
def beats(s):
... | 2.8125 | 3 |
Python/check-if-n-and-its-double-exist.py | RideGreg/LeetCode | 1 | 12780169 | <reponame>RideGreg/LeetCode
# Time: O(n)
# Space: O(n)
# 1346 weekly contest 175 2/8/2020
# Given an array arr of integers, check if there exists two integers N and M such that N is the double of M ( i.e. N = 2 * M).
#
# More formally check if there exists two indices i and j such that :
#
# i != j
# 0 <= i, j < arr... | 3.796875 | 4 |
examples/tf/trpo_cartpole_recurrent.py | icml2020submission6857/metarl | 2 | 12780170 | #!/usr/bin/env python3
"""This is an example to train a task with TRPO algorithm.
It uses an LSTM-based recurrent policy.
Here it runs CartPole-v1 environment with 100 iterations.
Results:
AverageReturn: 100
RiseTime: itr 13
"""
from metarl.experiment import run_experiment
from metarl.np.baselines import Lin... | 2.453125 | 2 |
examples/ae-benchmarks/model/xceptionnet.py | lijiansong/singa | 0 | 12780171 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 2.078125 | 2 |
tests/continuous_tests/interval_tests/test_merges_with_interval.py | lycantropos/topo | 0 | 12780172 | <reponame>lycantropos/topo<filename>tests/continuous_tests/interval_tests/test_merges_with_interval.py
from tests.utils import implication
from topo.continuous import Interval
def test_reflexivity(interval: Interval) -> None:
assert interval.merges_with_interval(interval)
def test_intersecting_intervals(interva... | 2.171875 | 2 |
tests/masks/test_mask.py | j-h-m/Media-Journaling-Tool | 0 | 12780173 | import unittest
from tests.test_support import TestSupport
from mock import Mock
from maskgen.masks.donor_rules import VideoDonor, AudioDonor, AllStreamDonor, AllAudioStreamDonor, \
VideoDonorWithoutAudio, InterpolateDonor,AudioZipDonor
from maskgen.video_tools import get_type_of_segment, get_start_time_from_segme... | 2.40625 | 2 |
6_1_2.py | rursvd/pynumerical2 | 0 | 12780174 | %matplotlib inline
from numpy import linspace,sqrt
import matplotlib.pyplot as plt
x = linspace(-1,5,50)
y1 = 1.0/sqrt(x**2 + 1)
y2 = 1.0/sqrt(3 * x**2 + 1)
plt.plot(x,y1,label='plot 1')
plt.plot(x,y2,'--',label='plot 2')
plt.legend()
plt.show()
| 3.21875 | 3 |
ubersmith_client/ubersmith_request.py | internap/python-ubersmithclient | 1 | 12780175 | <filename>ubersmith_client/ubersmith_request.py
# Copyright 2017 Internap.
#
# 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 requir... | 2.296875 | 2 |
Learning/surface 3D plot radial.py | TOLOSAT/gravimetry-payload | 1 | 12780176 | #%% -*- coding: utf-8 -*-
"""
Created on Sun Apr 26 02:47:57 2020
plot sherical hermonics in 3D with radial colormap
http://balbuceosastropy.blogspot.com/2015/06/spherical-harmonics-in-python.html
"""
from __future__ import division
import scipy as sci
import scipy.special as sp
import numpy as np
import matplotlib... | 2.5625 | 3 |
blog_content/models.py | paulootavio343/Blog | 0 | 12780177 | <filename>blog_content/models.py
from django.db import models
from django.utils.text import slugify
import os
from PIL import Image
from Blog import settings
from django.contrib.auth import get_user_model
User = get_user_model()
class Category(models.Model):
category_name = models.CharField(
max_length=64... | 2.3125 | 2 |
python/dataserver.py | chasepd/hackerbox0065 | 2 | 12780178 | from flask import Flask
from pycoingecko import CoinGeckoAPI
from time import sleep
from threading import Timer
cg = CoinGeckoAPI()
app = Flask(__name__)
coin_data = {}
coins_to_fetch = ["bitcoin", "ethereum", "litecoin", "monero", "dogecoin", "cardano", "tezos", "stellar"]
#Credit for RepeatedTimer class goes to Me... | 2.9375 | 3 |
moving_zeros_to_the_end.py | StefanS97/free-time-fun | 0 | 12780179 | def move_zeros(array):
helper_array = []
zeros_counter = 0
helper_zeros = 0
for i in range(len(array)):
if array[i] == 0:
zeros_counter += 1
else:
helper_array.append(array[i])
if zeros_counter > 0:
while helper_zeros < zeros_counter:
help... | 3.65625 | 4 |
examples/src/main/python/download_http.py | apache/airavata-mft | 7 | 12780180 | import grpc
import MFTApi_pb2
import MFTApi_pb2_grpc
channel = grpc.insecure_channel('localhost:7004')
stub = MFTApi_pb2_grpc.MFTApiServiceStub(channel)
download_request = MFTApi_pb2.HttpDownloadApiRequest(sourceStoreId ="remote-ssh-storage",
sourcePath= "/tmp/a.txt",
... | 2.40625 | 2 |
srcgen.py | emlynoregan/sutlstudio | 0 | 12780181 | import json
from decl import Decl, Dist
from google.appengine.ext import ndb
import webapp2
from google.appengine.api import users
import logging
class SrcGenBase(webapp2.RequestHandler):
def RequiredUser(self):
return None
def ProcessSrcGen(self, aUser):
raise Exception("ProcessSrcGen Not Overridden")
def ge... | 2.421875 | 2 |
pyarc/test/test_comparable_itemset.py | jirifilip/CBA | 19 | 12780182 | <gh_stars>10-100
import unittest
from pyarc.data_structures import (
Item,
Antecedent,
ComparableItemSet,
Transaction
)
class TestComparableItemSet(unittest.TestCase):
def test_compare(self):
row1 = [1, 1, 0]
header1 = ["A", "B", "C"]
transaction1 = Transaction(row1, head... | 3.09375 | 3 |
analysis/lib/stats/blueprint.py | astutespruce/secas-blueprint | 0 | 12780183 | <reponame>astutespruce/secas-blueprint<gh_stars>0
from pathlib import Path
import numpy as np
import rasterio
from analysis.constants import BLUEPRINT, INPUT_AREA_VALUES, ACRES_PRECISION, M2_ACRES
from analysis.lib.raster import (
detect_data,
boundless_raster_geometry_mask,
extract_count_in_geometry,
... | 2.359375 | 2 |
tmp/app.py | ArvisP/Arvis-Rubix | 2 | 12780184 | from flask import Flask, render_template, request, session, redirect, url_for
from models import db, User#, Places
from forms import SignupForm, LoginForm
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://postgres:edzh@localhost:5432/rubix'
db.init_app(app)
app.secret_key = "development-key... | 3.15625 | 3 |
klimalogger/data_builder.py | wuan/klimalogger | 5 | 12780185 | <filename>klimalogger/data_builder.py
import socket
import datetime
import pytz
from injector import singleton, inject
from .config import Config
@singleton
class DataBuilder(object):
@inject
def __init__(self, configuration: Config):
self.location = configuration.client_location_name
self.ho... | 2.53125 | 3 |
2020/day09.py | zzl0/aoc | 2 | 12780186 | from utils import *
def search(counter, target):
for a in counter:
b = target - a
if (a == b and counter[b] >= 2) or (a != b and counter[b]):
return True
return False
def day9_1(nums):
counter, i = Counter(nums[:25]), 0
for j in range(25, len(nums)):
if not search... | 3.296875 | 3 |
year/2020/04/passport_validator.py | nbalas/advent_of_code | 0 | 12780187 | <filename>year/2020/04/passport_validator.py
from operator import methodcaller
from logs.setup_logs import init_logs
from readers.file_reader import FileReader
import re
logger = init_logs(__name__)
VALID_EYE_COLORS = ["amb", "blu", "brn", "gry", "grn", "hzl", "oth"]
REQUIRED_FIELDS = {
"byr": lambda x: 1920 <=... | 2.9375 | 3 |
src/tt_storage/tt_storage/models.py | serhii73/the-tale | 0 | 12780188 |
import uuid
from django.db import models
from . import conf
class Item(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
owner = models.PositiveIntegerField(db_index=True)
storage = models.IntegerField(default=0)
data = models.JSONField(default=dict)
... | 2.265625 | 2 |
freyr_app/core/processing/sentiment.py | blanchefort/freyrmonitoring | 2 | 12780189 | <filename>freyr_app/core/processing/sentiment.py
import os
from typing import List
import torch
from transformers import BertTokenizer, BertForSequenceClassification
from django.conf import settings
from ..models import categories
from ..nn import CategoryClassifier
from .nlp import preprocess_text
class Sentimenter:... | 2.109375 | 2 |
djnic/web/views_dominio.py | avdata99/nic | 8 | 12780190 | <filename>djnic/web/views_dominio.py<gh_stars>1-10
from django.conf import settings
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page, cache_control
from django.views.generic.base import TemplateView
from django.views.generic.detail import DetailView
from core.vi... | 1.921875 | 2 |
_notebooks/make_notebooks.py | DTUWindEnergy/TopFarm2 | 4 | 12780191 | import os
import json
import pprint
import shutil
from _notebooks.notebook import Notebook
from topfarm.easy_drivers import EasyDriverBase
# def get_cells(nb):
# cells = []
# for cell in nb['cells']:
# if cell['cell_type'] == 'code' and len(cell['source']) > 0 and '%%include' in cell['source'][0]:
# ... | 2.375 | 2 |
cobi_loss.py | JungHeeKim29/DiffHDRsyn | 15 | 12780192 | <reponame>JungHeeKim29/DiffHDRsyn
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.models.vgg as vgg
from collections import namedtuple
class ContextualBilateralLoss(nn.Module):
"""
Creates a criterion that measures the contextual bilateral loss.
Parameters
---
... | 2.4375 | 2 |
treefort.py | tedder/priceonomics-sandbox | 0 | 12780193 | <reponame>tedder/priceonomics-sandbox<gh_stars>0
#!/usr/bin/env python3
import csv
import sys
import collections
import statistics
cityvals = collections.defaultdict(list)
# notes:
# - data seems to be really clean, actually. after normalizing the case of the city/state they came together.
# - how to represent large... | 2.953125 | 3 |
src/kestrue/naturals.py | brunolange/kestrue | 0 | 12780194 | <gh_stars>0
from functools import reduce
zero = lambda f: lambda x: x
one = lambda f: lambda x: f(x)
two = lambda f: lambda x: f(f(x))
three = lambda f: lambda x: f(f(f(x)))
four = lambda f: lambda x: f(f(f(f(x))))
five = lambda f: lambda x: f(f(f(f(f(x)))))
r"""
succ := \n.\fx.f(nfx)
>>> succ(2)
n -> \gy.g(gy)
-> f... | 3.21875 | 3 |
custom_exceptions.py | kamens/gae_bingo | 34 | 12780195 | <filename>custom_exceptions.py
class InvalidRedirectURLError(Exception):
"""Raised when there is a redirect attempt to an absolute url."""
pass
| 1.960938 | 2 |
Sequences/moreprint.py | zahraaliaghazadeh/python | 0 | 12780196 | <reponame>zahraaliaghazadeh/python<gh_stars>0
name = "Tim"
age = 10
print(name, age, "Python", 2020)
print(name, age, "Python", 2020, sep=", ")
# it will separate with , and space
| 3.453125 | 3 |
tests/main/views/test_brief_response.py | uk-gov-mirror/alphagov.digitalmarketplace-api | 25 | 12780197 | <filename>tests/main/views/test_brief_response.py
"""Tests for brief response views in app/views/brief_responses.py."""
from datetime import datetime, timedelta
from freezegun import freeze_time
import json
import mock
import pytest
from dmapiclient.audit import AuditTypes
from app.main.views.brief_responses import C... | 2.125 | 2 |
python/python.py | stewpidtnlvr/Smartproxy | 0 | 12780198 | import urllib.request as request
url = 'https://ipinfo.io'
username = 'username'
password = 'password'
proxy = f'http://{username}:{password}@gate.<EMAIL>:7000'
query = request.build_opener(request.ProxyHandler({'http': proxy, 'https': proxy}))
print(query.open(url).read())
| 2.640625 | 3 |
Server/index.py | Nycrera/p-game | 1 | 12780199 | import socketio
import mysql.connector
class Player:
def __init__(self,name,id,points,banned,admin,mod):
self.name=name
self.id=id
self.points=points
self.banned=banned
self.admin=admin
self.mod=mod
| 2.28125 | 2 |
Practice Round/main.py | sbrodehl/Hashcode2k20 | 2 | 12780200 | <reponame>sbrodehl/Hashcode2k20<filename>Practice Round/main.py
if __name__ == '__main__':
import importlib
import argparse
parser = argparse.ArgumentParser()
# need to be
parser.add_argument("input", help="input file")
parser.add_argument("--output", help="output file")
parser.add_argume... | 2.921875 | 3 |
smt/SMT.py | jeanqasaur/jeeves | 253 | 12780201 | '''
Translate expressions to SMT import format.
'''
from Z3 import Z3
class UnsatisfiableException(Exception):
pass
# NOTE(JY): Think about if the solver needs to know about everything for
# negative constraints. I don't think so because enough things should be
# concrete that this doesn't matter.
def solve(const... | 2.90625 | 3 |
watchmen/pipeline/core/context/unit_context.py | Insurance-Metrics-Measure-Advisory/watchman-data-connector | 125 | 12780202 | <reponame>Insurance-Metrics-Measure-Advisory/watchman-data-connector
from model.model.pipeline.pipeline import ProcessUnit
from watchmen.monitor.model.pipeline_monitor import UnitRunStatus
from watchmen.pipeline.core.context.stage_context import StageContext
class UnitContext:
stageContext: StageContext
unit... | 1.945313 | 2 |
tensorflow/python/distribute/distribute_coordinator_context.py | EricRemmerswaal/tensorflow | 190,993 | 12780203 | <filename>tensorflow/python/distribute/distribute_coordinator_context.py<gh_stars>1000+
# Copyright 2018 The TensorFlow Authors. 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 Lice... | 1.820313 | 2 |
trove/tests/api/root_on_create.py | dadu1688/trove | 1 | 12780204 | <gh_stars>1-10
# Copyright 2013 OpenStack Foundation
#
# 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.835938 | 2 |
T53_MaxSubArray.py | zoubohao/LeetCodes | 0 | 12780205 | <gh_stars>0
from typing import List
### dp array
class Solution:
def maxSubArray(self, nums: List[int]) -> int:
n = len(nums)
dpArray = [0 for _ in range(n)]
ans = nums[0]
dpArray[0] = nums[0]
for i in range(1, n):
dpArray[i] = max(dpArray[i - 1] + n... | 3.1875 | 3 |
setup.py | oVirt/ovirt-scheduler-proxy | 2 | 12780206 | import os
from setuptools import setup, find_packages
# Utility function to read the README file.
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='ovirt-scheduler-proxy',
version=read('VERSION').strip(),
license='ASL2',
description='oVirt Scheduler... | 1.65625 | 2 |
title_classification/train_word2vec.py | sun-yitao/PsychicLearners | 14 | 12780207 | <filename>title_classification/train_word2vec.py
import gensim
from gensim.models import Word2Vec
from gensim.utils import simple_preprocess
from pathlib import Path
from multiprocessing import cpu_count
psychic_learner_dir = Path.cwd().parent
data_dir = psychic_learner_dir / 'data'
with open(str(data_dir / 'titles.t... | 2.578125 | 3 |
memoboard/__init__.py | codebyravi/MemoBoard | 0 | 12780208 | <reponame>codebyravi/MemoBoard<gh_stars>0
"""
Everything that needs to be set up to get flask running is initialized in this file.
* set up and configure the app
* start the database (db)
* load all (!) models used (essential to create the database using db_create)
* load all (!) controllers
* load api
* S... | 2.703125 | 3 |
bin/utils.py | levathan/systemds | 1 | 12780209 | #!/usr/bin/env python
# -------------------------------------------------------------
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses t... | 1.992188 | 2 |
battlenet/utils.py | BuloZB/battlenet | 0 | 12780210 | import unicodedata
import re
import urllib
_slugify_strip_re = re.compile(r'[^\w\s-]')
_slugify_hyphenate_re = re.compile(r'[-\s]+')
def slugify(value):
slug = unicode(_slugify_strip_re.sub('', normalize(value)).strip().lower())
slug = _slugify_hyphenate_re.sub('-', slug)
if not slug:
return quo... | 2.875 | 3 |
slippy/contact/lubricant_models.py | KDriesen/slippy | 12 | 12780211 | """
Common sub models for lubricants
"""
import numpy as np
__all__ = ['constant_array_property', 'roelands', 'barus', 'nd_barus', 'nd_roelands', 'dowson_higginson',
'nd_dowson_higginson']
def constant_array_property(value: float):
""" Produce a closure that returns an index able constant value
... | 2.84375 | 3 |
fecha_horapy.py | miruimi/edem2021MDA | 0 | 12780212 | # -*- coding: utf-8 -*-
#!/usr/bin/python
import time
ahora = time.strftime("%c")
## representacion de fecha y hora
print "Fecha y hora " + time.strftime("%c")
time.sleep 10 | 3.75 | 4 |
plugins/quetz_content_trust/quetz_content_trust/repo_signer.py | maresb/quetz | 108 | 12780213 | import os
import shutil
from pathlib import Path
import conda_content_trust.signing as cct_signing
class RepoSigner:
def sign_repodata(self, repodata_fn, pkg_mgr_key):
final_fn = self.in_folder / "repodata_signed.json"
print("copy", repodata_fn, final_fn)
shutil.copyfile(repodata_fn, fina... | 2.46875 | 2 |
mmelemental/models/molecule/rdkit_mol.py | ccbiozhaw/mmelemental | 6 | 12780214 | <gh_stars>1-10
from pydantic import Field
from typing import List, Dict, Any
from .gen_mol import ToolkitMol
from mmelemental.util.decorators import require
try:
from rdkit import Chem
from rdkit.Chem import AllChem
except ImportError: # pragma: no cover
Chem = AllChem = None # pragma: no cover
class B... | 2.140625 | 2 |
GradientBoosting/test_gradient_boosting.py | ajinChen/Sklearn_ML_Implementation | 1 | 12780215 | import numpy as np
from gradient_boosting import *
def test_train_predict():
X_train, y_train = load_dataset("data/tiny.rent.train")
X_val, y_val = load_dataset("data/tiny.rent.test")
y_mean, trees = gradient_boosting_mse(X_train, y_train, 5, max_depth=2, nu=0.1)
assert(np.around(y_mean, decimals=4)== 3... | 2.765625 | 3 |
khoros/objects/roles.py | truthbyron/khoros | 0 | 12780216 | # -*- coding: utf-8 -*-
"""
:Module: khoros.objects.roles
:Synopsis: This module includes functions that handle roles and permissions.
:Usage: ``from khoros.objects import roles``
:Example: ``count = roles.get_total_role_count()``
:Created By: <NAME>
:Last Modified: ... | 2.625 | 3 |
machine/storage/backends/base.py | drdarina/slack-machine | 111 | 12780217 | <reponame>drdarina/slack-machine<filename>machine/storage/backends/base.py
class MachineBaseStorage:
"""Base class for storage backends
Extending classes should implement the five methods in this base class. Slack Machine takes
care of a lot of details regarding the persistent storage of data. So storage b... | 3.015625 | 3 |
source/utils/db/manager.py | goakgun/falcon-simple-api | 0 | 12780218 | <filename>source/utils/db/manager.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
import sqlalchemy
from sqlalchemy import orm
from sqlalchemy.orm import scoping
from utils.db import models
from passlib.hash import sha256_crypt
class DBManager(object):
def __init__(self, connection=None, pool_re... | 2.53125 | 3 |
hello_helpers/src/hello_helpers/fit_plane.py | hcrlab/stretch_ros | 0 | 12780219 | <filename>hello_helpers/src/hello_helpers/fit_plane.py<gh_stars>0
#!/usr/bin/env python3
import numpy as np
import cv2
def fit_plane_to_height_image(height_image, mask):
# Perform a least squares fit of a plane to the masked region of
# the height_image. Find the 3 element vector a for the equation
# aX ~... | 2.984375 | 3 |
service_catalog/serializers/instance_serializer.py | a-belhadj/squest | 0 | 12780220 | <reponame>a-belhadj/squest<gh_stars>0
from rest_framework import serializers
from service_catalog.models import Instance
class InstanceSerializer(serializers.ModelSerializer):
class Meta:
model = Instance
fields = '__all__'
read_only_fields = ['service', 'state']
| 1.898438 | 2 |
external_tests/get_tweets.py | garnachod/ConcursoPolicia | 0 | 12780221 | <filename>external_tests/get_tweets.py
from DBbridge.ConsultasCassandra import ConsultasCassandra
import codecs
if __name__ == '__main__':
cq = ConsultasCassandra()
i = 0
with codecs.open("millon_tweets.txt", "w", "utf-8") as f_out:
for tweet in cq.getTweetsTextAndLangAndID('es', limit=1000000):
... | 2.5625 | 3 |
tools/etnaviv/mmt.py | ilbers/etna_viv | 121 | 12780222 | import struct
from collections import namedtuple
def read_1(f):
return f.read(1)[0]
def read_2(f):
return struct.unpack('<H', f.read(2))[0]
def read_4(f):
return struct.unpack('<I', f.read(4))[0]
def read_8(f):
return struct.unpack('<Q', f.read(8))[0]
def read_buffer(f):
length = read_4(f)
retu... | 2.40625 | 2 |
src/catalogo.py | pugaru/NGKS_Shop | 0 | 12780223 | from catalogo.models import Categoria, Produto
class Gerencia_categoria():
def Cria_categoria(request):
nome = request.POST.get("nome")
slug = request.POST.get("slug")
Categoria.objects.create(nome=nome, slug=slug)
def Atualiza_categoria(request, slug):
nome = request.POST.... | 2.578125 | 3 |
motor_controller/src/refactored/src/utilities.py | maf2418/Perceptbot | 2 | 12780224 | PKG_NAME = "motion_control"
PID_SETTINGS_FILE = "pid_settings"
ENCODER_SETTINGS_FILE = "encoder_settings"
LINE = 0.15 # M/S
TURN = 0.075 # M/S
BASE_WIDTH = 0.13 # m
TICKS_PER_METER = 209 # TICKS_PER_REV / (WHEEL_RADIUS * 2 * PI)
MAX_PWM = 16 # hard max to preserve motors via clamp
SPEED_AT_100_PWM = 3.0 # m/s,... | 2.171875 | 2 |
mesh2sh/vonmises_kde.py | le-Greg/mesh2sh | 0 | 12780225 | # Adaptation from https://github.com/williamjameshandley/spherical_kde
# For the rule of thumb : https://arxiv.org/pdf/1306.0517.pdf
# Exact risk improvement of bandwidth selectors for kernel density estimation with directional data
# <NAME>
import math
import scipy.optimize
import scipy.special
import torch
from .ge... | 2.5625 | 3 |
learn/views/choose_exercise.py | Aigrefin/py3learn | 0 | 12780226 | from django.shortcuts import redirect
from learn.services.choice import random_choice, rythm_choice
def choose_rythm_notation_exercise(request, dictionary_pk):
if request.user.is_authenticated():
translation = rythm_choice(dictionary_pk, request.user)
else:
translation = random_choice(diction... | 2.296875 | 2 |
solvcon/kerpak/gasdyn.py | j8xixo12/solvcon | 16 | 12780227 | # -*- coding: UTF-8 -*-
#
# Copyright (C) 2008-2011 <NAME> <<EMAIL>>.
#
# This program 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; either version 2 of the License, or
# (at your option) any later version.
... | 1.875 | 2 |
os_traits/hw/nic/__init__.py | mail2nsrajesh/os-traits | 10 | 12780228 | <reponame>mail2nsrajesh/os-traits
# -*- coding: utf-8 -*-
# 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 ... | 0.914063 | 1 |
ml/ica.py | Max1993Liu/MLImplementation | 0 | 12780229 | """
Independent Component analysis
Reference implementation: https://github.com/asdspal/dimRed/blob/master/ICA.ipynb
""" | 1.148438 | 1 |
segmenters/nlp/JiebaSegmenter/tests/test_jiebasegmenter.py | saoc90/jina-hub | 106 | 12780230 | <reponame>saoc90/jina-hub
import os
import numpy as np
import pytest
from .. import JiebaSegmenter
cur_dir = os.path.dirname(os.path.abspath(__file__))
path_dict_file = os.path.join(cur_dir, 'dict.txt')
def test_jieba_segmenter():
segmenter = JiebaSegmenter(mode='accurate')
text = '今天是个大晴天!安迪回来以后,我们准备去动物园。... | 2.359375 | 2 |
main.py | citReyJoshua/assignment_statement_lexical_analyzer | 0 | 12780231 | from lexical_analyzer.assignment_analyzer import analyze
if __name__ == '__main__':
assignment_statements = []
# get string statements from file
with open('test-cases.txt', 'r') as file:
for line in file:
assignment_statements.append(line.rstrip('\n'))
# lexically analyze
... | 3.25 | 3 |
pystatic/error/message.py | pystatic/pystatic | 0 | 12780232 | <filename>pystatic/error/message.py<gh_stars>0
from typing import Optional, Tuple
from pystatic.error.level import Level
from pystatic.error.position import Position
class Message:
__slots__ = ["level", "msg"]
def __init__(self, level: Level, msg: str) -> None:
self.level = level
self.msg = m... | 2.59375 | 3 |
forfun/dice/rolldice.py | wy2136/wython | 1 | 12780233 | #!/usr/bin/env python
# <NAME> (<EMAIL>)
# Fri Jul 23 16:27:08 EDT 2021
#import xarray as xr, numpy as np, pandas as pd
import os.path
import matplotlib.pyplot as plt
#more imports
#from PIL import Image
import random
from matplotlib import image
#
#
#start from here
dice = range(1,6+1)
idir = os.path.dirname(__file_... | 3.15625 | 3 |
day9.py | jborlik/AdventOfCode2015 | 0 | 12780234 | # -*- coding: utf-8 -*-
# mostly from: http://stackoverflow.com/questions/30552656/python-traveling-salesman-greedy-algorithm
# credit to cMinor
import math
import random
import itertools
def indexOrNeg(arrr, myvalue):
try:
return arrr.index(myvalue)
except:
return -1
def printTour(to... | 3.859375 | 4 |
solutions/python3/633.py | sm2774us/amazon_interview_prep_2021 | 42 | 12780235 | class Solution:
def judgeSquareSum(self, c: int) -> bool:
return not all(((c - i ** 2) ** 0.5) % 1 for i in range(int(c ** 0.5) + 1)) | 3.078125 | 3 |
tests/test_sign_poet.py | HHSIDEAlab/python-poetri | 1 | 12780236 | <reponame>HHSIDEAlab/python-poetri
#!/usr/bin/env python
import unittest, os
from poetri.sign_poet import sign_poet
#This key is for testing and the CN is "transparenthealth.org"
test_private_key = """
-----<KEY>"""
class TestSigning(unittest.TestCase):
def test_sign_poet_happy(self):
result = sign_poet... | 2.875 | 3 |
utils.py | lonesword/lottery-ticket-experiments | 6 | 12780237 | import torch
def get_zero_count(matrix):
# A utility function to count the number of zeroes in a 2-D matrix
return torch.sum(matrix == 0).item()
def apply_mask_dict_to_weight_dict(mask_dict, weight_dict):
# mask_dict - a dictionary where keys are layer names (string) and values are masks (bytetensor) fo... | 3.328125 | 3 |
main.py | Pisun-afk/TOP3 | 0 | 12780238 | <filename>main.py
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import *
from PyQt5.QtGui import QPixmap
import os
from PIL import Image, ImageFilter
app = QApplication([])
window = QWidget()
window.setWindowTitle("Easy Editor")
btn_levo = QPushButton("Лево")
btn_pravo = QPushButton("Право")
btn... | 2.734375 | 3 |
prompt/gather.py | dyabel/detpro | 23 | 12780239 | <gh_stars>10-100
import os, sys
import torch
path = sys.argv[1]
save_name = os.path.join(path, sys.argv[2])
if os.path.exists(save_name):
print('Data: target already exists!')
exit(0)
feats = []
labels = []
ious = []
files = []
for splt in os.listdir(path):
print(splt)
files += [os.path.join(path, sp... | 2.171875 | 2 |
yadi/datalog2sql/datalog2sqlconverter.py | saltzm/yadi | 2 | 12780240 | from .tokens2ast.ast_builder import *
from .parse2tokens.parser import Parser, SyntaxException
from .ast2sql.ast2sqlconverter import Ast2SqlConverter
from .ast2sql.exceptions import *
from ..sql_engine.db_state_tracker import DBStateTracker
from colorama import *
__author__ = 'caioseguin', 'saltzm'
class Datalog2SqlC... | 2.390625 | 2 |
modules/new_user/cog.py | etandinnerman/jct-discord-bot | 0 | 12780241 | <gh_stars>0
from modules.new_user.greeter import Greeter
import discord
from utils import utils
from discord.ext import commands
class NewUserCog(commands.Cog, name="New User"):
"""Ask members who join to use the join command"""
def __init__(self, bot: commands.Bot):
self.bot = bot
self.greeter = Greeter(bot)
... | 2.765625 | 3 |
antiqueProjectApp/migrations/0012_auto_20190812_1531.py | jennie6151/inwiththeold | 0 | 12780242 | # Generated by Django 2.2.3 on 2019-08-12 14:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('antiqueProjectApp', '0011_auto_20190812_1453'),
]
operations = [
migrations.AlterModelOptions(
name='antiquesale',
o... | 1.75 | 2 |
whatsappweb.py | aromal17/Whatsapp-online-activity-tracker | 0 | 12780243 | <gh_stars>0
from selenium import webdriver
from win10toast import ToastNotifier
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import time
import os
# XP... | 2.6875 | 3 |
code/numpy/numpy-tutorial-master/scripts/test.py | vicb1/python-reference | 0 | 12780244 | <gh_stars>0
Z = [[0,0,0,0,0,0],
[0,0,0,1,0,0],
[0,1,0,1,0,0],
[0,0,1,1,0,0],
[0,0,0,0,0,0],
[0,0,0,0,0,0]]
def compute_neighbours(Z):
shape = len(Z), len(Z[0])
N = [[0,]*(shape[0]) for i in range(shape[1])]
for x in range(1,shape[0]-1):
for y in range(1,shape[1]-1):
... | 3.3125 | 3 |
arjuna/tpi/constant.py | bhargavkumar-65/arjuna | 0 | 12780245 | # This file is a part of Arjuna
# Copyright 2015-2021 <NAME>
# Website: www.RahulVerma.net
# 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.140625 | 2 |
URI/1046.py | leilaapsilva/BabySteps | 37 | 12780246 | <filename>URI/1046.py
start, end = [int(x) for x in input().split(" ")]
time = 0
if(start<end):
time=end-start
else:
time=end+24-start
print("O JOGO DUROU "+str(time)+" HORA(S)")
| 2.953125 | 3 |
sample/summary_and_plot_without_label.py | kishiyamat/npbdaa | 4 | 12780247 | #%%
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
import matplotlib.cm as cm
from tqdm import trange, tqdm
from sklearn.metrics import adjusted_rand_score
from argparse import ArgumentParser
from util.config_parser import ConfigParser_with_eval
#%% parse arguments
def... | 2.109375 | 2 |
RasPiBaseStation/ExampleData.py | jgOhYeah/Farm-PJON-LoRa-network | 1 | 12780248 | data = [
bytearray(b'\x00\x00\x00\x00\x00'),
bytearray(b'\xff\x16:Wos\x02\x00C\xbd\x01\x02\xd1hS'),
bytearray(b'\xff\xe6_R\x93\\\x9f\x03h\xc0\x01\xb0af\xf8'),
bytearray(b'\xff&\x0f\x07ZP_\x00a\xae\x01\xd9}q\xeb'),
bytearray(b'\xff&\x0f\x07ZP:\x00a\xb2\x01n\xd8\xd4\x8b'),
bytearray(b'\xff&\x0f\x07ZP\x00\x00a\xa2\x01\xcf... | 1.710938 | 2 |
lte/gateway/python/magma/pipelined/tests/old_tests/test_meter.py | remo5000/magma | 3 | 12780249 | <reponame>remo5000/magma<filename>lte/gateway/python/magma/pipelined/tests/old_tests/test_meter.py
"""
Copyright (c) 2016-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of pat... | 1.976563 | 2 |
givenergy_modbus/modbus.py | zaheerm/givenergy-modbus | 0 | 12780250 | from __future__ import annotations
import logging
from pymodbus.client.sync import ModbusTcpClient
from pymodbus.exceptions import ModbusIOException
from givenergy_modbus.decoder import GivEnergyResponseDecoder
from givenergy_modbus.framer import GivEnergyModbusFramer
from givenergy_modbus.model.register import Hold... | 2.28125 | 2 |