id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
3358929 | <reponame>mubasheeer/DatabaseManagement<filename>FinalReport/sourcefiles/app.py
from flask import Flask, redirect, url_for, render_template, request
# from flask_mysqldb import MySQL
from flaskext.mysql import MySQL
# import yaml
app = Flask(__name__)
#to connect db
# database = yaml.full_load(open('data... | StarcoderdataPython |
3224547 | <filename>tests/test_schemadef_plugin.py<gh_stars>1000+
#
# Copyright Contributors to the OpenTimelineIO project
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modific... | StarcoderdataPython |
19631 |
class AxisIndex(): #TODO: read this value from config file
LEFT_RIGHT=0
FORWARD_BACKWARDS=1
ROTATE=2
UP_DOWN=3
class ButtonIndex():
TRIGGER = 0
SIDE_BUTTON = 1
HOVERING = 2
EXIT = 10
class ThresHold():
SENDING_TIME = 0.5 | StarcoderdataPython |
367730 | <reponame>chutien/zpp-mem<gh_stars>1-10
import tensorflow as tf
from neural_network.backward_propagation import BackwardPropagation
from layer.weight_layer.convolutional_layers import ConvolutionalLayer
from layer.weight_layer.fully_connected import FullyConnected
from custom_operations import feedback_alignment_fc, f... | StarcoderdataPython |
4929663 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render
# Create your views here.
def goldPage(request):
return render(request, 'gold.html',{}) | StarcoderdataPython |
4886239 | __copyright__ = "Copyright (c) 2021 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"
import os
import sys
from glob import glob
import click
from jina.flow import Flow
from jina.logging import default_logger as logger
from jina.logging.profile import TimeContext
MAX_DOCS = int(os.environ.get('JINA_M... | StarcoderdataPython |
3438929 | # MINLP written by GAMS Convert at 08/20/20 01:30:53
#
# Equation counts
# Total E G L N X C B
# 628 49 147 432 0 0 0 0
#
# Variable counts
# x b i s1s s2s sc ... | StarcoderdataPython |
6473703 | <reponame>Liambcollins/pycroscopy<filename>pycroscopy/analysis/be_loop_fitter.py
# -*- coding: utf-8 -*-
"""
:class:`~pycroscopy.analysis.be_loop_fitter.BELoopFitter` that fits Simple Harmonic Oscillator model data to a
parametric model to describe hysteretic switching in ferroelectric materials
Created on Thu Aug 25 ... | StarcoderdataPython |
6439842 | <reponame>coffeacloudberry/PhotosManagerCLI
import vcr
from src.photos_manager import WebPUpdater
@vcr.use_cassette("fixtures/vcr_cassettes/repo_list.yaml")
def test_download_repo_list():
all_links = WebPUpdater.download_repo_list()
for symver, url_list in all_links.items():
assert isinstance(symver, ... | StarcoderdataPython |
1878588 | # -*- coding: utf-8 -*
"""Tests for the Azure Application Gateway Access log files parser."""
import unittest
from plaso.parsers.jsonl_plugins import azure_application_gateway_log
from tests.parsers.jsonl_plugins import test_lib
class AzureApplicationGatewayAccessLogJSONLPluginTest(
test_lib.JSONLPluginTestCas... | StarcoderdataPython |
12828217 | <reponame>davidbrochart/python-prompt-toolkit
from __future__ import unicode_literals
import pytest
from prompt_toolkit.document import Document
@pytest.fixture
def document():
return Document(
'line 1\n' +
'line 2\n' +
'line 3\n' +
'line 4\n',
len('line 1\n' + 'lin')
... | StarcoderdataPython |
1648681 | print('1')
input()
| StarcoderdataPython |
137765 | <filename>setup.py
# Copyright 2015 <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | StarcoderdataPython |
141050 | <gh_stars>10-100
from setuptools import setup, Extension
from Cython.Distutils import build_ext
import glob
import numpy as np
sources = ['pysofia/_sofia_ml.pyx'] + glob.glob('pysofia/src/*.cc')
setup(name='pysofia',
version='0.10.dev0',
description='Python bindings for sofia-ml',
long_description=o... | StarcoderdataPython |
4930623 | <filename>lib/evaluation/pic_eval.py<gh_stars>10-100
from functools import reduce
import numpy as np
import sys
def compute_iou(target_mask, query_masks):
N = query_masks.shape[0]
target_masks = np.repeat(target_mask[None], N, axis=0)
target_masks = target_masks.astype(np.int32)
query_masks = query_ma... | StarcoderdataPython |
3240676 | <reponame>shreyasnagare/Brick
import csv
import logging
from collections import defaultdict
from rdflib import Graph, Literal, BNode, URIRef
from rdflib.namespace import XSD
from rdflib.collection import Collection
from bricksrc.ontology import define_ontology
from bricksrc.namespaces import BRICK, RDF, OWL, RDFS, TA... | StarcoderdataPython |
3273118 | #Ref: <NAME>
"""
Colorizing images using traditional means.
While deep learning help swith natural images, for microscopy images we
don't need to get skin tones and sky color correct. So follow easier methods.
"""
#Pillow colorize module to define black and white points. Simplest way.
# importing image object from P... | StarcoderdataPython |
1967261 | import cmd
import re
from covertutils.shells.subshells import SimpleSubShell
try:
raw_input # Python 2
except NameError:
raw_input = input # Python 3
def format_shellcode( unformatted ) :
ready = unformatted
ready = ready.split('=')[-1] # in case shellcode[] = 'blah...'
ready = ready.strip().replac... | StarcoderdataPython |
5090718 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Setup commands for PyGraphviz.
"""
# Copyright (C) 2006-2014 by
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME>, http://www.cs.brown.edu/~er/
# Distributed with BSD license.
# All rights reserved, see LICENSE for details.
#
# Derived fr... | StarcoderdataPython |
1834571 | #!/bin/python
import bit_bootstrappable_decryption
import logging
class BootstrappableDecryption(object):
def __init__(self, short_odd_modulus, log=logging.getLogger(__name__)):
self.__log = log
self.__log.info("Creating BoostrappableDecryption with odd_modulus={odd_mod}".format(odd_mod=short_odd_... | StarcoderdataPython |
339246 | <filename>modal/loss.py
import torch
import torch.nn.functional as F
from torch.autograd import Variable
############################################################
# Loss Functions
############################################################
def compute_rpn_class_loss(rpn_match, rpn_class_logits):
"""RPN anch... | StarcoderdataPython |
8069236 | <gh_stars>1-10
# Generated by Django 4.0.2 on 2022-04-04 04:26
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('posts', '0011_remotelike'),
]
operations = [
migrations.CreateModel(
name='Remot... | StarcoderdataPython |
73236 | """Build and Version class model Managers."""
import logging
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from polymorphic.managers import PolymorphicManager
from readthedocs.core.utils.extend import (
SettingsOverrideObject,
get_override_class,
)
from .constants import... | StarcoderdataPython |
1856281 | <reponame>smarx/ethshardingpoc<gh_stars>10-100
from blocks import Block, Message, SwitchMessage_BecomeAParent, SwitchMessage_ChangeParent, SwitchMessage_Orbit
from config import SHARD_IDS
from config import VALIDATOR_NAMES
from config import VALIDATOR_WEIGHTS, SWITCH_BLOCK_EXTRA
from config import TTL_CONSTANT, TTL_SW... | StarcoderdataPython |
8135734 | # --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME> and <NAME>
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import divi... | StarcoderdataPython |
8119175 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def main():
try:
f = open('myfileimp.txt')
s = f.readline()
i = int(s.strip())
except OSError as err:
print("OS error: {0}".format(err))
except ValueError:
print("Could not convert data to an i... | StarcoderdataPython |
87988 | import unittest
from checkov.common.models.enums import CheckResult
from checkov.terraform.checks.resource.aws.MSKClusterEncryption import check
class TestMSKClusterEncryption(unittest.TestCase):
def test_failure(self):
resource_conf = {
"name": "test-project",
}
scan_result ... | StarcoderdataPython |
5096770 | <filename>src/file_updater.py
#!/usr/bin/env python3
import collections
import datetime
import logging
import pathlib
from typing import Dict, Mapping, Set
from environment import Environment
from file_formatter import Formatter
from playlist_id import PlaylistID
from playlist_types import CumulativePlaylist
from spo... | StarcoderdataPython |
6549521 | <reponame>thinkAmi/ipa_issues_model_by_doc2vec<gh_stars>0
import pathlib
from googleapiclient.http import MediaFileUpload
from google_drive_utils import (
create_directory, get_directory_id, get_google_drive_service
)
# pdfをGoogle DocsにすることでOCRしてくれる
# MIME typeは以下にある
# https://developers.google.com/drive/v3/web/... | StarcoderdataPython |
8043045 | <reponame>wrenger/schiller-lib
import re
import csv
from pathlib import Path
from jproperties import Properties
file_re = re.compile("translations_(\\w+).properties")
languages = dict()
for file in Path(".").glob("translations_*.properties"):
search = file_re.match(str(file))
if search:
lang = search... | StarcoderdataPython |
1772891 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import CrossEntropyLoss, BCELoss
from transformers.models.bert.modeling_bert import BertModel
from transformers.models.bert.modeling_bert import BertPreTrainedModel
from transformers.models.roberta.modeling_roberta import RobertaModel
from... | StarcoderdataPython |
340066 | <filename>optimizer.py
# --------------------------------------------------------
# Swin Transformer
# Copyright (c) 2021 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>
# --------------------------------------------------------
from torch import optim as optim
def build_opti... | StarcoderdataPython |
11376975 | <reponame>laulysta/nmt_transformer<filename>transformer/Layers.py
''' Define the Layers '''
import torch.nn as nn
from transformer.SubLayers import MultiHeadAttention, PositionwiseFeedForward
__author__ = "<NAME>"
class EncoderLayer(nn.Module):
''' Compose with two layers '''
def __init__(self, d_model, d_in... | StarcoderdataPython |
1838504 | <reponame>marcosgabarda/cookiecutter-backend<filename>{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/emails/urls.py
from django.urls import path
from {{ cookiecutter.project_slug }}.emails.views import PreviewEmailView
app_name = 'emails'
urlpatterns = [
path('previews/', PreviewEmailView.as_view(), ... | StarcoderdataPython |
11269966 | <filename>pydata/vtuhandler.py<gh_stars>0
"""
Module for .VTU files
.VTU files are VTK files with XML syntax containing vtkUnstructuredGrid.
Further information related with the file format available at url:
https://www.vtk.org/VTK/img/file-formats.pdf
"""
from vtk import vtkXMLUnstructuredGridRea... | StarcoderdataPython |
245980 | <filename>polling_stations/apps/data_collection/management/commands/import_west_suffolk.py
from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = "E07000245"
addresses_name = "parl.2019-12-12/Version 2/Democracy club w... | StarcoderdataPython |
45257 | import requests
import requests.exceptions
import requests_mock
from tieronepointfive.enums import State, Transition
from tieronepointfive.state_machine import StateMachineTick
from tieronepointfive.evaluation_helpers import HttpHelper
from ..mock_config import MockConfig
google = 'https://www.google.com'
b... | StarcoderdataPython |
1865391 | <gh_stars>0
# Generated by Django 3.2.9 on 2021-11-14 09:57
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Articles',
fie... | StarcoderdataPython |
5132253 | <gh_stars>0
#!/usr/bin/python
"""
Program: .py
Rev: 1.0.0
Author: <NAME>
Date:
Developed on Python 2.7.10
"""
import os
import re
import sys
import time
from pymongo import MongoClient
import requests
import logging
from flask import json
from flask import Flask
import paho.mqtt.client as mqtt
#mqtt info - ADD A PUBL... | StarcoderdataPython |
9738410 | """
15N Pure In-phase CPMG
======================
Analyzes 15N chemical exchange in the presence of high power 1H CW decoupling
during the CPMG block. This keeps the spin system purely in-phase throughout,
and is calculated using the (3n)×(3n), single-spin matrix, where n is the
number of states::
{ Ix(a), Iy(a),... | StarcoderdataPython |
1889087 | load("@org_pubref_rules_protobuf//protobuf:rules.bzl", "proto_repositories")
load("@org_pubref_rules_protobuf//cpp:rules.bzl", "cpp_proto_repositories")
load("@org_pubref_rules_protobuf//python:rules.bzl", "py_proto_repositories")
def p4runtime_proto_repositories():
""" Load proto repositories through org_pubref_r... | StarcoderdataPython |
9705436 | <filename>testsubnet.py
import unittest
import subnets
class TestSubnets(unittest.TestCase):
def test_isMask(self):
testString = "255.255.255."
for i in range(256, 5000, 1):
self.assertFalse(subnets.isMask(testString + f"{i}"))
for i in range(-5000, -1, 1):
... | StarcoderdataPython |
12865004 | <reponame>Josh-repository/Dashboard-CityManager-
import requests
import json
from ..Config.config_handler import read_config
class ProcessBusDelays:
def __init__(self):
self.config_vals = read_config("Bus_API")
# Get the live data of Buses(Arrival Time, Departure Time, Delay) from API and returns... | StarcoderdataPython |
98009 | <filename>cardea/primitives/processing/__init__.py
# -*- coding: utf-8 -*-
from cardea.primitives.processing.categorizer import Categorizer
from cardea.primitives.processing.imputer import Imputer
from cardea.primitives.processing.one_hot_encoder import OneHotEncoder
from cardea.primitives.processing.pruner import Pru... | StarcoderdataPython |
1614816 | #<NAME>
#OCTOBER 15, 2021
#LESSON #2
#QUESTION #1
"""
import turtle
world = turtle.Screen()
world.setup(width=400, height=400)
world.setworldcoordinates(0, 0, 400, 400)
world.bgcolor('white')
tula = turtle.Turtle()
tula.color('black')
tula.begin_fill()
tula.setheading(90)
tula.forward(200)
tula.right(90)
tula.forward... | StarcoderdataPython |
9676752 | import torch.nn as nn
import torch.nn.functional as F
import torch
__all__ = ['SharedTransformer']
class SharedTransformer(nn.Module):
def __init__(self, in_channels, out_channels, dim=1):
super().__init__()
self.conv1 = nn.Conv1d(in_channels,out_channels, kernel_size=1, bias=False)
... | StarcoderdataPython |
352150 | """
Courses application admin
"""
from django.contrib import admin
from cms.extensions import PageExtensionAdmin
from .models import Course, Organization
class CourseAdmin(PageExtensionAdmin):
"""Admin class for the Course model"""
list_display = ["title", "organization_main", "active_session"]
# pyli... | StarcoderdataPython |
8019364 |
__author__ = "Radical.Utils Development Team (<NAME>)"
__copyright__ = "Copyright 2013, RADICAL@Rutgers"
__license__ = "MIT"
import sys
import threading
import traceback
import misc as rumisc
_out_lock = threading.RLock ()
# ------------------------------------------------------------------------------
#
... | StarcoderdataPython |
4880571 | #!/usr/bin/python3
import time
import subprocess, sys, os, mmap, ctypes, struct
class quadshared(ctypes.Structure):
_fields_ = [
("state", ctypes.c_int),
("qcount", ctypes.c_int),
("quadsApos", ctypes.c_int),
("quadsAskip", ctypes.c_uint),
("quadsBpos", ctypes.c... | StarcoderdataPython |
363638 | <reponame>wassafshahzad/ani-cli-py<gh_stars>0
from dataclasses import dataclass, field
from typing import List, Type
from bs4.element import Tag
@dataclass
class Page:
previous_page: Type[Tag] = None
next_page: Type[Tag] = None
obj: List[Type[Tag]] = field(default_factory=list)
| StarcoderdataPython |
120953 | <filename>hard-gists/795180/snippet.py
from scrapy.spider import BaseSpider
# Requires this patch:
# https://github.com/joehillen/scrapy/commit/6301adcfe9933b91b3918a93387e669165a215c9
from scrapy.selector import PyQuerySelector
class DmozSpiderPyQuery(BaseSpider):
name = "pyquery"
allowed_domains = ["dmoz.or... | StarcoderdataPython |
6438193 | <filename>qiskit/aqua/_discover.py
# -*- coding: utf-8 -*-
# Copyright 2018 IBM.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | StarcoderdataPython |
3366721 | <gh_stars>1-10
# Copyright 2022 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | StarcoderdataPython |
11371773 | <filename>requests_f5auth/utils.py
# -*- coding: utf-8 -*-
import logging
import requests
from .exceptions import F5AuthenticationError, F5TokenExchangeError
log = logging.getLogger(__name__)
EXCHANGE_PATH = '/mgmt/shared/authn/exchange'
LOGIN_PATH = '/mgmt/shared/authn/login'
def f5_exchange_token(host, refresh_t... | StarcoderdataPython |
3504762 | <filename>venv/lib/python3.8/site-packages/azureml/_restclient/models/quantiles.py
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# licen... | StarcoderdataPython |
9702585 | #from pipeline4lstm.Source.py import Source
#from pipeline4lstm.Data.py import Data
#from pipeline4lstm.Visualize.py import Visualize
| StarcoderdataPython |
11293625 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Simulate the Monty Hall problem to prove that it's always best to switch.
-- BEGIN LICENSE --
MIT License
Copyright (c) 2016 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the ... | StarcoderdataPython |
3355785 | <reponame>arw12625/tulip-control<filename>examples/stutter/linear_stutter_control.py
# !/usr/bin/env python
'''An example of using the stutter abstraction control lifting algorithm to control a linear system'''
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import matplotlib.lines as mlines
i... | StarcoderdataPython |
254913 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
from PIL import Image
import math
import yaml
from hexahue_map import HexahueMap
def hexahue_decode(img, settings):
hexahue_map = HexahueMap('all')
padding = settings['image']['padding']
width, height = img.size
decoded = ''
for hi in range((height-paddin... | StarcoderdataPython |
5062579 | <filename>python/test_2020_14_2.py
import importlib
import unittest
solver = importlib.import_module('2020_14_2')
class Test2020Day14Part1(unittest.TestCase):
def test_example1(self):
input = (
'mask = 000000000000000000000000000000X1001X\n'
'mem[42] = 100\n'
'mask = 0000000000000000000... | StarcoderdataPython |
1646482 | import logging
import re
import utils.data_format_keys as dfk
from evaluation.evaluation_utils import doi_normalize
from random import random
from utils.cr_utils import search, generate_unstructured
from time import sleep
class Matcher:
def __init__(self, min_score, excluded_dois=[], journal_file=None):
... | StarcoderdataPython |
8057184 | <reponame>hodossy/pandas-extras
"""
Contains functions to help transform columns data containing complex types,
like lists or dictionaries.
"""
from functools import reduce
from itertools import zip_longest
import numpy as np
import pandas as pd
def extract_dictionary(dataframe, column, key_list=N... | StarcoderdataPython |
1990025 | from typing import List
def decode(s: str) -> str:
sb: List[str] = []
i = 0
while i < len(s):
next_idx = i
while next_idx < len(s) and '0' <= s[next_idx] <= '9':
next_idx += 1
try:
count = int(s[i:next_idx])
except ValueError:
count = 1
... | StarcoderdataPython |
5121948 | all = ['spongemock'] | StarcoderdataPython |
8179368 | <gh_stars>1-10
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
plt.style.use('seaborn-white')
#%matplotlib inline
from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model import LinearRegression
from sklearn.pipeline import Pipeline, make_pipeline
from sklearn.model_selecti... | StarcoderdataPython |
11278941 |
# fail:?
#from . import client
#import .client
#from .client import *
import client
r = client.json_input()
print(r.text)
print(r.json())
| StarcoderdataPython |
8175864 | n, m = map(int, input().split())
a = []
for i in range(n):
a.append(list(map(int, input().split())))
mx = 100003
arr = [True for i in range(mx+1)]
arr[0] = False
arr[1] = False
arr[2] = True
def generatePrimes(mx):
for i in range(2, mx+1):
if not arr[i]:
continue
else :
... | StarcoderdataPython |
5170546 | <gh_stars>0
# Generated by Django 2.2 on 2020-07-22 13:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0003_auto_20200716_0224'),
]
operations = [
migrations.AlterModelOptions(
name='article',
options=... | StarcoderdataPython |
3335820 | <filename>fake-pw-dump-gen.py
#!/usr/bin/python
import time
import gzip
import argparse
import numpy
import random
import sys
from faker import Faker
def gen_pw(pass_type):
password = ''
if pass_type == 'weak':
password = random.choice(lines).decode('utf-8').rstrip()
if pass_type == 'strong':
... | StarcoderdataPython |
11237411 | from ddcz.models.used.social import Market
from hashlib import md5
import logging
from smtplib import SMTPException
from django.apps import apps
from django.conf import settings
from django.core.paginator import Paginator
from django.http import (
HttpResponseRedirect,
HttpResponsePermanentRedirect,
HttpRe... | StarcoderdataPython |
9749143 | <reponame>deanearlwright/AdventOfCode<filename>2016/17_TwoStepsForward/test_doors.py
# ======================================================================
# Two Steps Forward
# Advent of Code 2016 Day 17 -- <NAME> -- https://adventofcode.com
#
# Python implementation by Dr. <NAME> III
# ===========================... | StarcoderdataPython |
11393526 | import boto3
import json
import re
ml_bucket = 'aml-an-intro'
batch_data_location = 'batch-prediction-upload/adultincomebatch1.csv'
schema_data_location = 'batch-prediction-upload/adultincomebatchschema.json'
# load data
s3 = boto3.resource('s3')
with open('adulttotest.csv', 'r') as data:
s3.Bucket(ml_bucket).put_... | StarcoderdataPython |
1901076 | <filename>src/opnsense/scripts/filter/list_states.py<gh_stars>0
#!/usr/local/bin/python3
"""
Copyright (c) 2015 <NAME> <<EMAIL>>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. R... | StarcoderdataPython |
9739596 | from xbrl.common.period import DateTimeUnion
import unittest
class DateTimeUnionTestsUnitStringTests(unittest.TestCase):
def test_datetimeunion(self):
datetimes = (
"2020-01-01T10:00:00Z",
"2020-01-01T10:00:00+10:00",
"2020-01-01T10:00:00.000+10:00",
"2020... | StarcoderdataPython |
9601658 | # pdf.py
import os.path as osp
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import astropy.units as au
import astropy.constants as ac
import pandas as pd
from mpl_toolkits.axes_grid1 import ImageGrid
from ..plt_tools.cmap import cmap_apply_alpha
from ..util.scp_to_pc import scp_to_pc
f... | StarcoderdataPython |
3379420 | import unittest
import logging
import numpy as np
import pandas as pd
import diffxpy.api as de
class _TestSingleFullRank(unittest.TestCase):
def _test_single_full_rank(self):
"""
Test if de.wald() generates a uniform p-value distribution
if it is given data simulated based on the null mo... | StarcoderdataPython |
231125 | <reponame>nestauk/sg_covid_impact
# %%
import logging
from pathlib import Path
from json import dumps
from sg_covid_impact import config
from sg_covid_impact.utils.metaflow import update_model_config, execute_flow
logger = logging.getLogger(__name__)
if __name__ == "__main__":
nomis_config = config["flows"]["no... | StarcoderdataPython |
5151327 | <filename>tests/components/homekit_controller/specific_devices/test_hue_bridge.py
"""Tests for handling accessories on a Hue bridge via HomeKit."""
from tests.common import assert_lists_same, async_get_device_automations
from tests.components.homekit_controller.common import (
Helper,
setup_accessories_from_fi... | StarcoderdataPython |
6528325 | <filename>src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py
r"""
Hyperelliptic curves over a finite field
EXAMPLES::
sage: K.<a> = GF(9, 'a')
sage: x = polygen(K)
sage: C = HyperellipticCurve(x^7 - x^5 - 2, x^2 + a)
sage: C._points_fast_sqrt()
[(0 : 1 : 0), (a + 1 : a : 1), (a + ... | StarcoderdataPython |
8074713 | """A simple jupyter config file for testing the spawner."""
import docker
import stat
c = get_config()
c.JupyterHub.spawner_class = 'cassinyspawner.SwarmSpawner'
c.JupyterHub.hub_ip = '0.0.0.0'
# The name of the service that's running the hub
c.SwarmSpawner.jupyterhub_service_name = "jupyterhub"
# The name of the ... | StarcoderdataPython |
262863 | from django.core.management.base import BaseCommand, CommandError
from complaints.models import Comments
class Command(BaseCommand):
help = 'Deletes all user comments'
def handle(self, *args, **options):
try:
comments = Comments.objects.all()
for comment in comments:
... | StarcoderdataPython |
8166427 | <reponame>rhoai/flask-rho-keycloak
import pytest
from httmock import response
from flask_rho_keycloak.exceptions import KeyCloakError, raise_error_from_response
class TestExceptions:
def test_no_error_from_response(self):
headers = {'content-type': 'application/json'}
content = b'response_ok'
... | StarcoderdataPython |
234408 | from tkinter import *
from tkinter import messagebox
def popup():
# messagebox.showinfo showwarning showerror askquestion askokcancel askyesno
resposta = messagebox.askquestion("Este é meu popup", "<NAME>")
Label(root, text=resposta).pack()
"""if resposta == 1:
Label(root, text="Você clicou e... | StarcoderdataPython |
5117498 | <gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 23 22:41:50 2019
@author: r17935avinash
"""
import argparse
import config
from Disc_train import main as D_train
from Gen_RL_Train import main as G_train
import torch
import random
import numpy as np
import pykp
def process_opt(... | StarcoderdataPython |
8123939 | '''
Tools for computing topological features in Riemannian space.
Code taken from https://morphomatics.github.io/,
created by <NAME> and <NAME> and <NAME>, 2021.
'''
import numpy as np
import numpy.random as rnd
import numpy.linalg as la
from scipy.linalg import logm, expm_frechet
from pymanopt.manifolds.manifold i... | StarcoderdataPython |
1714161 | import anki_vector
from anki_vector.events import Events
import cv2 as cv
import numpy as np
import time
import math
# Constants
Debug = False
# milliseconds per main loop execution
MainLoopDelay = 20
HeadTilt = anki_vector.robot.MIN_HEAD_ANGLE + anki_vector.util.degrees(5.0)
LiftHeight = 0.0
class Camera:
FovH =... | StarcoderdataPython |
9792027 | from django.shortcuts import render,redirect,render_to_response
from django.core.paginator import Paginator
from django.views.generic import TemplateView,ListView
from django.views import View
from django.urls import reverse_lazy
from services.utils import get_content
from data.models import ProxmoxData,ZabbixDB
from ... | StarcoderdataPython |
8026451 | from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django.utils.safestring import mark_safe
class SearchForm(forms.Form):
query=forms.CharField(label='Search',max_length=100)
class SignUpForm(UserCreationForm):
username=forms.CharF... | StarcoderdataPython |
9695010 | import JustIRC
import requests
import json
import time
import threading
import random
def get_date_time():
return time.strftime("[%d-%m-%Y %H:%M]")
bot = JustIRC.IRCConnection()
with open("config.json") as config_file:
config = json.loads(config_file.read())
bot.streams = []
bot.recordings = []
bot.upcoming... | StarcoderdataPython |
8015458 | <reponame>sergio-asenjo/youtube-live-chat-logger
import os
from googleapiclient.discovery import build
yt = build('youtube', 'v3', developerKey=os.environ.get("YOUTUBE_KEY"))
def getLive(channel_id):
live_request = yt.search().list(
part='snippet',
channelId=channel_id,
eventType='live',
... | StarcoderdataPython |
5160517 | <gh_stars>0
def exibe_matriz(mat):
''' Exibe a matriz na tela, reservando 15 espaços para cada valor '''
for i in range(len(mat)): # Percorre todas as linhas da matriz
for j in range(len(mat[i])): # Percorre todas as colunas
print(f'{mat[i][j]:15}', end='')
print()
# Apresentação
p... | StarcoderdataPython |
6491507 | <reponame>rtu715/NAS-Bench-360
from tensorflow.keras.layers import Layer
import tensorflow as tf
from tensorflow.keras import backend as K
from . import types
from typeguard import typechecked
from typing import Optional
class Mish(Layer):
'''
Mish Activation Function.
.. math::
mish(x) = x * tan... | StarcoderdataPython |
5022882 | #!bin/python
print("Inició python")
import numpy as np
import matplotlib.pyplot as plt
X=np.loadtxt("datos.txt",delimiter=',')
print("Datos cargados..")
Y=[]
Z=[]
for i in range(len(X)):
Y.append(X[i][0])
Z.append(X[i][1])
print(X)
plt.scatter(Y,Z)
plt.xlabel("TIEMPO")
plt.ylabel("DISTANCIA VERTICAL")
plt.sav... | StarcoderdataPython |
5121238 | <filename>src/scanner/scanner_update_V01.py
# -*- coding: utf-8 -*-
import sys, os
import pandas as pd
import openpyxl
from openpyxl.styles import PatternFill
import numpy as np
from collections import defaultdict
from scanner_map import searchKey, CertifiedManufacturerModelNameCTDict, CertifiedManufacturerCTDict, Tru... | StarcoderdataPython |
3547873 | <reponame>MidgeOnGithub/discord-bot
from typing import Union
from copy import copy
import discord
from discord.ext import commands
from src.utils import checks
class Admin(commands.Cog):
"""Admin-only actions for core bot functionalities and features."""
def __init__(self, bot):
self.b... | StarcoderdataPython |
5047202 | <filename>spectral_clustering.py
import numpy as np
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
from sklearn.datasets import make_blobs
from sklearn.metrics.pairwise import pairwise_distances
import scipy
#Landmark based representation algorithm from https://int8.io/large-scale-spectral-clusteri... | StarcoderdataPython |
1765741 | <filename>scripts/spack/packages/py-pyb11generator/package.py
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyPyb11generator(PythonPackage):... | StarcoderdataPython |
3373515 | import numpy as np
from scipy.stats import rankdata
from sklearn.base import BaseEstimator, TransformerMixin
from julia import Julia
Julia(compiled_modules=False)
from julia import Relief as Relief_jl
class MultiSURFStar(BaseEstimator, TransformerMixin):
"""sklearn compatible implementation of the MultiSURFStar ... | StarcoderdataPython |
5015319 | import cv2
import torch
from torch.autograd import Variable
def load_image(path):
"""
:param path:
:return: image in RGB format
"""
img = cv2.imread(str(path))
return cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
def cuda(x):
return x.cuda() if torch.cuda.is_available else x
def variable(x, vo... | StarcoderdataPython |
1697496 | <filename>src/compas_ghpython/install.py<gh_stars>1-10
import compas.plugins
@compas.plugins.plugin(category='install')
def installable_rhino_packages(category='install'):
return ['compas_ghpython']
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.