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 |
|---|---|---|---|---|---|---|
05_oop_inherit/OOP_05.py | teacher144123/AdvancedPython_2019 | 0 | 12767551 | class Shape:
def __init__(self):
self.data = ['_' for _ in range(10)]
def print_out(self):
print(''.join(self.data))
class Even(Shape):
def draw_func(self, x):
if x % 2 == 0:
return True
else:
return False
class ThirdBiggerFive(Shape):
def draw_f... | 3.71875 | 4 |
tests/test_api.py | LaudateCorpus1/windlass | 4 | 12767552 | <filename>tests/test_api.py
#
# (c) Copyright 2018-2019 Hewlett Packard Enterprise Development LP
#
# 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.... | 2.171875 | 2 |
tests/sanity_test.py | ocf/services | 3 | 12767553 | <reponame>ocf/services<gh_stars>1-10
import os.path
import pytest
def test_app_id_must_start_with_slash(app):
assert app.json['id'].startswith('/')
def test_app_should_use_bridge_networking(app):
"""Apps should use bridge networking.
There's nothing wrong with host networking and it'd be cool to use f... | 2.640625 | 3 |
window.py | duskvirkus/lpips-editor | 0 | 12767554 | from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QMainWindow, QAction, QFileDialog, QCheckBox
class Window(QMainWindow):
def __init__(self, controller):
super().__init__()
self.controller = controller
# setup actions
open_comparison_dir_action = QAction('Open Comparison I... | 2.640625 | 3 |
test/geocode_api_test_kafka.py | Steve0verton/google-maps-geocode-enrichment | 2 | 12767555 | <gh_stars>1-10
import json
import psycopg2
import psycopg2.extras
import traceback
from kafka import KafkaProducer
try:
conn = psycopg2.connect(dbname='postgres',user='postgres')
producer = KafkaProducer(bootstrap_servers='kafka')
cur = conn.cursor()
cur.execute( """
SELECT
location_hash,loc... | 2.578125 | 3 |
llvmlite/binding/targets.py | sklam/llvmlite | 0 | 12767556 | from __future__ import print_function, absolute_import
import collections
import os
from ctypes import (POINTER, c_char_p, c_longlong, c_int, c_size_t,
c_void_p, string_at, byref)
from . import ffi
from .module import parse_assembly
from .common import _decode_string, _encode_string
def get_defa... | 2.171875 | 2 |
src/further_examples/queues_stacks/stack_.py | lucidrohit/Over-100-Exercises-Python-and-Algorithms | 2 | 12767557 | #!/usr/bin/python3
# steinkirch at gmail.com
# astro.sunysb.edu/steinkirch
class Node(object):
def __init__(self, value=None):
self.value = value
self.next = None
class Stack(object):
def __init__(self):
self.top = None
def push(self, item):
node = Node(item)
node... | 3.8125 | 4 |
tools/graph_bag/scripts/trim_bag.py | jdekarske/astrobee | 1 | 12767558 | <reponame>jdekarske/astrobee<filename>tools/graph_bag/scripts/trim_bag.py<gh_stars>1-10
#!/usr/bin/env 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 t... | 2.515625 | 3 |
desafios/Mundo 1/Ex018.py | duartecgustavo/Python---Estudos- | 6 | 12767559 | <filename>desafios/Mundo 1/Ex018.py
# Desafio 18 - Aula 8 : Faça um programa que leia um angulo qualquer e calcule seu SENO, COSSENO E TANGENTE
import math
angulo = float(input('Digite um \033[4:32mangulo\033[m: '))
# no próprio python já possuem os calculos prontos para o SENO, COSSENO e TANGENTE
seno = math.sin(ma... | 4.15625 | 4 |
matrix/multiplication.py | shivam3009/fun-with-algorithms | 11 | 12767560 | <reponame>shivam3009/fun-with-algorithms
# coding: utf-8
def naive_square_matrix_product(A, B):
""" Implementation of naive squre matrix multiplication algorithm """
n = len(A)
C = [[0 for _ in range(n)] for _ in range(n)]
for i in range(n):
for j in range(n):
for k in range(n):
... | 3.984375 | 4 |
ggpy/player/game_player.py | hobson/ggpy | 1 | 12767561 | #!/usr/bin/env python
import socket
class Socket:
'''from python.org docs
demonstration class only -- coded for clarity, not efficiency
'''
def __init__(self, sock=None):
if sock is None:
self.sock = socket.socket(
socket.AF_INET, socket.SOCK_STREAM)
e... | 3.5625 | 4 |
boris/services/templatetags/services.py | fragaria/BorIS | 1 | 12767562 | '''
Created on 2.10.2011
@author: xaralis
'''
from django import template
from django.conf import settings
from boris.services.models.core import service_list
register = template.Library()
@register.inclusion_tag('services/interface.html')
def render_service_interface(encounter):
return {
'encounter':... | 1.984375 | 2 |
flask_server.py | liujiabing/blstm-crf-ner | 0 | 12767563 | <filename>flask_server.py
#!_*_coding:utf-8_*_
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
import os
from collections import defaultdict
import json
import requests
import numpy as np
import tensorflow as tf
from model.data_utils import CoNLLDataset
from model.ner_model import NERModel
from model.config im... | 2.484375 | 2 |
qtpy/tests/conftest.py | tlambert-forks/qtpy | 1 | 12767564 | <reponame>tlambert-forks/qtpy
import os
def pytest_configure(config):
"""Configure the test environment."""
if 'USE_QT_API' in os.environ:
os.environ['QT_API'] = os.environ['USE_QT_API'].lower()
# We need to import qtpy here to make sure that the API versions get set
# straight away.
imp... | 1.929688 | 2 |
dummy.py | paulaner/flask-sso | 0 | 12767565 | <reponame>paulaner/flask-sso
import datetime
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from tabledef import *
engine = create_engine('sqlite:///tutorial.db', echo=True)
# create a Session
Session = sessionmaker(bind=engine)
session = Session()
user = User("admin","admin","<EMAIL>",... | 3.0625 | 3 |
scripts/generate_command_help.py | FergusDeveloper/pyOCD | 1 | 12767566 | #!/usr/bin/env python3
# Copyright (c) 2020 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# 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... | 2.15625 | 2 |
dtech_instagram/InstagramAPI/src/http/Response/LoginResponse.py | hideki-saito/InstagramAPP_Flask | 126 | 12767567 | <gh_stars>100-1000
from .Response import Response
class LoginResponse(Response):
def __init__(self, response):
self.username = None
self.has_anonymous_profile_picture = None
self.profile_pic_url = None
self.profile_pic_id = None
self.full_name = None
self.pk = None... | 2.6875 | 3 |
tfcontracts/dtype_contract.py | vasiliykarasev/tfcontracts | 2 | 12767568 | import typing
import tensorflow as tf
from typing import Any, Callable, Dict, Sequence, Mapping, Union
from . import common
from . import contract
from . import errors
class SimpleDTypeContract(contract.FunctionContract):
"""Contract that ensures that all arguments match the given dtype.
Raises an exception if... | 2.890625 | 3 |
melodic/lib/python2.7/dist-packages/qt_gui/plugin_handler.py | Dieptranivsr/Ros_Diep | 2 | 12767569 | # Copyright (c) 2011, <NAME>, <NAME>, TU Darmstadt
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list ... | 0.941406 | 1 |
src/LocalSaliencyModel/model.py | noashin/local_global_attention_model | 0 | 12767570 | import sys
import pickle
import numpy as np
sys.path.append('./../')
sys.path.append('./../../')
from src.LocalGlobalAttentionModel.model import Model as parent_model
from .vel_param import VelParam as vel_param
from src.HMC.hmc import HMC
class Model(parent_model):
"""
This class describes a model where fi... | 2.265625 | 2 |
core/dm.py | avidale/pleiades-bot | 0 | 12767571 | import copy
import os
from datetime import datetime
import dialogic
import attr
from dialogic.cascade import Cascade, Pr, DialogTurn
from dialogic.dialog import Context, Response
from dialogic.dialog_manager import TurnDialogManager
csc = Cascade()
@attr.s
class PTurn(DialogTurn):
forms_collection = attr.ib(de... | 2.125 | 2 |
webserver/model/utils.py | kangyeolk/deep-labeling-vis | 0 | 12767572 | import torch
import torch.nn as nn
import numpy as np
from itertools import combinations
import torch.nn.functional as F
def sigmoid(x):
return 1 / (1 + np.exp(-x))
def cal_l2(x, y):
return torch.pow((x - y), 2).sum(-1).sum()
class ContrastiveLoss(nn.Module):
"""
Contrastive loss
Takes embedding... | 2.703125 | 3 |
test/test_packages/extras/test_idt.py | drewrisinger/pyGSTi | 1 | 12767573 | from ..testutils import BaseTestCase, compare_files, temp_files, regenerate_references
import unittest
import numpy as np
import pickle
import time
import warnings
import pygsti
from pygsti.extras import idletomography as idt
#Helper functions
#Global dicts describing how to prep and measure in various bases
prepDict... | 1.882813 | 2 |
faucet/acl.py | Bairdo/faucet-copy | 0 | 12767574 | <filename>faucet/acl.py
"""Configuration for ACLs."""
# Copyright (C) 2015 <NAME>, <NAME> and <NAME>.
# Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2017 The Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file... | 2.75 | 3 |
Projeto_de_Bloco/Projeto_final/cliente.py | LC-ardovino/INFNET | 0 | 12767575 | <filename>Projeto_de_Bloco/Projeto_final/cliente.py
import socket
import sys
def Processo_do_sistema():
target_host = socket.gethostname()
target_port = 9999
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect((target_host, target_port))
client.send("1".encode('utf-8'))
r... | 3.09375 | 3 |
puzzle_engine/puzzle_engine/tests/hitori/test_schemas.py | nathandaddio/puzzle_app | 0 | 12767576 | import pytest
import mock
from marshmallow import ValidationError
from puzzle_engine.hitori.schemas import (
CellSchema,
BoardSchema,
HitoriSolutionSchema
)
class TestCellSchema:
@pytest.fixture
def data(self):
return {
'id': 1,
'row_number': 1,
'col... | 2.28125 | 2 |
bin/extractTNHTimes.py | k323r/YASB-tools | 0 | 12767577 | #!/usr/bin/python3
import pandas as pd
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input", help="xlsx sheet containing the time tracks of the installation")
parser.add_argument("-o", "--output", help="output file path")
parser.add_argument... | 2.609375 | 3 |
hungry_toaster/hungry_toaster_odom/src/pynetworktables-tools/simulated_rio.py | FRC-1721/LAPIS | 5 | 12767578 | <reponame>FRC-1721/LAPIS<filename>hungry_toaster/hungry_toaster_odom/src/pynetworktables-tools/simulated_rio.py
#!/usr/bin/env python
import time
from math import sin, cos
from networktables import NetworkTables
import logging # Required
logging.basicConfig(level=logging.DEBUG)
NetworkTables.initialize()
table = Net... | 2.296875 | 2 |
murakami/runners/ndt5.py | flatlinebb/murakami | 0 | 12767579 | import logging
import shutil
import subprocess
import uuid
import datetime
import json
from murakami.errors import RunnerError
from murakami.runner import MurakamiRunner
logger = logging.getLogger(__name__)
class Ndt5Client(MurakamiRunner):
"""Run NDT5 test."""
def __init__(self, config=None, data_cb=None,
... | 2.0625 | 2 |
diet/admin.py | EspeIgira/Health-Diet | 0 | 12767580 | <reponame>EspeIgira/Health-Diet
from django.contrib import admin
from .models import Image,Category,Comment
admin.site.register(Image)
admin.site.register(Category)
admin.site.register(Comment)
| 1.226563 | 1 |
tests/test_setup.py | BFriedrichs/motorturbine | 1 | 12767581 | <gh_stars>1-10
import pytest
from motorturbine import BaseDocument, fields, errors
def test_failingdoc():
with pytest.raises(errors.FieldExpected):
class FailingDocument(BaseDocument):
y = int
doc = FailingDocument()
def test_subdoc():
class TestDocument(BaseDocument):
x... | 2.28125 | 2 |
structures/ls_conditional_spec_gan.py | googleinterns/audio_synthesis | 1 | 12767582 | <filename>structures/ls_conditional_spec_gan.py
# Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 2.515625 | 3 |
tests/test_market.py | SomeSpecialOne/asyncsteampy | 1 | 12767583 | import pytest
from .data import ITEM_DATA, TOTAL_LISTINGS, BUY_ORDERS, SELL_LISTINGS, CURRENCY, GAME
@pytest.mark.asyncio
async def test_get_price(client):
item = ITEM_DATA
prices = await client.market.fetch_price(item, GAME)
assert prices["success"]
@pytest.mark.asyncio
async def test_get_price_histor... | 2.453125 | 2 |
examples/kec.py | WeiZhixiong/ksc-sdk-python | 0 | 12767584 | # -*- encoding:utf-8 -*-
from kscore.session import get_session
if __name__ == "__main__":
s = get_session()
client = s.create_client("kec", "cn-beijing-6", use_ssl=False)
# https://docs.ksyun.com/read/latest/52/_book/oaDescribeInstances.html
client.describe_instances()
# https://docs.ksyun.com... | 1.9375 | 2 |
da4py/tests/test_amstc.py | BoltMaud/da4py | 2 | 12767585 | from unittest import TestCase
from numpy import sort
from pm4py.objects.petri import importer
from pm4py.objects.log.importer.xes import factory as xes_importer
from da4py.main.analytics.amstc import Amstc, samplingVariantsForAmstc
class TestAmstc(TestCase):
'''
This class aims at testing amstc.py file.
... | 2.28125 | 2 |
arginfer/cli.py | JereKoskela/arginfer | 2 | 12767586 | import sys
import os
import arginfer
import argparse
import logging
import msprime
from arginfer.mcmc import *
from arginfer.plots import *
# import comparison.plot
'''
command line interface for arginfer
'''
logger = logging.getLogger(__name__)
log_format = "%(asctime)s %(levelname)s %(message)s"
def error_exit(messa... | 2.4375 | 2 |
backend/api/migrations/0002_stock_userprofile.py | DataHack-CSCE606/django-vue-template | 0 | 12767587 | # Generated by Django 3.2 on 2021-04-24 03:25
from django.db import migrations, models # pragma: no cover
import django.db.models.deletion # pragma: no cover
class Migration(migrations.Migration): # pragma: no cover
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.C... | 1.9375 | 2 |
vector.py | qsctr/flocking | 0 | 12767588 | <reponame>qsctr/flocking<gh_stars>0
from math import atan2, degrees, hypot
from operator import add, mod, mul, sub, truediv
def average(vectors):
return sum(vectors) / len(vectors) if vectors else Vector()
def apply(op):
return lambda self, a: Vector(map(op, self, a if hasattr(a, '__iter__') else (a, a)))
cl... | 2.96875 | 3 |
addons/website_event/tests/test_event_internals.py | SHIVJITH/Odoo_Machine_Test | 0 | 12767589 | <gh_stars>0
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import datetime, timedelta
from odoo import fields
from odoo.addons.website_event.tests.common import TestWebsiteEventCommon
from odoo.tests.common import users
class TestEventWebsite(TestWeb... | 2.0625 | 2 |
highlevel/simulation/entity/simulation_state.py | outech-robotic/code | 7 | 12767590 | """
SimulationState of a simulation at a given moment.
"""
from __future__ import annotations
from dataclasses import dataclass
from typing import List, Deque
from highlevel.util.type import Millisecond, TickPerSec
from highlevel.util.geometry.vector import Vector2
@dataclass
class Cup:
"""
A cup.
"""
... | 2.5 | 2 |
labtronyx/bases/driver.py | protonyx/labtronyx | 4 | 12767591 | <filename>labtronyx/bases/driver.py
"""
Getting Started
---------------
All Drivers extend :class:`labtronyx.DriverBase`::
import labtronyx
class DRIVER_CLASS_NAME(labtronyx.DriverBase):
pass
Required Attributes
-------------------
Drivers require some attributes to be defined in order to specify w... | 2.890625 | 3 |
StkUiPlugins/CSharp/OperatorsToolBox/Stk12.OperatorsToolBox/Plugin Files/ConstellationWizardLib.py | ningwersen/STKCodeExamples | 78 | 12767592 | <reponame>ningwersen/STKCodeExamples
# Helper functions to create MTOs (visual representations of objects, no analysis)
# Run a deck access report then the writeTLE function can be called to create a TLE file with all objects fromt the deck access report.
# Deck Access Report Format
# ===============================... | 2.34375 | 2 |
python/mpopt/qap/cmdline/dd_gurobi.py | vislearn/libmpopt | 1 | 12767593 | <gh_stars>1-10
#!/usr/bin/env python3
import argparse
from mpopt import qap, utils
def main():
parser = argparse.ArgumentParser(description='Optimizer for *.dd quadratic assignment models.')
parser.add_argument('--quadratic-objective', action='store_true', help='Use quadratic objective and to reduce number ... | 2.40625 | 2 |
utils/PrintHandler.py | Arthurdw/Reaction-Role | 31 | 12767594 | # -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2019-2020 Arthur
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, m... | 2.078125 | 2 |
2021/03/p1.py | jo3-l/advent | 0 | 12767595 | <gh_stars>0
def lmap(f, it):
return list(map(f, it))
def ints(it):
return lmap(int, it)
def solve(input):
l = len(input.split()[0])
xs = lmap(lambda x: int(x, 2), input.split())
a = 0
for i in range(l):
cnt = [0, 0]
for x in xs:
cnt[(x >> i) & 1] += 1
if c... | 2.84375 | 3 |
train.py | vicgalle/cusp-dnn | 1 | 12767596 | import argparse
import time
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms, models
from models import *
from diagnostics import do_diagnostics
# TODOs
# Fix hyperparameters to match previous l... | 2.0625 | 2 |
setup.py | bcmyers/rustypy | 0 | 12767597 | import os
from pip.req import parse_requirements
from setuptools import find_packages, setup
from typing import List
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
def long_description() -> str:
path = os.path.join(BASE_DIR, 'README.rst')
with open(path, 'r') as f:
long_description = f.read()
... | 1.78125 | 2 |
Flask/flask variable.py | nuvish04/Basic-Programming | 0 | 12767598 | from flask import Flask
app = Flask(__name__)
@app.route('/<name>')
def hello_name(name):
return 'Hello %s!' % name
@app.route('/<int:postID>')
def show_blog(postID):
return 'Blog Number %d' % postID
@app.route('/<float:revNo>')
def revision(revNo):
return 'Revision Number %f' % revNo
if __name__... | 2.609375 | 3 |
test/test_gdeval.py | claclark/ir_measures | 17 | 12767599 | import unittest
import itertools
import ir_measures
class TestPytrecEval(unittest.TestCase):
def test_nDCG(self):
qrels = list(ir_measures.read_trec_qrels('''
0 0 D0 0
0 0 D1 1
0 0 D2 1
0 0 D3 2
0 0 D4 0
1 0 D0 1
1 0 D3 2
1 0 D5 2
'''))
run = list(ir_measures.read_trec_run('''
0 0 D0 1 0.8 run
0 ... | 2.3125 | 2 |
client/root/uiscript/minigamewindow.py | xTeJk/metin2---okey-cards | 1 | 12767600 | import uiScriptLocale
TAKE_ROOT = "d:/ymir work/ui/minigame/rumi/"
window = {
"name" : "MiniGameWindow",
"x" : SCREEN_WIDTH - 136 - 100,
"y" : 15,
"width" : 100,
"height" : 58,
"children" :
(
{
"name" : "mini_game_window",
"type" : "window",
"x" : 0,
"y" : 0,
"width" : 100,
"h... | 1.601563 | 2 |
tests/test_gitlab_reporter.py | nikitanovosibirsk/vedro-gitlab-reporter | 0 | 12767601 | <filename>tests/test_gitlab_reporter.py
from contextlib import contextmanager
from typing import Optional
from unittest.mock import Mock, call, patch
from uuid import uuid4
import pytest
from baby_steps import given, then, when
from rich.style import Style
from vedro.core import Dispatcher
from vedro.events import Arg... | 2.078125 | 2 |
ansible_navigator/_version.py | Akasurde/ansible-navigator | 0 | 12767602 | """ version
"""
__version__ = "0.6.1"
| 1.015625 | 1 |
Roman_Morozov_dz_2/task_4.py | Wern-rm/2074_GB_Python | 0 | 12767603 | __author__ = '<NAME>'
def convert_name_extract(list_in: list) -> list:
tmp: list = []
for i in list_in:
i = i.title()
name = i.rpartition(' ')
tmp.append(f'Привет, {name[-1]}!')
return tmp
if __name__ == '__main__':
example_list = ['инженер-конструктор Игорь', 'главный бухгал... | 3.578125 | 4 |
products/migrations/0005_delete_products_category.py | Endraraaz/Raj-Beverages | 0 | 12767604 | <gh_stars>0
# Generated by Django 2.0.2 on 2018-11-15 04:09
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('products', '0004_beer_rum_vodka_wine'),
]
operations = [
migrations.DeleteModel(
name='products_category',
),
]
| 1.28125 | 1 |
pyocd/coresight/cortex_m_v8m.py | juhhov/pyOCD | 0 | 12767605 | # pyOCD debugger
# Copyright (c) 2019 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | 1.789063 | 2 |
week_1/le_matriz.py | angelitabrg/lih_lab_python2 | 0 | 12767606 | def cria_matriz(num_linhas, num_colunas):
''' (int, int) --> matriz (lista de listas)
Cria e retorna uma matriz com num_linhas linhas e num_colunas
colunas em que cada elemento é igual digitado pelo usuário.
'''
matriz = [] # lista vazia
for i in range(num_linhas):
# cria a linha i
... | 4.15625 | 4 |
nhais-adaptor/edifact/incoming/models/message.py | tomzo/integration-adaptors | 15 | 12767607 | from edifact.incoming.models.transaction import Transactions
class MessageSegmentBeginningDetails:
"""
A representation of the incoming edifact message beginning details contained in a message
"""
def __init__(self, reference_number):
"""
:param reference_number: the referen... | 2.734375 | 3 |
pypykatz/commons/winapi/constants.py | wisdark/pypykatz | 1,861 | 12767608 | #!/usr/bin/env python3
#
# Author:
# <NAME> (@skelsec)
#
PROCESS_QUERY_INFORMATION = 0x0400
PROCESS_VM_READ = 0x0010
PROCESS_VM_WRITE = 0x0020
PROCESS_VM_OPERATION = 0x0008
PROCESS_CREATE_THREAD = 0x0002
# Standard access rights
DELETE = 0x00010000
READ_CONTROL = 0x00020... | 1.625 | 2 |
query_processor/migrations/0020_auto_20160710_0140.py | shashank-iitj/traibot | 0 | 12767609 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-07-09 20:10
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('query_processor', '0019_auto_20160709_1732'),
]
operations = [
migrations.RemoveFiel... | 1.5 | 2 |
LC/451.py | szhu3210/LeetCode_Solutions | 2 | 12767610 | <reponame>szhu3210/LeetCode_Solutions<filename>LC/451.py
class Solution(object):
def frequencySort(self, s):
"""
:type s: str
:rtype: str
"""
d = collections.defaultdict(int)
for c in s:
d[c] += 1
l = [[-d[key],key] for key in d]
l... | 3.25 | 3 |
accounts/views.py | APNovichkov/xplrio | 0 | 12767611 | <gh_stars>0
from django.views.generic import CreateView
from django.urls import reverse_lazy
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from accounts.models import UserProfile
from a... | 2.28125 | 2 |
classification/random_forest/scratch_implementation/random_forest.py | maxxie114/Basic_ML_Research | 4 | 12767612 | # Source from Codecademy
from tree import build_tree, print_tree, car_data, car_labels, classify
import random
random.seed(4)
# The features are the price of the car, the cost of maintenance, the number of doors, the number of people the car can hold, the size of the trunk, and the safety rating
unlabeled_point = ['hi... | 3.703125 | 4 |
series_rating.py | dents0/IMDb-Top-Rated-Series | 0 | 12767613 | import requests
from bs4 import BeautifulSoup
import pandas
data = requests.get("https://www.imdb.com/chart/toptv/?ref_=nv_tvv_250",
headers={"Accept-language": "en-US"})
soup = BeautifulSoup(data.text, "html.parser")
tbl = soup.find("table", {"class": "chart full-width"})
tbody = tbl.find("tbody"... | 3.21875 | 3 |
dboperation/__dboperation_helper.py | cheshirewara/dboperation | 0 | 12767614 | class Helper:
@staticmethod
def is_Empty(obj):
flag = False
if obj is None:
flag = True
elif not obj.strip():
flag = True
else:
flag = False
return flag
if __name__ == '__main__':
print(Helper.is_Empty(None))
| 3.234375 | 3 |
Methods/lambdaExpressionFiltersandMaps.py | NagarajuSaripally/PythonCourse | 0 | 12767615 | <gh_stars>0
'''
Lambda expressions are quick way of creating the anonymous functions:
'''
#function without lamda expression:
def square(num):
return num ** 2
print(square(5))
#converting it into lambda expression:
lambda num : num ** 2
#if we want we can assign this to variable like
square2 = lambda num : num **... | 4.40625 | 4 |
comments/views.py | NYARAS/Resuseable-Comments | 0 | 12767616 | <filename>comments/views.py
from django.shortcuts import render
from django.views.generic import TemplateView, FormView
from django.utils.decorators import method_decorator
from django.shortcuts import render, get_object_or_404, redirect
from django.utils import timezone
from .models import Post, CommentPost
from .form... | 2.234375 | 2 |
odesolvers/tests/test_helpers.py | francescoseccamonte/odesolvers | 0 | 12767617 | #
# Author : <NAME>
# Copyright (c) 2020 <NAME>. All rights reserved.
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
#
#
# Test function helpers.
#
import numpy as np
def constantode(t,x):
"""Function containing a constant ODE x' = 1.
"""
xprime = np.empty... | 3.0625 | 3 |
tests/hades_logs/conftest.py | agdsn/pycroft | 18 | 12767618 | import pytest
from flask import Flask
from hades_logs import HadesLogs
from tests.hades_logs import get_hades_logs_config
@pytest.fixture(scope='session')
def hades_logs_config():
return get_hades_logs_config()
@pytest.fixture(scope='session')
def app(hades_logs_config):
app = Flask('test')
app.config.... | 1.890625 | 2 |
src/stats/stats.py | gvso/eleccionespy | 0 | 12767619 | <reponame>gvso/eleccionespy
from scipy import stats
class Stats:
"""
The class Stats defines several statistics calculation functions such as
linear regression and p values.
"""
def r_and_p_value(self, x, y) -> str:
_, _, r_value, p_value, _ = stats.linregress(x, y)
return f"R = ... | 2.78125 | 3 |
producthunt/apps.py | IamCharlesM/Portfolio | 0 | 12767620 | from django.apps import AppConfig
class ProducthuntConfig(AppConfig):
name = 'producthunt'
| 1.0625 | 1 |
lib/pyfrc/wpilib/__init__.py | VikingRobotics/pyfrc | 1 | 12767621 | from .core import *
from ..main import run
| 0.980469 | 1 |
src/plaso/tarzan/app/views/hdfslsview.py | nesfit/pyspark-plaso | 2 | 12767622 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from flask.views import MethodView
from plaso.tarzan.app.controllers.filemancontroller import FileManController
class HdfsLsView(MethodView):
def __init__(self, hdfs_base_uri):
self.controller = FileManController(hdfs_base_u... | 2.125 | 2 |
frontend/urls.py | adnit/music-server | 1 | 12767623 | <gh_stars>1-10
from django.conf.urls import include
from django.urls import path
from . import views
from .api import album_views
from .api import artist_views
from .api import auth_views
from .api import song_views
urlpatterns = [
path('albums/', views.dashboard, name='albums'),
path('albums/<int:id>/', view... | 1.875 | 2 |
hippiepug/pack.py | SPRING-epfl/hippiepug | 4 | 12767624 | """
Serializers for chain blocks and tree nodes.
.. warning::
You need to take extra care when defining custom serializations. Be
sure that your serialization includes all the fields in the original
structure. E.g., for chain blocks:
- ``self.index``
- ``self.fingers``
- Your payload
Unle... | 2.46875 | 2 |
example/miniobs/run_acq.py | simonsobs/ocs | 9 | 12767625 | <reponame>simonsobs/ocs
from ocs.ocs_client import OCSClient
import time
faker = OCSClient('data1')
print('Data Faker -- start 30 second acq.')
print(faker.acq.start())
print('\nMonitoring (ctrl-c to stop and exit)...\n')
try:
for i in range(10):
time.sleep(3)
print(faker.acq.status())
except Key... | 2.625 | 3 |
src/identity/views.py | concordusapps/django-identity | 3 | 12767626 | <reponame>concordusapps/django-identity
# -*- coding: utf-8 -*-
""" \file identity/views.py
\brief Implements the core views for django-identity.
\author <NAME> (cactuscommander) <EMAIL>
\author <NAME> (mehcode) <EMAIL>
\copyright Copyright 2012 © Concordus Applications, Inc.
All Rights Reserved.
"""
| 0.925781 | 1 |
funpipe/vcf.py | broadinstitute/funpipe | 0 | 12767627 | <gh_stars>0
""" fungal analysis with a VCF file """
import os
from math import ceil
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from funpipe.utils import run
import subprocess as sp
class vcf:
""" vcf class command """
def __init__(self, vcf_file, prefix='output', outdir='.', fasta=... | 2.5 | 2 |
third_party/netty-tcnative/netty-tcnative.gyp | Wzzzx/chromium-crosswalk | 2 | 12767628 | # Builds the Netty fork of Tomcat Native. See http://netty.io/wiki/forked-tomcat-native.html
{
'targets': [
{
'target_name': 'netty-tcnative-so',
'product_name': 'netty-tcnative',
'type': 'shared_library',
'sources': [
'src/c/address.c',
'src/c/bb.c',
'src/c/dir.c',... | 1.703125 | 2 |
app/celery_app/tasks.py | KimKiHyuk/BenefitObserver | 0 | 12767629 | <filename>app/celery_app/tasks.py
from celery import shared_task
from app.celery import app
from .models import CrawlerTask
from subscribe_app.models import *
from subscribe_app.serializers import *
from auth_app.models import *
import time
import json
from celery import Celery
from celery.task import task, subtask
fro... | 2.0625 | 2 |
basics.py | Francesco149/nand | 3 | 12767630 | #!/bin/env python
from nand import Chip, Nand
ab = ["a", "b"]
x = ["x"]
out = ["out"]
sel = ["sel"]
Not = Chip("Not")
Not.inputs = x
Not.outputs = out
Not.add(Nand, a="x", b="x", out="out")
And = Chip("And")
And.inputs = ab
And.outputs = out
And.add(Nand, a="a", b="b", out="aNandB")
And.add(Not, x="aNandB", out="ou... | 2.765625 | 3 |
streamlit_image_crop/__init__.py | mitsuse/streamlit-image-crop | 10 | 12767631 | <gh_stars>1-10
from __future__ import annotations
from typing import Callable
from typing import Optional
from typing import Tuple
from typing import Union
from dataclasses import dataclass
from PIL.Image import Image
_DEBUG = False
_impl: Optional[Tuple[Callable, Callable[[str], str]]] = None
@dataclass(frozen=... | 2.09375 | 2 |
solcast/dependencies.py | iamdefinitelyahuman/solc-ast | 0 | 12767632 | #!/usr/bin/python3
def set_dependencies(source_nodes):
"""Sets contract node dependencies.
Arguments:
source_nodes: list of SourceUnit objects.
Returns: SourceUnit objects where all ContractDefinition nodes contain
'dependencies' and 'libraries' attributes."""
symbol_map = get_s... | 2.15625 | 2 |
tests/integ/group_test.py | murlock/hsds | 0 | 12767633 | ##############################################################################
# Copyright by The HDF Group. #
# All rights reserved. #
# #
# Th... | 2.046875 | 2 |
mathcli/__init__.py | FedeClaudi/mathcli | 2 | 12767634 | from pyinspect import install_traceback
from rich import pretty
install_traceback()
pretty.install()
from loguru import logger
import sys
# comment these two lines out to show logging info
logger.remove()
logger.add(sys.stderr, level="INFO")
logger.level("EXPRESSION", no=15, color="<yellow>", icon="🖇")
logger.leve... | 1.898438 | 2 |
Windows/pkn.py | SuperSecretPryncyMafia/PKN | 0 | 12767635 | from __init__ import *
import sys
from threading import Thread
from StartScreen.start_screen import StartScreen
from GameScreen.game_screen import GameScreen
from Options.options import Options
from WaitingRoom.waiting_room import WaitingRoom
from Results.results import Results
from style_sheets import Theme
class ... | 2.671875 | 3 |
BiancoCNN.py | donikv/IlluminationBase | 0 | 12767636 | <reponame>donikv/IlluminationBase
import tensorflow as tf
import tensorflow.keras.layers as l
import patcher as p
def __build_model__():
input = l.Input([32,32,3])
x = l.Conv2D(240, 1, 1)(input)
x = l.MaxPooling2D(8,8)(x)
x = l.Flatten()(x)
x = l.Dense(40, activation='relu')(x)
out = l.Dense(... | 2.234375 | 2 |
website/volunteer/models.py | NTI-Gymnasieingenjor/RedCrossAction-Pacific | 0 | 12767637 | import datetime
from django.db import models
from django.utils import timezone
# Create your models here.
class AddMail(models.Model):
mail_address = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __str__(self):
return self.mail_address
def wa... | 2.8125 | 3 |
backend/modules/datasets/sklearn_iris/__init__.py | fheyen/ClaVis | 2 | 12767638 | from sklearn import datasets
import numpy as np
def get_info():
return {
'name': 'sklearn_iris',
'description': 'ScikitLearn | Iris',
'class_names': ['Iris Setosa', 'Iris Versicolor', 'Iris Virginica']
}
def get_data(datasets_path):
data = datasets.load_iris()
return {
... | 2.90625 | 3 |
mailer/backend.py | mvpoland/django-mailer | 0 | 12767639 | <gh_stars>0
from django.core.mail.backends.base import BaseEmailBackend
from mailer.models import Message
class DbBackend(BaseEmailBackend):
def send_messages(self, email_messages):
# allow for a custom batch size
messages = Message.objects.bulk_create(
[Message(email=email) for email... | 2.203125 | 2 |
versions/1.1.3/blog/views/account/logout_view.py | mnp-fuf/django-bona-blog | 92 | 12767640 | <reponame>mnp-fuf/django-bona-blog
# Django imports
from django.contrib.auth import logout
from django.contrib import messages
from django.shortcuts import render, redirect
from django.views.generic import View
class UserLogoutView(View):
"""
Logs user out of the dashboard.
"""
template_name = 'accou... | 1.90625 | 2 |
object_database/web/html/html_gen_tests.py | szymonlipinski/nativepython | 0 | 12767641 | <gh_stars>0
#!/usr/bin/env python3
# Copyright 2017-2019 Nativepython Authors
#
# 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
#
#... | 2.40625 | 2 |
accounts/migrations/0022_auto_20200910_0658.py | samarthkulshrestha/zedway | 1 | 12767642 | <filename>accounts/migrations/0022_auto_20200910_0658.py<gh_stars>1-10
# Generated by Django 3.0.8 on 2020-09-10 06:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0021_auto_20200910_0431'),
]
operations = [
migrations.Al... | 1.328125 | 1 |
tools/pvacseq/generate_protein_fasta.py | atwollam/pVACtools | 0 | 12767643 | import sys
from pathlib import Path # if you haven't already done so
root = str(Path(__file__).resolve().parents[1])
sys.path.append(root)
import argparse
import tempfile
import os
import shutil
import yaml
import csv
from collections import OrderedDict
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord i... | 2.546875 | 3 |
src/tsr/registry.py | mballance/tsr | 1 | 12767644 | '''
Created on Mar 7, 2020
@author: ballance
'''
import os
import sys
import importlib
from tsr.engine_info import EngineInfo
from tsr.messaging import verbose_note, error
from tsr.tool_info import ToolInfo
import subprocess
from _io import StringIO
import cmd
from tsr.plusarg_info import PlusargInfo
from json impor... | 1.859375 | 2 |
Math/9020.py | kjh9267/BOJ_Python | 0 | 12767645 | # https://www.acmicpc.net/problem/9020
if __name__ == '__main__':
input = __import__('sys').stdin.readline
N = 10_001
T = int(input())
is_prime = [True for _ in range(N)]
sqrt = int(N ** (1 / 2))
is_prime[0] = is_prime[1] = False
for idx in range(2, sqrt + 1):
if not is_prime[idx]... | 3.296875 | 3 |
tests.py | cltrudeau/django-flowr | 3 | 12767646 | #!/usr/bin/env python
import sys
import django
from django.conf import settings
from django.test.runner import DiscoverRunner
settings.configure(DEBUG=True,
DATABASES={
'default':{
'ENGINE':'django.db.backends.sqlite3',
}
},
ROOT_URLCONF='flowr.urls',
INSTALLED_APPS=(
... | 1.914063 | 2 |
gtp/gtp_v2_core/utilities/configuration_parser.py | getdrive/SigPloit | 7 | 12767647 | <gh_stars>1-10
# configuration_parser.py
#
# Copyright 2018 <NAME>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the... | 1.414063 | 1 |
hapy/hapy.py | ukwa/hapy | 4 | 12767648 | <gh_stars>1-10
import os
from pkg_resources import resource_string
from xml.etree import ElementTree
import requests
import requests.auth
import logging
logger = logging.getLogger(__name__)
HEADERS = {
'accept': 'application/xml'
}
class HapyException(Exception):
def __init__(self, r):
super(Hapy... | 2.546875 | 3 |
xldlib/utils/xictools/amplitude.py | Alexhuszagh/XLDiscoverer | 0 | 12767649 | <reponame>Alexhuszagh/XLDiscoverer
'''
Utils/Xictools/amplitude
________________________
Tools for processing extracted ion chromatogram amplitudes and
metadata.
:copyright: (c) 2015 The Regents of the University of California.
:license: GNU GPL, see licenses/GNU GPLv3.txt for more details.
''... | 1.945313 | 2 |
dataset/split.py | kentaroy47/kaggle-wheat-arutema47 | 4 | 12767650 | <reponame>kentaroy47/kaggle-wheat-arutema47
# get a df with just image and source columns
# such that dropping duplicates will only keep unique image_ids
from sklearn.model_selection import StratifiedKFold
from itertools import islice
import pandas as pd
import numpy as np
import re
def expand_bbox(x):
r = np.arra... | 2.46875 | 2 |