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 |
|---|---|---|---|---|---|---|
recsys/models.py | JustinL42/django-polls | 0 | 43100 | from django.db import models
from django.conf import settings
from django.contrib.postgres.search import SearchVectorField
from django.contrib.auth.models import AbstractUser
from django.utils import timezone
# BOOK-RELATED MODELS
class Books(models.Model):
title = models.CharField(max_length=5125)
year... | 2.140625 | 2 |
leetcode/Tree & Recursion/114. Flatten Binary Tree to Linked List.py | yanshengjia/algorithm | 23 | 43101 | <filename>leetcode/Tree & Recursion/114. Flatten Binary Tree to Linked List.py
"""
Given a binary tree, flatten it to a linked list in-place.
For example, given the following tree:
1
/ \
2 5
/ \ \
3 4 6
The flattened tree should look like:
1
\
2
\
3
\
4
\
5
... | 4.15625 | 4 |
tests/unit/testTokenClientCredentialsGrant.py | Abestanis/TwistedOAuth2 | 3 | 43102 | """ Tests for the client credentials grant flow. """
from txoauth2.clients import PublicClient
from txoauth2.token import TokenResource
from txoauth2.errors import UnauthorizedClientError, MissingParameterError, \
MultipleParameterError, InvalidScopeError
from tests import getTestPasswordClient
from tests.unit.te... | 2.703125 | 3 |
lambda/service_call.py | binxio/blog-lambda-python-37-runtime | 0 | 43103 | from __future__ import annotations
import requests
from requests.auth import HTTPBasicAuth
from dataclasses import dataclass, asdict
from mashumaro import DataClassJSONMixin
@dataclass
class Response(DataClassJSONMixin):
statusCode: int = 200
body: str = ''
@classmethod
def of(cls, status_code: int, ... | 2.8125 | 3 |
nexussdk/storages.py | hygt/nexus-python-sdk | 0 | 43104 | <gh_stars>0
"""
This module provides a Python interface for operations on Storages.
It is part of the Knowledge Graph API of Blue Brain Nexus v1.
https://bluebrainnexus.io/docs/api/1.1/kg/kg-storages-api.html
"""
from typing import Dict, Optional
from urllib.parse import quote_plus as url_encode
from nexussdk.utils.h... | 2.546875 | 3 |
scTenifold/__main__.py | qwerty239qwe/scTenifoldpy | 3 | 43105 | import typer
from pathlib import Path
import yaml
from scTenifold import scTenifoldNet, scTenifoldKnk
app = typer.Typer()
@app.command(name="config")
def get_config_file(
config_type: int = typer.Option(1, "--type", "-t",
help="Type, 1: scTenifoldNet, 2: scTenifoldKnk"... | 2.4375 | 2 |
django_mri/analysis/interfaces/matlab/spm/cat12/segmentation/messages.py | GalBenZvi/django_mri | 4 | 43106 | <reponame>GalBenZvi/django_mri
"""
A module storing strings used to display messages.
"""
INVALID_INTERNAL_RESAMPLING_OPTIMAL = "Invalid CAT12 configuration! Resampling type 'optimal' can only be set with an internal resampling value of 1. Valid configuration coerced."
INVALID_INTERNAL_RESAMPLING_FIXED = "Invalid CAT1... | 1.914063 | 2 |
feature_extraction/tests/tss_tool_test.py | ramseylab/cerenkov | 1 | 43107 | <reponame>ramseylab/cerenkov
import unittest
from tss_tool import min_tss_dist
class TssToolTestCase(unittest.TestCase):
def test_min_tss_dist(self):
self.assertEqual(min_tss_dist([1, 2, 3]), 1)
self.assertEqual(min_tss_dist([-1, -2, -3]), -1)
self.assertEqual(min_tss_dist([1, -2, 3]), 1)... | 3.15625 | 3 |
singlecellmultiomics/modularDemultiplexer/demultiplexModules/chromium_10x.py | zztin/SingleCellMultiOmics | 17 | 43108 | from singlecellmultiomics.modularDemultiplexer.baseDemultiplexMethods import UmiBarcodeDemuxMethod
class chrom10x_c16_u12(UmiBarcodeDemuxMethod):
def __init__(self, barcodeFileParser, **kwargs):
self.barcodeFileAlias = '10x_3M-february-2018'
UmiBarcodeDemuxMethod.__init__(
self,
... | 2.109375 | 2 |
L8-pandas-autocorr.py | jdherman/eci273 | 10 | 43109 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# read CSV data into a "dataframe" - pandas can parse dates
# this will be familiar to R users (not so much matlab users)
df = pd.read_csv('data/SHA.csv', index_col=0, parse_dates=True)
Q = df.SHA_INFLOW_CFS # a pandas series (daily)
# Q = Q.resa... | 3.25 | 3 |
tests/test_polish_radio.py | jcwojdel/my_pi_skill | 0 | 43110 | import json
import os
import unittest
from functools import wraps
import mock
from lambdas import my_pi_lambda
EVENTS = json.load(open(os.path.join(os.path.dirname(__file__), 'sample_events.json')))
def forall_events(f):
@wraps(f)
def wrapper(*args, **kwds):
for event_meta in EVENTS:
kw... | 2.609375 | 3 |
GetData.py | FoxBearBear/aluguel-florianopolis | 0 | 43111 | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from bs4 import BeautifulSoup
import time
from webdriver_manager.chrome import ChromeDriverManager
import re
from itertools import groupby
import pandas as pd
import googlemaps
browser = webdriver.Chrome(ChromeDriverManager().inst... | 2.8125 | 3 |
core/classes/session_user.py | taimaskhanov11/AsyncVkAccount | 1 | 43112 | import asyncio
from pydantic import BaseModel
# from base_user import BaseUser
class New(BaseModel):
name: str
# class SessionUser(BaseModel):
# user_id: int
# text: str = Field()
# overlord: New
#
# def __init__(self, **data):
# print(data)
# super().__init__(**data)
# ... | 2.703125 | 3 |
bin/ss_test.py | PySilentSubstitution/silent-sub | 1 | 43113 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 25 12:41:40 2021
@author: jtm545
"""
#%%
import sys
sys.path.insert(0, '../')
import random
from colour.plotting import plot_chromaticity_diagram_CIE1931
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
from scipy.optimize... | 1.984375 | 2 |
msl/qt/exceptions.py | rebeccahawke/msl-qt | 0 | 43114 | """
Exception handling used by **MSL-Qt**.
"""
import logging
import traceback
from . import QtWidgets, Qt, application
logger = logging.getLogger(__name__)
def excepthook(exc_type, exc_obj, exc_traceback):
"""Displays unhandled exceptions in a :class:`QtWidgets.QMessageBox`.
See :func:`sys.excepthook` for... | 2.578125 | 3 |
Chapter04/exercise1/test_calculator.py | sportstube28/Continuous-Delivery-with-Docker-and-Jenkins-Second-Edition | 51 | 43115 | import unittest
from calculator import multiply
class TestSomething(unittest.TestCase):
def test_multiply(self):
self.assertEqual(6, multiply(2,3))
if __name__ == '__main__':
unittest.main()
| 2.984375 | 3 |
INBa/2015/SOSNOVY_M_S/task_9_26.py | YukkaSarasti/pythonintask | 0 | 43116 | <gh_stars>0
# Задание 9. Вариант 26
# Создайте игру, в которой компьютер выбирает какое-либо слово, а игрок должен его отгадать. Компьютер сообщает игроку, сколько букв в слове, и дает пять попыток узнать, есть ли какая-либо буква в слове, причем программа может отвечать только "Да" и "Нет". Вслед за тем игрок должен п... | 3.46875 | 3 |
UTMDriver/__init__.py | maxpoint2point/UTMDriver | 1 | 43117 | # Copyright (c) <EMAIL> 2020.
__version__ = '0.5.3-alpha'
from UTMDriver.connector import Connector
| 0.957031 | 1 |
FirstStepsInPython/Fundamentals/Exercice/Basic Syntax Conditional Statements and Loops/More Exercises/05. How Much Coffee Do You Need?.py | Pittor052/SoftUni-Studies | 0 | 43118 | command = input()
compare_string_lower = {"coding", "dog", "cat", "movie"}
compare_string_upper = {"CODING", "DOG", "CAT", "MOVIE"}
coffee = 0
get_sleep = False
while not command == "END":
if command.isupper() and command in compare_string_upper:
coffee += 2
if command.islower() and command in compare_s... | 3.859375 | 4 |
4-Matrix.py | macerman/Open-CV | 1 | 43119 | #--SHAPES and TEXTS--#
import cv2
import numpy as np
#We are going to use the numpy library to create our matrix
#0 stands for black and 1 stands for white
img = np.zeros((512,512,3),np.uint8) # (height,width) and the channel, it gives us value range 0-255
#print(img)
#img[200:300,100:300] = 255,0,0 #whole... | 4.03125 | 4 |
searching/migrations/0005_search_bgetbuyitnows.py | netvigator/auctions | 0 | 43120 | <filename>searching/migrations/0005_search_bgetbuyitnows.py<gh_stars>0
# Generated by Django 2.2.10 on 2020-04-19 21:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('searching', '0004_auto_20200104_2144'),
]
operations = [
migrations.... | 1.609375 | 2 |
src/api/meta/utils/basicapi/basic.py | Chromico/bk-base | 84 | 43121 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
---------------------------------------------... | 1.617188 | 2 |
src/ebay_rest/api/sell_fulfillment/models/ebay_tax_reference.py | matecsaj/ebay_rest | 3 | 43122 | # coding: utf-8
"""
Fulfillment API
Use the Fulfillment API to complete the process of packaging, addressing, handling, and shipping each order on behalf of the seller, in accordance with the payment method and timing specified at checkout. # noqa: E501
OpenAPI spec version: v1.19.10
Generated ... | 1.789063 | 2 |
lista3/questao3.py | lucasmmassa/VisaoComputacional_PLE | 0 | 43123 | <reponame>lucasmmassa/VisaoComputacional_PLE
import numpy as np
import cv2
import os
height = 9
width = 6
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001)
cap = cv2.VideoCapture('q3_original_video.avi')
codec = cv2.VideoWriter_fourcc("X", "V", "I", "D")
frame_rate = 30
resolution = (640, 4... | 2.46875 | 2 |
hetest/python/common/pickle_iter_test.py | y4n9squared/HEtest | 6 | 43124 | <filename>hetest/python/common/pickle_iter_test.py
# *****************************************************************
# Copyright (c) 2013 Massachusetts Institute of Technology
#
# Developed exclusively at US Government expense under US Air Force contract
# FA8721-05-C-002. The rights of the United States Government t... | 2.203125 | 2 |
Dataset/Leetcode/train/101/271.py | kkcookies99/UAST | 0 | 43125 | class Solution:
def XXX(self, root: TreeNode) -> bool:
if not root:
return 1 == 1
# 先记录先序遍历,再翻转二叉树然后再记录先序遍历。当没有叶子节点时添加标记'a'
def dfs(res, root):
if not root:
res.append('a')
return
res.append(root.val)
dfs(res, ... | 3.40625 | 3 |
coders/curso_python/poo/tarefa/test_tarefa_v2.py | flaviogf/Cursos | 2 | 43126 | from unittest import TestCase
from datetime import datetime, timedelta
from tarefa_v2 import Tarefa, Projeto, TarefaNaoEncontrada
class TestTarefa(TestCase):
def test_tarefa_init(self):
tarefa = Tarefa('Lavar pratos')
self.assertEqual('Lavar pratos', tarefa.descricao)
self.assertFalse(ta... | 3.109375 | 3 |
python/paddle/fluid/tests/unittests/test_hsigmoid_op.py | skylarch/Paddle | 1 | 43127 | <reponame>skylarch/Paddle
# Copyright (c) 2018 PaddlePaddle 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... | 1.96875 | 2 |
dopamine/generators/abstract_generator.py | K-Kielak/dopamine | 0 | 43128 | # coding=utf-8
# Copyright 2019 <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 ... | 2.765625 | 3 |
pymatflow/qe/tddfpt.py | DeqiTang/pymatflow | 6 | 43129 | <reponame>DeqiTang/pymatflow
"""
TDDFPT calc
"""
import os
import re
import sys
import shutil
from pymatflow.remote.server import server_handle
class TddfptRun():
"""
"""
def __init__(self):
self._initialize()
def _initialize(self):
""" initialize the current obje... | 2.453125 | 2 |
tests/users_tests/test_users_views.py | TomerNewmanPrograms/ResuMe | 0 | 43130 | <filename>tests/users_tests/test_users_views.py
import pytest
from django.contrib.auth.models import User
from pytest_django.asserts import assertTemplateUsed
from conftest import USERNAME, PASSWORD
def save_user(user):
try:
user = User.objects.get(username=USERNAME)
return user
except User.Do... | 2.4375 | 2 |
MonitoringService/service/tests/functional/alarm_test.py | Selfnet-5G/NBI | 0 | 43131 | import json
from service.tests.functional import MonitoringTestCase
class TestAlarm(MonitoringTestCase):
ENDPOINT = '/nbi/monitoring/api/alarms/'
def test_get_alarms(self):
"""
Test that validates getting all alarms
It asserts the response code 200, the default alarm limit 5 and the ... | 2.46875 | 2 |
tests/test_config.py | jangroth/keydra | 0 | 43132 | import copy
import unittest
from keydra.config import KeydraConfig
from keydra.exceptions import ConfigException
from unittest.mock import MagicMock
from unittest.mock import patch
ENVS = {
'dev': {
'description': 'AWS Development Environment',
'type': 'aws',
'access': 'dev',
'i... | 1.960938 | 2 |
fibertree/codec/plot-energy.py | Fibertree-Project/fibertree | 2 | 43133 | <reponame>Fibertree-Project/fibertree<filename>fibertree/codec/plot-energy.py
import matplotlib.pyplot as plt
import yaml
import sys
import os
import numpy as np
from matplotlib import colors as mcolors
colors = dict(mcolors.BASE_COLORS, **mcolors.CSS4_COLORS)
indir = sys.argv[1]
alldata = dict()
# go through and read... | 2.53125 | 3 |
common.py | hwase0ng/klseScrappers | 3 | 43134 | <reponame>hwase0ng/klseScrappers
"""
Created on Apr 27, 2018
@author: hwase0ng
"""
from BeautifulSoup import BeautifulSoup
from utils.dateutils import getToday, getDayOffset, generate_dates
from utils.fileutils import wc_line_count
from curses.ascii import isprint
import csv
import json
import requests
imp... | 2.296875 | 2 |
Face_recognition/original.py | rootadminWalker/Face-app | 0 | 43135 | <reponame>rootadminWalker/Face-app
import dlib
import cv2
import pandas as pd
import numpy as np
import os
path = "./Users"
_shape_dat = "shape_predictor_68_face_landmarks.dat"
_face_dat = "dlib_face_recognition_resnet_model_v1.dat"
_detector = dlib.get_frontal_face_detector()
_predictor = dlib.shape_predictor(_shape... | 2.640625 | 3 |
racing_models/bk/dronet_densenet121.py | gengliangyu2008/Intelligent-Navigation-Systems | 0 | 43136 | import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Input, Dense, Flatten, Conv2D, BatchNormalization, Lambda, Concatenate, Conv2DTranspose, Reshape, ReLU
from tensorflow.keras.applications import DenseNet121
# tf.config.experimental_run_functions_eagerly(True)
# with tf.dev... | 3.09375 | 3 |
examples/client.py | zaibon/tcprouter | 1 | 43137 | <gh_stars>1-10
import time
from gevent import ssl, socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Require a certificate from the server. We used a self-signed certificate
# so here ca_certs must be the server certificate itself.
ssl_sock = ssl.wrap_socket(s,
ca_certs="server... | 2.375 | 2 |
channel-api/src/processors/callback_delivery/__init__.py | xcantera/demo-provide-baseline | 3 | 43138 | from box import Box
from src import repos
from src.processors import SelfIteratingProcessor
from src.processors import use_cases
def CallbackDelivery(config: Box = None):
use_case = use_cases.DeliverCallbackUseCase(
delivery_outbox_repo=repos.DeliveryOutbox(config.DELIVERY_OUTBOX_REPO),
topic_base... | 2.078125 | 2 |
src/secondaires/exportaide/formats/pgsql/format.py | vlegoff/tsunami | 14 | 43139 | <reponame>vlegoff/tsunami
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyrigh... | 1.242188 | 1 |
app/models.py | Nasfame/Mobile-Wallet | 0 | 43140 | <gh_stars>0
from datetime import datetime
from flask_login import UserMixin
from pytz import timezone
from . import db
def time_now():
IST = timezone('Asia/Kolkata')
return datetime.now(IST)
class User(db.Model, UserMixin):
__tablename__ = "user"
id = db.Column(db.Integer, primary_key=True)
us... | 2.6875 | 3 |
models/flatten.py | msharmavikram/pytorch-cifar | 0 | 43141 | from collections import OrderedDict
from typing import Iterator, Tuple
from torch import nn
def flatten(module: nn.Sequential) -> nn.Sequential:
"""Flattens a nested sequential module."""
if not isinstance(module, nn.Sequential):
raise TypeError('not sequential')
return nn.Sequential(OrderedDict... | 2.796875 | 3 |
src/solutions/common/models/group_purchase.py | goubertbrent/oca-backend | 0 | 43142 | <reponame>goubertbrent/oca-backend
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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/LICE... | 1.859375 | 2 |
hw/2016_spring/hw1/run.py | lwlynn/cme193 | 15 | 43143 | <reponame>lwlynn/cme193
from util import test, summary
from matrix import Matrix
if __name__ == '__main__':
M = Matrix(shape=(4, 5))
test(M.shape() == (4, 5), 'M.shape() test')
test(M[0, 0] == 0, 'M[0, 0] == 0 test')
M[0, 0] = 3
test(M[0, 0] == 3, 'M[0, 0] == 3 (setter) test')
a = M[0, 0]
test(a == 3, 'a ... | 2.265625 | 2 |
osp/core/session/transport/transport_session_server.py | tareq97/osp-core | 0 | 43144 | <reponame>tareq97/osp-core
import os
import json
import logging
import inspect
from osp.core.session.buffers import BufferContext
from osp.core.session.wrapper_session import WrapperSession
from osp.core.session.transport.communication_engine \
import CommunicationEngineServer
from osp.core.session.transport.transp... | 2.375 | 2 |
tests/testapp/views.py | fabiangermann/feincms3 | 0 | 43145 | from django.shortcuts import get_object_or_404, redirect, render
from feincms3.plugins import external, html, richtext
from feincms3.regions import Regions
from feincms3.renderer import TemplatePluginRenderer
from .models import HTML, External, Image, Page, RichText, Snippet
renderer = TemplatePluginRenderer()
rend... | 1.875 | 2 |
bench/test_get.py | eabrouwer3/aiotoolz | 0 | 43146 | <reponame>eabrouwer3/aiotoolz<filename>bench/test_get.py
from aiotoolz import get
tuples = [(1, 2, 3) for i in range(100000)]
def test_get():
for tup in tuples:
get(1, tup)
| 2.125 | 2 |
gigapy.py | DinCahill/gigapy | 0 | 43147 | <reponame>DinCahill/gigapy<filename>gigapy.py<gh_stars>0
#!/usr/bin/env python3
import os
import xmltodict
import argparse
import sys
import psutil
import subprocess
import time
SIVDir = 'C:\Program Files (x86)\Gigabyte\SIV'
ProfileDir = os.path.join(SIVDir, 'Profile')
thermaldPath = os.path.join(SIVDir, ... | 2.421875 | 2 |
ui/views.py | h2020-westlife-eu/VRE | 1 | 43148 | import os
from django.conf import settings
from django.contrib.auth import logout as django_logout
from django.contrib.sites.models import Site
from django.http import HttpResponse
from django.shortcuts import render, redirect
from django.views.generic import View, TemplateView
from luna_django_commons.app.mixins imp... | 1.992188 | 2 |
train_mask_rcnn.py | branislav1991/MicroscopyUNet | 1 | 43149 | <reponame>branislav1991/MicroscopyUNet
import os
import sys
import random
import math
import re
import time
import numpy as np
import cv2
import matplotlib
import matplotlib.pyplot as plt
import keras.backend as K
from models.mask_rcnn.config import CellConfig
from models.mask_rcnn import utils
from mode... | 2.375 | 2 |
xrpl/utils/str_conversions.py | antonyggvzvmnxxcx/xrpl-py | 0 | 43150 | """Various useful string conversions utilities for XRPL."""
def str_to_hex(input: str) -> str:
"""
Convert a UTF-8-encoded string into hexadecimal encoding.
XRPL uses hex strings as inputs in fields like `domain`
in the `AccountSet` transaction.
Args:
input: UTF-8-encoded string to conver... | 3.171875 | 3 |
tang_jcompneuro/cnn_pretrained.py | leelabcnbc/tang_jcompneuro_revision | 3 | 43151 | <filename>tang_jcompneuro/cnn_pretrained.py
"""handles feature extraction"""
# rewrite of https://github.com/leelabcnbc/tang-paper-2017/blob/master/tang_2017/feature_extraction.py
from torchvision.models import vgg16, vgg16_bn, vgg19, vgg19_bn
from leelabtoolbox.feature_extraction.cnn import (cnnsizehelper, generic_ne... | 2.28125 | 2 |
mutesP/voicemutes.py | duanegtr/legendv3-cogs | 3 | 43152 | <reponame>duanegtr/legendv3-cogs
from typing import Optional, Tuple, Union
from datetime import timezone, timedelta, datetime
from .abc import MixinMeta
import discord
from redbot.core import commands, checks, i18n, modlog
from redbot.core.utils.chat_formatting import (
bold,
humanize_timedelta,
humanize_l... | 2.109375 | 2 |
sshr/clients/admin.py | zhengxiaowai/sshm | 0 | 43153 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from core import SSHRAdmin
from ._dropbox import DropboxClient
from ._qiniu import QiniuClient
from ._webdav import WebdavClient
sshr_admin = SSHRAdmin()
sshr_admin.register('dropbox', DropboxClient)
sshr_admin.register('qiniu', QiniuClient)
sshr_admin.regist... | 1.554688 | 2 |
searchguard/rolesmapping.py | ByteInternet/searchguard-python | 3 | 43154 | #!/usr/bin/python3
import requests
import json
import searchguard.settings as settings
from searchguard.exceptions import RoleMappingException, CheckRoleMappingExistsException, ViewRoleMappingException, \
DeleteRoleMappingException, CreateRoleMappingException, ModifyRoleMappingException, CheckRoleExistsException, ... | 2.53125 | 3 |
digsby/src/plugins/facebook/facebookprotocol.py | ifwe/digsby | 35 | 43155 | from util.callbacks import callsback
from util.threads.timeout_thread import Timer
from util.primitives import Storage as S
from traceback import print_exc
import util.primitives.structures as structures
from .fbutil import trim_profiles, extract_profile_ids
import traceback
import simplejson
import facebookapi
import ... | 1.984375 | 2 |
app/pytorch/book/chp003/chp003_c003.py | yt7589/aqp | 0 | 43156 | <gh_stars>0
#
import math
import numpy as np
import matplotlib.pyplot as plt
class Chp003C003(object):
def __init__(self):
self.name = ''
def run(self):
print('一元高斯分布图像')
mu = 3.0
sigma = 0.5
x = np.linspace(-1.0, 6.0, 100)
y = self.gaussian(x, mu, sigma)
... | 3.015625 | 3 |
python/zp/primjer_12.03.py | jasarsoft/examples | 0 | 43157 | <reponame>jasarsoft/examples
import os
import time
#fajlovi i folderi koje zelimo da backupujemo su specificirani u listi
izvor = ['C:\\py', '"C:\\Documents and Settings\xinjure\\Desktop\\"']
#primjetite da smo koristili duple navodnike unutar stringa, zbog imena koje sadrzi razmake
#backup ce biti sacuvan u glavnom ... | 2.5 | 2 |
nurbs/Curve.py | varshapendyala/Manifold-Learning | 3 | 43158 | <filename>nurbs/Curve.py
"""
.. module:: Curve
:platform: Unix, Windows
:synopsis: A data storage and evaluation class for B-spline and NURBS curves
.. moduleauthor:: <NAME>
"""
import sys
import itertools
import nurbs.utilities as utils
class Curve(object):
""" A class for storing and evaluating B-Spl... | 3.515625 | 4 |
pc.py | MaNongJiaLe/DaYuHaiTang | 0 | 43159 | <reponame>MaNongJiaLe/DaYuHaiTang
print('nice' in 'nice to meet you')
a=1000000
b=1000000
c=a+b
print(c)
| 2.46875 | 2 |
clients_1.3/python/test/test_solver_async_response.py | MetaAnalyticsAdmin/meta-analytics | 5 | 43160 | """
QUBO API solvers
QUBO solvers from Meta Analytics # noqa: E501
The version of the OpenAPI document: v1
Contact: <EMAIL>
Generated by: https://openapi-generator.tech
"""
import sys
import unittest
import meta_analytics
from meta_analytics.model.solver_async_response import SolverAsyncRespon... | 1.679688 | 2 |
data/studio21_generated/introductory/3074/starter_code.py | vijaykumawat256/Prompt-Summarization | 0 | 43161 | def growing_plant(upSpeed, downSpeed, desiredHeight):
| 1.484375 | 1 |
Settings.py | deswong/CalSyncHAB | 10 | 43162 | import configparser
import os
ApplicationDir = os.path.dirname(os.path.abspath(__file__))
HomeDir = os.path.expanduser('~')
CredentialDir = os.path.join(HomeDir, '.credentials')
if not os.path.exists(CredentialDir):
os.makedirs(CredentialDir)
CredentialFilePath = os.path.join(CredentialDir, 'CalSyncHAB.json')
Ca... | 1.882813 | 2 |
api/test/test_main.py | diego-hermida/ClimateChangeApp | 2 | 43163 | <reponame>diego-hermida/ClimateChangeApp
import global_config.config
import api.main as main
import json
from pymongo.errors import DuplicateKeyError
from unittest import TestCase, mock
from unittest.mock import Mock
from utilities.mongo_util import create_user, bulk_create_authorized_users, drop_user, drop_database
... | 2.390625 | 2 |
huskylens/main.py | bbk012/uPyBot | 0 | 43164 | <reponame>bbk012/uPyBot<gh_stars>0
"""Simple MicroPython script which demonstrates uPyBot controlled using the Micro Python Board (pyboard)"""
# 25-Dec-2019 Initial version of the script created
# 16-Jan-2020 Simple update robot class renamed to uPyBot
# 05-Sep-2021 Changed motor methods (added delay between movements ... | 3.15625 | 3 |
models/deeplab_v2.py | lmycross/segmentation | 6 | 43165 | <gh_stars>1-10
import torch.nn as nn
import torch
import numpy as np
from torchvision import models
affine_par = True
def outS(i):
i = int(i)
i = int(np.floor((i+1)/2))
i = int(np.floor((i+1)/2))
i = int(np.floor((i+1)/2))
return i
class Classifier_Module(nn.Module):
def __init__(self,dila... | 2.109375 | 2 |
acapi/resources/backup.py | darlev91/python-acquia-cloud | 9 | 43166 | <reponame>darlev91/python-acquia-cloud<gh_stars>1-10
"""Database Backup."""
try:
# Backwards compatible Python 3
import urllib.parse as urlparse
except ImportError:
# Python 2.x
import urlparse
from acapi.resources.acquiaresource import AcquiaResource
class Backup(AcquiaResource):
"""Acquia Clou... | 3.125 | 3 |
pysimgame/model.py | ScienceGamez/pysimgame | 0 | 43167 | <filename>pysimgame/model.py<gh_stars>0
"""The model that runs with the game."""
from __future__ import annotations
import json
import re
from functools import cached_property, singledispatchmethod
from pathlib import Path
from threading import Lock, Thread
from types import NotImplementedType
from typing import TYPE_... | 2.6875 | 3 |
test1.py | LotosPage/enviromnent0 | 1 | 43168 | <filename>test1.py
a = 1
b = 1
while 32 >= a:
print(a,-b)
b *= 2
a += 1
print("Year",b/365)
| 3.28125 | 3 |
utils/tileextractor/ExtractTiles.py | kurodenjiro/PokeRPG | 1 | 43169 | import Image, ImageDraw, ImageFont
import md5, sha
import sys, time, os
import re
tileSize = (16,16)
outputWidth = 8
outputSpare = 1
scale = 2
pathIn = 'input/'
pathOut = 'output/'
animatedTiles = []
class Tile :
pixels = None
hash = None
number = None
image = None
def __init__ (self) :
self.pixels = {}
... | 2.875 | 3 |
tock/utilization/views.py | mikiec84/tock | 0 | 43170 | from django.core.exceptions import PermissionDenied
from django.template.defaultfilters import slugify
from django.urls import reverse
from django.views.generic import ListView
from hours.models import TimecardObject, ReportingPeriod
from employees.models import UserData
from tock.utils import PermissionMixin
from .u... | 2.015625 | 2 |
tests/test_code.py | ducphucnguyen/PyEnvNoise | 1 | 43171 | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 13 15:10:58 2021
@author: nguy0936
"""
from pyenvnoise.utils import ptiread
data = ptiread('R:\CMPH-Windfarm Field Study\Hornsdale\set2\Recording-1.1.pti')
import numpy as np
file_name = 'R:\CMPH-Windfarm Field Study\Hornsdale\set2\Recording-1.1.pti'
fid = open(file... | 1.90625 | 2 |
tools/libs/PassID-Server/src/pymrtd/pki/crl.py | lukapercic/PassID-Public-Docs | 1 | 43172 | '''
File name: crl.py
Author: ZeroPass - <NAME>
License: MIT lincense
Python Version: 3.6
'''
from .x509 import CscaCertificate
from .cert_utils import verify_sig
from asn1crypto.crl import CertificateList
import datetime
"""
CRL: \
-object ***
-serial Number***
-subject key //not
-a... | 2.65625 | 3 |
src/r2g/online/blast.py | yangwu91/r2g | 55 | 43173 | <filename>src/r2g/online/blast.py
from __future__ import division
import os
import time
from copy import deepcopy
import xml.etree.ElementTree as ET
from r2g import utils
from r2g.online import NCBIWWW_selenium
from r2g import errors
def _cut_seq(name, seq, args):
chunks = []
try:
frag = int(args["c... | 2.296875 | 2 |
pypyr/steps/append.py | mofm/pypyr | 261 | 43174 | <reponame>mofm/pypyr<filename>pypyr/steps/append.py
"""pypyr step that appends items to a mutable sequence, such as a list."""
import logging
from pypyr.utils.asserts import assert_key_exists, assert_key_is_truthy
logger = logging.getLogger(__name__)
def run_step(context):
"""Append item to a mutable sequence.
... | 3 | 3 |
Node3D/opengl/Mesh.py | ArnoChenFx/Node3D | 3 | 43175 | import numpy as np
from OpenGL.arrays import vbo
from .Mesh_utils import MeshFuncs, MeshSignals, BBox
import openmesh
import copy
from .Shader import *
orig_set_vertex_property_array = openmesh.PolyMesh.set_vertex_property_array
def svpa(self, prop_name, array=None, element_shape=None, element_value=None):
if ar... | 2.296875 | 2 |
apps/ots/strategy/portfolio_hft.py | yt7589/iching | 32 | 43176 | #
from __future__ import print_function
import datetime as dt
import math
from apps.ots.strategy.performance import Performance
try:
import Queue as queue
except ImportError:
import queue
import numpy as np
import pandas as pd
#
from apps.ots.event.ots_event import OtsEvent
from apps.ots.event.signal_event impo... | 2.109375 | 2 |
src/python/gesture_controller.py | jdumm/spotify-gesture-controls | 0 | 43177 | import numpy as np
import pyautogui
import imutils
from mss import mss
from PIL import Image
import cv2
import copy
import argparse
from hand_poses import HandPoses
from hand_detect import HandDetect
from delay import Delay
from spotify_controls import SpotifyControls
parser = argparse.ArgumentParser()
parser.add_a... | 2.859375 | 3 |
loader/wakatime_loader.py | JasonkayZK/GitHubPoster | 1 | 43178 | <reponame>JasonkayZK/GitHubPoster<gh_stars>1-10
import time
import pendulum
import requests
from .base_loader import BaseLoader
from .config import WAKATIME_SUMMARY_URL
class WakaTimeLoader(BaseLoader):
def __init__(self, from_year, to_year, **kwargs) -> None:
super().__init__()
assert to_year >... | 2.984375 | 3 |
ui/1.py | sarkarrajsingh1/Tensorflow-text-generator-with-GUI | 0 | 43179 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '1.ui'
#
# Created by: PyQt5 UI code generator 5.8.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setO... | 1.9375 | 2 |
randomizer.py | spicefather/LADXR | 0 | 43180 | import explorer
import random
import os
import logic
import copy
import patches.dungeonEntrances
import patches.goal
from locations.items import *
class Error(Exception):
pass
class Randomizer:
def __init__(self, rom, options, *, seed=None):
self.seed = seed
if self.seed is ... | 2.640625 | 3 |
pythonPrograms/microphone_recognition.py | akierson/capstone-prototype | 0 | 43181 | #!/usr/bin/env python3
# NOTE: this example requires PyAudio because it uses the Microphone class
import speech_recognition as sr
# obtain audio from the microphone
r = sr.Recognizer()
with sr.Microphone() as source:
print("Say something!")
audio = r.listen(source)
# recognize speech using Sphinx
try:
p... | 3.109375 | 3 |
tests/unit/test_dp.py | lantz/faucet2 | 0 | 43182 | <gh_stars>0
"""Unit tests for DP"""
import unittest
from faucet.dp import DP
class FaucetDPConfigTest(unittest.TestCase): # pytype: disable=module-attr
"""Test that DP serialises config as it receives it"""
def setUp(self):
"""Defines the default config - this should match the documentation"""
... | 2.4375 | 2 |
factory-ai-vision/EdgeSolution/modules/WebModule/backend/vision_on_edge/azure_projects/ovms_config_utils.py | michellechena/azure-intelligent-edge-patterns | 0 | 43183 | <gh_stars>0
import os
import glob
import json
import configparser
face_detection_config = {
"model_config_list": [{
"config": {
"name": "face_detection",
"base_path": "/workspace/face-detection-retail-0004/",
"shape": "(1,3,400,600)",
"layout": "NHWC",
... | 1.882813 | 2 |
python_demo_v2/lxml_test.py | renhongl/python_demo | 1 | 43184 | <filename>python_demo_v2/lxml_test.py
import requests
from lxml import etree
def get_one_page(url):
try:
headers = {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36',
'cookie': 'prov=75cc3cab-0ed5-5... | 3.1875 | 3 |
nuage_neutron/plugins/common/service_plugins/l3.py | jbemmel/nuage-openstack-neutron | 0 | 43185 | <filename>nuage_neutron/plugins/common/service_plugins/l3.py
# Copyright 2016 NOKIA
#
# 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... | 1.265625 | 1 |
dark_proteome_visualization/handlers/__init__.py | Zethson/dark-proteome-visualization | 2 | 43186 | <filename>dark_proteome_visualization/handlers/__init__.py
# Import all handlers here
from . import favicon
from . import index
from . import generic
from . import elements
from . import about
from . import explore
from . import analyze
from . import features
from . import contact_request
| 0.964844 | 1 |
chapter05/selenium_search.py | Alchemy2011/spider | 0 | 43187 | from selenium import webdriver
def main():
driver = webdriver.Chrome()
driver.get('http://127.0.0.1:8000/places/default/search')
driver.find_element_by_id('search_term').send_keys('.')
driver.execute_script("document.getElementById('page_size').options[1].text = '1000'")
driver.find_element_by_id(... | 3.265625 | 3 |
alano/train/scheduler.py | zren96/alano | 0 | 43188 | # Please contact the author(s) of this library if you have any questions.
# Authors: <NAME> ( <EMAIL> )
class _scheduler(object):
def __init__(self, last_epoch=-1, verbose=False):
self.cnt = last_epoch
self.verbose = verbose
self.variable = None
self.step()
def step(self):
... | 2.703125 | 3 |
page_generator/page.py | abamaxa/docvision_generator | 2 | 43189 | <reponame>abamaxa/docvision_generator<gh_stars>1-10
import random
import time
import abc
import logging
from graphics import Draw
from augmentation import ImgAugAugmentor, ImageTiler
from .page_params import DefaultPageParameters, JsonPageParameters
class Page(object):
def __init__(self, name, options, persister... | 2.40625 | 2 |
src/test/tinc/tincrepo/mpp/gpdb/tests/storage/access_methods/ao_memory.py | lintzc/GPDB | 1 | 43190 | <filename>src/test/tinc/tincrepo/mpp/gpdb/tests/storage/access_methods/ao_memory.py
#!/usr/bin/env python
"""
Copyright (C) 2004-2015 Pivotal Software, Inc. All rights reserved.
This program and the accompanying materials are made available under
the terms of the under the Apache License, Version 2.0 (the "License");... | 2.234375 | 2 |
src/car_fft.py | pradolucas/SSVEP-EEG-MLP-OLS | 0 | 43191 | import numpy as np
from scipy.fft import fft
def CAR(X, labels):
N = X.shape
N_classes = len(np.unique(labels))
data10 = np.zeros((N[0], N[1], 1))
data11 = np.zeros((N[0], N[1], 1))
data12 = np.zeros((N[0], N[1], 1))
data13 = np.zeros((N[0], N[1], 1))
for trial in range(N[2]): ##... | 2.625 | 3 |
drl/agents/architectures/stateless/identity.py | lucaslingle/pytorch_drl | 0 | 43192 | from typing import Optional, Callable, List
import torch as tc
import numpy as np
from drl.agents.architectures.stateless.abstract import StatelessArchitecture
class Identity(StatelessArchitecture):
"""
Identity architecture. Useful for unit testing.
"""
def __init__(
self,
i... | 2.71875 | 3 |
parser/osm_parser_mapking.py | justinxutianyu/comp90019 | 1 | 43193 | import geog
import networkx as nx
import osmgraph
# By default any way with a highway tag will be loaded
g = osmgraph.parse_file('hawaii-latest.osm.bz2') # or .osm or .pbf
for n1, n2 in g.edges_iter():
c1, c2 = osmgraph.tools.coordinates(g, (n1, n2))
g[n1][n2]['length'] = geog.distance(c1, c2)
import ran... | 3.09375 | 3 |
StevenKyritsis_HW12.py | stevenkyritsis/NJIT-CS100 | 0 | 43194 | '''
<NAME>
CS100-031 Fall 2021
HW12 December 10, 2021
'''
#1
def safeOpen(inFile):
try:
file = open(inFile)
return file
except:
return None
#2
def safeFloat(inFloat):
try:
newFloat = float(inFloat)
return newFloat
except ValueError:
return 0.0
#3
def av... | 3.375 | 3 |
examples/ball-example/main.py | zenvarlab/pyobjus | 0 | 43195 | from random import random
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.properties import NumericProperty, ReferenceListProperty, ObjectProperty
from kivy.vector import Vector
from kivy.clock import Clock
from kivy.graphics import Color
from pyobjus import autoclass
class Ball(Widget):
vel... | 2.671875 | 3 |
src/simulator.py | xfontes42/hermes-simulation | 7 | 43196 | <reponame>xfontes42/hermes-simulation<filename>src/simulator.py
"""
Simulation process.
From micro-level decision making and learning, to macro-level simulation of Users on a graph network.
"""
from typing import List
from queue import PriorityQueue
from event import CreateActorEvent, AccidentEvent
from graph import Ro... | 2.96875 | 3 |
k3rn3l-ctf-2021/non-square-freedom/nonsquarefreedom_hard.py | AZ-0/Writeups | 0 | 43197 | <gh_stars>0
#!/usr/bin/env python3
from Crypto.Util.number import getPrime
import os
# Local imports
with open('flag.txt','rb') as f:
FLAG = f.read()
f.close()
# Key gen
P = getPrime(512//8)
Q = getPrime(256)
R = getPrime(256)
N = P**8 * Q * R
E = 0x10001
def pad_hard(m):
m <<= 256
m += int.from_byte... | 3.171875 | 3 |
Guanabara/desafio01.py | manuellaAlvesVarella/python | 1 | 43198 | nome = (input('digite o seu nome:'))
print ('muito prazer {} seja muito bem vinda!'.format(nome)) | 3.65625 | 4 |
dvc/utils/pkg.py | lucasalavapena/dvc | 9,136 | 43199 | <filename>dvc/utils/pkg.py
try:
# file is created during dvc build
from .build import PKG # noqa, pylint:disable=unused-import
except ImportError:
PKG = None # type: ignore[assignment]
| 1.414063 | 1 |