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 |
|---|---|---|---|---|---|---|
test/supporting/test_processor.py | holitics/phenome-extensions | 1 | 39900 | # test_processor.py, Copyright (c) 2019, Phenome Project - <NAME> <<EMAIL>>
from phenome_core.core.base.base_processor import BaseProcessor
class TestProcessor(BaseProcessor):
__test__ = False
def __init__(self):
super(TestProcessor, self).__init__()
def process(self, results):
from p... | 2.34375 | 2 |
Pyspark_Sample_ML_programs/simpleapp.py | mihaque313/pyspark_mllib | 7 | 39901 | <gh_stars>1-10
from pyspark import SparkContext
logFile = "D:/Spark/spark-1.6.1-bin-hadoop2.6/README.md"
sc = SparkContext("local", "Simple App")
logData = sc.textFile(logFile).cache()
numAs = logData.filter(lambda s: 'a' in s).count()
numBs = logData.filter(lambda s: 'b' in s).count()
print("Lines with a: ... | 2.921875 | 3 |
cli/src/commands/Backup.py | cicharka/epiphany | 2 | 39902 | import os
from cli.src.commands.BackupRecoveryBase import BackupRecoveryBase
from cli.src.helpers.doc_list_helpers import select_single
class Backup(BackupRecoveryBase):
"""Perform backup operations."""
def __init__(self, input_data):
super(BackupRecoveryBase, self).__init__(__name__) # late call o... | 2.28125 | 2 |
python/testData/inspections/PyUnresolvedReferencesInspection3K/objectNewAttributes.py | jnthn/intellij-community | 2 | 39903 | <filename>python/testData/inspections/PyUnresolvedReferencesInspection3K/objectNewAttributes.py<gh_stars>1-10
class C(object):
def __new__(cls):
self = object.__new__(cls)
self.foo = 1
return self
x = C()
print(x.foo)
print(x.<warning descr="Unresolved attribute reference 'bar' for class 'C... | 2.21875 | 2 |
lumin/nn/ensemble/__init__.py | choisant/lumin | 43 | 39904 | # from .ensemble import * # noqa 403
# __all__ = [*ensemble.__all__] # noqa F405
| 1 | 1 |
scg-scrape.py | josteinstraume/python-capstone | 1 | 39905 | <reponame>josteinstraume/python-capstone
import urllib, csv, numpy
from BeautifulSoup import *
url = raw_input('Enter URL to crawl: ')
if len(url) < 1:
url = 'http://sales.starcitygames.com//deckdatabase/deckshow.php?&t%5BC1%5D=3&start_num=0&start_num=0&limit=limit'
html = urllib.urlopen(url).read()
soup = BeautifulS... | 3.515625 | 4 |
wire/messages.py | evuez/stork | 0 | 39906 | """
Messages:
https://wiki.theory.org/BitTorrentSpecification#Messages
<length prefix><message ID><payload>
"""
from collections import namedtuple
from struct import pack
from struct import unpack
FORMAT = '>IB{}'
Message = namedtuple('Message', 'len id payload')
KEEP_ALIVE = -1
CHOKE = 0
UNCHOKE = 1
INTERESTED =... | 2.578125 | 3 |
nimrud/minimal/features.py | grayhem/nimrud | 1 | 39907 | <filename>nimrud/minimal/features.py<gh_stars>1-10
"""
functions to be mapped over point neighborhoods
"""
import numpy as np
# for handling empty neighborhoods in centroid
np.seterr(invalid="raise")
def take(neighborhood_idx, search_space_cloud):
"""
return an array of points from the search space (need... | 2.90625 | 3 |
Code Voorraad/Python stages/main.py | MarZwa/smart-kitchen | 0 | 39908 | import serial
import os
import json
from pprint import pprint
import mysql.connector
import time
import requests
mydb = mysql.connector.connect(
host="localhost",
user="max",
passwd="<PASSWORD>",
database="SmartKitchenDb"
)
com = serial.Serial('/dev/ttyUSB1', baudrate=9600, timeout=3.0)
com2 = serial.... | 2.71875 | 3 |
docs/sphinx-jupyter-widgets-cleanup.py | jinsanity07git/tmip-emat | 0 | 39909 |
import argparse, os
parser = argparse.ArgumentParser()
parser.add_argument('outdir', type=str, help='sphinx output directory')
args = parser.parse_args()
import re
duplicate_tag = '''(<script src="https://unpkg.com/@jupyter-widgets/html-manager@\^[0-9]*\.[0-9]*\.[0-9]*/dist/embed-amd.js"></script>)'''
bad1 = re.co... | 2.9375 | 3 |
finance_manager/database/views/v_input_inc_other.py | jehboyes/finance_manager | 0 | 39910 | from finance_manager.database.replaceable import ReplaceableObject as o
from finance_manager.database.views import account_description, p_list_string, p_sum_string
def _view():
view = o("v_input_inc_other", f"""
SELECT i.inc_id, i.account, a.description as account_name, {account_description}, i.description, i... | 2.375 | 2 |
examples/example_plugin/example_plugin/signals.py | susanhooks/nautobot | 0 | 39911 | <reponame>susanhooks/nautobot<filename>examples/example_plugin/example_plugin/signals.py
"""Signal handlers for the example example_plugin."""
def nautobot_database_ready_callback(sender, *, apps, **kwargs):
"""
Callback function triggered by the nautobot_database_ready signal when the Nautobot database is fu... | 2.625 | 3 |
scrape/scrape_md.py | jesse-peters/people | 0 | 39912 | import re
import lxml.html
import click
import scrapelib
from common import Person
def elem_to_str(item, inside=False):
attribs = " ".join(f"{k}='{v}'" for k, v in item.attrib.items())
return f"<{item.tag} {attribs}> @ line {item.sourceline}"
class XPath:
def __init__(self, xpath, *, min_items=1, max_i... | 3.03125 | 3 |
overwatch/stats/ids.py | jonghwanhyeon/overwatch-stats | 12 | 39913 | <filename>overwatch/stats/ids.py
OVERALL_CATEGORY_ID = '0x02E00000FFFFFFFF'
HERO_CATEGORY_IDS = {
'reaper': '0x02E0000000000002',
'tracer': '0x02E0000000000003',
'mercy': '0x02E0000000000004',
'hanzo': '0x02E0000000000005',
'torbjorn': '0x02E0000000000006',
'reinhardt': '0x02E0000000000007',
... | 1.28125 | 1 |
dataloaders/custom_transforms.py | JACKYLUO1991/DCBNet | 6 | 39914 | <reponame>JACKYLUO1991/DCBNet
import torch
import math
import numbers
import random
import numpy as np
from PIL import Image, ImageOps
from scipy.ndimage.filters import gaussian_filter
from scipy.ndimage.interpolation import map_coordinates
import cv2
from scipy import ndimage
def to_multilabel(pre_mask, classes=2):... | 2.421875 | 2 |
tools/Polygraphy/tests/backend/trt/test_profile.py | KaliberAI/TensorRT | 5,249 | 39915 | <filename>tools/Polygraphy/tests/backend/trt/test_profile.py
#
# Copyright (c) 2021, 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://ww... | 2.125 | 2 |
model.py | McHacks-2018/Retro-Reddit | 0 | 39916 | class Section:
def get_display_text(self):
pass
def get_children(self):
pass
| 1.203125 | 1 |
silvapermaculture/search.py | Walachul/SilvaPermaculture | 0 | 39917 | from flask import current_app
#This module is created for interaction with the Elasticsearch index
#Function that adds element to the index of Elasticsearch. Uses model as the SQLAlchemy model
def add_element_index(index,model):
#Check to see if Elasticsearch server is configured or not.
#The application runs ... | 2.828125 | 3 |
client.py | mguidon/socket-logger | 0 | 39918 | <filename>client.py
import socketio
sio = socketio.Client()
@sio.event
def connect():
print('connection established')
@sio.event
def log(data):
print(data)
@sio.event
def disconnect():
print('disconnected from server')
sio.connect('http://localhost:8080')
sio.wait() | 2.84375 | 3 |
interview/chainlink/problems.py | topliceanu/learn | 24 | 39919 | <gh_stars>10-100
def solution(prices):
if len(prices) == 0:
return 0
# We are always paying the first price.
total = prices[0]
min_price = prices[0]
for i in range(1, len(prices)):
if prices[i] > min_price:
total += prices[i] - min_price
if prices[i] < min_price:
... | 3.515625 | 4 |
example.py | badmutex/CoPipes | 1 | 39920 | from copipes import coroutine, pipeline, null
from copipes.macros.pipe import pipe
@pipe
def putStrLn():
"""doc"""
[x]
print x
send(x)
@pipe
def replicate(n):
[x]
for i in xrange(n):
send(x)
if __name__ == '__main__':
pipeline(
putStrLn,
replicate.params(3),
... | 2.1875 | 2 |
utils.py | whoamins/Ctftime-TelegramBot | 2 | 39921 | <filename>utils.py
def extract_arg(arg):
return arg.split()[1:][0]
| 1.921875 | 2 |
tests/attention/test_attention_layer.py | SamuelCahyawijaya/fast-transformers | 1,171 | 39922 | #
# Copyright (c) 2020 Idiap Research Institute, http://www.idiap.ch/
# Written by <NAME> <<EMAIL>>,
# <NAME> <<EMAIL>>
#
import unittest
import torch
from fast_transformers.attention.attention_layer import AttentionLayer
class TestAttentionLayer(unittest.TestCase):
def _assert_sizes_attention(self, qshape, k... | 2.671875 | 3 |
api_permission/__init__.py | jayvdb/django-api-permission | 3 | 39923 | <reponame>jayvdb/django-api-permission<gh_stars>1-10
default_app_config = 'api_permission.apps.AuthConfig'
| 1.09375 | 1 |
sliceMaker.py | longnow/longview | 82 | 39924 | #!/usr/bin/env python
# Copyright (c) 02004, The Long Now Foundation
# 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
# ... | 1.570313 | 2 |
get_longi_lati.py | icepoint666/Pytorch-ThinPlateSpline | 4 | 39925 | import numpy as np
import torch
import matplotlib.animation as animation
import matplotlib.pyplot as plt
from PIL import Image
import ThinPlateSpline as TPS
# 2048x2048.jpg size: 2048 x 2048
def on_press(event):
p = np.array([
[693.55, 531.26],
[1069.85, 1243.04],
[1243.74, 1238.69],
... | 2.578125 | 3 |
webapp/core/migrations/0001_initial.py | PoCDAB/cfns-webapp | 0 | 39926 | # Generated by Django 3.2 on 2021-08-25 14:44
import django.contrib.gis.db.models.fields
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import fontawesome_5.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
]
opera... | 1.539063 | 2 |
tlidb/examples/algorithms/DecoderAlgorithm.py | alon-albalak/TLiDB | 0 | 39927 | from tlidb.examples.utils import move_to
from .algorithm import Algorithm
class DecoderAlgorithm(Algorithm):
def __init__(self, config, datasets):
super().__init__(config, datasets)
self.generation_config = config.generation_config
self.generate_during_training = config.generate_during_trai... | 2.71875 | 3 |
python/ray/workflow/examples/comparisons/argo/exit_handler_workflow.py | willfrey/ray | 1 | 39928 | from typing import Tuple, Optional
import ray
from ray import workflow
@ray.remote
def intentional_fail() -> str:
raise RuntimeError("oops")
@ray.remote
def cry(error: Exception) -> None:
print("Sadly", error)
@ray.remote
def celebrate(result: str) -> None:
print("Success!", result)
@ray.remote
def... | 2.40625 | 2 |
thop/count_hooks.py | jwpleow/aanet | 0 | 39929 | <gh_stars>0
import argparse
import torch
import torch.nn as nn
multiply_adds = 1
def count_convNd(m, x, y):
cin = m.in_channels
kernel_ops = m.weight.size()[2:].numel()
ops_per_element = cin * kernel_ops
output_elements = y.nelement()
# cout x oW x oH
total_ops = output_ele... | 2.203125 | 2 |
generation_rs/process_output.py | microsoft/MRS | 2 | 39930 | """Convert the output format of fairseq.generate to the input format of the evaluation script."""
from argparse import ArgumentParser
from collections import defaultdict
def main():
parser = ArgumentParser()
parser.add_argument('src', help='path to source')
parser.add_argument('tgt', help='path to target... | 3.390625 | 3 |
mincaml/beta.py | aita/MinCaml.py | 1 | 39931 | <gh_stars>1-10
from pyrsistent import pmap
from . import logger
from .util import find
class Visitor:
def visit(self, env, e):
method = "visit_" + e[0]
visitor = getattr(self, method)
return visitor(env, e)
def visit_Unit(self, env, e):
return e
def visit_Int(self, env, ... | 2.703125 | 3 |
bakker/config.py | friedrichschoene/bakker | 1 | 39932 | import json
import os
from bakker.storage import FileSystemStorage
class Config:
USER_DIR = os.path.expanduser('~')
CONFIG_FILE = os.path.join(USER_DIR, '.bakker/config.json')
def __init__(self):
if os.path.isfile(self.CONFIG_FILE):
with open(self.CONFIG_FILE, 'r') as f:
... | 2.390625 | 2 |
Image_Stitching/cropper.py | RogerZhangsc/VDAS | 0 | 39933 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 16 00:37:05 2018
@author: Sunny
"""
import cv2
import numpy as np
import os
from os.path import abspath
FPS = 30
OUTPUT_FRAME_WIDTH = 0 #SHOULD REMAIN SAME AS INPUT
OUTPUT_FRAME_HEIGHT = 0 #SHOULD BE 2x INPUT
MULTI_STITCH = 0 #OFF
##STEP 1 - Read EACH FRAME... | 2.453125 | 2 |
home/views.py | pantsocksboots/rackandstack | 0 | 39934 | <reponame>pantsocksboots/rackandstack
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.template.response import TemplateResponse
from rubric.models import Evolution
from stucon.models import Student
from gradebook.models import ObjectiveScore, TraitScore
from djang... | 1.984375 | 2 |
src/main.py | xtreme3d/editor | 0 | 39935 | <reponame>xtreme3d/editor
# -*- coding: utf-8 -*-
import io
import os.path
import shutil
import getpass
import math
import time
import datetime
import ctypes
import Tkinter, tkFileDialog
import logging
import sdl2
import json
from framework import *
from framework import keycodes
from xtreme3d import x3dconstants as c... | 1.664063 | 2 |
barriers/models/history/mentions.py | felix781/market-access-python-frontend | 1 | 39936 | import dateutil.parser
from utils.models import APIModel
class Mention(APIModel):
def __init__(self, data):
self.data = data
@property
def created_on(self):
return dateutil.parser.parse(self.data["created_on"])
@property
def go_to_url_path(self):
data2 = self.data
... | 2.71875 | 3 |
scripts/show-profile.py | ekiden/ekiden | 19 | 39937 | <gh_stars>10-100
#!/usr/bin/env python
import argparse
import numpy as np
EKIDEN_PROFILE_PREFIX = 'ekiden-profile:'
if __name__ == '__main__':
parser = argparse.ArgumentParser(description=None)
parser.add_argument('profile', type=str,
help="Profile output file")
parser.add_argumen... | 2.796875 | 3 |
annotators/SentRewrite/test.py | Ramimashkouk/dream | 7 | 39938 | import requests
url = "http://0.0.0.0:8017/sentrewrite"
data = {
"utterances_histories": [
[["do you know <NAME>?"], ["yes, he is a football player."], ["who is the best, he or c.ronaldo?"]]
],
"annotation_histories": [
[
{"ner": [[{"confidence": 1, "end_pos": 24, "start_pos": ... | 2.65625 | 3 |
bioimageio/core/prediction.py | bioimage-io/python-core | 2 | 39939 | import collections
import os
from itertools import product
from pathlib import Path
from typing import Dict, Iterator, List, NamedTuple, Optional, OrderedDict, Sequence, Tuple, Union
import numpy as np
import xarray as xr
from tqdm import tqdm
from bioimageio.core import image_helper
from bioimageio.core import load_... | 2.125 | 2 |
pulsar/async/_subprocess.py | PyCN/pulsar | 1,410 | 39940 |
if __name__ == '__main__':
import sys
import pickle
from multiprocessing import current_process
from multiprocessing.spawn import import_main_path
data = pickle.load(sys.stdin.buffer)
current_process().authkey = data['authkey']
sys.path = data['path']
import_main_path(data['main'])
... | 1.945313 | 2 |
app/app/calculation_service/mongoSetup.py | alasdair-macleod/demoappback | 0 | 39941 | from app import db
def populate_mongo():
if 'expressions' in db.collection_names():
db.drop_collection('expressions')
expressions_entries = [
{
"name": "1",
"expression": "$A = \\begin{pmatrix}c_{11} & c_{12} & c_{13} & c_{14} & c_{15}\\\\ c_{21} & c_{22} & c_{23} & c_... | 2.578125 | 3 |
lista/schemas/prestador_schema.py | ViniciusGarciaSilva/izi-serv-backend | 0 | 39942 | <reponame>ViniciusGarciaSilva/izi-serv-backend
from marshmallow_sqlalchemy import ModelSchema
from marshmallow import fields
from lista.models.prestador_model import PrestadorModel
class PrestadorSchema(ModelSchema):
class Meta:
model = PrestadorModel | 1.671875 | 2 |
preprocessing/utils.py | nazariinyzhnyk/nlp-beatles-lyrics-modeling | 0 | 39943 | import random
import numpy as np
def set_seed(random_state: int = 42) -> None:
"""Function fixes random state to ensure results are reproducible"""
np.random.seed(random_state)
random.seed(random_state)
| 2.625 | 3 |
assignment/pubsub.py | nilaysaha/multitasking | 0 | 39944 | #!/bin/python3
import os, amqp
USERNAME=os.environ['MQTT_USERNAME']
PASSWORD=<PASSWORD>['<PASSWORD>']
AMQP_URL=f"amqp://{MQTT_USERNAME}:{MQTT_PASSWORD}@finch.rmq.cloudamqp.com/wwarpzsg"
class PubSub:
def __init__(self, url=AMQP_URL):
this.connection = amqp.Connection(url)
this.channels = {}
... | 2.4375 | 2 |
run.py | ceesroele/sarcasm_detection | 0 | 39945 | """
Train a model on the Reddit dataset by Khodak.
"""
import functools
import time
import logging
import pickle
import os
import pandas as pd
from sklearn.model_selection import train_test_split
from simpletransformers.classification import ClassificationModel, ClassificationArgs
from utils import (
hour_min_se... | 3.078125 | 3 |
assembler/arguments.py | ITD27M01/hack-assembler | 1 | 39946 | <filename>assembler/arguments.py
import argparse
def args_parser():
parser = argparse.ArgumentParser(description='Generates hack machine binary code from symbolic form.')
parser.add_argument('file', type=str, action='store',
help='File path with assembly code')
parser.add_argument... | 3.328125 | 3 |
yetl/metasource/__init__.py | semanticinsight/yetl-framework | 0 | 39947 | <reponame>semanticinsight/yetl-framework
from .metasource import FileMetasource
from .index import Index
__all__ = ["FileMetasource", "Index"] | 0.851563 | 1 |
visitors/signals.py | hugorodgerbrown/django-visitor | 6 | 39948 | from django.dispatch import Signal
# sent when a user creates their own Visitor - can
# be used to send the email with the token
# kwargs: visitor
self_service_visitor_created = Signal()
| 1.664063 | 2 |
eukarya/scripts_nonsql/statistics_OGs.py | ESDeutekom/ComparingOrthologies | 2 | 39949 | #python3
import os
import sys
import statistics as s
import pandas as pd
from find_loss import *
##########################
## statistics on orthogroups
##########################
"""if len(sys.argv) != 5:
print("Need 4 arguments: [Orthologous group input file] [LECA orthologous groups input list] [method name] [stat... | 2.59375 | 3 |
pyGLLib/light.py | juanmcasillas/pyGLLib | 0 | 39950 |
# ///////////////////////////////////////////////////////////////////////////
#
#
#
# ///////////////////////////////////////////////////////////////////////////
class GLLight:
def __init__(self, pos=(0.0,0.0,0.0), color=(1.0,1.0,1.0)):
self.pos = pos
self.color = color
self.ambient = (1.0... | 2.109375 | 2 |
src/models/aggregation_layers.py | InnovArul/vidreid_cosegmentation | 41 | 39951 | <reponame>InnovArul/vidreid_cosegmentation
import torch
import torch.nn as nn
import torch.nn.functional as F
class AggregationTP(nn.Module):
def __init__(self, feat_dim, *args, **kwargs):
super().__init__()
print("instantiating " + self.__class__.__name__)
self.feat_dim = feat_dim
d... | 2.390625 | 2 |
scripts/run_autoencoder.py | kashefy/transform | 0 | 39952 | <reponame>kashefy/transform<gh_stars>0
# -*- coding: utf-8 -*-
""" Auto Encoder Example.
Using an auto encoder on MNIST handwritten digits.
References:
<NAME>, <NAME>, <NAME>, and <NAME>. "Gradient-based
learning applied to document recognition." Proceedings of the IEEE,
86(11):2278-2324, November 1998.
Li... | 2.734375 | 3 |
map/forms.py | mpbrown/buffalo-community-engagement-map | 1 | 39953 | <filename>map/forms.py
from django import forms
class EmailOrganizationForm(forms.Form):
organization_name = forms.CharField(label="Organization you'd be most interested in working with")
why_interesting = forms.CharField(
label="Write one sentence about why this organization is interesting. How does ... | 2.734375 | 3 |
tensorflow/mcst_model.py | nkzhlee/RCModel | 1 | 39954 | <gh_stars>1-10
# -*- coding:utf8 -*-
# ==============================================================================
# Copyright 2017 lizhaohui.com, Inc. 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 ... | 1.875 | 2 |
customer_api/api/migrations/0008_auto_20171017_1504.py | t-yanaka/zabbix-report | 2 | 39955 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-17 06:04
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0007_auto_20171005_1713'),
]
operations = [... | 1.8125 | 2 |
mmdet/core/mask/transforms.py | vanyalzr/mmdetection | 2 | 39956 | # Copyright (C) 2020 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | 1.835938 | 2 |
SSGP/SMORMS3.py | Krystian95/SSGP | 0 | 39957 | <filename>SSGP/SMORMS3.py<gh_stars>0
################################################################################
# SSGP: Sparse Spectrum Gaussian Process
# Github: https://github.com/MaxInGaussian/SSGP
# Author: <NAME> (<EMAIL>)
################################################################################
i... | 2.09375 | 2 |
demo.py | itsrobli/depreciation-rate-classifier | 0 | 39958 | # 25 February 2019 - <NAME> <<EMAIL>>
import sys
from src.text_classifier_deprn_rates import DeprnPredictor
predict = DeprnPredictor()
print('Evaluate using user input.\n')
user_description = ['']
print('\"QQ\" to quit.')
print('\"CR\" to see classification report.')
print('Otherwise...')
while True:
user_desc... | 3.078125 | 3 |
morphablegraphs/motion_analysis/bvh_analyzer.py | dfki-asr/morphablegraphs | 5 | 39959 | #!/usr/bin/env python
#
# Copyright 2019 DFKI GmbH.
#
# 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, merg... | 1.757813 | 2 |
tests/data/tokenizers/test_character_tokenizer.py | naetherm/NSEC_NMT | 0 | 39960 | # -*- coding: utf-8 -*-
'''
Copyright 2019, University of Freiburg.
Chair of Algorithms and Data Structures.
<NAME> <<EMAIL>>
'''
import argparse
import unittest
import torch
import tests.utils as test_utils
from fairseq.data.tokenizers.character_tokenizer import CharacterTokenizer
class TestCharacterTokenizer(uni... | 2.875 | 3 |
django_slack/templatetags/django_slack.py | lociii/django-slack | 237 | 39961 | <gh_stars>100-1000
from django import template
from django.utils.encoding import force_str
from django.utils.functional import keep_lazy
from django.utils.safestring import SafeText, mark_safe
from django.template.defaultfilters import stringfilter
register = template.Library()
_slack_escapes = {
ord('&'): u'&... | 2.25 | 2 |
lemmus/__init__.py | naturalis/lemmus | 0 | 39962 | #!/usr/bin/python
__all__ = ['issue','init','review']
try:
import sys
except ImportError:
print 'Error while import [sys] module \nConsider checking your pc since os should really be there you fool!'
exit(1)
# checking which version we are using.
if sys.version_info >= (3,0):
print 'This is written in python 2... | 2.484375 | 2 |
analysis/compatibility.py | casperschmit/cct-selector | 0 | 39963 | <filename>analysis/compatibility.py
import ast
def compute_compatibility_score(row, project):
score = 0
technical_fit = ast.literal_eval(project.technical_scheme) # {'HTLC': 1, 'Hybrid': 2, 'Sidechain': 3, 'Notary': 0}
usecase_fit = ast.literal_eval(
project.use_case) # {'Asset transfer': 1, 'A... | 2.390625 | 2 |
models/Baseline.py | WorldChanger01/CORE_VAE | 0 | 39964 | <filename>models/Baseline.py
from __future__ import print_function
import numpy as np
import math
from scipy.misc import logsumexp
import torch
import torch.utils.data
import torch.nn as nn
from torch.nn import Linear
from torch.autograd import Variable
from torch.nn.functional import normalize
from utils.distrib... | 2.421875 | 2 |
lib/export/wordManip.py | WillBickerstaff/sundial | 1 | 39965 | <reponame>WillBickerstaff/sundial
def splitbylength(wordlist):
initlen = len(wordlist[0])
lastlen = len(wordlist[-1])
splitlist = []
for i in range(initlen, lastlen+1):
curlist = []
for x in wordlist:
if len(x) == i: curlist.append(x.capitalize())
... | 3.078125 | 3 |
2/solution-a.py | gmodena/adventofcode2017 | 1 | 39966 | if __name__ == '__main__':
checksum = 0
while True:
try:
numbers = input()
except EOFError:
break
numbers = map(int, numbers.split('\t'))
numbers = sorted(numbers)
checksum += numbers[-1] - numbers[0]
print(checksum)
| 3.25 | 3 |
cleanup.py | manojtpillai/kubuculum | 3 | 39967 | <filename>cleanup.py
#!/usr/bin/env python3
import argparse
from kubuculum.setup_run import setup_run
parser = argparse. ArgumentParser()
parser.add_argument("-n", "--namespace", help="namespace to cleanup")
args = parser.parse_args()
default_namespace = "nm-kubuculum"
if args.namespace:
environment_params = { ... | 2.171875 | 2 |
faktura/settings.py | Tethik/faktura | 0 | 39968 | from faktura import app
from flask import request, render_template, send_file, redirect, make_response, jsonify
from faktura.breadcrumbs import breadcrumbs
from faktura.models import db, TemplateVariable, User
from flask.ext.login import login_required
from faktura.csrf import generate_csrf_token
@app.route('/setting... | 2.265625 | 2 |
taobao_scrapper_extreme.py | marcozzxx810/TaobaoWebscrapper | 0 | 39969 | <filename>taobao_scrapper_extreme.py
import os
import re
import json
import time
import random
import requests
import pandas as pd
from retrying import retry
import openpyxl
from login import TaoBaoLogin
requests.packages.urllib3.disable_warnings()
req_session = requests.Session()
GOODS_EXCEL_PATH = 'taobao_good... | 2.515625 | 3 |
api/admin.py | SchoolOrchestration/Firehose | 0 | 39970 | from django.contrib import admin
from .models import Payload
class PayloadAdmin(admin.ModelAdmin):
list_display = ('method', 'path','get','post')
search_fields = ('get','post')
admin.site.register(Payload, PayloadAdmin) | 1.65625 | 2 |
useful_scripts/prepDataset.py | jessvb/3d_world_procedural_generation | 7 | 39971 | <gh_stars>1-10
import os
import tensorflow as tf
import random
import numpy as np
import matplotlib.pyplot as plt
# uncomment for inline for the notebook:
# %matplotlib inline
import pickle
# enter the directory where the training images are:
TRAIN_DIR = 'train/'
IMAGE_SIZE = 512
train_image_file_names = [TRAIN_DIR+i... | 2.84375 | 3 |
Computer Science/Development/imageProcessor/robo_controls.py | zbendt/ECE-Capstone-Project | 0 | 39972 | import time
import GRBL
start_crdnts_up = {} #start coordinates
start_crdnts_dn = {} #start coordinates
pass_crdnts_up = {} #test pass stack
pass_crdnts_dn = {} #test pass stack
fail_crdnts_up = {} #test fail stack
fail_crdnts_dn = {} #test fail stack
camera_cordnts_up = {} #camera locations
camera_cordnts_dn = {} ... | 2.359375 | 2 |
gc_apps/gis_tabular/urls.py | IQSS/geoconnect | 6 | 39973 | <gh_stars>1-10
from django.conf.urls import url
from gc_apps.gis_tabular import views, views_create_layer, views_delete
urlpatterns = [
url(r'^test/latest/$', views.view_tabular_file_latest, name="view_tabular_file_latest"),
#url(r'^test1/(?P<tabular_id>\d{1,10})/$', 'view_tabular_file', name="view_tabular_f... | 1.953125 | 2 |
008_behavioral_cloning/training.py | amitbcp/deep_learning_projects | 6 | 39974 | <filename>008_behavioral_cloning/training.py<gh_stars>1-10
import csv
import cv2
import utils
import argparse
import numpy as np
from model import network
from sklearn.utils import shuffle
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
import pickle
class TrainingPipeline:
def... | 2.703125 | 3 |
pyswan/parser.py | JosiahMg/pyswan | 3 | 39975 | <gh_stars>1-10
from pyswan.numeral import ExtractNumeral
from pyswan.extract_time import GenDatetime
from pyswan.extract_number import GenNumber
from pyswan.extract_math_equation import GenMathEquation
from pyswan.extract_cpca import GenPlace
def digitize(target):
return ExtractNumeral.digitize(target).target
d... | 2.734375 | 3 |
cp_validator/__init__.py | klashxx/cp_validator | 0 | 39976 | # -*- coding: utf-8 -*-
import os
import sys
__author__ = '<NAME>'
__version__ = '0.1'
__ppath__ = os.path.dirname(os.path.realpath(__file__))
if __ppath__ not in sys.path:
sys.path.append(os.path.dirname(__ppath__))
from flask import Flask
app = Flask(__name__)
from cp_validator import extractor
postals = extr... | 2.203125 | 2 |
src/data/datasets/Stocks/Stocks.py | msc5/junior-iw | 0 | 39977 |
import random
import torch
import torch.nn as nn
from pathlib import Path
from torch.utils.data import Dataset, DataLoader
RAW_PATH = 'src/data/datasets/Stocks/raw'
APIKEY = 'A6YNKD8LYDFDEALD'
class Stocks (Dataset):
def __init__(self, seq_len: int = 20, split: str = 'train'):
self.seq_len = seq_len
... | 2.546875 | 3 |
common/helpers/client_helpers.py | srrokib/aws-cloudformation-resource-providers-frauddetector | 4 | 39978 | <gh_stars>1-10
from cloudformation_cli_python_lib import (
SessionProxy,
exceptions,
)
# Use this global and use `afd_client = get_singleton_afd_client(session)` for singleton
afd_client = None
def get_singleton_afd_client(session):
global afd_client
if afd_client is not None:
return afd_clie... | 2.203125 | 2 |
python/p054.py | wephy/project-euler | 0 | 39979 | <filename>python/p054.py
# Poker hands
import os
import numpy as np
def solve():
data = np.loadtxt(os.path.join("..", "data", "p054.txt"),
delimiter=" ",
dtype=str)
player1 = data[:, :5]
player2 = data[:, 5:]
return sum(
score(player1[game]) > sco... | 3.390625 | 3 |
flask_unchained/bundles/security/config.py | briancappello/flask-unchained | 69 | 39980 | from datetime import datetime, timezone
from flask import abort
from flask_unchained import BundleConfig
from http import HTTPStatus
from .forms import (
LoginForm,
RegisterForm,
ForgotPasswordForm,
ResetPasswordForm,
ChangePasswordForm,
SendConfirmationForm,
)
from .models import AnonymousUser... | 2.609375 | 3 |
shipping/cythonize.py | pgolo/sic | 2 | 39981 | try:
from Cython.Build import cythonize
ext_modules = cythonize(['sic/core.py', 'sic/implicit.py'], compiler_directives={'language_level': '3'})
except:
pass
| 1.234375 | 1 |
edb/ir/scopetree.py | sbdchd/edgedb | 2 | 39982 | <gh_stars>1-10
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2008-present MagicStack Inc. and the EdgeDB 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 ... | 2.140625 | 2 |
resources/users.py | gwasserfall/matcha | 3 | 39983 | from flask import request
from flask_restful import Resource, abort
from flask_jwt_extended import get_jwt_identity
from helpers import jwt_refresh_required
from helpers.genders import genders
from helpers.email import send_validation_email
from models.user import User, get_full_user
from models.validation import Val... | 2.375 | 2 |
utils/crf.py | pengzhiliang/MRBrainS_seg | 46 | 39984 | import numpy as np
import pydensecrf.densecrf as dcrf
from pydensecrf.utils import compute_unary, create_pairwise_bilateral, create_pairwise_gaussian, unary_from_softmax
def dense_crf(img, prob):
'''
input:
img: numpy array of shape (num of channels, height, width)
prob: numpy array of shape (9, hei... | 2.4375 | 2 |
2021/__00.py | terezaif/adventofcode | 4 | 39985 | <reponame>terezaif/adventofcode
from aocd import get_data
def part1(data):
depths = [s for s in data.split("\n")]
return 150
def part2(data):
depths = [s for s in data.split("\n")]
return 900
def test_part1():
assert part1(test_data) == 150
def test_part2():
assert part2(test_data) == ... | 3.15625 | 3 |
monkPriorityList.py | skasch/ffxiv-sim | 0 | 39986 | <filename>monkPriorityList.py
# -*- coding: utf-8 -*-
"""
Created on Tue May 31 17:02:24 2016
@author: rmondoncancel
"""
# Deprecated
priorityList = [
{
'name': 'fistOfFire',
'group': 'monk',
'prepull': True,
'condition': {
'type': 'buffPresent',
'name': 'f... | 1.859375 | 2 |
robotto.py | sectrimte/pkmn_robotto | 0 | 39987 | import pyautogui
import random
from state import State
import time
fight_screen_bg_color = [52, 52, 52]
fight_screen_blank_xy = [533,733]
button_run_xy = [486, 755]
def path_circle_by_sizes(height, length):
path = ['right']*length + ['down']*height + ['left']*length + ['up']*height
return path
... | 3.15625 | 3 |
accounts/tests.py | HerbyDE/jagdreisencheck-webapp | 0 | 39988 | from django.contrib.auth.hashers import check_password
from django.test import TestCase
from accounts.forms import CreateBaseUserInstance
from accounts.models import User
# Unit tests for SignUp and Registration
class UserManagementTestCase(TestCase):
def test_create_base_user_form(self):
'''
Te... | 2.8125 | 3 |
src/replit/__init__.py | ykdojo/replit-py | 0 | 39989 | # flake8: noqa
"""The Replit Python module."""
from . import web
from .audio import Audio
from .database import db, Database
# Backwards compatibility.
def clear() -> None:
"""Clear the terminal."""
print("\033[H\033[2J", end="", flush=True)
audio = Audio()
| 2.109375 | 2 |
hio-yocto-bsp/sources/poky/scripts/lib/mic/3rdparty/pykickstart/commands/multipath.py | qiangzai00001/hio-prj | 0 | 39990 | #
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# Copyright 2006, 2007 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2. This program is distributed in the hope that it
# will... | 1.96875 | 2 |
python/tests/utils/test_environment_decorator_test.py | xuyanbo03/lab | 7,407 | 39991 | <reponame>xuyanbo03/lab
# Copyright 2018 Google Inc.
#
# 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 version 2 of the License, or
# (at your option) any later version.
#
# This program ... | 2.078125 | 2 |
dev/local/vision/core.py | LaurenSpiegel/fastai_docs | 0 | 39992 | <reponame>LaurenSpiegel/fastai_docs
#AUTOGENERATED! DO NOT EDIT! File to edit: dev/06_vision_core.ipynb (unless otherwise specified).
__all__ = ['Image', 'image_convert', 'ImageConverter', 'image_resize', 'ImageResizer', 'image2byte', 'unpermute_image',
'ImageToByteTensor', 'ByteToFloatTensor']
from ..impo... | 2.03125 | 2 |
cryspy/procedure_mempy/mempy_by_dictionary.py | ikibalin/rhochi | 0 | 39993 | import os
import numpy
import scipy
import scipy.optimize
from cryspy.A_functions_base.symmetry_elements import \
calc_asymmetric_unit_cell_indexes
from cryspy.A_functions_base.mempy import \
calc_mem_col, \
calc_mem_chi, \
calc_symm_elem_points_by_index_points, \
get_uniform_density_col, \
re... | 1.703125 | 2 |
mapCreator.py | kmarif/mapCreator | 11 | 39994 | # -*- coding: utf-8 -*-
"""
Map creation script
"""
import sys
import os
from configparser import ConfigParser
import math
from PIL import Image
import urllib.request, urllib.parse, urllib.error
# tile positions, see https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Lon..2Flat._to_tile_numbers_2
def deg2num(l... | 2.703125 | 3 |
data_hyperparams/beeradvocate.py | noveens/sampling_cf | 6 | 39995 | hyper_params = {
'weight_decay': float(1e-6),
'epochs': 30,
'batch_size': 256,
'validate_every': 3,
'early_stop': 3,
'max_seq_len': 10,
}
| 1.203125 | 1 |
Algae.py | pblanc5/LSystemFun | 0 | 39996 | # Author: <NAME>
# Date: 12-13-16
# Description: This is a program to help me learn L-Systems
# It should generate strings based on the rules applied.
class system:
axiom = "A"
sentence = axiom
rules = []
rules.append({
"A":"A",
"B":"AB"
})
rules.append({
"A": "B... | 3.875 | 4 |
util/draw_confusion_mat.py | GuardianWang/DM_hw_bagging | 0 | 39997 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLocator
from tqdm import tqdm
import torch
from torch.utils.data import DataLoader
import torch.nn.functional as F
from model.model import BaseNet
from model.config import arguments
from dataset.dataset import FlowerData
def ge... | 2.328125 | 2 |
tests/samples/test_sample.py | FoxoTech/methylcheck | 1 | 39998 | <gh_stars>1-10
import methylcheck
import pandas as pd
import methylprep # for manifest support
from pathlib import Path
PATH = Path('docs/example_data/mouse')
class TestProcessedSample():
manifest = methylprep.Manifest(methylprep.ArrayType('mouse'))
manifest_mouse_design_types = dict(manifest.mouse_data_frame[... | 2.125 | 2 |
bin/iris.py | davidus-sk/orion | 24 | 39999 | <filename>bin/iris.py
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
import sys
GPIO.setmode(GPIO.BOARD)
GPIO.setup(12, GPIO.OUT)
p = GPIO.PWM(12, 50)
p.start(7.5)
if sys.argv[1] == 'close':
p.ChangeDutyCycle(7.5)
time.sleep(1)
else:
p.ChangeDutyCycle(12.5)
time.sleep(1)
p.stop()
GPIO.cleanup()
| 2.671875 | 3 |