id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
71022 | <reponame>BirgittM/COSCO-1<gh_stars>10-100
from .Scheduler import *
import numpy as np
from copy import deepcopy
class MADMCRScheduler(Scheduler):
def __init__(self):
super().__init__()
self.utilHistory = []
self.utilHistoryContainer= []
def updateUtilHistoryContainer(self):
c... | StarcoderdataPython |
3353713 | import abc
import logging
from typing import TypeVar, Type, List, Tuple, Any, Callable
__all__ = ('Config', 'Argument', 'Arguments', 'Task', 'Message', 'Fence', 'TaskLogger',
'State', 'Router', 'LoggerService', 'Broker', 'App')
Config = TypeVar('Config')
Argument = TypeVar('Argument')
Arguments = TypeVar('... | StarcoderdataPython |
114110 | # Copyright 2017 <NAME>
#
# 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, softw... | StarcoderdataPython |
1648239 | # -*- coding: utf-8 -*-
from math import sqrt, pi
class SoftConfidenceWeighted(object):
MIN_CONFIDENCE = 0.0
MAX_CONFIDENCE = 1.0
MIN_AGGRESSIVENESS = 0.0
VALID_LABEL = [1, -1]
ERF_ORDER = 30
def __init__(self, confidence=0.7, aggressiveness=1.0):
if confidence < self.MIN_CONFIDENCE:... | StarcoderdataPython |
1776761 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'main.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, ... | StarcoderdataPython |
4812732 | #!/usr/bin/env python3
"""Advent of Code 2015, Day 11: Corporate Policy"""
import string
import aoc
import pytest
def validate_password(password):
"""Check password against the puzzle’s requirements
Passwords:
* must include one increasing straight of at least three
letters, like abc, bcd... | StarcoderdataPython |
160007 | import re
#from random import randrange
from model.contact import Contact
def test_contact_all(app, db):
ui_list = app.contact.get_contact_list()
def clean(contact):
return Contact(id=contact.id, name=contact.name.strip(), surname=contact.surname.strip(), address=contact.address,
... | StarcoderdataPython |
1752474 | """Unit test class for GraphTransformer objects."""
from tqdm.auto import tqdm
from unittest import TestCase
from embiggen.edge_prediction import edge_prediction_evaluation
from embiggen import get_available_models_for_edge_prediction, get_available_models_for_node_embedding
from embiggen.edge_prediction.edge_predictio... | StarcoderdataPython |
3233833 | <filename>datasets/seq2seq/en-ta-parallel-v2/tokenizer.py
import nltk
def combinations(word, blacklist):
combs = []
for i in range(len(word)):
if word[i] not in blacklist:
for j in range(i+2,len(word)+1):
combs.append(word[i:j])
return combs
def greedy_combinations(wor... | StarcoderdataPython |
3390128 | """Methods for image transformations/augmentations."""
from random import choice
from typing import Any, Callable, Tuple
import cv2
import numpy as np
from PIL import Image
from scipy.ndimage import gaussian_filter
def transform(
field: np.ndarray,
mask: np.ndarray,
translation: Callable[..., Tuple[np.nd... | StarcoderdataPython |
1751854 | import pytest
import reflectivipy
from .ReflectivityExample import ReflectivityExample
from reflectivipy import MetaLink
@pytest.fixture(autouse=True)
def setup():
reflectivipy.uninstall_all()
def test_original_ast_preservation():
example = ReflectivityExample()
link = MetaLink(example, 'tag_exec', 'af... | StarcoderdataPython |
160105 | #!/usr/bin/env python3
#
# Copyright 2019 <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This p... | StarcoderdataPython |
1660404 | #Majority Classifier
import numpy as np
# return array with features full of the most frequent class
def predictMaj(features):
(values,counts) = np.unique(features,return_counts=True)
values[np.argmax(counts)] # prints the most frequent element
return np.full(shape=len(features),fill_value=values[np.argma... | StarcoderdataPython |
3386784 | <filename>tests/src/python/test_qgsprocessingalgrunner.py
# -*- coding: utf-8 -*-
"""QGIS Unit tests for Processing algorithm runner(s).
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; eith... | StarcoderdataPython |
1645557 | from kivymd.uix.screen import MDScreen
class IntroScreen(MDScreen):
def goto_exercise(self):
self.manager.goto_exercise()
print("IntroScreen: goto_exercise")
def goto_choose(self):
self.manager.goto_choose()
| StarcoderdataPython |
3327798 | from .main import Voice
from .phonemes import (PhonemeList, Phoneme, FrenchPhonemes,
BritishEnglishPhonemes, GreekPhonemes, ArabicPhonemes,
SpanishPhonemes, GermanPhonemes, ItalianPhonemes,
PortuguesePhonemes, AmericanEnglishPhonemes)
| StarcoderdataPython |
172570 | #!/usr/bin/env python
from __future__ import generators
"""web.py: makes web apps (http://webpy.org)"""
__version__ = "0.2"
__revision__ = "$Rev: 62 $"
__author__ = "<NAME> <<EMAIL>>"
__license__ = "public domain"
__contributors__ = "see http://webpy.org/changes"
# todo:
# - some sort of accounts system
import uti... | StarcoderdataPython |
3244570 | '''
code for preparing and loading dataset for the SET game
'''
### imports
import os
import numpy as np
import pandas as pd
import logging
from pathlib import Path
from tensorflow.keras.preprocessing.image import ImageDataGenerator
# dataset path
dataset_path = Path(os.path.dirname(os.path.abspath(__file__))) / "d... | StarcoderdataPython |
20157 | import typing
from typing import Any
import json
import os
from multiprocessing import Process, Queue
from allennlp.data.tokenizers.word_splitter import SpacyWordSplitter
from spacy.tokenizer import Tokenizer
import spacy
from tqdm.auto import tqdm
import time
nlp = spacy.load("en")
class TokenizingWorker(Process):... | StarcoderdataPython |
24740 | <filename>python/brainvisa/maker/components_definition.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import sys
# groups:
# anatomist: projects needed for anatomist (aims, soma-io and dependencies)
# opensource
# brainvisa: public brainvisa distro
# bvdev: same as brainvisa but excludes ... | StarcoderdataPython |
3204800 | import csvreader
import numpy as np
import matplotlib.pyplot as plt
header, player_data = csvreader.csv_reader_with_headers('../data/Player_full_data.csv')
for player in player_data:
plt.style.use('ggplot')
values = [float(player[5]), float(player[10]), float(player[14]), float(player[18])]
feature = ['Bo... | StarcoderdataPython |
1733900 | <gh_stars>0
"""
The Logging Utility Module
"""
import logging
class BraceMessage:
def __init__(self, fmt, *args, **kwargs):
self.fmt = fmt
self.args = args
self.kwargs = kwargs
def __str__(self):
return self.fmt.format(*self.args, **self.kwargs)
| StarcoderdataPython |
1736519 | import numpy as np
from frameworks.CPLELearning import CPLELearningModel
from frameworks.SelfLearning import SelfLearningModel
from methods.scikitWQDA import WQDA
from examples.plotutils import evaluate_and_plot
# number of data points
N = 60
supevised_data_points = 4
# generate data
meandistance = 1
s = np.random.... | StarcoderdataPython |
1752418 | <gh_stars>10-100
# vim: set encoding=utf-8
"""Some common combinations"""
import string
from pyparsing import Empty, FollowedBy, LineEnd, Literal, OneOrMore, Optional
from pyparsing import Suppress, SkipTo, Word, ZeroOrMore
from regparser.grammar import atomic
from regparser.grammar.utils import keep_pos, Marker
per... | StarcoderdataPython |
104380 | <reponame>daisuke-fujita/monsaca-analytics_20181107
#!/usr/bin/env python
# Copyright (c) 2016 Hewlett Packard Enterprise Development Company, L.P.
#
# 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 Licen... | StarcoderdataPython |
3312575 | <filename>patron/verify/api.py
# Copyright 2015 OpenStack.
#
# 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 req... | StarcoderdataPython |
3343758 | import numpy as np
from torch.autograd import Variable, Function
import torch
import types
class VanillaGradExplainer(object):
def __init__(self, model):
self.model = model
def _backprop(self, inp, ind):
output = self.model(inp)
if ind is None:
ind = output.data.max(1)[1]
... | StarcoderdataPython |
3270033 | <filename>src/RIOT/tests/gnrc_rpl_srh/tests/01-run.py
#!/usr/bin/env python3
# Copyright (C) 2018 Freie Universität Berlin
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import os
import random
i... | StarcoderdataPython |
3238095 | <reponame>kalev/flatpak-status
import functools
import logging
import os
import subprocess
logger = logging.getLogger(__name__)
class GitError(Exception):
pass
class OrderingError(Exception):
pass
class GitRepo:
def __init__(self, repo_dir):
self.repo_dir = repo_dir
def do(self, *args):
... | StarcoderdataPython |
179609 | import numpy as np
from layers import (
FullyConnectedLayer, ReLULayer,
ConvolutionalLayer, MaxPoolingLayer, Flattener,
softmax_with_cross_entropy, l2_regularization, softmax
)
class ConvNet:
"""
Implements a very simple conv net
Input -> Conv[3x3] -> Relu -> Maxpool[4x4] ->
Conv[3x3... | StarcoderdataPython |
1777773 | <reponame>smmckay/quex-mirror
#! /usr/bin/env python
# PURPOSE:
# Tests the function "get_follow_state_combinations(state_combination)"
# from the module state_machine.construction.paralellize.
#
################################################################################
import sys
sys.path.append("../")
fro... | StarcoderdataPython |
1740820 | import re
import unittest
from unittest.mock import patch
from click.testing import CliRunner
from tests.util import read_data, DETERMINISTIC_HEADER, skip_if_exception
try:
import blackd
from aiohttp.test_utils import AioHTTPTestCase, unittest_run_loop
from aiohttp import web
except ImportError:
has_... | StarcoderdataPython |
1711236 | """
Written by <NAME> (<EMAIL>) and <NAME>,
based on Harry-Fairhurst arXiv:1012.4939. Produces a file txt with right ascension,
declination, coherent SNR and GPS time of the maximum for galaxies from the GLADE cathalog
within 90% C.L. of Bayestar skymap for a given Binary Neutron Star candidate trigger on Grace... | StarcoderdataPython |
1673017 | from django.shortcuts import render, redirect
from hujan_ui import maas
from hujan_ui.maas.utils import MAAS
from .forms import VlanForm, VlanEditForm
from django.utils.translation import ugettext_lazy as _
import sweetify
from hujan_ui.maas.exceptions import MAASError
def index(request):
try:
vlans = maa... | StarcoderdataPython |
3370460 | from .ContactUsController import ContactUsController
from .OpenApiController import OpenApiController
| StarcoderdataPython |
1794972 | <filename>aidfin/conf/GlobalSettings.py<gh_stars>0
# -*- coding: UTF-8 -*-
"""
Default settings. Override these with settings in the module pointed to
by the environment variable.
"""
####################
# CORE #
####################
EVENT_LOGS = "/opt/logs/tensor"
TRAIN_DATA = "/opt/logs/tensor/mnist_... | StarcoderdataPython |
174547 | import scapy.all as scapy
import netfilterqueue
import re
from threading import Thread
import time
import subprocess
class Injector:
def __init__(self):
self.ack_list=[]
self.injection = ''
self.injector_running = False
def enable_forward_chain(self):
subprocess.call(["iptabl... | StarcoderdataPython |
104996 | from helper import *
import json
URL = "https://www.umb.edu/academics/course_catalog/subjects/2018%20Spring"
SEM = "2018 Spring"
# Get the catalog page
text = read_URL(URL)
# Get the list of majors
cut = cut_text(text, "<h3>Undergraduate Subjects</h3>", "</ul>")
urls = get_URLs(cut)
cut = cut_text(text, "<h3>Gradua... | StarcoderdataPython |
27321 | # Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
import pyspark
from pyspark.sql import SparkSession
class TpchBase:
def __init__(self, spark, dir):
self.c... | StarcoderdataPython |
1719125 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Date created : 27 August 2016
@author : <NAME>
@description : Data Transformation
"""
import pandas as pd
import numpy as np
## Source file
df = pd.read_csv('path/to/file.csv')
## List of the original column names from the flat file
step = df['step']
gri... | StarcoderdataPython |
1615615 | # -*- coding: utf-8 -*-
##############################################################################
import os.path
import requests
from bs4 import BeautifulSoup
import sys
import os
os.system("clear")
if sys.version_info[0] != 3:
print('''\t \n\t\tREQUIRED PYTHON 3.x\n\t\tinstall and try: python3... | StarcoderdataPython |
4841661 | <filename>exs/mundo_3/python/099.py
"""
Desafio 099
Problema: Faça um programa que tenha a função maior(), que recebe vários parâmetros
com valores inteiros.
Seu programa tem que analisar todos os valores e dizer qual deles é o maior.
Resolução do problema:
"""
from time import sleep
# Função pa... | StarcoderdataPython |
3304453 | <filename>recipes/Python/102114_ThreadedContext/recipe-102114.py
ThreadedContext is like a dictionary, but stores its data in a private namespace for every thread.
A thread can't access to the data from other thread.
USAGE:
In Thread 1:
d = ThreadedContext()
d[1]=1
In Thread 2:
d[1] #raises KeyError exception
d[1]= 2
... | StarcoderdataPython |
3391277 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from datetime import datetime
import os
import json
import requests
import xmlrpc.client
import pprint
import pkg_resources
import time
from botbuilder.core import CardFactory, TurnContext, MessageFactory
from botbuilder.cor... | StarcoderdataPython |
1793890 | from common.tools.blockstring import BlockString
from common.tools.padders import PKCS7Padder, PKCS7Unpadder
from common.tools.xor import ByteXOR
class BlockCipherMode(object):
DEFAULT_BLOCK_SIZE = 16
@classmethod
def name(cls):
return cls.__name__
def __init__(self, b... | StarcoderdataPython |
1612549 | <reponame>mbaak/Eskapade
from eskapade.data_mimic.links import *
| StarcoderdataPython |
192972 | <reponame>matis11/Human-Computer-Communication
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import csv
import matplotlib.pyplot as plt
from matplotlib.legend_handler import HandlerLine2D
class Algorithm:
source_file = ""
label = ""
color = ""
def __init__(self, source_file, label, color):
s... | StarcoderdataPython |
1717165 | import argparse
import json
import math
from functools import lru_cache
from urllib.parse import urlencode
from urllib.request import urlopen
class AirportService:
def __init__(self, longitude, latitude):
self.location = MapCoordinate(longitude, latitude)
def get_nearest_airports_in_radius(self, rad... | StarcoderdataPython |
68812 | <gh_stars>0
# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__project__ = 'leetcode'
__file__ = '__init__.py.py'
__author__ = 'king'
__time__ = '2022/2/15 16:02'
_ooOoo_
o8888888o
88" . "88
... | StarcoderdataPython |
1797208 | <reponame>DariaMachado/Algoritmos_Python
n: int; i: int; fora: int; dentro: int; x: int
n = int(input("Quantos numeros voce vai digitar? "))
fora = 0
dentro = 0
for i in range(0, n):
x = int(input("Digite um numero: "))
if x < 10 or x > 20:
fora = fora + 1
else:
dentro = dentro + 1
prin... | StarcoderdataPython |
1616794 | <gh_stars>0
""""
Program name : Website cloner
author : https://github.com/codeperfectplus
How to use : Check README.md
"""
import os
import sys
import requests
from bs4 import BeautifulSoup
class CloneWebsite:
def __init__(self,website_name):
self.website_name = website_name
def crawl_... | StarcoderdataPython |
79094 | # -*- coding: utf-8 -*-
"""This module provides access to the execution REST api of Camunda."""
from __future__ import annotations
import dataclasses
import typing
__all__ = []
@dataclasses.dataclass
class Execution:
"""Data class of execution as returned by the REST api of Camunda."""
id_: str
proces... | StarcoderdataPython |
3229648 | #Importing all the necessary libraries
from tkinter import *
import random,string
import pyperclip
#initialize Window
root = Tk()
root.geometry("400x400")
root.resizable(0,0)
root.title("Password Generator")
Label(root, text ='Password Generator', font='arial 15 bold').pack(side = BOTTOM)
pass_label =... | StarcoderdataPython |
72286 | import csv
# convert to csv
with open('/home/elad_ch/security_prj/security_project/10-million-password-list-top-1000000.txt', 'r') as in_file:
stripped = (line.strip() for line in in_file)
lines = (line.split(",") for line in stripped if line)
with open('10-million-password-list-top-1000000.csv', 'w') as o... | StarcoderdataPython |
3317912 | <gh_stars>1-10
"""Message Processor package."""
| StarcoderdataPython |
136613 | <filename>db/model/APolitician.py
from db.model.ADBItem import ADBItem
from datetime import date
"""
Abstract Politician class that can be extended as needed
"""
class APolitician(ADBItem):
FIRST_NAME = None
MIDDLE_NAME = None
LAST_NAME = None
DATE_OF_BIRTH = None
GENDER = None
PARTY = No... | StarcoderdataPython |
3376940 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import argparse
import sys
import traceback
import json
import pika
DATA = []
def publish(host, port, exchange, routing_key, data):
connection = pika.BlockingConnection(
pika.ConnectionParameters(host=host, port=port))
main_channel = connection.channel()
... | StarcoderdataPython |
126023 | #!/usr/bin/env python
from distutils.core import setup
setup(
name='pysoftether',
version='1.0.1',
description='SoftEther VPN Server Python Management API',
author='vandot',
author_email='<EMAIL>',
url='https://github.com/vandot/pysoftether',
packages=['softether'],
)
| StarcoderdataPython |
1662693 | """Generate CronWorkflow specifications."""
from dataclasses import dataclass, field
from enum import Enum
from typing import Any, Mapping, Optional
from dagger.dag import DAG
from dagger.runtime.argo.extra_spec_options import with_extra_spec_options
from dagger.runtime.argo.workflow_spec import Workflow, workflow_sp... | StarcoderdataPython |
1775620 | ### $Id: admin.py,v 1.29 2017/12/18 09:12:52 muntaza Exp $
from django.contrib import admin
from umum.models import Provinsi, Kabupaten, LokasiBidang, SKPD, SUBSKPD, KodeBarang, HakTanah, SatuanBarang, KeadaanBarang, SKPenghapusan, MutasiBerkurang, JenisPemanfaatan, AsalUsul, Tahun, GolonganBarang, Tanah, KontrakTanah... | StarcoderdataPython |
3330720 | from PyQt5.QtWidgets import QDialog
from trpgcreator.ui.dialogs.create_resource import Ui_CreateResourceDialog
class CreateResourceDialog(QDialog):
def __init__(self):
super().__init__()
self.ui = Ui_CreateResourceDialog()
self.ui.setupUi(self)
self.ui.buttonBox.accepted.connect(la... | StarcoderdataPython |
142759 | <reponame>dubizzle/django_influxdb_metrics
"""URLs to run the tests."""
try:
from django.conf.urls import include, url
except ImportError: # Pre-Django 1.4 version
from django.conf.urls.defaults import include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = [
url(r'^admin/', inc... | StarcoderdataPython |
1627700 | <reponame>leonardovida/remindo-etl-airflow<gh_stars>0
from sqlalchemy import Date, Float, String, Integer, Column, DateTime, BIGINT
from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship
from src.warehouse.base import Base
from src.warehouse.models.moment import Moment
from src.warehouse.models.recip... | StarcoderdataPython |
1713922 | #!/usr/bin/env python3
import pytest
import isce3.ext.isce3.geometry as m
from isce3.ext.isce3.core import DataInterpMethod
from isce3.geometry import DEMInterpolator
from isce3.io import Raster
import iscetest
import os
import collections as cl
import numpy.testing as npt
from osgeo import gdal
def dem_info_from_g... | StarcoderdataPython |
151857 | <reponame>calibear20/NHentai-API
import functools
from expiringdict import ExpiringDict
from typing import Callable
class Cache:
_CACHE = None
def __init__(self, cache_key_position: int, cache_key_name: str, max_age_seconds: int=3600, max_size: int=100):
self._CACHE = ExpiringDict(max_len=max_size, max_age_se... | StarcoderdataPython |
3212819 | <gh_stars>0
import pathlib
from ted_sws import config
from ted_sws.mapping_suite_processor.adapters.allegro_triple_store import AllegroGraphTripleStore
def repository_exists(triple_store: AllegroGraphTripleStore, repository_name) -> bool:
"""
Method to check if the repository is in the triple store
:para... | StarcoderdataPython |
3363516 |
import FWCore.ParameterSet.Config as cms
process = cms.Process("GeometryTest")
process.load("Configuration.StandardSequences.MagneticField_38T_cff")
#from xml text files #process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi")
#from db xml source: #process.load("GeometryReaders.XMLIdealGeometryESSource.cmsG... | StarcoderdataPython |
1718843 | from random import random
row = []
row = ["city", "moving_from", "bhk", "min_budget", "max_budget", "cutomer_type", "workers", "no_of_cars",
"house_type", "travelling_time", "furnishing", "lease_type", "seen_other_options", "show_old_construction",
"status", "is_urgent", "state"]
print (", ".join(row))
for i in... | StarcoderdataPython |
3342197 | # -*- coding: utf-8 -*-
import re
import struct
from .common import *
from .CuSMVersion import CuSMVersion
# Pattern that matches an instruction string
p_InsPattern = re.compile(r'(@!?U?P\d|@!PT)?\s*\{?\s*(\w+.*)\s*')
# Pattern that matches scoreboard sets, such as {1}, {4,2}
# Seems only appear after opc... | StarcoderdataPython |
3386960 | from sys import exit
from django.conf import settings
from PIL import Image as PilImage
from PIL import UnidentifiedImageError
from forum.cdn.models import Image
def run():
print('already done')
exit(1)
all_images = list()
to_delete = set()
for idx, image in enumerate(Image.objects.all()): # ty... | StarcoderdataPython |
174611 | <reponame>chart21/fdrtd<gh_stars>0
"""
contains the entry points of the API
"""
from flask import current_app
from fdrtd.server.exceptions import handle_exception
def get_bus():
"""get the singleton bus of the server application"""
with current_app.app_context():
return current_app.bus
def list_re... | StarcoderdataPython |
1742863 | <reponame>Jianguo188/LeetCode-Py
class Heapq:
# 堆调整方法:调整为大顶堆
def heapAdjust(self, nums: [int], index: int, end: int):
left = index * 2 + 1
right = left + 1
while left <= end:
# 当前节点为非叶子结点
max_index = index
if nums[left] > nums[max_index]:
max_index = left
if right <= end and nums[right] > nums[m... | StarcoderdataPython |
1676595 | <gh_stars>1000+
# Copyright 2018 Espressif Systems (Shanghai) PTE LTD
#
# 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... | StarcoderdataPython |
4818515 | <reponame>HashFlag/tracer
import datetime
from django.utils.deprecation import MiddlewareMixin
from django.conf import settings
from app01 import models
from django.shortcuts import redirect
class tracer:
def __init__(self):
self.user_obj = None
self.price_policy = None
self.project = None... | StarcoderdataPython |
1620662 | <reponame>Web-Dev-Collaborative/DS-ALGO-OFFICIAL<gh_stars>10-100
def even_occuring_element(arr):
"""Returns the even occuring element within a list of integers"""
dict = {}
for num in arr:
if num in dict:
dict[num] += 1
else:
dict[num] = 1
for num in dict:
... | StarcoderdataPython |
1744373 | <gh_stars>0
from __future__ import print_function, unicode_literals
from PyInquirer import prompt, print_json
from tracra_export import writeMails
from mailbox import MailboxAnalyzeObject
from oauth_utils import openOauthWebsite, generateOauthString
import pandas as pd
import os, sys
from multiprocessing import freeze... | StarcoderdataPython |
3358095 | import os
import sys
import time
import shutil
#sys.path.append('C:/prismx/')
import prismx as px
libs = px.list_libraries()
clustn = 26
f = open("validationscore"+str(clustn)+".txt", 'r')
libraries = [x.split("\t")[0] for x in f.readlines()]
newlibs = list(set(libs).difference(set(libraries)))
for i in range(0, len... | StarcoderdataPython |
3378599 | from .contact import ContactForm
from .auth import UserForm, PermissionForm, RoutePermissionForm, LoginForm, ChangePassForm
__all__ = ['ContactForm', 'UserForm', 'PermissionForm', 'RoutePermissionForm', 'LoginForm', 'ChangePassForm']
| StarcoderdataPython |
1672118 | <filename>devices/cisco/cisco_ios.py
from devices.cisco import BaseCisco
class CiscoIOS(BaseCisco):
"""
Class to represent Cisco IOS device
"""
def __init__(self, **kwargs):
super(CiscoIOS, self).__init__(**kwargs)
@property
def device_type(self):
"""
Returns device t... | StarcoderdataPython |
4801226 | <reponame>JesseBausell/Hydrolight_MFile_reader_py
# Hydrolight_MFile_reader
# <NAME>
# October 31, 2020
#
# This python script reformats a series of Hydrolight-generated m-files (radiative
# transfer outputs) into hdf5 files. This enables easier access to data for investigators,
# who can work with structured variabl... | StarcoderdataPython |
29631 | import os
import numpy as np
import pytest
from pennylane import qchem
from openfermion.hamiltonians import MolecularData
ref_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "test_ref_files")
table_1 = np.array(
[
[0.0, 0.0, 0.0, 0.0, 0.68238953],
[0.0, 1.0, 1.0, 0.0, 0.68238953]... | StarcoderdataPython |
1636191 | from math import sqrt
# Omega(sqrt(n)) = Omega(n^(1/2)) = Omega((2^c)^(1/2))
def is_prime(n):
is_prime = (n + 1) * [True]
for candidate in range(2, int(sqrt(n)) + 1):
if is_prime[candidate]:
for witness in range(candidate * candidate, n + 1, candidate):
is_prime[witness] =... | StarcoderdataPython |
4823616 | <gh_stars>0
from Bio import SeqIO
import numpy as np
import os
#print("something")
class sequenceReaderDecoder():
def __init__(self, filePath, fileDestiny):
self.filePath = filePath
self.fileDestiny = fileDestiny
self.aminoacids = {"G" : 0 ,"P" : 1,"A" : 2,"V" : 3,"L" : 4,"I" : ... | StarcoderdataPython |
1773907 | <filename>tests/PySys/tedge/tedge_agent_user_sudo_access/run.py
import time
from pysys.basetest import BaseTest
import subprocess
from threading import Timer
"""
Validate tedge-agent user has a limited sudo right
Given tedge_apt_plugin and tedge_agent are installed
When we run plugin located in plugin directory as te... | StarcoderdataPython |
3314920 | from django.db import models
# Create your models here.
class Car(models.Model):
brand = models.CharField(max_length=20)
users = models.ManyToManyField('auth.User', blank=True, db_constraint=False) | StarcoderdataPython |
3276535 | """ Handles the logic of simple reusable dialogs
"""
import logging
import numpy as np
from PyQt5 import QtWidgets
from meggie.utilities.dialogs.simpleDialogUi import Ui_SimpleDialog
from meggie.utilities.widgets.batchingWidgetMain import BatchingWidget
from meggie.utilities.validators import validate_name
from m... | StarcoderdataPython |
3396221 | from setuptools import setup, find_packages
def setup_package():
setup(
name="motion-marmot",
description="The marmot serves as a motion detector which can target out all possible motions.",
url="https://github.com/daohuei/motion-marmot",
author="daohuei",
author_email="<EM... | StarcoderdataPython |
1671539 | from flask import Blueprint, request, render_template
import json, random, dbconfig_MapleStory
WispsWonderBerry = Blueprint("WispsWonderBerry", __name__, url_prefix="/MapleStory/WispsWonderBerry")
db_Class = dbconfig_MapleStory.DataBase()
WispsWonderBerry_Item_Name_List = []
WispsWonderBerry_Item_Probability_List = [... | StarcoderdataPython |
3356634 | <reponame>cognifloyd/stackstorm-device42<gh_stars>1-10
from lib.base_action import BaseAction
class Update_Device(BaseAction):
def run(self, identifier, identifier_type, changes):
# designate which device to update, based on any id_type:id pair
payload = {identifier_type: identifier}
# i... | StarcoderdataPython |
3234367 | <filename>Chapter11_OpenAI_Gym/taxi/Taxi-v3.py
# There are 4 locations (labeled by different letters) and your job is to pick up the passenger at one location
# and drop him off in another. You receive +20 points for a successful dropoff,
# and lose 1 point for every timestep it takes.
# There is also a 10 point pe... | StarcoderdataPython |
35230 | from demo.components.server import server
from chips.api.api import *
def application(chip):
eth = Component("application.c")
eth(
chip,
inputs = {
"eth_in" : chip.inputs["input_eth_rx"],
"am_in" : chip.inputs["input_radio_am"],
"fm_in" : chip.inputs["input... | StarcoderdataPython |
4824669 | <gh_stars>1-10
import json
from typing import List
from unittest import mock
import boto3
import pandas as pd
import pytest
from moto import mock_s3
from ruamel.yaml import YAML
import great_expectations.exceptions.exceptions as ge_exceptions
from great_expectations import DataContext
from great_expectations.core.bat... | StarcoderdataPython |
187083 | """
Get Cannabis Data for Connecticut
Copyright (c) 2021 Cannlytics
Author: <NAME>
Contact: <<EMAIL>>
Created: 9/16/2021
Updated: 9/18/2021
License: MIT License <https://github.com/cannlytics/cannlytics-ai/blob/main/LICENSE>
Data Sources:
Connecticut Medical Marijuana Brand Registry: https://data.ct.gov/Health-an... | StarcoderdataPython |
3203038 | <gh_stars>100-1000
# Manul - network file
# -------------------------------------
# <NAME> <<EMAIL>> <<EMAIL>>
#
# Copyright 2019 Salesforce.com, inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#... | StarcoderdataPython |
1703688 | <gh_stars>1-10
import os
import subprocess
from collections.abc import Iterable
from io import StringIO
from urllib.parse import urlparse
import pandas as pd
from pdfminer.converter import TextConverter
from pdfminer.layout import LAParams
from pdfminer.pdfinterp import PDFPageInterpreter, PDFResourceManager
from pdfm... | StarcoderdataPython |
46262 | <filename>twisted/plugins/tftp_plugin.py
'''
@author: shylent
'''
from tftp.backend import FilesystemSynchronousBackend
from tftp.protocol import TFTP
from twisted.application import internet
from twisted.application.service import IServiceMaker
from twisted.plugin import IPlugin
from twisted.python import usage
from t... | StarcoderdataPython |
3351151 | import json
from datetime import datetime
from typing import List
from flask_restplus import fields
from controllers.common.models.CommonModels import EntityModel, CommonModels
from controllers.integration.models.DataIntegrationModels import DataIntegrationModels
from infrastructor.IocManager import IocManager
from m... | StarcoderdataPython |
3267912 | list_of_books = []
def add_book():
book_name = str(input("Enter book name to add: "))
list_of_books.append(book_name)
print("Book is successfully added: "+ book_name)
def del_book():
book_name = str(input("Enter book name to delete: "))
is_book_exist = list_of_books.__contains__(book_... | StarcoderdataPython |
4824638 | <gh_stars>10-100
import requests
from mockserver_friendly import request, response, form
from test import MOCK_SERVER_URL, MockServerClientTestCase
class TestFormRequests(MockServerClientTestCase):
def test_form_request(self):
self.client.stub(
request(body=form({
"a": "b",
... | StarcoderdataPython |
39550 | <reponame>tej17584/proyecto3DisenoLenguajes
import pickle
class parserAlejandro():
def __init__(self) -> None:
self.tokensScaneados = "" # los tokens leidos
self.tokensScaneadosV2 = []
self.tokensMapeados = ""
self.lastToken = ""
self.lookAheadToken = ""
self.lee... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.