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 |
|---|---|---|---|---|---|---|
run_length_encoding.py | wolfd/jpeg-svg | 0 | 24700 | <reponame>wolfd/jpeg-svg<gh_stars>0
import typing as T
import numpy as np
def decode_run_length(compressed: T.Iterable[int]):
compressed
| 1.710938 | 2 |
pdf2data/data.py | inducer/pdf2data | 11 | 24701 | __copyright__ = "Copyright (C) 2019 <NAME>"
__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 rights
to use, copy, modify, mer... | 1.898438 | 2 |
exact/exact/tagger_messages/management/commands/testdb.py | maubreville/Exact | 43 | 24702 | <reponame>maubreville/Exact
from django.core.management.base import BaseCommand
from exact.users.models import User, Team, TeamMembership
from exact.tagger_messages.models import TeamMessage, GlobalMessage
from datetime import timedelta
from django.utils import timezone
from random import randint
from faker import Fake... | 2.046875 | 2 |
Libraries/Simplynet.py | frknayk/WeightVis | 2 | 24703 | <reponame>frknayk/WeightVis
import numpy as np
import pickle
from Libraries.Enums import NNLibs
from Libraries.Reader import Reader
#TODO Complete read() function for SimplyNet
#TODO SimplyNet init(self,path) - path should go to read's parameter(like torch)
class SimplyNet(Reader):
def __init__(self,path):
... | 2.546875 | 3 |
code/python/archive/c0103_timestamp_records.py | jesnyder/MeasuredStress | 0 | 24704 | <reponame>jesnyder/MeasuredStress<filename>code/python/archive/c0103_timestamp_records.py
from datetime import datetime
from dateutil import tz
import glob
import os
import pandas as pd
import sys
import time
def timestamp_records():
"""
"""
print("running format_source")
sensors = ['EDA', 'HR', '... | 2.6875 | 3 |
NVIDIA/benchmarks/ssd/implementations/pytorch/utils.py | goswamig/training_results_v0.7 | 48 | 24705 | <gh_stars>10-100
# MIT License
#
# Copyright (c) 2018 kuangliu
#
# 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... | 1.210938 | 1 |
src/rubinlander/parsers/lsstdoc/__init__.py | lsst-sqre/rubin-lander-plugin | 0 | 24706 | from rubinlander.parsers.lsstdoc.parser import LsstDocParser
__all__ = ["LsstDocParser"]
| 1.273438 | 1 |
network/__init__.py | nivilo/Chase | 68 | 24707 | import abc
from config import MODEL_DIR
class Network:
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
self.model = None
self.model_history = None
self.X_train = None
self.X_test = None
self.y_train = None
self.y_test = None
@abc.a... | 2.953125 | 3 |
rdfdatabank/lib/reqclassifier.py | dataflow/RDFDatabank | 4 | 24708 | # -*- coding: utf-8 -*-
"""
Copyright (c) 2012 University of Oxford
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, modif... | 1.578125 | 2 |
gui/apod_linux_config.py | danahynes/APOD_Linux | 0 | 24709 | #!/usr/bin/env python3
#------------------------------------------------------------------------------#
# Filename: apod_linux_config.py / \ #
# Project : APOD_Linux | () | #
# Date : 06/23/2021 ... | 2.1875 | 2 |
setup.py | marianaalbano/python_mail | 0 | 24710 | <filename>setup.py
#!/usr/bin/python3
#-*- coding: utf-8 -*-
import setuptools
longdesc = """
Esse módulo foi criado com o objetivo de realizar a busca de mensagens na caixa de e-mail de forma
simplificada e intuitiva utilizando o módulo imaplib para conexão.
A instalação pode ser feita utilizando:
``pip install gi... | 1.867188 | 2 |
visualize/MultiPersonVisualizer/Scene.py | ys1998/motion-forecast | 0 | 24711 | import vtk
class Scene(object):
def __init__(self):
self.sceneSources = list()
self.sceneMappers = list()
self.sceneActors = list()
self.sceneLights = list()
self.sceneSources.append(vtk.vtkCubeSource())
self.sceneSources[-1].SetXLength(50000)
self.sceneSou... | 2.40625 | 2 |
db-scripts/refseq.py | Zorino/BacterialDB-Fetcher | 6 | 24712 | <filename>db-scripts/refseq.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: <NAME>
# email: <EMAIL>
# date: 2017-08-24
# version: 0.01
from subprocess import call
import os
import argparse
import gzip
import re
import glob
from Bio import SeqIO
#from Bio.SeqFeature import FeatureLocation
def open_f... | 2.25 | 2 |
cobras_ts/notebookquerier_images.py | achenbachsven/learningSkript | 0 | 24713 | import sys
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import random
from cobras_ts.querier import Querier
from IPython import display
def _query_yes_no(question, default="yes"):
"""Ask a yes/no question via raw_input() and return their answer.
"question" is a string that is presented t... | 3.59375 | 4 |
train.py | yjang43/WaveNet | 0 | 24714 | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from dataclasses import dataclass
from argparse import ArgumentParser
from tqdm import tqdm
from torch.utils.data import DataLoader
from data import VCTKAudio
from model import WaveNet
def set_option():
parse... | 2.03125 | 2 |
swmmio/version_control/tests/compare_inp.py | jennwuu/swmmio | 76 | 24715 | import os
def remove_comments_and_crlf(inp_path, comment_string=';', overwrite=False):
tmpfilename = os.path.splitext(os.path.basename(inp_path))[0] + '_mod.inp'
tmpfilepath = os.path.join(os.path.dirname(inp_path), tmpfilename)
with open (inp_path) as oldf:
with open(tmpfilepath, 'w') as newf:
... | 3.0625 | 3 |
codeforces/math数学/1000/1023B两个玩具.py | yofn/pyacm | 0 | 24716 | <gh_stars>0
#!/usr/bin/env python3
# https://codeforces.com/problemset/problem/1023/A
def f(ll):
n,k = ll #1e14
f = k//2 + 1
e = min(k-1,n)
return max(0,e-f+1)
l = list(map(int,input().split()))
print(f(l))
| 2.765625 | 3 |
nwb/combine_messages.py | bendichter/api-python | 32 | 24717 | import re
import pprint
pp = pprint.PrettyPrinter(indent=4)
from sys import version_info # py3, for checking type of input
def combine_messages(messages):
""" Combines messages that have one or more integers in them, such as
"trial001" "trial002", into a single message like "trial# (#=1-2)".
Thi... | 3.921875 | 4 |
webapp/app/encryptioncontext/migrations/0001_initial.py | aws-samples/aws-secrets-manager-credential-rotation-without-container-restart | 3 | 24718 | # Generated by Django 3.0.1 on 2020-01-02 22:21
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='CustomerProfile',
fields=[
('id', models.Au... | 1.875 | 2 |
spec/python/test_cast_nested.py | DarkShadow44/kaitai_struct_tests | 11 | 24719 | <filename>spec/python/test_cast_nested.py<gh_stars>10-100
# Autogenerated from KST: please remove this line if doing any edits by hand!
import unittest
from cast_nested import CastNested
class TestCastNested(unittest.TestCase):
def test_cast_nested(self):
with CastNested.from_file('src/switch_opcodes.bin... | 2.625 | 3 |
application/__init__.py | ppawlo97/si-summer-2020 | 0 | 24720 | import logging
logging.basicConfig(level=logging.INFO)
from flask import Flask
from application.config import Config
app = Flask(__name__)
app.config.from_object(Config)
from application.models.classifiers.CNNClassifier import CNNClassifier
from application.models.classifiers.MLPClassifier import MLPClassifier
fro... | 2.0625 | 2 |
mpf/devices/ball_device/ball_device_state_handler.py | Wolfmarsh/mpf | 0 | 24721 | <reponame>Wolfmarsh/mpf
"""Base class for ball device handlers."""
import asyncio
from mpf.core.utility_functions import Util
class BallDeviceStateHandler:
"""Base class for ball device handler."""
__slots__ = ["ball_device", "machine", "_task"]
def __init__(self, ball_device):
"""Initialise h... | 2.3125 | 2 |
valtypes/__init__.py | vanburgerberg/constypes | 2 | 24722 | from .validator import (
And,
Attr,
Chain,
Const,
Contains,
ExcMax,
ExcMin,
Float,
Macro,
Max,
Min,
MultipleOf,
Not,
Or,
Pattern,
Proto,
Type,
Validator,
Xor,
)
__all__ = [
"And",
"Attr",
"Chain",
"Const",
"Validator",
... | 1.585938 | 2 |
ml_techniques/tests/tests.py | tgquintela/ml_techniques_in_python | 0 | 24723 | import numpy as np
import unittest
from itertools import product
from ml_techniques.svm import *
class PermutationDataTest(unittest.TestCase):
def testpropershape(self):
data = np.random.random((10, 4))
labels = np.random.randint(0, 2, 10)*2-1
data_per = permut_data(data)
self.a... | 2.5625 | 3 |
deps/deno/repository.bzl | y0psolo/YAD | 1 | 24724 | <reponame>y0psolo/YAD
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def deno_repository():
# Get Deno archive
http_archive(
name = "deno-amd64",
build_file = "//ext/deno:BUILD",
sha256 = "7b883e3c638d21dd1875f0108819f2f13647b866ff24965135e679c743013f46",
t... | 1.695313 | 2 |
src/oci/ai_vision/models/detected_language.py | LaudateCorpus1/oci-python-sdk | 0 | 24725 | <reponame>LaudateCorpus1/oci-python-sdk<gh_stars>0
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at ht... | 1.960938 | 2 |
source-code/Word Ladder 127.py | ttungl/Coding-Interview-Challenge | 0 | 24726 | <reponame>ttungl/Coding-Interview-Challenge
# 127. Word Ladder
# <EMAIL>
# Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that:
# Only one letter can be changed at a time.
# Each transformed word must exist in t... | 3.75 | 4 |
lexer/groovylexer.py | rhyolight/pygments-groovy | 1 | 24727 | # -*- coding: utf-8 -*-
"""
Lexer for the Groovy programming language
http://groovy.codehaus.org
"""
from pygments.lexer import RegexLexer
class GroovyLexer(RegexLexer):
"""
For `Groovy <http://groovy.codehaus.org/>`_ source code.
"""
name = 'Groovy'
aliases = ['groovy']
filenames = [... | 2.375 | 2 |
official/nlp/modeling/layers/cls_head.py | e10101/models | 1 | 24728 | <gh_stars>1-10
# Copyright 2021 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 requ... | 2.640625 | 3 |
oembed/migrations/0001_initial.py | EightMedia/djangoembed | 8 | 24729 | <filename>oembed/migrations/0001_initial.py
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.conf import settings
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'StoredOEmbed'
... | 2.015625 | 2 |
cntr/service/receive.py | ethan-iai/tour-recmd | 2 | 24730 | <reponame>ethan-iai/tour-recmd<filename>cntr/service/receive.py
import xml.etree.ElementTree as ET
from cntr.service.base import TextMsg, ImageMsg, LocationMsg, VoiceMsg
class ReceiveHandler(object):
def __init__(self):
self._type_class_map = {
'text' : TextMsg,
'image' : Image... | 2.484375 | 2 |
algorithms/allergies/__init__.py | JASTYN/pythonmaster | 3 | 24731 | class Allergies(object):
ALLERGY_SCORES = {
'eggs': 1,
'peanuts': 2,
'shellfish': 4,
'strawberries': 8,
'tomatoes': 16,
'chocolate': 32,
'pollen': 64,
'cats': 128
}
def __init__(self, score):
if score is None or not isinstance(score, i... | 4.0625 | 4 |
pages/data_upload.py | irzaip/selevaporum | 0 | 24732 | import collections
from numpy.core.defchararray import lower
import streamlit as st
import numpy as np
import pandas as pd
from pages import utils
def app():
st.title("Data Storyteller Application")
st.markdown("## Data Upload")
# Upload the dataset and save as csv
st.markdown("### Upload ... | 3.671875 | 4 |
uso_red/migrations/0001_initial.py | joelsegoviacrespo/control_aforo_migrado | 0 | 24733 | <filename>uso_red/migrations/0001_initial.py
# Generated by Django 2.2.13 on 2020-11-26 03:26
from django.db import migrations, models
import djongo.models.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
nam... | 1.515625 | 2 |
sweep_builder/scorable.py | panoramichq/data-collection-fb | 0 | 24734 | <reponame>panoramichq/data-collection-fb
import logging
from collections import defaultdict
from typing import Iterable, Generator, Optional
from pynamodb.exceptions import DoesNotExist
from common.enums.entity import Entity
from common.enums.jobtype import detect_job_type
from config.application import PERMANENTLY_... | 1.875 | 2 |
import_em.py | kaija/taiwan_stockloader | 2 | 24735 | #!/usr/bin/python
import datetime
import httplib
import urllib
import redis
import json
from datetime import timedelta
#now = datetime.datetime.now();
#today = now.strftime('%Y-%m-%d')
#print today
rdb = redis.Redis('localhost')
def rv(value):
out = ""
for num in value.strip().split(","):
out+=num
return out
de... | 2.921875 | 3 |
LaserController/InterfaceGUI.py | ColdMatter/PhotonBEC | 0 | 24736 | <gh_stars>0
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'InterfaceGUI.ui'
#
# Created: Mon Mar 11 15:56:47 2013
# by: PyQt4 UI code generator 4.9.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtWidgets
try:
from PyQt5 import QtCore,... | 2 | 2 |
src/sportsdata/nba/teams/washington_wizards.py | OrangeCardinal/sportsdata | 0 | 24737 | <filename>src/sportsdata/nba/teams/washington_wizards.py
from sports.nba.nba_team import NBA_Team
class WashingtonWizards(NBA_Team):
"""
NBA's Washington Wizards Static Information
"""
full_name = "<NAME>"
name = "Wizards"
team_id = 1610612764
def __init__(self):
"""
"""
... | 2.296875 | 2 |
modules/text/sentiment_analysis/senta_cnn/net.py | Steffy-zxf/HubModule | 0 | 24738 | # -*- coding:utf-8 -*-
import paddle.fluid as fluid
def cnn_net(data,
dict_dim,
emb_dim=128,
hid_dim=128,
hid_dim2=96,
class_dim=2,
win_size=3):
"""
Conv net
"""
# embedding layer
emb = fluid.layers.embedding(
input=da... | 2.734375 | 3 |
test/test_scripts.py | JulianKarlBauer/orientation_averaging_mean_field | 0 | 24739 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import runpy
import os
import pytest
import glob
THIS_FILES_DIR_PATH = os.path.realpath(os.path.dirname(__file__))
def get_paths_of_scripts():
exclude_sub_strings = ["do_not_execute"]
plot_script_paths = glob.glob(
os.path.join(
os.path.dirna... | 2.203125 | 2 |
python/brainvisa/maker/components_definition.py | brainvisa/brainvisa-cmake | 0 | 24740 | <filename>python/brainvisa/maker/components_definition.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import sys
# groups:
# anatomist: projects needed for anatomist (aims, soma-io and dependencies)
# opensource
# brainvisa: public brainvisa distro
# bvdev: same as brainvisa but excludes ... | 1.617188 | 2 |
examples/hashtrees.py | ascribe/transactions | 124 | 24741 | # -*- coding: utf-8 -*-
"""
Inspired by:
* https://gist.github.com/shirriff/c9fb5d98e6da79d9a772#file-merkle-py
* https://github.com/richardkiss/pycoin
"""
from __future__ import absolute_import, division, unicode_literals
from builtins import range
import binascii
import hashlib
def merkleroot(hashes):
... | 2.53125 | 3 |
test/test_del_contact_from_group.py | julipavlovich/python_training | 0 | 24742 | <gh_stars>0
from model.contact import Contact
from model.group import Group
import random
def test_add_contact_in_group(app, db):
if len(db.get_contact_list()) == 0:
app.contact.create(Contact(firstname="ADDNewFirstName1", lastname="ADDNewLastName1"))
if len(db.get_group_list()) == 0:
app.grou... | 2.453125 | 2 |
test.py | termistotel/CherryPyStuff | 0 | 24743 | import dill as pickle
import cherrypy
homeLocation = '/home/alion/Projekti/cherrypyTest'
rootConfig = {'/': {'log.screen': False,
'log.access_file': homeLocation+'/logs/access_file.log',
'log.error_file': homeLocation+'/logs/error_file.log',
'tools.sessions.on': True,
... | 2.546875 | 3 |
main/admin.py | ericrobskyhuntley/vialab.mit.edu | 0 | 24744 | from django.contrib import admin
from simple_history.admin import SimpleHistoryAdmin
from .models import MainMetadata
# Register your models here.
admin.site.register(MainMetadata, SimpleHistoryAdmin) | 1.328125 | 1 |
FEArena/feaapi/api/skills/helper.py | Superbird11/FEArena | 1 | 24745 | from typing import Iterable as Iterable, List, Dict, Callable, Iterator, Set, Optional
from ...models.core.Unit import Unit
from ...models.core.Class import Class
from ...models.core.Weapon import Weapon
from ...models.core.Item import Item
from ...models.core.Skill import Skill
from ...models.play.ActiveArena import A... | 2.5625 | 3 |
source/bazel/deps/libevent/get.bzl | luxe/CodeLang-compiler | 1 | 24746 | # Do not edit this file directly.
# It was auto-generated by: code/programs/reflexivity/reflexive_refresh
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
def libevent():
http_archive(
name = "libevent",
build_fi... | 1.367188 | 1 |
pygsti/modelmembers/states/cptpstate.py | colibri-coruscans/pyGSTi | 0 | 24747 | """
The CPTPState class and supporting functionality.
"""
#***************************************************************************************************
# Copyright 2015, 2019 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
# Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Govern... | 1.828125 | 2 |
examples/mach_opt_examples/LegacyCode/IM/machine_design/im_settingshandler.py | Severson-Group/MachEval | 6 | 24748 | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 30 11:58:20 2021
@author: <NAME>
"""
import sys
sys.path.append("...")
import macheval as me
class IMSettingsHandler(me.SettingsHandler):
def getSettings(x):
return NotImplementedError #TODO Implement settings functionality
| 2 | 2 |
scripts/cerealfiller_entity_and_test_pipeline.py | sedgewickmm18/functions | 0 | 24749 | import datetime as dt
import json
import os
import pandas as pd
from sqlalchemy import Column, Integer, String, Float, DateTime, Boolean, func
from iotfunctions.preprocessor import BaseTransformer
from iotfunctions.bif import IoTExpression
from iotfunctions.metadata import EntityType, make_sample_entity
from iotfunctio... | 2.484375 | 2 |
minst/tests/helpers.py | oriolromani/minst-dataset | 44 | 24750 | <gh_stars>10-100
import pytest
import os
import numpy as np
import minst.taxonomy as tax
def __test(value, expected):
assert value == expected
def __test_df_has_data(df):
assert not df.empty
def __test_pd_output(pd_output, dataset):
"""Make sure all the files in the tree exist"""
# Check for vali... | 2.609375 | 3 |
pwncat/modules/linux/enumerate/system/selinux.py | Mitul16/pwncat | 1,454 | 24751 | #!/usr/bin/env python3
from typing import Dict
import rich.markup
from pwncat.db import Fact
from pwncat.platform.linux import Linux
from pwncat.modules.enumerate import Schedule, EnumerateModule
class SELinuxState(Fact):
def __init__(self, source, state, status):
super().__init__(source=source, types=[... | 2.328125 | 2 |
rally_openstack/task/scenarios/gnocchi/archive_policy_rule.py | jogeo/rally-openstack | 0 | 24752 | # Copyright 2017 Red Hat, Inc. <http://www.redhat.com>
#
# 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 b... | 1.695313 | 2 |
count words problem/count_words.py | silasjimmy/Machine-Learning-course | 0 | 24753 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 21 08:20:55 2021
@author: silasjimmy
"""
def count_words(s, n):
s = s.split(' ')
counted_words = [(w, s.count((w))) for w in set(s)]
counted_words.sort(key = lambda x: (-x[1], x[0]))
top_n = counted_words[:n]
return top_n
def t... | 4.1875 | 4 |
segitiga/hitung-luas-segitiga.py | Yurimahendra/latihan-big-data | 0 | 24754 | # jumlah segitiga
n = 123
# panjang alas sebuah segitiga
alas = 30
# tinggi sebuah segitiga
tinggi = 18
# hitung luas sebuah segitiga
luas = alas * tinggi * 1/2
# hitung luas total
luastotal = n * luas
print('luas total : ', luastotal,'satuan luas') | 2.53125 | 3 |
pygooglehomenotifier/googlehomenotifier.py | k-sh/pygooglehomenotifier | 0 | 24755 | import queue
import textwrap
import threading
import time
import urllib.parse
import pychromecast
def create_notify_url(text: str, lang: str, ttsspeed: float):
payload = {
"ie": "UTF-8",
"q": text,
"tl": lang,
"total": 1,
"idx": 0,
"textlen": ... | 3 | 3 |
django_tgbot/types/userprofilephotos.py | purwowd/django-tgbot | 52 | 24756 | from . import BasicType
class UserProfilePhotos(BasicType):
fields = {
'total_count': int,
}
def __init__(self, obj=None):
super(UserProfilePhotos, self).__init__(obj)
from . import photosize
UserProfilePhotos.fields.update({
'photos': {
'class': photosize.PhotoSize,
... | 2.453125 | 2 |
pyexocross/exomol/exomoldef.py | ucl-exoplanets/pyexocross | 0 | 24757 | from taurex.log import Logger
class LinesReader:
def __init__(self, lines):
self._lines = lines
self._count = 0
def skip(self, num=1):
self._count += num
def read_int(self, skip=1):
val = int(self._lines[self._count])
self.skip(skip)
return val
... | 2.390625 | 2 |
web_parsers/parsers/base.py | invanalabs/web-parser | 1 | 24758 | <gh_stars>1-10
import logging
logger = logging.getLogger(__name__)
class ParserBase:
selector_key = None
def __init__(self, string_data, url=None, extractor_manifest=None):
self.string_data = string_data
self.url = url
self.extractor_manifest = extractor_manifest
def parse_dat... | 3.078125 | 3 |
kolejka/judge/tasks/list_files.py | zielinskit/kolejka-judge | 0 | 24759 | <gh_stars>0
import glob
import itertools
from functools import partial
from typing import Tuple, Optional
from kolejka.judge.tasks.base import TaskBase
class ListFiles(TaskBase):
def __init__(self, *args, variable_name):
self.files = list(args)
self.variable_name = variable_name
def execute(... | 2.25 | 2 |
backend/server/server.py | dballesteros7/starthack2016 | 0 | 24760 | import os
import json
from flask_sqlalchemy import SQLAlchemy
from flask import Flask, request, jsonify
from flask.views import MethodView
from flask.ext.cors import CORS
from database import ElasticStorage, RedisClient
from article import Article as ESArticle
app = Flask(__name__)
CORS(app)
#sql_config = json.loads(... | 2.109375 | 2 |
py/qaviton/scripts/create.py | qaviton/qaviton | 9 | 24761 | import os
from qaviton.utils import filer
from qaviton.utils import path
from qaviton.utils.operating_system import s
from qaviton.version import __version__
cwd = os.getcwd()
examples = path.of(__file__)('examples')
def initial_msg(f):
def dec(*args, **kwargs):
print("""
QAVITON VERSION {}
... | 2.34375 | 2 |
fpga_isp/debayer/base.py | antmicro/fpga-isp-core | 4 | 24762 | from migen import *
import math
from litex.soc.interconnect.csr import *
from litex.soc.interconnect import stream
class DemosaicBase(Module):
def first_pix(self):
return [If(self.first_pixel,
NextValue(self.rgb_first,1),
NextValue(self.first_pixel,0),
).Else(
... | 2.203125 | 2 |
tests/pipeline/test_buyback_auth.py | colin1alexander/zipline | 0 | 24763 | """
Tests for the reference loader for Buyback Authorizations.
"""
from functools import partial
from unittest import TestCase
import blaze as bz
from blaze.compute.core import swap_resources_into_scope
from contextlib2 import ExitStack
import pandas as pd
from six import iteritems
from zipline.pipeline.common import... | 2.078125 | 2 |
learnMongo/mongoInsert.py | huobingli/pyAlgorithm | 0 | 24764 | import pymongo
from bson.objectid import ObjectId
# mongo 增加
def main():
client = pymongo.MongoClient(host='172.16.17.32', port=27017)
db = client.test
collection = db.students
# 插入一条数据
student = {
'id': '20170101',
'name': 'Kevin',
'age': 20,
'gender': 'male'
... | 3.296875 | 3 |
gerrymander/operations.py | agx/gerrymander | 1 | 24765 | #
# Copyright (C) 2014 Red Hat, Inc
#
# 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 wr... | 2.1875 | 2 |
main.py | pystokes/mnist | 0 | 24766 | <filename>main.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import datetime as dt
import json
from pathlib import Path
import torch
import torch.nn as nn
from torch import optim
from libs.data_loader import create_mnist_data_loader
from libs.model import CNN
from libs.trainer import train, test
def main(config)... | 2.671875 | 3 |
ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/status_params.py | kennyballou/ambari | 0 | 24767 | <filename>ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/status_params.py
#!/usr/bin/env python
"""
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 co... | 1.640625 | 2 |
src/pyuwds3/types/vector/scalar_stable.py | LAAS-HRI/uwds3 | 2 | 24768 | import rospy
import numpy as np
import cv2
class ScalarStable(object):
"""Represents a stabilized scalar"""
def __init__(self,
x=.0,
vx=.0,
p_cov=.03, m_cov=.01,
time=None):
"""ScalarStabilized constructor"""
self.x = x
... | 3.1875 | 3 |
drest/api.py | derks/drest | 9 | 24769 | """dRest core API connection library."""
import re
from . import interface, resource, request, serialization, meta, exc
from . import response
class API(meta.MetaMixin):
"""
The API class acts as a high level 'wrapper' around multiple lower level
handlers. Most of the meta arguments are optionally passed... | 2.140625 | 2 |
ExIt/Expert/BaseExpert.py | LarsChrWiik/Expert-Iteration-Algorithmic-Comparison | 1 | 24770 |
from ExIt.Apprentice import BaseApprentice
from Games.GameLogic import BaseGame
class BaseExpert:
""" Class for the tree search algorithm used for policy improvement """
def __init__(self):
self.__name__ = type(self).__name__
def search(self, state: BaseGame, predictor: BaseApprentice, search_t... | 2.75 | 3 |
monasca_common/kafka_lib/partitioner/base.py | zhangjm12/monasca-common | 26 | 24771 | <filename>monasca_common/kafka_lib/partitioner/base.py
# 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 ag... | 2.5625 | 3 |
tests/test_options.py | inmanta/pytest-inmanta | 0 | 24772 | <gh_stars>0
"""
Copyright 2020 Inmanta
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 a... | 1.78125 | 2 |
PyFSM/pyfsm/elements/state_unit_tests.py | wafec/wafec-py-fsm | 0 | 24773 | <gh_stars>0
import unittest
from pyfsm.elements import *
class StateUnitSimpleFsmTests(unittest.TestCase):
def setUp(self):
self.fsm = StateUnit()
self.state1 = StateUnit()
self.state2 = StateUnit()
self.link1 = LinkElement()
self.fsm.starters = [self.state1]
self.... | 2.453125 | 2 |
data_extraction.py | Qnouro/Gdelt-analysis | 6 | 24774 | #!/usr/bin/env python
import os
import sys
import sqlite3
import pandas as pd
import numpy as np
from scraper import create_data_folder, read_config
from collections import OrderedDict
def main():
"""
Mainly for debugging purposes.
"""
config_file = read_config()
# Pick a file
try:
c... | 3.296875 | 3 |
predict_with_ssd7.py | esp32wrangler/ssd_keras | 0 | 24775 | <gh_stars>0
from keras.optimizers import Adam
from keras.callbacks import ModelCheckpoint, EarlyStopping, ReduceLROnPlateau, TerminateOnNaN, CSVLogger
from keras import backend as K
from keras.models import load_model
from math import ceil
import numpy as np
from matplotlib import pyplot as plt
from models.keras_ssd7 ... | 2.015625 | 2 |
deploy/__init__.py | gaocegege/treadmill | 2 | 24776 | <gh_stars>1-10
"""Ansible playbooks init"""
| 0.722656 | 1 |
a1/ANN.py | mishless/LearningSystems | 1 | 24777 | <reponame>mishless/LearningSystems
#Artificial Neural Network
#includes
import configparser
import math
import matplotlib.pyplot as plt
import numpy as np
import random
from decimal import *
#global variables
weights = [];
topology = [];
data_training = [];
data_test = [];
learning_rate = 0;
weight_min = 0;
weight_m... | 2.90625 | 3 |
Python/CodingBat/string_times.py | dvt32/cpp-journey | 1 | 24778 | # http://codingbat.com/prob/p193507
def string_times(str, n):
result = ""
for i in range(0, n):
result += str
return result
| 3.46875 | 3 |
app/service/plugin_svc.py | muyenzo/caldera | 0 | 24779 | from app.service.base_service import BaseService
class PluginService(BaseService):
def __init__(self, plugins):
self.plugins = plugins
self.log = self.add_service('plugin_svc', self)
def get_plugins(self):
return self.plugins
| 2.140625 | 2 |
tests/node_io/test_ethernet.py | SpiNNakerManchester/nengo_spinnaker | 13 | 24780 | import nengo
import pytest
from nengo_spinnaker.builder import Model
from nengo_spinnaker.builder.ports import OutputPort, InputPort
from nengo_spinnaker.node_io import ethernet as ethernet_io
from nengo_spinnaker.operators import SDPReceiver, SDPTransmitter
@pytest.mark.parametrize("transmission_period", [0.001, 0.... | 2.328125 | 2 |
aliyun/log/logclient.py | SeraphLiu/aliyun-log-sdk-python | 0 | 24781 | #!/usr/bin/env python
# encoding: utf-8
# Copyright (C) Alibaba Cloud Computing
# All rights reserved.
import sys
import requests
try:
import json
except ImportError:
import simplejson as json
try :
import logservice_lz4
except ImportError:
pass
from datetime import datetime
from... | 1.515625 | 2 |
CodeWars/Python/AlternateCase.py | BobbyRobillard/CodingChallenges | 0 | 24782 | def alternate_case(s):
# Like a Giga Chad
return "".join([char.lower() if char.isupper() else char.upper() for char in s])
# Like a Beta Male
# return s.swapcase()
# EXAMPLE AND TESTING #
input = ["Hello World", "cODEwARS"]
for item in input:
print("\nInput: {0}\nAlternate Case: {1}".format(item,... | 4.125 | 4 |
todoist_python_additions/scripts/personal.py | aagnone3/todoist-python-additions | 0 | 24783 | <reponame>aagnone3/todoist-python-additions<filename>todoist_python_additions/scripts/personal.py
#!/usr/bin/env python
import os
import todoist
import pickle
from os import path
from argparse import ArgumentParser
from todoist_python_additions.lib.state import Todoist
def build_parser():
parser = ArgumentParser... | 2.40625 | 2 |
recipe_server/recipeView.py | Shouyin/Recipe | 0 | 24784 | <gh_stars>0
from django import http
from django.shortcuts import render
from django.shortcuts import render_to_response
from . import settings
from .scripts import logic
import os
import urllib
import json
def recipe_html(request):
print(os.path.join(settings.BASE_DIR, "recipe_server/static"))
return render_to... | 2.421875 | 2 |
ua_project_transfer/wf_steps_template.py | UACoreFacilitiesIT/UA-Project_Transfer | 1 | 24785 | """A json-like master list of workflows and steps."""
# NOTE: Create a json-like dictionary in the form of:
# WF_STEPS = {
# env1: {
# 1st condition defined in next_steps: {
# 2nd condition defined in next_steps: (Workflow Name, Step Name),
# },
# },
# }
WF_STEPS = {}
| 1.507813 | 2 |
lang/python/pptv_strip.py | liuyang1/test | 8 | 24786 | import sys
fn = sys.argv[1]
fp = open(fn)
fo = open(fn+".flv","wb")
data = fp.read()
offset = int(sys.argv[2])
if len(sys.argv)==3:
fo.write(data[offset:])
else:
l = int(sys.argsv[3])
fo.write(data[offset:offset+l])
fo.close()
fp.close()
| 2.578125 | 3 |
tools/exploitation_tools.py | LucaRibeiro/pentestools | 1 | 24787 | <gh_stars>1-10
#!/usr/bin/python3
list = ["Armitage", "Backdoor Factory", "BeEF","cisco-auditing-tool",
"cisco-global-exploiter","cisco-ocs","cisco-torch","Commix","crackle",
"exploitdb","jboss-autopwn","Linux Exploit Suggester","Maltego Teeth",
"Metasploit Framework","MSFPC","RouterSploit","SET","ShellNoob","sqlmap",... | 1.171875 | 1 |
web/api/serializer/foodComment.py | bounswe/bounswe2016group2 | 10 | 24788 | from rest_framework import serializers
from api.model.foodComment import FoodComment
from api.model.food import Food
from django.contrib.auth.models import User
from api.serializer.user import UserSerializer
class FoodCommentSerializer(serializers.ModelSerializer):
comment = serializers.CharField(max_length=255... | 2.09375 | 2 |
pycccl/exchanges/binance.py | beraldoleal/pycccl | 2 | 24789 | <filename>pycccl/exchanges/binance.py
from pycccl.base import ExchangeBase
class Binance(ExchangeBase):
_public_endpoint = "https://api.binance.com/api/v1"
_private_endpoint = _public_endpoint
def get_ticker(self, ticker, against='USDT'):
pair = "{}{}".format(ticker, against)
endpoint = "... | 2.78125 | 3 |
features/feature_helpers.py | Omarzintan/bumblebee-ai | 3 | 24790 | <gh_stars>1-10
'''Contains helper functions that can be used by any feature.'''
from nltk_utils import tokenize
def get_search_query(
spoken_text,
patterns,
search_terms,
false_search_term_indicators=['like', 'love', 'want', 'ready']
):
'''
General function that extracts a search query from sp... | 3.71875 | 4 |
tests/core/test_machine.py | zionwu/rancher | 0 | 24791 | <reponame>zionwu/rancher<filename>tests/core/test_machine.py<gh_stars>0
from common import auth_check
def test_machine_fields(cclient):
fields = {
'useInternalIpAddress': 'cr',
'nodeTaints': 'r',
'nodeLabels': 'r',
'nodeAnnotations': 'r',
'namespaceId': 'cr',
'condi... | 2.0625 | 2 |
tempest/lib/services/placement/base_placement_client.py | rishabh20111990/tempest | 254 | 24792 | <reponame>rishabh20111990/tempest<filename>tempest/lib/services/placement/base_placement_client.py
# Copyright (c) 2019 Ericsson
#
# 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
#
# ... | 1.953125 | 2 |
Telegram Bot/Controllo_intenti.py | LuzDeGea/FoodHelper | 0 | 24793 | from Dialogflow_Api import rispondimi
from collegamentoSito import inserisci_utente
from Nutrition import get_food, traduzione
import re
tipo_cibo = ["frutta", "carne", "verdure", "ortaggi", "primi_piatti", "legumi"]
"""
controllo_intent(query_result, utente)--> text_respose
prende il risultato della query e lo confr... | 2.4375 | 2 |
solutions/problem_122.py | ksvr444/daily-coding-problem | 1,921 | 24794 | <reponame>ksvr444/daily-coding-problem
def get_max_coins_helper(matrix, crow, ccol, rows, cols):
cval = matrix[crow][ccol]
if crow == rows - 1 and ccol == cols - 1:
return cval
down, right = cval, cval
if crow < rows - 1:
down += get_max_coins_helper(
matrix, crow + 1, ccol... | 3.328125 | 3 |
examples/GANs/3DGAN/eval.py | Tarkiyah/kaotlin | 2 | 24795 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicabl... | 1.835938 | 2 |
camfi/annotator.py | J-Wall/camfi | 0 | 24796 | """Defines procedures for training, and evaluation automatic camfi annotation models,
and for using them for making automatic annotations (inference). Depends on camfi.util,
camfi.datamodel.autoannotation, camfi.datamodel.geometry, camfi.datamode.via, as well
as ._torchutils and ._models."""
from datetime import datet... | 2.3125 | 2 |
SLpackage/private/pacbio/pythonpkgs/pbreports/lib/python2.7/site-packages/pbreports/report/laagc_input.py | fanglab/6mASCOPE | 5 | 24797 | """
Wrapper for running amplicon_analysis_inputs report for LAAgc (with an extra
input file).
"""
import logging
import sys
from pbcommand.models import FileTypes
from pbcommand.cli import pbparser_runner
from pbcommand.utils import setup_log
from pbreports.report.amplicon_analysis_input import _get_parser, make_rep... | 2.328125 | 2 |
toughradius/common/event_common.py | geosson/GSRadius | 1 | 24798 | #!/usr/bin/env python
# coding:utf-8
from toughlib import dispatch
"""触发邮件,短信发送公共方法"""
def trigger_notify(obj, user_info, **kwargs):
if int(obj.get_param_value("webhook_notify_enable", 0)) > 0 and kwargs.get('webhook_notify'):
dispatch.pub(kwargs['webhook_notify'], user_info, async=False)
if int(o... | 1.984375 | 2 |
sahara/utils/openstack/nova.py | citrix-openstack-build/sahara | 1 | 24799 | <filename>sahara/utils/openstack/nova.py
# Copyright (c) 2013 Mirantis Inc.
#
# 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 requir... | 1.867188 | 2 |