id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1636411 | #!/usr/bin/env python3
import os
import sys
sys.path.append(os.getcwd()+'/build')
import AStarPython
if __name__ == "__main__":
# define the world map
map_width = 20
map_height = 20
world_map = [
# 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,... | StarcoderdataPython |
66807 | salario = float(input('Digite o salário atual: '))
print('O salário ajustado será de R${:.2f}'.format(salario*1.15))
| StarcoderdataPython |
3267575 | <reponame>chamwen/NT-Benchmark
# -*- coding: utf-8 -*-
# @Time : 2022/2/20 21:46
# @Author : wenzhang
# @File : __init__.py
import numpy as np
| StarcoderdataPython |
1669416 | <reponame>initialkommit/fika
import pymysql
class MySQL:
def __init__(self, host, user, passwd, db, port=3306,
charset='UTF8', auto_commit=True, auto_connect=True):
self.init_command = None
self.host = host
self.user = user
self.passwd = <PASSWORD>
self.db ... | StarcoderdataPython |
1701972 | from sympy.sets import ConditionSet
from sympy import (Symbol, Eq, S, sin, pi, Lambda, Interval)
x = Symbol('x')
def test_CondSet():
sin_sols_principal = ConditionSet(Lambda(x, Eq(sin(x), 0)),
Interval(0, 2*pi, False, True))
assert pi in sin_sols_principal
assert pi/... | StarcoderdataPython |
3270513 | <reponame>hernan-erasmo/project-euler<gh_stars>0
"""Podria ser mucho mas rapido si se pudiera identificar a un x intermedio como
un numero en una secuencia ya calculada. En ese caso, solo habria que unir la
lista que se esta calculando actualmente con la que ya se habia calculado antes"""
def main():
max_len = 0
for... | StarcoderdataPython |
3295925 | T = int(input())
while T:
s = int(input())
n = int(input())
result = s
for _ in range(n):
q, p = map(int, input().split())
result += q*p
print(result)
T -= 1
| StarcoderdataPython |
67675 | import numpy as np
from scipy import interpolate
from progressbar import ProgressBar, Bar, Percentage
class ImpulseResponseFunction(object):
'''Internal bemio object to contain impulse response function (IRF) data
'''
pass
class WaveElevationTimeSeries(object):
'''Internal bemio object to contain wave... | StarcoderdataPython |
4820222 | <gh_stars>0
"""
Классы окружающей среды
"""
import pygame
from files.global_stuff import *
class Wall(BaseGameObject):
def __init__(self, x, y, img):
super().__init__(x, y, img, HITBOX_FULL_RECT, can_slide=True)
self.avg_color = pygame.Color(17, 23, 12)
class Floor(BaseGameObject):
def __in... | StarcoderdataPython |
3346708 | <gh_stars>1000+
# Copyright (c) 2021 PaddlePaddle 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... | StarcoderdataPython |
4836627 | <gh_stars>0
import json
import pickle
import os
import networkx as nx
import matplotlib.pyplot as plt
def main():
suffix = lambda x: f'-{x}' if x != 0 else ''
# path = os.path.join(config['PATH'], config['EXPERIMENT_NAME'] + suffix(config['num']), config['HIGH_SCORE'])
path = os.path.join(config['EXPERIMEN... | StarcoderdataPython |
1799587 | class DocumentersAggregatorSQLAlchemyPipeline(object):
"""
Stub pipeline to save to AirTable.
"""
def process_item(self, item, spider):
return item
| StarcoderdataPython |
191056 | import looker_sdk
# from typing import cast, MutableSequence, Sequence
####Initialize API/SDK for more info go here: https://pypi.org/project/looker-sdk/
from looker_sdk import methods31, models
sdk = looker_sdk.init31() # or init40() for v4.0 API
me = sdk.me()
### DEFINE VALUES HERE ####
# DASHBOARDID = VALUE
# U... | StarcoderdataPython |
3363220 | # ----------------------------------------------------------------------------------------------------------------------
# FILE DESCRIPTION
# ----------------------------------------------------------------------------------------------------------------------
# File: loss.py
# Author: <NAME>
# Date written: 01-28-... | StarcoderdataPython |
1691302 | #!/usr/bin/env python
"""
Run an environment with the chosen policy.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import ast
import os
import random
import socket
import uuid
from builtins import input
import numpy as np
import h5py... | StarcoderdataPython |
175409 | <reponame>convers39/IR-ecommerce<filename>core/settings/local.py
from .base import *
DEBUG = True
DOMAIN = 'http://127.0.0.1:8080'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static'), ]
# for debug tool:
DEBUG_TOOLBAR_PATCH_SETTINGS = False
if DEBUG:
INSTALLED_APPS += ['debug_toolbar']
MIDDLEWARE += ['debug_... | StarcoderdataPython |
1605882 | <reponame>sbstnkll/flowine
from math import pi
prefixes = {
"EXA": 1e18,
"PETA": 1e15,
"TERA": 1e12,
"GIGA": 1e9,
"MEGA": 1e6,
"KILO": 1e3,
"HECTO": 1e2,
"DECA": 1e1,
"DECI": 1e-1,
"CENTI": 1e-2,
"MILLI": 1e-3,
"MICRO": 1e-6,
"NANO": 1e-9,
"PICO": 1e-12,
"FEM... | StarcoderdataPython |
96479 | import itertools
import random
import ranking
from collections import defaultdict
from sqlalchemy import Column, Integer, String, desc, func
from sqlalchemy.orm import relationship
from scoring_engine.models.base import Base
from scoring_engine.models.check import Check
from scoring_engine.models.round import Round
... | StarcoderdataPython |
1737109 | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 17 14:22:41 2019
@author: snoone
"""
import os
import glob
import pandas as pd
import csv
import datetime
import numpy as np
##import all csv files in current dir that need timezone changing to GMT based on hours offset
os.chdir("D:/EEC_canadian_hourly/200... | StarcoderdataPython |
3351506 | #BEWARE: automatically generated code
#This code was generated by /generate/__main__.py
from opengl.gl.raw.bindings import *
@accepts(t.enum, t.uint, t.uint, t.sizei, t.enum, t.void)
@returns(t.void)
@binds(dll)
def draw_range_elements(mode, start, end, count, type, indices):
'''
render primitives from array ... | StarcoderdataPython |
1713663 | # Generated by Django 3.2.5 on 2021-09-14 17:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reporting', '0004_auto_20210914_1055'),
]
operations = [
migrations.AddField(
model_name='involvedparties',
name='la... | StarcoderdataPython |
1777429 | import numpy as np
### Minecraft Notations
malmo_object_to_index = {
# Basics
'air' : 1,
'wooden_door' : 2,
# 'wool' : 3, wall : 4,
'lever' : 5,
# 'ball': 6,'box' : 7,
# 'goal': 8,
'fire' : ... | StarcoderdataPython |
157012 | <filename>examples/export_by_album.py
""" Export all photos to specified directory using album names as folders
If file has been edited, also export the edited version,
otherwise, export the original version
This will result in duplicate photos if photo is in more than album """
import os.path
import pat... | StarcoderdataPython |
105715 | <filename>screenpy/questions/text_of_the_alert.py
"""
A question to discover the text of an alert. Questions must be asked with
an expected resolution, like so:
the_actor.should_see_the(
(TextOfTheAlert(), ReadsExactly("Look out!!")),
)
"""
from ..abilities import BrowseTheWeb
from ..actor import Act... | StarcoderdataPython |
4822006 | <reponame>soasme/rio
# -*- coding: utf-8 -*-
from flask_script import Manager
from flask_migrate import MigrateCommand
from rio.app import create_app as create_flask
from rio.core import celery
from rio.core import migrate
from rio.commands import RunWorkerCommand
from rio.commands import SyncProjectCommand
app = cre... | StarcoderdataPython |
1728862 | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 29 11:48:11 2021
@author: Mike
"""
import metodosOrdenamiento
import random as rn
import copy
from time import time
def crear_lista(longitud):
lista = []
for i in range(0,longitud):
lista.append(rn.randint(0, 200))
return lista
if __name__=="__main__... | StarcoderdataPython |
1649764 | <gh_stars>1-10
from django.conf.urls import patterns, url
from django.conf import settings
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from .views import index_view, login_view
urlpatterns = patterns('',
url(r'^$', index_view, name='index'),
url(r'^login$', login_view, name='login'),
... | StarcoderdataPython |
11612 | import logging
import pytest
from ocs_ci.framework.testlib import tier1, skipif_ui_not_support, ui
from ocs_ci.ocs.ui.pvc_ui import PvcUI
from ocs_ci.framework.testlib import skipif_ocs_version
from ocs_ci.framework.pytest_customization.marks import green_squad
from ocs_ci.ocs.resources.pvc import get_all_pvc_objs, ge... | StarcoderdataPython |
1699598 | <filename>blog/admin.py
from django.contrib import admin
from django.contrib import admin
from django.utils import timezone
from .models import Post, Category, Tag
admin.site.site_header = "Blog博客-Joker"
admin.site.index_title = "Blog博客-Joker"
class PostAdmin(admin.ModelAdmin):
# 文章展示列表
list_display = ['titl... | StarcoderdataPython |
99436 | #!/usr/bin/env python
import sys
import math
import random
import json
### Enter a location in an urban area and then generate a set random locations nearby.
### Continue to use a similar process to generate a smaller number near surrounding urban areas
### until you get the number of locations you need. Next, these ... | StarcoderdataPython |
3267747 | <filename>app0.py
import dash
import dash_html_components as html
import dash_core_components as dcc
from dash.dependencies import Input, Output
app = dash.Dash(__name__)
app.layout = html.Div([
html.H1("Demo: Plotly Express in Dash with Heat Demand Data"),
dcc.Input(id="x"),
html.H2(id="x_out... | StarcoderdataPython |
1756096 | <filename>main/py-set-symmetric-difference-operation/py-set-symmetric-difference-operation.py<gh_stars>0
def input_set():
raw_input() # ignore n
return set(map(int, raw_input().split()))
print len(input_set() ^ input_set())
| StarcoderdataPython |
104576 | import typing as tp
import pydantic
import yaml
from loguru import logger
from .config_models import GlobalConfig, CameraConfigSection
@logger.catch(reraise=True)
@tp.no_type_check
def _load_config(config_path: str, model) -> tp.Any:
logger.debug(f"Looking for config in {config_path}")
with open(config_pat... | StarcoderdataPython |
83580 |
import time
from haystack.constants import ID, DJANGO_CT, DJANGO_ID
### Useful For Querying
def get_backend(index_instance, using=None):
""" given an index, return the backend, by default using the default connection """
using = using or 'default'
return index_instance._get_backend(using=using)
def get... | StarcoderdataPython |
123442 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-02 08:01
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('polls', '0004_auto_20160501_1622'),
]
operations = ... | StarcoderdataPython |
1761271 | """Main module."""
from collections import defaultdict
import subprocess
import bids
import bids.layout
import json
import csv
import os
from pathlib import Path
from bids.layout import parse_file_entities
from bids.utils import listify
import numpy as np
import pandas as pd
import nibabel as nb
import datalad.api as d... | StarcoderdataPython |
1710555 | # init
from constants import *
from paths import *
| StarcoderdataPython |
1763408 | <filename>Clappform/__init__.py
from .settings import settings
from .auth import Auth
from .app import App
from .transfer import Transfer
from .notification import Notification
from .whatsapp import Whatsapp
from .sms import SMS
from .email import Email
from .file import File
from .user import User
from .actionflow imp... | StarcoderdataPython |
85842 | # Copyright 2020 Pax Syriana Foundation. Licensed under the Apache License, Version 2.0
#
#
import datetime as dt
import os
import traceback
from flask import Blueprint
from flask import current_app
from flask import flash
from flask_babel import lazy_gettext as _l
from flask_login import current_user
from flask_lo... | StarcoderdataPython |
3277825 | <filename>c3cloud_semanticmapper_client/__main__.py
from os.path import join, dirname
from c3cloud_semanticmapper_client import client
import sys
import argparse
from c3cloud_semanticmapper_client.lib import *
from c3cloud_semanticmapper_client.c3_cloud_excel_loader import *
from c3cloud_semanticmapper_client import c... | StarcoderdataPython |
1613384 | <reponame>morisakigogogo/python-react-demo
print('peach')
| StarcoderdataPython |
1750845 | <filename>comments/migrations/0006_auto_20170606_0745.py<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('comments', '0005_auto_20170605_1035'),
]
operations = [
... | StarcoderdataPython |
14595 | from __future__ import print_function
import os, sys
import pickle
import time
import glob
import numpy as np
import torch
from model import PVSE
from loss import cosine_sim, order_sim
from vocab import Vocabulary
from data import get_test_loader
from logger import AverageMeter
from option import parser, verify_input... | StarcoderdataPython |
3386089 | <gh_stars>10-100
import runpy
import logging
from setuptools import _install_setup_requires, setup, find_packages
PACKAGE_NAME = "clifter-slam"
VERSION = runpy.run_path("clifter_slam/version.py")["__version__"]
DESCRIPTION = "ClifterSlam: Dense Slam mmets automatic differentation"
URL = "< url.to.go.in.here>"
AUTHOR ... | StarcoderdataPython |
144099 | <filename>varnish_cache/varnish_cache.py
#!/usr/bin/python
"""
Site24x7 Varnish Plugin
author: selvakumar.cs
Edited to support all types of data from varnish cache
"""
import importlib
import json
import os
import subprocess
import re
# if any impacting changes to this plugin kindly increment the plugin version her... | StarcoderdataPython |
3383866 | import dragonfly as df
from srabuilder import rules
import title_menu, menu_utils, server, df_utils, game, container_menu, objective, server, constants
CARPENTER_MENU = 'carpenterMenu'
async def get_carpenter_menu():
return await menu_utils.get_active_menu(CARPENTER_MENU)
async def click_button(name):
menu =... | StarcoderdataPython |
3249081 | # -*- coding: utf-8 -*-
# @Time : 3/18/21 1:35 PM
# @Author : <NAME>
# @Contact : <EMAIL>
# @File : __init__.py
# @Software: PyCharm
import unittest
def get_tests():
from .models_test import ModelsTestCase
# from .serializer import ResourceTestCase as SerializerTestCase
# from .utils import UtilsT... | StarcoderdataPython |
4808066 | <gh_stars>1-10
# Generated by Django 2.0.3 on 2018-04-03 19:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('twitmining', '0002_auto_20180403_1923'),
]
operations = [
migrations.AlterField(
model_name='tweet',
... | StarcoderdataPython |
3244466 | <reponame>couchtyp/certbot-dns-schlundtech
"""DNS Authenticator for the SchlundTech XML Gateway."""
import logging
import xml.etree.ElementTree as Et
try:
from urllib.request import Request, urlopen
from urllib.error import HTTPError, URLError
except ImportError:
from urllib2 import Request, urlopen, HTTPEr... | StarcoderdataPython |
1725552 | """
This file is part of LiberaForms.
# SPDX-FileCopyrightText: 2021 LiberaForms.org
# SPDX-License-Identifier: AGPL-3.0-or-later
"""
from liberaforms import ma
from liberaforms.models.user import User
from liberaforms.models.formuser import FormUser
class UserSchemaForAdminDataDisplay(ma.SQLAlchemySchema):
cla... | StarcoderdataPython |
3268974 | ##
## Operations with keyring
##
import os
import socket
import hvac
import rsa
from keypair import KeyPair
from message import Message
class KeyRing:
def __init__(self, namespace="bund",
name=socket.gethostname(),
url="http://127.0.0.1:8200",
token=os.environ["VAUL... | StarcoderdataPython |
1602101 | M = [2345,4575,2,7,34,562,34,51,56,36,4,2,42,6,234,2,54]
total = 0
for i in M:
total = total + i
print(total)
| StarcoderdataPython |
1719136 | # MIT License
#
# Copyright (c) 2021 [FacuFalcone]
#
# 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... | StarcoderdataPython |
1732208 | # Copyright 2016 <NAME>
# All rights reserved
"""Flask based micro-blogging service.
# microblog 0.1.0
For complete documentation see README.md.
"""
# Set the values below as indicated, and rename this file to __init__.py
import os
basedir = os.path.abspath(os.path.dirname(__file__))
WTF_CSRF_ENABLED = True
# Se... | StarcoderdataPython |
180171 | <reponame>jojoelfe/napari<filename>napari/utils/events/_tests/test_event_emitter.py
import weakref
from functools import partial
import pytest
from napari.utils.events import EventEmitter
def test_event_blocker_count_none():
"""Test event emitter block counter with no emission."""
e = EventEmitter(type="tes... | StarcoderdataPython |
1685248 | """Unit tests for symupy.utils.configurator
"""
# ============================================================================
# STANDARD IMPORTS
# ============================================================================
import pytest
# ==========================================================================... | StarcoderdataPython |
55560 | <gh_stars>0
import json
from collections import defaultdict
import click
from click.utils import make_str
from flask import current_app
from flask.cli import with_appcontext
from invenio_accounts.models import User
from tabulate import tabulate
from oarepo_enrollments import enroll, list_enrollments as api_list_enrol... | StarcoderdataPython |
1608492 | <reponame>erjel/SOTR
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import argparse
import glob
import multiprocessing as mp
import os
import time
import cv2
import tqdm
from detectron2.data.detection_utils import read_image
from detectron2.utils.logger import setup_logger
from predictor impor... | StarcoderdataPython |
170710 | """
Question:
Write a program that accepts a comma separated sequence of words as input and prints the words in a comma-separated sequence
after sorting them alphabetically.
Suppose the following input is supplied to the program:
without,hello,bag,world
Then, the output should be:
bag,hello,without,world
"""
enter_st... | StarcoderdataPython |
3396991 | import requests_mock
from clb_py_tools import collaboratory
from ..fixtures import * # noqa: 411
from ..constants import COLLABORATORY_URL, COLLAB_NAME, PAGE_NAME
class TestPage:
def test_page(self, a_test_page: collaboratory.Page) -> None: # noqa: 811
a_test_page.title = f"title: {PAGE_NAME}"
... | StarcoderdataPython |
105865 | <gh_stars>100-1000
# Copyright 2018-2021 Xanadu Quantum Technologies 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 re... | StarcoderdataPython |
111388 | # The MIT License (MIT)
#
# Copyright (c) 2020 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, me... | StarcoderdataPython |
3361490 | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
with open("requirements.txt", 'r') as reqfile:
requirements = reqfile.readlines()
setuptools.setup(
name="wilson",
version="0.0.1",
author="datapao",
author_email="<EMAIL>",
description="Six sigma rule gener... | StarcoderdataPython |
3363640 | string = input()
if not string[0].istitle() and string[1:].isupper():
print(string.swapcase())
elif string.isupper():
print(string.swapcase())
elif len(string) > 1 and string.islower():
print(string)
elif len(string) == 1 and string.islower():
print(string.swapcase())
else:
print(string) | StarcoderdataPython |
1617561 | <filename>tests/swig/python/runtime/messaging/test_bucket.py
import pytest
from unittest import TestCase
from pyflamegpu import *
import random as rand
AGENT_COUNT = 24
out_mandatory = """
FLAMEGPU_AGENT_FUNCTION(out_mandatory, MsgNone, MsgBucket) {
int id = FLAMEGPU->getVariable<int>("id");
FLAMEGPU->message... | StarcoderdataPython |
164985 | <filename>tests_integration/helpers.py<gh_stars>10-100
from barterdude.hooks import BaseHook
from asyncworker.rabbitmq.message import RabbitMQMessage
class ErrorHook(BaseHook):
async def on_success(self, message: RabbitMQMessage):
raise NotImplementedError
async def on_fail(self, message: RabbitMQMes... | StarcoderdataPython |
4818669 | # This script will accept a string from a user.
# It'll then check if the string begins with "Is" or not.
# If not, then it'll add "Is" in the front.
# Import modules.
import clear_screen_module
# Clear the screen.
clear_screen_module.clear_screen()
# Display purpose of the script.
print(f"The script will check i... | StarcoderdataPython |
1705818 | from cobjects import CBuffer
b=CBuffer()
b.info()
b.new_object(24,2,[])
b.info()
obj=b.get_object_buffer(0).view('uint64')
obj[0]=31
b.reallocate(100,100,100,100)
b.info()
b._test_cffilib()
| StarcoderdataPython |
136993 | <gh_stars>0
"""The country module includes an object representation of a country,
and functions to parse strings into Countries."""
from ._util import check_single_row
import re
import os
import os.path
import pandas as pd
dirpath = os.path.dirname(os.path.realpath(__file__))
_countries = pd.read_csv(os.path.join(dirp... | StarcoderdataPython |
182163 | import numpy as np
import time
import matplotlib.pyplot as plt
import visdom
# find the minimum of y
# y = x^2 + x + 1
# y' = 2x + 1
# y'' = 2
x0 = 91.91
g = 2*x0 + 1 # f'(x0)
gg = 2 # f''(x0)
while abs(g) > 0.001:
# update x0
x0 = -g/gg + x0
# update one order partial
g = 2*x0 + 1
# update ... | StarcoderdataPython |
1653494 | <filename>Image2CAD/Core/Utils/__init__.py
# -*- coding: utf-8 -*-
"""
@author: <NAME>
Copyright (C) 2016, <NAME>.
Licensed under the Apache License 2.0. See LICENSE file in the project root for full license information.
"""
#from .Eraser import Eraser
#from .ImgTransform import ImgTransform | StarcoderdataPython |
1770504 | import os
import numpy as np
import segyio
from ..core import SegyFile, SegyFileAttributes, is_segy_valid
from ..core.file_copy_utils import fast_copy
def add_files(input_filepath_list, output_filepath, average=False,
iline=9, xline=21):
"""
Add two or more SEG-Y files
"""
if all([is... | StarcoderdataPython |
4842118 | class BaseMotion(object):
""" Base class for motion.
"""
def __init__(self, time_i=0, pos_i=0):
self._time_i = time_i
self._pos_i = pos_i
@property
def time_i(self):
""" initial time """
return self._time_i
@time_i.setter
def time_i(self, value):
... | StarcoderdataPython |
3294688 | import socketserver
import socket
from TimeSync import TimeSync2
import pandas as pd
import numpy as np
import os
from struct import pack
BUFFER_SIZE = 2048
SENSOR_FILES_SUBDIRECTORY = "sensors"
def main():
host = get_ip()
port = 9428
s = socket.socket()
s.bind((host, port))
print(f'Server sta... | StarcoderdataPython |
3286615 | <gh_stars>0
import torch
import numpy as np
import os.path as osp
from scipy.spatial.distance import pdist, cdist, squareform
from sklearn.cluster.dbscan_ import dbscan
from sklearn.cluster import KMeans
from reid.utils.rerank import compute_jaccard_dist
from reid.utils.faiss_rerank import faiss_compute_jaccard_dist
fr... | StarcoderdataPython |
8638 | <gh_stars>1-10
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in... | StarcoderdataPython |
3317019 | <filename>serious_shop/payments/decorators.py
from django.core.exceptions import PermissionDenied
from orders.models import Order
def user_is_order_author(function):
def wrap(request, *args, **kwargs):
order_id = kwargs["order_id"]
order = Order.objects.get(id=order_id)
if order.user == r... | StarcoderdataPython |
3226027 | #!/usr/bin/env python
if __name__ == "__main__":
from psana.pscalib.geometry.SegGeometryMatrixV1 import *
import sys
from time import time
import psana.pyalgos.generic.Graphics as gg
logging.basicConfig(format='[%(levelname).1s] L%(lineno)04d: %(message)s', level=logging.DEBUG)
def test_xyz_min_max():
... | StarcoderdataPython |
3275570 | import networkx as nx
import pandas as pd
import matplotlib.pyplot as plt
def load(title):
df = pd.read_csv(f'./data/{title}.csv').astype(int)
Graphtype = nx.Graph()
G = nx.from_pandas_edgelist(df, source='Source',target='Target',create_using=Graphtype)
nx.draw(G, with_labels=True)
plt.clf()
nx... | StarcoderdataPython |
1640535 | from flask.ext.sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Device(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.Unicode, unique=True)
mac = db.Column(db.Unicode)
| StarcoderdataPython |
59203 | """
Copyright (c) 2020 Cisco and/or its affiliates.
This software is licensed to you under the terms of the Cisco Sample
Code License, Version 1.1 (the "License"). You may obtain a copy of the
License at
https://developer.cisco.com/docs/licenses
All use of the material herein must be in accordance wit... | StarcoderdataPython |
46441 | <reponame>Dih5/zadeh
import zadeh
import os
def test_parse():
"""Load an external .fis file"""
fis = zadeh.FIS.from_matlab(os.path.join(os.path.dirname(os.path.abspath(__file__)), "data", "tipper.fis"))
assert isinstance(fis.get_crisp_output({"food": 5, "service": 5}), float)
| StarcoderdataPython |
3296716 | <reponame>buctlab/source-seeking-multi-robot-team-simulator<gh_stars>0
from numpy import array, zeros, cos, sqrt
from NIM.benchmarks.benchmark import Benchmark
class Griewank(Benchmark):
"""dim: n"""
def __init__(self, lower=-600, upper=600, dimension=2):
super(Griewank, self).__init__(lower, upper, d... | StarcoderdataPython |
190746 | <filename>connections2mine.py
import pandas as pd
import sys, datetime
"""
This script will calculate connections by month/year over time
based on an input csv called "Connections.csv" that you can get
from the LinkedIn Data Privacy page
"""
# the fields we care about
fields = ["Connected On"]
filePth = ... | StarcoderdataPython |
3223030 | import matplotlib.pyplot as plt
import threading
class Application:
def display(self, img):
plt.imshow(img)
threading.Thread(target=lambda: plt.pause(0.000000001)).start()
| StarcoderdataPython |
3379441 |
import matplotlib.pyplot as plt
# testing examples from http://matplotlib.org/users/pyplot_tutorial.html
def example_line():
numbers = [1, 2, 3, 4]
plt.plot(numbers)
plt.ylabel('Numbers :) ')
plt.show()
# example_line()
def example_red_dots():
numbers = [1, 2, 3, 4]
more_numbers = [1, 4, ... | StarcoderdataPython |
1773273 | # encoding: utf-8
from babel.support import Format
from lxml import etree
from invoicegenerator.config import ConfigStore
from invoicegenerator.generator.rml.rmlgenerator import RMLGenerator
from invoicegenerator.lib.pythonic_testcase import *
from invoicegenerator.model.address import Address
from invoicegenerator.m... | StarcoderdataPython |
6521 | <filename>othello_rl/qlearning/qlearning.py
from logging import getLogger
logger = getLogger(__name__)
class QLearning:
"""
Q-Learning用のクラス
Attributes
----------
alpha : float
学習率α
gamma : float
割引率γ
data : dict
Q-Learningでの学習結果の保存用辞書
init_value : float
dataの初期値
"""
def __init__(s... | StarcoderdataPython |
1768860 | #Code by <NAME>
#Available on github.com/nhannt201
def findX(arr):
tichlon = arr[0]*arr[1]
for x in range(len(arr)):
if (x == ((len(arr)) - 1)):
break
else:
if ((arr[x]*arr[x+1]) > tichlon):
tichlon = arr[x]*arr[x+1]
print(tichlon)
inputArray = []
pri... | StarcoderdataPython |
3259456 | <reponame>mmaltafe/Learning
import numpy as np
import pandas as pd
import scipy.stats as stats
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
import matplotlib.pyplot as plt
import pickle
import SODA
import threading
from datetime import datetime
from psutil import cpu_percent, s... | StarcoderdataPython |
3269151 | #!src/venv/bin/python
from __future__ import print_function
import Tkinter as tk
class CurationFrame(tk.Frame):
def __init__(self, gui, *args, **kwargs):
tk.Frame.__init__(self, *args, **kwargs)
| StarcoderdataPython |
1704990 | # Python modules
# 3rd party modules
import numpy as np
from lmfit import Parameters
# Our modules
import vespa.analysis.chain_fit_identity as chain_fit_identity
import vespa.common.util.math_ as util_math
import vespa.common.util.generic_spectral as util_spectral
import vespa.analysis.fun... | StarcoderdataPython |
3379758 | #!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = "Robin 'r0w' Weiland"
__credits__ = ["<NAME>", ]
__copyright__ = "Copyright 2019, <NAME>"
__date__ = "2019-04-01"
__version__ = "0.1.0"
__license__ = "MIT"
__status__ = "In Development"
__maintainer__ = "<NAME>"
__all__ = ['lmgc']
# imports:
from warnings impo... | StarcoderdataPython |
72135 | <gh_stars>10-100
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications... | StarcoderdataPython |
3217792 | <reponame>savioacp/worky
from .worker_thread import WorkerThread
from .stateless_worker import StatelessWorker
from .work_unit import WorkUnit
__all__ = [WorkerThread, StatelessWorker, WorkUnit]
| StarcoderdataPython |
64154 | """A thin wrapping of the VoIP.ms REST API to make it slightly less than
horrible to use.
"""
import contextlib
from collections import Mapping
import requests
from functools import partial
def validate_response(response_obj):
"""Check for HTTP failures, API failures, and return JSON."""
if response_obj.stat... | StarcoderdataPython |
1713690 | <reponame>anandpskerala/BotListBot
big_range = list(range(512))
# CONSTANTS
class BotStates:
BROADCASTING, \
SEARCHING, \
SENDING_KEYWORDS, \
SENDING_USERNAME, \
SENDING_NAME, \
SENDING_EXTRA, \
SENDING_DESCRIPTION, \
ADMIN_MENU, \
DUMMY, \
ADMIN_ADDING_BOT, \
EDITING_BOT... | StarcoderdataPython |
116575 | valor = int(input())
print('{} minutos'.format(valor*2)) | StarcoderdataPython |
3339701 | <filename>flybirds/core/dsl/step/page.py
# -*- coding: utf-8 -*-
"""
This module defines the steps related to the page.
"""
from behave import step
from flybirds.core.global_context import GlobalContext as g_Context
from flybirds.utils.dsl_helper import get_params
@step("go to url[{param}]")
def jump_to_page(contex... | StarcoderdataPython |
1682530 | <gh_stars>0
# Domoticz plugin for controlling Extron SSP 7.1
#
# Author: azvero
#
"""
<plugin key="Extron" name="Extron SSP 7.1" author="azvero" version="1.0.0" wikilink="http://www.domoticz.com/wiki/plugins/plugin.html" externallink="http://www.extron.com/">
<params>
<param field="Address" label="IP Address or H... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.