id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
1858467 | from .staggered_grid import StaggeredGrid, unstack_staggered_tensor
from .grid import CenteredGrid
from phi import math
from phi import geom
def staggered_grid(tensor, name='manta_staggered'):
tensor = tensor[...,::-1] # manta: xyz, phiflow: zyx
assert math.staticshape(tensor)[-1] == math.spatial_rank(tensor... | StarcoderdataPython |
138731 | <gh_stars>100-1000
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Created by: <NAME>
# Email: <EMAIL>
# Copyright (c) 2019
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
"""Calculate Multi-label Loss (Semantic Loss)"""
import torch
from torch.nn.modules.loss ... | StarcoderdataPython |
3513599 | #{
#Driver Code Starts
#Initial Template for Python 3
# } Driver Code Ends
#User function Template for python3
def logical(a,b):
print( a and b) ## do a and b
print(a or b) ## do a or b
print(not a) ## do not a
#{
#Driver Code Starts.
def main():
testcases=int(input()) #testcases
while(test... | StarcoderdataPython |
3510434 | import os
from flask import Flask
from flask_bcrypt import Bcrypt
from flask_sqlalchemy import SQLAlchemy
from application import constants
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + constants.LOCAL_SQLITE_FILENAME
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlche... | StarcoderdataPython |
4863112 | <reponame>zhanghao001122/study
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import json
import xlwt
#from ansible.plugins.callback import CallbackBase
#from ansible.parsing.dataloader import DataLoader
#from ansible.vars.manager import VariableManager
#from ansible.inventory.manager import InventoryManager
#from ansibl... | StarcoderdataPython |
6697505 | <filename>python/database/createDiseases.py<gh_stars>0
from collections import defaultdict
from nertoolkit.geneontology.GeneOntology import GeneOntology
from database.Neo4JInterface import neo4jInterface
from synonymes.Synonym import Synonym
from synonymes.SynonymUtils import handleCommonExcludeWords
from utils.idutil... | StarcoderdataPython |
1630823 | # When you create a new test file, make sure to add it here.
# Simply import the class from your file, and then add that class to the '__all__' array.
from game.test_suite.tests.test_example import TestExample
__all__ = [
'TestExample'
] | StarcoderdataPython |
4939138 | import torch
def train(net, data_loader, parameters, device):
net.to(device=device)
net.train()
optimizer = torch.optim.SGD(
net.parameters(),
lr=parameters.get("lr", 0.0001),
momentum=parameters.get("momentum", 0.0),
weight_decay=parameters.get("weight_decay", 0.0),
)
... | StarcoderdataPython |
111360 | from django.db import models
from django.contrib.auth.models import User
class TerminationRequest(models.Model):
"""
When an employee leaves the organization
remove access to the different services that were previously requested
"""
requester = models.ForeignKey(
User, related_name='reques... | StarcoderdataPython |
6432642 | <reponame>mardukbp/robotframework-lsp<filename>robotframework-interactive/src/robotframework_interactive/ast_utils.py
import sys
from typing import Iterator, Tuple, Any, Union, Generic, TypeVar
import ast as ast_module
T = TypeVar("T")
Y = TypeVar("Y", covariant=True)
class NodeInfo(Generic[Y]):
stack: tuple
... | StarcoderdataPython |
1681814 | """Base Garage Environment API."""
import abc
from dataclasses import dataclass
from typing import Dict
import akro
import numpy as np
# Can't use naive garage import, or Sphinx AutoAPI breaks.
from garage._dtypes import StepType
@dataclass(frozen=True)
class InOutSpec:
"""Describes the input and output spaces... | StarcoderdataPython |
3453254 | <reponame>haribhutanadhu/PaddleViT
# Copyright (c) 2021 PPViT Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.... | StarcoderdataPython |
5155224 | # -*- coding: utf-8 -*-
# This tool reads an MM corpus and creates a cowtop
# feature matrix using LDA.
import argparse
import os.path
import sys
import copy
from gensim import models, corpora
import logging
def main():
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
... | StarcoderdataPython |
4909366 | <filename>jiant/jiant/tasks/lib/cosmosqa.py
import pandas as pd
from dataclasses import dataclass
from jiant.tasks.lib.templates.shared import labels_to_bimap
from jiant.tasks.lib.templates import multiple_choice as mc_template
@dataclass
class Example(mc_template.Example):
@property
def task(self):
... | StarcoderdataPython |
9629467 | <filename>quiz.py<gh_stars>0
import asyncio
import random
import re
import unidecode
import os
import numpy as np
import operator
import discord
class Question:
def __init__(self, question, propositions, proposition_emojis, correct_idx, score):
self.question = question
self.propositions = proposit... | StarcoderdataPython |
371751 | <reponame>idosavion/coursist<filename>academic_helper/urls.py
from django.http import JsonResponse
from django.urls import path, include
from academic_helper.views.basic import IndexView
from academic_helper.views.courses import CoursesView, CourseDetailsView
from academic_helper.views.other import AjaxView, AboutView... | StarcoderdataPython |
1618960 | <filename>elib_wx/avwx/__init__.py
# coding=utf-8
# type: ignore
"""
<NAME> - <EMAIL>
Original source: https://github.com/flyinactor91/AVWX-Engine
Modified by <EMAIL>
"""
# type: ignore
# type: ignore
# stdlib
from datetime import datetime
from os import path
# module
from . import metar, service, speech, structs, su... | StarcoderdataPython |
3541158 | from clearml import Task
from clearml.automation import PipelineController
def pre_execute_cb(a_pipeline, a_node, current_param_override):
# type (PipelineController, PipelineController.Node, dict) -> bool
print('Cloning Task id={} with parameters: {}'.format(a_node.base_task_id, current_param_override))
#... | StarcoderdataPython |
11297400 | from setuptools import setup
with open('README.md', 'r') as fh:
long_description = fh.read()
setup(
name='ingreedypy',
py_modules=['ingreedypy'],
version='1.3.5',
description='ingreedy-py parses recipe ingredient lines into a object',
long_description=long_description,
long_description_co... | StarcoderdataPython |
1782494 | from flask_wtf import FlaskForm
from wtforms import StringField,TextAreaField,SubmitField,RadioField
from wtforms.validators import Required
class PitchForm(FlaskForm):
title = StringField('Pitch title',validators=[Required()])
pitch = TextAreaField('Pitch', validators=[Required()])
category = RadioField(... | StarcoderdataPython |
9743766 | import os, glob
class ImageListCreator(object):
def __init__(self):
pass
# This takes a directory name and looks for jpg images and creates a text file listing those images location.
def make_list_image_filenames(self, image_path):
dir_path = os.path.dirname(os.path.realpath(__file__))
#filename = os.path.jo... | StarcoderdataPython |
9797087 | from wx_pay.unified import WxPayOrderClient # NOQA
from wx_pay.query import WxPayQueryClient # NOQA
| StarcoderdataPython |
5130356 | from chainer_chemistry.iterators.balanced_serial_iterator import BalancedSerialIterator # NOQA
from chainer_chemistry.iterators.index_iterator import IndexIterator # NOQA
| StarcoderdataPython |
49592 | <filename>src/main.py
from utility import util
CONN = util.connectAlpaca()
class algo:
pass
| StarcoderdataPython |
5030179 | <reponame>utyman/tdc-wiretapping<filename>tdc-wiretapping/inf_utils.py
import math
from clint.textui import colored, puts
from os import system, remove
from graphviz import Digraph
import ntpath
def dump_results(filein, symbol_dict, entropy, max_entropy, totalEvents):
file = open('data.dat', 'w+')
i = 0;
m... | StarcoderdataPython |
6623007 | <gh_stars>0
# p36.py
str1 = input().split()
str2 = input().split()
str3 = input().split()
str1 = list(map(int, str1))
str2 = list(map(int, str2))
str3 = list(map(int, str3))
n = str1[0]
k = str1[1]
for i in range(1, k + 1):
if i % 2 != 0:
for j in range(0, n):
if str2[2*j] >= str3[... | StarcoderdataPython |
1979841 | <filename>nbassignment/utils/notebookfilefinder.py
import re
import os
class MarkdownImageFinder:
def __init__(self):
self.__p_inline = re.compile(r'!\[[^\]]*\]\(([^\)]*)\)')
self.__p_html = re.compile(r'<img[^>]*src\s*=\s*("[^"]*"|\'[^\']*\')')
self.__p_alt = re.compile(r'!\[[^\]]*\](... | StarcoderdataPython |
5021354 | <reponame>waikato-datamining/wai-common
from typing import Optional, Tuple
# Datatypes
DATATYPE_STRING = 'S'
DATATYPE_NUMERIC = 'N'
DATATYPE_BOOLEAN = 'B'
DATATYPE_UNKNOWN = 'U'
# Separator between parts of a compound name
SEPARATOR = '\t'
class Field:
"""
Class representing a report field. Has a name and a... | StarcoderdataPython |
3208586 | <filename>src/utils/parse/types.py
import typing
def try_int(s: str) -> typing.Optional[int]:
try:
return int(s)
except ValueError:
return None
| StarcoderdataPython |
8121948 | # Copyright 2021 TUNiB Inc.
class InfiniteDataLoader:
"""
Make dataloader to have infinite iterator
This is copy of ``deepspeed.runtime.dataloader.RepeatingLoader``
"""
def __init__(self, loader):
self.loader = loader
self.data_iter = iter(self.loader)
def __iter__(self):
... | StarcoderdataPython |
1795344 | from django import forms
from django.forms import widgets
from order.models import BillingAddress, ShippingAddress
class ShippingAddressForm(forms.ModelForm):
class Meta:
model = ShippingAddress
fields = [
'user',
'first_name',
'last_name',
'address'... | StarcoderdataPython |
8154071 | import json,re,csv;
#csv
#open('hrmonkeys.csv','w').write('Company Name,Location,Job type,Rating,Job details(time),Job details(price),Qualifications,Closing Date,Full job description,Duties and Responsibilities,Preferred Qualifications\n');
# remote
# base_url
base_url = 'https://www.simplyhired.com'
# list of urls t... | StarcoderdataPython |
3341522 | import unittest
from handlers.QueryHandler import QueryHandler
from collections import namedtuple
cassandraRow = namedtuple('row', ['timestamp', 'name', 'value'])
ANNOTATION_NAME = 'test annotation'
class TestAnnotationsHandler(unittest.TestCase):
rows = [
cassandraRow(timestamp=9876543210, name='oxyg... | StarcoderdataPython |
1682249 | <reponame>JaumVitor/HOMEWORK-PYTHON
dia = int ( input ( 'Quantos dias passou com o carro ? '))
km = float ( input ( 'Quantos km foram rodados ? '))
custo = (dia * 60) + (km * 0.15)
print ( 'Valor do aluguel é de R${}'.format(custo ))
| StarcoderdataPython |
6446331 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 8 12:12:30 2020
@author: Rudra
"""
import os
import glob
import torch
path2logs = os.path.join('..', 'logs', 'ritnet')
strSys = 'RC'
cond = [0, 1, 2]
selfCorr = [0, 1]
opDict = {'state_dict':[], 'epoch': 0}
for i in cond:
for j in selfCorr:
... | StarcoderdataPython |
5014488 | """
Feedback package
Takes in a message an an (optional) email address and sends feedback to
e-mail address specified in settings.py
""" | StarcoderdataPython |
6429573 | <reponame>angrybacon/gitaxian-probability<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# flake8: noqa
"""
The SLATE table contains the corresponding flags to each card that is relevant
to Lands as an archetype.
The FORMS table lists all forms for a Manabond into Marit Lage on the first
turn.
"""
SLATE ... | StarcoderdataPython |
9052 | <filename>fastseg/model/utils.py<gh_stars>100-1000
import torch.nn as nn
from .efficientnet import EfficientNet_B4, EfficientNet_B0
from .mobilenetv3 import MobileNetV3_Large, MobileNetV3_Small
def get_trunk(trunk_name):
"""Retrieve the pretrained network trunk and channel counts"""
if trunk_name == 'efficien... | StarcoderdataPython |
1932898 | def func1(func2):
return func2()
def hello():
return 'Olá, mundo'
print(func1(hello))
def func_mestre(f, *args, **kwargs):
return f(*args, **kwargs)
def fala_oi(nome):
return f'Oi, {nome}'
def fala(saud, nome):
return f'{saud}, {nome}'
print(func_mestre(fala_oi, 'João'))
print(func_mestre(fala, '... | StarcoderdataPython |
19607 | <gh_stars>0
'''
Copyright (C) 2016 The Crown (i.e. Her Majesty the Queen in Right of Canada)
This file is an add-on to RAVE.
RAVE is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the Li... | StarcoderdataPython |
1640124 | <reponame>sikaiyin/easy-VQA-Pytorch<filename>model.py
from __future__ import print_function
import argparse
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.image import load_img, img_to_array
import json
import os
import numpy as np
import torch
import torch.nn as nn
import... | StarcoderdataPython |
366292 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.ExtendParams import ExtendParams
from alipay.aop.api.domain.GoodsDetail import GoodsDetail
from alipay.aop.api.domain.SettleInfo import SettleInfo
from alipay.aop.api.domain.SubMerc... | StarcoderdataPython |
366406 | import string
import numpy
import copy
from domrl.engine.agent import Agent
"""
class Agent(object):
def choose(self, decision, state):
return decision.moves[0]
class StdinAgent(Agent):
def choose(self, decision, state):
# Autoplay
if len(decision.moves) == 1:
return [0]... | StarcoderdataPython |
4929424 | <reponame>pymt-lab/pymt_prms_soil<filename>pymt_prms_soil/__init__.py<gh_stars>0
#! /usr/bin/env python
import pkg_resources
__version__ = pkg_resources.get_distribution("pymt_prms_soil").version
from .bmi import PRMSSoil
__all__ = [
"PRMSSoil",
]
| StarcoderdataPython |
6626851 | <reponame>tbarbette/core<filename>homeassistant/components/brother/const.py<gh_stars>1-10
"""Constants for Brother integration."""
from homeassistant.const import ATTR_ICON, PERCENTAGE
ATTR_BELT_UNIT_REMAINING_LIFE = "belt_unit_remaining_life"
ATTR_BLACK_DRUM_COUNTER = "black_drum_counter"
ATTR_BLACK_DRUM_REMAINING_LI... | StarcoderdataPython |
3210946 | from typing import TYPE_CHECKING, List, Optional
if TYPE_CHECKING:
from projectreport.analyzer.project import Project
from projectreport.analyzer.parsers.base import Parser
import os
from cached_property import cached_property
from projectreport.analyzer.analysis import ModuleAnalysis
from projectreport.ana... | StarcoderdataPython |
240096 | import datetime
from timeit import default_timer as timer
import numpy as np
import pkg_resources
from PyQt5 import uic, QtCore
from matplotlib.backends.backend_qt5agg import (
FigureCanvasQTAgg as FigureCanvas,
NavigationToolbar2QT as NavigationToolbar)
from matplotlib.figure import Figure
from xas.xray impor... | StarcoderdataPython |
6591183 | # -*- coding: utf-8 -*-
"""
local/grade_template.py
Last updated: 2021-03-29
Manage template-specific fields for grade reports.
=+LICENCE=============================
Copyright 2021 <NAME>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with th... | StarcoderdataPython |
9628677 | import subprocess
import sqlite3
import pickle
import copy
from pathlib import Path
from urllib.parse import urlparse
from unittest.mock import MagicMock, Mock
from subprocess import CalledProcessError
import paramiko
import pytest
from ploomber import DAG
from ploomber.tasks import ShellScript
from ploomber.product... | StarcoderdataPython |
6668449 | from __future__ import unicode_literals
import sys
from PyQt4 import QtGui, QtCore
from PyQt4.QtCore import Qt
from PyQt4.QtGui import (QComboBox, QDialog, QTableWidgetItem, QTableWidget, QWizard)
#import lasio.pylasdev.las_reader
import logging
import sqlite3
import totaldepth.PlotLogs
import inout.las.reader.ui.lo... | StarcoderdataPython |
12832716 | # 023
# Ask the user to type in the first line of a nursery rhyme and display
# the length of the string. Ask for a starting number and an
# ending number and then display just that section of the text
# (remember Python starts counting from 0 and not 1).
rhyme = list()
while True:
try:
if not rhyme:
... | StarcoderdataPython |
8079317 | #655. Print Binary Tree
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def printTree(self, root):
if root is None:
return None
def maxDepth(node):
if node is None:
return 0
else:
leftDepth = maxDepth(no... | StarcoderdataPython |
3549879 | <filename>code/convert_to_record.py
import tensorflow as tf
def _int64_feature(value):
return tf.train.Feature(int64_list=tf.train.Int64List(value=[value]))
def _bytes_feature(value):
return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))
def data_to_record(data, label, writer):
h, w, c ... | StarcoderdataPython |
8091255 | import pytest
from matryoshka_tester.helpers import ContainerBuild
@pytest.mark.parametrize(
"dockerfile_build",
(
build.to_pytest_param()
for build in (
ContainerBuild(
name="amidst",
pre_build_steps=(
"git clone -b v4.6 "
... | StarcoderdataPython |
6570318 | <gh_stars>0
"""
Language detection using n-grams
"""
import re
from math import log
from statistics import mean
# 4
def tokenize_by_sentence(text: str) -> tuple:
"""
Splits a text into sentences, sentences into tokens, tokens into letters
Tokens are framed with '_'
:param text: a text
:return: a... | StarcoderdataPython |
1740652 | import argparse
import sys
import numpy as np
import itertools
# visualization libraries
import matplotlib.pyplot as plt
import seaborn as sns
plt.style.use('classic')
import numpy as np
import pandas as pd
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Data Collector for neuron outpu... | StarcoderdataPython |
1946753 | <filename>app.py
import billboard
import spotipy
import os
from spotipy.oauth2 import SpotifyOAuth
from flask import Flask, session, request, redirect, render_template
from flask_session import Session
app = Flask(__name__)
app.config['SECRET_KEY'] = os.urandom(64)
app.config['SESSION_TYPE'] = 'filesystem'
app.config[... | StarcoderdataPython |
3387006 | import math
import json
import pathlib
import argparse
import collections
from functools import partial
from typing import List, Dict, Tuple
import torch
import numpy as np
from tqdm import tqdm
from torch.utils.data import TensorDataset
from torch.functional import Tensor
from transformers.models.bert.tokenization_b... | StarcoderdataPython |
6695429 | <reponame>cu-library/mellyn<filename>agreements/test_forms.py<gh_stars>0
"""
This module defines tests to run against the fields module.
https://docs.djangoproject.com/en/3.0/topics/testing/
"""
from datetime import datetime, timezone
from django.test import TestCase
from .forms import AgreementBaseForm
class Agr... | StarcoderdataPython |
158464 | import unittest
from kbmodpy import kbmod as kb
class test_import(unittest.TestCase):
def setUp(self):
#kb.
pass
def test_something(self):
#self.assertGreater( a , b )
#self.assertEqual( a , b )
pass
| StarcoderdataPython |
20804 | # encoding: utf8
import numpy as np
import pandas as pd
from collections import OrderedDict
from senti_analysis import config
from senti_analysis import constants
from senti_analysis.preprocess import (load_tokenizer, load_sentences,
encode_sentence, label_transform)
def load_... | StarcoderdataPython |
1733354 | <filename>src/utils/models.py
import tensorflow as tf
import os
import logging
def get_VGG_16_model(input_shape, model_path):
model = tf.keras.applications.vgg16.VGG16(
input_shape = input_shape,
weights = "imagenet",
include_top = False
)
model.save(model_path)
logging.info(... | StarcoderdataPython |
5185255 | a = 123
b = 'abc'
print('{} and {}'.format(a, b))
# 123 and abc
print('{first} and {second}'.format(first=a, second=b))
# 123 and abc
print(f'{a} and {b}')
# 123 and abc
print(F'{a} and {b}')
# 123 and abc
print(f"{a} and {b}")
# 123 and abc
print(f'''{a} and {b}''')
# 123 and abc
print(f"""{a} and {b}""")
# 12... | StarcoderdataPython |
250745 | ## CA
from Load_config_GUI import Ui_Load
from Adv_params_GUI import Ui_Adv_Params
class Ui_CA(object):
def load_folder_name(self):
"""
Initializes the 'Load config file' window
Returns
------
string : the loaded filename
"""
self.window = QtWidgets.QWidg... | StarcoderdataPython |
8054637 | from modeltranslation.translator import translator, TranslationOptions
from events.models import Category, EventTemplate
class CategoryTranslationOptions(TranslationOptions):
fields = ('description', 'name',)
class EventTemplateTranslationOptions(TranslationOptions):
fields = ('description', 'name',)
transla... | StarcoderdataPython |
4998187 | <reponame>leonoravesterbacka/excursion<gh_stars>1-10
# test_initialize_excursion.py
import torch
import yaml
from excursion import init_gp, ExcursionSetEstimator
from excursion.utils import load_example
def test_init_excursion():
device = torch.device("cpu")
ninit = 1
algorithmopts = yaml.safe_load(open... | StarcoderdataPython |
3371858 | <gh_stars>10-100
'''
Problem Description
Given an integer array A of size N.
You can pick B elements from either left or right end of the array A to get maximum sum.
Find and return this maximum possible sum.
NOTE: Suppose B = 4 and array A contains 10 elements then
You can pick first four elements or can pick last fou... | StarcoderdataPython |
5052578 | <reponame>sedatozturke/swe-573-2020f
# Generated by Django 3.1.5 on 2021-01-12 16:43
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('explore', '0003_auto_20210112_1931'),
]
operations = [
migrations.RemoveField(
model_name='subreddi... | StarcoderdataPython |
6418929 | <filename>aago_ranking/games/migrations/0001_initial.py<gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-18 00:53
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
class Mig... | StarcoderdataPython |
3516530 | <gh_stars>10-100
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
# Copyright 2019 The BERT-QA Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | StarcoderdataPython |
9730751 | def test_save_known_data():
pass
def test_save_unknown_data():
pass
| StarcoderdataPython |
11362376 | #!/usr/bin/env python
from enum import Enum
class ServerType(Enum):
ZOOKEEPER = 1
KAFKA = 2
SCHEMA_REGISTRY = 3
KAFKA_CONNECT = 4
REPLICATOR = 5
KAFKA_REST = 6
KSQLDB = 7
CONTROL_CENTER = 8
ANY = 9
NONE = 10
| StarcoderdataPython |
1709946 | # -*- coding: utf-8 -*-
"""
mslib.mscolab._tests.test_file_manager
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests for file_manager functionalities
This file is part of mss.
:copyright: Copyright 2020 <NAME>
:copyright: Copyright 2020-2021 by the mss team, see AUTHORS.
:license: APACHE-2.0, s... | StarcoderdataPython |
9780034 | <gh_stars>0
import cv2
import numpy as np
import sys
import requests
import os
import alerts
import datetime
import time
def captures(names):
file1=open("admin_files/logs.txt","a+")
file2=open("admin_files/mobile_no.txt","r")
data=file2.read()
file2.close()
recognizer = cv2.face.LBPHFaceRecogn... | StarcoderdataPython |
4948845 | #!/usr/bin/env python3.4
import requests
from bs4 import BeautifulSoup as BS
import datetime
import io
import nntplib
import time
import urllib.parse
import base64
import random
class Article:
"""
an nntp article
"""
timeFormat = '%a, %d %b %Y %H:%M:%S +0000'
def __init__(self, j, board, site)... | StarcoderdataPython |
1655973 | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 18 14:44:44 2021
@author: <NAME>
"""
from sklearn.metrics import explained_variance_score
from sklearn.metrics import r2_score
from sklearn.metrics import max_error
from sklearn.metrics import accuracy_score
from sklearn.metrics import roc_auc_score
from skle... | StarcoderdataPython |
1989862 | import os
import json
from collections import defaultdict
from bs4 import BeautifulSoup
files = ['test_2.html', 'test_3.html', 'test_4.html', 'test_5.html']
questions = []
answers = defaultdict(list)
question_index = 0
for _file in files:
question_index = len(questions)
with open(_file, 'r') as f:
content = f.re... | StarcoderdataPython |
6638279 | <reponame>phplaboratory/madcore-ai
from __future__ import print_function
import os
import sys
from utils import run_cmd
NAMESPACE = 'spark-cluster'
SPARK_PATH = '/opt/spark'
# TODO@geo validate this
sparks_args = sys.argv[1]
# this can be
app_file_name = sys.argv[2]
app_args = sys.argv[3]
example_subfold = None
if... | StarcoderdataPython |
1796812 | <reponame>kezabelle/django-livereloadish<filename>livereloadish/apps.py
import logging
import os
import pickle
import time
import pathlib
from collections import namedtuple
from datetime import datetime, timezone
from hashlib import sha1
from tempfile import gettempdir
from typing import Dict, Literal, Optional
from a... | StarcoderdataPython |
3492764 | from os import listdir, path
from xml.etree import ElementTree
import numpy as np
from mrcnn.utils import Dataset
class ISRLHumanDatasetManager(Dataset):
def load_dataset(self, dataset_dir, dataset_type="train"):
self.add_class("dataset", 1, "human")
images_dir = dataset_dir + '/color/'
a... | StarcoderdataPython |
5065646 | <gh_stars>1-10
import pandas as pd
from time import time
from math import sqrt
import matplotlib.pyplot as plt
import datetime
import sys
sys.path.insert(0,'APM/BIN/')
# Import real time contingencies assessment
from ST_AM_Contingencies_Analysis import Real_Time_Contingencies as RTC_A
from ST_AM_Contingencie... | StarcoderdataPython |
6533831 | from django import forms
from .models import Lost
from .models import Found
from django.forms import ModelForm
class LostForm(ModelForm):
class Meta:
model = Lost
fields = ['Item_Name','Item_Image','Description','Last_Seen']
class FoundForm(ModelForm):
class Meta:
m... | StarcoderdataPython |
1777125 | <reponame>rockwolf/python
#!/usr/local/bin/python
"""
See LICENSE file for copyright and license details.
"""
from database.databaseaccess import DatabaseAccess
from database.mappings import *
from modules.core_module import CoreModule
from modules.statement import Statement
from modules.function import *
from modu... | StarcoderdataPython |
1614012 | <reponame>fish2000/pilkit<filename>pilkit/utils.py<gh_stars>1-10
import os
import mimetypes
import sys
from io import UnsupportedOperation
from .exceptions import UnknownExtension, UnknownFormat
from .lib import Image, ImageFile, StringIO, string_types
RGBA_TRANSPARENCY_FORMATS = ['PNG']
PALETTE_TRANSPARENCY_FORMATS ... | StarcoderdataPython |
9653792 | <gh_stars>1-10
import pyeccodes.accessors as _
def load(h):
h.alias('localDefinitionNumber', 'grib2LocalSectionNumber')
_.Template('grib2/local.[centreForLocal:l].[grib2LocalSectionNumber:l].def').load(h)
h.add(_.Position('offsetAfterLocalSection'))
| StarcoderdataPython |
11308414 |
"""
A suite of tests to be run on a replicator with the s3g python module. These tests are broken down into several categories:
"""
import os, sys
lib_path = os.path.abspath('../')
sys.path.append(lib_path)
lib_path = os.path.abspath('../s3g/')
sys.path.append(lib_path)
try:
import unittest2 as unittest
except ... | StarcoderdataPython |
5083486 | <reponame>cpieri/api_slack
import requests
from error import *
def list_channel(token):
print ('Your token is: {token}'.format(token=token))
pink = '\033[38;5;206m'
cyan = '\033[36m'
endl = '\033[0m'
channels = requests.get('https://slack.com/api/{type}.list?limit=100&token={t}&types=public_channel,private_channe... | StarcoderdataPython |
3551269 | from adminsortable.admin import SortableTabularInline, NonSortableParentAdmin
from django.contrib import admin
from django.db.models import Count
from simple_history.admin import SimpleHistoryAdmin
from music.models import Pays, Artiste, Style, Label, Playlist, Musique, MusiquePlaylist, Lien, Plateforme, LienPlaylist
... | StarcoderdataPython |
12822064 | import puzzle_1
import puzzle_2
# Read lines from input file and assign them to a list called input
with open("../input.txt", "r") as information:
input = information.readlines()
# Declares variables for each of the puzzles solutions and assigns respective functions to it
# (See puzzle_1 and puzzle_2 python file... | StarcoderdataPython |
3534070 | # Uses Sharded vote counter, to increase vote throughput.
# https://cloud.google.com/appengine/articles/sharding_counters
# Import external modules.
from google.appengine.ext import ndb
import math
# Import app modules.
from configuration import const as conf
from constants import Constants
import logging
import ... | StarcoderdataPython |
6676148 | <reponame>ngvozdiev/ncode
import numpy as np
import matplotlib.pylab as plt
def PlotCDF(x, label):
x = np.sort(x)
y = np.arange(len(x))/float(len(x))
plt.plot(x, y, label=label)
for filename, label in {{files_and_labels}}:
data = np.loadtxt(filename)
PlotCDF(data, label=label)
ax = plt.gca()
for ... | StarcoderdataPython |
8042738 | <gh_stars>0
import argparse
from threading import Thread
from virtualgrid.grid_scheduler import GridScheduler
from virtualgrid.node import Node
from virtualgrid.resource_manager import ResourceManager
from virtualgrid.vector_clock import VectorClock
def start_node(args):
node = Node(args.port, VectorClock(args.p... | StarcoderdataPython |
272711 | <reponame>tagwan/scripts<gh_stars>0
# !/usr/bin/env python
# -*- coding:utf-8 -*-
"""
批量修改文件编码,例如从ansi转为utf-8
"""
import os
import sys
import codecs
import chardet
def get_file_extension(file):
(filepath, filename) = os.path.split(file)
(shortname, extension) = os.path.splitext(filename)
return extension... | StarcoderdataPython |
11281420 | <filename>vagrant/myTourney.py
__author__ = 'erik'
from tournament import *
import math
import random
import decimal
db = connect()
deletePlayers()
deleteMatches()
registerPlayer("Ace")
registerPlayer("Jimmy")
registerPlayer("Phil")
registerPlayer("Sport")
registerPlayer("Ed")
registerPlayer("Lucy")
registerPlayer(... | StarcoderdataPython |
1681481 | #r# ============================================
#r# Resistive voltage divider
#r# ============================================
#r# This example shows the simulation of a simple voltage divider made of resistances
######################################### IMPORT UTILITIES #########################################
i... | StarcoderdataPython |
4877663 | <reponame>ryanpdwyer/jittermodel<gh_stars>1-10
from jittermodel import u
import nose
import functools
from nose.tools import assert_almost_equal, assert_raises
import unittest
def pint_assert_almost_equal(first, second, unit=None, places=None,
msg=None, delta=None):
"""assert_almost_e... | StarcoderdataPython |
3238553 | <gh_stars>1-10
#!/usr/bin/python
#
# Copyright (c) 2021 <NAME>(@techcon65)
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
module: azure_rm_diskencryptionset
ve... | StarcoderdataPython |
6477650 | # -*- coding: utf-8 -*-
"""
@date: 2020/5/23 上午10:16
@file: __init__.py.py
@author: zj
@description:
"""
from .convert_from_ints import ConvertFromInts
from .expand import Expand
from .normalize import Normalize
from .random_sample_crop import RandomSampleCrop
from .resize import Resize
from .random_mirror import Ra... | StarcoderdataPython |
1866616 | """
This is an example to demonstrate how to invoke milvus client APIs asynchronously.
There are partial APIs allowed to be invoked asynchronously, they are: insert(), create_index(),
search(), flush() and compact().
This example is runnable for milvus(0.11.x) and pymilvus(0.4.x)(developing).
"""
import random
from p... | StarcoderdataPython |
9649184 | <filename>utils/tlsInjector.py<gh_stars>100-1000
#!/usr/bin/env python
import pefile, sys, getopt, os, re, random, string, struct
from colorama import Fore, Style
__author__ = "<NAME>"
__mail__ = "<EMAIL>"
__version__ = "1.0"
class colors:
GREEN = '\033[92m'
FAIL = '\033[91m'
BOLD = '\033[1m'
RESET =... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.