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 |
|---|---|---|---|---|---|---|
mdtoc.py | jmossberg/mdtoc | 0 | 12766451 | <filename>mdtoc.py<gh_stars>0
import argparse
import re
import sys
# Header structure
# ================
#
# ### Header title<a name="header-title"></a>
# | | | |
# Pounds | |
# Header title| |
# Anchor tag
# Name attribute
class M... | 2.734375 | 3 |
CIApi.py | jironghuang/Python-CityIndex-API | 3 | 12766452 | <filename>CIApi.py<gh_stars>1-10
"""
Author: <NAME>
License: Apache 2.0 License
Copyright 2015
"""
import json
from CITool import *
import pprint as pp
import requests
from Singleton import *
"""
Market Tag ID Lookup Table
=============================
Tag ID Description
80 FX
81 FX FX-Major
82 FX AUD-Cros... | 1.765625 | 2 |
adv/farren.py | dl-stuff/dl | 22 | 12766453 | <filename>adv/farren.py
from core.advbase import *
from conf import DEFAULT
class Farren(Adv):
def prerun(self):
self.a3_regen = Timer(self.a3_regen, 1.0, True).on()
def s2_proc(self, e):
if e.group == DEFAULT:
self.add_hp(140 * self.dragonform.utp_gauge / self.dragonform.max_utp_... | 2.171875 | 2 |
exercicios/ex 011 a 020/ex013.py | CarlosWillian/python | 0 | 12766454 | print('Vamos te dar um aumento salarial meu garoto')
n1 = float(input('Digite o valor do seu salário atual: R$ '))
print('Seu novo salário com reajuste de 15% é: R$ {:.2f}'.format(n1*1.15))
| 3.59375 | 4 |
python/application.py | mrkem598/housing-insights | 0 | 12766455 | <filename>python/application.py
# -*- coding: utf-8 -*-
"""
flask api
~~~~~~~~~
This is a simple Flask applicationlication that creates SQL query endpoints.
TODO, as of 6/15/2017 none of these endpoints are SQL Injection ready
"""
from flask import Flask, request, Response, abort, json
import psycopg2
from sqlalc... | 2.3125 | 2 |
main.py | shakilbd009/py-compute-func | 0 | 12766456 | <reponame>shakilbd009/py-compute-func<gh_stars>0
import base64,json,os,compute,bigquery,firestore,time
import googleapiclient.discovery as gcp
def compute_deployment(data:dict):
engine = gcp.build(serviceName='compute',version='v1',cache_discovery=False)
vm = compute.Compute_engine(compute=engine,
... | 2.28125 | 2 |
cogs/kill.py | feimaomiao/killbot | 4 | 12766457 | import asyncio
import datetime
import json
import logging
import os
from collections import Counter
from copy import deepcopy as dc
from io import BytesIO
from random import choice as randchoice
from random import randrange as rrange
from re import match, sub
from statistics import mean as avg
from time import time as ... | 2.375 | 2 |
tests/test_codemelli.py | HanifBirgani/codemelli | 3 | 12766458 | <gh_stars>1-10
#!/usr/bin/env python
"""Tests for `codemelli` package."""
import pytest
from re import search
from codemelli import codemelli
def test_city_codes_data_returns_dict_type():
assert isinstance(codemelli.city_codes_data(), dict)
def test_validator_valid_input_is_true():
assert codemelli.valida... | 2.609375 | 3 |
lecture-6/game_of_life/conway_v3.py | evarga/parallel-computing-lectures | 3 | 12766459 | """
Variant of the base class with parallelized, pipelined, and vectorized operations.
The technique pertaining to convolution was reused from https://stackoverflow.com/a/36968434.
Try executing this program with (the other variants will crawl):
python3 conway_v3.py --board-size 160 --interval 20 --configuration patt... | 2.78125 | 3 |
logfetcher3000/logfetcher3000.py | am401/logfetcher3000 | 2 | 12766460 | <gh_stars>1-10
import argparse
import datetime
import json
import logging
import os
import re
import requests
import sys
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('-v', '--verbose', help='Toggle verbose debug logging', action='store_true')
parser.add_argument('-f', '--file',... | 2.984375 | 3 |
tests/unit/oil/barrels/aws/test_autoscaling.py | kbougy/oil | 3 | 12766461 | import unittest
from unittest.mock import MagicMock, patch
from oil.barrels.aws import AutoScalingBarrel
class AutoScalingBarrelTestCase(unittest.TestCase):
def client_mock(self, fixture):
client = MagicMock()
paginator = MagicMock()
response_iterator = fixture
paginator.paginate.... | 2.359375 | 2 |
utils.py | MarkEEaton/fictograph | 0 | 12766462 | <filename>utils.py
""" some tools to work with the data """
from random import uniform
import asks
import trio
import multio
from bs4 import BeautifulSoup
import key
def clean(data):
""" clean the data """
# sort the data by date
sorted_data = sorted(data, key=lambda k: k["date"])
cleaned = []
... | 3.3125 | 3 |
deployman/test_manifests.py | alexvnilsson/deployman | 0 | 12766463 | import manifests
m = manifests.read("deploy.yml")
print(m.name) | 1.328125 | 1 |
src/compas_plotters/artists/circleartist.py | archimarkGit/compas | 0 | 12766464 | <gh_stars>0
from compas_plotters.artists import Artist
from matplotlib.patches import Circle as CirclePatch
# from matplotlib.transforms import ScaledTranslation
__all__ = ['CircleArtist']
class CircleArtist(Artist):
""""""
zorder = 1000
def __init__(self, circle, **kwargs):
super(CircleArtist,... | 2.703125 | 3 |
DMOJ/DMOPC/DMPG_17_S5_Bit_Matrix.py | Togohogo1/pg | 0 | 12766465 | from math import log2, ceil
def find(gen, arr):
if gen == 1:
return arr
rev = arr[::-1]
for i in range(len(arr)):
arr[i] = "0" + arr[i]
rev[i] = "1" + rev[i]
return find(gen-1, arr+rev)
R, C = map(int, input().split())
rows = find(ceil(log2(R+1)), ["0", "1"])
cols = find(... | 3.1875 | 3 |
websiteV2/utils/encrypt.py | meng950813/scholar_discovery_sys | 1 | 12766466 | """
created by chen
该模块用于密码加密
基本思路为 : 调用 hashlib 库中的 md5 加密方法,
将用户密码 与 专门的 key 进行 update 运算
返回一个 32 位 长的密码
"""
import hashlib
import sys
sys.path.append("..")
from config import SECRET_KEY
def encryption(pwd):
"""
用于加密的函数
:param pwd: 用户密码 (str)
:return: 32位长度字符串
"""
... | 3.15625 | 3 |
scripts/npc/goNinja.py | Snewmy/swordie | 9 | 12766467 | <gh_stars>1-10
# Palanquin (9110107) | Outside Ninja Castle (800040000)
mushroomShrine = 800000000
response = sm.sendAskYesNo("Would you like to go to #m" + str(mushroomShrine) + "m#?")
if response:
sm.warp(mushroomShrine) | 1.679688 | 2 |
app/dao/email_branding_dao.py | alphagov/notify-notifications-api | 51 | 12766468 | from app import db
from app.dao.dao_utils import autocommit
from app.models import EmailBranding
def dao_get_email_branding_options():
return EmailBranding.query.all()
def dao_get_email_branding_by_id(email_branding_id):
return EmailBranding.query.filter_by(id=email_branding_id).one()
def dao_get_email_br... | 2.4375 | 2 |
src/player/player.py | philipholler/RocoCup_Soccer_P6 | 5 | 12766469 | <reponame>philipholler/RocoCup_Soccer_P6<gh_stars>1-10
import math
import configurations
from geometry import calculate_full_origin_angle_radians, is_angle_in_range, smallest_angle_difference, get_xy_vector, \
Vector2D, inverse_y_axis
from configurations import BALL_DECAY, KICKABLE_MARGIN
from player.world_objects... | 2.578125 | 3 |
backend/api/views.py | ankitgehlot123/TheDevCom_ProjectChatroom | 0 | 12766470 | from django.shortcuts import render
from django.utils.safestring import mark_safe
from django.http import HttpResponse
import json
alias_set = set()
def home(request):
return render(request,'home.html',{})
def room(request, room_name, user):
return render(request, 'room.html', {
'alias': mark_safe(js... | 2.15625 | 2 |
scripts/python/s2-c2-extract-schema.py | ashutoshsingh0223/freebase-triples | 177 | 12766471 | <filename>scripts/python/s2-c2-extract-schema.py
#!/usr/bin/env python
"""
Run with:
$ python this-script.py [path_to_input_file]
"""
import argparse
import datetime
import subprocess
import time
# Globals
# Note: path to the query file has been hardcoded here
# queries.txt file has a schema of [slice_title],... | 2.984375 | 3 |
jetbrains/project_parser.py | MrMitch/ulauncher-jetbrains | 0 | 12766472 | """
Parses the Jetbrains based IDEs recent projects list
"""
import glob
import os
import re
import xml.etree.ElementTree as ET
class RecentProjectsParser():
""" Processes the "Recent projects" file from Jetbrains IDEs """
@staticmethod
def parse(file_path, query):
"""
Parses the recent p... | 2.890625 | 3 |
run.py | beenje/aiolegomac | 1 | 12766473 | from aiolegomac.app import run
run()
| 1.054688 | 1 |
torch/nn/quantized/_reference/modules/linear.py | CompPsy/pytorch | 3 | 12766474 | <reponame>CompPsy/pytorch
import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Optional, Dict, Any
from .utils import _quantize_and_dequantize_weight
from .utils import _save_weight_qparams
from .utils import _get_weight_qparam_keys
class Linear(nn.Linear):
""" A reference quantize... | 2.078125 | 2 |
tests/unit/test_gherkin_formatter.py | radish-bdd/radish2 | 0 | 12766475 | <filename>tests/unit/test_gherkin_formatter.py
"""
radish
~~~~~~
The root from red to green. BDD tooling for Python.
:copyright: (c) 2019 by <NAME> <<EMAIL>>
:license: MIT, see LICENSE for more details.
"""
import re
import textwrap
import datetime
import colorful as cf
import pytest
from radish.formatters.gherkin... | 2.25 | 2 |
src/misc/gpu_running.py | Brunopaes/python-sandbox | 5 | 12766476 | <reponame>Brunopaes/python-sandbox<filename>src/misc/gpu_running.py
#!-*- coding: utf8 -*-
from numba import jit
import datetime
import numpy
def func(a):
for i in range(len(a)):
a[i] += 1
@jit
def func2(a):
for i in range(len(a)):
a[i] += 1
if __name__ == "__main__":
n_ = numpy.ones(... | 2.96875 | 3 |
tests/test_http_asgi.py | jessewmc/azure-functions-python-library | 0 | 12766477 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import unittest
import azure.functions as func
from azure.functions._http_asgi import (
AsgiMiddleware
)
class MockAsgiApplication:
response_code = 200
response_body = b''
response_headers = [
[b"co... | 2.515625 | 3 |
src/backend/hacker_gif_poll/graphql_api/tenor/resolvers/hacker_gif.py | guligon90/hacker-gif-poll | 0 | 12766478 | <filename>src/backend/hacker_gif_poll/graphql_api/tenor/resolvers/hacker_gif.py
# Project imports
from api.tenor import get_hacker_gifs
from graphql_api.tenor.schemas.hacker_gif.result import Result
def map_graphql_args_to_api_filters(args):
"""
Maps the GraphQL query arguments to the corresponding
query... | 2.296875 | 2 |
find_a_supplier/migrations/0067_auto_20181012_1507.py | kaedroho/dit-directory-cms | 0 | 12766479 | <reponame>kaedroho/dit-directory-cms
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-10-12 15:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('find_a_supplier', '0066_auto_20180830_0632'),
]
... | 1.554688 | 2 |
asgard/workers/autoscaler/simple_decision_component.py | rockerbacon/asgard-api | 0 | 12766480 | <reponame>rockerbacon/asgard-api
from typing import List
from asgard.conf import settings
from asgard.workers.autoscaler.decision_component_interface import (
DecisionComponentInterface,
)
from asgard.workers.autoscaler.decision_events import DecisionEvents
from asgard.workers.models.decision import Decision
from ... | 2.15625 | 2 |
python/sample_amazon/eduactive-crack-amazon/print_braces.py | FriendlyUser/code-algorithm-questions | 0 | 12766481 | import copy
def print_all_braces(n):
# TODO: Write - Your - Code
output = []
result = []
print_all_braces_rec(n, 0, 0, output, result)
return result
def print_all_braces_rec(n, left_count, right_count, output, result):
if left_count >= n and right_count >= n:
result.append(copy.copy(... | 3.59375 | 4 |
tools/graph_bag/scripts/test_rmse_utilities.py | limenutt/astrobee | 629 | 12766482 | <gh_stars>100-1000
#!/usr/bin/python
#
# Copyright (c) 2017, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration.
#
# All rights reserved.
#
# The Astrobee platform is licensed under the Apache License, Version 2.0
# (the "License"); you may not use this ... | 2.03125 | 2 |
cogs/misc.py | DoggieLicc/ReminderFriend | 3 | 12766483 | <filename>cogs/misc.py<gh_stars>1-10
from datetime import timedelta
from discord.ext import commands
import discord
import time
import inspect
from io import StringIO
from classes import embed_create, CustomBot
class Misc(commands.Cog, name="Misc. Commands"):
def __init__(self, bot):
se... | 2.71875 | 3 |
week1/mapper.py | JasonSanchez/w261 | 6 | 12766484 | <filename>week1/mapper.py<gh_stars>1-10
#!/usr/bin/python
import sys
import re
for line in sys.stdin:
# Turn the list into a collection of lowercase words
for word in re.findall(r'[a-zA-Z]+', line):
if word.isupper():
print("Capital 1")
else:
print("Lower 1") | 3.796875 | 4 |
object_store_experiments/aiohttp_s3_put_get_redis.py | fadams/amqp-lambda-runtime | 0 | 12766485 | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 1.84375 | 2 |
models/locomchatlogsresponse.py | jujinesy/Empier_PythonKakaoBot | 3 | 12766486 | <filename>models/locomchatlogsresponse.py<gh_stars>1-10
# -*- coding: utf-8 -*-
from locoresponse import LocoResponse
from locochatlog import *
class LocoMChatLogsResponse(LocoResponse):
def chat_logs(self):
return map(LocoChatLog, self._data["chatLogs"])
def eof(self):
return self._... | 2.1875 | 2 |
lab4/src/enquirie_feature.py | derry95922/STV | 0 | 12766487 | <reponame>derry95922/STV<gh_stars>0
import unittest
from keywords import *
class test_suite(unittest.TestCase):
def create_enquiry_on_the_contact_page(self):
driver = webdriver.Chrome()
driver.get("http://127.0.0.1:3000/")
driver.maximize_window()
wait_element_is_visible(driver, "//... | 2.96875 | 3 |
python/nehe/lesson6.py | acs/opengl-samples | 1 | 12766488 | <gh_stars>1-10
#!/usr/bin/env python3
from OpenGL.GL import *
from OpenGL.GLUT import *
from opengl_app import OpenGLApp
class Lesson6(OpenGLApp):
red = (1.0, 0.0, 0.0)
dark_green = (0.0, 0.4, 0.0)
light_green = (0.0, 0.4, 0.0)
green = dark_green
blue = (0.0, 0.0, 1.0)
yellow = (1.0, 1.0, 0... | 3.046875 | 3 |
misc_scripts/file_to_bytes.py | jtara1/misc_scripts | 4 | 12766489 | <filename>misc_scripts/file_to_bytes.py
import click
@click.command()
@click.argument('file_name', type=click.Path())
@click.argument('output_file_name', default='file_bytes.txt', type=click.Path())
def file_to_bytes(file_name, output_file_name):
# save bytes
with open(file_name, 'rb') as infile:
with... | 3.40625 | 3 |
crds/tests/test_submit.py | rendinam/crds | 7 | 12766490 | import os
import shutil
import tempfile
from nose.tools import assert_equals, assert_not_equals, assert_is, assert_true, raises
from crds.submit import Submission, NoFilesSelected
from crds.tests import test_config
import mock
# To run:
# nosetests -v unit_tests.py
TEMPFILES = ['ipppssoot_ccd.fits', 'opppssoot_bia.... | 2.109375 | 2 |
setup.py | dchud/demodocus | 0 | 12766491 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Software License Agreement (Apache 2.0)
Copyright (c) 2020, The MITRE Corporation.
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 Licen... | 1.515625 | 2 |
Eval.py | sk-aravind/3D-Bounding-Boxes-From-Monocular-Images | 38 | 12766492 | """
This script utilises the ground truth label's 2D bounding box to
crop out the the points of interest and feed it into the model so that
it can predict a 3D bounding box for each of the 2D detections
The script will plot the results of the 3D bounding box onto the image
and display them alongside the groundtruth... | 2.796875 | 3 |
test/gdsctools/test_readers.py | Donnyvdm/gdsctools | 28 | 12766493 | from gdsctools.readers import GenomicFeatures, IC50, DrugDecode
from gdsctools.readers import Reader, drug_name_to_int
from easydev import TempFile
from gdsctools import ic50_test, gdsctools_data
import pandas as pd
from gdsctools.datasets import testing
def test_readers():
a = Reader()
try:
a = Re... | 2.5 | 2 |
setup.py | drawks/txstatsd | 0 | 12766494 | <gh_stars>0
# Copyright (C) 2011-2012 Canonical Services Ltd
#
# 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 rights to use, copy, mod... | 1.570313 | 2 |
day03/python/quajak/three.py | AlexisTM/aoc-2021 | 11 | 12766495 | f = open("./three.txt", "r")
lines = [x.strip() for x in f.readlines()]
gamma = ""
for index in range(len(lines[0])):
bits = [line[index] for line in lines]
zeros = list(bits).count('0')
ones = list(bits).count('1')
if zeros > ones:
gamma += "0"
else:
gamma += "1"
epsilon = ""
for... | 3.109375 | 3 |
simpletickets/views.py | monobot/simple-tickets | 6 | 12766496 | # -*- coding: utf-8 -*-
from datetime import timedelta
from django.contrib.auth.models import Group
from django.contrib.auth.decorators import login_required
from django.contrib.messages.views import SuccessMessageMixin
from django.core.urlresolvers import reverse_lazy
from django.db.models import Q
from djang... | 1.820313 | 2 |
applications/MultilevelMonteCarloApplication/external_libraries/PyCOMPSs/exaqute/ExaquteParameter.py | ma6yu/Kratos | 0 | 12766497 | <gh_stars>0
#!/usr/bin/python
#
# Copyright 2002-2019 Barcelona Supercomputing Center (www.bsc.es)
#
# 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/... | 1.757813 | 2 |
examples/callbacks.py | progmacattack/mpyg321 | 0 | 12766498 | <gh_stars>0
"""
MPyG321 callbacks example
Playing and pausing some music, triggering callbacks
You need to add a "sample.mp3" file in the working directory
"""
from mpyg321.mpyg321 import MPyg321Player
from time import sleep
class MyPlayer(MPyg321Player):
"""We create a class extending the basic player to impleme... | 3.53125 | 4 |
gyoseki/admin.py | yamaken1343/gyoseki-archive | 1 | 12766499 | from django.contrib import admin
from .models import Author, Recode, Tag, Division, Language
# Register your models here.
admin.site.register(Author)
admin.site.register(Recode)
admin.site.register(Tag)
admin.site.register(Division)
admin.site.register(Language) | 1.445313 | 1 |
books/migrations/0008_auto_20210621_0054.py | Aki-qiu/DATA130039.01-MyBookDB | 3 | 12766500 | # Generated by Django 3.2.3 on 2021-06-20 16:54
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('publishers', '0002_auto_20210608_2151'),
('writers', '0004_auto_20210621_0054'),
('books', '0007_alter_books... | 1.570313 | 2 |
syncfin/utils/positions.py | gitvipin/syncfin | 1 | 12766501 |
import collections
import datetime
import logging
import os
import syncfin.db.model as mydb
import syncfin.utils.common as common
import syncfin.core.config as config
from prettytable import PrettyTable
log = logging.getLogger(__name__)
class Positions(object):
def parse_and_save(self, fpath):
"""
... | 2.4375 | 2 |
src/commandline.py | tiktikimelbo7/framebot | 3 | 12766502 | import argparse
import os
import sys
from src import config
def process_arguments():
# Take arguments from commandline and parse them
parser = argparse.ArgumentParser()
parser.add_argument("--page-id", required=True, help="your facebook page-id")
parser.add_argument("--pdir", required=True, help="dire... | 3.015625 | 3 |
competitive-programming/codeforces/edu/binary-search/step1b.py | sanchopanca/coding-for-pleasure | 0 | 12766503 | <gh_stars>0
def bin_search_lower(a, x):
l, r = -1, len(a)
while l + 1 < r:
m = (l + r) // 2
if a[m] <= x:
l = m
else:
r = m
return l
n, k = map(int, input().split())
array = list(map(int, input().split()))
for x in map(int, input().split()):
print(bin_s... | 3.359375 | 3 |
msgraph/graph/implementations/graph_filter.py | SWB-Dev/microsoft-graph-api | 0 | 12766504 | <reponame>SWB-Dev/microsoft-graph-api
from __future__ import annotations
class GraphFilter:
"""Implements the IGraphFilter protocol."""
def __init__(self, filter:str, value:str):
self.filter = filter
self.value = value
self.subfilters:list[GraphFilter] = []
def add_subfilter(s... | 2.5 | 2 |
nally/core/layers/transport/tcp/tcp_control_bits.py | FreibergVlad/port-scanner | 0 | 12766505 | from nally.core.utils.bit_flags import BitFlags
from nally.core.utils.utils import Utils
class TcpControlBits(BitFlags):
"""
Represents 9 TCP control flags, can be used for storing, setting or
retrieving flags
"""
NS = 256
"""Bit mask used to check or set NS flag """
CWR = 128
"""Bit ... | 2.640625 | 3 |
progress2.py | hrhee8/DL | 0 | 12766506 | #!/usr/bin/env python
# coding: utf-8
# In[9]:
#setup for implementing gpu brought from given file
import numpy as np
import os
import torch
import torch.nn as nn
import torchvision
import torchvision.transforms as transforms
import torch.optim as optim
import h5py
import time
# In[3]:
#data augmentation
transfo... | 2.71875 | 3 |
celery_app/plugins/pluginnormal/phpmyadmin_weak_password.py | tiaotiaolong/piu | 2 | 12766507 | import requests
import re
from celery_app.utils.utils import insert_vuln_db
from celery_app.config.config import web_port_long
#通达 OA 系统 SQL 注入漏洞
plugin_id=73
default_port_list=web_port_long
def get_token(url):
result = re.findall('<input type="hidden" name="token" value="(\w+)" />', requests.get(url, timeout=1... | 2.5625 | 3 |
basic/simple.py | chaniotakismg/quantum-experiments | 0 | 12766508 | import numpy as np
from qiskit import (
QuantumCircuit,
execute,
Aer)
from qiskit.visualization import plot_histogram
# Use Aer's qasm_simulator
simulator = Aer.get_backend('qasm_simulator')
# Create a Quantum Circuit acting on the q register
circuit = QuantumCircuit(3, 3)
# Add a H gate on qubit 0
circu... | 3 | 3 |
handlers/__init__.py | dragondjf/cqssl | 0 | 12766509 | <reponame>dragondjf/cqssl<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from .task import task
from .mainhandler import MainHandler
from .websockerhandler import WebSocketManagerHandler
| 1.101563 | 1 |
source_code/1-1-urllib.py | VickyMin1994/easy-scraping-tutorial | 708 | 12766510 | from urllib.request import urlopen
# if has Chinese, apply decode()
html = urlopen("https://mofanpy.com/static/scraping/basic-structure.html").read().decode('utf-8')
print(html)
import re
res = re.findall(r"<title>(.+?)</title>", html)
print("\nPage title is: ", res[0])
# Page title is: Scraping tutorial 1 | 莫烦Pyth... | 3.234375 | 3 |
src/data/52.py | NULLCT/LOMC | 0 | 12766511 | from collections import deque
n, q = map(int, input().split())
ab = [[] for i in range(n)]
for i in range(n - 1):
a, b = map(int, input().split())
ab[a - 1].append(b - 1)
ab[b - 1].append(a - 1)
cd = [list(map(int, input().split())) for i in range(q)]
s = set()
qu = deque()
s.add(0)
qu.append(0)
hugo = [0... | 3 | 3 |
mandarin_twitter_bot/settings.py | matthew-li/mandarin_twitter_bot | 0 | 12766512 | <reponame>matthew-li/mandarin_twitter_bot<filename>mandarin_twitter_bot/settings.py
import configparser
import os
"""This module contains settings referenced by the application."""
# The format in which dates are stored.
DATE_FORMAT = "%Y-%m-%d"
# Read configuration from a file.
CONFIG_FILE = os.environ["TWITTER_BO... | 2.828125 | 3 |
app/common/whats_new/views.py | domdomegg/coronavirus-dashboard-frontend-server | 0 | 12766513 | #!/usr/bin python3
# Imports
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Python:
import re
from json import loads
from datetime import datetime
# 3rd party:
# Internal:
from app.storage import AsyncStorageClient
from app.caching import from_cache_or_func
# ~~~~~~~~~~... | 2.140625 | 2 |
9_lab_3_draw_bbox_json.py | zgle-fork/synthetic-images | 0 | 12766514 | <reponame>zgle-fork/synthetic-images
import os, math
from PIL import Image, ImageDraw
import json
def draw_bbs(img_fp, annotations):
img=Image.open(img_fp)
for a in annotations:
c=a['coordinates']
x, y, w, h =c['x'], c['y'],c['width'],c['height']
label=a['label']
... | 2.578125 | 3 |
moarri_profile_iacs/utils/enumeratings.py | moarri/moarri_profile_iacs | 0 | 12766515 | # -*- coding: utf-8 -*-
# Copyright 2018 Moarri Project
#
# 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 o... | 3.1875 | 3 |
access/views.py | pepeul1191/tutorial-flask | 0 | 12766516 | <reponame>pepeul1191/tutorial-flask
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import Blueprint, render_template, session, request, redirect
from datetime import datetime
from main.filters import if_session_active_go_home, if_session_not_active_go_login
view = Blueprint('access_bludprint', __name__)
@v... | 2.71875 | 3 |
Paso2(Andrea).py | andmansim/Ping-Pong | 0 | 12766517 | <gh_stars>0
# Paso 2: Clase de PelotaPong
#Importación de módulos
import random
#Importación de módulos
import pygame
#Importación de módulos
import random
from pygame.locals import QUIT
#Definición de constantes
# Constantes para la inicialización de la superficie de dibujo
VENTANA_HORI = 800 # Ancho de la ventan... | 2.828125 | 3 |
scanpy/tools/dbscan.py | gioelelm/scanpy | 0 | 12766518 | <filename>scanpy/tools/dbscan.py
# Author: <NAME> (http://falexwolf.de)
"""Cluster using DBSCAN
Using the scikit-learn implementation.
"""
import numpy as np
from .. import settings as sett
from .. import logging as logg
def dbscan(adata, basis='tsne', n_comps=2, eps=None, min_samples=None, n_jobs=None, copy=False):... | 2.75 | 3 |
nau_bb_reporting/reports/hardlinks.py | dikaiosune/nau-bb-learn-reporting | 0 | 12766519 | <reponame>dikaiosune/nau-bb-learn-reporting<gh_stars>0
"""
This report looks at all of the course content HTML and tries to find
links that point back to Bb Learn but are not managed by the LMS or CMS
(i.e. they are copypasta from a user who was smart but not smart enough).
In a given term, we get all of the course co... | 2.59375 | 3 |
client/states/base.py | AndrewIjano/distributed-tic-tac-toe | 0 | 12766520 | class State:
def __init__(self, client) -> None:
self.client = client
def get_input_command(self):
return input(f"JogoDaVelha> ").strip().split() or [""]
def handle_input_command(self, *input_command):
pass
def handle_opponent_command(self, *command):
pass
def han... | 2.75 | 3 |
attic/gui/mainwindow/mainwindow.py | awacha/cct | 1 | 12766521 | import logging
import traceback
import pkg_resources
from gi.repository import Gtk, GdkPixbuf
from .devicestatusbar import DeviceStatusBar
from .logtreeview import LogTreeView
from ..accounting import UserManager, ProjectManager
from ..core import ToolWindow, error_message, ToolFrame, question_message
from ..devices ... | 1.882813 | 2 |
client/src/client/motion.py | andrhahn/pi-spy | 1 | 12766522 | <reponame>andrhahn/pi-spy
import io
import logging
import os
import threading
import uuid
import picamera
from PIL import Image
from PIL import ImageChops
from PIL import ImageDraw
from PIL import ImageOps
import config_service
import s3_service
log_level = config_service.get_config("log_level")
logging.basicConfig(... | 1.921875 | 2 |
get_proxy.py | pighui/myproxy | 6 | 12766523 | #! /usr/bin/env python
# -*-coding:UTF-8-*-
# __author__ : pighui
# __time__ : 2019-11-2 上午11:51
import requests
def get_proxies(params: dict = {}):
'''
:param params: 参数字典 默认为空
:return: 返回一个包含多条代理信息的列表,列表的每一个元素是一个字典
'''
try:
response = requests.get('http://127.0.0.1:8888/ip/', params=pa... | 3.09375 | 3 |
autocnet/camera/camera.py | readthedocs-assistant/autocnet | 17 | 12766524 | import numpy as np
from autocnet.camera.utils import crossform
from cv2 import triangulatePoints
def compute_epipoles(f):
"""
Compute the epipole and epipolar prime
Parameters
----------
f : ndarray
(3,3) fundamental matrix or autocnet Fundamental Matrix object
Returns
-------
... | 2.921875 | 3 |
web/controllers/__init__.py | DXDSpirits/tatinspiration | 0 | 12766525 | <reponame>DXDSpirits/tatinspiration
# -*- coding: utf-8 -*-
import frontend
import api
import search_api
| 0.933594 | 1 |
tests/test_decorator.py | spulec/django-file-keeper | 1 | 12766526 | from mock import mock_open, patch
import sure
from keeper.core import get_bucket, use_file
@patch("keeper.core.get_bucket")
def test_basic_decorator(get_bucket):
class FakeKey(object):
def __init__(self, keyname):
self.keyname = keyname
def get_contents_as_string(self):
re... | 2.640625 | 3 |
erpnext_telegram_integration/extra_notifications/doctype/date_notification/date_notification.py | chiajunshen/shrdc_erpnext_telegram | 60 | 12766527 | <reponame>chiajunshen/shrdc_erpnext_telegram
# -*- coding: utf-8 -*-
# Copyright (c) 2020, <NAME> and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import nowdate, ad... | 1.929688 | 2 |
2 - data2graph/evaluateData/readData.py | Tocha4/HSM-Solubility | 0 | 12766528 | <filename>2 - data2graph/evaluateData/readData.py
import Anton as aen
import numpy as np
import matplotlib.pyplot as plt
import os
from scipy.stats import linregress as lin
def gcfunction(files, temp): # liefert nur die files mit einer bestimmten Temperatur
gc = []
for i in files:
fname,name = os.path.... | 2.75 | 3 |
src/ptpip/data_object/storage_info.py | DethCount/ptpip-d5300 | 0 | 12766529 | <reponame>DethCount/ptpip-d5300
from ptpip.constants.storage.access_capability import AccessCapability
from ptpip.constants.storage.type import StorageType
from ptpip.constants.storage.filesystem_type import FilesystemType
from ptpip.packet.stream_reader import StreamReader
class StorageInfo():
def __init__(self, pa... | 2.296875 | 2 |
grindone.py | racumen/python-binance | 0 | 12766530 | <filename>grindone.py
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 6 22:49:00 2021
@author: f.romano
"""
# from datetime import datetime
from binance.client import Client
import pandas as pd
import statistics
import matplotlib.pyplot as plt
import sklearn
from joblib import dump,load
from sklearn.ensemble import... | 2.234375 | 2 |
das/migrations/0005_auto_20180415_1947.py | knowwinter/monkey | 0 | 12766531 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2018-04-15 11:47
from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('das', '0004_auto_20180415_1926'),
]
operations = [
... | 1.492188 | 1 |
openstates/metadata/data/sc.py | washabstract/openstates-core | 9 | 12766532 | from ..models import State, Chamber, simple_numbered_districts
SC = State(
name="South Carolina",
abbr="SC",
capital="Columbia",
capital_tz="America/New_York",
fips="45",
unicameral=False,
legislature_name="South Carolina Legislature",
legislature_organization_id="ocd-organization/57920... | 1.84375 | 2 |
data/quantum/ts/g-bQOOHIsom/TS.py | goldmanm/butanol_paper_data | 0 | 12766533 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
spinMultiplicity = 2
energy = {
'CCSD(T)-F12/cc-pVTZ-F12': MolproLog('TSN09_f12.out'),
}
frequencies = GaussianLog('ts3-freq.log')
rotors = [HinderedRotor(scanLog=ScanLog('scan_0.log'), pivots=[4,10], top=[10,11,12,13,14], symmetry=1, fit='best'),
HinderedRo... | 1.867188 | 2 |
fancy/config/base_config.py | susautw/fancy-config | 1 | 12766534 | <filename>fancy/config/base_config.py
import inspect
from abc import ABC
from typing import TYPE_CHECKING, Dict, List, Optional
from . import ConfigStructure, ConfigContext, exc
from . import Option
if TYPE_CHECKING:
from ..config import BaseConfigLoader
class BaseConfig(ConfigStructure, ConfigContext, ABC): #... | 2.421875 | 2 |
tests/test_pipelines.py | bow/pytest-pipeline | 20 | 12766535 | # -*- coding: utf-8 -*-
"""
plugin tests
~~~~~~~~~~~~
"""
# (c) 2014-2020 <NAME> <<EMAIL>>
import glob
import os
import sys
import pytest
pytest_plugins = "pytester"
MOCK_PIPELINE = """
#!/usr/bin/env python
if __name__ == "__main__":
import os
import sys
OUT_DIR = "output_dir"
if len(... | 2.21875 | 2 |
Python/Python20/15.py | sapieninja/AdventOfCode | 0 | 12766536 | import aoc_utils
import datetime
si = aoc_utils.read()
starting_nos = list(map(int,si.split(',')))
x = 1
p = [-1 for x in range(30000000)]
previous = 0
for sno in starting_nos:
p[sno] = x
previous = sno
x+=1
first = True
while True:
if first:
nextout = 0
else:
nextout = x-p[previou... | 2.5 | 2 |
camera_calibration_ws/monodepth-FPN/MonoDepth-FPN-PyTorch/main_fpn.py | tamaslevente/trai | 0 | 12766537 | <gh_stars>0
import torch
import matplotlib.pyplot as plt
import numpy as np
import os
import sys
from constants import *
from model_fpn import I2D
import argparse
import time
# from utils.net_utils import adjust_learning_rate
from torch.autograd import Variable
# from dataset.dataloader import DepthDataset
# from datas... | 1.953125 | 2 |
ita/__init__.py | Tezar/Assigment-generator | 0 | 12766538 | import os
MODULE_PATH = os.path.dirname(__file__)
VERBOSE = True
from ita import loader_file
from ita import parser
from ita import generator
FileLoader = loader_file.FileLoader
Loader = loader_file.FileLoader
Parser = parser.Parser
Generator = generator.Generator
GeneratorException = generator.GeneratorException
_... | 1.851563 | 2 |
cisco_exec_by_ssh.py | sweetcolor/cisco-exec-by-ssh | 1 | 12766539 | import paramiko
import sys
import os
import time
import re
class CiscoExecBySSH:
def __init__(self):
self.input_file = self.get_input_file()
self.login_params = {'host': '', 'user': '', 'password': '', 'port': 22}
self.get_login_info()
self.client = self.login()
def get_login_... | 2.5 | 2 |
mastermind_django_files/front_end/admin.py | chodges7/mastermind-capstone | 0 | 12766540 | <filename>mastermind_django_files/front_end/admin.py
from django.contrib import admin
from .models import Games, Stats
admin.site.register(Games)
admin.site.register(Stats)
| 1.320313 | 1 |
tests/integration/workflows/nodejs_npm_esbuild/test_nodejs_npm_with_esbuild.py | awslabs/aws-lambda-builders | 180 | 12766541 | <filename>tests/integration/workflows/nodejs_npm_esbuild/test_nodejs_npm_with_esbuild.py<gh_stars>100-1000
import os
import shutil
import tempfile
from unittest import TestCase
from aws_lambda_builders.builder import LambdaBuilder
from aws_lambda_builders.exceptions import WorkflowFailedError
from aws_lambda_builders.w... | 2.15625 | 2 |
converter.py | josuemartinezsv/joitek-video2text-converter | 0 | 12766542 | """
Copyright 2021 <NAME>
"""
from pathlib import Path
from tempfile import TemporaryDirectory
from textwrap import TextWrapper
from time import sleep
from typing import Optional
import typer
from moviepy.video.io.VideoFileClip import VideoFileClip
from speech_recognition import Recognizer, AudioFile, UnknownValueErro... | 2.734375 | 3 |
account/models.py | AhteshamSid/College_school_management_system | 0 | 12766543 | from django.conf import settings
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
class UserProfile(models.Model):
user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
... | 2.125 | 2 |
samples/python/Wilson/image-net_backup/work.py | yptheangel/Gymmy | 0 | 12766544 | #Author : <NAME>
#Last Edited : 14 June 2017
import cv2
import os
from shutil import copyfile
import numpy as np
max_num = 1800
img_folder = "pos_test/"
perfect_img = "pos_test/99.jpg"
def convert_images():
pic_num = 1
for pic_num in range(1,max_num+1):
try:
img = cv2.imread(img_folder+str(pic_num)+".jp... | 3.046875 | 3 |
draw_benchmark.py | dragonly/pingcap_interview | 25 | 12766545 | import matplotlib.pyplot as plt
with open('benchmark_local.txt', 'rt') as fd:
lines = fd.readlines()
data = {}
for line in lines:
line = line.strip()
if not line.endswith('ns/op'):
continue
split = line.split()
benchmark_name, record_len = split[0].split('-')[:2]
benchmark_name = benc... | 2.890625 | 3 |
wb/main/jobs/export_project/export_project_job.py | apaniukov/workbench | 23 | 12766546 | """
OpenVINO DL Workbench
Class for exporting the whole project
Copyright (c) 2021 Intel Corporation
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/LICEN... | 1.71875 | 2 |
plugins/trivia/questions.py | wuhoodude/Bappybot | 7 | 12766547 | <gh_stars>1-10
class QuestionGenerator:
def makeQuestion(self):
return {'a':'42','q':'What is the meaning of life?'}
| 2.78125 | 3 |
pyaniml/core/result.py | FAIRChemistry/pyAnIML | 0 | 12766548 | from dataclasses import dataclass
from typing import List, Union, Optional
from pyaniml.utility.utils import SchemaBase, elements, attribute
from pyaniml.core.series import SeriesSet
from pyaniml.core.parameter import Category
@dataclass
class Result(SchemaBase):
"""Container for experiment results"""
result... | 2.640625 | 3 |
pets/serializers.py | fabrilopez/django_backend_irobot | 1 | 12766549 | <filename>pets/serializers.py
from rest_framework import serializers
from .models import Pet
class PetSerializer(serializers.ModelSerializer):
class Meta:
model = Pet
fields = ('id',
'name',
'age',
'exact_age') | 2.078125 | 2 |
kinoml/features/__init__.py | t-kimber/kinoml | 36 | 12766550 | <filename>kinoml/features/__init__.py<gh_stars>10-100
"""
Featurizers will always output arrays
but they will use structure-oriented methods
underneath to do it.
"""
| 1.234375 | 1 |