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 |
|---|---|---|---|---|---|---|
Image classifier/train.py | anirudha-bs/Farm_assist | 0 | 10300 | from __future__ import absolute_import, division, print_function, unicode_literals
import tensorflow as tf
from keras import regularizers
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Conv2D, Flatten, Dropout, MaxPooling2D
from tensorflow.keras.preprocessing.image import Ima... | 2.53125 | 3 |
questions/q118_linked_list_loop_removal/code.py | aadhityasw/Competitive-Programs | 0 | 10301 | def removeLoop(head):
ptr = head
ptr2 = head
while True :
if ptr is None or ptr2 is None or ptr2.next is None :
return
ptr = ptr.next
ptr2 = ptr2.next.next
if ptr is ptr2 :
loopNode = ptr
break
ptr = loopNode.next
count = ... | 3.828125 | 4 |
fastrunner/httprunner3/report/html/gen_report.py | Chankee/AutoTestRunner | 1 | 10302 | <gh_stars>1-10
import io
import os
from datetime import datetime
from jinja2 import Template
from loguru import logger
from httprunner.exceptions import SummaryEmpty
def gen_html_report(summary, report_template=None, report_dir=None, report_file=None):
""" render html report with specified report name and templ... | 2.703125 | 3 |
SD/lab1/client.py | matheuscr30/UFU | 0 | 10303 | #client.py
#!/usr/bin/python # This is client.py file
import socket # Import socket module
s = socket.socket() # Create a socket object
host = socket.gethostname() # Get local machine name
port = 12352 ... | 3.421875 | 3 |
tests/helpers.py | ws4/TopCTFd | 1 | 10304 | <reponame>ws4/TopCTFd
from CTFd import create_app
from CTFd.models import *
from sqlalchemy_utils import database_exists, create_database, drop_database
from sqlalchemy.engine.url import make_url
import datetime
import six
if six.PY2:
text_type = unicode
binary_type = str
else:
text_type = str
binary_t... | 2.375 | 2 |
homeassistant/components/kaiterra/const.py | MrDelik/core | 30,023 | 10305 | """Consts for Kaiterra integration."""
from datetime import timedelta
from homeassistant.const import (
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
CONCENTRATION_MILLIGRAMS_PER_CUBIC_METER,
CONCENTRATION_PARTS_PER_BILLION,
CONCENTRATION_PARTS_PER_MILLION,
PERCENTAGE,
Platform,
)
DOMAIN = "kaite... | 1.726563 | 2 |
support/views.py | bhagirath1312/ich_bau | 1 | 10306 | <filename>support/views.py
from django.shortcuts import render, redirect
from django.http import HttpResponseRedirect
from .models import SupportProject
# Create your views here.
def index( request ):
sp = SupportProject.objects.all()
if sp.count() == 1:
return HttpResponseRedirect( sp.first().p... | 1.820313 | 2 |
timeline/models.py | KolibriSolutions/BepMarketplace | 1 | 10307 | <gh_stars>1-10
# Bep Marketplace ELE
# Copyright (c) 2016-2021 Kolibri Solutions
# License: See LICENSE file or https://github.com/KolibriSolutions/BepMarketplace/blob/master/LICENSE
#
from datetime import datetime
from django.core.exceptions import ValidationError
from django.db import models
class TimeSlot(mode... | 2.484375 | 2 |
app/api/user_routes.py | nappernick/envelope | 2 | 10308 | from datetime import datetime
from werkzeug.security import generate_password_hash
from flask import Blueprint, jsonify, request
from sqlalchemy.orm import joinedload
from flask_login import login_required
from app.models import db, User, Type
from app.forms import UpdateUserForm
from .auth_routes import authenticate, ... | 2.421875 | 2 |
timeflux/nodes/ml.py | OpenMindInnovation/timeflux | 0 | 10309 | """Machine Learning"""
import importlib
import numpy as np
import pandas as pd
import json
from jsonschema import validate
from sklearn.pipeline import make_pipeline
from timeflux.core.node import Node
from timeflux.core.exceptions import ValidationError, WorkerInterrupt
from timeflux.helpers.background import Task
fr... | 2.140625 | 2 |
cms/migrations/0006_auto_20170122_1545.py | josemlp91/django-landingcms | 0 | 10310 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-22 15:45
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('content', '0002_auto_20170122_1509'),
('cms', '0005... | 1.648438 | 2 |
1-lab-lambdaDynamoDB/source/cdk/app.py | donnieprakoso/workshop-buildingRESTAPIwithAWS | 23 | 10311 | <reponame>donnieprakoso/workshop-buildingRESTAPIwithAWS
#!/usr/bin/env python3
from aws_cdk import aws_iam as _iam
from aws_cdk import aws_lambda as _lambda
from aws_cdk import aws_dynamodb as _ddb
from aws_cdk import core
class CdkStack(core.Stack):
def __init__(self, scope: core.Construct, id: str, stack_prefi... | 1.882813 | 2 |
module_6_lets_make_a_web_app/webapp/yield.py | JCarlos831/python_getting_started_-pluralsight- | 0 | 10312 | <reponame>JCarlos831/python_getting_started_-pluralsight-
students = []
def read_file():
try:
f = open("students.txt", "r")
for student in read_students(f):
students.append(student)
f.close()
except Exception:
print("Could not read file")
def read_students(f):
... | 3.515625 | 4 |
paul_analysis/Python/labird/gamma.py | lzkelley/arepo-mbh-sims_analysis | 0 | 10313 | """Module for finding an effective equation of state for in the Lyman-alpha forest
from a snapshot. Ported to python from <NAME>'s IDL script."""
import h5py
import math
import numpy as np
def read_gamma(num,base):
"""Reads in an HDF5 snapshot from the NE gadget version, fits a power law to the
equation of st... | 2.671875 | 3 |
evogym/envs/change_shape.py | federico-camerota/evogym | 78 | 10314 | <gh_stars>10-100
import gym
from gym import error, spaces
from gym import utils
from gym.utils import seeding
from evogym import *
from evogym.envs import BenchmarkBase
import random
from math import *
import numpy as np
import os
class ShapeBase(BenchmarkBase):
def __init__(self, world):
super().__... | 2.46875 | 2 |
pybind/slxos/v16r_1_00b/mpls_state/ldp/fec/ldp_fec_prefixes/__init__.py | shivharis/pybind | 0 | 10315 | <filename>pybind/slxos/v16r_1_00b/mpls_state/ldp/fec/ldp_fec_prefixes/__init__.py<gh_stars>0
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBoo... | 1.84375 | 2 |
pug/dj/miner/model_mixin.py | hobson/pug-dj | 0 | 10316 | from pug.nlp.db import representation
from django.db import models
class RepresentationMixin(models.Model):
"""Produce a meaningful string representation of a model with `str(model.objects.all[0])`."""
__unicode__ = representation
class Meta:
abstract = True
class DateMixin(models.Model):
""... | 2.578125 | 3 |
custom_components/kodi_media_sensors/config_flow.py | JurajNyiri/kodi-media-sensors | 5 | 10317 | <reponame>JurajNyiri/kodi-media-sensors
import logging
from typing import Any, Dict, Optional
from homeassistant import config_entries
from homeassistant.components.kodi.const import DOMAIN as KODI_DOMAIN
from homeassistant.core import callback
import voluptuous as vol
from .const import (
OPTION_HIDE_WATCHED,
... | 2.046875 | 2 |
MySite/MainApp/views.py | tananyan/siteee | 1 | 10318 | from django.shortcuts import render
from django.views.generic.edit import FormView
from django.views.generic.edit import View
from . import forms
# Опять же, спасибо django за готовую форму аутентификации.
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth import logout
from django... | 2.140625 | 2 |
imagetagger/imagetagger/settings_base.py | jbargu/imagetagger | 1 | 10319 | """
Django settings for imagetagger project.
Generated by 'django-admin startproject' using Django 1.10.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
impor... | 1.828125 | 2 |
apps/project/views/issue.py | rainydaygit/testtcloudserver | 349 | 10320 | <reponame>rainydaygit/testtcloudserver
from flask import request
from apps.auth.auth_require import required
from apps.project.business.issue import IssueBusiness, IssueRecordBusiness, IssueDashBoardBusiness
from apps.project.extentions import parse_json_form, validation, parse_list_args2
from library.api.render impor... | 2.171875 | 2 |
PhysicsTools/PythonAnalysis/python/ParticleDecayDrawer.py | nistefan/cmssw | 0 | 10321 | # <NAME>, DESY
# <EMAIL>
#
# this tool is based on Luca Lista's tree drawer module
class ParticleDecayDrawer(object):
"""Draws particle decay tree """
def __init__(self):
print "Init particleDecayDrawer"
# booleans: printP4 printPtEtaPhi printVertex
def _accept(self, cand... | 2.953125 | 3 |
translator.py | liuprestin/pyninjaTUT-translator | 0 | 10322 | <gh_stars>0
from translate import Translator
translator = Translator(to_lang="zh")
try:
with open('./example.md', mode='r') as in_file:
text = in_file.read()
with open('./example-tranlated.md', mode='w') as trans_file:
trans_file.write(translator.translate(text))
except FileNotF... | 3 | 3 |
reddit2telegram/channels/news/app.py | mainyordle/reddit2telegram | 187 | 10323 | #encoding:utf-8
from utils import weighted_random_subreddit
t_channel = '@news756'
subreddit = weighted_random_subreddit({
'politics': 0.5,
'news': 0.5
})
def send_post(submission, r2t):
return r2t.send_simple(submission,
text='{title}\n\n{self_text}\n\n/r/{subreddit_name}\n{short_link}',
... | 2.515625 | 3 |
xcbgen/xtypes.py | tizenorg/framework.uifw.xorg.xcb.xcb-proto | 1 | 10324 | '''
This module contains the classes which represent XCB data types.
'''
from xcbgen.expr import Field, Expression
import __main__
class Type(object):
'''
Abstract base class for all XCB data types.
Contains default fields, and some abstract methods.
'''
def __init__(self, name):
'''
... | 3.125 | 3 |
BioKlustering-Website/mlmodel/parser/kmeans.py | solislemuslab/mycovirus-website | 1 | 10325 | # Copyright 2020 by <NAME>, Solis-Lemus Lab, WID.
# All rights reserved.
# This file is part of the BioKlustering Website.
import pandas as pd
from Bio import SeqIO
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.cluster import KMeans
from sklearn.decomposition import PCA
from sklearn.cluster ... | 2.484375 | 2 |
workflow/src/routing.py | mibexsoftware/alfred-stash-workflow | 13 | 10326 | # -*- coding: utf-8 -*-
from src import icons, __version__
from src.actions import HOST_URL
from src.actions.configure import ConfigureWorkflowAction
from src.actions.help import HelpWorkflowAction
from src.actions.index import IndexWorkflowAction
from src.actions.projects import ProjectWorkflowAction
from src.actions.... | 1.984375 | 2 |
model/model.py | CaoHoangTung/shark-cop-server | 2 | 10327 | <reponame>CaoHoangTung/shark-cop-server
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.svm import SVC
from sklearn.metrics import classification_report, confusion_matrix
from mlxtend.plotting import plot_decision_regions
# from sk... | 2.328125 | 2 |
PE032.py | CaptainSora/Python-Project-Euler | 0 | 10328 | from itertools import count
from _pandigital_tools import is_pandigital
def pand_products():
"""
Returns the sum of all numbers n which have a factorization a * b = n such
that a, b, n are (cumulatively) 1 through 9 pandigital.
"""
total = set()
for a in range(2, 100):
for b in count(... | 3.6875 | 4 |
v1/models.py | jdubansky/openstates.org | 1 | 10329 | from django.db import models
from openstates.data.models import Bill
class LegacyBillMapping(models.Model):
legacy_id = models.CharField(max_length=20, primary_key=True)
bill = models.ForeignKey(
Bill, related_name="legacy_mapping", on_delete=models.CASCADE
)
| 2.0625 | 2 |
corehq/apps/accounting/utils.py | satyaakam/commcare-hq | 0 | 10330 | <filename>corehq/apps/accounting/utils.py
import datetime
import logging
from collections import defaultdict, namedtuple
from django.conf import settings
from django.template.loader import render_to_string
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django_prbac.models... | 1.984375 | 2 |
RSA/Algorithm/EEA.py | Pumpkin-NN/Cryptography | 0 | 10331 | <filename>RSA/Algorithm/EEA.py
def extended_euclidean_algorithm(a, b):
# Initial s = 1
s = 1
list_s = []
list_t = []
# Algorithm
while b > 0:
# Find the remainder of a, b
r = a % b
if r > 0:
# The t expression
t = (r - (a * s)) // b
li... | 3.375 | 3 |
hci/command/commands/le_apcf_commands/apcf_service_data.py | cc4728/python-hci | 3 | 10332 | from ..le_apcf_command_pkt import LE_APCF_Command
from struct import pack, unpack
from enum import IntEnum
"""
This pare base on spec <<Android BT HCI Requirement for BLE feature>> v0.52
Advertisement Package Content filter
"""
class APCF_Service_Data(LE_APCF_Command):
def __init__(self):
# TODO generate... | 2.21875 | 2 |
source/documentModel/representations/DocumentNGramSymWinGraph.py | Vyvy-vi/Ngram-Graphs | 178 | 10333 | <gh_stars>100-1000
"""
DocumentNGramSymWinGraph.py
Created on May 23, 2017, 4:56 PM
"""
import networkx as nx
import pygraphviz as pgv
import matplotlib.pyplot as plt
from networkx.drawing.nx_agraph import graphviz_layout
from DocumentNGramGraph import DocumentNGramGraph
class DocumentNGramSymWinGraph(Documen... | 2.75 | 3 |
examples/EC2Conditions.py | DrLuke/troposphere | 1 | 10334 | from __future__ import print_function
from troposphere import (
Template, Parameter, Ref, Condition, Equals, And, Or, Not, If
)
from troposphere import ec2
parameters = {
"One": Parameter(
"One",
Type="String",
),
"Two": Parameter(
"Two",
Type="String",
),
"Thr... | 2.65625 | 3 |
fist_phase/08_objects.py | kapuni/exercise_py | 0 | 10335 | class Student(object):
# __init__是一个特殊方法用于在创建对象时进行初始化操作
# 通过这个方法我们可以为学生对象绑定name和age两个属性
def __init__(self, name, age):
self.name = name
self.age = age
def study(self, course_name):
print('%s正在学习%s.' % (self.name, course_name))
# PEP 8要求标识符的名字用全小写多个单词用下划线连接
# 但是部分程序员和公司... | 4.03125 | 4 |
lrtc_lib/data/load_dataset.py | MovestaDev/low-resource-text-classification-framework | 57 | 10336 | # (c) Copyright IBM Corporation 2020.
# LICENSE: Apache License 2.0 (Apache-2.0)
# http://www.apache.org/licenses/LICENSE-2.0
import logging
from lrtc_lib.data_access import single_dataset_loader
from lrtc_lib.data_access.processors.dataset_part import DatasetPart
from lrtc_lib.oracle_data_access import gold_labels_... | 2.109375 | 2 |
graphql_compiler/compiler/emit_match.py | BarracudaPff/code-golf-data-pythpn | 0 | 10337 | <reponame>BarracudaPff/code-golf-data-pythpn
"""Convert lowered IR basic blocks to MATCH query strings."""
from collections import deque
import six
from .blocks import Filter, MarkLocation, QueryRoot, Recurse, Traverse
from .expressions import TrueLiteral
from .helpers import get_only_element_from_collection, validate_... | 2.65625 | 3 |
mo_leduc.py | mohamedun/Deep-CFR | 0 | 10338 | <gh_stars>0
from PokerRL.game.games import StandardLeduc
from PokerRL.game.games import BigLeduc
from PokerRL.eval.rl_br.RLBRArgs import RLBRArgs
from PokerRL.eval.lbr.LBRArgs import LBRArgs
from PokerRL.game.bet_sets import POT_ONLY
from DeepCFR.EvalAgentDeepCFR import EvalAgentDeepCFR
from DeepCFR.TrainingProfile imp... | 1.84375 | 2 |
geocircles/backend/gamestate.py | tmick0/geocircles | 0 | 10339 | <gh_stars>0
import sqlite3
from enum import Enum
import random
__all__ = ['state_mgr', 'game_state', 'next_state']
class game_state (Enum):
NEW_GAME = 0
WAITING_FOR_HOST = 1
HOST_CHOOSING = 2
GUEST_GUESSING = 3
GUEST_CHOOSING = 4
HOST_GUESSING = 5
def next_state(s):
if s == game_state.W... | 2.828125 | 3 |
tests/unit/providers/callables/__init__.py | YelloFam/python-dependency-injector | 0 | 10340 | <filename>tests/unit/providers/callables/__init__.py<gh_stars>0
"""Tests for callables."""
| 1.3125 | 1 |
dss/dss_capi_gr/__init__.py | dss-extensions/dss_python | 24 | 10341 | <gh_stars>10-100
'''
A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.
Copyright (c) 2016-2019 <NAME>
'''
from __future__ import absolute_import
from .IDSS import IDSS
| 0.960938 | 1 |
museflow/components/embedding_layer.py | BILLXZY1215/museflow | 0 | 10342 | from .component import Component, using_scope
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
class EmbeddingLayer(Component):
def __init__(self, input_size, output_size, name='embedding'):
Component.__init__(self, name=name)
self.input_size = input_size
self.output_size = out... | 2.671875 | 3 |
hydrocarbon_problem/env/__init__.py | lollcat/Aspen-RL | 1 | 10343 | from hydrocarbon_problem.env.types_ import Observation, Done, Stream, Column | 1.007813 | 1 |
addon_common/common/decorators.py | Unnoen/retopoflow | 1 | 10344 | '''
Copyright (C) 2021 CG Cookie
http://cgcookie.com
<EMAIL>
Created by <NAME>, <NAME>
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 3 of the License, or
(at your op... | 2.140625 | 2 |
venv/Lib/site-packages/pandas/tests/window/moments/test_moments_consistency_ewm.py | ajayiagbebaku/NFL-Model | 28,899 | 10345 | import numpy as np
import pytest
from pandas import (
DataFrame,
Series,
concat,
)
import pandas._testing as tm
@pytest.mark.parametrize("func", ["cov", "corr"])
def test_ewm_pairwise_cov_corr(func, frame):
result = getattr(frame.ewm(span=10, min_periods=5), func)()
result = result.loc[(slice(Non... | 2.34375 | 2 |
brainex/query.py | ebuntel/BrainExTemp | 1 | 10346 |
# TODO finish implementing query
import math
from pyspark import SparkContext
# from genex.cluster import sim_between_seq
from brainex.op.query_op import sim_between_seq
from brainex.parse import strip_function, remove_trailing_zeros
from .classes import Sequence
from brainex.database import genexengine
def query(... | 2.609375 | 3 |
main.py | orgr/arbitrage_bot | 0 | 10347 | <gh_stars>0
import sys
import time
from typing import List
import asyncio
import ccxt.async_support as ccxt
# import ccxt
import itertools
from enum import Enum
class Color(Enum):
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
RESET = '\033[0m'
def colorize(s, color: Co... | 2.578125 | 3 |
examples/click-ninja/clickninja-final.py | predicatemike/predigame | 0 | 10348 | WIDTH = 20
HEIGHT = 14
TITLE = 'Click Ninja'
BACKGROUND = 'board'
def destroy(s):
sound('swoosh')
if s.name == 'taco':
score(50)
else:
score(5)
# draw a splatting image at the center position of the image
image('redsplat', center=s.event_pos, size=2).fade(1.0)
s.fade(0.25)
def ... | 3.09375 | 3 |
nni/retiarii/hub/pytorch/nasbench201.py | nbl97/nni | 2,305 | 10349 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import Callable, Dict
import torch
import torch.nn as nn
from nni.retiarii import model_wrapper
from nni.retiarii.nn.pytorch import NasBench201Cell
__all__ = ['NasBench201']
OPS_WITH_STRIDE = {
'none': lambda C_in, C_out, st... | 1.9375 | 2 |
setup.py | Pasha13666/dialog_py | 1 | 10350 | #!/usr/bin/env python3
import os
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='dialog_py',
version='1.0a1',
description='Python API for cdialog/linux dialog',
long_description=long_de... | 1.179688 | 1 |
test/test_who.py | rliebz/whoswho | 28 | 10351 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import unittest
import nose
from nose.tools import *
from whoswho import who, config
from nameparser.config.titles import TITLES as NAMEPARSER_TITLES
class TestMatch(unittest.TestCase):
def setUp(self):
self.name = '<NAME>'
def test... | 2.75 | 3 |
endpoints/UserEndpoint.py | GardenersGalore/server | 0 | 10352 | import json
from flask import request
from flask_restful import Resource, abort, reqparse
from models.User import User
"""
POST Creates a new resource.
GET Retrieves a resource.
PUT Updates an existing resource.
DELETE Deletes a resource.
"""
class UserEndpoint(Resource)... | 3.09375 | 3 |
passy_forms/forms/forms.py | vleon1/passy | 0 | 10353 | <reponame>vleon1/passy
from django.forms import forms
class Form(forms.Form):
def get_value(self, name):
self.is_valid() # making sure we tried to clean the data before accessing it
if self.is_bound and name in self.cleaned_data:
return self.cleaned_data[name]
... | 2.859375 | 3 |
assignment4/rorxornotencode.py | gkweb76/SLAE | 15 | 10354 | <filename>assignment4/rorxornotencode.py<gh_stars>10-100
#!/usr/bin/python
# Title: ROR/XOR/NOT encoder
# File: rorxornotencode.py
# Author: <NAME>
# SLAE-681
import sys
ror = lambda val, r_bits, max_bits: \
((val & (2**max_bits-1)) >> r_bits%max_bits) | \
(val << (max_bits-(r_bits%max_bits)) & (2**max_bits-... | 2.578125 | 3 |
authalligator_client/entities.py | closeio/authalligator-client | 0 | 10355 | import datetime
from enum import Enum
from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union, cast
import attr
import ciso8601
import structlog
from attr import converters
from . import enums
from .utils import as_json_dict, to_snake_case
logger = structlog.get_logger()
class Omitted(Enum):
... | 2.3125 | 2 |
library/device.py | lompal/USBIPManager | 24 | 10356 | <gh_stars>10-100
from library import config, ini, lang, log, performance, periphery, queue
from asyncio import get_event_loop
from threading import Thread, Event
from PyQt5.QtCore import QObject, pyqtSignal
from PyQt5.QtWidgets import QTreeWidgetItem
# noinspection PyPep8Naming
class Signal(QObject):
""" PyQt si... | 2.359375 | 2 |
agent/minimax/submission.py | youkeyao/SJTU-CS410-Snakes-3V3-Group06 | 1 | 10357 | <reponame>youkeyao/SJTU-CS410-Snakes-3V3-Group06
DEPTH = 3
# Action
class Action:
top = [1, 0, 0, 0]
bottom = [0, 1, 0, 0]
left = [0, 0, 1, 0]
right = [0, 0, 0, 1]
actlist = [(-1, 0), (1, 0), (0, -1), (0, 1)]
mapAct = {
actlist[0]: top,
actlist[1]: bottom,
actlist[2]: le... | 3.46875 | 3 |
public_html/python/Empty_Python_Page.py | Asher-Simcha/help | 0 | 10358 | <reponame>Asher-Simcha/help<filename>public_html/python/Empty_Python_Page.py
#!/usr/bin/pyton
# Title:
# Author:
# Additional Authors:
# Filename:
# Description:
# Version:
# Date:
# Last Modified:
# Location_of_the_Video:
# Meta_data_for_YouTube:
# Web_Site_For_Video:
# Start Your Code Here
#EOF
| 1.773438 | 2 |
Python/first_flask_project/utilities/file_reader.py | maxxxxxdlp/code_share | 0 | 10359 | <gh_stars>0
def read_csv(root, file_name, keys):
with open('{root}private_static/csv/{file_name}.csv'.format(root=root, file_name=file_name)) as file:
data = file.read()
lines = data.split("\n")
return [dict(zip(keys, line.split(','))) for i, line in enumerate(lines) if i != 0]
| 3.109375 | 3 |
semester3/oop/lab3/parser/client/MasterService/client.py | no1sebomb/University-Labs | 0 | 10360 | <reponame>no1sebomb/University-Labs
# coding=utf-8
from parser.client import *
from parser.client.ResponseItem import *
with (Path(__file__).resolve().parent / "config.json").open("rt") as siteConfigFile:
SITE_CONFIG = json.load(siteConfigFile)
class MasterService(Client):
class Link:
main = "https... | 2.1875 | 2 |
sketchduino/template.py | rodrigopmatias/sketchduino | 0 | 10361 | # -*- coding: utf-8 -*-
'''
Copyright 2012 <NAME> <<EMAIL>>
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 agree... | 1.554688 | 2 |
Tic-Tac-Pi/gameObjects/TextObject.py | mstubinis/Tic-Tac-Pi | 2 | 10362 | <filename>Tic-Tac-Pi/gameObjects/TextObject.py<gh_stars>1-10
import pygame
from pygame.locals import *
import resourceManager
class TextObject(pygame.sprite.Sprite):
def __init__(self,pos,fontSize,fontcolor,textstring):
pygame.sprite.Sprite.__init__(self) #call Sprite initializer
self.position = p... | 2.859375 | 3 |
src/encoded/server_defaults.py | beta-cell-network/beta-cell-nw | 4 | 10363 | from datetime import datetime
from jsonschema_serialize_fork import NO_DEFAULT
from pyramid.security import effective_principals
from pyramid.threadlocal import get_current_request
from string import (
digits,
ascii_uppercase,
)
import random
import uuid
from snovault.schema_utils import server_default
A... | 1.960938 | 2 |
app/__init__.py | geirowew/SapAPI | 1 | 10364 | <reponame>geirowew/SapAPI
from flask import Flask
#from config import Config
import config
app = Flask(__name__)
#app.config.from_object(Config)
app.config.from_object(config)
#from app import routes
from app import gettoken | 1.4375 | 1 |
todo/task/__init__.py | BenMcLean981/flask-todo | 0 | 10365 | """Todo module."""
| 0.972656 | 1 |
src/pvt_model/pvt_system/pipe.py | BenWinchester/PVTModel | 1 | 10366 | <filename>src/pvt_model/pvt_system/pipe.py<gh_stars>1-10
#!/usr/bin/python3.7
########################################################################################
# pvt_collector/pipe.py - Represents a pipe within the system.
#
# Author: <NAME>
# Copyright: <NAME>, 2021
#############################################... | 2.671875 | 3 |
tests/test_api_account_state.py | luisparravicini/ioapi | 0 | 10367 | import unittest
import os
import json
import requests
import requests_mock
from ioapi import api_url, IOService, AuthorizationError, UnexpectedResponseCodeError
class APIAccountStateTestCase(unittest.TestCase):
def setUp(self):
self.service = IOService()
@requests_mock.mock()
def test_account_st... | 2.703125 | 3 |
testData/devSeedData.py | bgporter/wastebook | 0 | 10368 | '''
fake posts to bootstrap a development database. Put any interesting cases
useful for development in here.
'''
from datetime import datetime
POST_DATA_1 = [
{
"created" : datetime(2015, 10, 1),
"published": datetime(2015, 10, 1),
"edited": datetime(2015, 10, 1),
"rende... | 2.640625 | 3 |
customer_support/utils.py | rtnpro/django-customer-support | 1 | 10369 | from __future__ import absolute_import
from django.shortcuts import render
import simplejson
import datetime
from django.http import HttpResponse
class GenericItemBase(object):
ITEM_ATTRS = []
def __init__(self, identifier):
self.identifier = identifier
def jsonify(self, value):
"""
... | 2.328125 | 2 |
tobit.py | AlvaroCorrales/tobit | 1 | 10370 | import math
import warnings
import numpy as np
import pandas as pd
from scipy.optimize import minimize
import scipy.stats
from scipy.stats import norm # edit
from scipy.special import log_ndtr
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error, mean_absolute_error
def sp... | 2.609375 | 3 |
setup.py | Raymond38324/hagworm | 0 | 10371 | <filename>setup.py
# -*- coding: utf-8 -*-
import setuptools
with open(r'README.md', r'r', encoding="utf8") as stream:
long_description = stream.read()
setuptools.setup(
name=r'hagworm',
version=r'3.0.0',
license=r'Apache License Version 2.0',
platforms=[r'all'],
author=r'Shaobo.Wang',
au... | 1.367188 | 1 |
mercury_ml/keras/containers.py | gabrieloexle/mercury-ml | 0 | 10372 | """
Simple IoC containers that provide direct access to various Keras providers
"""
class ModelSavers:
from mercury_ml.keras.providers import model_saving
save_hdf5 = model_saving.save_keras_hdf5
save_tensorflow_graph = model_saving.save_tensorflow_graph
save_tensorrt_pbtxt_config = model_saving.save_... | 2.421875 | 2 |
Code Injector/code_injector_BeEF.py | crake7/Defensor-Fortis- | 0 | 10373 | #!/usr/bin/env python
import netfilterqueue
import scapy.all as scapy
import re
def set_load(packet, load):
packet[scapy.Raw].load = load
del packet[scapy.IP].len
del packet[scapy.IP].chksum
del packet[scapy.TCP].chksum
return packet
def process_packet(packet):
"""Modify downloads files on t... | 2.875 | 3 |
pycardcast/net/aiohttp.py | Elizafox/pycardcast | 0 | 10374 | # Copyright © 2015 <NAME>.
# All rights reserved.
# This file is part of the pycardcast project. See LICENSE in the root
# directory for licensing information.
import asyncio
import aiohttp
from pycardcast.net import CardcastAPIBase
from pycardcast.deck import (DeckInfo, DeckInfoNotFoundError,
... | 2.5 | 2 |
libtiepie/triggeroutput.py | TiePie/python-libtiepie | 6 | 10375 | <gh_stars>1-10
from ctypes import *
from .api import api
from .const import *
from .library import library
class TriggerOutput(object):
""""""
def __init__(self, handle, index):
self._handle = handle
self._index = index
def _get_enabled(self):
""" Check whether a trigger output i... | 2.21875 | 2 |
conduit_rest/radish/conduit_rest_steps.py | dduleba/tw2019-ui-tests | 1 | 10376 | import time
from faker import Faker
from radish_ext.radish.step_config import StepConfig
from conduit.client import ConduitClient, ConduitConfig
class ConduitStepsConfig(StepConfig):
def __init__(self, context):
super().__init__(context)
self._faker = None
self.client = ConduitClient(Co... | 2.265625 | 2 |
SummaryExternalClient.py | Hackillinois2k18/Main-Repo | 5 | 10377 | <filename>SummaryExternalClient.py<gh_stars>1-10
import requests
import credentials
class SummaryExternalClient:
def pullSummaryForUrl(self, artUrl, title):
url = "https://api.aylien.com/api/v1/summarize"
headers = {"X-AYLIEN-TextAPI-Application-Key": credentials.AYLIEN_APP_KEY,
... | 3.046875 | 3 |
tests/test_render.py | isuruf/conda-build | 0 | 10378 | import os
import sys
from conda_build import api
from conda_build import render
import pytest
def test_output_with_noarch_says_noarch(testing_metadata):
testing_metadata.meta['build']['noarch'] = 'python'
output = api.get_output_file_path(testing_metadata)
assert os.path.sep + "noarch" + os.path.sep in o... | 2.0625 | 2 |
ABC/007/b.py | fumiyanll23/AtCoder | 0 | 10379 | <reponame>fumiyanll23/AtCoder
def main():
# input
A = input()
# compute
# output
if A == 'a':
print(-1)
else:
print('a')
if __name__ == '__main__':
main()
| 3.109375 | 3 |
SPAE/read_write.py | simon-schuler/SPAE | 0 | 10380 | #Writing MOOG parameter file for the parameter, abundance, and error calculations.
#The parameter file only needs to be written once, at beginning of the routine, because the output
#files are overwritten with each itereation of the routine, only minimal output data are needed.
#
#The user can choose to have the param... | 3.125 | 3 |
lectures/optimization/optimization_plots.py | carolinalvarez/ose-course-scientific-computing | 0 | 10381 | <reponame>carolinalvarez/ose-course-scientific-computing<filename>lectures/optimization/optimization_plots.py
"""Plots for optimization lecture."""
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import cm
def plot_contour(f, allvecs, legend_path):
"""Plot contour graph for function f."""
#... | 3.65625 | 4 |
gdsfactory/functions.py | simbilod/gdsfactory | 0 | 10382 | <reponame>simbilod/gdsfactory<gh_stars>0
"""All functions return a Component so you can easily pipe or compose them.
There are two types of functions:
- decorators: return the original component
- containers: return a new component
"""
from functools import lru_cache, partial
import numpy as np
from omegaconf impor... | 2.9375 | 3 |
OverlayUFOs/Overlay UFOs.roboFontExt/lib/OverlayUFOs.py | connordavenport/fbOpenTools | 0 | 10383 | #coding=utf-8
from __future__ import division
"""
# OVERLAY UFOS
For anyone looking in here, sorry the code is so messy. This is a standalone version of a script with a lot of dependencies.
"""
import os
from AppKit import * #@PydevCodeAnalysisIgnore
from vanilla import * #@PydevCodeAnalysisIgnore
from mojo.drawingT... | 1.960938 | 2 |
nautapy/__init__.py | armandofcom/nautapy | 25 | 10384 | <gh_stars>10-100
import os
appdata_path = os.path.expanduser("~/.local/share/nautapy")
os.makedirs(appdata_path, exist_ok=True)
| 1.398438 | 1 |
pyteamup/Calendar.py | LogicallyUnfit/pyTeamUp | 5 | 10385 | import requests
import json
import datetime
import sys
from dateutil.parser import parse as to_datetime
try:
import pandas as pd
except:
pass
from pyteamup.utils.utilities import *
from pyteamup.utils.constants import *
from pyteamup.Event import Event
class Calendar:
def __init__(self, cal_id, api_key):... | 2.625 | 3 |
configs/regnet.py | roatienza/agmax | 2 | 10386 |
from . import constant
parameters = {
'RegNet' : { "lr": 0.1, "epochs": 100, "weight_decay": 5e-5, "batch_size": 128, "nesterov": True, "init_backbone":True, "init_extractor":True,},
}
backbone_config = {
"RegNetX002" : {"channels": 3, "dropout": 0.2,},
"RegNetY004" : {"channels": ... | 1.671875 | 2 |
examples/ws2812/main.py | ivankravets/pumbaa | 69 | 10387 | <filename>examples/ws2812/main.py
#
# @section License
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2017, <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, i... | 2.359375 | 2 |
reports/urls.py | aysiu/manana | 9 | 10388 | from django.conf.urls import patterns, include, url
urlpatterns = patterns('reports.views',
url(r'^index/*$', 'index'),
url(r'^dashboard/*$', 'dashboard'),
url(r'^$', 'index'),
url(r'^detail/(?P<serial>[^/]+)$', 'detail'),
url(r'^detailpkg/(?P<serial>[^/]+)/(?P<manifest_name>[^/]+)$', 'detail_pkg')... | 2 | 2 |
BackEnd/venv/lib/python3.8/site-packages/pytest_flask/fixtures.py | MatheusBrodt/App_LabCarolVS | 0 | 10389 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import multiprocessing
import pytest
import socket
import signal
import os
import logging
try:
from urllib2 import URLError, urlopen
except ImportError:
from urllib.error import URLError
from urllib.request import urlopen
from flask import _request... | 2.3125 | 2 |
tableauserverclient/server/endpoint/endpoint.py | jorwoods/server-client-python | 1 | 10390 | from .exceptions import (
ServerResponseError,
InternalServerError,
NonXMLResponseError,
EndpointUnavailableError,
)
from functools import wraps
from xml.etree.ElementTree import ParseError
from ..query import QuerySet
import logging
try:
from distutils2.version import NormalizedVersion as Version
... | 2.390625 | 2 |
spec/test_importer.py | lajohnston/anki-freeplane | 15 | 10391 | import unittest
from freeplane_importer.importer import Importer
from mock import Mock
from mock import MagicMock
from mock import call
from freeplane_importer.model_not_found_exception import ModelNotFoundException
class TestImporter(unittest.TestCase):
def setUp(self):
self.mock_collection = Mock()
... | 2.546875 | 3 |
analysis/fitexp.py | mfkasim91/idcovid19 | 0 | 10392 | import argparse
import numpy as np
from scipy.stats import linregress
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser()
parser.add_argument("--plot", action="store_const", default=False, const=True)
args = parser.parse_args()
data = np.loadtxt("../data/data.csv", skiprows=1, usecols=list(range(1,8)),... | 2.9375 | 3 |
.venv/lib/python3.7/site-packages/jedi/inference/lazy_value.py | ITCRStevenLPZ/Proyecto2-Analisis-de-Algoritmos | 76 | 10393 | <gh_stars>10-100
from jedi.inference.base_value import ValueSet, NO_VALUES
from jedi.common import monkeypatch
class AbstractLazyValue(object):
def __init__(self, data, min=1, max=1):
self.data = data
self.min = min
self.max = max
def __repr__(self):
return '<%s: %s>' % (self.... | 2.40625 | 2 |
percept/plot.py | joshleeb/PerceptronVis | 0 | 10394 | <filename>percept/plot.py
import matplotlib.lines as lines
import matplotlib.pyplot as plt
COLOR_CLASSIFICATIONS = [
'black', # Unclassified
'blue', # Classified True (1)
'red' # Classified False (0)
]
def generate_line(ax, p0, p1, color='black', style='-'):
'''
Generates a line betw... | 3.875 | 4 |
openpype/hosts/flame/api/lib.py | j-cube/OpenPype | 1 | 10395 | import sys
import os
import re
import json
import pickle
import tempfile
import itertools
import contextlib
import xml.etree.cElementTree as cET
from copy import deepcopy
from xml.etree import ElementTree as ET
from pprint import pformat
from .constants import (
MARKER_COLOR,
MARKER_DURATION,
MARKER_NAME,
... | 2.078125 | 2 |
newanalysis/plot_performances.py | nriesterer/cogsci-individualization | 0 | 10396 | import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
if len(sys.argv) != 3:
print('usage: python plot_performances.py <group_csv> <indiv_csv>')
exit()
group_file = sys.argv[1]
indiv_file = sys.argv[2]
# Load the data
df_group = pd.read_csv(group_file)
df_i... | 2.5 | 2 |
src/helpers.py | demirdagemir/thesis | 0 | 10397 | <filename>src/helpers.py
from Aion.utils.data import getADBPath
import subprocess
def dumpLogCat(apkTarget):
# Aion/shared/DroidutanTest.py
# Define frequently-used commands
# TODO: Refactor adbID
adbID = "192.168.58.101:5555"
adbPath = getADBPath()
dumpLogcatCmd = [adbPath, "-s", adbID, "logc... | 2.296875 | 2 |
tests/test_show.py | domi007/pigskin | 6 | 10398 | from collections import OrderedDict
import pytest
import vcr
try: # Python 2.7
# requests's ``json()`` function returns strings as unicode (as per the
# JSON spec). In 2.7, those are of type unicode rather than str. basestring
# was created to help with that.
# https://docs.python.org/2/library/func... | 2.609375 | 3 |
integration_test/basic_op_capi.py | cl9200/nbase-arc | 0 | 10399 | <reponame>cl9200/nbase-arc<gh_stars>0
#
# Copyright 2015 N<NAME>.
#
# 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 app... | 1.773438 | 2 |