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
scripts/s3-uploader.py
kltm/go-site
31
48300
""" Copy the contents of a local directory into the correct S3 location, using the correct metadata as supplied by the metadata file (or internal defaults). """ #### #### Copy the contents of a local directory into the correct S3 #### location, using the correct metadata as supplied by the metadata #### file (or intern...
2.53125
3
iss.py
WesleySalesberry/q3-ISS_Location
0
48301
#!/usr/bin/env python __author__ = '<NAME>' import turtle from datetime import datetime import requests import json # Cleans up the json so that it is readable def jprint(obj): text = json.dumps(obj, sort_keys=True, indent=4) print(text) # gets the number and name of each astronaught def get_astronauts_in...
3.28125
3
engram/tests/test_sys_redirect.py
rgrannell1/engram.py
0
48302
#!/usr/bin/env python3 import unittest import os import sys import requests import utils_test from multiprocessing import Process import time sys.path.append(os.path.abspath('engram')) import engram class TestRedirect(utils_test.EngramTestCase): def test_index(self): """ Story: Bookmark pages loads....
2.6875
3
pyluna-radiology/tests/luna/radiology/unpack_images/test_unpack.py
msk-mind/data-processing
1
48303
<filename>pyluna-radiology/tests/luna/radiology/unpack_images/test_unpack.py import pytest import os, shutil from pyspark import SQLContext from click.testing import CliRunner import os from luna.radiology.unpack_images.unpack import cli unpacked_pngs_path = "pyluna-radiology/tests/luna/radiology/testdata/unpacked_p...
2.171875
2
Cpy simplified/wiznet_simplify.py
ronpang/WIZnet-HK_Ron
0
48304
<filename>Cpy simplified/wiznet_simplify.py<gh_stars>0 # SPDX-FileCopyrightText: 2010 WIZnet # # SPDX-License-Identifier: MIT import board import digitalio import time import busio from adafruit_wiznet5k.adafruit_wiznet5k import * #active WIZnet chip library import adafruit_wiznet5k.adafruit_wiznet5k_socket a...
2.546875
3
data/KS_Eqn_data.py
BethanyL/PDEKoopman2
10
48305
<filename>data/KS_Eqn_data.py """ Create training/validation data for KS Equation. All data comes from solutions to Kuramoto-Sivashinsky equation. Training data: Initial conditions: 120,000 ICs White noise, Sines, Square waves Solve from t = 0 to 6.25 in steps of 0.125 128 spatial points in...
2.5625
3
utils/tmp.py
adusa1019/ntm_one_shot_chainer
0
48306
<gh_stars>0 #!/usr/bin/env python3 # coding=utf-8 import argparse import glob import os import random import sys import chainer import numpy as np def transform(in_data): """ 画像の白黒を反転する in_data: 画素値が0.0~1.0に正規化されたグレースケール画像 """ return 1.0 - in_data class SamplingDataset(cha...
2.515625
3
src/python/interpret/test/test_interactive.py
benediktwagner/interpret
0
48307
# Copyright (c) 2019 Microsoft Corporation # Distributed under the MIT software license from ..visual.interactive import set_show_addr, get_show_addr, shutdown_show_server import pytest @pytest.mark.skip def test_shutdown(): target_addr = ("127.0.0.1", 1337) set_show_addr(target_addr) actual_response = ...
2.25
2
books/booksdatasourcetests.py
KristinA64/cs257
0
48308
<filename>books/booksdatasourcetests.py ''' booksdatasourcetest.py <NAME>, 24 September 2021 <NAME>, <NAME>, 11 October 2021 ''' import booksdatasource import unittest class BooksDataSourceTester(unittest.TestCase): def setUp(self): self.data_source = booksdatasource.BooksDataSource('books_medi...
3.28125
3
thunder/extraction/extraction.py
pearsonlab/thunder
1
48309
from thunder.utils.common import checkParams from thunder.extraction.source import SourceModel class SourceExtraction(object): """ Factory for constructing source extraction methods. Returns a source extraction method given a string identifier. Options include: 'nmf', 'localmax', 'sima' """ d...
2.453125
2
evaluation/__init__.py
ardihikaru/hfsoftmax
95
48310
<gh_stars>10-100 from .verify import evaluate
1.0625
1
src/plugins/render/__init__.py
MeetWq/mybot
29
48311
from nonebot import on_command from nonebot.typing import T_State from nonebot.adapters.cqhttp import Bot, MessageEvent, MessageSegment, unescape from .data_source import t2p, m2p __des__ = '文本、Markdown转图片' __cmd__ = ''' text2pic/t2p {text} md2pic/m2p {text} '''.strip() __short_cmd__ = 't2p、m2p' __example__ = ''' t2p...
2.296875
2
PIL_ext.py
Freakwill/pillow-extension
0
48312
<gh_stars>0 # -*- coding: utf-8 -*- import itertools import pathlib import numpy as np import numpy.linalg as LA from PIL import Image def tovector(image, k=None): # image -> vector data = np.asarray(image, dtype=np.float64) if k: return data[:,:, k].flatten() else: r...
2.78125
3
acurl/tests/test_to_curl.py
markgreene74/mite
17
48313
import pytest from helpers import create_request import acurl def test_to_curl(): r = create_request("GET", "http://foo.com") assert r.to_curl() == "curl -X GET http://foo.com" def test_to_curl_headers(): r = create_request( "GET", "http://foo.com", headers=("Foo: bar", "My-Header: is-aweso...
2.421875
2
quickstartup/qs_accounts/admin.py
shahabaz/quickstartup
13
48314
<reponame>shahabaz/quickstartup<gh_stars>10-100 from django import forms from django.contrib import admin from django.contrib.auth import get_user_model from django.contrib.auth.forms import ReadOnlyPasswordHashField from django.utils.translation import gettext_lazy as _ from .models import User class UserAdminCreat...
2.53125
3
gitogether/__init__.py
nklapste/gitogether
0
48315
#!/usr/bin/python # -*- coding: utf-8 -*- """gitogether Scripts: + :mod:`.__main__` - argparse entry point Module: """ __version__ = (0, 0, 0)
1.257813
1
docparser/objdetmetrics_lib/BoundingBox.py
DS3Lab/DocParser
45
48316
<gh_stars>10-100 from docparser.objdetmetrics_lib.utils import * class BoundingBox: def __init__(self, imageName, classId, x, y, w, h, typeCoordinates=CoordinatesType.Absolute, i...
2.78125
3
models/bare/conv4.py
sdamadi/image-classification
3
48317
import torch import torch.nn as nn class Conv4(nn.Module): def __init__(self, in_ch, imgsz, num_classes=10): super(Conv4, self).__init__() self.conv1 = nn.Conv2d(in_ch, 64, kernel_size=(3, 3), stride=1, padding=1) self.conv2 = nn.Conv2d(64, 64, kernel_size=(3, 3), stride=1, padding=1) self.conv3 = nn...
2.859375
3
libs/parser.py
micobg/revolut-stocks
0
48318
<reponame>micobg/revolut-stocks import pdfreader from pdfreader import PDFDocument, SimplePDFViewer from pdfreader.viewer import PageDoesNotExist from datetime import datetime, timedelta import decimal decimal.getcontext().rounding = decimal.ROUND_HALF_UP from libs import ( REVOLUT_DATE_FORMAT, REVOLUT_ACTIVI...
2.515625
3
towers/monkey_village.py
56kyle/bloons_auto
0
48319
<filename>towers/monkey_village.py from tower import Tower from config import keybinds class MonkeyVillage(Tower): name = 'monkey_village' range = 215 width = 119 height = 103 size = 'xl' keybind = keybinds[name] aquatic = False def __init__(self, **kwargs): super().__init__(*...
2.578125
3
dataset/data_utils/point_util.py
shinke-li/Campus3D
31
48320
<gh_stars>10-100 import numpy as np def gen_gaussian_ball(center, radius, size): if not isinstance(radius, np.ndarray): radius = np.asarray([radius, radius, radius]) pts = [np.random.normal(loc=center[i], scale=radius[i], size=size) for i in range(center.shape[0])] return np.asarray(pts).transpose...
2.65625
3
kairon/shared/account/processor.py
encounter-ai/kairon
0
48321
<filename>kairon/shared/account/processor.py from datetime import datetime from typing import Dict, Text from loguru import logger as logging from mongoengine.errors import DoesNotExist from mongoengine.errors import ValidationError from pydantic import SecretStr from validators import ValidationFailure from validator...
1.976563
2
subtle_data_crimes/crime_2_jpeg/Fig7/DL/Test_MoDL_R4_forFig6.py
mikgroup/subtle_data_crimes
8
48322
''' This code is used for testing MoDL on JPEG-compressed data, for the results shown in figures 6, 7 and 8c in the paper. Before running this script you should update the following: basic_data_folder - it should be the same as the output folder defined in the script /crime_2_jpeg/data_prep/jpeg_data_prep.py (c...
2.640625
3
wk8_hw/ex5_netmiko_sh_ver.py
philuu12/PYTHON_4_NTWK_ENGRS
1
48323
<gh_stars>1-10 #!/usr/bin/env python """ 5. Use Netmiko to connect to each of the devices in the database. Execute 'show version' on each device. Calculate the amount of time required to do this. """ from netmiko import ConnectHandler from datetime import datetime from net_system.models import NetworkDevice, Credent...
2.671875
3
homeassistant/components/multimatic/entities.py
thomasgermain/home-assistant
7
48324
"""Common entities.""" from __future__ import annotations from abc import ABC import logging from homeassistant.helpers.update_coordinator import CoordinatorEntity from homeassistant.util import slugify from .const import DOMAIN as MULTIMATIC from .coordinator import MultimaticCoordinator _LOGGER = logging.getLogge...
2.1875
2
leetcode/binary_tree_preorder_traversal.py
alexandru-dinu/competitive-programming
0
48325
# https://leetcode.com/problems/binary-tree-preorder-traversal # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def preorderTraversal(self, root: Optional[T...
3.765625
4
Data/__init__.py
himammz/GpTest
1
48326
__all__ = ['Database']
1.046875
1
debarcer/generate_vcf.py
FelixMoelder/debarcer
11
48327
<reponame>FelixMoelder/debarcer # -*- coding: utf-8 -*- """ Created on Fri Oct 25 14:25:48 2019 @author: RJovelin """ import time from debarcer.version import __version__ def GetConsData(consfile): ''' (str) -> dict :param consfile: Path to the consensus file (merged or not) Returns...
2.390625
2
geneticpython/core/operators/mutation/flip_bit_mutation.py
ngocjr7/geneticpython
0
48328
""" # Problem: flip_bit_mutation.py # Description: # Created by ngocjr7 on [2020-03-31 16:49:14] """ from __future__ import absolute_import from geneticpython.models.binary_individual import BinaryIndividual from .mutation import Mutation from geneticpython.utils.validation import check_random_state from ...
2.78125
3
data/ansible-module-template.py
trskop/hsansible
12
48329
<reponame>trskop/hsansible #!/usr/bin/env python # This file was generated using $program$ $version$ from a template # with following copyringht notice. # # Copyright (c) 2013, <NAME> <<EMAIL>> # # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted...
1.492188
1
Structured/models/building_blocks/transformers.py
hlzhang109/TransTEE
11
48330
<reponame>hlzhang109/TransTEE import copy from typing import Optional, Any import numpy as np import torch from torch import Tensor, nn from torch.nn.parameter import Parameter import torch.nn.functional as F from torch.nn.modules.module import Module from torch.nn.modules.container import ModuleList from torch.nn.modu...
2.46875
2
HLTrigger/Configuration/python/HLT_75e33/psets/initialStepTrajectoryFilterShapePreSplitting_cfi.py
PKUfudawei/cmssw
1
48331
<reponame>PKUfudawei/cmssw<gh_stars>1-10 import FWCore.ParameterSet.Config as cms initialStepTrajectoryFilterShapePreSplitting = cms.PSet( ComponentType = cms.string('StripSubClusterShapeTrajectoryFilter'), layerMask = cms.PSet( TEC = cms.bool(False), TIB = cms.vuint32(1, 2), TID = cms....
1.203125
1
cradmin_legacy/apps/cradmin_authenticate/views/logout.py
appressoas/cradmin_legacy
0
48332
from __future__ import unicode_literals from django.conf import settings from django.contrib.auth import logout def cradmin_logoutview(request, template_name='cradmin_authenticate/logout.django.html'): next_page = None if 'next' in request.GET: next_page = request.GET['next'] return logout( ...
1.921875
2
examples/example_modules/module_2.py
vladcalin/pymicroservice
2
48333
from gemstone.core.modules import Module import gemstone class SecondModule(Module): @gemstone.exposed_method("module2.say_hello") def say_hello(self): return "Hello from module 2!"
2.578125
3
dashboard/dashboard/pages/__init__.py
uk-gov-mirror/NHSX.covid-chest-imaging-database
56
48334
<filename>dashboard/dashboard/pages/__init__.py """Create and manage all the pages in the dashboard """ from pathlib import Path import dash_bootstrap_components as dbc import plotly.io as pio from jinja2 import Environment, FileSystemLoader from dataset import Dataset from .hospitals import create_app as hospital...
2.453125
2
tasks/serializers.py
rohitdwivedula/ultimate-task-manager
0
48335
from rest_framework import serializers from tasks.models import Label, Task, SubTask class LabelSerializer(serializers.ModelSerializer): class Meta: model = Label fields = ('uuid', 'name', 'description', 'created_at') class SubTaskSerializer(serializers.ModelSerializer): class Meta: m...
2.15625
2
UNIOA/Opt_X.py
Huilin-Li/UNIOA
0
48336
<filename>UNIOA/Opt_X.py from sklearn.metrics import pairwise_distances from .LevyFlight import Levy import numpy as np from numba import jit, prange class Opt_X: @staticmethod def your(): pass # <editor-fold desc="2 defs for ba: ba, ba_but_asyncE"> @staticmethod def ba(old_X, new_Y, old_x...
1.914063
2
open_astral_engine/effects/buff.py
I-dan-mi-I/Open-Astral-Engine
0
48337
<reponame>I-dan-mi-I/Open-Astral-Engine from .base_classes import EffectsDict effects = EffectsDict() @effects.append class BuffExample: __ename__ = "Название Бафф" __description__ = """Описание""" __fluttering__ = False __event__ = False __duration__ = 0 __eindex__ = -1 __type__ = "buff...
1.875
2
sshserveraudit/validator/__init__.py
zwiazeksyndykalistowpolski/ssh-server-audit
2
48338
from ..entity.host import Node from ..valueobject.validator import ValidatorResult import time import datetime import tornado.log class Validator: max_cache_time = 120.0 # static cache = {} def __init__(self, max_cache_time: int): self.max_cache_time = max_cache_time def _get_cache_ide...
2.078125
2
evaluate_recon_cd.py
kampta/multiview-shapes
0
48339
import numpy as np from scipy.spatial import cKDTree as KDTree import math import argparse # ref: https://github.com/facebookresearch/DeepSDF/blob/master/deep_sdf/metrics/chamfer.py # takes one pair of reconstructed and gt point cloud and return the cd def compute_cd(gt_points, gen_points): # one direction ...
2.546875
3
scripts/process.py
lpenuelac/ImageAnalysis
93
48340
#!/usr/bin/env python3 # This is the master ImageAnalysis processing script. For DJI and # Sentera cameras it should typically be able to run through with # default settings and produce a good result with no further input. # # If something goes wrong, there are usually specific sub-scripts that # can be run to fix th...
2.1875
2
lib/OSCP.py
streetlightvision/oscp-datalogger
0
48341
<filename>lib/OSCP.py import sqlite3 import sys import json import datetime import time import xml.etree.ElementTree as ET from lib.CMS import CMS def enum(*sequential, **named): enums = dict(zip(sequential, range(len(sequential))), **named) return type('Enum', (), enums) State = enum('INIT', 'CONNECT_LOCAL_DB', '...
2.28125
2
src/subs/get.py
ganghe74/solve
0
48342
#!/usr/bin/env python3 import click import requests import re import os from bs4 import BeautifulSoup headers = { 'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.82 Safari/537.36" } sources = { 'boj': { 'url': 'https://acmicpc.net/proble...
2.640625
3
infer_server/python/test/session_test.py
YJessicaGao/easydk
0
48343
<gh_stars>0 # ============================================================================== # Copyright (C) [2022] by Cambricon, Inc. 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 ...
1.632813
2
src/aiokatcp/connection.py
richarms/aiokatcp
0
48344
# Copyright 2017 National Research Foundation (Square Kilometre Array) # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of conditi...
1.570313
2
mock_stream.py
ckljohn/dash-live-table
0
48345
<reponame>ckljohn/dash-live-table<gh_stars>0 """ This script is to stream tcpdump to local Elasticsearch. Require root permission. """ from datetime import datetime import subprocess as sub import re from elasticsearch import Elasticsearch, RequestsHttpConnection, helpers tcpdump_reg = re.compile(r"IP (?P<IP1>[\w.-]+...
2.515625
3
VVeb.UQ/www/interfaces/submit_prominence_workflow.py
ukaea/ALC_UQ
2
48346
#!/usr/bin/python3 import os import subprocess import sys import json import requests import time # --- Function to execute command with interactive printout sent to web-terminal in real-time def interactive_command(cmd,session_name): # --- Execute command try: cmd2 = 'printf "' + cmd + '" > /VVebUQ_ru...
2.703125
3
201-300/221-230/224-basicCalculator/basicCalculator.py
xuychen/Leetcode
0
48347
<reponame>xuychen/Leetcode class Solution: def get_num(self, s, start): index = start while index < len(s) and s[index].isdigit(): index += 1 return int(s[start:index]), index def calculate_helper(self, s, start): result, sign, index = 0, 1, start operator =...
3.296875
3
rial_old/stages/post_parsing/infinite_loop_detector.py
L3tum/RIAL
2
48348
from rial.concept.parser import Tree from rial.stages.post_parsing.PostParsingInterface import PostParsingInterface class InfiniteLoopDetector(PostParsingInterface): def execute(self, ast: Tree): while ast is not None: self.visit_tree(ast) ast = None def visit_tree(self, ast: ...
2.125
2
plugins/russian_roulette/data_source.py
JustUndertaker/tuanzi_bot
8
48349
import datetime import random from typing import Union from modules.duel_history import DuelHistory def get_latest_duel(group_id: int) -> Union[DuelHistory, None]: """ :说明: 根据群号获取最近一场决斗记录 :参数 * group_id:QQ群号 :返回 * DuelHistory:俄罗斯轮盘决斗记录 * None:不存在记录 """ r = Due...
2.796875
3
examples/pull_entry_values.py
c0gnac/dealcloud-python
1
48350
""" This script pulls the values of the fields for the "Project Genome" entry on the Deal list """ import getpass as gp import sys import requests import dealcloud as dc # Create an instance of a client for the DealCloud Data Service and a service # proxy try: client = dc.create_client( ...
2.890625
3
udm-bildungslogin/usr/lib/python2.7/dist-packages/univention/udm/modules/bildungslogin_license.py
univention/bildungslogin
0
48351
# -*- coding: utf-8 -*- # # Copyright 2021 Univention GmbH # # https://www.univention.de/ # # All rights reserved. # # The source code of this program is made available # under the terms of the GNU Affero General Public License version 3 # (GNU AGPL V3) as published by the Free Software Foundation. # # Binary versions ...
1.898438
2
jd/api/rest/SellerPromoSingleCreatePlummetedPromoRequest.py
jof2jc/jd
0
48352
<reponame>jof2jc/jd<filename>jd/api/rest/SellerPromoSingleCreatePlummetedPromoRequest.py from jd.api.base import RestApi class SellerPromoSingleCreatePlummetedPromoRequest(RestApi): def __init__(self,domain,port=80): RestApi.__init__(self,domain, port) self.riskLevel = None self.promoChannel = None self....
2.1875
2
leer/core/storage/utxo_index_storage.py
TensorVirus/leer
0
48353
import os, lmdb class UTXOIndex: ''' Basically it is index [public_key -> set of unspent outputs with this public key] ''' __shared_states = {} def __init__(self, storage_space, path): if not path in self.__shared_states: self.__shared_states[path]={} self.__dict__ = self.__shared_states[p...
2.453125
2
bioinformatics/genbank_get_genomes_by_taxon.py
widdowquinn/scripts
15
48354
#!/usr/bin/env python # # genbank_get_genomes_by_taxon.py # # A script that takes an NCBI taxonomy identifier (or string, though this is # not reliable for taxonomy tree subgraphs...) and downloads all genomes it # can find from NCBI in the corresponding taxon subgraph with the passed # argument as root. # # (c) TheJa...
2.421875
2
homeworkpal_project/common/tests/test_utils.py
luiscberrocal/homeworkpal
0
48355
import datetime from django.test import TestCase from ..utils import get_fiscal_year, Holiday import logging logger = logging.getLogger(__name__) __author__ = 'lberrocal' class TestUtils(TestCase): def test_get_fiscal_year(self): cdates = [[datetime.date(2015, 10, 1), 'AF16'], [datetime....
2.546875
3
src/datamodules/imagenet_datamodule.py
blurry-mood/Distilled-Models
2
48356
import pytorch_lightning as pl import torch from torch.utils.data import Dataset, DataLoader, random_split from sklearn.preprocessing import LabelEncoder from PIL import Image import numpy as np import pandas as pd def encode_labels(labels): le = LabelEncoder() encoded = le.fit_transform(labels) ...
2.640625
3
py/scrn.py
sehagler/OrorbiaMikolovReitter2017
0
48357
<filename>py/scrn.py # Delta Recurrent Neural Network (Delta-RNN) Framework # # This gives an implementation of the Delta-RNN framework given in Ororbia et al. 2017, arXiv:1703.08864 [cs.CL], # https://arxiv.org/abs/1703.08864 using Python and Tensorflow. # # This code implements a variety of RNN models using the Delt...
2.953125
3
pysnmp/smi/mibs/instances/__SNMP-TARGET-MIB.py
RKinsey/pysnmp
492
48358
# # This file is part of pysnmp software. # # Copyright (c) 2005-2019, <NAME> <<EMAIL>> # License: http://snmplabs.com/pysnmp/license.html # # This file instantiates some of the MIB managed objects for SNMP engine use # if 'mibBuilder' not in globals(): import sys sys.stderr.write(__doc__) sys.exit(1) Mi...
1.609375
2
gcp-cli/client/util/util_dpm.py
lacework/csp-integrations
1
48359
<filename>gcp-cli/client/util/util_dpm.py from __future__ import print_function from __future__ import absolute_import from builtins import input from builtins import str import logging from .util_base import UtilBase from . import util_template HTTP_GET_METHOD = "GET" HTTP_POST_METHOD = "POST" HTTP_DELETE_METHOD = "D...
2.0625
2
main.py
Skopos-team/Prostagma
0
48360
import argparse import shutil import numpy as np from project.data_preprocessing.preprocessing import Preprocessor from project.data_preprocessing.data_loader import Loader from project.models.model import Model from prostagma.techniques.grid_search import GridSearch from prostagma.performances.cross_validation impor...
2.359375
2
gsm/truc.py
BobcatSMS/Bobcat
0
48361
<reponame>BobcatSMS/Bobcat text = "zeub" hexa = "" for i in text: hexa += str(hex(ord(i)))[2:].zfill(4) print(hexa) hexa = "002B00330033003600380039003000300034003000300030" #YOLOO hexa = [hexa[i:i+4] for i in range(0, len(hexa), 4)] text="" for i in hexa: text+=chr(int(i, 16)) print(text)
2.5625
3
otokon_archive/robotics/models.py
bilbeyt/otokon-archive
0
48362
from __future__ import unicode_literals from django.db import models from ckeditor_uploader.fields import RichTextUploadingField from django.db.models.signals import pre_save from django.template.defaultfilters import slugify from django.dispatch import receiver class Season(models.Model): name = models.CharField...
2.109375
2
cs411site/views.py
Mig-Foxhound/Find_Friend-Django-Project
0
48363
from django.shortcuts import render, redirect from django.db import connection from .forms import ProfileForm, LocationForm, SearchLocationForm import populartimes import datetime import math from mycrawl import popCrawl def index(request): # Render the HTML template index.html with the data in the context varia...
2.34375
2
model.py
ndminh21/aaa
0
48364
<filename>model.py from app import db from sqlalchemy.dialects.postgresql import JSON class Transaction(db.Model): __tablename__ = 'transaction' id = db.Column(db.String(), primary_key=True) size = db.Column(db.String()) time = db.Column(db.String()) valueout = db.Column(db.String())
2.59375
3
src/lib/utils/image_draw.py
Lakerszjb/CentereNet-C
0
48365
<gh_stars>0 from random import random as rand import cv2 import numpy as np import math import copy def draw_points(im, points, point_color=None): color = (rand() * 255, rand() * 255, rand() * 255) if point_color is None else point_color for i in range(points.shape[0]): cv2.circle(im, (int(points[i, 0...
2.484375
2
lifecycle/data/standalone/service_instance.py
mF2C/LifecycleManagement
0
48366
<reponame>mF2C/LifecycleManagement<gh_stars>0 """ Service instance - Data management This is being developed for the MF2C Project: http://www.mf2c-project.eu/ Copyright: Atos Research and Innovation, 2017. This code is licensed under an Apache 2.0 license. Please, refer to the LICENSE.TXT file for more information C...
2.140625
2
questioner/cli.py
larsyencken/questioner
9
48367
# -*- coding: utf-8 -*- # # cli.py # questioner # """ A command-line client for annotating things. """ import re import os from typing import List, Set, Optional import readchar import blessings SKIP_KEY = '\r' SKIP_LINE = '' QUIT_KEY = 'q' QUIT_LINE = 'q' EMAIL_REGEX = '^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$...
3.34375
3
Chapter08/01-chapter-content/contours_hu_moments.py
yaojh01/Mastering-OpenCV-4-with-Python
2
48368
""" Hu moments calculation """ # Import required packages: import cv2 from matplotlib import pyplot as plt def centroid(moments): """Returns centroid based on moments""" x_centroid = round(moments['m10'] / moments['m00']) y_centroid = round(moments['m01'] / moments['m00']) return x_centroid, y_centr...
3.296875
3
Data Analyst in Python/Step 1 - Introduction to Python/1. Python for Data Science Fundamentals/7. Functions Intermediate.py
MyArist/Dataquest
8
48369
## 1. Interfering with the Built-in Functions ## a_list = [1, 8, 10, 9, 7] print(max(a_list)) def max(a_list): return "No max value returned" max_val_test_0 = max(a_list) print(max_val_test_0) del max ## 3. Default Arguments ## # INITIAL CODE def open_dataset(file_name): opened_file = open(file_name) ...
4.09375
4
07-Data-Structures-Trees/54-BST-Insert-Code/src/BST-Insert.py
covuworie/data-structures-and-algorithms
0
48370
class Node: def __init__(self, value: int) -> None: self.value = value self.left = None self.right = None class BinarySearchTree: def __init__(self) -> None: self.root = None def insert(self, value: int) -> bool: new_node = Node(value) if self.root ...
4
4
native/sta2dfft.py
julianmak/pydra
0
48371
<gh_stars>0 #/usr/bin/env python3 # # JM: 12 Apr 2018 # # the sta2dfft.f90 adapted for python # contains 2d spectral commands which uses stafft from stafft import * # This module performs FFTs in two directions on two dimensional arrays using # the stafft library module to actually compute the FFTs. If FFTs in one ...
2.90625
3
SageMaker/from_athena.py
terratenney/aws-tools
8
48372
#import sys #!{sys.executable} -m pip install pyathena from pyathena import connect import pandas as pd conn = connect(s3_staging_dir='s3://aws-athena-query-results-459817416023-us-east-1/', region_name='us-east-1') df = pd.read_sql('SELECT * FROM "ticketdata"."nfl_stadium_data" order by stadium limit 10;', conn) df
2.0625
2
ApiRequests/tbdb_api_requests_example.py
mihaibc/PythonExamples
0
48373
import requests import json import api_informations as api_info # this is used to not expose the api key def json_print(obj): text = json.dumps(obj, sort_keys=True, indent=4) print(text) parameters = { "api_key" : api_info.api_key, "language" : "en-US", } response = requests.get("https://api.themovie...
3.34375
3
auto_ripper_daemon/main.py
puujam/auto_ripper_gui
0
48374
<filename>auto_ripper_daemon/main.py # Base modules import time import os import multiprocessing # Non-standard Installed modules from daemoniker import Daemonizer # Local modules import processing import communication pid_file_path = "pid_file" def main(): global processor processor = processing.P...
2.390625
2
attendees/forms.py
TonyEight/lionax-wedding
0
48375
<filename>attendees/forms.py<gh_stars>0 from django import forms from django.db.models.base import ModelBase from phonenumber_field.formfields import PhoneNumberField from . import models class InvitationReplyForm(forms.Form): mobile_phone = PhoneNumberField(required=True, widget=forms.widgets.TextInput( ...
1.992188
2
send_data.py
BiaChacon/weather-api
0
48376
import requests import time i = 0 while True: response = requests.get( "http://localhost:5000/send?idNode=ESP") print(i) i = i+1 print(response) time.sleep(60)
2.453125
2
setup.py
AdvancedThreatAnalytics/django-otp-sns
1
48377
<filename>setup.py #!/usr/bin/env python from setuptools import setup, find_packages setup( name='django-otp-sns', version='0.1.1', description="A django-otp plugin that delivers tokens via Amazon SNS.", long_description=open('README.rst').read(), author='Critical Start', author_email='<EMAIL...
1.398438
1
dxm/lib/DxJobs/DxExecutionComponent.py
experiortec/dxm-toolkit
5
48378
# # 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, software # distributed under ...
1.695313
2
genealogy.py
CristianLara/d3-code-genealogy
0
48379
import mosspy userid = 223762299 m = mosspy.Moss(userid, "javascript") # Submission Files m.addFile("files/d3.js") m.addFilesByWildcard("files/map.js") url = m.send() # Submission Report URL print ("Report Url: " + url) # Save report file m.saveWebPage(url, "report/report.html") # Download whole report locally i...
2.46875
2
ppstructure/vqa/infer_ser.py
QianMuluo/PaddleOCR
2
48380
<gh_stars>1-10 # Copyright (c) 2021 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 # # Unless re...
2.125
2
commands/cmdNewLoad.py
NightKev/Renol-IRC
2
48381
import imp ID = "newload" permission = 3 def execute(self, name, params, channel, userdata, rank): files = self.__ListDir__("commands") currentlyLoaded = [self.commands[cmd][1] for cmd in self.commands] for item in currentlyLoaded: filename = item.partition("/")[2] files.remove(filena...
2.0625
2
T2T_transformer_block.py
wdayang/TED-net
5
48382
<filename>T2T_transformer_block.py # Copyright (c) [2012]-[2021] Shanghai Yitu Technology Co., Ltd. # # This source code is licensed under the Clear BSD License # LICENSE file in the root directory of this file # All rights reserved. """ Borrow from timm(https://github.com/rwightman/pytorch-image-models) """ import tor...
2.625
3
tests/test_smith_waterman.py
Lioscro/pyseq-align
0
48383
<reponame>Lioscro/pyseq-align from unittest import TestCase from pyseq_align import smith_waterman from tests.mixins import TestMixin class TestSmithWaterman(TestMixin, TestCase): def test_align(self): sw = smith_waterman.SmithWaterman( substitution_matrix=self.substitution_matrix, ...
2.671875
3
smart/middlewire.py
liangbaika/Tinepeas
1
48384
# -*- coding utf-8 -*-# # ------------------------------------------------------------------ # Name: middlewire # Author: liangbaikai # Date: 2020/12/28 # Desc: there is a python file description # ------------------------------------------------------------------ from copy import copy from functools ...
2.671875
3
calamari_ocr/test/test_data_pagexml.py
jacektl/calamari
922
48385
import os import unittest this_dir = os.path.dirname(os.path.realpath(__file__)) class TestPageXML(unittest.TestCase): def run_dataset_viewer(self, add_args): from calamari_ocr.scripts.dataset_viewer import main main(add_args + ["--no_plot"]) def test_cut_modes(self): images = os.pa...
2.203125
2
GoingMerry/settings.py
Luffin/ThousandSunny
0
48386
<reponame>Luffin/ThousandSunny import os # You can name your own database's name DB_FILENAME = 'luffin' CUR_DIR = os.path.abspath('.') DB_DIR = "sqlite:///%s" % (os.path.join(CUR_DIR, '{}.db'.format(DB_FILENAME))) # cookie_secret must be set and keep it secret COOKIE_SECRET = '<KEY> # You can choose theme by setting...
2.390625
2
scripts/gene/preproc_BrainSpan_link.py
dbmi-bgm/cgap-annotation-server
1
48387
#!/usr/bin/env python # -*- coding: utf-8 -*- # preproc_BrainSpan_link.py # made by <NAME> # 2020-04-20 16:21:05 ######################### import sys import os SVRNAME = os.uname()[1] if "MBI" in SVRNAME.upper(): sys_path = "/Users/pcaso/bin/python_lib" elif SVRNAME == "T7": sys_path = "/ms1/bin/python_lib" els...
2.34375
2
tests/test_cdn.py
datalogics-cgreen/server_core
0
48388
# encoding: utf-8 from nose.tools import ( eq_, set_trace, ) from util.cdn import cdnify class TestCDN(object): def unchanged(self, url, cdns): self.ceq(url, url, cdns) def ceq(self, expect, url, cdns): eq_(expect, cdnify(url, cdns)) def test_no_cdns(self): url = "http:...
2.53125
3
test/test_helpers.py
hegga/act-api-python
0
48389
""" Test for act helpers """ import pytest import act.api def test_add_uri_fqdn() -> None: # type: ignore """ Test for extraction of facts from uri with fqdn """ api = act.api.Act("", None, "error") uri = "http://www.mnemonic.no/home" facts = act.api.helpers.uri_facts(api, uri) assert len(fac...
2.390625
2
03.Pins/PinsBasicOutput.py
gesaleh/MicroPython-Examples
60
48390
<reponame>gesaleh/MicroPython-Examples<filename>03.Pins/PinsBasicOutput.py import pyb # USR button is controlled using a Switch object # This is the one closer to the center of the pyboard sw = pyb.Switch() # connect an LED (with resistor) to pin X1 (the corner) # a ground pin is two pins away. pin = pyb.Pin('X1', pyb...
3.921875
4
insta_share/__init__.py
softcoder24/insta_share
22
48391
<reponame>softcoder24/insta_share<filename>insta_share/__init__.py from .instagram import Instagram __version__ = "0.0.1"
1.023438
1
src/pyprerender/BaseEventHandler.py
thingiesmm/pyprerender
3
48392
import threading class BaseEventHandler(object): screen_lock = threading.Lock() def __init__(self, browser, tab, directory='./'): self.browser = browser self.tab = tab self.start_frame = None self.directory = directory def frame_started_loading(self, frameId): if ...
2.484375
2
baseStrategy.py
Fadope1/alpaca-SDK
2
48393
import numpy as np import requests import talib class stock_ins: BASE_URL = "https://paper-api.alpaca.markets" DATA_URL = "https://data.alpaca.markets" def __init__(self, stock_name, save_len, api_key, secret_key): self.stock_name = stock_name self.save_len = save_len self.ask_data...
2.890625
3
scripts/injection_studies/create_population.py
MoritzThomasHuebner/memestr
0
48394
import json import warnings from pathlib import Path import sys from bilby.core.utils import logger from bilby.core.result import BilbyJsonEncoder from memestr.injection import create_injection warnings.filterwarnings("ignore") if len(sys.argv) > 1: minimum_id = int(sys.argv[1]) maximum_id = int(sys.argv[2]...
2.1875
2
src/estimagic/decorators.py
janosg/estimagic
7
48395
"""This module contains various decorators. There are two kinds of decorators defined in this module which consists of either two or three nested functions. The former are decorators without and the latter with arguments. For more information on decorators, see this `guide`_ on https://realpython.com which provides a...
3.21875
3
gallery/models.py
hzdg/feincms_gallery
0
48396
<gh_stars>0 #coding=utf-8 from django import forms from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.db import models from django.http import HttpResponse from django.template.context import RequestCon...
1.921875
2
grandt_etl.py
Racana/grandtdata
0
48397
import pandas as pd df = pd.DataFrame() files = pd.read_csv('grandtlinks.csv') try: files['status'] = files['status'].astype(str) header=False except KeyError: files['status'] = '' header=True for index, row in files.iterrows(): if row['status'] == 'parsed': continue filename = row['f...
2.8125
3
hydeengine/path_util.py
rahuldave/hyde
1
48398
import os class PathUtil: @staticmethod def filter_hidden_inplace(item_list): if(not len(item_list)): return wanted = filter( lambda item: not ((item.startswith('.') and item != ".htaccess") or item.endswith('~')), item_list) ...
2.46875
2
deal/_cli/_decorate.py
orsinium/condition
40
48399
from __future__ import annotations from argparse import ArgumentParser from pathlib import Path from .._colors import get_colors from ..linter import TransformationType, Transformer from ._base import Command from ._common import get_paths class DecorateCommand(Command): """Add decorators to your code. ```...
2.484375
2