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 |
|---|---|---|---|---|---|---|
panelexpr/__init__.py | actcwlf/panelexpr | 0 | 55200 | <reponame>actcwlf/panelexpr
from panelexpr.interface import *
| 1.078125 | 1 |
src/app/utils/string.py | meyer-net/robot | 12 | 55201 | <filename>src/app/utils/string.py<gh_stars>10-100
# -- coding: UTF-8
class String(object):
def __init__(self):
super(String, self).__init__()
'''
类名标准化
'''
def class_name_normalize(self, class_name):
part_list = []
for item in class_name.split("_"):
part... | 2.96875 | 3 |
word_search.py | claudiasofiaC/python_practice | 0 | 55202 | """
A researcher has gathered thousands of news articles.
But she wants to focus her attention on articles including a specific word.
Complete the function below to help her filter her list of articles.
"""
def word_search(documents, keyword):
# list holds the indices of matching documents
indices = []
# ... | 4.1875 | 4 |
tests/test_model.py | piotlinski/ssd | 0 | 55203 | """Test SSD model."""
import pytest
import torch
from pytorch_ssd.modeling.model import SSD
def test_model_setup(ssd_params):
"""Test model building."""
model = SSD(**ssd_params)
assert model
def test_model_forward(ssd_params):
"""Test model forward method."""
model = SSD(**ssd_params)
data... | 2.578125 | 3 |
test/py/boundary/test11.py | Ahdhn/lar-cc | 1 | 55204 | """ Testing signed 2-boundary """
from larlib import *
sys.path.insert(0, 'test/py/boundary/')
from test10 import *
""" mfaces-to-nfaces relations """
fcOp = larCells2Faces(CV,FV,EV)
CF = [fcOp([k]) for k in range(len(CV))]
FC = invertRelation(CF)
ecOp = larCells2Edges(CV,FV,EV)
CE = [ecOp([k]) for k in range(len(CV... | 2.28125 | 2 |
spikeforest2/experimental/__init__.py | michaeljohnclancy/spikeforest2 | 26 | 55205 | from ._sort import sort | 1.070313 | 1 |
server/server/__init__.py | JS1240/frameworks_and_languages_module | 0 | 55206 | <gh_stars>0
#Defines directory as a package | 1.085938 | 1 |
build/lib.linux-x86_64-2.7_ucs4/mx/DateTime/ISO.py | mkubux/egenix-mx-base | 0 | 55207 | """ This module provides a set of constructors and routines to convert
between DateTime[Delta] instances and ISO representations of date
and time.
Note: Timezones are only interpreted by ParseDateTimeGMT(). All
other constructors silently ignore the time zone information.
Copyright (c) 1998-2000, ... | 3.296875 | 3 |
backend/src/app.py | didi/MeetDot | 6 | 55208 | <filename>backend/src/app.py
# python sys lib
import base64
import monkey_patch
from services.manager import Manager
from utils import deep_update
import argparse
import os
import ssl
import time
import warnings
from datetime import datetime
from http import HTTPStatus
from pathlib import Path
from threading import Tim... | 1.796875 | 2 |
22.ParImpar.py | JDKdevStudio/Taller30Abril | 0 | 55209 | <gh_stars>0
while True:
numero= int(input("Escribir un numero= "))
if numero%2 == 0:
print("El numero es par")
else:
print("El numero es impar")
| 3.921875 | 4 |
tests/test_accounts.py | thesus/claypot | 0 | 55210 | import pytest
from django.urls import reverse
from django.test import override_settings
from django.contrib.auth import authenticate
@pytest.mark.django_db
def test_login(api_client, django_user_model):
"""Tests the ability to login."""
username = "user"
password = "<PASSWORD>"
user = django_user_m... | 2.46875 | 2 |
python/example_code/pinpoint-email/test/test_pinpoint_send_email_message_email_api.py | iconara/aws-doc-sdk-examples | 5,166 | 55211 | <reponame>iconara/aws-doc-sdk-examples<filename>python/example_code/pinpoint-email/test/test_pinpoint_send_email_message_email_api.py<gh_stars>1000+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Unit tests for pinpoint_send_email_message_email_api.py.
""... | 2.296875 | 2 |
zetuptools/api.py | zmarffy/zetuptools | 0 | 55212 | <filename>zetuptools/api.py
import getpass
import logging
import os
import shutil
import subprocess
import sys
from typing import Optional
import docker
import docker.errors
import zmtools
from pkg_resources import resource_filename
LOGGER = logging.getLogger(__name__)
class PipPackage():
def __init__(self, na... | 2.515625 | 3 |
data_processing/01h-extractLAI.py | mnqoliveira/data-assimilation-tomato-models | 0 | 55213 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 8 09:40:22 2019
@author: Monique
Extracts leaf area from scans.
"""
import cv2
import numpy as np
import os
import pandas as pd
import auxiliary_functions.f_aux as aux
# %%
# =============================================================================
#... | 2.484375 | 2 |
messier_objects/views.py | DanielPDWalker/Astrophoto | 0 | 55214 | from rest_framework import viewsets, permissions
from messier_objects import serializers, models
class MessierViewSet(viewsets.ModelViewSet):
"""Messier Object API View"""
serializer_class = serializers.MessierSerializer
queryset = models.MessierObject.objects.all()
permission_classes = (
per... | 2.015625 | 2 |
hybrid_learning/concepts/kpis.py | continental/hybrid_learning | 3 | 55215 | """Collection of loss and metric functions and classes.
A good overview and collection can be found e.g. here:
https://lars76.github.io/neural-networks/object-detection/losses-for-segmentation/
*(the contained code samples are quite instructive but in tensorflow, thus not
used here)*.
"""
# Copyright (c) 2020 Contine... | 2.984375 | 3 |
codes/templates/tfhub_embedding.py | NilLau/NilLau.github.io | 0 | 55216 | <filename>codes/templates/tfhub_embedding.py
import os
import numpy as np
import pandas as pd
import seaborn as sb
import tensorflow as tf
import tensorflow_hub as hub
import sklearn.metrics
import sklearn.model_selection
from absl import logging
logging.set_verbosity(logging.INFO)
train, test = load_data()
X_train,... | 2.1875 | 2 |
setup.py | humantech/smush.py | 0 | 55217 | <filename>setup.py
from distutils.core import setup
setup(name='Smush',
version='1.0',
description='Lossless image optimiser script',
url='https://github.com/thebeansgroup/smush.py',
platforms='OS Independent',
keywords="image optimize lossless",
scripts=['bin/smush_it'],
pack... | 1.15625 | 1 |
rating/__init__.py | LinuxOSsk/Shakal-NG | 10 | 55218 | <filename>rating/__init__.py
# -*- coding: utf-8 -*-
default_app_config = 'rating.apps.AppConfig'
| 1.109375 | 1 |
firecrown/priors.py | LSSTDESC/firecrown | 15 | 55219 | """
A prior can be any distribution in `scipy.stats`. You specify them in YAML
as follows:
.. code-block:: yaml
priors:
module: firecrown.priors
param1:
# here 'norm' is the name of the function/class in scipy.stats
kind: norm
# any keywors to this function are listd by name
#... | 2.71875 | 3 |
tools/venezia/ingestion_engine.py | physycom/slides | 1 | 55220 | <filename>tools/venezia/ingestion_engine.py
#! /usr/bin/env python3
import os
import json
from datetime import datetime
from dateutil import tz
import mysql.connector
import shutil, os
import pandas as pd
import logging
from logging.handlers import RotatingFileHandler, TimedRotatingFileHandler
import colore... | 2.0625 | 2 |
Array/209MinimumSizeSubarraySum.py | john-the-dev/leetcode | 0 | 55221 | # 209. Minimum Size Subarray Sum
'''
Given an array of positive integers nums and a positive integer target, return the minimal length of a contiguous subarray [numsl, numsl+1, ..., numsr-1, numsr] of which the sum is greater than or equal to target. If there is no such subarray, return 0 instead.
Example 1:
Input... | 3.703125 | 4 |
speedtest.py | ajeje93/speedtest-to-mongodb | 2 | 55222 | import subprocess
import os
import errno
import json
import datetime
from pymongo import MongoClient
import time
import logging
from dotenv import load_dotenv
from timeout import timeout
logging_level = logging.DEBUG
def get_module_logger(mod_name):
"""
To use this, do logger = get_module_logger(__name__)
... | 2.125 | 2 |
SQLITE3 & python/SQLITE3 update data from database.py | OSAMAMOHAMED1234/python_projects | 0 | 55223 | import sqlite3
con = sqlite3.connect("database.db")
c = con.cursor()
c.execute("UPDATE names SET fname='OSAMA', lname='MOHAMED', age=22, salary=5000 WHERE age=20")
con.commit()
con.close()
| 3.21875 | 3 |
Question_01_10/myans/myans_08.py | OverHall27/Gasyori100knock | 0 | 55224 | import cv2
import numpy as np
def MaxPooling(_img):
img = _img.copy()
result = np.zeros_like(img)
for i in range(img.shape[0]//8):
ind_11 = i * 8
ind_12 = ind_11 + 8
for j in range(img.shape[1]//8):
ind_21 = j * 8
ind_22 = ind_21 + 8
result[ind_11... | 2.71875 | 3 |
data_preparation/make_vad_inputs.py | dweekly/libri-light | 246 | 55225 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import os
from pathlib import Path
import torchaudio
import progressbar
import argparse
import torch
import tqdm
def findAllSeqs(dirName,
extension='.flac',
loadCache=False):
r"""
Lists all the sequences wit... | 2.546875 | 3 |
tests/models/test_bayes_mlp.py | rnagumo/bayes_nn | 0 | 55226 | <filename>tests/models/test_bayes_mlp.py<gh_stars>0
import torch
from bayes_nn.models.bayes_mlp import BayesMLP
BATCH = 24
X_DIM = 5
Y_DIM = 3
MC_SAMPLES = 17
def test_forward() -> None:
x = torch.randn(BATCH, X_DIM)
model = BayesMLP(X_DIM, Y_DIM)
y_mu, y_cov = model(x)
assert y_mu.size() == (BATC... | 2.34375 | 2 |
uumpa_ci_toolbox/kubectl/cli.py | CloudWebManage/uumpa-ci-toolbox | 3 | 55227 | import click
from uumpa_ci_toolbox import common
from . import api
@click.group()
def kubectl():
pass
@kubectl.command()
@click.option('--version', required=True, help='Kubectl version to install, e.g. "v1.19.0"')
@click.option('--target-filename', default='/usr/local/bin/kubectl')
@click.option('--with-sudo'... | 1.90625 | 2 |
plugins/modules/pvc_info.py | krestomatio/ansible-collection-k8s | 1 | 55228 | #!/usr/bin/python
# Copyright: (c) 2021, <NAME> <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = r'''
---
module: pvc_info
short_description: Get expand info
... | 2 | 2 |
src/liblegis/backends/git.py | lawpeople/polish-law | 0 | 55229 | <reponame>lawpeople/polish-law<filename>src/liblegis/backends/git.py<gh_stars>0
import pathlib
import re
from typing import TypedDict
from pygit2 import GIT_SORT_REVERSE, Commit, Repository
from liblegis.backends.base import Backend
from liblegis.legal_act import LegalAct
class JournalIndexConfig(TypedDict):
ti... | 2.375 | 2 |
espnfantasyfootball/api.py | danielwillgeorge/fantasy-football-analytics | 2 | 55230 | <filename>espnfantasyfootball/api.py
# -*- coding: utf-8 -*-
"""
ESPN-analytics.api
~~~~~~~~~~~~
This module implements the ESPN-analytics API.
__author__ = "<NAME>"
__license__ = MIT, see LICENSE.txt for more details.
"""
import pandas as pd
import numpy as np
import requests
from bs4 import BeautifulSoup
from da... | 1.671875 | 2 |
slack_time/methods/views.py | jackwardell/SlackTime | 2 | 55231 | <reponame>jackwardell/SlackTime
# -*- coding: utf-8 -*-
from requests import Response
from slack_time import SlackAPI
class Views(SlackAPI):
def open(self, trigger_id: str, view: str, **kwargs) -> Response:
"""
Open a view for a user.
https://api.slack.com/methods/views.open
:para... | 2.703125 | 3 |
rknreporter.py | KindEvilDm/RKNreporter | 2 | 55232 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
from reporter import Reporter
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--orgname", help="Название организации")
parser.add_argument("--login", help="Логин на portal.rfc-revizor.ru")
parser.add_ar... | 2.203125 | 2 |
meiduo_mall/meiduo_mall/apps/orders/urls.py | Nicholas-violet/meiduo_project_preview | 2 | 55233 | from django.urls import path,re_path
from . import views
# urlpatterns是被Django自动识别的路由列表变量:定义该应用的所有路由信息
urlpatterns = [
# 函数视图路由语法:
# path('网络地址正则表达式', 函数视图名),
# 订单确认
re_path(r'^orders/settlement/$', views.OrderSettlementView.as_view()),
# 订单提交
re_path(r'^orders/commit/$', views.OrderCommitView... | 1.8125 | 2 |
lain_cli/imagecheck.py | sunyi00/lain-cli | 0 | 55234 | <reponame>sunyi00/lain-cli
# -*- coding: utf-8 -*-
from argh.decorators import arg
import lain_sdk.mydocker as docker
from lain_cli.utils import check_phase, get_domain, lain_yaml, ClusterConfig
from lain_sdk.util import error, info
def _check_phase_tag(registry):
yml = lain_yaml(ignore_prepare=True)
meta_ve... | 2.046875 | 2 |
dapricot/auth/migrations/0002_auto_20190602_1858.py | softapr/django_apricot | 0 | 55235 | # Generated by Django 2.2.1 on 2019-06-02 18:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('daauth', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='permissionsmixin',
options={},
... | 1.789063 | 2 |
mmcls/datasets/hjq.py | xhdtc8/mmclassification | 0 | 55236 | <gh_stars>0
import os.path as osp
import xml.etree.ElementTree as ET
import mmcv
import numpy as np
from .builder import DATASETS
# from .multi_label import MultiLabelDataset
from .base_dataset import BaseDataset
# @DATASETS.register_module()
# class HJQ(MultiLabelDataset):
# CLASSES = ('indoor','outdoor','surv... | 2.203125 | 2 |
homeassistant/components/kef/__init__.py | domwillcode/home-assistant | 30,023 | 55237 | <gh_stars>1000+
"""The KEF Wireless Speakers component."""
| 0.929688 | 1 |
server/clip_server/executors/clip_onnx.py | jina-ai/bert-as-service | 0 | 55238 | <reponame>jina-ai/bert-as-service
import os
import warnings
from multiprocessing.pool import ThreadPool
from typing import Optional, Dict
import onnxruntime as ort
from clip_server.executors.helper import (
split_img_txt_da,
preproc_image,
preproc_text,
set_rank,
)
from clip_server.model import clip
fr... | 1.882813 | 2 |
examples/render_sphere_RDN.py | ZhengWenSEC2023/SF_temp | 0 | 55239 | """
Render the models from 24 elevation angles, as in thesis NMR
Save as an image.
9. 17. 2020
created by <NAME>
9. 19. 2020
ALL RENDER ARE FINISHED WITHOUT TEXTURE
Run from anaconda console
NOTE:
RENDER FROM ORIGINAL SHOULD BE RANGE(360, 0, -15)
HERE RANGE(0, 360, 15)
SOLUTION: RENAME FILES OR GENERAT... | 2.59375 | 3 |
ch7_Extracting_Information_from_Text/chinker.py | MingjunZhou/nltk_book | 1 | 55240 | <filename>ch7_Extracting_Information_from_Text/chinker.py
import nltk
grammar = r"""
NP:
{<.*>+} # Chunk everything
}<VBD|IN>+{ # Chink sequences of VBD and IN
"""
sentence = [("the", "DT"), ("little", "JJ"), ("yellow", "JJ"),
("dog", "NN"), ("... | 2.953125 | 3 |
int-mon/tests/checkQueue.py | dang03/son-tests | 0 | 55241 | #! /usr/bin/python
__author__="panos"
__date__ ="$Jun 29, 2016 6:10:32 PM$"
import pika, json
import os, threading, time, signal, sys
if __name__ == "__main__":
def fail():
sys.stdout.write("False")
sys.stdout.flush()
os._exit(0)
threading.Timer(120, fail).start()
crede... | 1.84375 | 2 |
conanfile.py | kudzurunner/conan-libjpeg-turbo | 0 | 55242 | <gh_stars>0
from conans import ConanFile, CMake, tools
import os
class LibjpegturboConan(ConanFile):
name = "libjpeg-turbo"
version = "2.0.3"
license = "https://raw.githubusercontent.com/libjpeg-turbo/libjpeg-turbo/master/LICENSE.md"
author = "KudzuRunner"
url = "https://github.com/kudzurunner/con... | 1.828125 | 2 |
src/imitation/summaries.py | shwang/imitation-extern | 0 | 55243 | import datetime
import glob
import os.path
import tensorflow as tf
def make_summary_writer(exp_name="AIRL", graph=None):
summary_base = os.path.join("output/", exp_name, "summary/")
today_str = datetime.datetime.today().strftime('%Y-%m-%d')
dir_list = glob.glob(os.path.join(summary_base, today_str + "*/"))
... | 2.4375 | 2 |
python/euler28.py | zhouxiumin/projecteuler | 0 | 55244 | #coding=utf-8
length=1001+1
result=1
for t in range(3,length,2):
result+=4*t*t-6*t+6
print result
| 3.265625 | 3 |
apps/accounts/services/activate_account.py | ShAlireza/gamein-backend | 5 | 55245 | <reponame>ShAlireza/gamein-backend
from django.contrib.auth.models import User
from django.utils.http import urlsafe_base64_decode
from rest_framework.generics import get_object_or_404
from apps.accounts.models import ActivateUserToken
from ..exceptions import AccountActivationError
__all__ = ('ActivateAccount',)
... | 2.1875 | 2 |
src/app.py | 3l3n01/lift-pass | 0 | 55246 | import math
from datetime import datetime
from flask import Flask, jsonify, request
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.db'
db = SQLAlchemy(app)
class Price(db.Model):
id = db.Column(db.Integer, primary_key=True)
type = db.Col... | 3 | 3 |
Paris_SIR_Model/get_data.py | Behrouz-Babaki/covid-19-model | 0 | 55247 | import numpy as np
import pandas as pd
import datetime
import pickle
data = pickle.load(open("./data.pkl",'rb'))
class get_data():
def __init__(self, data):
self.c_data = data
self.data = self.clean_data()
def clean_data(self):
for d in range(len(data)-1, -1, -1):
... | 3.296875 | 3 |
testscripts/testtmhomepage.py | fingerella2000/e2enuggets | 0 | 55248 | <filename>testscripts/testtmhomepage.py
import sys
import os
sys.path.append(os.getcwd())
import unittest
import logging
from selenium import webdriver
from tmbasetest import TMBaseTest
from uiautomation.common import Constants
from uiautomation.common import BaseWebDriver
from uiautomation.pages.tmhomepage import TMHo... | 2.46875 | 2 |
verify/grid.py | CAS-LRJ/DeepPAC | 0 | 55249 | <reponame>CAS-LRJ/DeepPAC<filename>verify/grid.py
import math
'''
Classes:
Grid: The Grids Used For Stepwise Splitting
Functions:
grid_split: Split a List of Grid Objects into 2x2 sub-grids.
'''
class Grid(object):
def __init__(self, leftup_x, leftup_y, rightdown_x, rig... | 2.953125 | 3 |
References/gpu_test.py | royqh1979/python_libs_usage | 0 | 55250 | import tensorflow as tf
#让tf不要一次性分配所有显存(性能会有影响,但是不容易出现无内存错误)
# physical_devices = tf.config.list_physical_devices('GPU')
# try:
# tf.config.experimental.set_virtual_device_configuration(
# physical_devices[0],
# [tf.config.experimental.VirtualDeviceConfiguration(memory_limit=1024*6)])
# # tf.conf... | 2.78125 | 3 |
util/sigen.py | cubicdaiya/ngx_access_token | 5 | 55251 | <gh_stars>1-10
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 <NAME> <<EMAIL>>
#
# signature generator
#
import sys
import hmac
from hashlib import sha1
import base64
import binascii
import argparse
def build_parser():
parser = argparse.ArgumentParser(description='Signature Generator', add_help=False)
parser.... | 2.609375 | 3 |
VA/main/config.py | YuJaceKim/Activity-Recognition-with-Combination-of-Deeply-Learned-Visual-Attention-and-Pose-Estimation | 343 | 55252 | <filename>VA/main/config.py
import numpy as np
import keras.backend as K
K.set_image_data_format('channels_last')
class DataConfig(object):
"""Input frame configuration and data augmentation setup."""
def __init__(self, crop_resolution=(256, 256), image_channels=(3,),
angles=[0], fixed_angle=0,
... | 2.59375 | 3 |
pic_analyzer_python/image.py | 610yilingliu/simi_pic_detection | 0 | 55253 | <reponame>610yilingliu/simi_pic_detection
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
import cv2
import os
class input_img(object):
def __init__(self, pic_path):
self.__path = pic_path
self.__image = Image.open(pic_path)
self.__rgb_np = np.array(self.__image)
... | 2.796875 | 3 |
textbooks/nltk_book/www.nltk.org/book/pylisting/code_search_documents.py | motazsaad/NLP-ICTS6361 | 10 | 55254 | # Natural Language Toolkit: code_search_documents
def raw(file):
contents = open(file).read()
contents = re.sub(r'<.*?>', ' ', contents)
contents = re.sub('\s+', ' ', contents)
return contents
def snippet(doc, term):
text = ' '*30 + raw(doc) + ' '*30
pos = text.index(term)
return text[pos-... | 3.546875 | 4 |
homeassistant/components/trend/__init__.py | MrDelik/core | 30,023 | 55255 | """A sensor that monitors trends in other components."""
from homeassistant.const import Platform
DOMAIN = "trend"
PLATFORMS = [Platform.BINARY_SENSOR]
| 1.367188 | 1 |
game_hub/game_hub/accounts/urls.py | ivailoiliev84/GameHub | 0 | 55256 | <gh_stars>0
from django.urls import path
from game_hub.accounts.views import RegisterUser, logout_user, ProfilePageView, \
LoginUserView, ChangePasswordView, ProfileEditView, ProfileDeleteView
urlpatterns = (
path('register/', RegisterUser.as_view(), name='register'),
path('log-in/', LoginUserView.as_view... | 1.75 | 2 |
goose/network.py | frnsys/python-goose | 1 | 55257 | # -*- coding: utf-8 -*-
"""\
This is a python port of "Goose" orignialy licensed to Gravity.com
under one or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.
Python port was written by <NAME>
Gravity.com licenses this file
t... | 2.203125 | 2 |
src/models/final_analysis.py | AedynLadd/sysc4906-termProject | 0 | 55258 | <filename>src/models/final_analysis.py
import numpy as np
import matplotlib.pyplot as plt
import json
import logging
import datetime
from datetime import datetime
from datetime import timedelta
from pathlib import Path
import os
import sys
from statsmodels.tsa.stattools import adfuller
from statsmodels.stats... | 3.046875 | 3 |
mnist/w7-v2/no_pytorch/data_iter.py | 7568/examples | 0 | 55259 | <gh_stars>0
# -*- coding: UTF-8 -*-
"""
Created by louis at 2021/4/14
Description:
"""
import random
class IrisDataIter:
"""
迭代器
"""
def __init__(self, m, bach):
random.shuffle(m)
self.data = m
self.bach = bach
self.length = len(m)
self.index = -1
def __it... | 2.46875 | 2 |
quantgov/__main__.py | ajnye/quantgov | 0 | 55260 | <reponame>ajnye/quantgov
"""
Quantgov: a policy analytics framework
"""
import argparse
import csv
import io
import functools
import logging
import shutil
import sys
import zipfile
import requests
import joblib as jl
import quantgov
from pathlib import Path
log = logging.getLogger(__name__)
_URL = 'https://githu... | 2.109375 | 2 |
utils/helper.py | BDBC-KG-NLP/CDT_EMNLP2019 | 17 | 55261 | """
Helper functions.
"""
import os
import json
import six
import argparse
import subprocess
def ensure_dir(d, verbose=True):
if not os.path.exists(d):
if verbose:
print("Directory {} do not exist; creating...".format(d))
os.makedirs(d)
class FileLogger(object):
"""
A file logg... | 2.890625 | 3 |
src/api/models/authors.py | Anfevazu/library-api-R5 | 0 | 55262 | # Django
from django.db import models
# Utilities
from utils.models import CommonModel
class Author(CommonModel):
"""Author model.
Model to store the data of the authors of the books.
"""
name = models.CharField(
'name',
max_length=150,
blank=False,
null=False,
... | 2.890625 | 3 |
controle.py | Wilderick-Souza/Sistema-Python | 0 | 55263 | from PyQt5 import uic, QtWidgets
import mysql.connector
from reportlab.pdfgen import canvas
global_id = 0
#Cria o banco de dados para ser usado na aplicação.
banco_de_dados = mysql.connector.connect(
host="localhost",
user="root",
password="",
database='cadastro_produtos'
)
def funcao_principal():
... | 2.5 | 2 |
docker/in-container/dump-predict-ranks.py | ONNC/umbrella | 22 | 55264 | #!/usr/bin/env python2
import argparse
from PIL import Image
from onnx import onnx
import os
import sys
import struct
def read_array_from_tensor(filename):
tensor = onnx.TensorProto()
with open(filename, 'rb') as file:
tensor.ParseFromString(file.read())
assert tensor.data_type == 1 # only allows... | 2.625 | 3 |
eruditio/project/settings.py | genghisu/eruditio | 0 | 55265 | <filename>eruditio/project/settings.py<gh_stars>0
from os.path import join, dirname, normpath
PROJECT_ROOT = join(dirname(normpath(__file__)), '..')
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('hanbox', '<EMAIL>'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = '' # 'postgresql_psycopg2', 'postgresql', '... | 2.015625 | 2 |
deslib/base.py | vishalbelsare/DESlib | 310 | 55266 | <reponame>vishalbelsare/DESlib<gh_stars>100-1000
# coding=utf-8
# Author: <NAME> <<EMAIL>>
#
# License: BSD 3 clause
import functools
import math
import warnings
from abc import abstractmethod, ABCMeta
import numpy as np
from scipy.stats import mode
from sklearn.base import BaseEstimator, ClassifierMixin
from sklea... | 1.773438 | 2 |
bl/tests/test_scheduler.py | djfroofy/beatlounge | 8 | 55267 | <reponame>djfroofy/beatlounge<filename>bl/tests/test_scheduler.py<gh_stars>1-10
from twisted.trial.unittest import TestCase
from bl.scheduler import BeatClock, Tempo, Meter
import data
class ClockRunner:
def _runTicks(self, ticks):
for i in range(ticks):
self.clock.runUntilCurrent()
... | 2.4375 | 2 |
Heart_Score.py | alokm014/Heart-Score | 1 | 55268 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
from matplotlib.pyplot import plot, scatter, show
from numpy import NaN, Inf, arange, isscalar, asarray, array
# In[2]:
get_ipython().magic(u'matplotlib inline')
# In[3]:
df=pd.read_csv("Heart_Rate.csv")
# In[4]:
df.info()
# In[5]:
si... | 3.296875 | 3 |
241.py | RafaelHuang87/Leet-Code-Practice | 0 | 55269 | class Solution:
def diffWaysToCompute(self, input: str) -> [int]:
end = []
op = {'+': lambda x, y: x + y,
'-': lambda x, y: x - y,
'*': lambda x, y: x * y}
for i in range(len(input)):
if input[i] in op.keys():
for left in self.diffWays... | 3.234375 | 3 |
api_v1/urls.py | alexkiura/bank_otuch | 1 | 55270 | from django.urls import path
from rest_framework_jwt.views import obtain_jwt_token
from rest_framework import routers
from .views import (BankingUserCreateViewSet, BankingUserVerifyViewSet,
BankAccountViewSet, TransactionViewSet)
router = routers.SimpleRouter()
router.register('account', BankAccou... | 1.976563 | 2 |
flopyAdapter/flopy_adapter/flopy_read_classes/readconcentration.py | inowas/flopyAdapter | 0 | 55271 | import os
import flopy.utils.binaryfile as bf
class ReadConcentration:
_filename = None
def __init__(self, workspace):
for file in os.listdir(workspace):
if file.upper() == "MT3D001.UCN":
self._filename = os.path.join(workspace, file)
pass
def read_times(self)... | 2.5 | 2 |
tests/test_formats/test_registry.py | ameily/cincoconfig | 6 | 55272 | from unittest.mock import patch, MagicMock, PropertyMock
import pytest
from cincoconfig.core import ConfigFormat
from cincoconfig.formats.json import JsonConfigFormat
from cincoconfig.formats.bson import BsonConfigFormat
from cincoconfig.formats.yaml import YamlConfigFormat
from cincoconfig.formats.xml import XmlConfig... | 2.328125 | 2 |
DaPy/methods/classifiers/classifier.py | huihui7987/DaPy | 552 | 55273 | from DaPy.core import Series, SeriesSet
from DaPy.core import is_seq
from copy import copy
def proba2label(seq, labels):
if hasattr(seq, 'shape') is False:
seq = SeriesSet(seq)
if seq.shape[1] > 1:
return clf_multilabel(seq, labels)
return clf_binlabel(seq, labels)
def clf_multilabel(seq,... | 2.46875 | 2 |
my_CribleEratosthene.py | StephaneLab/Calcul-du-PGCD-par-Algorithme-d-Euclide | 0 | 55274 | <reponame>StephaneLab/Calcul-du-PGCD-par-Algorithme-d-Euclide<gh_stars>0
#!/usr/bin/python3.9
# Licence MIT copyright (c) 2022 <NAME>
import numpy as np
def my_CribleEratosthene(n):
# Algorithme du crible d'Eratostène pour calculer les nombres premiers inférieur ou égaux à un entier naturel n
# Il est basé sur ... | 3.140625 | 3 |
jinja2_maps/osm.py | bfontaine/jinja2_maps | 1 | 55275 | <filename>jinja2_maps/osm.py
# -*- coding: UTF-8 -*-
from .base import urlencode, map_filter, _make_url_filter
from jinja2 import Markup, escape
_osm_default_attrs = dict(
width=500,
height=400,
frameborder=0,
scrolling="no",
marginheight=0,
marginwidth=0,
)
# roughly equivalent to zoom level... | 2.5 | 2 |
uniform_meta.py | isVoid/pairs_organizer | 0 | 55276 | import os
import shutil
try:
input = raw_input
except NameError:
pass
def uniform_meta(f):
xmp_path = ""
f_list = []
for root, dirs, files in os.walk(f):
for f in files:
if f.split(".")[-1].upper() == "ARW":
f_list.append(os.path.join(root, f))
if f... | 2.5625 | 3 |
source/core/machine/model.py | pedroaraujocaldeira/reconhecimento-image | 0 | 55277 | import numpy as np
import matplotlib.pyplot as plt
import os
import cv2
from tensorflow.python.keras.callbacks import TensorBoard
from tqdm import tqdm
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Activation, Flatten
from tensorflow.keras.lay... | 2.78125 | 3 |
shepherd/comm/__init__.py | iterait/shepherd | 5 | 55278 | """Package with sockets/greenlets communication helpers."""
from .messages import *
from .messenger import Messenger
__all__ = ['Message', 'InputMessage', 'DoneMessage', 'ErrorMessage', 'Messenger']
| 1.53125 | 2 |
canu/validate/shcd/shcd.py | Cray-HPE/canu | 6 | 55279 | # MIT License
#
# (C) Copyright [2022] Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the righ... | 1.515625 | 2 |
src/parser.py | gavinbarrett/SL_Engine | 0 | 55280 | <filename>src/parser.py
import string
import src.ast as ast
from src.newLexer import *
from src.gen import generate
from collections import defaultdict
class Parser:
''' Constructs a parser that builds ASTs from logical expressions '''
def __init__(self):
''' Create parser with expression lexer and tr... | 3.6875 | 4 |
Trial.py | TianshuangQiu/Townsend-Dice-Game | 0 | 55281 | <gh_stars>0
import random
Dice = [1, 2, 3, 4, 5, 6]
def roll():
return random.choice(Dice) + random.choice(Dice)
def rule(num):
if num <= 3:
return 10
elif num == 4:
return -10
elif num == 5:
x = roll()
if x > 5:
return 10 + rule(x)
else:
... | 3.6875 | 4 |
code/lexis/ReadabilityCalculator.py | ats0stv/Lisibilite | 4 | 55282 | <filename>code/lexis/ReadabilityCalculator.py<gh_stars>1-10
import logging as LOG
import math
from models.CoreMetrics import CoreMetrics
from models.ReadabilityMetrics import ReadabilityMetrics
class ReadabilityCalculator:
def __init__(self, coreMetrics: CoreMetrics):
"""
Readability Calculator i... | 2.8125 | 3 |
ns_eos/gap_parametrisation.py | LBJ-Wade/NS_EoS | 1 | 55283 | """
Calculation of the superfluid neutron and superconducting proton gap
in the neutron star core following the parametrisation introduced in
Andersson et al. (2005) with the parameters given in Ho et al. (2015)
Authors:
<NAME> (<EMAIL>)
Copyright (c) <NAME>
"""
from scipy.optimize import newton
import ... | 2.59375 | 3 |
src/questions/questions1.py | odinosaur/gamimg | 0 | 55284 | <gh_stars>0
# Solve the following with a comment for the answer below
# True or False is
# true
# True and True is
# true
# (True and False) or True is
# true
# Not False is
# true
# 1 or 0 is
# 1 :: Technicaly 1 or 0 is True because a boolean statement can only solve to True or False HOWEVE... | 4.25 | 4 |
make_pickle_from_log.py | NilayPachauri/Jeopardy-The-Complete-Saga-Database | 0 | 55285 | <reponame>NilayPachauri/Jeopardy-The-Complete-Saga-Database<filename>make_pickle_from_log.py
import argparse
import pickle
import re
parser = argparse.ArgumentParser()
parser.add_argument('--log', help='the log file to make the pickle file from')
parser.add_argument('--pickle', help='the name of the pickle file to wri... | 3.34375 | 3 |
e3/execution/grinder/confluence/persona/Commentor.py | sguillory6/e3 | 0 | 55286 | <filename>e3/execution/grinder/confluence/persona/Commentor.py
import random
from confluence.common.helper.ConfluenceUserCreator import create_user
from confluence.common.helper.Authentication import login, logout
from confluence.common.helper.ResourceUtils import *
from confluence.common.wrapper.User import User
fro... | 2.28125 | 2 |
yt/utilities/answer_testing/api.py | danielgrassinger/yt_new_frontend | 0 | 55287 | """
API for enzo_test
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, yt Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-------------------------... | 1.570313 | 2 |
src/compas_vibro/structure/node.py | Design-Machine-Group/compas_vibro | 2 | 55288 |
__author__ = ['<NAME> <<EMAIL>>']
__copyright__ = 'Copyright 2020, Design Machine Group - University of Washington'
__license__ = 'MIT License'
__email__ = '<EMAIL>'
__all__ = [
'Node',
]
class Node(object):
""" Initialises base Node object.
Parameters
----------
key : int
... | 3.421875 | 3 |
qubovert/utils/_pubomatrix.py | panaali/qubovert | 15 | 55289 | <filename>qubovert/utils/_pubomatrix.py
# Copyright 2020 <NAME>
#
# 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 requi... | 2.53125 | 3 |
src/napari_threedee/lighting/lighting_control.py | alisterburt/napari-threedee | 5 | 55290 | <filename>src/napari_threedee/lighting/lighting_control.py
from typing import List
import numpy as np
import napari
from ..base import ThreeDeeModel
from ..utils.napari_utils import add_mouse_callback_safe, get_napari_visual, remove_mouse_callback_safe
class LightingControl(ThreeDeeModel):
def __init__(self, vi... | 2.25 | 2 |
pypibatch/__init__.py | newvicx/pybatch | 0 | 55291 | <reponame>newvicx/pybatch<gh_stars>0
from .main import NoBatchesFound, PIBatch, PIBatchError, PISubBatch, PIUnitBatch | 1.039063 | 1 |
Season 10 - Advanced Python Development/Episode 06 - Queues in Python.py | Pythobit/Python-tutorial | 3 | 55292 | <filename>Season 10 - Advanced Python Development/Episode 06 - Queues in Python.py
# Queue in python
"""
Queue is like people entering in a theatre in queue
i.e: add elements at the end, and remove the elements from the start
A Queue in python is where you can add or remove elements either side is called `deque` or `... | 3.65625 | 4 |
tools/isolate/tests/run_test_from_archive/repeated_files.py | quisquous/chromium | 2 | 55293 | <gh_stars>1-10
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Checks all the expected files are mapped."""
import os
import sys
ROOT_DIR = os.path.dirname(os.path.abspath(__... | 2.421875 | 2 |
drun_airsim_client/drun_airsim_client/__init__.py | braind3d/DRUN | 8 | 55294 | <filename>drun_airsim_client/drun_airsim_client/__init__.py<gh_stars>1-10
"""Base simulation utility for Microsoft AirSim."""
from __future__ import absolute_import
from __future__ import division
from typing import Tuple, List
from math import sin, cos, pi, acos, atan
from airsim.types import Pose, CollisionInfo
fro... | 2.265625 | 2 |
scrape.py | Brownymister/BER-Bot | 0 | 55295 | import requests
import json
from auth import (
user,
password
)
class Scrape:
def __init__(self) -> None:
self.url = 'https://'+user+':'+password + \
'@opensky-network.org/api/states/all?lamin=52.311624&lomin=13.426828&lamax=52.416285&lomax=13.636693'
self.all_flights = []
... | 3.1875 | 3 |
odoo-13.0/addons/website_sale_coupon_delivery/controllers/main.py | VaibhavBhujade/Blockchain-ERP-interoperability | 0 | 55296 | # -*- coding: utf-8 -*-
from odoo import http
from odoo.addons.website_sale_delivery.controllers.main import WebsiteSaleDelivery
from odoo.http import request
class WebsiteSaleCouponDelivery(WebsiteSaleDelivery):
@http.route()
def update_eshop_carrier(self, **post):
Monetary = request.env['ir.qweb.fi... | 1.96875 | 2 |
test/dataset/test_dataset.py | guimaraes13/NeuralLog | 6 | 55297 | # Copyright 2021 <NAME>
#
# 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,... | 1.585938 | 2 |
adminator/port.py | techlib/adminator | 1 | 55298 | <filename>adminator/port.py
#!/usr/bin/python3 -tt
# -*- coding: utf-8 -*-
from adminator.model import Model
__all__ = ['Port']
class Port(Model):
def init(self):
self.schema = 'topology'
self.table_name = 'port'
self.pkey = 'uuid'
# vim:set sw=4 ts=4 et:
| 2.125 | 2 |
part-2/collect/sets.py | kumalee/python-101 | 0 | 55299 | #! /usr/bin/python
# encoding: utf-8
s1 = set([1,2,3])
for s in s1:
print s
s1.add(4)
print 's1.add(4)'
print 's1 =', s1, '\n'
| 3.4375 | 3 |