text string | size int64 | token_count int64 |
|---|---|---|
"""
Example usage of cmap() to assign a color to each mesh vertex
by looking it up in matplotlib database of colormaps
"""
print(__doc__)
from vedo import Plotter, Mesh, dataurl
# these are the some matplotlib color maps
maps = [
"afmhot",
"binary",
"bone",
"cool",
"coolwarm",
"copper",
"gi... | 696 | 265 |
''' class <name>:
<suite>
Assignments & def in <suite> create attributes of the class'''
# Object Construction
# Idea: All bank accounts have a balance and an account holder
# The account class should add those attributes to each of its instances
''' When a class is called:
1. New instance of t... | 2,696 | 696 |
from mongoengine import *
from secrets import db_host, db_port, db_user, db_password
from schemas import Profile
connect('t_database', port=db_port, host=db_host, username=db_user, password=db_password )
def get_profiles():
return Profile.objects | 250 | 78 |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Component:
DESCRIPTION = "Scans a file using Yara"
class Input:
FILE = "file"
RULES = "rules"
class Output:
RESULTS = "results"
class ScanFileInput(komand.Input):
schema = json.loads("""
{
"type": "object",
... | 2,435 | 781 |
# -*- coding: utf-8 -*-
"""# - - -
data-edit: 2018-04-28(05:30)
name: Jen-Soft-Print (JSP)
author: jen-soft
email: jen.soft.master@gmail.com
license: Licensed under the Apache License, Version 2.0
http://www.apache.org/licenses/LICENSE-2.0
description: short tools for using in inter... | 2,054 | 738 |
from django.core.exceptions import ValidationError
from django.core.validators import validate_email
def emailValidator(email):
'''Checks if an email is valid'''
try:
validate_email(str(email))
except ValidationError:
raise ValidationError(f'{email} is not a valid email') | 302 | 83 |
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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 applicab... | 2,695 | 1,004 |
import numpy as np
from ligeor.fitting.sampler import EmceeSampler
from ligeor.models.twogaussian import TwoGaussianModel
from ligeor.utils.lcutils import *
class EmceeSamplerTwoGaussian(EmceeSampler):
def __init__(self, filename='', times = [], fluxes = [], sigmas = [],
period_init=1, t0_ini... | 8,887 | 2,716 |
#-*- coding: utf-8 -*-
import psycopg2
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
from .errors import PygresError
from .model import Model
class Pygres(object):
conn = None
curs = None
model = Model
config = None
q = None
def __init__(self, config, **kwargs):
self.conf... | 2,078 | 603 |
#!/usr/bin/env python3
# coding: utf-8
class RdboxNode(object):
def __init__(self, hostname, ip, location):
self.hostname = hostname
self.ip = ip
self.location = location
def __repr__(self):
return "<RdboxNode '%s' : '%s' : '%s'>" % (self.hostname, self.ip, self.location)
... | 478 | 157 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###########################################################
# WARNING: Generated code! #
# ************************** #
# Manual changes may get lost if file is generated again. #
# Only code inside the [MANUAL] ta... | 9,185 | 3,424 |
import os
from pathlib import Path
import joblib
import json
import numpy as np
import sys
DIR = "./sync-results/escalation-gw/find-all-50-other-play/"
for folder in sorted(Path(os.path.abspath(DIR)).iterdir(), key=os.path.getmtime):
try:
full_path = os.path.join(DIR, folder, "findings.obj")
try:
... | 789 | 257 |
# -*- coding: utf-8 -*-
from lxml import etree
import lxml
import argparse
import os
import argparse
from tqdm import tqdm
import time
import threading
import regex
from io import StringIO, BytesIO
import zipfile
def get_args_parser():
parser = argparse.ArgumentParser(description='XML application parser')
pa... | 5,697 | 2,004 |
class InkCanvasClipboardFormat(Enum,IComparable,IFormattable,IConvertible):
"""
Specifies the formats that an System.Windows.Controls.InkCanvas will accept from the Clipboard.
enum InkCanvasClipboardFormat,values: InkSerializedFormat (0),Text (1),Xaml (2)
"""
def __eq__(self,*args):
""" x.__eq__(y) ... | 1,057 | 399 |
import torch
import subprocess
from torch.utils.cpp_extension import CUDAExtension
def check_cuda_torch_binary_vs_bare_metal():
# command line CUDA
cuda_dir = torch.utils.cpp_extension.CUDA_HOME
cuda_call = [cuda_dir + "/bin/nvcc", "-V"]
raw_output = subprocess.check_output(cuda_call, universal_newli... | 1,858 | 657 |
# Generated by Django 2.1.2 on 2020-10-14 23:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('publications', '0014_auto_20201002_1350'),
]
operations = [
migrations.AlterField(
model_name='stgknowledgeproducttranslation',
... | 437 | 155 |
import torch
import torch.nn as nn
import torchvision.models as models
import torchvision.transforms as transforms
import random
class ScoreSamples():
"""
Keeps the scores in lists of a predefined size to take inner expectations in the
Discriminator and generator adverserial losses.
"""
def __... | 6,120 | 2,180 |
from ..cw_model import CWModel
class ExpenseEntry(CWModel):
def __init__(self, json_dict=None):
self.id = None # (Integer)
self.company = None # **(CompanyReference)
self.chargeToId = None # (Integer)
self.chargeToType = None # **(Enum)
self.type = None # *(... | 1,102 | 339 |
# !/usr/bin/hfo_env python3
# encoding utf-8
from collections import namedtuple
"""
This module is used to test the agent previous trained
"""
EpisodeMetrics = namedtuple(
'EpisodeMetrics', ['touched_ball', 'passed_ball', 'scored_goal']
)
class GameMetrics:
def __init__(self):
self.num_ep = 0
... | 3,255 | 1,168 |
import torch.nn as nn
class CubeModule(nn.Module):
def __init__(self, module: nn.Module, **kwargs):
super().__init__()
# copy values
self.__dict__ = module.__dict__.copy()
# copy methods
for name, attr in module.__class__.__dict__.items():
if name not in ["__ini... | 600 | 179 |
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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 applicab... | 2,607 | 846 |
# Copyright (C) 2005, 2006, 2007 Michael Bayer mike_mp@zzzcomputing.com
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Define the base components of SQL expression trees."""
from sqlalchemy import util, exceptions, logging
from sqla... | 83,265 | 23,458 |
#!/usr/bin/env python
# ----------------------------------------------------------------------------
# Copyright (c) 2015--, The Horizomer Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------... | 19,218 | 5,942 |
# ---
# jupyter:
# jupytext:
# formats: ipynb,py
# split_at_heading: true
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.6.0
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# ... | 11,318 | 3,983 |
__base_version__ = "1.0"
__post_version__ = "222"
__gitversion__ = "f1c797df2966237244527c1c6343dbe9bc765342"
| 110 | 70 |
from std_imports import *
# random policy function used for MCTS
def randomPolicy(state):
while not state.isTerminal():
try:
action = random.choice(state.getPossibleActions())
except IndexError:
state.show_game_state
raise Exception("Non-terminal state has no possible action... | 8,248 | 2,304 |
"""Plot some basic BPT distributions
"""
import os, sys
from matplotlib import pyplot as plt
import numpy as np
from scipy.stats import expon, gamma, weibull_min, invgauss
mu = 100
alphas = [ 0.5, 1., 2., 5., 10.]
#alpha = 1
x_vals = np.arange(0, 4*mu)
# Plot for a range of alpha values
for alpha in alphas:
bpt = ... | 614 | 255 |
#!/usr/bin/env python3
import argparse
from json import dumps
from sys import argv
from vang.tfs.api import call
from vang.tfs.definition_utils import get_definition, get_definition_name
def get_release_definition(template, project, repo, branch, comment=None):
return get_definition(template,
... | 2,125 | 582 |
from .transform import Transform
class IntensityTransform(Transform):
"""Transform that modifies voxel intensities only."""
@staticmethod
def get_images(sample):
return sample.get_images(intensity_only=True)
@staticmethod
def get_images_dict(sample):
return sample.get_images_dict(... | 341 | 101 |
#!/usr/bin/env python
# To use the API, copy these 4 lines on each Python file you create
from niryo_one_python_api.niryo_one_api import *
import rospy
import time
rospy.init_node('niryo_one_example_python_api')
print "--- Start"
n = NiryoOne()
try:
# Calibrate robot first
n.calibrate_auto()
print "Cal... | 1,483 | 631 |
"""Din99o Lch class."""
from ..spaces import RE_DEFAULT_MATCH
from .lch import Lch
from .. import util
import math
import re
from ..util import MutableVector
ACHROMATIC_THRESHOLD = 0.0000000002
def lch_to_lab(lch: MutableVector) -> MutableVector:
"""Din99o Lch to lab."""
l, c, h = lch
h = util.no_nan(h)... | 1,560 | 627 |
import os
import requests
import re
HEATHROW_URL= "https://www.metoffice.gov.uk/pub/data/weather/uk/climate/stationdata/heathrowdata.txt"
WEATHER_DIR = "../data/weather"
HEATHROW_FILE = WEATHER_DIR + "/heathrow.csv"
HEADER ="year,month,maximum_temp,minimum_temp,days_of_air_frost,total_rainfall,total_sunshine\n"
if __... | 949 | 406 |
# coding: utf-8
# In[1]:
import drama as drm
import numpy as np
import matplotlib.pylab as plt
from matplotlib import gridspec
from sklearn.metrics import roc_auc_score
import os
import glob
import h5py
import scipy.io as sio
get_ipython().magic(u'matplotlib inline')
# In[12]:
fils = sorted(glob.glob('../data... | 4,277 | 1,784 |
# Django
from django.db import models
# Models
from django.contrib.auth.models import User
class Tag(models.Model):
name = models.CharField(max_length=20, unique=True, blank=False, null=False)
is_active = models.BooleanField(default=True)
created_at = models.DateTimeField(auto_now_add=True)
updated... | 1,362 | 445 |
__author__ = "Adam Mahameed"
__copyright__ = "2020 HMK-IDEA-Cryptor"
__credits__ = ["Adam Mahameed"]
__license__ = "MIT"
__email__ = "adam.mah315@gmail.com"
from Cryptors.DSA import DSA
from Cryptors.HMKnapsack import HMKnapsack
from pckgIDEA.IDEA import IDEA
KEY_SIZE = 128
class Receiver():
def __init__(self, ... | 2,776 | 910 |
# encoding: utf-8
#
# Copyright (c) 2020-2021 Hopenly srl.
#
# This file is part of Ilyde.
#
# 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
#... | 1,562 | 431 |
import rclpy
from rclpy.node import Node
from std_msgs.msg import String
class MinimalSubscriber(Node):
def __init__(self):
super().__init__('minimal_subscriber')
self.subscription = self.create_subscription(
String, 'chatter', self.listener_callback)
def listener_callback(self, ... | 557 | 194 |
from typing import Generator, Tuple
def break_string(string: str) -> Generator[Tuple[int, int], None, None]:
i = 0
while i < len(string):
count = 0
current_digit = string[i]
while i < len(string) and string[i] == current_digit:
count += 1
i += 1
yield (s... | 719 | 277 |
from . import main
from flask_wtf import FlaskForm
from wtforms import SubmitField,StringField,TextAreaField,SelectField
from wtforms.validators import Required
from ..models import Article,Comment
class ArticleUploadForm(FlaskForm):
article = TextAreaField('Article',validators=[Required()])
category = StringF... | 676 | 186 |
""" author: Ataba29
the code is just a russian roulette game against
the computer
"""
from random import randrange
import time
def main():
# create the gun and set the bullet
numOfRounds = 6
gun = [0, 0, 0, 0, 0, 0]
bullet = randrange(0, 6)
gun[bullet] = 1
player = False # is player ... | 2,526 | 769 |
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# * Make sure each ForeignKey has `on_delete` set to the desired behavior.
# * Remove `managed = False` lines if ... | 2,318 | 754 |
import pytest
import govuk_frontend_jinja
@pytest.fixture
def env(loader):
return govuk_frontend_jinja.Environment(
# for some reason the page_template tests only pass with trim_blocks=False
loader=loader,
autoescape=True,
keep_trailing_newline=True,
trim_blocks=False,
... | 500 | 155 |
# -*- coding: utf-8 -*-
from pip_services3_expressions.calculator.functions.DelegatedFunction import DelegatedFunction
from pip_services3_expressions.calculator.functions.FunctionCollection import FunctionCollection
from pip_services3_expressions.variants.Variant import Variant
class TestFunctionCollection:
def... | 1,044 | 298 |
# coding: utf-8
"""
GraphHopper Directions API
With the [GraphHopper Directions API](https://www.graphhopper.com/products/) you can integrate A-to-B route planning, turn-by-turn navigation, route optimization, isochrone calculations and other tools in your application. The GraphHopper Directions API consist... | 24,698 | 7,692 |
#
# PySNMP MIB module Printer-MIB (http://pysnmp.sf.net)
# ASN.1 source http://mibs.snmplabs.com:80/asn1/Printer-MIB
# Produced by pysmi-0.0.7 at Sun Feb 14 00:12:48 2016
# On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose
# Using Python version 3.5.0 (default, Jan 5 2016, 17:11:52)
#
( Obje... | 134,317 | 44,498 |
from computer import Computer
from mycomputer import MyComputer
builder = MyComputer()
builder.build_computer()
computer = builder.get_computer()
computer.display()
| 183 | 61 |
# -*- coding: utf-8 -*-
"""
.. module:: skimpy
:platform: Unix, Windows
:synopsis: Simple Kinetic Models in Python
.. moduleauthor:: SKiMPy team
[---------]
Copyright 2017 Laboratory of Computational Systems Biotechnology (LCSB),
Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland
Licens... | 3,563 | 1,326 |
#! Python
def getInput(datafile):
links = open(datafile, 'r')
dataTable = []
for line in links:
goodLine = line.strip('\n')
dataTable.append(goodLine)
links.close()
return dataTable
def createOutput(dataTable):
finalTable = {}
namesfile = []
x = 1
for i, data in enumerate(dataTable):
temppoint =... | 981 | 433 |
# =============================================================================
# Author: Teerapat Jenrungrot - https://github.com/mjenrungrot/
# FileName: 10433.py
# Description: UVa Online Judge - 10433
# =============================================================================
while True:... | 619 | 198 |
from fastapi.exceptions import HTTPException
from typing import List
from api.models import MovieIn, MovieOut
from fastapi import APIRouter
from api.db import get_all_movies, get_movie, add_movie, update_movie, delete_movie
movies_router = APIRouter()
@movies_router.get('/', response_model=List[MovieOut])
async def... | 1,317 | 433 |
"""Evaluators for the recommender model."""
import numpy as np
import pandas as pd
class Evaluator:
"""RMSE, RMSUE, MAE, MAUE evaluators wrapper."""
def _preprocessing(self, test_file, predictions_file):
test = pd.read_csv(test_file)
predictions = pd.read_csv(predictions_file)
test = ... | 10,457 | 3,194 |
#!/usr/bin/env python
#------------------------------------------------------------------------------
# Copyright 2014 Esri
# 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.apac... | 7,465 | 2,197 |
from django.contrib import admin
from farmers.models import ProductCategory
from accounts.models import Product
admin.site.register(ProductCategory)
admin.site.register(Product)
| 180 | 45 |
import serial
import time
import struct
def pack(value):
return struct.pack('>B', value)
def main():
ser = serial.Serial("/dev/ttyUSB0", 9600)
time.sleep(3)
ser.reset_input_buffer()
ser.reset_output_buffer()
time.sleep(5)
val = 100
while True:
val = val + 10
ser.write(... | 518 | 196 |
"""Tests for option6."""
| 25 | 9 |
import torch
from torch import nn
from torchvision.models.resnet import BasicBlock as BasicResidualBlock
from stable_baselines3.common.preprocessing import preprocess_obs
NETWORK_ARCHITECTURE_DEFINITIONS = {
'BasicCNN': [
{'out_dim': 32, 'kernel_size': 8, 'stride': 4},
{'out_dim': 64, 'ker... | 6,865 | 2,223 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from core.interfaces.task import Task
from core.utils.constants import Constants
class HelloWorldPolicy(Task):
def execute(self, input_entity):
if input_entity.project == 'TestProject':
return self.result(Constants.FAIL... | 540 | 151 |
'''
Numbers with non-decreasing digits
'''
N = int(input().strip())
i = N
while i > 0:
digits = list(str(i))
if digits == sorted(digits):
print(i)
break
i -= 1
else:
print(i)
| 208 | 79 |
import pytest
from functimer import Unit, get_unit
@pytest.mark.parametrize(
"_input, expected",
[
("0.2 ns", Unit.NANOSECOND),
("0.2 µs", Unit.MICROSECOND),
("0.2 ms", Unit.MILLISECOND),
("0.2 s", Unit.SECOND),
("0.2 m", Unit.MINUTE),
],
)
def test_get_unit(_input... | 499 | 204 |
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.schema import FetchedValue
from sqlalchemy.ext.associationproxy import association_proxy
from app.api.utils.models_mixins import Base
from app.extensions import db
from app.api.constants import *
class StateOfLand(Base):
__tablename__ = "state_of_la... | 1,713 | 571 |
from __future__ import division
import numpy as np
import pylab as plt
from collections import Counter
from fcube.fcube import countGauss_projection
import pickle
def gauss_sim(X, k, alg='gauss'):
m, n = np.shape(X)
idxT = Counter()
if alg == 'gauss':
G = np.random.randn(n, k)
Z = np.dot(X... | 2,118 | 893 |
"""mysite URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based ... | 2,151 | 737 |
from output.models.ms_data.particles.particles_r020_xsd.particles_r020 import (
B,
R,
Doc,
)
from output.models.ms_data.particles.particles_r020_xsd.particles_r020_imp import (
ImpElem1,
ImpElem2,
)
__all__ = [
"B",
"R",
"Doc",
"ImpElem1",
"ImpElem2",
]
| 295 | 137 |
# Generated by Django 3.0.1 on 2020-01-01 01:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lims', '0044_auto_20191231_1805'),
]
operations = [
migrations.AlterField(
model_name='guide',
name='kind',
... | 502 | 181 |
#-*-coding:utf8;-*-
import re
from random import choice
class sub(object):
""" a simple text to number evaluating class """
def text_to_number(self,text):
'''convert a number written as text to its real number equivalence'''
text = text.lower()
text = re.sub(r"ten", "10", text)
... | 5,303 | 2,164 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('commons', '0016_auto_20170223_1149'),
]
operations = [
migrations.AddField(
model_name='oer',
name='... | 1,217 | 351 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The kv_seek_account_history command allows to query the KV 'History of Accounts' table."""
import argparse
import context # pylint: disable=unused-import
from silksnake.helpers.dbutils import tables
from silksnake.remote import kv_metadata
from silksnake.remote import... | 1,827 | 598 |
#! /usr/bin/env python
# Sample Demo program to interface with the DHT11
# Created by Etech-SW
import adafruit_dht
import board
import time
dhtSensor = adafruit_dht.DHT11(board.D4)
try:
while True:
try:
humidity = dhtSensor.humidity
temp_c = dhtSensor.temperature
temp_f = temp_c * (9 / 5) + 32
print(... | 790 | 332 |
import ipywidgets
import numpy as np
import pandas as pd
import pathlib
from scipy.stats import linregress
from bokeh.io import push_notebook, show, output_notebook
from bokeh.plotting import figure
from bokeh.models import ColumnDataSource, RangeTool, Circle, Slope, Label, Legend, LegendItem, LinearColorMapper
from bo... | 18,460 | 6,640 |
import numpy as np
import matplotlib.pyplot as plt
DATA_14 = np.loadtxt("Poincare_1.400000.dat")
DATA_144 = np.loadtxt("Poincare_1.440000.dat")
DATA_1465 = np.loadtxt("Poincare_1.465000.dat")
Omega_14 = DATA_14[:,[0,0]]
Theta_14 = DATA_14[:,[1,1]]
time_14 = DATA_14[:,[2,2]]
Omega_144 = DATA_144[:,[0,0]]... | 1,115 | 625 |
"""
Place holder for the views. The current views file would be too large and can
get annoying to scroll when reading the source code.
"""
# Constant definitions
DEFAULT_LIBRARY_NAME_PREFIX = 'Untitled Library'
DEFAULT_LIBRARY_DESCRIPTION = 'My ADS library'
USER_ID_KEYWORD = 'X-Adsws-Uid'
from .base_view import BaseVi... | 614 | 175 |
# Herb Town (251000000) => Ardentmill
sm.setReturnField()
sm.setReturnPortal()
sm.warp(910001000, 6)
| 101 | 55 |
#!/usr/local/bin/python
import os
import sys
import signal
global version, command_list
version = "0.0.1"
command_list = {
'exit': {'run': 'cl_exit', 'info': 'Exit from ZXC-shell'},
'help': {'run': 'cl_help', 'info': 'Show help page'}
}
def cl_exit():
print("ZXC shutdown")
sys.exit(0)
def cl_he... | 1,153 | 413 |
# Copyright 2017, Google LLC 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 law or a... | 2,292 | 622 |
"""
Pillow - Módulo python com diversas funções para manipular imagens
"""
import os
from PIL import Image # Importando o Pillow
def main(main_images_folder, new_width=800):
if not os.path.isdir(main_images_folder): # Levantando exceção caso o dir não exista
raise NotADirectoryError(f'{main_images_fol... | 2,918 | 900 |
print("你好")
def add():
return 1+1
add()
| 47 | 24 |
# MIT License
# Copyright 2020 Ryan Hausen
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publis... | 2,244 | 824 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='CHVConcept',
fields=[
... | 11,456 | 3,030 |
import pathlib
from typing import List, Optional
import ni_python_styleguide._utils
class InMultiLineStringChecker:
"""Provide utility methods to decide if line is within a multiline string."""
def __init__(self, error_file: Optional[str] = None, *_, lines: Optional[List[str]] = None):
"""Cache off ... | 2,115 | 622 |
x = [1,2,3,4]
b1 = bytes(x)
print(b1) # --- BY1
print(type(b1)) # --- BY2
print(b1[1]) # --- BY3
print(b1[-3]) # --- BY4
for i in b1:
print(i) # --- BY5
size1 = 3
arr1 = bytes(size1)
print(arr1)# --- BY6
st1 = "Python is interesting."
# string with encoding 'utf-8'
arr2 = bytes(st1, 'utf-8')
print... | 335 | 167 |
from optparse import Values
from typing import FrozenSet, List, Set
import pytest
from pip._internal.cli import cmdoptions
from pip._internal.cli.base_command import Command
from pip._internal.cli.status_codes import SUCCESS
from pip._internal.models.format_control import FormatControl
class SimpleCommand(Command):... | 2,454 | 812 |
"""Unit tests for functions used in Robot Framework Historic Parser"""
import os
import sys
import unittest
from unittest.mock import patch
from robotframework_historic_parser.parserargs import parse_options
from robotframework_historic_parser.rfhistoricparser import get_time_in_min, rfhistoric_parser
ROOT_PATH = os.... | 1,742 | 550 |
#
# Copyright 2019 Koyal Bhartia
# @file 8-puzzle solver.py
# @author Koyal Bhartia
# @date 26/02/2019
# @version 1.0
#
# @brief This is the code to solve the 8-puzzle
#
# @Description This code has functions which returns all the possible paths that can be
# traversed given any goal matrix. Given any inpu... | 7,984 | 2,602 |
"""
Refactor the membrane test module to provide a clean interface.
You can always refactor the core later.
"""
import os
import sys
PATH_HERE = os.path.abspath(os.path.dirname(__file__))
PATH_DATA = os.path.abspath(PATH_HERE+"../../../data/abfs/")
PATH_SRC = os.path.abspath(PATH_HERE+"../../../src/")
sys.path.insert(... | 498 | 206 |
from selenium import webdriver, common
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
import math
import time
import os
import demjson
driver = None
all_pokemon_data = demjson.decode(open('pokemon_data.txt', 'r').read())
own_team = []
opponent_team = [N... | 22,112 | 7,360 |
#!/usr/bin/env python3
#
# Bench backup block-job
#
# Copyright (c) 2020 Virtuozzo International GmbH.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at... | 5,583 | 1,768 |
import pandas as pd
if __name__ == '__main__':
experts = pd.read_csv('../result_analysis/SM-judgements.csv', index_col=0)
res = pd.read_csv('results_wmd_top_20.csv', index_col=0)
print(experts)
print(res)
joined = res.join(experts, how='left', sort=False)
joined.to_csv('wmd_top_20_w_raw_judgemen... | 328 | 134 |
from django.db import models
from django.core.validators import MinValueValidator
from django.contrib.auth.models import User
from django.utils import timezone
from datetime import datetime
BET_SIDE = (
(0, 'X'),
(1, '1'),
(2, '2')
)
class Wallet(models.Model):
owner = models.ForeignKey(User, null=Fa... | 5,221 | 1,411 |
#2 ćwiczenia
#zadanie 7
ile=input("Podaj ile chcesz wczytać liczb: ")
ile=int(ile)
for i in range(ile):
liczba=input("Podaj liczbę numer "+str(i)+": ")
liczba=int(liczba)
print(str(liczba**2))
| 223 | 107 |
class TestGui:
def test_start(self): # synced
assert True
def test_end(self): # synced
assert True
def test_closeEvent(self): # synced
assert True
class TestThreePartGui:
def test_start(self): # synced
assert True
class TestHtmlGui:
pass
class TestSystemTr... | 952 | 298 |
from paida.paida_core.PAbsorber import *
from paida.paida_core.IFillStyle import *
from paida.paida_core.ILineStyle import *
from paida.paida_core.IMarkerStyle import *
from paida.paida_core.ITextStyle import *
from javax.swing import JFrame, JPanel, JScrollPane, JTree, JLayeredPane, SwingUtilities, JMenuBar
from java... | 42,617 | 16,285 |
import configparser
import os
from extra_metrics.logs import logger
def read_config_helper(cfg):
logger.info(f"loading the configuration from file {ExtraMetricsConfiguration.DEFAULT_CFG_FILE_LOCATION}")
with open(ExtraMetricsConfiguration.DEFAULT_CFG_FILE_LOCATION, 'r') as f:
cfg.read_configuration(f)... | 2,550 | 856 |
# http://rosalind.info/problems/iev/
from sys import argv
f = open(argv[1], 'r')
a = f.readline().strip().split(' ')
f.close()
a = map(int, a)
r = 2*(a[0]*1 + a[1]*1 + a[2]*1 + a[3]*.75 + a[4]*.5 + a[5]*0)
w = open('results_' + argv[1], 'w')
w.write(str(r))
w.close()
| 271 | 140 |
interface_code = """
# Events
Transfer: event({_from: indexed(address), _to: indexed(address), _value: uint256})
Approval: event({_owner: indexed(address), _spender: indexed(address), _value: uint256})
# Functions
@constant
@public
def totalSupply() -> uint256:
pass
@constant
@public
def balanceOf(_owner: address... | 674 | 239 |
#########
# world
#########
import librosa
import parselmouth
import numpy as np
import torch
import torch.nn.functional as F
from pycwt import wavelet
from scipy.interpolate import interp1d
gamma = 0
mcepInput = 3 # 0 for dB, 3 for magnitude
alpha = 0.45
en_floor = 10 ** (-80 / 20)
FFT_SIZE = 2048
f0_bin = 256
f0_... | 8,371 | 3,874 |
# This code is taken from many places and many authors and compiled by YU4HAK :)
# Raspberry Pi Pico is needed to use this app! Maybe I will do an Arduino version in the future.
# Basic purpose of the app is to take input from serial port and turn it into Morse code.
# Then it plays it via sound, light or by actin... | 5,101 | 1,841 |
def parse_options(inp):
parsed = inp.split(':', 1)
name = parsed[0]
options = parsed[1] if len(parsed) == 2 else ''
return name, options
class Ident(object):
def __init__(self, *args):
self._ident = args
def as_tuple(self):
return tuple(filter(None, self._ident))
def as_s... | 864 | 290 |
import time
import cv2
import pyqtgraph as pg
from PyQt5.QtCore import QObject
from PyQt5.QtCore import pyqtSignal
from pylsl import local_clock
from config import config_ui
from utils.sim import sim_openBCI_eeg, sim_unityLSL, sim_inference
import pyautogui
import numpy as np
from utils.ui_utils import dialog_pop... | 356 | 122 |
# -*- coding: utf-8 -*- #
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | 1,527 | 424 |
#!/usr/bin/env python
# process_rgbs.py
#
# Copyright (C) 2020 Dan Rodrigues <danrr.gh.oss@gmail.com>
#
# SPDX-License-Identifier: Apache-2.0
import png
import struct
import sys
# Read sim generated log of RGBS output:
log_file = open("rgbs.log", "rb")
raw_log = log_file.read()
log_file.close()
image_width = 640 ... | 1,589 | 641 |