text string | size int64 | token_count int64 |
|---|---|---|
# Marcelo Campos de Medeiros
# ADS UNIFIP
# Estrutura de Repetição
# 25/03/2020
'''
25 -Faça um programa que peça para n pessoas a sua idade,
ao final o programa devera verificar se a média de idade da turma
varia entre 0 e 25,26 e 60 e maior que 60; e então, dizer se a turma é jovem,
adulta ou idosa, conforme a média... | 954 | 407 |
#!/usr/bin/env python
#
# Copyright 2007 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 o... | 4,089 | 1,428 |
from bucks.bucks_enums import BucksType
from buffs.tunable import TunableBuffReference
from event_testing.tests import TunableTestSetWithTooltip
from interactions.utils.tunable_icon import TunableIconFactory
from rewards.reward_tuning import TunableSpecificReward
from sims4.localization import TunableLocalizedStringFac... | 8,658 | 2,328 |
from .elasticnet_regression import ElasticNetRegression
from .lasso_regression import LassoRegression
from .linear_regression import LinearRegression
from .logistic_regression import LogisticRegression
from .ridge_regression import RidgeRegression
__all__ = [
'ElasticNetRegression',
'LassoRegression',
'Lin... | 387 | 115 |
import os, uuid, sys
from azure.storage.blob import BlockBlobService, PublicAccess
def run_sample():
try:
# Create the BlockBlockService that is used to call the Blob service for the storage account
block_blob_service = BlockBlobService(account_name='planck', account_key='dXskxcS8enXEWXbk2K4dAfh5k... | 831 | 286 |
from automon import AutomonNode, AutomonCoordinator, RlvNode, RlvCoordinator
from test_utils.functions_to_monitor import func_kld
from test_utils.tune_neighborhood_size import tune_neighborhood_size
from test_utils.data_generator import DataGeneratorKldAirQuality
from test_utils.test_utils import start_test, end_test, ... | 2,078 | 653 |
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.4.2
# kernelspec:
# display_name: pydove
# language: python
# name: pydove
# ---
# %% [markdown]
# # Test... | 902 | 354 |
# https://www.beecrowd.com.br/judge/pt/problems/view/1007
'''
Leia quatro valores inteiros A, B, C e D. A seguir, calcule e mostre a diferença do produto de A e B pelo produto de C e D segundo a fórmula: DIFERENCA = (A * B - C * D).
Entrada
O arquivo de entrada contém 4 valores inteiros.
Saída
Imprima a mensagem DIF... | 643 | 266 |
import argparse
from itertools import product
import warnings
from joblib import Parallel, delayed
import librosa
import numpy as np
import pandas as pd
from scipy import signal, stats
from sklearn.linear_model import LinearRegression
from tqdm import tqdm
from tsfresh.feature_extraction import feature_calculators
fr... | 15,450 | 5,462 |
# Copyright (C) 2018 Phonexia
# Author: Jan Profant <jan.profant@phonexia.com>
# All Rights Reserved
| 101 | 41 |
# Generated by Django 3.1.6 on 2021-02-19 10:22
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('criminals', '0002_criminalsinfo_image'),
]
operations = [
migrations.RenameField(
model_name='criminalsinfo',
old_name='full... | 378 | 132 |
'''
Created on Dec 10, 2014
@author: Dxmahata
'''
__author__ = "Debanjan Mahata"
import requests
import sys
import json
API_REQUEST_COUNT = 0
#Base Url for calling Seen API
BASE_URL = "http://api.seen.co/v0.1"
#Setting up the endpoints
ENDPOINTS = {}
#setting up events endpoint
ENDPOINTS["events"] = {}
#setting ... | 13,281 | 4,290 |
import sys
sys.path.append("../")
import torch
import matplotlib.pyplot as plt
from util.util import to_tensor, imsplot_tensor
from util.imwrap import imwrap_BCHW # as imwrap
from dataloader.imagerw import load_image, load_disp #, save_image
from SSIM import SSIM
def implot(im1, im2, im3, im4, im5, im6, im7, im8):
... | 1,981 | 945 |
# -*- coding: utf-8 -*-
import datetime
from optim.pretrain import *
import argparse
import torch
from optim.train import supervised_train
def parse_option():
parser = argparse.ArgumentParser('argument for training')
parser.add_argument('--save_freq', type=int, default=200,
help='save... | 6,611 | 2,324 |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
DATA_PATH = os.path.join(os.path.dirname(basedir), "data")
DEGIRO_PATH = os.path.join(os.path.dirname(basedir), "degiro_creds.json")
EXCHANGE_MAPPING_PATH = os.path.join(DATA_PATH, "raw/exchange_symbol_map.json")
# Path to DB with SQLAlchemy syntax:
# Refe... | 610 | 235 |
# SPDX-License-Identifier: MIT
default_groups = ["user"]
| 57 | 23 |
import sys
import re
from models.types import Types
def out(treechildren, variables):
print("")
for j in range(len(treechildren.children)):
if treechildren.getChild(j).getToken().getType() == Types.STRING:
sys.stdout.write(treechildren.getChild(j).getToken().getValue())
elif treech... | 713 | 217 |
import smart_imports
smart_imports.all()
class Command(utilities_base.Command):
help = 'Search orphan effects'
LOCKS = ['game_commands']
def _handle(self, *args, **options):
self.logger.info('remove orphan effects')
logic.remove_orphan_event_effects(logger=self.logger)
| 307 | 105 |
from boundingbox.boundingbox import BoundingBox
from haversine import haversine
import numpy as np
import time
from importlib import reload
import boundingbox.validations; reload(boundingbox.validations)
from boundingbox.validations.numbers import validate_strictly_positive_integer, validate_positive_number
def get_... | 2,731 | 834 |
from events.models import SupplementLog
from supplements.models import IngredientComposition, Supplement, Ingredient, Measurement
from vendors.models import Vendor
VALID_REST_RESOURCES = [
SupplementLog,
Supplement,
IngredientComposition,
Ingredient,
Measurement,
Vendor
]
# a lot of frontend (... | 709 | 216 |
import os
_NamePath = "Data/noms2008nat_text.txt"
_SurnameGirlsPath = "Data/prenoms_donnees_filles.csv"
_SurnameBoysPath = "Data/prenoms_donnees_garcons.csv"
_FreqPathPrenom = "Data/freq_prenoms.csv"
_FreqPathNom = "Data/freq_noms.csv"
def _get_first_name_freq(file_name: str, d: dict) -> int:
""" Modifies the dic... | 4,538 | 1,540 |
from django.dispatch import receiver
from django_rtk.signals import account_activated
from moves import models
from profiles.models import Profile, ProfileToMoveList
@receiver(account_activated)
def create_profile_on_activation(sender, user, request, **kwargs):
trash = models.MoveList(
role="trash",
... | 1,126 | 362 |
from flask import render_template
from app import app
import SystemInfo.main
@app.route('/')
def index():
sysInfo = SystemInfo.main.main()
returnDict = {}
returnDict['title'] = 'Assignment 2: Flask & Systeminfo'
returnDict['heading'] = 'COMP30670'
returnDict['subHeading'] = 'Assignment 2:... | 431 | 143 |
# coding: utf-8
import numpy as np
from torchvision.transforms import ToTensor, Normalize, Compose
# from sd_lib.nn.dataset import SlyDataset
input_image_normalizer = Compose([
ToTensor(),
Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
])
# class UnetV2Dataset(SlyDataset):
# def _get... | 535 | 227 |
from Core import *
from StoredData import data
from Events import handler
### SCENARIO SETUP ###
lLostIn1700AD = [iChina, iIndia, iTamils, iKorea, iVikings, iTurks, iSpain, iHolyRome, iPoland, iPortugal, iMughals, iOttomans, iThailand]
lWonIn1700AD = [(iIran, 0), (iJapan, 0), (iFrance, 0), (iCongo, 0), (iNetherland... | 5,131 | 2,078 |
# Copyright (c) 2020 Huawei Technologies Co., Ltd.
# foss@huawei.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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 8,015 | 2,900 |
import peakutils
from module.seeding.seeder.seeder import Seeder
class ThresholdSeeder(Seeder):
def __init__(self, threshold, return_type='string', s_filter=None, peak_filter=None):
super(ThresholdSeeder, self).__init__(return_type)
self.threshold = threshold
self.s_filter = s_filter
... | 1,138 | 365 |
from turtle import Turtle
TOP_BORDER = 280
SIDE_BORDER = 380
P_SIZE = 50
P_POSITION = 320
class Ball:
def __init__(self):
self.ball = Turtle("circle")
self.ball.pu()
self.ball.color("white")
self.x_move = 10
self.y_move = 10
self.r_score = 0
self.l_score =... | 1,620 | 636 |
# -*- coding: utf-8 -*-
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2009-2022 by the NICOS contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or modify it under
# the t... | 2,404 | 712 |
import pytest
import responses
from mapbox import DirectionsMatrix
from mapbox.errors import MapboxDeprecationWarning
points = [{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [
-87, 36]}}, {
"type": "Feature",
"properties": {},
... | 2,941 | 1,034 |
import os
import sys
import json
import socket
import getpass
import glog as log
import numpy as np
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader
from tensorboardX import SummaryWriter
import time
p = os.path.dirname(os.path.dirname((os.path.abspath(__file__))))
if p not in sys.p... | 41,409 | 16,261 |
# Generated by Django 2.1.11 on 2019-10-31 14:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('base', '0006_auto_20190731_1549'),
]
operations = [
migrations.AddField(
model_name='projet',
name='logged_only',
... | 784 | 244 |
# -*- coding: utf-8 -*-
"""
Unsorted miscellaneous stuff
"""
from .unsorted import *
from .unsorted import streamline
| 123 | 44 |
"""Handlers for category"""
import flask
from werkzeug.exceptions import BadRequest, Unauthorized
from json import dumps
from itemcatalog import app
import models
import login
@app.route('/catalog/<catalog_id>/addcategory', methods=['GET', 'POST'])
@login.check_logged_in
def add_category_handler(catalog_id):
""... | 4,660 | 1,301 |
"""
Check that pandas/core/generic.py doesn't use bool as a type annotation.
There is already the method `bool`, so the alias `bool_t` should be used instead.
This is meant to be run as a pre-commit hook - to run it manually, you can do:
pre-commit run no-bool-in-core-generic --all-files
The function `visit` is... | 2,801 | 882 |
""" Some tests using a alternate test configurations
to prove code paths not covered by the ansible-navigator
configuration
"""
import pytest
from ansible_navigator.configuration_subsystem.configurator import Configurator
from ansible_navigator.configuration_subsystem.navigator_post_processor import (
NavigatorP... | 4,786 | 1,204 |
#!/bin/python3
x1,v1,x2,v2 = input().strip().split(' ')
x1,v1,x2,v2 = [int(x1),int(v1),int(x2),int(v2)]
print("YES" if (x2 - x1) * (v2 - v1) < 0 and (x2 - x1) % (v2 - v1) == 0 else "NO")
| 199 | 117 |
# Generated by Django 2.2 on 2019-04-17 16:19
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Auther',
... | 792 | 259 |
from prometheus_query_builder.query import Query
import pytest
def test_query():
""" Test query with only metric name """
query = Query("http_requests_total")
assert str(query) == "http_requests_total"
def test_query_with_label():
query = Query("http_requests_total")
query.add_label("environmen... | 2,313 | 754 |
from typer.testing import CliRunner
from drudgeyer import app
runner = CliRunner()
def test_app():
result = runner.invoke(app, ["--help"])
assert result.exit_code == 0, result.stdout
result = runner.invoke(app, ["run", "--help"])
assert result.exit_code == 0, result.stdout
result = runner.invo... | 699 | 230 |
import wx
class WxTestCase:
def setup(self):
self.app = wx.App()
self.frame = wx.Frame(None)
self.frame.Show()
def teardown(self):
def _cleanup():
for win in wx.GetTopLevelWindows():
if win:
if isinstance(win, wx.Dialog) and win.... | 563 | 172 |
#!/usr/bin/env python
from __future__ import print_function
import os
import re
results = {}
version_files = [x for x in os.listdir(".") if x.endswith(".version.txt")]
# TODO https://github.com/nf-core/proteomicslfq/pull/165
def get_versions(software, version_file):
semver_regex = r"((?P<major>0|[1-9]\d*)\.(?P<mi... | 2,705 | 1,034 |
import configparser
config = configparser.RawConfigParser()
config.read("../tests/configurations/config.ini")
class ReadConfig:
"""This class consists of methods that retrieve
information from the configuration file"""
@staticmethod
def get_application_url():
"""This method retrieves the URL ... | 637 | 169 |
# Copyright (c) 2013 Blizzard Entertainment
#
# 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, publi... | 20,678 | 6,455 |
# -*- coding: utf-8 -*-
import datetime
from enum import Enum
from json import JSONDecoder, JSONEncoder
from uuid import UUID
from types import MethodType, FunctionType
from base64 import b64decode, b64encode
from typing import Optional
from decimal import Decimal
from functools import wraps, singledispatch
from collec... | 9,669 | 3,213 |
from django.apps import AppConfig
class BranchConfig(AppConfig):
name = 'osc_bge.branch'
| 95 | 31 |
# Copyright 2016 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 required by applicable law or ag... | 16,135 | 11,542 |
def complex(real, imag = 0.0):
return magic(r = real, i = imag)
| 68 | 27 |
from util.tensor_ops import *
class Stacker:
"""help easily make graph model by stacking layer and naming for tensorflow
ex)
stacker = Stacker(input_)
stacker.add_layer(conv2d, 64, CONV_FILTER_5522)
stacker.add_layer(bn)
stacker.add_layer(lrelu)
stacker.add_layer(conv2d, 128,... | 3,594 | 1,218 |
import torch
import numpy as np
from pathlib import Path
import platform
from rl_rvo_nav.policy.policy_rnn_ac import rnn_ac
from math import pi, sin, cos, sqrt
import time
class post_train:
def __init__(self, env, num_episodes=100, max_ep_len=150, acceler_vel = 1.0, reset_mode=3, render=True, save=False, neighbor... | 6,019 | 2,069 |
#!/usr/bin/env python
# coding: utf-8
# # A short Tutorial to process sample NIRISS AMI simulations
#
# * fit fringes for a simulated target and calibrator sequence (no WFE evolution between them)
# * calibrate target closure phases with the calibrator
# * fit for a binary
import glob
import os, sys, time
from astro... | 4,866 | 1,730 |
from fibo import fib, fib2
import fibo
import importlib
print(fibo.__name__)
print(fib(1000))
print(fibo.fib2(100))
importlib.reload(fibo)
| 139 | 64 |
import sys
from openstack import connection
from openstack import profile
from openstack import utils
# open logging
# utils.enable_logging(debug=True, stream=sys.stdout)
# get the connection to the
def create_connection(auth_url, region, project_name, username, password):
prof = profile.Profile()
prof.set_r... | 1,363 | 459 |
# coding: UTF-8
from __future__ import absolute_import
import json
import PyRSS2Gen as RSS2
from vilya.config import DOMAIN
from vilya.libs.reltime import compute_relative_time
from vilya.views.api.utils import jsonize
class GitUI(object):
_q_exports = ['branches', 'allfiles', 'lastlog', 'lineblame']
def _... | 3,817 | 1,168 |
import RPi.GPIO as GPIO
import sys,tty,termios,time
from Adafruit_MotorHAT import Adafruit_MotorHAT, Adafruit_DCMotor
import atexit
import os
# create a default object, no changes to I2C address or frequency
mh = Adafruit_MotorHAT(addr=0x60)
# recommended for auto-disabling motors on shutdown!
def turnOffMotors():
m... | 3,237 | 1,640 |
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
from app import app
from app import applog
from datetime import datetime
import json
import numpy as np
import pandas as pd
import plotly.express as px
import requests
"""Displays graph of time s... | 1,912 | 610 |
# Copyright 2020 (c) Cognizant Digital Business, Evolutionary AI. All rights reserved. Issued under the Apache 2.0 License.
import numpy as np
import pandas as pd
LATEST_DATA_URL = 'https://raw.githubusercontent.com/OxCGRT/covid-policy-tracker/master/data/OxCGRT_latest.csv'
LOCAL_DATA_URL = "tests/fixtures/OxCGRT_lat... | 1,985 | 593 |
# 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... | 3,282 | 1,054 |
import base_action
import re
import json
class BestFit(base_action.BaseAction):
def __init__(self, config):
"""Creates a new BaseAction given a StackStorm config object (kwargs works too)
:param config: StackStorm configuration object for the pack
:returns: a new BaseAction
"""
... | 4,446 | 1,257 |
from django.contrib import admin
from .models import Alert
# Register the Alert model in the admin panel
admin.site.register(Alert)
| 134 | 35 |
#!/usr/bin/env python3
""" Test case for the Footleg Robotics Sentinel robot controller board
Pulses all IO expander pins configured as outputs
"""
from time import sleep
import digitalio
from sentinelboard import SentinelHardware
sh = SentinelHardware()
# Set all pins as outputs, setting them LOW
for pin in ran... | 622 | 221 |
import boto3, os
from datetime import datetime as dt
from botocore.client import Config
def main():
ACCESS_KEY = os.environ['DIGITAL_OCEAN_ACCESS_KEY']
SECRET = os.environ['DIGITAL_OCEAN_SECRET_KEY']
date = dt.today().strftime('%Y.%m.%d')
files = ['data.csv', 'agg_data.csv', 'confirmed_cases.csv']
... | 882 | 295 |
from typing import TYPE_CHECKING
from pymunk import Vec2d
from k_road.entity.entity_type import EntityType
from k_road.entity.linear_entity import LinearEntity
if TYPE_CHECKING:
from k_road.k_road_process import KRoadProcess
class Curb(LinearEntity):
"""
"""
def __init__(self, parent: 'KRoadProces... | 491 | 174 |
#
# Copyright (c) 2016 NORDUnet A/S
# Copyright (c) 2018 SUNET
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# ... | 3,100 | 987 |
#!/usr/bin/env python3
import os
import sys
args = sys.argv[1:]
if len(args) != 1:
print('Usage: {} WORD'.format(os.path.basename(sys.argv[0])))
sys.exit(1)
word = args[0]
number = 0
for letter in word:
number += ord(letter)
print('"{}" = "{}"'.format(word, number))
| 285 | 117 |
import setuptools
with open("README.md", "r") as f:
long_description = f.read()
with open('requirements.txt', 'r', encoding='utf-16') as ff:
required = ff.read().splitlines()
setuptools.setup(
name='livermask',
version='1.2.0',
author="André Pedersen",
author_email="andrped94@gmail.com"... | 1,113 | 344 |
import sys
from typing import Iterator, Tuple
from .pin import PinBase, Pin, MuxPin, Mux
from . import DeviceSetup
def all_pins() -> Iterator[Tuple[str, PinBase]]:
dupe_filter = set()
for v_name, var in vars(DeviceSetup).items():
if not hasattr(var, "__dict__"): continue
for a_name, attr in var... | 1,039 | 359 |
import asyncio
import pytest
from fastapi.testclient import TestClient
@pytest.mark.usefixtures("snapshots_setup")
def test_yara_scan(client: TestClient, event_loop: asyncio.AbstractEventLoop):
# it matches with all snapshots
payload = {"source": 'rule foo: bar {strings: $a = "foo" condition: $a}'}
respo... | 749 | 249 |
#: E211:4
spam (1)
#: E211:4 E211:19
dict ['key'] = list [index]
#: E211:11
dict['key'] ['subkey'] = list[index]
# Okay
spam(1)
dict['key'] = list[index]
# This is not prohibited by PEP8, but avoid it.
# Dave: I think this is extremely stupid. Use the same convention everywhere.
#: E211:9
class Foo (Bar, Baz):
pa... | 323 | 141 |
from django import forms
# if you wanto add more actions add them here.
ACTIONS = (
("nochange", "No Change"),
("rename", "Rename"),
("format", "Format"),
("format_rename", "Format And Rename"),
("delete", "Delete"),
)
class FieldForm(forms.Form):
current_field_name = forms.CharField(max_leng... | 834 | 262 |
import re
import sys
#!/bin/env python
import sys
import re
if len(sys.argv) != 1:
print >>sys.stderr,"%s < in > out"%(__file__)
sys.exit(1)
for line in sys.stdin:
# 中文的正则匹配式
zh_patt = u'[\u4e00-\u9fa5]'
# 英文的正则匹配式
en_patt = u'[A-Za-z]'
src_word_list = []
for word in line.strip().sp... | 576 | 250 |
import urllib
import pandas as pd
import pandas.io.data as web
from datetime import datetime
import matplotlib.pyplot as plt
import pickle as pk
znga = web.DataReader("ZNGA", "yahoo", datetime(2009,1,1))
gluu = web.DataReader("GLUU", "yahoo", datetime(2009,1,1))
vix = web.DataReader("^vix", "yahoo", datetime(2009,1,1)... | 2,343 | 1,148 |
# PackedBerry System
import requests
import random
import os
import youtubesearchpython
def search_video(query:str):
videosSearch = youtubesearchpython.VideosSearch(str(query), limit = 1)
return videosSearch.result()
def get_video_data(query:dict):
r = {}
d = search_video(query)
for _ in d:
l = d[_]
for e i... | 8,327 | 4,104 |
"""Link to ``mapry.main`` so that you can execute it with ``python`` CLI."""
import sys
import mapry.main
if __name__ == "__main__":
sys.exit(mapry.main.run(prog="mapry"))
| 179 | 65 |
import pandas
csv_location = 'C:\\Users\\KAMALI\\Documents\\ACM.csv'
html_location = 'C:\\Users\\KAMALI\\Desktop\\table.html'
dfObj = pandas.read_csv(csv_location)
htmlData = dfObj.to_html()
with open(html_location, 'w') as infile:
infile.write(htmlData)
| 260 | 101 |
import os
import unittest
from mock import ANY, patch
from malcolm.core import Context, Process, StringMeta
from malcolm.modules.ca.util import catools
from malcolm.modules.scanning.controllers import RunnableController
from malcolm.modules.system.parts import IocIconPart
defaultIcon = ""
with open(
os.path.spli... | 2,623 | 895 |
# -*- coding: utf-8 -*-
"""
Defines the environment variable names for the mock code execution.
"""
from enum import Enum
class EnvKeys(Enum):
"""
An enum containing the environment variables defined for
the mock code execution.
"""
LABEL = 'AIIDA_MOCK_LABEL'
DATA_DIR = 'AIIDA_MOCK_DATA_DIR'
... | 416 | 156 |
import socket
import struct
import binascii
s = socket.socket(socket.PF_PACKET, socket.SOCK_RAW, socket.ntohs(0x0800))
s.bind(("eth0",socket.htons(0x0800)))
sor = '\x00\x0c\x29\x4f\x8e\x35'
victmac ='\x88\x53\x2e\x0a\x75\x3f'
gatemac = '\x84\x1b\x5e\x50\xc8\x6e'
code ='\x08\x06'
eth1 = victmac+sor+code #for victim
e... | 763 | 427 |
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import collections
from itertools import cycle, islice
from readability import plotter as read
import speeches
from emotions import data
from emotions import stemmer
from emotions import calculator
from plotting import emotions_plott... | 2,049 | 719 |
# Copyright (c) 2016, The Bifrost Authors. All rights reserved.
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must r... | 4,749 | 1,829 |
from os import environ as os_environ
from socket import gethostname
from snakypy.zshpower.utils.catch import get_key
from .utils import Color, element_spacing, symbol_ssh
class Hostname:
def __init__(self, config: dict):
self.config: dict = config
self.symbol = symbol_ssh(get_key(config, "hostn... | 1,311 | 390 |
from abc import ABC, abstractmethod
from traceback import print_exc
from signal import SIGALRM, SIG_IGN, alarm, signal
from datetime import datetime, timedelta
from contextlib import contextmanager
from typing import Optional, List, Dict
from os import path, makedirs
from io import TextIOWrapper
from testUtils.junit.Te... | 9,067 | 2,457 |
# ------------------------------------------------------------------------------------
# BaSSL
# Copyright (c) 2021 KakaoBrain. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 [see LICENSE for details]
# ------------------------------------------------------------------------------------
| 311 | 68 |
from dataclasses import dataclass
from typing import Any, Dict, Optional, Union
@dataclass
class NFTMetadataInput:
"""
The metadata of an NFT to mint
You can use the NFTMetadataInput.from_json(json) method to create
an instance of this class from a dictionary.
:param name: The name of the NFT
... | 3,574 | 993 |
from flask import Flask, render_template, jsonify, request, g, abort
import pandas as pd
import networkx as nx
import pygraphviz as pgv
import json
import tempfile
import numpy as np
import brewer2mpl
from StringIO import StringIO
import psycopg2
import urlparse
import os
app = Flask(__name__)
app.config['DEBUG'] = T... | 5,304 | 1,862 |
# -*- coding: utf-8 -*-
# (c) Copyright IBM Corp. 2019. All Rights Reserved.
# pragma pylint: disable=unused-argument, no-self-use
import socket
from past.builtins import basestring, unicode
import tldextract
import logging
import time
import traceback
from ipwhois import IPWhois, exceptions
from datetime import date... | 4,530 | 1,419 |
'''
Created on Oct 4, 2017
@author: amin
'''
from __future__ import division, print_function
from matplotlib import pyplot as plt
import numpy as np
import matplotlib
import os
# Set some parameters to apply to all plots. These can be overridden
# in each plot if desired
# Plot size to 14" x 7"
matplotlib.rc('figure... | 2,086 | 776 |
#!/usr/bin/env python3
import requests
import json
import cgi
import cgitb
import sys
cgitb.enable(display=0, logdir="/usr/local/apache2/logs/cgitb")
# URL prefix for SOLR query service
# XXX should work with both EDINA and BL
service = "http://laaws-indexer-solr:8983/solr/test-core/select"
# URL prefix for OpenWayba... | 3,373 | 1,002 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: Tianyi Zhang and Botao Gao
Created on Tue Dec 1st 14:03:37 2020
Based on the code found in tutorial at this website: 'https://blog.csdn.net/u014798883/article/details/106200697'
"""
def dijkstra(adjacency_matrix, start, path, cost, max):
"""
... | 4,682 | 1,640 |
class A:
def f1(self):
print("F1 in A")
class B:
def f2(self):
print("F2 in B")
def f1(self):
print("F1 in B")
class C(A,B):
def f(self):
A().f1()
B().f1()
c = C()
c.f1()
c.f2()
c.f()
| 250 | 114 |
#!d:\software development\django-react-apps\lead_manager\venv\scripts\python.exe
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| 187 | 59 |
""" simple flask application to show appmetrics usage. """
# a couple of endpoints are defined and a couple of metrics
# measuring throughput and latency for each endpoint plus one
# for the global throughput
#
# of course, flask must be installed (pip install flask)
# Example:
#
# $ python examples/webapp_flask.py ... | 2,189 | 1,138 |
import moderngl
from .p4dyna.equation import Equation
from numpy.random import random
class ParticleSystem:
def __init__(self, game, brender, fname, target, miss, move_data):
self.game = game
self.brender = brender # meh
self.N = 500000
self.particles = 0
self.fname = fnam... | 29,278 | 9,534 |
import unittest
from comm import IpcComm
from comm import IpcTransmitter
import json
class IpcCommTest(unittest.TestCase):
def setUp(self):
pass
def test_IpcCommTest_0011(self):
"""
テストケースNo.11
"""
### No.11-1 コンストラクタ生成 ###
try:
com_obj = IpcComm... | 1,764 | 660 |
# fileio_serializers.py
#
# This file is part of scqubits: a Python package for superconducting qubits,
# arXiv:2107.08552 (2021). https://arxiv.org/abs/2107.08552
#
# Copyright (c) 2019 and later, Jens Koch and Peter Groszkowski
# All rights reserved.
#
# This source code is licensed under the BSD-style licen... | 10,093 | 3,253 |
from .sph2pipe import install_sph2pipe
| 39 | 15 |
# Copyright 2020 The SODA Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | 2,328 | 657 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 24 23:08:26 2017
@author: pranavjain
This model classifies a pokemon as legendary or not-legendary.
Required Data to predict Hit Points, Attack Points, Defence Points, Special Attack Points, Special Defence Points, Speed Points
"""
# import libra... | 1,826 | 653 |
import unittest
from curvy import builder, axis
import datetime
import numpy as np
taus = [[2,5],[5,7],[7,11]]
prices = [3,5,4]
knots = [5,7]
class TestBuilderMethods(unittest.TestCase):
def test_calc_H(self):
H = np.load('test/test_files/H.npy')
np.testing.assert_array_equal(
builder... | 4,392 | 1,562 |
#!/usr/bin/env python
import os
import sgmake
import subprocess
import json
from common import Status
from common import Settings
from common import Support
from common import call
def make(project):
try:
project.npmpath = os.path.abspath(os.path.expanduser(Settings.get('npm_path')))
except:
pr... | 2,091 | 669 |