id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
11367170
import pygame import os import configparser import numpy as np import cv2 from src import music from src import files_work def end_music(inp): inp = False def main(): # Config init and read config file conf = files_work.get_conf() conf.read(os.path.dirname(os.path.abspath(__file__)) + '/conf.ini') ...
StarcoderdataPython
1900009
#!/usr/bin/env python # -*- coding: utf-8 -*- # The MIT License (MIT) # # Copyright (c) 2016 <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, includi...
StarcoderdataPython
3342238
<gh_stars>1-10 """ @author: <NAME> 'Mayou36' This modul contains several tools like fits. DEPRECEATED! USE OTHER MODULES LIKE rd.data, rd.ml, rd.reweight, rd.score and rd.stat DEPRECEATED!DEPRECEATED!DEPRECEATED!DEPRECEATED!DEPRECEATED! """ from .. import config as cfg # noqa import numpy as np # from raredeca...
StarcoderdataPython
5029946
<reponame>calmisential/TensorFlow2.0-MNIST import tensorflow as tf from config import * def VGG16(): model = tf.keras.Sequential() # 1 model.add(tf.keras.layers.Conv2D(filters=64, kernel_size=(3, 3), strides=1, ...
StarcoderdataPython
3319469
# declarando minhas listas e variáveis x=[0,0,0,0] #coluna x y=[0,0,0,0] #coluna y xy=[0,0,0,0] #coluna xy x2=[0,0,0,0] #coluna x² a=0 #utilizo para contador neste primeiro momento b=0 while(a<3): #loop para receber os valores de x e y x[a]=float(input("Digite um valora para x... ")) #recebe um valor de x e armaze...
StarcoderdataPython
6476802
from circus.commands.base import Command from circus.exc import ArgumentError, MessageError from circus.util import convert_opt class Get(Command): """\ Get the value of specific watcher options ========================================= This command can be used to query the current value ...
StarcoderdataPython
8058813
<filename>frimcla/command_line.py from __future__ import absolute_import from . import fullAnalysis import argparse import sys def main(): arg1 = sys.argv[1] fullAnalysis.fullAnalysis(arg1)
StarcoderdataPython
5024420
<reponame>taufikxu/RepLibrary<gh_stars>0 import time import torch import torch.nn as nn from Tools import FLAGS from library.data_iters import dataset_info, get_data_augmentation def l2_norm(inputx): assert len(inputx.shape) == 2 norm = torch.sqrt(torch.sum(inputx ** 2, 1)).view(-1, 1) return inputx / no...
StarcoderdataPython
9628949
################################################################################ # MIT License # # Copyright (c) 2017 <NAME> & <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...
StarcoderdataPython
9735469
import time import argparse import json import os import glob import sys import re import random import string # parse the arguments parser = argparse.ArgumentParser(description="Apache data cleaning + join") parser.add_argument( "--path", type=str, dest="data_path", default="../../test/resources/2000....
StarcoderdataPython
8000657
# -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2016-11-13 17:46 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): initial = True depe...
StarcoderdataPython
5153151
<gh_stars>1-10 import base64 import hmac import json import logging import os from asyncio import wait from datetime import datetime, timedelta from typing import Any, Awaitable, Callable, Dict, List, Optional, Text from urllib.parse import urljoin import asyncpg import httpx import sentry_sdk from async_lru import al...
StarcoderdataPython
3249906
#!/usr/bin/python3 import threading from datetime import datetime import urllib.request BASE_PATH = '/Users/sukumargv/bc_ferries/' def get_page(page_url, local_fname): d = datetime.now() fname = d.strftime("{}/{}".format(BASE_PATH, local_fname)) urllib.request.urlretrieve(page_url, fname) """ http://or...
StarcoderdataPython
6529521
<filename>fastapi_events/typing.py from enum import Enum from typing import Any, Tuple, Union Event = Tuple[Union[str, Enum], Any]
StarcoderdataPython
1814830
from datetime import datetime from app.extensions import db class Product(db.Model): id = db.Column(db.Integer(), primary_key=True) name = db.Column(db.String(120), unique=True, nullable=False, index=True) email = db.Column(db.String(120), nullable=True) slug = db.Column(db.String(120), unique=True,...
StarcoderdataPython
3244828
<filename>data/HQdata.py<gh_stars>0 import datetime class Tournament: date= datetime.date matches= [] patch= "v0" name= "Test" def __init__(self,patch,name): self.date= datetime.date.today() self.patch= patch self.name= name def addMatch(self,match): self.matches.append(match) def print(self,output): ...
StarcoderdataPython
6499218
from typing import Any, Union, Optional import yaml from dataclasses import dataclass from pathlib import Path from .models.locale import Locale, LocaleConfig from pyi18n_new.lib.base_class import BaseClass @dataclass class I18N(BaseClass): path: Path default: str = "en" def __post_init__(self): ...
StarcoderdataPython
6640487
<reponame>sanglass/sandglass.time<gh_stars>1-10 from sandglass.time import _ from sandglass.time.api.error import APIError # API error codes and messages CODES = { 'INVALID_SIGNIN': _("Invalid sign in credentials"), 'USER_EMAIL_EXISTS': _("A user with the same E-Mail already exists"), 'USER_NOT_FOUND': _(...
StarcoderdataPython
8077589
z tkinter zaimportuj TclError klasa WidgetRedirector: """Support dla redirecting arbitrary widget subcommands. Some Tk operations don't normally dalej through tkinter. For example, jeżeli a character jest inserted into a Text widget by pressing a key, a default Tk binding to the widget's 'insert' ope...
StarcoderdataPython
12814253
<gh_stars>1-10 # This file is used with the GYP meta build system. # http://code.google.com/p/gyp # To build try this: # svn co http://gyp.googlecode.com/svn/trunk gyp # ./gyp/gyp -f make --depth=. mpg123.gyp # make # ./out/Debug/test { 'variables': { 'target_arch%': 'ia32', }, 'target_defaults': { ...
StarcoderdataPython
6441408
<reponame>OscarFM014/IntroCS<filename>How_to_manage_data/product_list.py # Define a procedure, product_list, # that takes as input a list of numbers, # and returns a number that is # the result of multiplying all # those numbers together. def product_list(list_of_numbers): """z = (len(list_of_numbers))-1 conta...
StarcoderdataPython
3477561
<filename>calendars/fields.py # -*- coding: utf-8 -*- ''' Created on Mar 20, 2011 @author: <NAME> @copyright: Copyright © 2011 other contributers: ''' from django import forms from django.conf import settings from django.forms import widgets from django.contrib.auth.models import User from django.utils.translation i...
StarcoderdataPython
359923
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
StarcoderdataPython
12857832
<filename>rotkehlchen/exchanges/iconomi.py import base64 import hashlib import hmac import json import logging import time from json.decoder import JSONDecodeError from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Tuple from urllib.parse import urlencode import requests from rotkehlchen.accounting...
StarcoderdataPython
5072338
import string import sys class URISC_V1_Extended: def __init__(self, code): self.code = code self.output = ['1 ?\n'] self.functions = {} self.label_num = 0 self.temp_num = 0 def comp(self): for line in self.code.split('\n'): # print(line) ...
StarcoderdataPython
3340294
<reponame>dreibh/planetlab-lxc-plcapi<gh_stars>0 from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed from PLC.Auth import Auth from PLC.NodeGroups import NodeGroup, NodeGroups class DeleteNodeGroup(Method): """ Delete an existing Node Group. ins may delete any...
StarcoderdataPython
3295233
<filename>Basic/operator/operator_perbandingan.py<gh_stars>10-100 # Operator Perbandingan (Comparison Operator) digunakan untuk # Membadingkan antara dua nilai # contoh # Variable a = 5 b = 3 # == (sama dengan) digunakan untuk membandingkan # apakah kedua nilai memiliki nilai yang sama print("a == b:", a == b) # Fa...
StarcoderdataPython
8045926
<reponame>vhnatyk/vlsistuff #! /usr/bin/python3 import waveformer print('AFTER')
StarcoderdataPython
99446
<reponame>jstzwj/Mocores<gh_stars>1-10 from mocores.core.util.consistent_hash import (ConsistentHash) from mocores.core.util.identity import (WorkerID) from mocores.core.util.message_queue import (MessageQueue) from mocores.core.util.lru import (LRU)
StarcoderdataPython
11298151
# -*- coding: utf-8 -*- import torch import os import sys sys.path.append('../lightning-transformers') import argparse import json import re from torch.utils.data import DataLoader from transformers import AutoTokenizer, AutoModelForSequenceClassification, T5TokenizerFast, T5ForConditionalGeneration from typing import ...
StarcoderdataPython
11200520
<gh_stars>0 ''' This module contains all callbacks regarding the realtime tracing ''' from dash import callback_context from dash.dependencies import Input, Output, State from dash.exceptions import PreventUpdate from tracerface.web_ui.alerts import ( ErrorAlert, SuccessAlert, TraceErrorAlert, Warning...
StarcoderdataPython
6482543
<gh_stars>1-10 # This file is part of the Data Cleaning Library (openclean). # # Copyright (C) 2018-2021 New York University. # # openclean is released under the Revised BSD License. See file LICENSE for # full license details. """Generic outlier detector that uses scikit-learn outlier detection or clustering algorith...
StarcoderdataPython
4821811
<reponame>hhefzi/CKG<gh_stars>0 #------------------------------------------------------------------------------ # Configuration file for jupyterhub. #------------------------------------------------------------------------------ # set of users who can administer the Hub itself c.Authenticator.admin_users = {'adminhub...
StarcoderdataPython
1648154
<filename>1014 Find Local Peaks.py class Solution: def solve(self, nums): if len(nums) == 1: return [] return list(filter(lambda i:(nums[i] > nums[i-1] if i > 0 else True) and (nums[i] > nums[i+1] if i < len(nums)-1 else True), range(len(nums))))
StarcoderdataPython
11321923
# Author <NAME> import click import os import cv2 import shutil import random import time from faces_train import train_faces def unique_id(): """ Generator for the unique ids :return: Returns unique ids """ seed = random.getrandbits(32) while True: yield seed seed += 1 def ...
StarcoderdataPython
11222245
<reponame>gehtsoft/backtest-docker<gh_stars>1-10 import json, requests, sys, os.path import rest_conf as conf import datafile_rest as datafiles import unittest class DataFileTest(unittest.TestCase): def test_datafiles(self): file = conf.DATA_ADD resp = datafiles.add_datafile(file) self.as...
StarcoderdataPython
304235
import time import uctypes import struct import machine class DMA: DMA_BASE = 0x50000000 DMA_EN = 0x01 << 0 HIGH_PRIO = 0x01 << 1 INCR_READ = 0x01 << 4 INCR_WRITE= 0x01 << 5 DREQ_PIO0_RX0 = 0x04 << 15 DREQ_SPI1_TX = 0x12 << 15 DREQ_PERMANENT= 0x3F << 15 IRQ_QUIET = 0x01 <<...
StarcoderdataPython
6681622
import numpy as np from ..solution import Solution class Day07(Solution, day=7): def parse(self): with open(self.input_file, "rt") as infile: return [int(x) for x in infile.read().strip().split(",")] def part1(self): """ Want to compute argmin_x s(x) where s(x) = Σ_{d ∈ d...
StarcoderdataPython
9611650
<gh_stars>0 import unittest import logging import sys sys.path.append('../') from backend.bcm2835audiodriver import Bcm2835AudioDriver from cleep.exception import InvalidParameter, MissingParameter, CommandError, Unauthorized from cleep.libs.tests import session, lib import os import time from mock import Mock, MagicMo...
StarcoderdataPython
4923248
<reponame>andreaskern/simcoin import logging from bitcoin.rpc import JSONRPCError from setuptools.package_index import unique_everseen import utils import config from operator import attrgetter class CliStats: def __init__(self, context, writer): self._context = context self._writer = writer ...
StarcoderdataPython
1780564
from yolov5.utils.plots import plot_results plot_results('runs\\train\\exp175\\results.csv') # plot 'results.csv' as 'results.png'
StarcoderdataPython
8115048
<reponame>rw-meta/starter-py-client # coding=utf-8 import json import logging from time import sleep import requests class PrivateApi: headers = {'Accept': 'application/json', 'Content-Type': 'application/json'} def __init__(self, api_url): self.api_url = api_url self.max_retries = 30 d...
StarcoderdataPython
5025676
# Copyright 2017 ZTE Corporation. # # 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 ...
StarcoderdataPython
153389
#!/usr/bin/python # Python built-in function range() generates the integer numbers between the given start integer to the stop integer, i.e., range() returns a range object. # Using for loop, we can iterate over a sequence of numbers produced by the range() function. # It only allows integer type numbers as arguments....
StarcoderdataPython
12820113
#!/usr/bin/env python # -*- coding: utf-8 -*- # @author: x.huang # @date:17-8-11 from abc import abstractmethod from libs.util import AbstractBase class BaseService(AbstractBase): @abstractmethod def insert(self, *args, **kwargs): pass @abstractmethod def update(self, *args, **kwargs): ...
StarcoderdataPython
11313960
<gh_stars>10-100 basic_url = "/?length=1&comment0=test+comment&func0=KEY&skey0%5B%5D=CTRL&skey0%5B%5D=ALT&skeyValue0=i&Window0=ahk_exe+chrome.exe&Program0=chrome.exe&option0=ActivateOrOpen" basic_hotstring_url = ( "/?indexes=0&comment0=&func0=STRING&skeyValue0=btw&input0=by+the+way&option0=Replace" ) public_examp...
StarcoderdataPython
4800403
<gh_stars>1-10 import dash_bootstrap_components as dbc import dash_html_components as html from components.home_project_block import project_block from db import session from models import Project def layout(*args, **kwargs): projects = session.query(Project).order_by(Project.name).all() return html.Div([ ...
StarcoderdataPython
5187404
<gh_stars>1-10 import numpy as np import tensorflow as tf from tensorflow import keras from tensorflow.keras.layers import Dense from matplotlib import pyplot as plt class Module(keras.Model): def __init__(self, nf): super(Module, self).__init__() self.dense_1 = Dense(nf, activation='tanh'...
StarcoderdataPython
9689793
# # Autogenerated by Thrift # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # from cyclozzo.thrift.Thrift import * from ttypes import * from cyclozzo.thrift.Thrift import TProcessor from cyclozzo.thrift.transport import TTransport from cyclozzo.thrift.protocol import TBinaryProtocol, TProtocol try...
StarcoderdataPython
1975676
<gh_stars>0 #! /usr/bin/env python3 import random import time class Remote: _remote_type_alias_map = { 'fut089': 'rgbcct' } _remote_type_parameters_map = { 'rgbw': { 'retries': 10, 'delay': 0.1, 'channels': [9, 40, 71], 'syncword': [0x258B, 0x147A], 'zones': [1, 2, 3, 4], 'features': [ ...
StarcoderdataPython
9604434
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
StarcoderdataPython
9641112
<filename>validate.py """ Validation Implemented by <NAME> """ import argparse import os import torch from torch.utils.data import DataLoader from torchvision import utils as v_utils from tqdm import tqdm from data_path import DATA_PATH from dataset.augmentation import ValidFrameSampler, ValidAugmentation from datas...
StarcoderdataPython
90860
# Copyright 2017 <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, merge, publish, distribute, sub...
StarcoderdataPython
1903464
<filename>WebMirror/management/rss_parser_funcs/feed_parse_extractBarnnnBlogspotCom.py def extractBarnnnBlogspotCom(item): ''' Parser for 'barnnn.blogspot.com' ''' if 'Voice Drama' in item['tags']: return None vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "p...
StarcoderdataPython
6584590
<reponame>learningequality/sushi-chef-content-automation-scripts import functools import json import os import requirements import tempfile import xmlrpc.client from fabric.api import env, task, local from fabric.colors import red, green, blue, yellow from fabric.context_managers import hide, lcd from fabric.utils imp...
StarcoderdataPython
3476301
from unittest import TestCase from services.textrank import _word_graph, _sentence_graph _sentences = [ ['Every', 'breath', 'you', 'take'], ['Every', 'move', 'you', 'make'], ['Every', 'bond', 'you', 'break'], ['Every', 'step', 'you', 'take'], ['I', 'll', 'be', 'watching', 'you'] ] class TestG...
StarcoderdataPython
8099664
from plex import Plex from tests.core.helpers import read import responses # Set client configuration defaults Plex.configuration.defaults.server(host='mock') @responses.activate def test_get_all(): responses.add( responses.GET, 'http://mock:32400/:/prefs', body=read('fixtures/prefs.xml'), statu...
StarcoderdataPython
5175653
<reponame>webclinic017/koapy from koapy.backend.kiwoom_open_api_plus.core.KiwoomOpenApiPlusTypeLibSpec import ( DISPATCH_CLSID, EVENT_CLSID, TYPELIB_SPEC, ) from koapy.utils.pywin32 import BuildOleItems, LoadTypeLib TYPELIB = LoadTypeLib(TYPELIB_SPEC) OLE_ITEMS, ENUM_ITEMS, RECORD_ITEMS, VTABLE_ITEMS = Bu...
StarcoderdataPython
6440095
<gh_stars>0 import pytest from modules.feedback.models import Feedback, FeedbackScoreField, FeedbackField from modules.statistics.models.utils.update_users_statistics import update_user_stats from modules.packages.models import Package, MissionPackages from tasks.consts import IN_PROGRESS, VERIFICATION, FINISHED from ...
StarcoderdataPython
6570925
#!/usr/bin/env python3 # pip3 install requests import requests import json import logging import argparse import configparser import sys import re from urllib.parse import urlsplit import time nightscout_host=None # will be read from ns.ini api_secret=None # will be read from ns.ini token_secret=None # will be rea...
StarcoderdataPython
1717056
######################################################## # <NAME> - drigols # # Last update: 07/11/2021 # ######################################################## class Person: def __init__(self, nome, idade=None, numero_olhos = 2, naturalidade = "Brazil")...
StarcoderdataPython
1764553
""" Synchronizes a mailchimp list with the students of a course. """ import itertools import logging import math import random from collections import namedtuple from itertools import chain from django.core.management.base import BaseCommand from mailsnake import MailSnake from opaque_keys.edx.keys import CourseKey ...
StarcoderdataPython
3234540
""" ``$ articlequality extract_text -h`` :: Extracts text & metadata for labelings using XML dumps. Usage: extract_text <dump-file>... [--labelings=<path>] [--output=<path>] [--threads=<num>] [--verbose] extract_text -h | --help Options: -h --he...
StarcoderdataPython
5076950
from scanner.const import os from scanner.types import BaseContol, is_item_detected from scanner.transports import get_transport class Control(BaseContol, control_number=7): file_paths = ( '/boot/grub/menu.lst', '/boot/grub2/menu.lst', '/boot/grub/grub.cfg', '/boot/grub2/grub.cfg',...
StarcoderdataPython
5101323
<reponame>marvinhere/bookrecommendation import flask from sqlalchemy import create_engine import pandas as pd import numpy as np #import operator import mysql.connector as sql from flask import request, jsonify #from operations import * import joblib import json import array as arr import random import sys ...
StarcoderdataPython
5034652
<reponame>BrenoNAlmeida/free-python-games """Snake, classic arcade game. Exercises 1. How do you make the snake faster or slower? 2. How can you make the snake go around the edges? 3. How would you move the food? 4. Change the snake to respond to arrow keys. 1. Como você deixa a cobra mais rápida ou mais lenta? FEIT...
StarcoderdataPython
11242780
<reponame>astromark/lacewing import numpy as np #from mpl_toolkits.mplot3d import Axes3D from matplotlib import pyplot #from matplotlib import cm from matplotlib.patches import Ellipse from matplotlib.patches import Polygon from matplotlib import patches from matplotlib import _png import kinematics import ellipse impo...
StarcoderdataPython
6473167
# -*- coding: utf-8 -*- """Veil https api client.""" import asyncio import json import logging from types import TracebackType from typing import Dict, Optional, Type from urllib.parse import urlencode from uuid import UUID, uuid4 try: import ujson except ImportError: # pragma: no cover ujson = None try: ...
StarcoderdataPython
9648633
<gh_stars>100-1000 from contextlib import contextmanager import time from nose.tools import assert_less, assert_raises, eq_ from mockredis.tests.fixtures import setup, teardown from mockredis.tests.test_constants import ( LIST1, LIST2, VAL1, VAL2, VAL3, VAL4, bLIST1, bVAL1, bVAL2, bVAL3, bVAL4, ) @contextma...
StarcoderdataPython
11287108
<reponame>Cryptex-github/publicbot<gh_stars>0 import discord from discord.ext import commands # Image Manipulation import cv2 as cv from urllib.request import Request, urlopen import numpy as np class Misc(commands.Cog): """Some miscellaneous commands""" def __init__(self, bot): self.bot = bot ...
StarcoderdataPython
12806794
<reponame>UTexas-PSAAP/Parla.py import os os.environ["OMP_NUM_THREADS"] = "24" # This is the default on my machine (Zemaitis) import argparse import numpy as np import scipy.linalg from time import perf_counter as time def check_result(A, Q, R): # Check product is_correct_prod = np.allclose(np.matmul(Q, R), A)...
StarcoderdataPython
3440250
"""A Data Management, fitting and sequence design tool designed for Protein Engineering"""
StarcoderdataPython
11223650
<reponame>vincentdavis/special-sequences from unittest import TestCase from seqs.CardinalityMatchingAlt2 import matching, greedy_matching # g = {0: {1: (0, 1), 2: (0, 2), 4: (0, 4)}, 1: {0: (1, 0), 3: (1, 3), 5: (1, 5)}, 2: {3: (2, 3), 0: (2, 0), 6: (2, 6)}, 3: {2: (3, 2), 1: (3, 1), 7: (3, 7)}, 4: {5: (4, 5), 6: (4,...
StarcoderdataPython
345663
# -*- coding: utf-8 -*- """ Flandre Gallery Module (/flandre) Created on Sun Sep 1 15:36:31 2019 @author: eliphat """ import os import random import tg_connection flanpic_dir = r"D:\AndroidProjects\ScarletKindom\image-downloader\images0825" oss_root = 'https://scarletkindom.oss-cn-hangzhou.aliyuncs.com' oss_fmt = ...
StarcoderdataPython
3527898
<filename>npamp/model/integrator.py # Copyright (C) 2012 <NAME> # 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 retain the above copyright notice, this #...
StarcoderdataPython
1769729
#/!/usr/bin/python def writeDataToFile(filename, data, quitOnFail=False): f = file("output/"+filename, "a") f.write(data) f.flush() f.close() print "[*] Successfully saved %s" % filename
StarcoderdataPython
4887147
<reponame>stephenwalker2020/solidity-things<gh_stars>0 #!/usr/bin/python3 from brownie import accounts, Contract, BoringDAOTimelock from dotenv import load_dotenv import os load_dotenv() def main(): user = accounts.add(os.getenv("private_key")) print(user) timelock = BoringDAOTimelock.deploy(24*3600, [use...
StarcoderdataPython
1791928
def print_event(args): print "Event: ", args def invoke(event_manager): print event_manager event_manager.register_handler('message', print_event, persist=True)
StarcoderdataPython
11270577
<reponame>SpikingNeurons/toolcraft from .__base__ import Folder, ResultsFolder, StorageHashable from .state import Info, Config from .file_group import FileGroup, NpyMemMap, SHUFFLE_SEED_TYPE, \ DETERMINISTIC_SHUFFLE, NO_SHUFFLE, DO_NOT_USE, USE_ALL, \ SELECT_TYPE, NON_DETERMINISTIC_SHUFFLE, FileGroupConfig fro...
StarcoderdataPython
9663639
import argparse import logging import sys import socket from typing import ByteString import select import time import re from urllib import request import scapy import getmac from getmac import get_mac_address from scapy.all import * def getArgs(): # Parse command-line arguments argsParser = argparse.Argument...
StarcoderdataPython
8102756
<reponame>Xowap/pylesswrap # vim: fileencoding=utf-8 tw=100 expandtab ts=4 sw=4 : # # pylesswrap # (c) 2014 <NAME> <<EMAIL>> # # This work is free. You can redistribute it and/or modify it under the # terms of the Do What The Fuck You Want To Public License, Version 2, # as published by Sam Hocevar. See the COPYING fil...
StarcoderdataPython
11354173
from .join import Join from .quit import Quit from .time import Time from .stats import Stats from .start import Start from .notify import Notify from .wins import Wins from .top import Top def setup(client): client.add_cog(Join(client)) client.add_cog(Quit(client)) client.add_cog(Time(client)) client....
StarcoderdataPython
3295816
import json from random import * with open("data.json", "r") as myfile: data = myfile.read() data = json.loads(data) items = [] def updateItems(): global items global data items = [] buildingIDX = 0 itemIDX = 0 while True: items.append(data["proffesions"][buildingIDX]["items"][i...
StarcoderdataPython
3311249
from argparse import ArgumentParser import os import json import numpy as np from google.protobuf import json_format from calamari_ocr.utils import glob_all, split_all_ext from calamari_ocr.ocr import Evaluator from calamari_ocr.ocr.datasets import create_dataset, DataSetType, DataSetMode from calamari_ocr.proto impo...
StarcoderdataPython
11371298
""" Animation Resource Description: This resource will house the requests to create and retrieve video animations. """ from io import BytesIO from flask import send_file from flask_restx import Resource, reqparse from werkzeug.datastructures import FileStorage from saturn.apis import api from saturn.common import ani...
StarcoderdataPython
3203239
<filename>tests/data/test_activate_mixin.py import unittest from rastervision.data import (ActivateMixin, ActivationError) class TestActivateMixin(unittest.TestCase): class Foo(ActivateMixin): def __init__(self): self.activated = False def _activate(self): self.activated ...
StarcoderdataPython
3445826
N, Q = map(int, input().split()) acorns = list(map(int, input().split())) for i in range(Q): t, l, r = map(int, input().split()) if t == 1: acorns[l-1:r] = list(sorted(acorns[l-1:r])) else: acorns[l-1:r] = list(sorted(acorns[l-1:r], reverse=True)) print(*acorns)
StarcoderdataPython
3312014
# 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 writing, software # distributed under the...
StarcoderdataPython
8123680
<gh_stars>0 from typing import Union, Dict from asyncpg import Record from asyncpgsa import PG from graphene.types import ResolveInfo from graphql.language.ast import InlineFragment from sqlalchemy import and_ from .base import PROJECTS_REQUIRED_FIELDS, format_project_type from tracker.api.errors import APIException ...
StarcoderdataPython
4808673
import numpy as np import os,sys,subprocess from pandas import * CSPEC='SO2 SO4 NOX HNO3 NO3 PMS1 PMS2 PMS3'.split() # 由目錄中讀取所有concrec*.dat檔名。檔名是成分與時間的矩陣 fnames=list(subprocess.check_output('ls concrec*dat',shell=True).split(b'\n')) fnames=[i.decode('utf8') for i in fnames if len(i)>0 ] if len(fnames)==0:sys.exit('conc...
StarcoderdataPython
4837129
"""Controller for registering new objects.""" import logging import string # noqa: F401 from typing import (Dict, Optional) from flask import current_app from pymongo.errors import DuplicateKeyError from trs_filer.errors.exceptions import ( InternalServerError, ) from trs_filer.ga4gh.trs.endpoints.utils import ...
StarcoderdataPython
12821601
# coding: utf-8 # # Copyright (c) 2018, <NAME> <<EMAIL>>. All rights reserved. # Licensed under BSD 2-Clause License. See LICENSE file for full license. from pytest import mark from advent.input import text from advent.the_stars_align import parser, part1 test_data = """ position=< 9, 1> velocity=< 0, 2> position=...
StarcoderdataPython
5184455
import torch, os, cv2 from model.model import parsingNet from utils.common import merge_config from utils.dist_utils import dist_print import torch import scipy.special, tqdm import numpy as np import torchvision.transforms as transforms from data.dataset import LaneTestDataset from data.constant import culane_row_anch...
StarcoderdataPython
1767443
<filename>autoencoder/Q1_Autoencoder.py import random import torch import torch.nn as nn import pandas as pd import numpy as np import matplotlib.pyplot as plt N=1000 mean1=[0,0,0] cov1=[[1,0.8,0.8],[0.8,1,0.8],[0.8,0.8,1]] dataset = np.random.multivariate_normal(mean1, cov1, N) dataset = (dataset-np.amin(dataset))/(...
StarcoderdataPython
3374893
import pytest from flask import g, session, url_for, request from portal.db import get_db def test_sessions(client, auth): auth.teacher_login() # Teachers should see session from mock data on session page response = client.get('/teacher/sessions') assert b'180 A' in response.data # Teachers shoul...
StarcoderdataPython
3434394
#!/usr/bin/env python import sys import numpy as np from scipy.spatial import distance from scipy.stats import pearsonr, spearmanr from itertools import izip np.random.seed(1337) # for reproducibility def pos_prob(x, y): # return sum(np.log(x[y > 0])) / sum(y) pos_probs = np.log(x[y > 0]) pos_probs = n...
StarcoderdataPython
5086998
# ------------------------------------------------------------------------- # # Part of the CodeChecker project, under the Apache License v2.0 with # LLVM Exceptions. See LICENSE for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # # ---------------------------------------------------...
StarcoderdataPython
171411
class BadStatusException(Exception): pass
StarcoderdataPython
5185690
<reponame>nchlis/CIFAR10_CAM<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Thu May 9 15:53:01 2019 @author: N.Chlis """ from keras.models import load_model import numpy as np from keras.datasets import cifar10 (X_tr, y_tr), (X_val, y_val) = cifar10.load_data() #normalize input images to [0,1] X_tr=...
StarcoderdataPython
8164296
<filename>garpar/utils/mabc.py import attr from abc import ABCMeta, abstractmethod # noqa HPARAM_METADATA_FLAG = "__hparam__" MPROPERTY_METADATA_FLAG = "__mproperty__" MODEL_CONFIG = "__model_cls_config__" def hparam(default, **kwargs): """Create a hyper parameter for market maker. By design decision, h...
StarcoderdataPython