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 |
|---|---|---|---|---|---|---|
list7/decoder.py | luk9400/kodowanie | 0 | 32300 | from sys import argv
G = [
"00000000",
"11010010",
"01010101",
"10000111",
"10011001",
"01001011",
"11001100",
"00011110",
"11100001",
"00110011",
"10110100",
"01100110",
"01111000",
"10101010",
"00101101",
"11111111",
]
errors = 0
def from_hamming(bit... | 3.234375 | 3 |
kfdata/tests/test_attribute.py | kylef-archive/KFData.py | 1 | 32301 | <reponame>kylef-archive/KFData.py<gh_stars>1-10
import unittest
from kfdata.attributes import Attribute, NumberAttribute, BooleanAttribute
class AttributeTests(unittest.TestCase):
def setUp(self):
self.attribute = Attribute(name='firstName', is_indexed=True, is_optional=False)
def test_creation(self... | 2.90625 | 3 |
fucker.py | MacsedSub/ZBH-Fucker | 4 | 32302 | <gh_stars>1-10
import threading # 多线程模块
import queue # 队列模块
import requests
import time
import random
import json
import os
import re
import traceback
from urllib.parse import quote
from config import fakeVisitorCount
from config import startUserID
from config import spreadToken
from config import UAs
from config impor... | 2.640625 | 3 |
hs_composite_resource/tests/test_composite_resource_user_zone.py | tommac7/hydroshare | 0 | 32303 | import os
from django.test import TransactionTestCase
from django.contrib.auth.models import Group
from django.conf import settings
from hs_core import hydroshare
from hs_core.models import BaseResource
from hs_core.hydroshare.utils import resource_file_add_process, resource_file_add_pre_process
from hs_core.views.ut... | 1.828125 | 2 |
tests/test_compat.py | eisensheng/pytest-catchlog | 85 | 32304 | <filename>tests/test_compat.py
# -*- coding: utf-8 -*-
import pytest
def test_camel_case_aliases(testdir):
testdir.makepyfile('''
import logging
logger = logging.getLogger(__name__)
def test_foo(caplog):
caplog.setLevel(logging.INFO)
logger.debug('boo!')
... | 2.078125 | 2 |
ectrello/commands/board.py | hadi-alnehlawi/ECTRELLI-PYPI | 0 | 32305 | <gh_stars>0
import click
from trello.client import Client
key = "<KEY>"
token = "<KEY>"
client = Client(key, token)
show_help = """ \n
TEXT=all show all boards.\n
TEXT=first show first board.\n
TEXT=last show last board.\n
"""
@click.command()
@click.option("--show", required=False, help=show_help)
def cli(show):
... | 2.75 | 3 |
main.py | prozum/mastermixer | 0 | 32306 | <reponame>prozum/mastermixer<gh_stars>0
from sqlite3 import dbapi2 as sqlite3
from libliquor import Actuator,Ranger,Mixer
config = dict(
DEBUG=True,
DATABASE='/tmp/flaskr.db',
)
# Setup objects
if not config["DEBUG"]:
motor = Actuator(10)
piston = Actuator(11)
valves = [Actuator(12), Actuator(... | 2.53125 | 3 |
conftest.py | Shy/migration-env-demo | 1 | 32307 | # conftest.py
import pytest
import os
from myapp import create_app, create_contentful
from dotenv import load_dotenv
load_dotenv()
SPACE_ID = os.getenv("SPACE_ID")
DELIVERY_API_KEY = os.getenv("DELIVERY_API_KEY")
TESTING_ENV = "circle_testing"
@pytest.fixture
def app():
app = create_app(SPACE_ID, DELIVERY_API_K... | 2 | 2 |
db.py | L1mPeX/Casino-Bot | 2 | 32308 | #!/usr/bin/python3.6
import sqlite3
def make_connect():
conn = sqlite3.connect("bot.db")
cursor = conn.cursor()
return conn, cursor
def create_tables():
conn, cursor = make_connect()
try:
cursor.execute("CREATE TABLE users(user_id INTEGER, bal FLOAT, count_games INTEGER, sum_games FLOAT, ref... | 3.125 | 3 |
tests/unit-tests/test_rst_lists.py | hazemelraffiee/confluencebuilder | 90 | 32309 | # -*- coding: utf-8 -*-
"""
:copyright: Copyright 2020-2022 Sphinx Confluence Builder Contributors (AUTHORS)
:license: BSD-2-Clause (LICENSE)
"""
from tests.lib.testcase import ConfluenceTestCase
from tests.lib.testcase import setup_builder
from tests.lib import parse
import os
class TestConfluenceRstLists(Confluenc... | 2.21875 | 2 |
src/cira_am/config.py | quistian/dns-firewall | 1 | 32310 | #!/usr/bin/env python
'''
Global Variables convention:
* start with UpperCase
* have no _ character
* may have mid UpperCase words
'''
Debug = True
Silent = True
Verbose = False
CustomerName = 'customer_name'
AuthHeader = {'Content-Type': 'application/json'}
BaseURL = "https://firewall-api.d-zone.ca"
... | 1.328125 | 1 |
安装三方库.py | gaoguole/ctpgao | 73 | 32311 | import os
os.system("pip install tqsdk -i https://pypi.tuna.tsinghua.edu.cn/simple")
os.system("pip install numba -i https://pypi.tuna.tsinghua.edu.cn/simple")
os.system("pip install janus -i https://pypi.tuna.tsinghua.edu.cn/simple")
os.system("pip install redis -i https://pypi.tuna.tsinghua.edu.cn/simple")
os... | 1.992188 | 2 |
smartystreets_python_sdk/client_builder.py | jasonrfarkas/smartystreets-python-sdk | 0 | 32312 | <gh_stars>0
import smartystreets_python_sdk as smarty
from smartystreets_python_sdk.us_street import Client as USStreetClient
from smartystreets_python_sdk.us_zipcode import Client as USZIPClient
from smartystreets_python_sdk.us_extract import Client as USExtractClient
from smartystreets_python_sdk.us_autocomplete impo... | 2.140625 | 2 |
src/util.py | uguryagmur/RealTimeObjectDetection | 0 | 32313 | <reponame>uguryagmur/RealTimeObjectDetection<gh_stars>0
"""Utility functions for Object Detection Networks"""
from __future__ import division
import cv2
import torch
import numpy as np
from PIL import Image, ImageDraw
def xyxy2xywh(box: torch.Tensor) -> torch.Tensor:
"""
Returns the xywh format of the in... | 2.5 | 2 |
model/warp.py | askerlee/rift | 11 | 32314 | <gh_stars>10-100
import torch
import torch.nn as nn
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
# Precomputed coordinate grids dictionary, with (tensor device, tensor size) as the keys.
backwarp_tenGrid = {}
# backwarp and multiwarp are doing backward warping using the forward flow.
# backwa... | 2.296875 | 2 |
api/models.py | UAACC/pro | 0 | 32315 | <filename>api/models.py
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import AbstractUser
class Author(models.Model):
username = models.CharField(max_length=50, unique=True)
display_name = models.CharField(max_length=50, null=True, blank=True)
email = models... | 2.484375 | 2 |
miniworld/model/network/interface/Interfaces.py | miniworld-project/miniworld_core | 5 | 32316 | <reponame>miniworld-project/miniworld_core
from collections import defaultdict
from miniworld.errors import InterfaceUnknown
from miniworld.model.Objects import Objects
from miniworld.model.network.interface.Interface import INTERFACE_NORMAL_CLASSES_TYPES, INTERFACE_NAME_TYPE_MAPPING, AP, Mesh
__author__ = '<NAME>'
... | 2.796875 | 3 |
tests/test_distgit/test_convert_source_url_to_https.py | sosiouxme/doozer | 0 | 32317 | from __future__ import absolute_import, print_function, unicode_literals
import unittest
from doozerlib import distgit
class TestDistgitConvertSourceURLToHTTPS(unittest.TestCase):
def test_conversion_from_ssh_source(self):
source = "git@github.com:myorg/myproject.git"
actual = distgit.convert_so... | 2.75 | 3 |
KnowledgeMapping/SpiderExp/4-Function/openSSLExp/3.py | nickliqian/ralph_doc_to_chinese | 8 | 32318 | import requests
import ssl
from requests.adapters import HTTPAdapter, PoolManager
class MyAdapter(HTTPAdapter):
def init_poolmanager(self, connections, maxsize):
super(MyAdapter, self).__init__()
self.poolmanager = PoolManager(num_pools=connections, maxsize=maxsize, ssl_version=ssl.PROTOCOL_SSLv3)... | 2.890625 | 3 |
weighmail/observers/__init__.py | gremmie/weighmail | 0 | 32319 | <filename>weighmail/observers/__init__.py
"""Base observer class for weighmail operations.
"""
class BaseObserver(object):
"""Base observer class; does nothing."""
def searching(self, label):
"""Called when the search process has started for a label"""
pass
def labeling(self, label, coun... | 2.75 | 3 |
banks/apps.py | lauriefacer/Facer | 0 | 32320 | <reponame>lauriefacer/Facer<filename>banks/apps.py<gh_stars>0
from django.apps import AppConfig
class BanksConfig(AppConfig):
name = 'banks'
class DatatableView(AppConfig):
name = 'datatableview'
| 1.28125 | 1 |
assessment/migrations/0010_assessment_open_status.py | sravanireddy1102/peerevaluationsystem | 2 | 32321 | # Generated by Django 3.0.2 on 2020-04-29 20:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('assessment', '0009_auto_20200426_1103'),
]
operations = [
migrations.AddField(
model_name='assessment',
name='open_s... | 1.445313 | 1 |
opyoid/bindings/instance_binding/instance_binding_to_provider_adapter.py | illuin-tech/opyoid | 37 | 32322 | from opyoid.bindings.binding import Binding
from opyoid.bindings.binding_to_provider_adapter import BindingToProviderAdapter
from opyoid.bindings.registered_binding import RegisteredBinding
from opyoid.injection_context import InjectionContext
from opyoid.provider import Provider
from opyoid.utils import InjectedT
from... | 1.96875 | 2 |
backend/src/asset_manager/data/repos/license.py | JonathanLoscalzo/asset-license-dev-demo | 0 | 32323 | from pymongo.database import Database
from asset_manager.data.repos.base import MongoRepository
from asset_manager.data.schemas.license import LicenseMongo
class LicenseRepository(MongoRepository[LicenseMongo]):
def __init__(self, db: Database):
super().__init__(db, "licenses", LicenseMongo)
| 2.078125 | 2 |
build_utils/salt_utils.py | maharg101/gdl-100-provision | 0 | 32324 | <reponame>maharg101/gdl-100-provision
# -*- coding: utf-8 -*-
"""
salt_utils.py
Description: Utility methods for configuration of Salt Cloud.
Written by: maharg101 on 27th March 2018
"""
import io
import yaml
def generate_openstack_conf(params):
"""
Generate an openstack.conf file-like given the supplied p... | 1.953125 | 2 |
Scripts/Topology_Generator/top_gen.py | LABORA-INF-UFG/eXP-RAN | 6 | 32325 | # -*- coding: utf-8 -*-
import json
import math
import random
import argparse
import networkx as nx
class Node:
def __init__ (self, nodeNumber, nodeType):
self.nodeNumber = nodeNumber
self.nodeType = nodeType
def add_vm (self, vm):
if not hasattr(self,'vms'):
self.vms = []
self.vms.append(vm)
class VM:... | 2.453125 | 2 |
gather/weighted_corr.py | mrJeppard/clusterdb-ingest | 0 | 32326 | <filename>gather/weighted_corr.py
"""
Weighted correlation of NES vectors. The idea is to weight positive values on either vector. Positive values
"""
import pandas as pd
import numpy as np
from scipy.spatial.distance import pdist
from scipy.spatial.distance import squareform
def m(x, w):
"""Weighted Mean"""
... | 2.90625 | 3 |
time_wizard/mixins.py | wfehr/django-time-wizard | 5 | 32327 | <filename>time_wizard/mixins.py<gh_stars>1-10
from django.contrib.contenttypes.fields import GenericRelation
from django.db import models
from django.utils.timezone import now
class TimeWizardInlineMixin(models.Model):
"""
Mixin for the inline support of PeriodModel.
"""
periods = GenericRelation(
... | 2.3125 | 2 |
highearthorbit.py | orithena/highearthorbit | 3 | 32328 | #!/usr/bin/python
import twython, time, pprint, traceback, os, sys
import config
from twython import TwythonStreamer, TwythonError, TwythonRateLimitError
import urllib, json, glob, re
import thread
queuelock = thread.allocate_lock()
watchlock = thread.allocate_lock()
import logging
logging.basicConfig(filename='highea... | 2.375 | 2 |
migrations/versions/8b9f5b081137_.py | Rdbaker/betly | 0 | 32329 | <reponame>Rdbaker/betly<gh_stars>0
"""Creates the bet table and associates it with users.
Revision ID: 8b9f5b081137
Revises: <KEY>
Create Date: 2016-08-27 17:29:41.137566
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<KEY>'
from alembic import op
import sqlalchemy as sa
from sqlal... | 2.15625 | 2 |
script.py | Relex12/mywebsite_jekyll | 0 | 32330 | <filename>script.py
from os import path
from os import system
if (not path.exists("../Relex12.github.io/")):
raise FileNotFoundError("Relex12.github.io directory not found")
if (not path.exists("../Markdown-Table-of-Contents/")):
raise FileNotFoundError("Markdown-Table-of-Contents directory not found")
... | 2.671875 | 3 |
scripts/clang_git_format/clang_git_format/repo.py | zarmomin/mrpt | 9 | 32331 | <filename>scripts/clang_git_format/clang_git_format/repo.py<gh_stars>1-10
from utils import callo
import os
import subprocess
import re
import logging
logger = logging.getLogger("clang-format")
class Repo(object):
"""Class encapsulates all knowledge about a git repository, and its metadata
to run clang-forma... | 2.828125 | 3 |
bot.py | jeonghunn/EverytimeBot | 2 | 32332 | """Simple Bot to reply to Telegram messages.
This is built on the API wrapper, see echobot2.py to see the same example built
on the telegram.ext bot framework.
This program is dedicated to the public domain under the CC0 license.
"""
import logging
import telegram
import requests, json
import traceback
from time import... | 2.890625 | 3 |
apertools/log.py | scottstanie/apertools | 8 | 32333 | """
This module exports a Log class that wraps the logging python package
Uses the standard python logging utilities, just provides
nice formatting out of the box.
Usage:
from apertools.log import get_log
logger = get_log()
logger.info("Something happened")
logger.warning("Something concerning happe... | 3.59375 | 4 |
monitoring/notifications/tests.py | okozachenko1203/monasca-ui | 17 | 32334 | # 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 u... | 1.953125 | 2 |
basic/sort/03_insert.py | weihuchao/algorithm | 0 | 32335 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021/12/4 22:00
# @Author : weihuchao
def insert_sort(data):
"""
从前往后遍历, 假定前面部分已经有序, 查看当前元素应该在前面部分的哪个位置
"""
for idx in range(1, len(data)):
tmp = data[idx]
j = idx - 1
while j >= 0 and tmp < data[j]:
data[j ... | 3.765625 | 4 |
GraphDefs/create_GraphDefs.py | AnotherGroupChat/Machine-Learning | 0 | 32336 | <filename>GraphDefs/create_GraphDefs.py
#!/usr/bin/python3
import tensorflow as tf
import numpy as np
BASE = 'GraphDefs'
def writeg(name):
session = tf.Session()
session.run(tf.initialize_all_variables())
tf.train.write_graph(session.graph_def, BASE, name + '.txt', True)
tf.train.write_graph(session.... | 2.625 | 3 |
snipmyvideo.py | rascoro1/SnipMyVideo | 3 | 32337 | from moviepy.editor import *
from moviepy import Clip
import sys
import os
"""
This is a simple script that can only snip your code and return it back in one video
This script requires moviepy.py
Is can be obtained through pip:
pip install moviepy
Output file can be '.mp4', 'ogv', 'webm'
You can mod... | 3.203125 | 3 |
nutils/matrix.py | JochenHinz/nutils | 0 | 32338 | # Copyright (c) 2014 Evalf
#
# 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, modify, merge, publish, distribute, s... | 2.140625 | 2 |
pz/installer.py | pyramidzero/pzinstaller | 0 | 32339 | <reponame>pyramidzero/pzinstaller
from subprocess import run
# configuration defaults tools
update = ['brew', 'update']
install = ['brew', 'install', 'git']
class Installer:
def func_update(self):
run(update)
def func_install(self):
run(install)
| 1.890625 | 2 |
modules/widgets.py | ldvlpr-dev/AudioVisualizer-Release | 2 | 32340 | import cv2
import numpy as np
def hex_to_bgr(hx):
hx = hx.lstrip('#')
return tuple(int(hx[i:i + 2], 16) for i in (0, 2, 4))[::-1]
class Rectangle:
def __init__(self, x, y, width, height, max_height, min_db, max_db, color, thickness, reverse):
self.rev = -1 if reverse else 1
self.x = x
... | 2.875 | 3 |
auto_LiRPA/examples/vision/simple_verification.py | KaidiXu/LiRPA_Verify | 14 | 32341 | <gh_stars>10-100
import torch.nn as nn
import torch.nn.functional as F
import torchvision
from auto_LiRPA import BoundedModule, BoundedTensor
from auto_LiRPA.perturbations import *
import models
## Step 1: Define computational graph by implementing forward()
class Flatten(nn.Module):
def forward(self, x):
... | 2.90625 | 3 |
fiction/plaza.py | cloudRoutine/curveship | 1 | 32342 | """Plaza
Items (in particular, Things and Rooms) representing the setting of Lost One."""
__author__ = '<NAME>'
__copyright__ = 'Copyright 2011 <NAME>'
__license__ = 'ISC'
__version__ = '0.5.0.0'
__status__ = 'Development'
from item_model import Room, Thing
items = [
Room('@plaza_center',
article='the'... | 2.59375 | 3 |
tests/r/test_us_pop.py | hajime9652/observations | 199 | 32343 | <gh_stars>100-1000
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.us_pop import us_pop
def test_us_pop():
"""Test module us_pop.py by downloading
us_pop.csv and testing shape of
extract... | 2.28125 | 2 |
2021/python/dec04/solution.py | razzlestorm/advent-of-code | 0 | 32344 | from pathlib import Path
from typing import List
FILE_DIR = Path(__file__).parent
def create_boards(boards: List[str]) -> List[str]:
defined_boards = []
for board in boards:
b = board.split('\n')
d_board = [db.split() for db in b]
defined_boards.append(d_board)
return defined_boar... | 3.46875 | 3 |
app.py | serbathome/words | 0 | 32345 | from flask import Flask, render_template, jsonify
import random as r
import csv
app = Flask(__name__)
# define global words dictionary
words = {}
words["easy"] = []
words["medium"] = []
words["hard"] = []
# load words (russian and english)
with open('words.csv', newline='\n', encoding="UTF8") as csvfile:
wordrea... | 2.921875 | 3 |
setup.py | cexiolabs/cexpay.support-telegram-bot | 0 | 32346 | from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name='cexpay',
version='2.0.4',
description="A support bot for CEX Pay's products. See more https://developers.cexpay.io/.",
long_description=long_description,
long_description_co... | 1.359375 | 1 |
newsthreads/sentences.py | microsoft/News-Threads | 5 | 32347 | <gh_stars>1-10
# File #1: Fragment, FragmentId
# File #2: fragmentid, docid, date, domain, fragmentposition
import configparser
from typing import Dict, List, Tuple
import csv
import nltk.data
import string
def process_sentences(config: configparser.SectionProxy):
csv.field_size_limit(2**23)
fin = open(confi... | 2.625 | 3 |
reconcile/test/test_utils_ocm_versions.py | bhushanthakur93/qontract-reconcile | 0 | 32348 | <gh_stars>0
import pytest
from reconcile.utils.ocm import OCM
@pytest.fixture
def ocm(mocker):
mocker.patch("reconcile.utils.ocm.OCM._init_access_token")
mocker.patch("reconcile.utils.ocm.OCM._init_request_headers")
mocker.patch("reconcile.utils.ocm.OCM._init_clusters")
mocker.patch("reconcile.utils.o... | 2.125 | 2 |
test_agent/jianyang_ai.py | bbpp222006/maj_ai | 0 | 32349 | <reponame>bbpp222006/maj_ai
# -*- coding: utf-8 -*-
import datetime
import os
import pickle
import random
from copy import deepcopy
from time import sleep
import numpy as np
from test_agent.ai_interface import AIInterface
from test_agent.utils.wait_calc import WaitCalc
from test_agent.utils.win_calc import WinCalc
fr... | 2.125 | 2 |
jupyterlab_templates/extension.py | ElectroDevTeam/jupyterlab_templates | 0 | 32350 | <reponame>ElectroDevTeam/jupyterlab_templates<filename>jupyterlab_templates/extension.py<gh_stars>0
import fnmatch
import json
import os
import os.path
import jupyter_core.paths
from io import open
from datetime import datetime
from notebook.utils import url_path_join
from notebook.base.handlers import IPythonHandler
... | 2.421875 | 2 |
src/automotive/application/actions/serial_actions.py | philosophy912/automotive | 0 | 32351 | # -*- coding:utf-8 -*-
# --------------------------------------------------------
# Copyright (C), 2016-2020, lizhe, All rights reserved
# --------------------------------------------------------
# @Name: serial_actions.py
# @Author: lizhe
# @Created: 2021/5/2 - 0:02
# ----------------------------------... | 2.578125 | 3 |
colours.py | F0lha/UJunior-Projects | 0 | 32352 | <reponame>F0lha/UJunior-Projects
# Permite usar o modulo do Sense HAT
from sense_hat import SenseHat
from mcpi.minecraft import Minecraft
from time import sleep
sense = SenseHat()
mc = Minecraft.create()
# blocos
grass = 2
water = 9
sand = 12
air = 0
# cores
white = (255, 255, 255)
green = (0, 255, 0)
blue = (0, 0,... | 2.734375 | 3 |
year_2/os_sem2/checkLab14/app.py | honchardev/KPI | 0 | 32353 | <filename>year_2/os_sem2/checkLab14/app.py
import sys
import os
import re
def main():
# Check input for the program.
checker = ArgsChecker()
if not checker.checkInputArgsAreCorrect():
return 1
if checker.processMode == checker.PROCESS_FROM_DIR:
dirProcesser = FromDirProcesser()
... | 2.921875 | 3 |
HSTB/drivers/hips_log.py | noaa-ocs-hydrography/drivers | 2 | 32354 | import xml.etree.ElementTree as ElementTree
import os
class CARISObject:
"""A generic CARIS object with a name"""
def __init__(self):
"""Initialize with empty name"""
self.name = ''
def __init__(self, name):
"""Initialize with a name provided"""
self.name = name
def ... | 2.890625 | 3 |
Contest/ABC017/b/main.py | mpses/AtCoder | 0 | 32355 | #!/usr/bin/env python3
import re
print(re.sub("ch|o|k|u", "", input()) and "NO" or "YES") | 3.671875 | 4 |
plugins/salesforce_utils.py | brennoflavio/airflow-salesforce-operators | 0 | 32356 | <reponame>brennoflavio/airflow-salesforce-operators
from simple_salesforce import Salesforce
from airflow.hooks.base_hook import BaseHook
import json
from airflow.utils.log.logging_mixin import LoggingMixin
from airflow.models import BaseOperator
from airflow.plugins_manager import AirflowPlugin
from airflow.utils.deco... | 2.1875 | 2 |
src/django_website/blog/views.py | jdheinz/project-ordo_ab_chao | 2 | 32357 | from django.contrib.auth.decorators import login_required
from django.shortcuts import render, get_object_or_404
from .models import BlogPost
from .forms import BlogPostModelForm
# render intial html page of list of published blogs
def blog_post_list_view(request):
qs = BlogPost.objects.all().published() # queryse... | 2.375 | 2 |
uiConfig.py | g-ulrich/ScreenShotToDiscord | 0 | 32358 | from PyQt5.QtCore import QTimer, QTime
from PyQt5 import QtGui, QtWidgets
import time
import random
import os
import datetime
import requests
import sqlite3 as sql
import database_impl as db
from date_tools import dt
def datetime_diff(old_datetime, new_datetime, dates_are_strings=True):
"""
String dates shoul... | 2.6875 | 3 |
src/glum/_distribution.py | Quantco/glum | 68 | 32359 | from abc import ABCMeta, abstractmethod
from functools import partial
from typing import Tuple, Union
import numexpr
import numpy as np
from scipy import sparse, special
from tabmat import MatrixBase, StandardizedMatrix
from ._functions import (
binomial_logit_eta_mu_deviance,
binomial_logit_rowwise_gradient_... | 2.453125 | 2 |
apps/medicalcontrol/models.py | claudioDcv/Vetadmin | 1 | 32360 | <gh_stars>1-10
from django.db import models
from apps.core.models import Patient, Person
from django_extensions.db.fields import AutoSlugField
from apps.core.utils import STYLE_IMG_MIN
from apps.pharmacy.models import SupplyAssignControl
class Medicalcontrol(models.Model):
name = models.CharField(max_length=100)
... | 2 | 2 |
icetray/resources/test/shoulddo.py | hschwane/offline_production | 1 | 32361 | #!/usr/bin/env python
#
# Sample i3module in python
#
from icecube.icetray import *
from I3Tray import *
tray = I3Tray()
# generate empty frames
tray.AddModule("BottomlessSource","bottomless")
def make_counter(base):
class ShouldCounter(base):
def __init__(self, context):
base.__init__(self... | 2.703125 | 3 |
Scripts/Biochemistry/Merge_Compounds.py | nkkchem/ModelSEEDDatabase | 0 | 32362 | <reponame>nkkchem/ModelSEEDDatabase
#!/usr/bin/env python
import os, sys
temp=list();
header=1;
sys.path.append('../../Libs/Python')
from BiochemPy import Reactions, Compounds
ReactionsHelper = Reactions()
Reactions_Dict = ReactionsHelper.loadReactions()
CompoundsHelper = Compounds()
Compounds_Dict = CompoundsHelper... | 2.46875 | 2 |
Homework.py | Quericee/da | 0 | 32363 | import math
import pandas as pd
data = pd.read_csv("works.csv").dropna()
count_people = 0
for (jobTitle, qualification) in zip(data['jobTitle'], data['qualification']):
if jobTitle != qualification:
count_people += 1
print(f"У {count_people} человек профессия и должность не совпадают")
meneger... | 3.625 | 4 |
examtool/examtool/cli/compile_all.py | ThaumicMekanism/cs61a-apps | 0 | 32364 | <reponame>ThaumicMekanism/cs61a-apps<gh_stars>0
import json
import os
import pathlib
from datetime import datetime
from io import BytesIO
from pikepdf import Pdf, Encryption
import click
import pytz
from examtool.api.database import get_exam, get_roster
from examtool.api.utils import sanitize_email
from examtool.api.... | 2.484375 | 2 |
main/tests/test_views.py | Lumexralph/book-store | 0 | 32365 | from decimal import Decimal
from unittest.mock import patch
from django.test import TestCase
from django.urls import reverse
from django.contrib import auth
from main.models import Product, User, Address
from main.forms import UserCreationForm
class TestPage(TestCase):
def test_home_page_works(self):
re... | 2.515625 | 3 |
021_loguru/multifile01.py | fkubota/rkkubotay-gmail.com | 0 | 32366 | <reponame>fkubota/rkkubotay-gmail.com
from loguru import logger
from multifile02 import sum_ab
def run():
logger.add("log_multifile.log")
logger.info("="*30)
logger.info("start run")
sum_ab(5, 7)
logger.info("end run")
def main():
run()
logger.success('Complete.')
if __name__ == "__mai... | 1.921875 | 2 |
pythonperlin/__init__.py | timpyrkov/pyperlin | 0 | 32367 | <filename>pythonperlin/__init__.py
# -*- coding: utf-8 -*-
from pythonperlin.perlin import perlin
from pkg_resources import get_distribution
__version__ = get_distribution('pythonperlin').version | 1.359375 | 1 |
reservas/settings/base.py | fedegallar/reservas | 1 | 32368 | # coding=utf-8
"""
Django settings for reservas project.
Generated by 'django-admin startproject' using Django 1.8.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
... | 1.78125 | 2 |
python/learning2.py | dblalock/sprintz | 45 | 32369 | #!/usr/bin/env python
import collections
# import itertools
import numpy as np
# from sklearn import linear_model as linear # for VAR
# from .utils import sliding_window as window
# from .utils.distance import kmeans, dists_sq
# from .utils import distance as dist
# from python import compress
# ===============... | 2.171875 | 2 |
run.py | radish2012/flask-restful-example | 650 | 32370 | from app.factory import create_app, celery_app
app = create_app(config_name="DEVELOPMENT")
app.app_context().push()
if __name__ == "__main__":
app.run()
| 1.515625 | 2 |
__init__.py | KAndreyK/gachicmd | 0 | 32371 | <gh_stars>0
#!/usr/bin/env python
#-*- encoding: utf-8 -*-
"""Command line interpreter right version."""
import sys
import cmd
import random
import os
import pyglet.media
import webbrowser
import time
gachidict = []
with open('gachicmd' + os.sep + 'gachidict.txt') as f:
gachidict = f.read().splitl... | 2.796875 | 3 |
scripts/check_schemas.py | chasleslr/dagster | 0 | 32372 | <filename>scripts/check_schemas.py
# pylint: disable=print-call
import importlib
import pkgutil
import dagster
import sqlalchemy as sa
def check_schema_compat(schema):
"""We run this check to ensure that we don't have any schema columns that are incompatible with
MySQL.
"""
for name in dir(schema):
... | 2.609375 | 3 |
src/main/resources/alm/CreateDefect.py | xebialabs-community/xlr-hpalm-plugin | 0 | 32373 | <filename>src/main/resources/alm/CreateDefect.py
#
# Copyright 2021 XEBIALABS
#
# 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... | 1.867188 | 2 |
extra_apps/xadmin/plugins/utils.py | Fors3cDream/DjX | 3 | 32374 | from django.template.context import RequestContext
def get_context_dict(context):
"""
Contexts in django version 1.9+ must be dictionaries. As xadmin has a legacy with older versions of django,
the function helps the transition by converting the [RequestContext] object to the dictionary when necessary.
... | 1.914063 | 2 |
tests/wallet_api/test_mining.py | beatsbears/pyburstlib | 7 | 32375 | '''
pyburstlib
:author: drownedcoast
:date: 4-26-2018
'''
import pytest
from pyburstlib.wallet_api.models.mining import *
from tests.base import BaseTest
from tests.config import PyBurstLibConfig
@pytest.mark.api
class TestMiningApi(BaseTest):
def setup(self):
self.TEST_ACCOUNT_NUMERIC = PyBurstLibConfig.... | 2.265625 | 2 |
nltktest.py | HeikkiKeskustalo/Fuzzy-String-Matching | 0 | 32376 | from nltk.stem.snowball import SnowballStemmer
letter = [u'kissassa']
for word in letter:
print word, SnowballStemmer("finnish").stem(word)
# read file (get a string)
# detect charset (UTF-8)
# decode (get a Unicode code point presentation)
# tokenize
# try out the Snowball stemmer
| 3.328125 | 3 |
Linked-in Job scrapper.py | MMallah/Linked-in-Job-scrapper | 0 | 32377 | <reponame>MMallah/Linked-in-Job-scrapper
#!/usr/bin/env python
# coding: utf-8
# # Project Data Science Desired Skills
#
# this project will Answer the question of what are the most desired skills for Data Science in Egypt and UAE.
# * Extract data from Linked in Via webscrapping or Manually.
# * Perform data wrangli... | 3.3125 | 3 |
25_Assigment_Operator/main.py | jmmedel/Python-Tutorials- | 0 | 32378 |
x = 5
x |= 3
print(x)
| 2.5625 | 3 |
email_extractor.py | lukeeckley/outlook-email-recovery | 0 | 32379 | <gh_stars>0
import argparse
import os
import re
import sys
try:
import pypff
except ImportError:
print("[+] Install the libpff Python bindings to use this script")
sys.exit(1)
message_list = []
messages = 0
def main(pst_file, output_dir):
print("[+] Accessing {} PST file".format(pst_file))
pst = ... | 2.703125 | 3 |
Judge/judge_core.py | peeesspee/BitOJ | 30 | 32380 | # This process handles all the requests in the queue task_queue and updates database
import json, pika, sys, time
from database_management import manage_database, submission_management
class core():
data_changed_flags = ''
task_queue = ''
channel = ''
file_password = ''
unicast_exchange = 'connection_manager'
... | 2.65625 | 3 |
{{cookiecutter.project_name}}/src/{{cookiecutter.package_name}}/__init__.py | cav71/cav71-python-package-cookiecutter | 0 | 32381 | __version__ = "0.0.0"
__hash__ = "<invalid-hash>"
| 1.210938 | 1 |
generator/restaurant.py | mouse-reeve/unfamiliar-tourism | 3 | 32382 | ''' buildings and built environment '''
from datetime import datetime
import random
import tracery
from utilities import format_text, get_latin
def eatery(name, dish, category, data):
''' a charming stone hut where they serve tea '''
earliest = data['founded'] if data['founded'] > 1700 else 1700
founding =... | 3.1875 | 3 |
Urutu/cu/blocks.py | adityaatluri/Urutu | 0 | 32383 | <reponame>adityaatluri/Urutu<filename>Urutu/cu/blocks.py
## CUDA blocks are initialized here!
## Created by: <NAME>
## Date: Mar 03 2014
def bx(blocks_dec, kernel):
if blocks_dec == False:
string = "int bx = blockIdx.x;\n"
kernel = kernel + string
blocks_dec = True
return kernel, blocks_dec
def by(blocks_dec,... | 2.359375 | 2 |
tests/test_attr.py | tatsuya4649/dcolour | 0 | 32384 | <reponame>tatsuya4649/dcolour
import pytest
from dcolor.attr import *
def attr_init():
attr = Attr(
kind="bold"
)
yield attr
def test_init():
Attr(
kind="bold"
)
def test_init2():
Attr(
kind=AttrList.bold
)
@pytest.mark.parametrize(
"kind", [
b"kind",
... | 2.453125 | 2 |
tests/test_setuptools_build_subpackage.py | ashb/setuptools-build-subpackage | 2 | 32385 | import os
import tarfile
import textwrap
from pathlib import Path
import setuptools
from wheel.wheelfile import WheelFile
from setuptools_build_subpackage import Distribution
ROOT = Path(__file__).parent.parent
def build_dist(folder, command, output, *args):
args = [
'--subpackage-folder',
fold... | 2.265625 | 2 |
satchless/checkout/tests/__init__.py | styleseat/satchless | 1 | 32386 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.conf import settings
from django.http import HttpResponse
from django.test import (
Client,
TestCase,
)
from satchless.cart.tests import TestCart
from ...cart.models import CART_SESSION_KEY
from ...order.app import order_... | 1.9375 | 2 |
app/source/tests_previos/test6/run.py | SMDynamicsLab/Haptic | 0 | 32387 | <filename>app/source/tests_previos/test6/run.py
import os
import subprocess
import pathlib
import time
import sys
from numpy.core.shape_base import block
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from random import randint
import random
from datetime import datetime
def run_make():
p_... | 2.453125 | 2 |
Libraries_Benchmark/Real_dataset_experiments/code/Plotting/plots_code_real_dataset_var.py | gonzalo-munillag/Benchmarking_Differential_Privacy_Analytics_Libraries | 0 | 32388 | import matplotlib.pyplot as plt
import matplotlib.gridspec as gs
import numpy as np
import pandas as pd
import csv
from matplotlib.lines import Line2D
epsilon = pd.read_pickle('epsilon.pkl')
def plots_with_sizes(result_folder, query, attribute):
if attribute == 'age':
d = 1
if attribute == '... | 2.765625 | 3 |
tests/anim.py | jerry-belaston/gopro-lib-node.gl | 1 | 32389 | <reponame>jerry-belaston/gopro-lib-node.gl
#!/usr/bin/env python
#
# Copyright 2020 GoPro Inc.
#
# 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 l... | 2.171875 | 2 |
ozpcenter/models/import_task_result.py | emosher/ozp-backend | 1 | 32390 | from django.db import models
from ozpcenter.utils import get_now_utc
from .import_task import ImportTask
class ImportTaskResultManager(models.Manager):
def get_queryset(self):
return super().get_queryset()
def find_all(self):
return self.all()
def find_by_id(self, id):
return s... | 2.171875 | 2 |
latmats/tasks/loader.py | ardunn/latmats | 0 | 32391 | """
Loading utilities for computational experiments.
"""
import os
import pandas as pd
DATA_DIR = os.path.dirname(os.path.abspath(__file__))
def load_zT(all_data=False):
"""
Thermoelectric figures of merit for 165 experimentally measured compounds.
Obtained from the Citrination database maintained by C... | 2.765625 | 3 |
triviaqa_cp/triviaqa_cp_loader.py | chrisc36/debias | 51 | 32392 | import json
def get_qtypes(dataset_name, part):
"""Return list of question-types for a particular TriviaQA-CP dataset"""
if dataset_name not in {"location", "person"}:
raise ValueError("Unknown dataset %s" % dataset_name)
if part not in {"train", "dev", "test"}:
raise ValueError("Unknown part %s" % par... | 3.203125 | 3 |
org/sfu/billing/controller/__init__.py | MehdiLebdi/Real-Time-Charging_system | 1 | 32393 | <gh_stars>1-10
__all__= ['controller']
| 1.078125 | 1 |
tests/unicode/unicode_id.py | learnforpractice/micropython-cpp | 692 | 32394 | <filename>tests/unicode/unicode_id.py
# test unicode in identifiers
# comment
# αβγδϵφζ
# global identifiers
α = 1
αβγ = 2
bβ = 3
βb = 4
print(α, αβγ, bβ, βb)
# function, argument, local identifiers
def α(β, γ):
δ = β + γ
print(β, γ, δ)
α(1, 2)
# class, method identifiers
class φ:
def __init__(self):
... | 3.125 | 3 |
examples/hsets.py | gfmartins/cssdbpy | 85 | 32395 | from cssdbpy import Connection
from time import time
import md5
if __name__ == '__main__':
conn = Connection('127.0.0.1', 8888)
for i in xrange(0, 10000):
md5word = md5.new('word{}'.format(i)).hexdigest()
create = conn.execute('hset','words', md5word, int(time()))
value = conn.execute('hget','words', md5word)... | 2.65625 | 3 |
BuildTiramisuData.py | abfarahani/Image-segmentation | 0 | 32396 | <gh_stars>0
import os
import argparse
from distutils.dir_util import copy_tree
import random
def main(args):
"""
Simple function that looks at the arguments passed, checks to make sure
everything expected exists, and then defines a validation data set for
later processing by TrainTiramisu.py and TestTi... | 2.875 | 3 |
samples/histrequester_demo.py | suuuch/tws_async | 102 | 32397 | import datetime
import pytz
from tws_async import *
stocks = [
Stock('TSLA'),
Stock('AAPL'),
Stock('GOOG'),
Stock('INTC', primaryExchange='NASDAQ')
]
forexs = [
Forex('EURUSD'),
Forex('GBPUSD'),
Forex('USDJPY')
]
endDate = datetime.date.today()
startDate = endDate - datetime.timedelta(day... | 2.453125 | 2 |
problems/test_0630_easy_to_understand.py | chrisxue815/leetcode_python | 1 | 32398 | <filename>problems/test_0630_easy_to_understand.py
import heapq
import unittest
from typing import List
import utils
# O(nlog(n)) time. O(n) space. Interval, sorting by end, greedy.
class Solution:
def scheduleCourse(self, courses: List[List[int]]) -> int:
courses.sort(key=lambda course: course[1])
... | 3.40625 | 3 |
Tests/ttLib/tables/C_F_F__2_test.py | odidev/fonttools | 2,705 | 32399 | """cff2Lib_test.py -- unit test for Adobe CFF fonts."""
from fontTools.ttLib import TTFont
from io import StringIO
import re
import os
import unittest
CURR_DIR = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
DATA_DIR = os.path.join(CURR_DIR, 'data')
CFF_TTX = os.path.join(DATA_DIR, "C_F_F__2.ttx")
CF... | 2.59375 | 3 |