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 |
|---|---|---|---|---|---|---|
tests/python_venv/test_env.py | jmknoble/python-venv | 1 | 12778251 | """Provide unit tests for `~python_venv.env`:py:mod:."""
import unittest
import parameterized # https://pypi.org/project/parameterized/
from python_venv import const, env, reqs
class TestEnv_000_General(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_PV_EN... | 2.828125 | 3 |
online/cflib/utils/multiranger.py | jmslagmay/apoleid | 0 | 12778252 | <reponame>jmslagmay/apoleid<gh_stars>0
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# ... | 1.960938 | 2 |
ryu/app/network_awareness/shortest_forwarding.py | lzppp/mylearning | 0 | 12778253 | <reponame>lzppp/mylearning
# Copyright (C) 2016 <NAME> at Beijing University of Posts
# and Telecommunications. www.muzixing.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
#
# htt... | 1.6875 | 2 |
tests/features/steps/database.py | manoadamro/jason | 0 | 12778254 | <reponame>manoadamro/jason<gh_stars>0
import shlex
import subprocess
import time
from datetime import datetime
from behave import given, then, when
from jason import JSONEncoder, jsonify, make_config, service
from jason.ext.sqlalchemy import SQLAlchemy
EXPOSED_FIELDS = ["created", "name"]
db = SQLAlchemy()
@JSONE... | 2.375 | 2 |
translation.py | ogg17/fb2translate | 0 | 12778255 | <reponame>ogg17/fb2translate
import translators as ts
class BookType(enum.Enum):
fb2 = 0
epub = 1
class TranslateType(enum.Enum):
google = 0
yandex = 1
def text_translate(translate_type, text):
trans_text = ''
if translate_type == TranslateType.google:
trans_text = ts.google(text, f... | 2.90625 | 3 |
ncharts/management/commands/clear_clients.py | ncareol/ncharts | 0 | 12778256 | from django.core.management.base import BaseCommand
from ncharts.models import VariableTimes
from ncharts.models import ClientState
from ncharts import views as nc_views
from django.contrib.sessions.models import Session
class Command(BaseCommand):
def handle(self, **options):
sessions = Session.object... | 2.109375 | 2 |
pyth/plugins/plaintext/__init__.py | eriol/pyth | 47 | 12778257 | """
Plaintext
"""
| 0.96875 | 1 |
bayes_implicit_solvent/rjmc_experiments/tree_rjmc_w_elements.py | openforcefield/bayes-implicit-solvent | 4 | 12778258 | <reponame>openforcefield/bayes-implicit-solvent
from jax.config import config
config.update("jax_enable_x64", True)
from numpy import load, random
from simtk import unit
from bayes_implicit_solvent.molecule import Molecule
import sys
valid_lls = ['student-t']
try:
job_id = int(sys.argv[1])
ll = sys.argv[2]... | 2.03125 | 2 |
analysis-and-complexity-of-algorithms/big-o-notation/time-complexity/linear/examples/example-02.py | DKSecurity99/academic-programming | 2 | 12778259 | # O(n)
from typing import List
Vector = List[int]
n = [1, 20, 30, 40, 50, 60]
total = 0
def sumArrayElements(array: Vector) -> int:
total = 0
for v in n:
total += v
return total
print(sumArrayElements(n)) | 3.484375 | 3 |
dataparser/queue/finder.py | idxn/sublime-robot-framework-assistant | 103 | 12778260 | import os
import fnmatch
def finder(path, ext):
"""Returns files from path by extension"""
l = []
if not ext.startswith('*.'):
ext = '*.{0}'.format(ext)
for path, dirs, files in os.walk(os.path.abspath(path)):
for f in fnmatch.filter(files, ext):
l.append(os.path... | 3.265625 | 3 |
650/main.py | JanaSabuj/Leetcode-solutions | 13 | 12778261 | class Solution:
def minSteps(self, n: int) -> int:
sum = 0
# prime factorise
for i in range(2, int(sqrt(n)) + 1):
while n % i == 0:
n//= i;
sum += i
if n > 1:
sum += n
return sum | 3.328125 | 3 |
sgn.py | 102/sign | 0 | 12778262 | <reponame>102/sign<gh_stars>0
#!/usr/bin/python3
import hash
import rsa
import argparse
from collections import deque
md5 = hash.MD5()
def int_to_bytearray(a):
x = deque()
while a:
x.appendleft(a & 0xff)
a >>= 8
return bytearray(x)
def generate(args):
public, private = rsa.get_key... | 2.875 | 3 |
tests/formats/mysql/definitions/test_database.py | cmancone/mygrations | 10 | 12778263 | <filename>tests/formats/mysql/definitions/test_database.py<gh_stars>1-10
import unittest
from mygrations.formats.mysql.file_reader.database import database as database_reader
from mygrations.formats.mysql.file_reader.create_parser import create_parser
class test_database(unittest.TestCase):
def _get_sample_db(self... | 2.859375 | 3 |
Subproblem/parameters_subproblem.py | oyvorha/Master_Heuristic | 1 | 12778264 |
class ParameterSub:
def __init__(self, route, vehicle, pattern, customer_arrivals, L_CS, L_FS, base_violations, V_0, D_O, base_deviations,
weights, hour):
# Sets
self.stations = [i for i in range(len(route.stations))]
self.charging_stations = list()
self.non_chargi... | 2.671875 | 3 |
apps/exercises/views.py | ospreyelm/HarmonyLab | 4 | 12778265 | <filename>apps/exercises/views.py
import json
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth import get_user_model
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.shortcuts import render
from django.utils.decor... | 2.1875 | 2 |
neural_network.py | will-cromar/needy | 4 | 12778266 | <reponame>will-cromar/needy
# Luke
from pybrain.datasets import SupervisedDataSet
from pybrain.tools.shortcuts import buildNetwork
from pybrain.supervised.trainers import BackpropTrainer
from pybrain.structure.modules import TanhLayer
from normalizer import normalize
from normalizer import denormalize
from price_parsi... | 3.0625 | 3 |
ote_sdk/ote_sdk/entities/coordinate.py | ntyukaev/training_extensions | 775 | 12778267 | <reponame>ntyukaev/training_extensions
"""This module implements the Coordinate entity"""
# Copyright (C) 2021-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
from typing import Tuple
class Coordinate:
"""
Represents a 2D-coordinate with an x-position and a y-position.
NB most coordinates ... | 3.328125 | 3 |
bot/twitter.py | dandelea/twitter-naive-communities | 0 | 12778268 | <filename>bot/twitter.py
import datetime
import time
import tweepy
class Connection:
"""
Manages the connection with the Twitter API.
"""
def __init__(self, accounts, user_fields, tweet_fields):
self.accounts = accounts
self.index = 0
self.user_fields = user_fields
self... | 3.28125 | 3 |
tests/util/test_message_loop.py | natduca/ndbg | 5 | 12778269 | # Copyright 2011 Google 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 writing,... | 2.359375 | 2 |
tests/contracts/test_bundle.py | devopshq/crosspm2 | 3 | 12778270 | <reponame>devopshq/crosspm2
import pytest
from crosspm.contracts.bundle import Bundle, validate_trigger_package_doesnt_hide_higher_version
from crosspm.contracts.package import Package
from crosspm.helpers.exceptions import CrosspmBundleNoValidContractsGraph, CrosspmException, \
CrosspmBundleTriggerPackageHidesHig... | 2.046875 | 2 |
fonty/models/font/font_format.py | jamesssooi/font-cli | 12 | 12778271 | <reponame>jamesssooi/font-cli
'''font_format.py'''
from enum import Enum
class FontFormat(Enum):
'''Represents a font format.'''
WOFF = 'woff'
WOFF2 = 'woff2'
TTF = 'ttf'
OTF = 'otf'
| 2.40625 | 2 |
kashgari/layers/__init__.py | SharpKoi/Kashgari | 2,422 | 12778272 | # encoding: utf-8
# author: BrikerMan
# contact: <EMAIL>
# blog: https://eliyar.biz
# file: __init__.py
# time: 7:39 下午
from typing import Dict, Any
from tensorflow import keras
from .conditional_random_field import KConditionalRandomField
from .behdanau_attention import BahdanauAttention # type: ignore
L = keras... | 2.125 | 2 |
e2xgrader/preprocessors/authoring/__init__.py | divindevaiah/e2xgrader | 2 | 12778273 | from .preprocessor import Preprocessor
from .removeexercise import RemoveExercise
from .copynotebooks import CopyNotebooks
from .copyfiles import CopyFiles
from .generatetaskids import GenerateTaskIDs
from .makeexercise import MakeExercise
from .filltemplate import FillTemplate
from .addtaskheader import AddTaskHeader
... | 1.132813 | 1 |
src/tav/tmux/model.py | mudox/pytav | 0 | 12778274 | # -*- coding: utf-8 -*-
from typing import NamedTuple
class Server(NamedTuple):
sessions: list
class Window(NamedTuple):
id: str
name: str
index: int
def __eq__(self, rhs):
if not isinstance(rhs, Window):
return NotImplemented
if self is rhs:
return True
return ... | 2.90625 | 3 |
tests/integration/airflow/dags/demo_dag.py | frankcash/marquez-airflow | 1 | 12778275 |
from datetime import datetime
from airflow.operators.dummy_operator import DummyOperator
from marquez_airflow import DAG
DAG_NAME = 'test_dag'
default_args = {
'depends_on_past': False,
'start_date': datetime(2019, 2, 1),
}
dag = DAG(DAG_NAME, schedule_interval='0 0 * * *',
catchup=False,
... | 2.203125 | 2 |
src/my_tfg_pkg/my_tfg_pkg/controller_node.py | pparrilla/ROS2_TFG | 0 | 12778276 | <reponame>pparrilla/ROS2_TFG
#!/usr/bin/env python3
from functools import partial
import json
import datetime
import rclpy
import os
from rclpy.logging import get_logger
from rclpy.node import Node
from my_tfg_interfaces.msg import FloatDataNode, StatusNode
from my_tfg_interfaces.srv import UploadFile
class Controll... | 2.34375 | 2 |
kafka/metrics/stats/percentiles.py | tcpcloud/debian-python-kafka | 0 | 12778277 | <gh_stars>0
from kafka.metrics import AnonMeasurable, NamedMeasurable
from kafka.metrics.compound_stat import AbstractCompoundStat
from kafka.metrics.stats import Histogram
from kafka.metrics.stats.sampled_stat import AbstractSampledStat
class BucketSizing(object):
CONSTANT = 0
LINEAR = 1
class Percentiles(... | 2.28125 | 2 |
niobium/webelement_wait.py | cle-b/niobium | 1 | 12778278 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import time
from selenium.common.exceptions import (
ElementNotVisibleException,
ElementNotInteractableException,
NoSuchElementException,
)
from .timeout import ImplicitWait, ExplicitWait
def wait(self, displayed=True, enabled=True, timeout=None):
"""
Wait ... | 3.4375 | 3 |
agilent33220a.py | Quik-e/Agilent-33220a-Remote-Control | 0 | 12778279 | <filename>agilent33220a.py<gh_stars>0
# By <NAME>
import time
import numpy as np
import visa
class instrument:
def __init__(self, visa_instrument_handle):
self.instrument_handle = visa_instrument_handle
self.memory=65536
self.namelen=12
self.vmax=10.0 # High Z
sel... | 2.71875 | 3 |
AnoutherFile.py | batmansdu/Git_learn | 0 | 12778280 | print("Another!")
"This is the develop branch for developing some new features."
| 1.367188 | 1 |
miniworld/model/spatial/Node/DefaultNode.py | miniworld-project/miniworld_core | 5 | 12778281 | # encoding: utf-8
from miniworld.model.spatial.MovementPattern.RandomWalk import RandomWalk
from .AbstractNode import AbstractNode
__author__ = "<NAME>"
__email__ = "uni at lamp<EMAIL>"
class DefaultNode(AbstractNode):
"""
Attributes
----------
crnt_movement_pattern : AbstractMovem... | 2.453125 | 2 |
exercises/CursoemVideo/ex075.py | arthurguerra/cursoemvideo-python | 0 | 12778282 | a = (int(input('Digite um número: ')),
int(input('Digite outro número: ')),
int(input('Digite mais um número: ')),
int(input('Digite o último número: ')))
print(f'Você digitou os valores {a}')
print(f'O número 9 apareceu {a.count(9)} vezes')
if a.count(3) != 0:
print(f'O valor 3 apareceu na {a.index(... | 3.984375 | 4 |
Python3/576.out-of-boundary-paths.py | 610yilingliu/leetcode | 0 | 12778283 | <filename>Python3/576.out-of-boundary-paths.py
#
# @lc app=leetcode id=576 lang=python3
#
# [576] Out of Boundary Paths
#
# @lc code=start
class Solution:
def findPaths(self, m: int, n: int, N: int, i: int, j: int):
dp = [[[0] * n for _ in range(m)] for _ in range(N + 1)]
for s in range(1, N + 1):
... | 3.3125 | 3 |
devday/event/models.py | ronnyfriedland/devday_website | 0 | 12778284 | from django.apps import apps
from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.utils.encoding import python_2_unicode_compatible
from django.utils.text import slugify
from django.utils.translation import ugettext_lazy as _
class EventManager(models.Manager):
... | 2.203125 | 2 |
codegenandtransformerapi/models/template.py | farhan-apimatic/2bb956fd-e451-4e82-beb3-5cae661a01be | 0 | 12778285 | # -*- coding: utf-8 -*-
"""
codegenandtransformerapi.models.template
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io )
"""
class Template(object):
"""Implementation of the 'template' enum.
TODO: type enum description here.
Attributes:
CS_PORT... | 1.351563 | 1 |
tensorkit/settings_.py | lizeyan/tensorkit | 0 | 12778286 | <reponame>lizeyan/tensorkit<gh_stars>0
from enum import Enum
from typing import *
from mltk import Config, ConfigField, field_checker
__all__ = ['JitMode', 'Settings', 'settings']
KNOWN_BACKENDS = ('PyTorch', 'TensorFlow')
def auto_choose_backend() -> Optional[str]:
"""
Choose the backend automatically.
... | 2.4375 | 2 |
leet/array/maxSubArrayLen.py | peterlamar/python-cp-cheatsheet | 140 | 12778287 | class Solution:
# Maximum Size Subarray Sum Equals k
def maxSubArrayLen(self, nums: List[int], k: int) -> int:
hm = {0:-1}
ps = 0
rtn = 0
for i in range(len(nums)):
ps += nums[i]
if ps not in hm:
hm[ps] = i
if ps - ... | 2.890625 | 3 |
cotede/qctests/cars_normbias.py | BillMills/CoTeDe | 0 | 12778288 | <filename>cotede/qctests/cars_normbias.py
# -*- coding: utf-8 -*-
"""
"""
from datetime import timedelta
import logging
import numpy as np
from numpy import ma
from oceansdb import CARS
from .qctests import QCCheckVar
module_logger = logging.getLogger(__name__)
class CARS_NormBias(QCCheckVar):
"""Compares m... | 2.5625 | 3 |
cli/tests/__init__.py | 2O4/keyt | 0 | 12778289 | <reponame>2O4/keyt<filename>cli/tests/__init__.py
"""Keyt tests."""
| 1.039063 | 1 |
projects/webptspy/apps/tcase/views/api.py | codelieche/testing | 2 | 12778290 | <reponame>codelieche/testing
# -*- coding:utf-8 -*-
"""
这个文件主要是提供:
1、通过case的id获取到最近的execute id
2、如果最近的execute id是空 就创建一个
"""
from datetime import datetime
from django.shortcuts import get_object_or_404
from django.http import JsonResponse
from django.views.generic import View
from django.core.exceptions import Permiss... | 2.265625 | 2 |
scripts/setup_scenes_example.py | mrudorfer/burg-toolkit | 0 | 12778291 | """
===================
Setup Scene Example
===================
This script provides examples for loading, using and saving an object library based on a YAML file.
We will step through the individual commands, generate thumbnails, VHACD meshes, URDF files for all objects.
After that, we will compute the stable poses o... | 2.78125 | 3 |
leetcode/python/easy/p777_canTransform.py | kefirzhang/algorithms | 0 | 12778292 | class Solution:
def canTransform(self, start: str, end: str) -> bool:
len1 = len(start)
len2 = len(end)
if len1 != len2:
return False
i = 0
j = 0
while i < len1 and j < len2:
while start[i] == 'X' and i < len1 - 1:
i += 1
... | 3.1875 | 3 |
lzproduction/sql/tables/Requests.py | alexanderrichards/LZProduction | 2 | 12778293 | """Requests Table."""
import json
import logging
from datetime import datetime
import cherrypy
from sqlalchemy import Column, Integer, String, TIMESTAMP, ForeignKey, Enum
from sqlalchemy.orm import relationship
from lzproduction.utils.collections import subdict
from ..utils import db_session
from ..statuses import LO... | 2.34375 | 2 |
tunelo/common/wsgi.py | ChameleonCloud/tunelo | 0 | 12778294 | <reponame>ChameleonCloud/tunelo<filename>tunelo/common/wsgi.py
from oslo_concurrency import processutils
from oslo_service import service
from oslo_service import wsgi
from tunelo.flask import create_app
from tunelo.common import exception
from tunelo.conf import CONF
_MAX_DEFAULT_WORKERS = 4
class WSGIService(ser... | 2.21875 | 2 |
servers/flashx.py | sodicarus/channels | 0 | 12778295 | <filename>servers/flashx.py<gh_stars>0
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# Alfa-PureITA - XBMC Plugin
# Conector para flashx
# http://www.mimediacenter.info/foro/viewtopic.php?f=36&t=7808
# Alfa-Addon / Alfa-PureITA
# -------------------------------------------------... | 2.109375 | 2 |
plugins/pkts_utils/pkts_utils.py | sooualil/atlas-feature-extraction-extension | 0 | 12778296 | import binascii
import numpy as np
import copy
from scapy.all import TCP, UDP, IP, IPv6, ARP, raw
def get_packet_matrix(packet):
"""
Transform a packet content into 1D array of bytes
Parameters
----------
packet : an IP packet
Returns
-------
1D ndarry of packet bytes
"""
hex... | 3.21875 | 3 |
raspa/raspa_join_movies.py | kbsezginel/tutorials | 11 | 12778297 | <filename>raspa/raspa_join_movies.py
"""
Join RASPA movie output pdb files for the adsorbent and adsorbate.
Creates a pdb file (not a trajectory!).
Usage:
>>> python raspa_join_movies.py framework.pdb adsorbate.pbd
Typical RASPA movie output names:
- framework: Framework_0_final.pdb
- adsorbate: Movie_IRMOF-1_2.2.2_... | 2.953125 | 3 |
ex_discrete_convolution.py | ZEXINLIU/Univariate_ttr_examples | 0 | 12778298 | <gh_stars>0
import numpy as np
from UncertainSCI.ttr import predict_correct_discrete, stieltjes_discrete, \
aPC, hankel_deter, mod_cheb, lanczos_stable
from UncertainSCI.utils.compute_moment import compute_moment_discrete
from UncertainSCI.families import JacobiPolynomials
from UncertainSCI.utils.verify_orthono... | 2.25 | 2 |
PyRAI2MD/Dynamics/Ensembles/thermostat.py | lopez-lab/PyRAI2MD | 12 | 12778299 | ######################################################
#
# PyRAI2MD 2 module for thermostat in NVT ensemble
#
# Author <NAME>
# Sep 7 2021
#
######################################################
import numpy as np
def NoseHoover(traj):
""" Velocity scaling function in NVT ensemble (Nose Hoover thermostat)
... | 2.53125 | 3 |
setup.py | daiyizheng/liyi-cute | 0 | 12778300 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2022/4/5 15:18
# @Author : <NAME>
# @Email : <EMAIL>
# @File : setup.py.py
import setuptools
__version__ = None
exec(open('liyi_cute/__init__.py').read())
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
tests_req... | 1.328125 | 1 |
faker/providers/lorem/tl_PH/__init__.py | jacksmith15/faker | 12,077 | 12778301 | <reponame>jacksmith15/faker<gh_stars>1000+
from ..fil_PH import Provider as FilPhProvider
class Provider(FilPhProvider):
"""Implement lorem provider for ``tl_PH`` locale.
There is no difference from the |FilPhLoremProvider|.
.. |FilPhLoremProvider| replace::
:meth:`FilPhLoremProvider <faker.prov... | 1.523438 | 2 |
sampling_free/modeling/generalized_rcnn/rpn/retinanet/__init__.py | ChenJoya/sampling-free | 266 | 12778302 | <reponame>ChenJoya/sampling-free
from .retinanet import build_retinanet | 0.8125 | 1 |
scripts/python/check_issue.py | zxkane/aws-cloudfront-extensions | 87 | 12778303 | import sys
import logging
from optparse import OptionParser
log = logging.getLogger('aws-cloudfront-extension.check_issue')
log_formatter = logging.Formatter(
'[%(asctime)s %(name)s][%(levelname)s] %(message)s')
log_stream_handler = logging.StreamHandler(sys.stdout)
log_stream_handler.setFormatter(log_formatter)
l... | 2.5 | 2 |
bootstrap/src/nodelabels.py | mapr/mapr-operators | 2 | 12778304 | import json
from common.mapr_logger.log import Log
class NodeLabels(object):
MAPR_LABEL = "mapr.com/usenode"
EXCLUSIVE_LABEL = "mapr.com/exclusivecluster"
def __init__(self, k8s):
self.k8s = k8s
self._node_count = 0
self._items = None
self._json = None
def _get_json(... | 2.484375 | 2 |
{{cookiecutter.gh_repo_name}}/setup.py | filwaitman/cookiecutter-lib | 0 | 12778305 | <reponame>filwaitman/cookiecutter-lib<filename>{{cookiecutter.gh_repo_name}}/setup.py<gh_stars>0
{%- if cookiecutter.py2_support.lower() == 'n' -%}
import sys
{% endif -%}
from setuptools import setup
{%- if cookiecutter.py2_support.lower() == 'n' %}
CURRENT_PYTHON = sys.version_info[:2]
REQUIRED_PYTHON = (3, 6)
if C... | 1.84375 | 2 |
tests/ref_jobs/fit_curve_odc_ref.py | Open-EO/openeo-odc | 1 | 12778306 | <filename>tests/ref_jobs/fit_curve_odc_ref.py
from dask.distributed import Client
import datacube
import openeo_processes as oeop
# Initialize ODC instance
cube = datacube.Datacube(app='collection', env='default')
cube_user_gen = datacube.Datacube(app='user_gen', env='user_generated')
# Connect to Dask Scheduler
clien... | 2.046875 | 2 |
drivers/verdictdb.py | xty0505/crossfilter-benchmark-public | 2 | 12778307 | <filename>drivers/verdictdb.py
import json
import datetime, time
import itertools
import pyverdict
import decimal
import os
import multiprocessing
from multiprocessing import Queue
from common import util
import pandas as pd
import numpy as np
import queue
import threading
from threading import Thread
#logger = loggin... | 2.375 | 2 |
minicms/urls.py | optik/minicms | 0 | 12778308 | from django.conf.urls import url
from . import views
app_name = 'minicms'
urlpatterns = [
url(r'^$', views.homepage, name='homepage'),
url(r'^(?P<path>.+)/$', views.page, name='page'),
]
| 1.617188 | 2 |
src/agent/base_agent.py | Wisteria30/GIM-RL | 3 | 12778309 | # -*- coding: utf-8 -*-
import torch
class Agent:
def __init__(self, env, cfg):
# if gpu is to be used
self.device = torch.device(
f"cuda:{cfg.gpu}" if torch.cuda.is_available() else "cpu"
)
self.env = env
self.cfg = cfg
self.n_states = self.env.observa... | 2.515625 | 3 |
wgetgui/wget_gui_main.py | tadiclazar/tkintering | 0 | 12778310 | <filename>wgetgui/wget_gui_main.py<gh_stars>0
import tkinter as tk
from tkinter import ttk
import urllib.request
import os
from download_funcs import get_content, get_content_from_file
def main():
root = tk.Tk()
root.wm_title("Content Downloader")
style = ttk.Style()
if os.name == "nt":... | 3.5 | 4 |
eventvec/server/model/torch_models/eventvec/event_torch_model.py | vedmathai/event-vec | 0 | 12778311 | import torch.nn as nn
import torch
class EventModel(nn.Module):
def __init__(self, input_size, hidden_size, output_size, device):
super(EventModel, self).__init__()
self.i2o = nn.Linear(input_size * 4, output_size, device=device)
self.dropout = nn.Dropout(0.1)
self.relu = nn.ReLU(... | 2.703125 | 3 |
pacman-arch/test/pacman/tests/upgrade074.py | Maxython/pacman-for-termux | 23 | 12778312 | self.description = "pkg2<2.0 dependency (satisfy)"
p = pmpkg("pkg1")
p.depends = ["pkg2<2.0"]
self.addpkg(p)
lp = pmpkg("pkg2", "1.9b-3")
self.addpkg2db("local", lp)
self.args = "-U %s" % p.filename()
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_EXIST=pkg1")
self.addrule("PKG_EXIST=pkg2")
| 1.960938 | 2 |
cli/gardener_ci/checkmarx_cli.py | zkdev/cc-utils | 15 | 12778313 | import concourse.steps.scan_sources
def upload_and_scan_from_component_descriptor(
checkmarx_cfg_name: str,
team_id: str,
component_descriptor_path: str
):
concourse.steps.scan_sources.scan_sources_and_notify(
checkmarx_cfg_name=checkmarx_cfg_name,
team_id=team_id,
... | 1.648438 | 2 |
Assignments/Dictionaries/Lab/01. Bakery.py | KaloyankerR/python-fundamentals-repository | 0 | 12778314 | <reponame>KaloyankerR/python-fundamentals-repository
items = input().split(" ")
bakery = {}
for item in range(0, len(items), 2):
key = items[item]
value = int(items[item + 1])
bakery[key] = value
print(bakery)
| 3.71875 | 4 |
trackml/score.py | victor-estrade/trackml-library | 166 | 12778315 | """TrackML scoring metric"""
__authors__ = ['<NAME>', '<NAME>', '<NAME>',
'<NAME>']
import numpy
import pandas
def _analyze_tracks(truth, submission):
"""Compute the majority particle, hit counts, and weight for each track.
Parameters
----------
truth : pandas.DataFrame
Truth ... | 2.9375 | 3 |
openedx_export_plugins/exporters/base.py | appsembler/openedx-export-plugins | 1 | 12778316 | """
Define an Exporter Plugin class providing
additional options to xmodule lib ExportManager
"""
import datetime
from lxml import etree
from xmodule.modulestore import xml_exporter
from .. import app_settings
from . import resolvers
class PluggableCourseExportManager(xml_exporter.CourseExportManager):
"""
... | 2.515625 | 3 |
test/unit-tests/common/test_translator.py | jaredcurtis/confluencebuilder | 0 | 12778317 | # -*- coding: utf-8 -*-
"""
:copyright: Copyright 2016-2019 by the contributors (see AUTHORS file).
:license: BSD-2-Clause, see LICENSE for details.
"""
from collections import namedtuple
from sphinxcontrib.confluencebuilder.translator import ConfluenceTranslator
from sphinxcontrib_confluencebuilder_util impor... | 2.109375 | 2 |
modmon/db/create.py | alan-turing-institute/ModMon | 1 | 12778318 | """
Functions for creating and deleting the ModMon database.
"""
import argparse
import sys
from sqlalchemy import create_engine
from sqlalchemy.exc import ProgrammingError
from .schema import Base
from .connect import get_database_config, DATABASE_NAME, ENGINE
from ..config import config
from ..utils.utils import as... | 3.484375 | 3 |
packages/w3af/w3af/tests/vuln_sites/utils/scan_vulnerable_site.py | ZooAtmosphereGroup/HelloPackages | 3 | 12778319 | <reponame>ZooAtmosphereGroup/HelloPackages
"""
test_scan_vulnerable_site.py
Copyright 2014 <NAME>
This file is part of w3af, http://w3af.org/ .
w3af 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 version 2 of t... | 1.804688 | 2 |
balsam/job_sources/JobInterface.py | hep-cce/hpc-edge-service | 0 | 12778320 | from common_core.MessageInterface import MessageInterface
from balsam_core.BalsamJobMessage import BalsamJobMessage
from balsam_core.job_sources.StatusMessage import StatusMessage
import logging,time,sys
logger = logging.getLogger(__name__)
class NoMoreJobs(Exception): pass
class JobListener:
''' opens message int... | 2.125 | 2 |
BOJ_Solved/BOJ-25191.py | CodingLeeSeungHoon/Python_Algorithm_TeamNote | 7 | 12778321 | <reponame>CodingLeeSeungHoon/Python_Algorithm_TeamNote
"""
백준 25191번 : 치킨댄스를 추는 곰곰이를 본 임스
"""
chicken = int(input())
coke, beer = map(int, input().split())
print(min(coke//2 + beer, chicken)) | 2.84375 | 3 |
pypardot/objects_v3/tests/__init__.py | andyoneal/PyPardotSF | 2 | 12778322 | <gh_stars>1-10
# This module (objects) was originally imported from <NAME>'s original implementation
# https://github.com/joshgeller/PyPardot/tree/349dde1fad561f32a425324005c4f2a0c4a23d9b/pypardot/objects
| 1.1875 | 1 |
test.py | dvanderrijst/DEMO-text2vec-openai | 7 | 12778323 | import json
f = open('data/movies.json')
data = json.load(f)
for movie in data[:10]:
print(movie["Title"]) | 3.1875 | 3 |
python/setup.py | chemalot/openmm-py | 1 | 12778324 | ###############################################################################
## The MIT License
##
## SPDX short identifier: MIT
##
## Copyright 2019 Genentech Inc. South San Francisco
##
## Permission is hereby granted, free of charge, to any person obtaining a
## copy of this software and associated documentation ... | 1.257813 | 1 |
pycausal_explorer/meta/_single_learner.py | gotolino/pycausal-explorer | 3 | 12778325 | <reponame>gotolino/pycausal-explorer
import numpy as np
from sklearn.base import clone
from sklearn.utils.validation import check_is_fitted, check_X_y
from pycausal_explorer.base import BaseCausalModel
class SingleLearnerBase(BaseCausalModel):
def __init__(self, learner):
if isinstance(learner, type):
... | 2.734375 | 3 |
ppdb_app/models.py | aryanicosa/ppdb_mvt | 0 | 12778326 | <gh_stars>0
from django.db import models
# Create your models here.
class Users(models.Model):
role = models.CharField(max_length=20)
username = models.CharField(max_length=100)
fullname = models.CharField(max_length=100)
password = models.CharField(max_length=200)
def __str__(self):
... | 2.453125 | 2 |
source/FnAssetAPI/core/properties.py | IngenuityEngine/ftrack-connect-foundry | 1 | 12778327 | import re
__all__ = ['UntypedProperty', 'TypedProperty', 'TimecodeProperty']
class UntypedProperty(object):
"""
The Property classes form the basis for the FixedInterfaceObject. They
implement a Python property, and store the data in the instances dataVar.
Docstrings can also be provided to improve help() ... | 2.625 | 3 |
tests/common/csv_import.py | Amber1990Zhang/nebula-graph | 0 | 12778328 | # Copyright (c) 2020 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License,
# attached with Common Clause Condition 1.0, found in the LICENSES directory.
import csv
import re
from tests.common.types import (
VID,
Rank,
Prop,
Tag,
Edge,
Vertex,
)
class CSV... | 2.265625 | 2 |
project/hijri_calendar_project/hijri_calendar_app/views.py | bilgrami/hijri-calendar | 1 | 12778329 | <filename>project/hijri_calendar_project/hijri_calendar_app/views.py
from django.shortcuts import render, get_object_or_404
from django.views.generic import TemplateView
from .models import HijriCalendar
from datetime import date
from helpers import cache_helper as ch
class HomePageView(TemplateView):
template_na... | 2.046875 | 2 |
examples/basic/cm_assembly_playground/early_tests/assembly_testold.py | tatung/somo | 27 | 12778330 | <gh_stars>10-100
from pathlib import Path
import os
import pybullet as p
import pybullet_data
import time # for waiting
from pybullet_utils import bullet_client as bc
from pybullet_utils import urdfEditor as ed
p0 = bc.BulletClient(connection_mode=p.DIRECT)
p0.setAdditionalSearchPath(pybullet_data.getDataPath())
... | 2.109375 | 2 |
lib/interactiveBrokers/extra.py | cmorgan/trading-with-python | 24 | 12778331 | '''
Created on May 8, 2013
Copyright: <NAME>
License: BSD
convenience functions for interactiveBrokers module
'''
from ib.ext.Contract import Contract
priceTicks = {1:'bid',2:'ask',4:'last',6:'high',7:'low',9:'close', 14:'open'}
timeFormat = "%Y%m%d %H:%M:%S"
dateFormat = "%Y%m%d"
def createContr... | 2.40625 | 2 |
blocks/bevel_types.py | go2net/PythonBlocks | 9 | 12778332 | <filename>blocks/bevel_types.py
# ctypes and os shouldn't be re-exported.
import ctypes as _ctypes
import os as _os
# Part One: Type Assignments for G and Instrument Drivers, see spec table
# 3.1.1.
#
# Remark: The pointer and probably also the array variants are of no
# significance in Python because there is no nat... | 1.882813 | 2 |
crawler/grant.gov/spiders/modules/item_properties.py | dmvieira/ETL-example | 1 | 12778333 | <reponame>dmvieira/ETL-example<gh_stars>1-10
# -*- coding: utf-8 -*-
import urllib2
import json
known_formats = 'pdf doc docx'.split()
def get_attachment_or_description(url):
f = urllib2.urlopen(url)
s = f.read()
f.close()
try:
data = json.loads(s, encoding='latin1')
except ValueError:
... | 2.6875 | 3 |
skills/program-y-wide/test.py | stefanrer/commonbsecret | 0 | 12778334 | <filename>skills/program-y-wide/test.py<gh_stars>0
import requests
def to_dialogs(sentences):
utters = [{"text": sent, "user": {"user_type": "human"}} for sent in ["hi"] + sentences]
return {"dialogs": [{"utterances": utters, "bot_utterances": utters, "human_utterances": utters}]}
def main_test():
url =... | 2.921875 | 3 |
src/main/python/get_ip_ranges/source.py | jbowdre/SWIPAMforvRA8 | 0 | 12778335 | <filename>src/main/python/get_ip_ranges/source.py<gh_stars>0
"""
Modified by <NAME> to support Solarwinds IPAM
Initial release: 11/10/2020
Copyright (c) 2020 VMware, Inc.
This product is licensed to you under the Apache License, Version 2.0 (the "License").
You may not use this product except in compliance with the L... | 2.203125 | 2 |
Chapter_4/SCU_4_9.py | charliealpha094/Introduction-to-Python-Programming-for-Business-and-Social-Sciences-Applications | 0 | 12778336 | # Done by <NAME> (2020/09/23)
# SCU 4.9 - Exception Handling
try:
value_entered = int(input("Please, enter a number: "))
print("The number entered was: ", str(value_entered))
except ValueError:
print("Invalid entry! Please, enter a numeric character.")
| 3.96875 | 4 |
quorum/parse/parse.py | LSaldyt/quorum | 0 | 12778337 | from collections import defaultdict
from ..objects import Clause
from ..objects import Statement
from ..structs import KnowledgeMap
from ..objects import Pattern
def parse_clause(words):
assert len(words) == 3
name, relation, node = words
return Clause((name, relation, node))
def parse_chained(words):
... | 2.84375 | 3 |
tests/model/test_provisioned_worker_pool_properties.py | yellowdog/yellowdog-sdk-python-public | 0 | 12778338 | <gh_stars>0
from yellowdog_client.model import ProvisionedWorkerPoolProperties
from .test_utils import should_serde
def test_serialize_empty():
obj_in_raw = ProvisionedWorkerPoolProperties()
obj_in_dict = {}
should_serde(obj_in_raw, obj_in_dict, ProvisionedWorkerPoolProperties)
def test_serialize_popu... | 2.140625 | 2 |
visitors/views.py | maxhamz/prieds_test_hospital_queue_be | 0 | 12778339 | from rest_framework.decorators import api_view
from rest_framework import status
from rest_framework.response import Response
from visitors.models import Visitor
from visitors.serializers import VisitorSerializer
# Create your views here.
@api_view(['GET', 'POST'])
def visitor_list(request, format=None):
if (requ... | 2.328125 | 2 |
plugins/modules/saos8_facts.py | ciena/ciena.saos8 | 2 | 12778340 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
"""
The module file for saos8_facts
"""
DOCUMENTATION = """
module: s... | 2.328125 | 2 |
pipeline_ie/coref.py | vj1494/PipelineIE | 15 | 12778341 | <reponame>vj1494/PipelineIE
from stanza.server import CoreNLPClient
import pandas as pd
import neuralcoref
from pipeline_ie.config import Config
import time
class Coref:
def __init__(self, nlp, coref_mode, data, coref_output=False):
self.nlp = nlp
self.coref_mode = coref_mode
self.data = d... | 2.953125 | 3 |
scripts/howde_allsome_stats.py | rsharris/HowDeSBT-multi_make_bf | 5 | 12778342 | #!/usr/bin/env python
"""
Compute some special stats in a howdesbt allsome tree.
"""
from sys import argv,stdin,stdout,stderr,exit
from howde_tree_parse import read_howde_tree_file
def usage(s=None):
message = """
usage: cat annotated_tree_file | howde_allsome_stats [options]
--table print the... | 3.203125 | 3 |
plotter/agg_01_d050_weights_dts.py | kit-tm/fdeval | 1 | 12778343 | <filename>plotter/agg_01_d050_weights_dts.py<gh_stars>1-10
import logging, math, json, pickle, os
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.dates as mdates
from datetime import datetime
import matplotlib.patches as patches
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib... | 1.921875 | 2 |
Factory/tests/test_factory_method.py | klee1611/design_pattern | 0 | 12778344 | <gh_stars>0
from ..factory_method import ProductAFactory, ProductBFactory
class TestFactoryMethod():
def test_factory_method(self):
factory_a = ProductAFactory()
factory_b = ProductBFactory()
product_a_name = factory_a.get_product_name()
product_b_name = factory_b.get_product_nam... | 2.984375 | 3 |
sso/tests/test_access_log.py | uktrade/staff-sso | 7 | 12778345 | import json
import pytest
from freezegun import freeze_time
from sso.core.logging import create_x_access_log
from sso.tests.factories.user import UserFactory
class TestAppAccessLog:
@pytest.mark.django_db
@freeze_time("2017-06-22 15:50:00.000000+00:00")
def test_user_info_is_logged(self, rf, mocker):
... | 2.15625 | 2 |
BOJ_Parsing/main.py | alsrua7222/ToyPython | 0 | 12778346 | import parserBOJ
import openpyxl as xl
parse = parserBOJ.Parse()
wb = xl.Workbook()
ws = wb.active
ws.title = "sheet100"
# 컬럼명 지정
col_names = ['문제 번호', '문제 제목', '맞힌 사람', '제출 횟수', '정답률']
for seq, name in enumerate(col_names):
ws.cell(row=1, column=seq+1, value=name)
row_num = 2
# 데이터 입력
for n, rows in enumerate(p... | 2.75 | 3 |
euler/problem_45.py | jcthomassie/euler | 0 | 12778347 | # -*- coding: utf-8 -*-
"""
Triangular, pentagonal, and hexagonal
=====================================
https://projecteuler.net/problem=45
Triangle, pentagonal, and hexagonal numbers are generated by the following
formulae:
Triangle Tn=n(n+1)/2 1, 3, 6, 10, 15, ...
Pentagonal Pn=n(3n−1)/2 1, 5, 12, 22, 35, ...... | 3.96875 | 4 |
grumpyforms/tests/form_test.py | FelixSchwarz/grumpywidgets | 0 | 12778348 | <filename>grumpyforms/tests/form_test.py
# This file is a part of GrumpyWidgets.
# The source code contained in this file is licensed under the MIT license.
# See LICENSE.txt in the main project directory, for more information.
from pythonic_testcase import *
from grumpyforms.api import Form
from grumpyforms.fields i... | 2.21875 | 2 |
HandsOnDemo/DSS Example Code/models/FieldOperation.py | Patrick-iOS/DevelopWithDeere2019-Mannheim | 1 | 12778349 | import json
class FieldOperation(object):
def __init__(self, d):
if type(d) is str:
d = json.loads(d)
self.from_dict(d)
def from_dict(self, d):
self.__dict__ = {}
for key, value in d.items():
if type(value) is dict:
value ... | 3.015625 | 3 |
src/database/json_func.py | swordysrepo/youtube_discord_bot | 1 | 12778350 | # import json
# a_dictionary = {"d": 4}
# def add_to_json(channel):
# '''add new channel to the json list file'''
# with open("stored_youtube_channels.json", "r+") as file:
# data = json.load(file)
# data.update(a_dictionary)
# file.seek(0)
# json.dump(data, file)
# #... | 3.359375 | 3 |