id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
6626358
<filename>raiden_contracts/constants.py from enum import Enum, IntEnum from eth_utils import to_canonical_address # Contract names CONTRACT_ENDPOINT_REGISTRY = 'EndpointRegistry' CONTRACT_HUMAN_STANDARD_TOKEN = 'HumanStandardToken' CONTRACT_TOKEN_NETWORK_REGISTRY = 'TokenNetworkRegistry' CONTRACT_TOKEN_NETWORK = 'Tok...
StarcoderdataPython
12833579
<reponame>iasbs-isg/PMoE """All the models that are used in the experiments: Mixture of Experts (MoE)(Alternative) with/out shared weights Predictive U-Net (PU-Net) Predictive Mixture of Experts (PMoE) """ from pathlib import Path import sys try: sys.path.append(str(Path("../").resolve())) except: raise Runtim...
StarcoderdataPython
364221
<filename>setup.py from distutils.core import setup setup( name = 'loggable-decorator', packages = ['loggable'], version = '1.1.1', description = 'Add a logger attribute to class decorated', author = '<NAME>', author_email = '<EMAIL>', url = 'https://github.com/ateliedocodigo/python-loggable-decorator', ...
StarcoderdataPython
5170066
# -*- coding: utf-8 -*- import gzip import re import sqlite3 import sys from defusedxml import ElementTree class IngestLogfile: """log ingestion class""" def __init__(self, conn): """ :param conn: sqlite connection object """ self.conn = conn self.jid_pattern = re.com...
StarcoderdataPython
6640544
import sqlite3 from sqlite3 import Error def create_connetion(db_file): connection = None try: connection = sqlite3.connect(db_file) return connection except Error as e: print(e) if __name__=='__main__': create_connetion("db/forum.db")
StarcoderdataPython
6536751
<filename>gpuPTXModel.py<gh_stars>1-10 def main(): """Main function.""" import argparse import sys import torch import numpy as np import os from os import listdir from src import readFiles as rf from src import functionsPyTorch as pytor from src import globalStuff as gls fr...
StarcoderdataPython
4818567
<gh_stars>1-10 import unittest from instasteem.parser import InstagramPostParser from instasteem.sync import Sync TEST_POST = "https://www.instagram.com/p/BsfudqQgGlw/" class IntegrationTest(unittest.TestCase): def test_image_parsing(self): p = InstagramPostParser(TEST_POST) images = p.extract_i...
StarcoderdataPython
223151
<gh_stars>0 import hikari import lightbulb moderation_plugin = lightbulb.Plugin('Moderation') moderation_plugin.add_checks( lightbulb.has_guild_permissions(hikari.Permissions.MANAGE_GUILD) )
StarcoderdataPython
325705
import matplotlib.pyplot as plt import numpy as np def plot_ica_points(feat_actors, ica_mixing_array, idx): data = np.concatenate([feat_actors['01'][idx] for actor in feat_actors],axis=1) scatter = np.dot(data.T, ica_mixing_array[idx]) plt.scatter(scatter[:,0], scatter[:,1])
StarcoderdataPython
4916687
<gh_stars>0 # Test functions for Submission.py import os import sys import unittest # Add the parent directory to the lib path lib_path = os.path.abspath(os.path.join(__file__, '..')) sys.path.append(lib_path) class TestRunner(unittest.TestCase): ''' Just a dummy test ''' def testSubmission1(self): ...
StarcoderdataPython
3201322
<reponame>tlagore/ros2relay<filename>ros2relay/metrics/metrics.py import threading class MessageMetrics: def __init__(self): """ """ self.byte_sum = 0 self.message_count = 0 self.message_handle_time = 0 def increment_message_count(self, message_size, time_taken): self....
StarcoderdataPython
1972718
"""外星人入侵游戏""" # 要玩游戏《外星人入侵》,只需运行这个py文件即可 import pygame from settings import Settings from ship import Ship import game_functions as gf from pygame.sprite import Group from alien import Alien from game_stats import GameStats from button import Button from scoreboard import ScoreBoard def run_game(): ...
StarcoderdataPython
5015407
<reponame>PacktPublishing/Applied-Computational-Thinking-with-Python with open("ch8_survey.txt") as file: for line in file: line = line.strip() divide = line.split(" - ") name = divide[0] color = divide[1] print(name + " voted for " + color)
StarcoderdataPython
286376
#!/usr/bin/python import sys sys.path.append('/usr/share/inkscape/extensions') import inkex from simplestyle import * import simpletransform import lc import re class VDistanceEffect(inkex.Effect): def __init__(self): inkex.Effect.__init__(self) self.OptionParser.add_option('--distance', ac...
StarcoderdataPython
1671461
def start(animation,frame): o=frame.make_random()[0] animation.pass_obj=o def move_right(animation,frame): frame.move(animation.pass_obj,10,0) def move_left(animation,frame): frame.move(animation.pass_obj,-10,0) def end(animation,frame): frame.delete(animation.pass_obj) animation=( start, m...
StarcoderdataPython
1880220
# -*- coding: utf-8 -*- """ ------------------------------------------------------------------------------ WLAN Experiment Commands ------------------------------------------------------------------------------ Authors: <NAME> (chunter [at] mangocomm.com) <NAME> (murphpo [at] mangocomm.com) <NAM...
StarcoderdataPython
1763394
"""This module contains all actions and interactions for the Home Page.""" from selenium.webdriver.common.by import By class HomePage: # * Locators @classmethod def contact_us_a(cls): return (By.ID, 'contact-link') def __init__(self, driver): self.driver = driver # * Actions ...
StarcoderdataPython
1871740
<reponame>RafaelAmauri/Projeto-e-Analise-de-Algoritmos<gh_stars>0 class Celula: def __init__(self, value): self.value = value self.visited = False self.up = None self.down = None self.left = None self.right = None def __repr__(self): ...
StarcoderdataPython
336768
<reponame>Coalin/Daily-LeetCode-Exercise<gh_stars>1-10 class Solution(object): def robot(self, command, obstacles, x, y): """ :type command: str :type obstacles: List[List[int]] :type x: int :type y: int :rtype: bool """ # zb = [0, 0] # ind = 0...
StarcoderdataPython
8021590
<filename>Python/41.first-missing-positive.py from typing import List class Solution: def firstMissingPositive(self, nums: List[int]) -> int: """ Given an unsorted integer array, find the smallest missing positive integer. >>> Solution().firstMissingPositive([1, 2, 0]) 3 >...
StarcoderdataPython
139870
# Implementation of the Gaborfilter # https://en.wikipedia.org/wiki/Gabor_filter import numpy as np from cv2 import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filter2D, imread, imshow, waitKey def gabor_filter_kernel( ksize: int, sigma: int, theta: int, lambd: int, gamma: int, psi: int ) -> np.ndarray: """ :param...
StarcoderdataPython
1624540
<reponame>babbysross/ITER-Inspection-Tool<filename>GPIO-PWM.py #A program that will hopefully control a motor via a Raspberry Pi Zero W from tkinter import Frame, Scale, HORIZONTAL, Tk import RPi.GPIO as GPIO from time import sleep GPIO.setmode(GPIO.BCM) GPIO.setup(18, GPIO.OUT) GPIO.setwarnings(False) pwm = GPIO.PW...
StarcoderdataPython
1799106
<reponame>AxelGoetz/website-fingerprinting<gh_stars>10-100 UNMONITORED_LABEL = -1 MONITORED_LABEL = 1 # Sets the percentage of unmonitored and monitored data you will train on TRAIN_PERCENTAGE_UNMONITORED = 0.10 TRAIN_PERCENTAGE_MONITORED = 0.90 K_FOLDS = 3 DATA_DIR = ''
StarcoderdataPython
42854
from .client import Spread, Client from ._version import __version__, __version_info__ __all__ = ["Spread", "Client", "__version__", "__version_info__"]
StarcoderdataPython
3261026
<gh_stars>0 """ Main entry point for the application. """ # Standard Library Packages import logging import sys # Installed Packages import darkdetect import qdarkstyle from PyQt5 import QtWidgets, QtGui # BEAMS Modules from app.gui import mainwindow from app.gui.dialogs.dialog_misc import NotificationDialog from ap...
StarcoderdataPython
26474
#!/usr/bin/env python3 import re import sys from glob import glob from subprocess import run def main(args): assert len(args) >= 1 from_image = args.pop(0) optional = [x for x in map(str.strip, args) if x] optional_used = set() with open("Dockerfile", "w") as fout: print(f"from {from_ima...
StarcoderdataPython
5136216
from time import sleep from datetime import datetime import sys import busio import digitalio import board import adafruit_mcp3xxx.mcp3008 as MCP from adafruit_mcp3xxx.analog_in import AnalogIn def voltage_to_direction(voltage: float) -> str: """ Converts an anolog voltage to a direction Arguments: ...
StarcoderdataPython
4851535
<reponame>melancholy/dd-trace-py import mock from ddtrace.internal.hostname import get_hostname @mock.patch("socket.gethostname") def test_get_hostname(socket_gethostname): # Test that `get_hostname()` just returns `socket.gethostname` socket_gethostname.return_value = "test-hostname" assert get_hostname...
StarcoderdataPython
9682288
# Importing the required libraries from surprise import Reader, Dataset from surprise import SVD, accuracy, SVDpp, SlopeOne, BaselineOnly, CoClustering import datetime import requests, zipfile, io from os import path import pandas as pd import tqdm as tqdm from numpy import * from sklearn.model_selection import train_t...
StarcoderdataPython
105840
<gh_stars>10-100 # # Copyright 2015-2020 <NAME> <<EMAIL>> # # 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 ...
StarcoderdataPython
9704249
<gh_stars>10-100 from enum import Enum class Status(Enum): BETA = "beta" PRODUCTION = "production" DEPRECATED = "deprecated" DISCONTINUED = "discontinued" class Impact(Enum): PROFIT = "profit" CUSTOMERS = "customers" EMPLOYEES = "employees" class SentryIssueCategory(Enum): STALE = ...
StarcoderdataPython
5197209
<filename>explain_of_imply.py<gh_stars>0 from formula import * def get_truth_value(f, explain_imp: list): """ :param f: 待求真值的公式 :param explain_imp: p->q中, (p,q)值为(0,0),(0,1),(1,0),(1,1)时的真值 :return: """ if len(explain_imp) != 4: return def confirm(_exp, assignment: dict): ...
StarcoderdataPython
1745713
def resolve(): ''' code here ''' from functools import lru_cache import sys sys.setrecursionlimit(10**6) N, M = [int(item) for item in input().split()] As = [int(input()) for _ in range(M)] memo = [False for _ in range(N+1)] for item in As: memo[item] = True res_li...
StarcoderdataPython
1923776
"""Data Manipulation - Strings""" def handle_permutations(existing_list, permutations_to_populate): """Handle permutations.""" temp_list = [] for perm in permutations_to_populate: for item in existing_list: temp_list.append('{}{}'.format(item, perm)) return [item for item in temp_l...
StarcoderdataPython
9604897
import pytest from random import randint from datetime import datetime from test.test_data import generate_courier_db, generate_courier from candy_delivery.db.models import Courier, Order @pytest.mark.asyncio async def test_update_courier(api_client, migrated_db_session): courier = generate_courier_db() cour...
StarcoderdataPython
5085913
<filename>src/sst/elements/memHierarchy/tests/sdl5-1.py # Automatically generated SST Python input import sst from mhlib import componentlist DEBUG_L1 = 0 DEBUG_L2 = 0 DEBUG_L3 = 0 DEBUG_MEM = 0 DEBUG_CORE0 = 0 DEBUG_CORE1 = 0 DEBUG_CORE2 = 0 DEBUG_CORE3 = 0 DEBUG_NODE0 = 0 DEBUG_NODE1 = 0 # Define the simulation com...
StarcoderdataPython
1971235
<reponame>yuvabedev/AV-Bakery-APP # Copyright (c) 2022, <EMAIL> and contributors # For license information, please see license.txt # import frappe from frappe.model.document import Document class AVBCustomer(Document): pass
StarcoderdataPython
115664
<gh_stars>1-10 from datetime import timedelta, datetime import pendulum from airflow import DAG from airflow.operators.python import PythonOperator from airflow.providers.ssh.operators.ssh import SSHOperator from auxiliary.outils import refresh_tableau_extract default_args = { 'owner': 'airflow', 'depends_on_...
StarcoderdataPython
6694190
<gh_stars>100-1000 from django.urls import path from chats import views app_name = 'chats' urlpatterns = [ path('chats/', views.index, name='index'), ]
StarcoderdataPython
165934
# -*- coding: utf-8 -*- """Command line interface for Axonius API Client.""" import click from ..context import AliasedGroup from . import ( grp_central_core, grp_discover, grp_meta, grp_nodes, grp_roles, grp_settings, grp_users, ) @click.group(cls=AliasedGroup) def system(): """Group...
StarcoderdataPython
5187112
<reponame>vikingden8/Algorithms-Patterns #!/usr/bin/python3 #coding=utf-8 def search(): items = (0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610) target = 144 index = interpolationSearch(items, target) if index == -1: print('Element found not found.') else: print('Eleme...
StarcoderdataPython
4971797
class UserExistsError(Exception): """Пользователь уже есть в базе""" class UserNotExistsError(Exception): """Пользователь не найден""" class UserOrGoodsNotExistsError(Exception): """Товара нет в базе или у пользователя нет товаров""" class TelegramUserExistsError(Exception): """Пользователь уже ес...
StarcoderdataPython
4852343
from orbit.estimators.pyro_estimator import PyroEstimatorSVI def test_pyro_estimator_vi(stan_estimator_lgt_model_input): stan_model_name, model_param_names, data_input = stan_estimator_lgt_model_input # create estimator vi_estimator = PyroEstimatorSVI(num_steps=50) # extract posterior samples po...
StarcoderdataPython
1752791
<gh_stars>100-1000 """ SleekXMPP: The Sleek XMPP Library Copyright (C) 2010 <NAME> This file is part of SleekXMPP. See the file LICENSE for copying permission. """ from sleekxmpp.stanza import Message from sleekxmpp.xmlstream import register_stanza_plugin from sleekxmpp.plugins.xep_0071 import XHTML_...
StarcoderdataPython
11213235
<filename>flashback/__init__.py from .thread import Thread from .post import Post def get(base_url): t = Thread(base_url) t.get() return t
StarcoderdataPython
5080066
<reponame>angeldev7/ico import datetime import pytest from eth_utils import to_wei from web3.contract import Contract @pytest.fixture def presale_freeze_ends_at() -> int: """How long presale funds stay frozen until refund.""" return int(datetime.datetime(2017, 1, 1).timestamp()) @pytest.fixture def presale...
StarcoderdataPython
292051
<filename>tests/integration/test_fetch_partition_should_reset_mutation/test.py import pytest from helpers.client import QueryRuntimeException from helpers.cluster import ClickHouseCluster from helpers.test_tools import TSV cluster = ClickHouseCluster(__file__) node = cluster.add_instance("node", main_configs=["configs...
StarcoderdataPython
5173135
<filename>setup.py<gh_stars>0 from setuptools import setup, find_packages DESCRIPTION = "Djangotoolbox for Django-nonrel" LONG_DESCRIPTION = None try: LONG_DESCRIPTION = open('README.rst').read() except: pass setup(name='djangotoolbox', version='1.6.2', description=DESCRIPTION, long_descrip...
StarcoderdataPython
1631728
# coding=utf-8 # pip install textract import textract extension = ".pdf" folder_ma = "texts-ma/" folder_ba = "texts-ba/" files_ma = [ "BLEHNER_SVEN_MA_THESIS", "Iila_Marit_MA_Thesis", "Kubre_Liisa_MA_Thesis", "Kümnik_Maret_MA_Thesis", "Laanepere_Lilian_MA_Thesis.pdf1", "Maatee, Sylvia. MA thesis", "Mugra_Siir...
StarcoderdataPython
3368578
# Copyright (c) OpenMMLab. All rights reserved. import os.path as osp import random from .builder import DATASETS from .custom import CustomDataset from collections import OrderedDict from mmseg.core import eval_metrics, intersect_and_union, pre_eval_to_metrics import mmcv import numpy as np from mmcv.utils import pr...
StarcoderdataPython
11343336
<reponame>Erick-Paulino/exercicios-de-cursos '''Faça um programa que leia o ano de nascimento de um jovem e informe, de acordo com a sua idade, se ele ainda vai se alistar ao serviço militar, se é a hora exata de se alistar ou se já passou do tempo do alistamento. Seu programa também deverá mostrar o tempo que falta ou...
StarcoderdataPython
4981557
#!/usr/bin/python2.5 # # Copyright 2014 <NAME>. # # Author: <NAME> (<EMAIL>) # # 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 # t...
StarcoderdataPython
54676
<gh_stars>1-10 # -*- coding: utf-8 -*- import optparse import os from mako.template import Template from pyramid.path import AssetResolver from shutil import copyfile def _create_standard_yaml_config_(name='pyramid_oereb_standard.yml', database='postgresql://postgres:password@localh...
StarcoderdataPython
1694867
<reponame>anandagopal6/azure-functions-python-worker<filename>tests/endtoend/test_eventhub_functions.py<gh_stars>100-1000 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import json import time from datetime import datetime from dateutil import parser, tz from azure_functi...
StarcoderdataPython
184757
<filename>examples.py/Basics/Color/WaveGradient.py<gh_stars>1000+ """ Wave Gradient by <NAME>. Adapted to python by <NAME> Generate a gradient along a sin() wave. """ import math amplitude = 30 fillGap = 2.5 def setup(): size(200, 200) background(200, 200, 200) noLoop() def draw(): frequency =...
StarcoderdataPython
1728870
import re from typing import Any from aim.ql.tokens.types import * class Token(object): types = [ String, Integer, Float, Boolean, None_, List, Comparison, Logical, Identifier, Path, Expression, ] def __init__(self, value: Any, ltype: str): if ltype == 'Nu...
StarcoderdataPython
1827440
<filename>domain/processor_md.py from domain.processor import Processor class ProcessorMd(Processor): def __init__(self, file) -> None: super().__init__(file) @property def word_count(self): purged_text = self.data.replace('#', '') return len(purged_text.split()) def unpack(s...
StarcoderdataPython
3553591
<filename>contentcuration/contentcuration/views/nodes.py import json import logging from datetime import datetime from django.conf import settings from django.core.cache import cache from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import PermissionDenied from django.db.models import F...
StarcoderdataPython
5069058
<filename>tests/conftest.py<gh_stars>10-100 import os import shutil import uuid from random import randint import pytest from pytest_order.sorter import SESSION from tests.utils import write_test pytest_plugins = ["pytester"] @pytest.fixture def item_names_for(testdir): def _item_names_for(tests_content): ...
StarcoderdataPython
4892283
<filename>python/testData/completion/qualifiedAssignment.py def foo(a): woo = [] a.words = {} for x in w<caret>
StarcoderdataPython
6419960
import datetime class Move: def __init__(self): self.roll_id = None self.game_id = None self.roll_number = None self.player_id = None self.is_winning_play = False
StarcoderdataPython
228027
<gh_stars>0 from _collections import deque INPUT = input() data = deque() for parenthesis in INPUT: if parenthesis == "{" or parenthesis == "[" or parenthesis == "(": data.append(parenthesis) if parenthesis == "}" or parenthesis == "]" or parenthesis == ")": if len(data) == 0: d...
StarcoderdataPython
12847708
<gh_stars>1000+ # Dash components, html, and dash tables import dash_core_components as dcc import dash_html_components as html import dash_table # Import Bootstrap components import dash_bootstrap_components as dbc # Import custom data.py import data # Import data from data.py file teams_df = data.teams # Hardcoded...
StarcoderdataPython
8113332
<filename>pictures/views.py<gh_stars>0 from django.http import HttpResponse, Http404 import datetime as dt from django.shortcuts import render from .models import Image from .filters import ImageFilter # Create your views here. def home(request): date = dt.date.today() slogan = 'Just keep uploading...' pi...
StarcoderdataPython
4816184
''' Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the last word does not exist, return 0. Note: A word is defined as a character sequence consists of non-space characters only. Example: Input: "<NAME>" Output: 5 ''...
StarcoderdataPython
4935793
<filename>my_module.py def write_to_file(name, data, encoding): try: text_file = open(name, "w") except IOError as error: print("[!!] Error opening file " + str(error)) return -1 if enconding == 'utf-8': try: text_file.write(data.encode('utf-8')) except IOError as error: print("[!!] Error w...
StarcoderdataPython
11314377
# -*- coding: utf-8 -*- """ Microsoft-Windows-Base-Filtering-Engine-Resource-Flows GUID : 92765247-03a9-4ae3-a575-b42264616e78 """ from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct from etl.utils import WString, CString, SystemTime, Guid from etl...
StarcoderdataPython
8068278
# Generated by Django 2.0.4 on 2018-04-18 14:22 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Photo', fields=[ ...
StarcoderdataPython
1801698
import time from worm import WormBase from mod import MOD worm = WormBase() mod = MOD() mods = [worm] for m in mods: start_time = time.time() m.load_genes() print (" --- %s seconds --- " % (time.time() - start_time)) # mod.load_homologs() for m in mods: start_time = time.time() m.load_go() ...
StarcoderdataPython
73178
<filename>batch.py import argparse import os import sys import json from datetime import datetime import covizu from covizu.utils import gisaid_utils from covizu.utils.progress_utils import Callback from covizu.utils.batch_utils import * from covizu.utils.seq_utils import SC2Locator from tempfile import NamedTemporary...
StarcoderdataPython
28337
from unihan_db.tables import ( UnhnLocation, UnhnLocationkXHC1983, UnhnReading, kCantonese, kCCCII, kCheungBauer, kCheungBauerIndex, kCihaiT, kDaeJaweon, kDefinition, kFenn, kFennIndex, kGSR, kHanYu, kHanyuPinlu, kHanyuPinyin, kHDZRadBreak, kIICore...
StarcoderdataPython
5120152
<reponame>ronan-keane/hav-sim """ @author: <EMAIL> problem with optplot rmse not making sense; verified fixed 11/29, pushed to master. bug was for multiple guesses being used, when order = 1, if latter guesses are worse, the simulation used in future calibration would be the worse simulations, which messed up the r...
StarcoderdataPython
9661613
from django.conf.urls.defaults import * urlpatterns = patterns('', (r'^login$', 'views.login'), (r'^logout$', 'views.logout'), (r'^addbmark(?:\/)*$', 'views.addBmark'), (r'^nb/', include('nextbus.urls') ), (r'^catch/(?P<bmark>[\w|-]+)(?:\/)*$', 'views.catch'), (r'^delete/bmark/(?P<bmark>...
StarcoderdataPython
1864976
import re _symbol_delimiter_regex = re.compile(r'[./\-_]') def split_nasdaq(symbol): sym = re.replace(_symbol_delimiter_regex, '', symbol) return sym[:4], sym[4:] def split_nyse(symbol): return re.split(_symbol_delimiter_regex, symbol, maxsplit=1)
StarcoderdataPython
6425416
<reponame>glotaran/pyglotaran_extras from __future__ import annotations import subprocess import sys from pathlib import Path from textwrap import dedent from typing import TYPE_CHECKING from tests.conftest import wrapped_get_script_dir from pyglotaran_extras.io.setup_case_study import get_script_dir from pyglotaran...
StarcoderdataPython
8158218
<filename>the_sward_to_offer/32.2.py # -*- coding:utf-8 -*- """ 从上到下按层打印二叉树,同一层结点从左至右输出。每一层输出一行。 input0: {8,6,10,5,7,9,11} output0: [[8],[6,10],[5,7,9,11]] """ # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: # 返回二维列表[[1,2...
StarcoderdataPython
6533030
<filename>package/spack-findutils/package.py ############################################################################## # Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by <NAME>, <EMAIL>, All ri...
StarcoderdataPython
8052366
from typing import List, Any from talipp.indicators.Indicator import Indicator from talipp.indicators.EMA import EMA from talipp.indicators.AccuDist import AccuDist from talipp.ohlcv import OHLCV class ChaikinOsc(Indicator): """ Chaikin Oscillator Output: a list of floats """ def __init__(self,...
StarcoderdataPython
4967794
<filename>docs/conf.py # -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst # # Astropy documentation build configuration file. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this fi...
StarcoderdataPython
9612894
<gh_stars>0 """Module containing the user entity""" from django.db import models from django.contrib.auth.models import (AbstractBaseUser, BaseUserManager) from shared.base_model import BaseModel class User(AbstractBaseUser, BaseModel): """Model for a user in the system""" class Meta: """Class to a...
StarcoderdataPython
4873494
import numpy as np, random MIN = "[MIN" MAX = "[MAX" MED = "[MED" SUM_MOD = "[SM" END = "]" OPERATORS = [MIN, MAX, MED, SUM_MOD] VALUES = range(10) VALUE_P = 0.75 MAX_ARGS = 3 MAX_DEPTH = 4 def generate_tree(depth): if depth < MAX_DEPTH: r = random.random() else: r = 1 if r > VALUE_P: ...
StarcoderdataPython
6318
<filename>fastmvsnet/train1.py #!/usr/bin/env python import argparse import os.path as osp import logging import time import sys sys.path.insert(0, osp.dirname(__file__) + '/..') import torch import torch.nn as nn from fastmvsnet.config import load_cfg_from_file from fastmvsnet.utils.io import mkdir from fastmvsnet.u...
StarcoderdataPython
9655500
# -*- coding: utf-8 -*- """ convnet-est-loss """ import numpy as np from os import sys, path import argparse caffe_dir = '/home/aaskov/caffe/' def damage_range(x): if float(x) < 0.0: raise argparse.ArgumentTypeError("%r is not positive" % x) return float(x) def run(): parser = argparse.ArgumentP...
StarcoderdataPython
4891951
<reponame>lresende/text-extensions-for-pandas # # Copyright (c) 2020 IBM Corp. # 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
5111237
import os import sys import time from vector import Vector2D import math import random import pygame import cProfile as profile # GLOBALS LEVEL = 0 RESDIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'res') ######### def load_sound(name): """Borrowed from http://www.pygame.org/docs/tut/chimp/Chimp...
StarcoderdataPython
5132458
<filename>medical_prescription/user/views/logoutview.py # Django from django.shortcuts import redirect from django.contrib import auth from django.views.generic import View class LogoutView(View): ''' Logout of User. ''' # Exit user and render 'home' page. def get(self, request): auth.log...
StarcoderdataPython
8171069
import RPi.GPIO as GPIO from time import sleep SLEEPTIME = 1 PIN = 18 GPIO.setmode(GPIO.BOARD) GPIO.setup(PIN, GPIO.IN, pull_up_down = GPIO.PUD_UP) def event_callback(): print("Magnetic field is detected") GPIO.add_event_detect(GPIO_PIN, GPIO.FALLING, callback = event_callback, bouncetime = 200) try: ...
StarcoderdataPython
147665
# -*- coding: utf-8 -*- """ Created on Fri Dec 18 22:59:59 2020 @author: CS Check the read-me file for a in-depth summary of the problem """ import numpy as np import sys sys.path.append('..') import TrussAnalysis as ta class environment: """ The enviroment will act as a container for the data in the probl...
StarcoderdataPython
9662998
#Credential Generated from your Twilio Account account_sid= 'Your Twilio Sid' auth_token='<PASSWORD>' my_cell='Number whom you want to sms' my_twilio='Your Twilio number'
StarcoderdataPython
1918223
""" Low-Level Logging A module to allow a ton of data (e.g. all SSL unencrypted and encrypted IO) to be logged but not actually slow the server down unless the thing is being traced or the whole server is logging super verbose. Use like: import ll import faststat ml = ll.LLogger() .... ml.la("format string {0} {1...
StarcoderdataPython
3545382
<reponame>Jitsusama/lets-do-dns """Introduce time delays during program execution.""" import time def sleep(delay): """Pause program execution until delay (in seconds) has expired.""" time.sleep(delay)
StarcoderdataPython
3442891
# GW2 API wrapper class import os import json from . import session from functions import return_config """ GW2 API wrapper class. Configurations for endpoints are maintained in the src/configs/config.json file for ease of updating in the event an endpoint changes. """ class GW2Wrapper(object): def __init__(self)...
StarcoderdataPython
3461181
<reponame>Zyjacya-In-love/Pedestrian-Detection-on-YOLOv3<gh_stars>10-100 import os import cv2 import numpy as np from PIL import Image from timeit import default_timer as timer from keras_yolov3_detect import YOLO_detector ''' 对于 Caltech 测试数据集 ./image,使用 keras_yolov3_detect.py 预测出每张图片的 bounding boxes 信...
StarcoderdataPython
30939
<filename>compiler.py from sphere_engine import CompilersClientV4 from sphere_engine.exceptions import SphereEngineException import time # define access parameters accessToken = '77501c36922866a03b1822b4508a50c6' endpoint = 'dd57039c.compilers.sphere-engine.com' # initialization client = CompilersClientV4(accessToke...
StarcoderdataPython
1721289
"""User Model.""" from masoniteorm.models import Model from masoniteorm.scopes import SoftDeletesMixin class User(Model, SoftDeletesMixin): """User Model.""" __timezone__ = "Asia/Hong_Kong" __fillable__ = ["name", "email", "password"] __auth__ = "email"
StarcoderdataPython
11202425
<gh_stars>0 import unittest import pygame from agagla import game_state_manager from agagla.game_state_manager import GameState from agagla import __main__ as main import time class GSMTestCase(unittest.TestCase): def setUp(self): main.init() pygame.init() self.gsm = game_state_manager.Ga...
StarcoderdataPython
5037215
<gh_stars>0 import discord, numpy, textwrap, requests, wand from io import BytesIO from discord.ext import commands from discord.ext.commands.cooldowns import BucketType from wand.image import Image as WandImage from PIL import Image, ImageFilter, ImageDraw, ImageOps, ImageFont, ImageSequence class image(commands.Cog,...
StarcoderdataPython
1888253
<reponame>nliolios24/textrank #!/usr/bin/env python """ An example using Graph as a weighted network. """ __author__ = """<NAME> (<EMAIL>)""" try: import matplotlib.pyplot as plt except: raise import networkx as nx G=nx.Graph() G.add_edge('a','b',weight=0.6) G.add_edge('a','c',weight=0.2) G.add_edge('c',...
StarcoderdataPython
4847411
<reponame>romchegue/Python<gh_stars>0 print('Ni' * 8)
StarcoderdataPython
9729297
def mul(number, *bys): # TODO: block isn't used, debug this! if type(number) == list and number[0] == "ARRAY": block = number result = number for num in bys: result *= num return result
StarcoderdataPython