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 |
|---|---|---|---|---|---|---|
praetorian_ssh_proxy/hanlers/menu_handler.py | Praetorian-Defence/praetorian-ssh-proxy | 0 | 20500 | import sys
class MenuHandler(object):
def __init__(self, client, client_channel, remote_checker):
self._client = client
self._client_channel = client_channel
self._buffer = ''
self._remote_checker = remote_checker
@staticmethod
def create_from_channel(client, client_channe... | 2.640625 | 3 |
orderedtable/urls.py | Shivam2k16/DjangoOrderedTable | 2 | 20501 | <reponame>Shivam2k16/DjangoOrderedTable
from django.conf.urls import include, url
from django.contrib import admin
import orderedtable
from orderedtable import views
app_name="orderedtable"
urlpatterns = [
url(r'^$', views.home,name="home"),
url(r'^import-json/$', views.import_json,name="import_json"),
u... | 1.867188 | 2 |
lang/Python/set-consolidation-1.py | ethansaxenian/RosettaDecode | 1 | 20502 | def consolidate(sets):
setlist = [s for s in sets if s]
for i, s1 in enumerate(setlist):
if s1:
for s2 in setlist[i+1:]:
intersection = s1.intersection(s2)
if intersection:
s2.update(s1)
s1.clear()
s1... | 3.59375 | 4 |
call_google_translate.py | dadap/klingon-assistant-data | 0 | 20503 | #!/usr/bin/env python3
# Calls Google Translate to produce translations.
# To use, set "language" and "dest_language" below. (They are normally the same,
# unless Google uses a different language code than we do.) Then fill in
# the definition_[language] fields with "TRANSLATE" or
# "TRANSLATE: [replacement definition... | 2.78125 | 3 |
xenavalkyrie/xena_object.py | xenadevel/PyXenaValkyrie | 4 | 20504 | """
Base classes and utilities for all Xena Manager (Xena) objects.
:author: <EMAIL>
"""
import time
import re
import logging
from collections import OrderedDict
from trafficgenerator.tgn_utils import TgnError
from trafficgenerator.tgn_object import TgnObject, TgnObjectsDict
logger = logging.getLogger(__name__)
c... | 2.171875 | 2 |
test/ryu/vsw-602_mp_port_desc.py | iMasaruOki/lagopus | 281 | 20505 | <gh_stars>100-1000
from ryu.base.app_manager import RyuApp
from ryu.controller.ofp_event import EventOFPSwitchFeatures
from ryu.controller.ofp_event import EventOFPPortDescStatsReply
from ryu.controller.handler import set_ev_cls
from ryu.controller.handler import CONFIG_DISPATCHER
from ryu.controller.handler import MAI... | 1.859375 | 2 |
mamba/exceptions.py | bmintz/mamba-lang | 20 | 20506 | class InterpreterException(Exception):
def __init__(self, message):
self.message = message
def __str__(self):
return self.message
class SymbolNotFound(InterpreterException):
pass
class UnexpectedCharacter(InterpreterException):
pass
class ParserSyntaxError(InterpreterException):
... | 2.75 | 3 |
test/phytozome_test.py | samseaver/GenomeFileUtil | 0 | 20507 | # -*- coding: utf-8 -*-
import unittest
import os # noqa: F401
import json # noqa: F401
import time
import shutil
import re
import sys
import datetime
import collections
#import simplejson
from os import environ
try:
from ConfigParser import ConfigParser # py2
except:
from configparser import ConfigParser ... | 2.03125 | 2 |
icetray_version/trunk/resources/scripts/make_plots.py | hershalpandya/airshowerclassification_llhratio_test | 0 | 20508 |
# coding: utf-8
# In[1]:
import numpy as np
get_ipython().magic(u'matplotlib inline')
from matplotlib import pyplot as plt
from matplotlib.colors import LogNorm
import sys
sys.path.append('../../python/')
from general_functions import load_5D_PDF_from_file
from mpl_toolkits.mplot3d import Axes3D
from matplotlib imp... | 2.5 | 2 |
tests/test_vector.py | slode/triton | 0 | 20509 | <filename>tests/test_vector.py
# Copyright (c) 2013 <NAME>
#
# 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, modi... | 2.53125 | 3 |
build.py | Lvue-YY/Lvue-YY | 1 | 20510 | <gh_stars>1-10
import httpx
import pathlib
import re
import datetime
from bs4 import BeautifulSoup
root = pathlib.Path(__file__).parent.resolve()
def formatGMTime(timestamp):
UTC_FORMAT = '%Y-%m-%dT%H:%M:%SZ'
timeStr = datetime.datetime.strptime(timestamp, UTC_FORMAT) + datetime.timedelta(hours=2, minutes=30... | 2.625 | 3 |
app/models/news_article_test.py | engineer237/News-application | 0 | 20511 | <filename>app/models/news_article_test.py
import unittest # module for testing
from models import news_article
class TestNewsArticles(unittest.TestCase):
'''
TestNewsArticles for testing class news_articles
'''
def setUp(self):
'''
Set up method to run before each test cases.
''... | 2.9375 | 3 |
samples/at.bestsolution.framework.grid.personsample.model/utils/datafaker.py | BestSolution-at/framework-grid | 4 | 20512 | #! /usr/bin/env python3
import sys
import random
import os
from faker import Factory as FFactory
OUTFILE = "samples.xmi"
NUM_SAMPLES = 10
NUM_COUNTRIES = 4
TEMPLATE = """<?xml version="1.0" encoding="ASCII"?>
<person:Root
xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/... | 2.515625 | 3 |
tests/test_utility.py | ericbdaniels/pygeostat | 0 | 20513 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
__author__ = 'pygeostat development team'
__date__ = '2020-01-04'
__version__ = '1.0.0'
import os, sys
try:
import pygeostat as gs
except ImportError:
sys.path.append(os.path.abspath(os.p... | 2.1875 | 2 |
rockets/rocket.py | rsewell97/open-starship | 0 | 20514 | <reponame>rsewell97/open-starship<filename>rockets/rocket.py
import time
import multiprocessing as mp
import numpy as np
from scipy.spatial.transform import Rotation
from world import Earth
class Rocket(object):
def __init__(self, planet=Earth()):
self.planet = planet
self.propellant_mass = 1e6... | 2.5625 | 3 |
examples/complex/tcp_message.py | 0x7c48/mitmproxy | 74 | 20515 | <gh_stars>10-100
"""
tcp_message Inline Script Hook API Demonstration
------------------------------------------------
* modifies packets containing "foo" to "bar"
* prints various details for each packet.
example cmdline invocation:
mitmdump --rawtcp --tcp-host ".*" -s examples/complex/tcp_message.py
"""
from mitmpr... | 2.40625 | 2 |
notes/notebook/apps.py | spam128/notes | 0 | 20516 | <gh_stars>0
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class NotebookConfig(AppConfig):
name = "notes.notebook"
verbose_name = _("Notebook")
| 1.078125 | 1 |
tests/unit/test_app_init.py | isabella232/typeseam | 2 | 20517 | from unittest import TestCase
from unittest.mock import Mock, patch
from typeseam.app import (
load_initial_data,
)
class TestModels(TestCase):
@patch('typeseam.app.os.environ.get')
def test_load_initial_data(self, env_get):
ctx = Mock(return_value=Mock(
__exit__=Mock(),
... | 2.4375 | 2 |
execution/execution.py | nafetsHN/environment | 0 | 20518 | import sys
sys.path.append('../')
from abc import ABCMeta, abstractmethod
# https://www.python-course.eu/python3_abstract_classes.php
import logging
import oandapyV20
from oandapyV20 import API
import oandapyV20.endpoints.orders as orders
from oandapyV20.contrib.requests import MarketOrderRequest
class... | 2.640625 | 3 |
conda/update_versions.py | PicoJr/StereoPipeline | 323 | 20519 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# __BEGIN_LICENSE__
# Copyright (c) 2009-2013, United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The NGT platform is licensed under the Apache License, Version 2.0 (the
# "Lic... | 2.1875 | 2 |
test.py | uuidd/SimilarCharacter | 199 | 20520 | import cv2
import ProcessWithCV2
img1 = cv2.imread("D:/py/chinese/7.png")
img2 = cv2.imread("D:/py/chinese/8.png")
a = ProcessWithCV2.dHash(img1, img2, 1)
print(a)
| 2.765625 | 3 |
scripts/common/alignments.py | SilasK/genome_sketch | 1 | 20521 | <gh_stars>1-10
import pandas as pd
import os
MINIMAP_HEADERS = [
"Contig2",
"Length2",
"Start2",
"End2",
"Strand",
"Contig1",
"Length1",
"Start1",
"End1",
"Nmatches",
"Allength",
"Quality",
]
MINIMAP_DATATYPES = [str, int, int, int, str, str, int, int, int, int, int, in... | 2.859375 | 3 |
python/sprint1_nonfinals/l.py | tu2gin/algorithms-templates | 0 | 20522 | <reponame>tu2gin/algorithms-templates<gh_stars>0
# <NAME>
# Васе очень нравятся задачи про строки, поэтому он придумал свою.
# Есть 2 строки s и t, состоящие только из строчных букв. Строка
# t получена перемешиванием букв строки s и добавлением 1 буквы в
# случайную позицию. Нужно найти добавленную букву.
# Формат... | 2.984375 | 3 |
bentoml/lightgbm.py | francoisserra/BentoML | 1 | 20523 | from ._internal.frameworks.lightgbm import load
from ._internal.frameworks.lightgbm import save
from ._internal.frameworks.lightgbm import load_runner
__all__ = ["load", "load_runner", "save"]
| 1.070313 | 1 |
flake8_strings/visitor.py | d1618033/flake8-strings | 0 | 20524 | import ast
from typing import List
from flake8_plugin_utils import Visitor
from .errors import UnnecessaryBackslashEscapingError
class StringsVisitor(Visitor):
lines: List[str]
def _is_escaped_char(self, character: str) -> bool:
repr_c = repr(character)
return repr_c[1] == '\\' and repr_c[2... | 2.625 | 3 |
tests/test_asyncio_hn.py | MITBigDataGroup2/asyncio-hn | 30 | 20525 | <gh_stars>10-100
#!/usr/bin/env python3.6
# -*- coding: utf-8 -*-
import pytest
from asyncio_hn import ClientHN
@pytest.mark.asyncio
async def test_last_n_posts():
async with ClientHN() as hn:
posts = await hn.last_n_items(2)
assert len(posts) == 2
@pytest.mark.asyncio
async def test_download_... | 2.375 | 2 |
src/data/make_dataset.py | Rajasvi/Adverse-Food-Events-Analysis | 1 | 20526 | # -*- coding: utf-8 -*-
import click
import logging
from pathlib import Path
import pandas as pd
import re
import string
from nltk.corpus import stopwords
def brand_preprocess(row, trim_len=2):
""" This function creates a brand name column by parsing out the product column of data. It trims the words based on tri... | 3.703125 | 4 |
src/compare_eval.py | gccrpm/cdmf | 1 | 20527 | import os
import re
import hyperparams as hp
from data_load import DataLoad
from tqdm import tqdm
import numpy as np
import pandas as pd
import tensorflow as tf
def load_ckpt_paths(model_name='cdmf'):
# get ckpt
ckpt_path = '../model_ckpt/compare/{}/'.format(model_name)
fpaths = []
with open(ckpt_pat... | 2.046875 | 2 |
substitute_finder/migrations/0003_product.py | tohugaby/pur_beurre_web | 1 | 20528 | # Generated by Django 2.1 on 2018-08-14 09:42
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('substitute_finder', '0002_category'),
]
operations = [
migrations.CreateModel(
name='Product',
... | 1.867188 | 2 |
parameters/standard.py | David-Loibl/gistemp | 1 | 20529 | <reponame>David-Loibl/gistemp<gh_stars>1-10
#! /usr/bin/env python
#
# parameters/standard.py
#
# <NAME>, Ravenbrook Limited, 2010-02-15
# <NAME>, Revision 2016-01-06
"""Parameters controlling the standard GISTEMP algorithm.
Various parameters controlling each phase of the algorithm are
collected and documented here.... | 1.6875 | 2 |
pypdevs/src/pypdevs/tracers/tracerCell.py | martinvy/sin-model-elevators | 1 | 20530 | <filename>pypdevs/src/pypdevs/tracers/tracerCell.py<gh_stars>1-10
# Copyright 2014 Modelling, Simulation and Design Lab (MSDL) at
# McGill University and the University of Antwerp (http://msdl.cs.mcgill.ca/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in comp... | 2.1875 | 2 |
Estrangement/tests/test_utils.py | kawadia/estrangement | 7 | 20531 | import networkx as nx
import sys
import os
import nose
sys.path.append(os.getcwd() + "/..")
import utils
class test_utils:
def setUp(self):
self.g0 = nx.Graph()
self.g1 = nx.Graph()
self.g2 = nx.Graph()
self.g3 = nx.Graph()
self.g4 = nx.Graph()
self.g5 = nx.Graph()
self.g7 = nx.Graph(... | 2.296875 | 2 |
src/train.py | stephenllh/bcs-unet | 5 | 20532 | <filename>src/train.py
import os
import argparse
import pytorch_lightning as pl
from pytorch_lightning.callbacks import (
ModelCheckpoint,
EarlyStopping,
LearningRateMonitor,
)
from pytorch_lightning.loggers import TensorBoardLogger
from pytorch_lightning.utilities.seed import seed_everything
from data.emni... | 2.0625 | 2 |
perturbation_classifiers/util/dataset.py | rjos/perturbation-classifiers | 0 | 20533 | # coding=utf-8
# Author: <NAME> <<EMAIL>>
import numpy as np
import re
class KeelAttribute:
"""
A class that represent an attribute of keel dataset format.
"""
TYPE_REAL, TYPE_INTEGER, TYPE_NOMINAL = ("real", "integer", "nominal")
def __init__(self, attribute_name, attribute_type, attribute_rang... | 2.875 | 3 |
ex44e.py | liggettla/python | 0 | 20534 | <reponame>liggettla/python
#Rather than rely on inplicit inheritance from other classes, classes can just
#call the functions from a class; termed composition
class Other(object):
def override(self):
print "OTHER override()"
def implicit(self):
print "OTHER implicit()"
def altered(self):... | 4.21875 | 4 |
tools/create_doc.py | nbigaouette/gitlab-api-rs | 11 | 20535 | #!/usr/bin/env python3
import os
import re
import sys
import urllib.request
# api_filename = "projects.md"
api_filename = "groups.md"
url = "https://gitlab.com/gitlab-org/gitlab-ce/raw/master/doc/api/" + api_filename
doc_dir = "doc_tmp"
if not os.path.exists(doc_dir):
os.makedirs(doc_dir)
filename, headers =... | 2.828125 | 3 |
samples/butia/sumo_crono/push_mouse_event.py | RodPy/Turtlebots.activity | 0 | 20536 | <filename>samples/butia/sumo_crono/push_mouse_event.py<gh_stars>0
#Copyright (c) 2009-11, <NAME>, <NAME>
# This procedure is invoked when the user-definable block on the
# "extras" palette is selected.
# Usage: Import this code into a Python (user-definable) block; when
# this code is run, the current mouse status wi... | 2.78125 | 3 |
espn_api/hockey/constant.py | samthom1/espn-api | 0 | 20537 | <filename>espn_api/hockey/constant.py
#Constants
POSITION_MAP = {
# Remaining: F, IR, Util
0 : '0' # IR?
, 1 : 'Center'
, 2 : 'Left Wing'
, 3 : 'Right Wing'
, 4 : 'Defense'
, 5 : 'Goalie'
, 6 : '6' # Forward ?
, 7 : '7' # Goalie, F (Goalie Bench?)
, 8 : '8' # Goalie, F... | 1.351563 | 1 |
dataval/conftest.py | weishengtoh/machinelearning_assignment | 0 | 20538 | import os
import pandas as pd
import pytest
import yaml
import wandb
run = wandb.init(project='RP_NVIDIA_Machine_Learning',
job_type='data_validation')
@pytest.fixture(scope='session')
def data():
config_path = os.path.join(os.pardir, 'configs')
with open(os.path.join(config_path, 'datav... | 2.3125 | 2 |
src/abaqus/Odb/Odb.py | Haiiliin/PyAbaqus | 7 | 20539 | from abaqusConstants import *
from .OdbPart import OdbPart
from .OdbStep import OdbStep
from .SectionCategory import SectionCategory
from ..Amplitude.AmplitudeOdb import AmplitudeOdb
from ..BeamSectionProfile.BeamSectionProfileOdb import BeamSectionProfileOdb
from ..Filter.FilterOdb import FilterOdb
from ..Material.Mat... | 2.0625 | 2 |
popcorn_gallery/tutorials/urls.py | Koenkk/popcorn_maker | 15 | 20540 | from django.conf.urls.defaults import patterns, url
urlpatterns = patterns(
'popcorn_gallery.tutorials.views',
url(r'^(?P<slug>[\w-]+)/$', 'object_detail', name='object_detail'),
url(r'^$', 'object_list', name='object_list'),
)
| 1.617188 | 2 |
tests/characterisation/test_kelvin_models.py | pauliacomi/adsutils | 35 | 20541 | """
This test module has tests relating to kelvin model validations.
All functions in /calculations/models_kelvin.py are tested here.
The purposes are:
- testing the meniscus shape determination function
- testing the output of the kelvin equations
- testing that the "function getter" is performing as exp... | 2.5 | 2 |
packages/jet_bridge/jet_bridge/__main__.py | bokal2/jet-bridge | 1 | 20542 | import os
from datetime import datetime
import sys
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from jet_bridge_base import configuration
from jet_bridge.configuration import JetBridgeConfiguration
conf = JetBridgeConfiguration()
configuration.set_configuration(conf)
from jet_bridge_b... | 2.078125 | 2 |
casepro/translation.py | praekelt/helpdesk | 5 | 20543 | <reponame>praekelt/helpdesk
from __future__ import unicode_literals
from django.utils.translation import ugettext as _
from django.utils.translation import get_language as _get_language
from modeltranslation.translator import translator, TranslationOptions
from modeltranslation import utils
from nsms.text.models impor... | 1.921875 | 2 |
Booleans/4.2.4 If/4.2.5 Fix the problem.py | ferrerinicolas/python_samples | 0 | 20544 | <reponame>ferrerinicolas/python_samples<filename>Booleans/4.2.4 If/4.2.5 Fix the problem.py
can_juggle = True
# The code below has problems. See if
# you can fix them!
#if can_juggle print("I can juggle!")
#else
print("I can't juggle.")
| 2.1875 | 2 |
pytools/mpiwrap.py | nchristensen/pytools | 52 | 20545 | <reponame>nchristensen/pytools<gh_stars>10-100
"""See pytools.prefork for this module's reason for being."""
import mpi4py.rc # pylint:disable=import-error
mpi4py.rc.initialize = False
from mpi4py.MPI import * # noqa pylint:disable=wildcard-import,wrong-import-position
import pytools.prefork # pylint:disable=wron... | 1.6875 | 2 |
vlcp/service/connection/tcpserver.py | geek-plus/vlcp | 1 | 20546 | <filename>vlcp/service/connection/tcpserver.py
'''
Created on 2015/10/19
:author: hubo
'''
from vlcp.server.module import Module, api
from vlcp.event import TcpServer
from vlcp.event.runnable import RoutineContainer
from vlcp.event.connection import Client
class TcpServerBase(Module):
'''
Generic tcp server o... | 2.609375 | 3 |
make/requirements.py | Fizzadar/Kanmail | 12 | 20547 | from distutils.spawn import find_executable
from os import path
import click
from .settings import (
BASE_DEVELOPMENT_REQUIREMENTS_FILENAME,
BASE_REQUIREMENTS_FILENAME,
DEVELOPMENT_REQUIREMENTS_FILENAME,
REQUIREMENTS_FILENAME,
)
from .util import print_and_run
def _ensure_pip_tools_installed():
... | 2.125 | 2 |
integration/python/src/helper/hosts.py | ArpitShukla007/planetmint | 3 | 20548 | # Copyright © 2020 Interplanetary Database Association e.V.,
# Planetmint and IPDB software contributors.
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
# Code is Apache-2.0 and docs are CC-BY-4.0
from typing import List
from planetmint_driver import Planetmint
class Hosts:
hostnames = []
connections... | 2.46875 | 2 |
baiduspider/core/__init__.py | samuelmao415/BaiduSpider | 1 | 20549 | <filename>baiduspider/core/__init__.py
"""BaiduSpider,爬取百度的利器
:Author: <NAME>
:Licence: MIT
:GitHub: https://github.com/samzhangjy
:GitLab: https://gitlab.com/samzhangjy
TODO: 完成文档
TODO: 添加更多爬虫
"""
import json
import os
import re
from html import unescape
from pprint import pprint
from urllib.parse import quote, urlp... | 2.875 | 3 |
HY_Plotter/windReader/reader/cfosat.py | BigShuiTai/HY-CFOSAT-ASCAT-Wind-Data-Plotter | 1 | 20550 | <reponame>BigShuiTai/HY-CFOSAT-ASCAT-Wind-Data-Plotter<filename>HY_Plotter/windReader/reader/cfosat.py
import netCDF4
import numpy as np
class CFOSAT(object):
def extract(fname):
try:
init = netCDF4.Dataset(fname)
except Exception:
lats, lons, data_spd, data_dir, data_time... | 2.40625 | 2 |
example_snippets.py | kimberscott/ffmpeg-stimuli-generation | 0 | 20551 | <gh_stars>0
"""
Examples of using the functions in videotools.py to generate videos.
This file will not run as-is - it is just intended to provide reference commands you might copy and edit.
"""
import os
from videotools import *
this_path = os.path.dirname(os.path.abspath(__file__))
input_path = os.path.join(this_pa... | 3.046875 | 3 |
sample_project/env/lib/python3.9/site-packages/qtpy/tests/test_qtprintsupport.py | Istiakmorsalin/ML-Data-Science | 4 | 20552 | from __future__ import absolute_import
import pytest
from qtpy import QtPrintSupport
def test_qtprintsupport():
"""Test the qtpy.QtPrintSupport namespace"""
assert QtPrintSupport.QAbstractPrintDialog is not None
assert QtPrintSupport.QPageSetupDialog is not None
assert QtPrintSupport.QPrint... | 2.015625 | 2 |
logbook/auth.py | nicola-zanardi/personal-logbook | 0 | 20553 | from flask import Blueprint, flash, redirect, render_template, request, url_for
from werkzeug.security import check_password_hash, generate_password_hash
from flask_login import login_required, login_user, logout_user
from logbook.models import User, db
from peewee import fn
auth = Blueprint("auth", __name__)
... | 2.875 | 3 |
gecko/classes/api_handler.py | paulschick/Coingecko-Crypto-Price-API | 2 | 20554 | import aiohttp
from aiohttp import ClientConnectionError, ClientResponseError
from .models import CoinsResponse, SimplePriceResponse
from .configs import Config
from typing import List, Dict, Union
class APIHandler:
def __init__(self):
self._config: Config = Config()
async def get_supported_coins(sel... | 2.4375 | 2 |
Hello-Cifar-10/keras.py | PyTorchLightning/grid-tutorials | 0 | 20555 | from argparse import ArgumentParser
from pathlib import Path
from tensorflow import keras
# Define this script's flags
parser = ArgumentParser()
parser.add_argument('--lr', type=float, default=1e-3)
parser.add_argument('--batch_size', type=int, default=32)
parser.add_argument('--max_epochs', type=int, default=5)
pars... | 2.421875 | 2 |
src/taskmaster/client.py | alex/taskmaster | 2 | 20556 | """
taskmaster.consumer
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
import cPickle as pickle
import gevent
from gevent_zeromq import zmq
from gevent.queue import Queue
from taskmaster.util import import_target
class Worker(object):
def __init_... | 2.28125 | 2 |
src/loop.py | migueldingli1997/PySnake | 2 | 20557 | import pygame as pg
from pygame.time import Clock
from src.drawer import Drawer
from src.game import Game
from src.utils.config import Config
from src.utils.score import ScoresList
from src.utils.sfx import SfxHolder
from src.utils.text import Text
from src.utils.util import Util, user_quit
class Loop:
def __ini... | 2.9375 | 3 |
Medium/valid-ip-addresses.py | SaumyaRai2010/algoexpert-data-structures-algorithms | 152 | 20558 |
# VALID IP ADDRESSES
# O(1) time and space
def validIPAddresses(string):
# Write your code here.
validIPAddresses = []
if len(string) < 4:
return []
for i in range(3):
if not isValidPart(string[:i+1]):
continue
for j in range(i+1, i+4):
if not isValidPart(string[i+1:j+1]):
continue
for k ... | 3.296875 | 3 |
resnet152/configs.py | LiuHao-THU/frame2d | 1 | 20559 | <reponame>LiuHao-THU/frame2d
"""
this .py file contains all the parameters
"""
import os
configs = {}
main_dir = 'frame_vessel/resnet152'
#****************************************read data parameters**************************************
configs['max_angle'] = 20
configs['root_dir'] = 'data'
configs['save_dir'... | 2.40625 | 2 |
src/packagedcode/windows.py | Siddhant-K-code/scancode-toolkit | 1,511 | 20560 | <reponame>Siddhant-K-code/scancode-toolkit
#
# Copyright (c) nexB Inc. and others. All rights reserved.
# ScanCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/scancode-toolkit for support or downlo... | 1.835938 | 2 |
day-21/main.py | jmolinski/advent-of-code-2018 | 2 | 20561 | # decompiled-by-hand & optimized
# definitely not gonna refactor this one
# 0.18s on pypy3
ip_reg = 4
reg = [0, 0, 0, 0, 0, 0]
i = 0
seen = set()
lst = []
while True:
i += 1
break_true = False
while True:
if break_true:
if i == 1:
print("1)", reg[1])
if reg[1... | 2.046875 | 2 |
website/canvas/funnels.py | bopopescu/drawquest-web | 61 | 20562 | <reponame>bopopescu/drawquest-web
from django.conf import settings
from canvas.metrics import Metrics
class Funnel(object):
def __init__(self, name, steps):
self.name = name
self.steps = steps
def __repr__(self):
return self.name
def step_names(self):
return [step.name f... | 2.203125 | 2 |
hopfield.py | mstruijs/neural-demos | 0 | 20563 | <filename>hopfield.py
import numpy as np
from neupy import algorithms,plots
import matplotlib.pyplot as plt
from neupy.utils import format_data
from neupy.algorithms.memory.utils import bin2sign,step_function
import argparse
dhnet = algorithms.DiscreteHopfieldNetwork(mode='async', check_limit=False)
iteration = 0
outp... | 3.09375 | 3 |
client/fig_client.py | haihala/fig | 0 | 20564 | <filename>client/fig_client.py
from init import conf_parse, socket_init
from sock_ops import pull_sync, push_sync
from fs_ops import construct_tree, differences
from debug import debug_print
import time
def main():
conf = conf_parse()
sock = socket_init(conf)
debug_print("Initialization successful")
debug_print(... | 2.53125 | 3 |
TicTacToe2.py | tlively/N-TicTacToe | 6 | 20565 | # N-Dimensional Tic-Tac-Toe by <NAME>
from __future__ import division
import curses, curses.ascii, sys
# logical representation of the n-dimensional board as a single list
class Model(object):
def __init__(self, dimensions=2, size=0, players=2):
if size < 3:
size = dimensions+1
self.di... | 3.765625 | 4 |
platform-tools/systrace/catapult/devil/devil/utils/run_tests_helper.py | NBPS-Robotics/FTC-Code-Team-9987---2022 | 1,894 | 20566 | <gh_stars>1000+
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Helper functions common to native, java and host-driven test runners."""
import collections
import logging
from devil.utils import lo... | 2.03125 | 2 |
src/classical_ml/pca.py | Jagriti-dixit/CS229_Project_Final | 0 | 20567 | <reponame>Jagriti-dixit/CS229_Project_Final<filename>src/classical_ml/pca.py
import sys
import time
from comet_ml import Experiment
import pydub
import numpy as np
from pydub import AudioSegment
import librosa
import librosa.display
import matplotlib.pyplot as plt
import sklearn
from sklearn import preprocessing
from s... | 2.28125 | 2 |
API/application.py | XuhuaHuang/LearnPython | 0 | 20568 | <filename>API/application.py
from flask import Flask, jsonify, request
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///data.db'
db = SQLAlchemy(app)
class Drink(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(... | 3.46875 | 3 |
examples/mass-generation.py | Orange-OpenSource/tinypyki | 1 | 20569 | #!/usr/bin/env python
"""A third example to get started with tinypyki.
Toying with mass certificate generation.
"""
import os
import tinypyki as tiny
print("Creating a pki instance named \"mass-pki\"")
pki = tiny.PKI("mass-pki")
print("Create the \"root-ca\"")
root_ca = tiny.Node(nid = "root-ca", pathlen = 1, s... | 2.921875 | 3 |
passive_capture/reporter/admin.py | Sillson/passive_capture_py | 0 | 20570 | from django.contrib import admin
from django.contrib.gis import admin as geo_model_admin
from leaflet.admin import LeafletGeoAdmin
from .models import Forecasts, Dam, Species
# Forecast Model
class ForecastsAdmin(admin.ModelAdmin):
list_display = ('dam', 'species', 'forecast_range')
admin.site.register(Forecasts, F... | 1.609375 | 2 |
files/models.py | AdrianoCahete/website | 0 | 20571 | # -*- coding: UTF-8 -*-
# vim: set expandtab sw=4 ts=4 sts=4:
#
# phpMyAdmin web site
#
# Copyright (C) 2008 - 2016 <NAME> <<EMAIL>>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either vers... | 1.515625 | 2 |
main/models/sign.py | fakegit/gxgk-wechat-server | 1,564 | 20572 | <reponame>fakegit/gxgk-wechat-server
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from . import db
class Sign(db.Model):
__table_args__ = {
'mysql_engine': 'InnoDB',
'mysql_charset': 'utf8mb4'
}
openid = db.Column(db.String(32), primary_key=True, unique=True,
null... | 2.375 | 2 |
pinax/projects/sample_group_project/urls.py | peiwei/pinax | 1 | 20573 | from django.conf import settings
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from django.contrib import admin
admin.autodiscover()
from account.openid_consumer import PinaxConsumer
handler500 = "pinax.views.server_error"
if settings.ACCOUNT_OPEN_SIGNUP:
... | 1.9375 | 2 |
synapse/storage/schema/delta/50/make_event_content_nullable.py | Cadair/synapse | 2 | 20574 | <filename>synapse/storage/schema/delta/50/make_event_content_nullable.py<gh_stars>1-10
# -*- coding: utf-8 -*-
# Copyright 2018 New Vector Ltd
#
# 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
... | 2.21875 | 2 |
tools/applause_detection/applause_detection.py | AudiovisualMetadataPlatform/amp_mgms | 0 | 20575 | <reponame>AudiovisualMetadataPlatform/amp_mgms
#!/usr/bin/env python3
import os
import os.path
import shutil
import subprocess
import sys
import tempfile
import argparse
import amp.utils
def main():
#(root_dir, input_audio, min_segment_duration, amp_segments) = sys.argv[1:5]
parser = argparse.ArgumentParser... | 2.484375 | 2 |
5_Pham_Ngo_Tien_Dung/3.1.py | lpython2006e/exercies | 0 | 20576 | """Write a program that allow user enter a file name (path) then content, allow user to save it"""
filename = input("Please input filename")
f= open(filename,"w+")
content = input("Please input content")
f.write(content) | 4.09375 | 4 |
2019/intcode/intcode/tests/test_intcode.py | Ganon11/AdventCode | 0 | 20577 | <filename>2019/intcode/intcode/tests/test_intcode.py
import intcode
def test_default_constructor(): # pylint: disable=C0116
values = [0, 1, 2, 0, 99]
program = intcode.IntCodeProgram(values)
assert program.instruction_pointer == 0
assert program.memory == values
def test_noun_verb(): # pylint: disable=C0116
... | 2.6875 | 3 |
tests/test_DataAugmenterExternally.py | AlexKay28/zarnitsa | 8 | 20578 | import os
import sys
import pytest
import numpy as np
import pandas as pd
from scipy.stats import ks_2samp
sys.path.append("zarnitsa/")
from zarnitsa.stats import DataAugmenterExternally
N_TO_CHECK = 500
SIG = 0.5
@pytest.fixture
def dae():
return DataAugmenterExternally()
@pytest.fixture
def normal_data()... | 2.28125 | 2 |
cgc/Collision.py | Jfeatherstone/ColorGlass | 0 | 20579 | from .Wavefunction import Wavefunction
import numpy as np
from scipy.fft import ifft2, fft2
import numba
CACHE_OPTIMIZATIONS = True
class Collision():
targetWavefunction = None # Implements wilson line
incidentWavefunction = None # Doesn't (have to) implement wilson line
_omega = None
_omegaFFT = ... | 3.03125 | 3 |
fastagram/tags/models/__init__.py | dobestan/fastagram | 1 | 20580 | <filename>fastagram/tags/models/__init__.py
from .tag import Tag
| 1.140625 | 1 |
tensorflow/contrib/model_pruning/python/learning.py | uve/tensorflow | 0 | 20581 | <gh_stars>0
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | 2.140625 | 2 |
run2.py | akuz/deep-gen-mnist | 0 | 20582 |
import numpy as np
import tensorflow as tf
import model
if __name__ == "__main__":
print("Making level configs...")
level_configs = model.default_level_configs()
print("Making filter variables...")
filters = model.make_filters(tf.get_default_graph(), level_configs)
print("Done")
| 2.453125 | 2 |
payload_templates/lin_shell_payload.py | ahirejayeshbapu/python-shell | 4 | 20583 | import subprocess, os, socket, re, pickle, docx, urllib2
from platform import platform
from getpass import getuser
from time import sleep
from datetime import datetime
port = !!!!!
ip_addr = @@@@@
lkey = #####
End = $$$$$
skey = %%%%%
time_to_sleep = ^^^^^
type_of_scout = 'Command Shell'
try:
operati... | 2.390625 | 2 |
scripts/python/make-dist-cfg.py | brakmic/cm3 | 2 | 20584 | <gh_stars>1-10
#! /usr/bin/env python
from pylib import *
CopyConfigForDistribution(InstallRoot)
| 0.9375 | 1 |
bench.py | citorva/verificateur_defis_leviathan | 0 | 20585 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pygame
import threading
import time
import math
import sys
import argparse
import bench_core
import multiprocessing
# Couleurs du programme. Peut être modifié à tout moment
couleur_txt = (0xc0, 0xc0, 0xc0) # Couleur gris clair pour le texte commun
coul... | 1.96875 | 2 |
test/conftest.py | PlaidCloud/sqlalchemy-greenplum | 6 | 20586 | <gh_stars>1-10
from sqlalchemy.dialects import registry
registry.register("greenplum", "sqlalchemy_greenplum.dialect", "GreenplumDialect")
from sqlalchemy.testing.plugin.pytestplugin import *
| 1.117188 | 1 |
xclim/core/locales.py | bzah/xclim | 0 | 20587 | <reponame>bzah/xclim
# -*- coding: utf-8 -*-
# noqa: D205,D400
"""
Internationalization
====================
Defines methods and object to help the internationalization of metadata for the
climate indicators computed by xclim.
All the methods and objects in this module use localization data given in json files.
These... | 2.359375 | 2 |
tests/samples/importing/nested/base.py | machinable-org/machinable | 23 | 20588 | <filename>tests/samples/importing/nested/base.py
from machinable import Component
class BaseComponent(Component):
"""Base component"""
| 1.523438 | 2 |
source/blockchain_backup/config/gunicorn.conf.py | denova-com/blockchain-backup | 0 | 20589 | <gh_stars>0
# See
# The configuration file should be a valid Python source file with a python extension (e.g. gunicorn.conf.py).
# https://docs.gunicorn.org/en/stable/configure.html
bind='127.0.0.1:8962'
timeout=75
daemon=True
user='user'
accesslog='/var/local/log/user/blockchain_backup.gunicorn.access.log'
erro... | 1.773438 | 2 |
code_snippets/api-monitor-schedule-downtime.py | brettlangdon/documentation | 0 | 20590 | from datadog import initialize, api
options = {
'api_key': 'api_key',
'app_key': 'app_key'
}
initialize(**options)
# Schedule downtime
api.Downtime.create(scope='env:staging', start=int(time.time()))
| 1.734375 | 2 |
src/oscar/apps/customer/__init__.py | QueoLda/django-oscar | 4,639 | 20591 | default_app_config = 'oscar.apps.customer.apps.CustomerConfig'
| 1.023438 | 1 |
modnotes/converters.py | jack1142/SinbadCogs-1 | 0 | 20592 | import contextlib
import re
from typing import NamedTuple, Optional
import discord
from redbot.core.commands import BadArgument, Context, MemberConverter
_discord_member_converter_instance = MemberConverter()
_id_regex = re.compile(r"([0-9]{15,21})$")
_mention_regex = re.compile(r"<@!?([0-9]{15,21})>$")
class Membe... | 2.53125 | 3 |
face_api/admin.py | glen-s-abraham/face-detection-api | 0 | 20593 | from django.contrib import admin
from face_api.models import KnowledgeDatabase
from face_api.models import ImageUploads
# Register your models here.
admin.site.register(KnowledgeDatabase)
admin.site.register(ImageUploads)
| 1.390625 | 1 |
plugins/base/views.py | adlerosn/corpusslayer | 0 | 20594 | <filename>plugins/base/views.py
# Copyright (c) 2017 <NAME> <<EMAIL>>
#
# MIT License
#
# 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... | 1.46875 | 1 |
addons/stats/scripts/predictors/abstract_predictor.py | Kait-tt/tacowassa | 0 | 20595 | <reponame>Kait-tt/tacowassa
# coding:utf-8
from abc import ABCMeta, abstractmethod
class AbstractPredictor(metaclass=ABCMeta):
@classmethod
@abstractmethod
def predicate(cls, tasks, user_id, cost):
pass
| 2.15625 | 2 |
day11/eqatri.py | nikhilsamninan/python-files | 0 | 20596 | size = 5
m = (2 * size)-2
for i in range(0, size):
for j in range(0, m):
print(end=" ")
m = m - 1
for j in range(0, i + 1):
if(m%2!=0):
print("*", end=" ")
print("") | 3.78125 | 4 |
tests/test_constants.py | 9cat/dydx-v3-python | 0 | 20597 | from dydx3.constants import SYNTHETIC_ASSET_MAP, SYNTHETIC_ASSET_ID_MAP, ASSET_RESOLUTION, COLLATERAL_ASSET
class TestConstants():
def test_constants_have_regular_structure(self):
for market, asset in SYNTHETIC_ASSET_MAP.items():
market_parts = market.split('-')
base_token, quote_t... | 2.59375 | 3 |
src/cogs/invasion.py | calsf/codex-prime | 0 | 20598 | #INVASION COMMANDS:
# !invasions // !atinvasions <reward> // !rminvasions
import discord
from discord.ext import commands
import asyncio
from src import sess
class Invasions(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.alert_dict = {} # user: reward, list of prev invasions with ... | 2.765625 | 3 |
samples-python/datalayer.calc/calculations/__init__.py | bracoe/ctrlx-automation-sdk | 16 | 20599 | <reponame>bracoe/ctrlx-automation-sdk<gh_stars>10-100
__version__ = '2.0.0'
__description__ = 'Sample for calculations with data from the ctrlX Data Layer'
__author__ = 'Fantastic Python Developers'
__licence__ = 'MIT License'
__copyright__ = 'Copyright (c) 2021 Bosch Rexroth AG' | 1.25 | 1 |