text string | size int64 | token_count int64 |
|---|---|---|
b = 10; c = 20;
a=b+c;
print(a) | 31 | 25 |
#!/usr/bin/env python
# requires python3
#ensure destpath exists and url, merged_folder_id, username and password are correct
#redhat: scl enable rh-python34 -- python3 /root/nessus_download_merge_and_upload.py
#debian: python3 /root/nessus_download_merge_and_upload.py
import requests, json, sys, os, getpass, time,... | 9,539 | 2,764 |
import sys
import inspect
import biocrnpyler
from os import listdir
from os.path import isfile
from os.path import join
# Get lists of bioCRNpyler objects of different types
species = [
(n, o) for (n, o) in inspect.getmembers(sys.modules["biocrnpyler"])
if inspect.isclass(o) and issubclass(o, biocrnpyler.Speci... | 3,162 | 1,158 |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
---------------------------------------------... | 3,998 | 1,268 |
from PIL import Image
import json, StringIO, requests
import time
import robotparser
import re
import sys
host = "http://dlss-dev-azaroth.stanford.edu/"
service = host + "services/iiif/f1rc/"
resp = requests.get(service + "info.json")
js = json.loads(resp.text)
h = js['height']
w = js['width']
img = Image.new("RGB", ... | 1,304 | 525 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This file imports your code from localization_logic.py and uses class Visualisation from visualisation.py.
Additionally, it imports code from sensor_fusion.py file.
You can change the code at your own risk!
"""
import easygopigo3 as go
import signal
import pyqtgraph a... | 3,353 | 986 |
"""
MIRA API config
"""
MODELS = [
{
"endpoint_name": "mira-large",
"classes": ["fox", "skunk", "empty"]
},
{
"endpoint_name": "mira-small",
"classes": ["rodent", "empty"]
}
]
HEADERS = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "Content-Type",
"Access-Cont... | 348 | 138 |
import os, sys, inspect, logging, time
lib_folder = os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0], '..')
lib_load = os.path.realpath(os.path.abspath(lib_folder))
if lib_load not in sys.path:
sys.path.insert(0, lib_load)
import capablerobot_usbhub
hub = capablerobot_usbhub.USBHub()
##... | 702 | 275 |
class Int_code:
def __init__(self, s, inputs):
memory = {}
nrs = map(int, s.split(","))
for i, x in enumerate(nrs):
memory[i] = x
self.memory = memory
self.inputs = inputs
def set(self, i, x):
self.memory[i] = x
def one(self, a, b, c, mod... | 3,545 | 1,256 |
from discord.ext import commands
class NotOwner(commands.CheckFailure):
pass
class NotModerator(commands.CheckFailure):
pass
class Blacklisted(commands.CheckFailure):
pass | 175 | 51 |
from setuptools import setup
# Get the long description by reading the README
try:
readme_content = open("README.rst").read()
except Exception as e:
readme_content = ""
# Create the actual setup method
setup(
name="pycinga",
version="1.0.0",
description="Python library to write Icinga plugins.",
... | 1,012 | 313 |
"""
Main call.
TODO:
- parallize the mda processing portion? (dask)
"""
import numpy as np
import matplotlib.pyplot as plt
import MDAnalysis as mda
from command_line import create_cmd_arguments, handle_command_line
from calc_relax import Calc_19F_Relaxation
from calc_fh_dists import Calc_FH_Dists
from plot_relax imp... | 4,177 | 1,647 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division
import numpy as np
from scipy.optimize import fmin_bfgs
class NeuralNetwork:
"""A simple neural network."""
def __init__(self, hidden_layers=(25,), reg_lambda=0, num_labels=2):
"""Instantiates the class."""
self.__h... | 6,404 | 2,106 |
import unittest
from unittest.mock import Mock, call
from ethereumapis.v1alpha1 import beacon_chain_pb2, validator_pb2
from spectroscope.clients.beacon_client import BeaconChainStreamer
from spectroscope.model import ChainTimestamp, Event, ValidatorIdentity
from spectroscope.model.update import (
ValidatorBalanceU... | 4,734 | 1,469 |
import numpy as np
class BoundBox:
"""
Adopted from https://github.com/thtrieu/darkflow/blob/master/darkflow/utils/box.py
"""
def __init__(self, obj_prob, probs=None, box_coord=[float() for i in range(4)]):
self.x, self.y = float(box_coord[0]), float(box_coord[1])
self.w, self.h =... | 1,519 | 643 |
# -*- coding: utf-8 -*-
"""
Created on Feb 28 20:56:45 2020
Copyright (c) Huawei Technologies Co., Ltd. 2019. All rights reserved.
"""
import json
import os
import sys
if __name__ == '__main__':
if len(sys.argv) != 3:
print(sys.argv)
print('argv error, inert_op_info.py your_op_file lib_op_file')
... | 904 | 358 |
"""Tests for motif/contour_extractors/utils.py
"""
import unittest
import numpy as np
from motif.contour_extractors import utils
class TestPeakStreamHelper(unittest.TestCase):
def setUp(self):
self.S = np.array([
[0, 0, 0],
[1, 0, 5],
[0, 0.002, 1],
[0.1, 0... | 16,982 | 7,077 |
"""
Python 2.7 Multiprocessing Unittest workaround.
=====================================================================
Due the manner in which multiprocessing is handled on windows
and the fact that __main__.py are actually called __main__
This workaround bypasses the fact that the calling unittest
script is called... | 667 | 197 |
import unittest
import docs as bp
class ApplicationClassTest(unittest.TestCase):
def setUp(self):
self.app = bp.Application()
def test_set_fps(self):
self.app.set_fps(30)
self.assertEqual(self.app.fps, 30)
self.app.set_fps(60)
self.assertEqual(self.app.fps, 60)
if _... | 363 | 142 |
# Copyright 2013 Google Inc. All Rights Reserved.
"""A command that prints out information about your gcloud environment."""
import os
import StringIO
import sys
import textwrap
from googlecloudsdk.calliope import base
from googlecloudsdk.core import config
from googlecloudsdk.core import log
from googlecloudsdk.cor... | 7,969 | 2,391 |
# -*- coding: utf-8 -*-
from django.conf.urls import include, url
from .user_admin_views import UserAdminListViewSet
user_admin_list=UserAdminListViewSet.as_view({
"get":"get"
})
urlpatterns = (
url(r'^user$', user_admin_list, name='user-admin-list'),
)
| 269 | 102 |
# Code generated by `typeddictgen`. DO NOT EDIT.
"""V1EmptyDirVolumeSourceDict generated type."""
from typing import TypedDict
V1EmptyDirVolumeSourceDict = TypedDict(
"V1EmptyDirVolumeSourceDict",
{
"medium": str,
"sizeLimit": str,
},
total=False,
)
| 283 | 91 |
import pandas as pd
import numpy as np
import click
import os
PRIORITY = ('Read-through', 'Protein coding',
'Pseudogene', 'TUCP', 'lncrna', 'lncRNA', 'other', 'ncRNA,other')
type_map = {
'other': 'lncRNA',
'ncRNA,other': 'lncRNA',
'lncrna': 'lncRNA',
'protein_coding': 'Protein coding',
... | 5,537 | 2,022 |
#!/usr/bin/python
import sys
import csv
def split_num(n, M):
# n : original number
# M : max size for split range
nsplit = n//M
if nsplit*M < n:
nsplit += 1
ninterval = n//nsplit
ncum = 1
end = 0
res = []
while end < n:
start = ncum
ncum += ninterval
... | 1,236 | 434 |
# Back compatibility -- use broad subdirectory for new code
from bcbio.broad.metrics import *
| 94 | 26 |
from utills import *
conn,cur=start("loja")
produtos_p="produto_id integer primary key autoincrement,nome text,valor real,categoria_id integer,constraint fk_categorias foreign key (categoria_id) references categorias(categoria_id)"
criarTabela("categorias","categoria_id integer primary key, categoria text")
criarTabela... | 1,019 | 402 |
from django import template
register = template.Library()
@register.filter
def is_bbb_mod(room, user):
return room.is_moderator(user)
| 140 | 46 |
# This Python file uses the following encoding: utf-8
import cv2
from multiprocessing import shared_memory
import numpy as np
import time
class Video:
def __init__(self, id, camera_number):
"""Initializes the class and calls its methods."""
self.id = id
self.ca... | 1,538 | 453 |
# -*- coding: utf-8 -*-
import scinum as sn
import numpy as np
def create_config(base_cfg):
# setup the config for 2018 data
from analysis.config.campaign_UltraLegacy18 import campaign as campaign_UltraLegacy18
from analysis.config.jet_tagging_sf import ch_ee, ch_emu, ch_mumu, ch_e, ch_mu
cfg = base_c... | 8,437 | 4,580 |
'''
This algorithm is a IA-RL implementation on off-policy TD3 algorithm, to check the original IA-RL algorithm
you can refer to https://arxiv.org/abs/1811.06187.
Since it is a baseline algorithm, the descriptions are mostly omitted, please visit the HUGTD3.py for more implementation details
'''
import pickle
import n... | 8,557 | 3,017 |
#!/usr/bin/evn python
# jojo_xia
import os
import re
import socket
from urllib import request
from urllib.error import ContentTooShortError
import apk_info
import data_utils
import file_utils
socket.setdefaulttimeout(30)
class qihu:
def __init__(self):
self.url_list = []
self.apk_list = []
... | 4,477 | 1,464 |
#/bin/python3
import os
import subprocess
# Const:
with open("config",'r') as conf:
VENV_A = conf.read()
PYTHON="python"
PYTHON3_VENV_A = os.path.join(VENV_A, "bin", "python3")
PIP=""
PIP_VENV_A= os.path.join(VENV_A, "bin", "pip3")
# Functions:
def python_call(argv):
subprocess.call([PYTHON, argv])
def p... | 469 | 206 |
# -*- coding: utf-8 -*-
import os
import time
import numpy as np
import pandas as pd
def get_1bet_nums(n, Pmax, Pmin=1, **kwargs):
'''
随机生成一注号码
Parameters
----------
n: 一注号码的个数
Pmax: 备选号码最大值
Pmin: 备选号码最小值
Returns
-------
bet_nums: 随机选中的一注号码列表
'''
# 无放随机回抽样
bet_n... | 2,900 | 1,261 |
from typing import Dict, List
from tudelft.utilities.immutablelist.AbstractImmutableList import AbstractImmutableList
from tudelft.utilities.immutablelist.ImmutableList import ImmutableList
from tudelft.utilities.immutablelist.Outer import Outer
from geniusweb.issuevalue.Bid import Bid
from geniusweb.issuevalue.Domai... | 1,500 | 431 |
# Copyright (C) 2013 Sony Mobile Communications AB.
# All rights, including trade secret rights, reserved.
import json
import time
import traceback
from ave.network.process import Process
from ave.network.exceptions import *
from ave.broker._broker import validate_serialized, RemoteBroker, Broker
from ave.brok... | 18,061 | 5,775 |
from flask import jsonify
from flask_jwt_extended import JWTManager
from app.v1.messages import MSG_INVALID_CREDENTIALS, MSG_TOKEN_EXPIRED
from app.v1.modules.users.daos import UserDAO
jwt = JWTManager()
def init_app(app, **kwargs):
# pylint: disable=unused-argument
"""
Auth extension initialization po... | 3,250 | 1,223 |
import subprocess
import time
import socket
import os
import smtplib
class CyberCPLogFileWriter:
fileName = "/home/cyberpanel/error-logs.txt"
@staticmethod
def SendEmail(sender, receivers, message, subject=None, type=None):
try:
smtpPath = '/home/cyberpanel/smtpDetails'
if... | 3,845 | 1,114 |
from .NumpyDataset import NumpyDataset | 38 | 12 |
# @Date: 2020-04-05T14:08:33+10:00
# @Last modified time: 2020-04-08T18:40:22+10:00
from labscript_devices import register_classes
register_classes(
'SMB100A',
BLACS_tab='labscript_devices.SMB100A.blacs_tabs.SMB100ATab',
runviewer_parser=None
)
| 261 | 139 |
#!/usr/bin/env python
"""Module for global fitting titrations (pH and cl) on 2 datasets
"""
import os
import sys
import argparse
import numpy as np
from lmfit import Parameters, Minimizer, minimize, conf_interval, report_fit
import pandas as pd
import matplotlib.pyplot as plt
# from scipy import optimize
def ci_repo... | 6,060 | 2,350 |
from datetime import timedelta
from typing import Optional
from ..abstract import ErdReadOnlyConverter
from ..primitives import *
from gehomesdk.erd.values.advantium import ErdAdvantiumCookTimeMinMax
class ErdAdvantiumCookTimeRemainingConverter(ErdReadOnlyConverter[Optional[timedelta]]):
def erd_decode(self, valu... | 487 | 147 |
import os
import sys
import neuron
import json
from pprint import pprint
from neuron import h
import matplotlib.pyplot as plt
import numpy as np
import h5py
## Runs the 5 cell iclamp simulation but in NEURON for each individual cell
# $ python pure_nrn.py <gid>
neuron.load_mechanisms('../components/mechanisms')
h.loa... | 3,842 | 1,678 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import unittest
from telemetry.page import page_set
from telemetry.timeline import tracing_timeline_data
from telemetry.value import trace
class ... | 973 | 343 |
import torch.nn.parallel
import torch.optim as optim
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
import torchvision.datasets
import torchvision.transforms as transforms
import torchvision.utils as vutils
from torch.autograd import Variable
import matplotlib.pyplot as plt
from PIL impo... | 4,383 | 1,927 |
from utils.Dataset_reader import Dataset_reader
from Dataset_IO.Classification.Dataset_conifg_classification import Dataset_conifg_classification
import Dataset_IO.Classification.Dataset_classification_pb2 as proto
import tensorflow as tf
import os
#TODO: ADD TFRECORDS AND MEANPROTO READING CHECKS
class Dataset_reade... | 3,044 | 959 |
# Recipe creation tool - create command build system handlers
#
# Copyright (C) 2014 Intel Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed... | 13,902 | 3,855 |
# model settings
model = dict(
type='ImageClassifier',
backbone=dict(
type='OTEMobileNetV3',
mode='small',
width_mult=1.0),
neck=dict(type='GlobalAveragePooling'),
head=dict(
type='NonLinearClsHead',
num_classes=1000,
in_channels=576,
hid_channels=... | 431 | 156 |
#!/usr/bin/python2
#
# Copyright 2019 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
roots = [
'bench',
'dm',
'docs',
'example',
'experimental',
'fuzz',
'gm',
'include',
'modules',
'platform_tools/an... | 2,254 | 696 |
import unittest
import sys
import os
sys.path.append('../')
from src.class_query import ClassQuery
from src.query_tool import QueryTool, Mode
base_path = os.path.dirname(__file__)
cq = ClassQuery(base_path + '/sample_queries/class_queries.xml')
class TestClassQuery(unittest.TestCase):
def test_class_cluster(self... | 598 | 202 |
#[2015-10-26] Challenge #238 [Easy] Consonants and Vowels
v=['a','e','i','o','u']
c=['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']
import random
string = raw_input()
word=[]
for i in range (len(string)):
if string[i] == 'v':
word.append(random.choice(v))
else:
word.append(ra... | 358 | 165 |
import init_file as variables
import cj_function_lib as cj
from datetime import datetime
fert_table = cj.extract_table_from_mdb(variables.QSWAT_MDB, "fert", variables.path + "\\fert.tmp~")
fert = ""
for fert_line in fert_table:
fert += cj.trailing_spaces(4, fert_line.split(",")[1], 0) + cj.string_trailing_spaces... | 899 | 381 |
import math,pyperclip
def main():
myMessage = 'Cenoonommstmme oo snnio. s s c'
myKey = 8
plainText = decryptMessage(myKey,myMessage)
print(plainText+'|')
pyperclip.copy(plainText)
def decryptMessage(key,message):
numOfColumns = math.ceil(len(message)/key)
numOfRows = key
numOfShadedbox... | 700 | 248 |
#!/bin/python
import requests
import json
import pprint
#remove https warning
requests.packages.urllib3.disable_warnings()
#url = "https://192.168.248.150/web_api/"
#user = "api_user"
#pw = "demo123"
def login(url,user,pw):
payload_list={}
payload_list['user']=user
payload_list['password']=pw
headers = {
... | 10,163 | 3,209 |
from typing import Any, Type
import aiofiles # type: ignore
from tornado.web import RequestHandler
from pait.app.base import BaseAppHelper
from pait.core import Pait as _Pait
from pait.g import config
from pait.model import response
from ._app_helper import AppHelper
__all__ = ["pait", "Pait"]
async def make_moc... | 1,753 | 543 |
from scrapy.item import Field, Item
# pylint: disable-msg=too-many-ancestors
class FundItem(Item):
code = Field()
name = Field()
tier = Field()
start_date = Field()
date = Field()
price = Field()
| 222 | 76 |
import json, yeelight, sys
from utils import get_alfred_object, bulb, bulb_properties, current_brightness
current_brigthness_index = round(int(current_brightness)/10)
brightness_list = [0,10,20,30,40,50,60,70,80,90,100]
brightness_list = brightness_list[current_brigthness_index:] + brightness_list[:current_brigthness_... | 609 | 230 |
__author__ = 'dimd'
from zope.interface import Interface, Attribute
class IProtocolStogareInterface(Interface):
"""
This interface define our session storage
Every custom storage have to implement this Interface
"""
session = Attribute(""" Container for our session """) | 296 | 73 |
#!/usr/bin/env python
from __future__ import division
import numpy as np
from lfd.environment.simulation import DynamicSimulationRobotWorld
from lfd.environment.simulation_object import XmlSimulationObject, BoxSimulationObject
from lfd.environment import environment
from lfd.environment import sim_util
from lfd.demo... | 3,616 | 1,374 |
import csv
import os.path
import random
import numpy as np
import scipy.io
import torch
import torchvision
from torch.utils.data import Dataset
# from .util import *
from data.util import default_loader, read_img, augment, get_image_paths
class PIPALFolder(Dataset):
def __init__(self, root=None, ... | 6,350 | 2,338 |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from... | 10,543 | 3,158 |
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... | 5,606 | 2,045 |
import unittest
from Familytree.individual import Person
from Familytree import variables
class Testperson(unittest.TestCase):
def setUp(self):
self.person = Person(1, "Jane", "Female")
def test_initialization(self):
# check instance
self.assertEqual(isinstance(self.person, Person), ... | 3,074 | 997 |
class BaseNode:
pass
class Node(BaseNode):
def __init__(self, offset, name=None, **opts):
self.offset = offset
self.end_offset = None
self.name = name
self.nodes = []
self.opts = opts
def __as_dict__(self):
return {"name": self.name, "nodes": [node.__as_dict... | 2,972 | 895 |
def foo():
print("I'm a lovely foo()-function")
print(foo)
# <function foo at 0x7f9b75de3f28>
print(foo.__class__)
# <class 'function'>
bar = foo
bar()
# I'm a lovely foo()-function
print(bar.__name__)
# foo
def do_something(what):
"""Executes a function
:param what: name of the function to be executed... | 795 | 312 |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import ... | 74,516 | 22,345 |
# Copyright 2019 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | 2,029 | 687 |
# This script was written by Conroy
# import discord
from discord.ext import commands
# inherit from commands.Cog
class Calculations(commands.Cog):
def __init__(self, bot):
# reference the bot object from Main.py
self.bot = bot
@commands.command(help=("Does simple math. Type a simple math ... | 2,438 | 706 |
n, m = [int(e) for e in input().split()]
mat = []
for i in range(n):
j = [int(e) for e in input().split()]
mat.append(j)
for i in range(n):
for j in range(m):
if mat[i][j] == 0:
if i == 0:
if mat[i][j+1] == 1 and mat[i][j-1] == 1 and mat[i+1][j] == 1:
... | 1,011 | 409 |
from . import db_api
from . import misc
# from . import postpone_message | 72 | 23 |
# coding: utf-8
"""
Xero AppStore API
These endpoints are for Xero Partners to interact with the App Store Billing platform # noqa: E501
Contact: api@xero.com
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
from xero_python.models import BaseModel
class Plan(BaseModel):... | 5,105 | 1,547 |
from abc import ABC, abstractmethod
class Command(ABC):
@abstractmethod
def execute(self):
pass
@abstractmethod
def un_execute(self):
pass
class AddCommand(Command):
def __init__(self, values, new_value):
self.values = values
self.new_value = new_value
def e... | 2,167 | 702 |
import numpy as np
from dqn.cnn.config import CNNConfigBase
from dqn.cnn.datum import (Batch, Loss, SampleFromActor, SampleFromBuffer,
split_sample_from_actor)
def test_sample_from_actor(config=CNNConfigBase()):
size = 4
s = SampleFromActor.as_random(size=size, np_defs=config.sampl... | 2,537 | 855 |
import codecs
import collections
import io
import os
import re
import struct
from .instruction import Instruction
from .opcode import Opcodes
from .registers import Registers
from .section import Section
from .symbol import Symbol
def p32(v):
return struct.pack('<I', v)
def unescape_str_to_bytes(x):
return c... | 6,943 | 1,981 |
from netCDF4 import Dataset
import glob,os.path
import numpy as np
from scipy.interpolate import UnivariateSpline
from matplotlib import cm
import matplotlib.pyplot as plt
#import site
#site.addsitedir('/tera/phil/nchaparr/SAM2/sam_main/python')
#from Percentiles import *
from matplotlib.patches import Patch
import sys... | 2,120 | 915 |
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 5,925 | 1,793 |
"""
test_Payload.py
Copyright 2012 Andres Riancho
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 the License.
w3af is distributed in the hope tha... | 2,172 | 648 |
# Copyright (C) 2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
from drf_spectacular.extensions import OpenApiFilterExtension, OpenApiAuthenticationExtension
from drf_spectacular.plumbing import build_parameter_type
from drf_spectacular.utils import OpenApiParameter
# https://drf-spectacular.readthedocs.io/en... | 1,700 | 447 |
"""
Version 1:
- It begins
- For some reason, this version of the decision code (in Shape.move) just makes
every shape move up and to the left
"""
from __future__ import division
import pygame, pygame.locals, math, random
RAND = random.Random()
RAND.seed()
UP = 0
DOWN = 1
RIGHT = 2
LEFT = 3
STAY = 4
PLAYER_MOVEM... | 14,720 | 4,662 |
import moeda
p = float(input('Digite o preço: '))
t = int(input('Qual o valor da taxa? '))
moeda.resumo(p, t)
| 111 | 49 |
'''
DetailLevels.py
Copyright (c) 2008 Joseph Greenawalt(jsgreenawalt@gmail.com)
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 us... | 11,683 | 4,163 |
CONNECTION_STRING = '/@'
CHUNK_SIZE = 100
BORDER_QTY = 5 # minimun matches per year per player for reload player
ATP_URL_PREFIX = 'http://www.atpworldtour.com'
DC_URL_PREFIX = 'https://www.daviscup.com'
ATP_TOURNAMENT_SERIES = ('gs', '1000', 'atp', 'ch')
DC_TOURNAMENT_SERIES = ('dc',)
DURATION_IN_DAYS = 18
ATP_CSV_PAT... | 1,142 | 548 |
#!/usr/bin/env python
r'''
https://www.hackerrank.com/challenges/journey-to-the-moon/problem
'''
import math
import os
import random
import re
import sys
class Node:
def __init__(self, v):
self.v = v
self.neighbors = set()
self.visit = False
def addN(self, n):
if n not in sel... | 3,383 | 1,222 |
#!/usr/bin/env python
'''
Check YAML file. Each _entry_ contains one or more _definitions_.
'''
import sys
import re
import yaml
from collections import Counter
# Keys for entries and definitions.
ENTRY_REQUIRED_KEYS = {'slug'}
ENTRY_OPTIONAL_KEYS = {'ref'}
ENTRY_LANGUAGE_KEYS = {'en', 'es', 'fr'}
ENTRY_KEYS = ENTRY... | 3,669 | 1,209 |
import pytest
import numpy as np
import pandas as pd
from SPARTACUS10 import spatial_silhouette as spasi
import sklearn.metrics as metrics
import os
def find_path(name, path = None):
if path is None:
path = os.getcwd()
for root, dirs, files in os.walk(path):
if name in files:
... | 6,430 | 2,443 |
# Standard
import os
import platform
# Pip
import typer
import yaml
from PIL import Image
from PyPDF2 import PdfFileReader, PdfFileWriter
from yaml.scanner import ScannerError
from yaml.loader import SafeLoader
# Custom
from auxiliary.message_keys import MessageKeys as mk
from auxiliary.file_explorer import FileExplo... | 5,014 | 1,572 |
from django.shortcuts import render
from django.views import View, generic
from .services.predictor import get_results
class Index(View):
template_name = 'predictions/index.html'
model = 'xgboost'
season = '16/17'
results = ''
leadboard = ''
def get(self, request):
self.results = get_r... | 888 | 249 |
from .impl import SumType
from .types import Either, Maybe
__all__ = ('SumType', 'Either', 'Maybe') | 100 | 32 |
import numpy as np
import pandas as pd
import pickle as pk
import random
from sklearn.metrics import accuracy_score
from sklearn import preprocessing
from sklearn.ensemble import RandomForestClassifier
from sklearn.preprocessing import Imputer
def read_csv(csv_path):
df = pd.read_csv(csv_path)
return df
d... | 2,599 | 1,025 |
from decimal import Decimal
import simplejson as json
import requests
from .converter import RatesNotAvailableError, DecimalFloatMismatchError
class BtcConverter(object):
"""
Get bit coin rates and convertion
"""
def __init__(self, force_decimal=False):
self._force_decimal = force_decimal
... | 7,546 | 2,194 |
# iPhone Manager bot by Oldmole
# No support will be provided, this code is provided "as is" without warranty of any kind, either express or implied. Use at your own risk.
# The use of the software and scripts is done at your own discretion and risk and with agreement that you will be solely responsible for any damage
... | 10,805 | 4,150 |
# Generated by Django 3.1.7 on 2021-03-09 16:24
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Material',
fields=[
('id', models.AutoField... | 1,892 | 708 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# 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 ... | 3,514 | 930 |
import re
from dataclasses import dataclass
from collections import defaultdict
from itertools import cycle
@dataclass
class Line:
x1: int
y1: int
x2: int
y2: int
def all_points(self):
stepx = 1 if self.x1 < self.x2 else -1
stepy = 1 if self.y1 < self.y2 else -1
if self.x1... | 1,086 | 402 |
# Generated by Django 3.0.7 on 2020-12-20 15:16
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('academica', '0002_auto_20201220_0117'),
]
operations = [
migrations.RemoveField(
model_name='clase',
name='nivel',
)... | 1,513 | 453 |
from event.models import Event
from talk.models import Talk
def committee_member_context_processor(request):
if request.user.is_authenticated:
return {
"is_committee_member": request.user.has_perms(
("talk.add_vote", "talk.add_talkcomment")
)
}
else:
... | 721 | 213 |
from spectrum import Spectrum, align_wavelengths
def divide( numerator: Spectrum, denominator: Spectrum, wl_low: float = None, wl_high: float = None ) -> Spectrum:
"""
Performs a point-by-point division of the numerator spectrum by the denominator spectrum. If wavelength ranges
are not specificed, will u... | 948 | 338 |
'''4. Write a Python program to check whether multiple variables have the same value.'''
var1, var2, var3 = 20, 20, 20
if var1 == var2== var3:
print("var1, var2, and var3 have the same value !") | 198 | 70 |
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from baseapp.models import Recently
# Create your models here.
class PublishedManager(models.Manager):
def get_queryset(self):
return super(PublishedManage... | 1,895 | 540 |
# encoding: utf-8
from __future__ import absolute_import
from avython.console.main import warning_color, show_error, show_warning, check_continue, bcolors
| 156 | 46 |
# -*- coding: utf-8 -*-
from . import geo
class CountryMiddleware(object):
"""
This is a middleware that parses a request
and decides which country the request came from.
"""
def process_request(self, request):
request.COUNTRY_CODE = geo.get_country_from_request(request)
| 303 | 97 |