id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
1794471 | from django.shortcuts import render
from django.contrib.auth.hashers import make_password, check_password
from django.http import HttpResponse
from django.http import request
from pinfo import models
def register(request):
if request.method == 'POST':
username = request.POST.get('username')
email ... | StarcoderdataPython |
3332321 | <reponame>nakul-shahdadpuri/Minor_Project
from typing import Tuple
from qiskit import QuantumCircuit, QuantumRegister, CompositeGate
import hhl4x4.custom_gates.comment
QubitType = Tuple[QuantumRegister, int]
class CRZZGate(CompositeGate):
def __init__(self, theta: float, ctrl: QubitType, target: QubitType,
... | StarcoderdataPython |
1606702 | <filename>tests/test_alpha_casenumber.py<gh_stars>1-10
import oscn
def dont_test_request_withalpha():
case_params = {"number": "181A", "county": "pittsburg", "year": "2003"}
case = oscn.request.Case(**case_params)
assert case.valid
assert case.county == "pittsburg"
assert case.type == "F"
as... | StarcoderdataPython |
75081 | """This module contains the process that generates our regression test battery."""
import os
import json
import argparse
import numpy as np
from soepy.python.simulate.simulate_python import simulate
from soepy.python.soepy_config import TEST_RESOURCES_DIR
from soepy.test.random_init import random_init
from soepy.test... | StarcoderdataPython |
1779711 | #!/usr/bin/env python3
with open("imgTest0.pgm", 'wb') as file:
file.write(b'P5\n')
file.write(b'324 244\n')
file.write(b'255\n')
for i in range(0, 324*244):
file.write((i & 0x7f).to_bytes(1, byteorder='big'))
with open("imgTest1.pgm", 'wb') as file:
file.write(b'P5\n')
file.write(b'32... | StarcoderdataPython |
99050 | <reponame>rishad-sayone/dpu-utils
import binascii
import gzip
import json
import os
import glob
import fnmatch
import zlib
import io
import pickle
import codecs
import tempfile
import re
from abc import ABC, abstractmethod
from collections import OrderedDict
from functools import total_ordering
from ty... | StarcoderdataPython |
117578 | <reponame>rob-blackbourn/bareasgi
"""Websocket errors"""
class WebSocketInternalError(Exception):
"""Exception raised for a WebSocket internal error"""
| StarcoderdataPython |
177190 | #!/usr/bin/python
"""Base class for all FAUCET unit tests."""
import json
import os
import re
import shutil
import tempfile
import time
import unittest
import yaml
import ipaddr
import requests
from mininet.node import Controller
from mininet.node import Host
from mininet.node import OVSSwitch
from mininet.topo imp... | StarcoderdataPython |
3278019 | from terrain import BLOCKS_NOTHING, BLOCKS_FIRE, Terrain
from coords import Coords
from entites import Player
# los/raycasting
def old_betterLOS(gl, playerEntity, pointToLookAt):
"""gl = a Level object
playerEntity = a Player object
pointToLookAt = a Coords"""
def setVisibile(cx, cy):
# try:
... | StarcoderdataPython |
186646 | <reponame>sandromello/themis-py<filename>setup.py
#!/usr/bin/env python
#from distutils.core import setup
from setuptools import setup
packages = {
'themis_core_package' : {
'name' : 'themis-core',
'version' : '0.1.4',
'author' : '<NAME>',
'author_email' : '<EMAIL>',
'url' : 'https://gi... | StarcoderdataPython |
1788210 | <reponame>SpyrosD3v25/aviato_whistle
"""
This file is responsible for sending mms to the number phone_num parameter passed in here.
"""
import os
from twilio.rest import Client
class Send:
def __init__(self, category, img_path, phone_num):
self.category = category
self.img_path = img_path
... | StarcoderdataPython |
1631834 | """
Some constants used throughout the project
"""
EARTH_RADIUS_METERS = 6371.0087714150598 * 1000 # Earth radius in meters
MIN_LAT = -90 # min value of latitude
MAX_LAT = 90 # min value of longitude
MIN_LON = -180 # max value of latitude
MAX_LON = 190 # max value of longitude
LOS_ANGELES_MAX_LAT = 34.342324... | StarcoderdataPython |
156414 | #!/usr/bin/env python
# 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
#
# Authors:
# - <NAME>, <EMAIL>, 2018-2021
def allow_memory_usage_verificat... | StarcoderdataPython |
4837662 | <filename>plugins/jobs/girder_jobs/models/job.py
# -*- coding: utf-8 -*-
import datetime
from bson import json_util
from girder import events
from girder.constants import AccessType, SortDir
from girder.exceptions import ValidationException
from girder.models.model_base import AccessControlledModel
from girder.models.... | StarcoderdataPython |
1687314 | <filename>coalescent/scripts/calc_rho.py
#!/usr/bin/env python3
import numpy as np
from scipy import stats
from scipy.spatial.distance import hamming
from skbio import TreeNode, DistanceMatrix, TabularMSA, DNA
from docopt import docopt
import re
def sample_matrix_to_runs(dist, reps=3):
'''Repeats a distance matr... | StarcoderdataPython |
3244703 | <filename>wukong/tools/python/remove_node.py
import sys, os
tools = os.path.join(os.path.dirname(__file__), "..")
wukong = os.path.join(tools, "..")
master = os.path.join(wukong, "master")
sys.path.append(os.path.abspath(master))
wkpf = os.path.join(master, "wkpf")
sys.path.append(os.path.abspath(wkpf))
# print sys.pat... | StarcoderdataPython |
3502 | <filename>contacts/urls.py
from django.urls import path
from contacts.views import (
ContactsListView, CreateContactView, ContactDetailView,
UpdateContactView, RemoveContactView,
GetContactsView, AddCommentView, UpdateCommentView,
DeleteCommentView, AddAttachmentsView, DeleteAttachmentsView)
app_name =... | StarcoderdataPython |
72826 | # This file helps in imorting the functions.
from Crop import crop
from Resize import resize
from writeImage import writeImage
from readImage import readImage | StarcoderdataPython |
3326117 | <filename>projects/airbnb santa clara/pull_addresses.py
import pandas as pd
import requests
import matplotlib.pyplot as plt
G_API = '#ADD GOOGLE API KEY'
# reading csv file
def filter_dataframe(df, column_name, value):
return df.loc[df[column_name] == value]
def get_address(lat, long):
URL = 'https://maps.... | StarcoderdataPython |
3384851 | <reponame>phanirepo/azure-sql-data-project<gh_stars>10-100
import pyodbc
import unittest
from unittest import TestCase
from configparser import ConfigParser
from azure.mgmt.sql import SqlManagementClient
from azure.common.credentials import ServicePrincipalCredentials
from azure_data_pipeline.client import AzureSQLCl... | StarcoderdataPython |
3276510 | from django.contrib import admin
from django.urls import path
from django.shortcuts import HttpResponseRedirect
from .constants import MEMBER_NAMES
from .models import Member
from .models import Member
class MemberAdmin(admin.ModelAdmin):
change_list_template = 'mainapp/admin_member_changelist.html'
list_disp... | StarcoderdataPython |
3369365 | <gh_stars>0
import os
"""Default configuration
Use env var to override
"""
DEBUG = True
SECRET_KEY = "changeme"
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or "sqlite:////tmp/myapi.db"
SQLALCHEMY_TRACK_MODIFICATIONS = False
JWT_BLACKLIST_ENABLED = True
JWT_BLACKLIST_TOKEN_CHECKS = ['access', 'refresh']
... | StarcoderdataPython |
4807482 | <filename>src/function_approximation/IPL/plot_results.py<gh_stars>0
import numpy as np
from matplotlib import pyplot as plt
plt.rc('text', usetex=True)
plt.rcParams.update({'font.size': 20})
fig = plt.figure(figsize=(8, 6))
ax = fig.gca()
Ns = (2 ** np.arange(7, 13)).tolist()
Ns2 = (2 ** np.arange(6, 13)).tolist()
ga... | StarcoderdataPython |
1681651 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.utils import softmax
from toolbox.nn.Highway import Highway
class GraphEncoder(nn.Module):
def __init__(self, entity_dim, relation_dim):
super(GraphEncoder, self).__init__()
self.a_i = nn.Linear(entity_dim, 1,... | StarcoderdataPython |
3316607 | <filename>preprocess.py
import os
import re
import copy
import json
import tqdm
import emoji
import sklearn
import pandas as pd
from string import ascii_letters, digits
from nltk.tokenize.punkt import PunktSentenceTokenizer
def lower(text):
return text.lower()
def strip(text):
return text.strip()
def fi... | StarcoderdataPython |
133686 | import numpy as np
from unittest import SkipTest, expectedFailure
from parameterized import parameterized
from holoviews import NdOverlay, Store
from holoviews.element import Curve, Area, Scatter, Points, Path, HeatMap
from holoviews.element.comparison import ComparisonTestCase
from ..util import is_dask
class Tes... | StarcoderdataPython |
1608984 | from flask import Flask, request, make_response
import json
import platform
import sys
import hmac
import hashlib
from time import time
from .version import __version__
class SlackServer(Flask):
def __init__(self, signing_secret, events_endpoint, interactive_endpoint, emitter, server):
self.signing_secret... | StarcoderdataPython |
1686110 | # Copyright 2019-2020 SURF.
# 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, soft... | StarcoderdataPython |
1772177 | """Routing module provides functionality to configure routes and responses."""
from __future__ import annotations
import json
import random
import time
from typing import Any, Dict, List, Optional, Type, TypeVar, Union
import flask
from trickster import TricksterException
class RouteConfigurationError(TricksterEx... | StarcoderdataPython |
3319104 | <filename>hieronymus/hieronymus.py
#! /usr/bin/env python
# TODO:
# * config yaml
# * move utils to separate module
# * color list mapping name: rgb
# * output to ELK/influx
# * close-up render top, body, base
# * configurable resolutions (or based on staff length?)
# * redis cache
# * remove defaults to allow individ... | StarcoderdataPython |
3233749 | <gh_stars>1-10
from setuptools import setup
setup(
use_scm_version=True,
setup_requires=['setuptools_scm'],
include_package_data=True,
packages=['pynamelix'],
install_requires=[
'requests',
'check-pypi-name',
],
entry_points={
'console_scripts': [
'pyn... | StarcoderdataPython |
123605 | <filename>MarketVersion/ProducerMKT_class.py
class Product:
def __init__(self,psi,ksi,GoodPriceN,FacPrices):
import numpy as np
self.GoodPriceN=float(GoodPriceN)
self.FacPrices=np.array(FacPrices)
self.ksi=float(ksi)
self.psi=np.array(psi)
self.nf=len(FacPrices)
... | StarcoderdataPython |
148555 | import os
import numpy as np
from azureml.monitoring import ModelDataCollector
from inference_schema.parameter_types.numpy_parameter_type import NumpyParameterType
from inference_schema.schema_decorators import input_schema, output_schema
# sklearn.externals.joblib is removed in 0.23
from sklearn import __version__ as... | StarcoderdataPython |
1684159 | <reponame>graybrandonpfg/checkov<filename>tests/terraform/checks/data/aws/test_AdminPolicyDocument.py
import unittest
import hcl2
from checkov.terraform.checks.data.aws.AdminPolicyDocument import check
from checkov.common.models.enums import CheckResult
class TestAdminPolicyDocument(unittest.TestCase):
def tes... | StarcoderdataPython |
12384 | # Copyright 2021 Sony Semiconductors Israel, 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | StarcoderdataPython |
1667627 | <filename>cloudmarker/test/test_azwebappclientcertevent.py
"""Tests for AzWebAppClientCertEvent plugin."""
import copy
import unittest
from cloudmarker.events import azwebappclientcertevent
base_record = {
'ext': {
'record_type': 'web_app_config',
'cloud_type': 'azure',
'client_cert_en... | StarcoderdataPython |
3244959 | #!/usr/bin/env python
# encoding: utf-8
"""
Common utils for tests
"""
import contextlib
import tempfile
import os
import shutil
from gensim.corpora import Dictionary
module_path = os.path.dirname(__file__) # needed because sample data files are located in the same folder
def datapath(fname):
"""Return full ... | StarcoderdataPython |
145329 | <gh_stars>10-100
# -*- coding: UTF-8 -*-
from __future__ import unicode_literals, print_function
from base64 import b64encode
from datetime import date, datetime
from decimal import Decimal
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import mock
import pytest
import pytz
fro... | StarcoderdataPython |
1651343 | """
cryptography.py
Author: <NAME>
Credit: None, just help from Eric and Mr. Dennison
Assignment:
Write and submit a program that encrypts and decrypts user data.
See the detailed requirements at https://github.com/HHS-IntroProgramming/Cryptography/blob/master/README.md
"""
associations = "abcdefghijklmnopqrstuvwxyz... | StarcoderdataPython |
1124 | <reponame>ericlin8545/grover
# Original work Copyright 2018 The Google AI Language Team Authors.
# Modified work Copyright 2019 <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
#
# ... | StarcoderdataPython |
3259119 | <reponame>Brandon-mg/wordle-bot
import json
import string
fileobj=open("freq_map.json")
wordfrq=json.load(fileobj)
yellows=[]
word_vector = [set(string.ascii_lowercase) for _ in range(5)]
for attempts in range(5):
guess=input("enter guess:")
clues=input("enter clues:")
if clues=="ggggg":
break
... | StarcoderdataPython |
157019 | from restit.exception.http_error import HttpError
class BadRequest(HttpError):
STATUS_CODE = 400
TITLE = "Bad Request"
DEFAULT_DESCRIPTION = \
"This response means that server could not understand the request due to invalid syntax."
DEFAULT_RFC7807_TYPE = "https://developer.mozilla.org/de/docs... | StarcoderdataPython |
19579 | <reponame>neerajvkn/vet_care
import csv
import datetime
import frappe
# bench execute vet_care.scripts.generate_from_history.execute --args "['./data/important_data.csv']"
def execute(filename):
patient_activities = []
not_created = []
with open(filename, 'r') as csvfile:
reader = csv.DictReader(c... | StarcoderdataPython |
1647654 | <filename>ssh/rforward.py
# rforward.py 192.168.100.133 -p 8080 -r 192.168.100.128:80 --user fearless --password
import getpass
import select
import socket
import sys
import threading
import paramiko
def main():
options, server, remote = parse_options()
password = None
if options.readpass:
passwor... | StarcoderdataPython |
3208212 | ##----------* CHALLENGE 53 *----------
#Display a random fruit from a list of five fruits.
import random
fruits = ["pineapple", "guava", "apple", "watermelon","grape"]
print(random.choice(fruits)) | StarcoderdataPython |
1622221 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-05 19:41
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Pago',... | StarcoderdataPython |
3296494 | <reponame>sean-dingxu/sciwing
from sciwing.infer.seq_label_inference.seq_label_inference import (
SequenceLabellingInference,
)
import torch.nn as nn
from sciwing.data.datasets_manager import DatasetsManager
from typing import Union, Optional
import torch
class Conll2003Inference(SequenceLabellingInference):
... | StarcoderdataPython |
3300579 | <filename>src/libs/libpcap.py
from lib_template import *
from collections import defaultdict
class PcapSeeker(Seeker):
"""Seeker (Identifier) for the pcap open source library."""
# Library Name
NAME = 'libpcap'
# version string marker
VERSION_STRING = "libpcap version "
# Overridden base fun... | StarcoderdataPython |
3312351 | <reponame>Polygon-io/client-python
from polygon import RESTClient
from typing import cast
from urllib3 import HTTPResponse
client = RESTClient()
aggs = cast(
HTTPResponse,
client.get_aggs(
"AAPL",
1,
"day",
"2022-04-01",
"2022-04-04",
raw=True,
),
)
print(ag... | StarcoderdataPython |
3395555 | import snippets.basic_operations as bo
import requests
import csv
import os
import math
from random import uniform
import pandas as pd
from datetime import datetime, timedelta
import time
from tqdm import tqdm
# -----------------------------------------------------------------------
# DataFetch class
class DataFetch:... | StarcoderdataPython |
1761926 | <filename>cogs/music/views.py
# RT.cogs.music - Views ... 音楽プレイヤーで使うViewのモジュールです。
from typing import Optional, Union, Type, List, Dict
from discord.ext import commands
import discord
from functools import wraps
from .cogs.classes import MusicRawDataForJson
from .music_player import MusicPlayer
from .cogs... | StarcoderdataPython |
89000 | <reponame>hasan-se/blm304
import socket
import time
from datetime import datetime
import win32api
import os,sys
#YAZAN
#BAHAR ÇİFTÇİ
SUNUCU_IP = '127.0.0.1'
DINLENEN_PORT = 142
BUFFER = 1024
UTC_ZAMAN_DILIMI = "UTC-2"
sunucu = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sunucu.bind((SUNUCU_IP,DINLENEN_PORT))
sun... | StarcoderdataPython |
3206421 | def calculate_pv_fwd2():
return
def calculate_pv_fwd3():
return
def calculate_pv_rev1():
return
def calculate_pv_rev2():
return
def calculate_pv_rev3():
return
| StarcoderdataPython |
3305210 | """
Classes to interface to ROACH hardware for KID readout systems
"""
import time
import socket
import numpy as np
import scipy.signal
import udp_catcher
import tools
from interface import RoachInterface
from kid_readout.settings import ROACH1_VALON, ROACH1_IP, ROACH1_HOST_IP
import logging
logger = logging.getLog... | StarcoderdataPython |
1670530 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""unittest cases for dvh."""
# test_dvh.py
# Copyright (c) 2016 <NAME>
import unittest
import os
from dicompylercore import dvh, dicomparser
from numpy import array, arange
from numpy.testing import assert_array_equal
mpl_available = True
try:
import matplotlib.pypl... | StarcoderdataPython |
139584 | <filename>google-cloud-sdk/lib/googlecloudsdk/third_party/apis/appengine/v1/appengine_v1_client.py
"""Generated client library for appengine version v1."""
# NOTE: This file is autogenerated and should not be edited by hand.
from apitools.base.py import base_api
from googlecloudsdk.third_party.apis.appengine.v1 import ... | StarcoderdataPython |
1709386 | <filename>py_stringsimjoin/tests/test_profiler.py<gh_stars>10-100
import unittest
from nose.tools import assert_equal, assert_list_equal, raises
import pandas as pd
from py_stringsimjoin.profiler.profiler import profile_table_for_join
class ProfileTableForJoinTestCases(unittest.TestCase):
def setUp(self):
... | StarcoderdataPython |
159413 | <filename>chembo.py
import sys
import os
import pickle as pkl
from PyQt5 import QtCore, QtGui, QtWidgets
from gui.layouts.welcome import Welcome
from gui.layouts.utils import *
def main():
try:
with open('.ChemBO_config.pkl', 'rb') as f:
config = pkl.load(f)
assert(isinstance(config, ... | StarcoderdataPython |
1706843 | arr1 = [1, 2, 3, 4]
arr2 = [
"one",
"two",
"three",
]
zip_obj = zip(arr1, arr2)
# converting iterator to list
res1 = list(zip(arr1, arr2))
# converting iterator to set
res2 = set(zip(arr1, arr2))
# it's possible to iterate over zip_obj (it's an iterable, after all)
for i, v in zip_obj:
print(i, v)
... | StarcoderdataPython |
57502 | import cv2
import numpy as np
thres = 0.45
nms_threshold = 0.2
#Default Camera Capture
cap = cv2.VideoCapture(0)
cap.set(3, 1280)
cap.set(4, 720)
cap.set(10, 150)
##Importing the COCO dataset in a list
classNames= []
classFile = 'coco.names'
with open(classFile,'rt') as f:
classNames = f.read().rstrip('\n').spli... | StarcoderdataPython |
3394108 | # -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import copy
from helper.ambiente import Pontos
def make_maze(mx, my, mz, ox, oy, oz, xs, ys, zs, xt, yt, zt, obs, limiar):
if max(ox) > 200:
maze = np.ones((my, mx, mz))
auxmaze = np.ones((my, mx, mz))
aux = []
px, py, pz = [xs], [ys],... | StarcoderdataPython |
3346464 | from .box3d_utils import *
from .point_cloud_utils import *
from .various import *
| StarcoderdataPython |
1731884 | from django.utils.translation import ugettext_lazy
forms_translate = {
"RegisterForm": {
'first_name': 'Имя',
'last_name': 'Фамлия',
'email': 'Email',
'password': '<PASSWORD>'
}
}
forms_error_messages = {
'password':
{'required': 'обязателен к заполнению',
... | StarcoderdataPython |
3381488 | <reponame>mudbungie/assorted-functions
import xmlgen
import os
def feed():
RSSVersion = '2.0'
XSI = 'http://www.w3.org/2001/XMLSchema-instance'
XMLNS = 'http://search.yahoo.com/mrss/'
title = 'DeskSite Video RSS'
link = 'http://desksite.cloudapp.net/'
description = 'Video provision for MSN feed'
feedRSS = xmlg... | StarcoderdataPython |
1639020 | <gh_stars>1-10
#!/usr/bin/env python3
#coding: utf-8
# IMPORTS
from classes.event_user import userEvent
from classes.event_follower import followerEvent
from classes.event_aa import aaEvent
from classes.event_cdm import cdmEvent
from classes.event_tp import tpEvent
from classes.event_cp import cpEvent
from classes.eve... | StarcoderdataPython |
1642955 | <filename>rat_game.py
import random
import threading
import time
import keyboard as key
#prints rat at a random time and starts a one second timer for the user to react
def rat():
rat.a=0
rat.c=0
for i in range(1,100):
rat.a=random.randint(1,100)
if int(rat.a)%2==0:
rat.b=time.s... | StarcoderdataPython |
3216458 | <filename>jumpgate/compute/drivers/sl/index.py<gh_stars>1-10
class IndexV2(object):
def __init__(self, app):
self.app = app
def on_get(self, req, resp):
versions = [{
'id': 'v2.0',
'links': [{
'href': self.app.get_endpoint_url('compute', req, 'v2_index'... | StarcoderdataPython |
3315480 | <reponame>jliev/wealthbot_chatterbot
from django import template
register = template.Library()
@register.filter(name='phone_number')
def phone_number(number):
"""Convert a 10 character string into (xxx) xxx-xxxx."""
#print(number)
#first = number[0:3]
#second = number[3:6]
#third = number[6:10]
#return '(' + fir... | StarcoderdataPython |
95914 | """
Copyright 2020 InfAI (CC SES)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | StarcoderdataPython |
1657644 | from fastapi import APIRouter
from sciwing.models.science_ie import ScienceIE
router = APIRouter()
science_ie_model = ScienceIE()
@router.get("/science_ie/{citation}")
def tag_citation_string(citation: str):
""" End point to tag a citation
Parameters
----------
citation: str
Returns
------... | StarcoderdataPython |
1628550 | <gh_stars>1-10
from .configuration import Configuration
import os
class BuildConfiguration(Configuration):
def __init__(self):
super().__init__()
def get_build_name(self, project_type):
assert project_type is not None
_formattedDate = Configuration.getFormattedDate()
return ... | StarcoderdataPython |
1758287 | <gh_stars>0
import os
import sys
import re
import shutil
import subprocess
import tempfile
import textwrap
from .platform import OnPlatform, Platform
from .error import *
import paella
GIT_LFS_VER = '2.12.1'
#----------------------------------------------------------------------------------------------
class Output... | StarcoderdataPython |
1607791 | <gh_stars>1-10
'''
analyse the openroberta statistics file of a whole month (usually done at the first day of the next month :-)
@author: rbudde
'''
from datetime import datetime
import time
from util import *
from store import *
from entry import *
def processInitData(logDir, logFileNameOptionallyWithZip, outputDir... | StarcoderdataPython |
1725674 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
import pickle
import os
from hyperopt import fmin, tpe, hp, Trials
import numpy as np
import outer
save_path = outer.save_path
def parameter_search(ntrials, objective_function, fname):
## Grid search
search_space = {'num_dense_layers': hp.choice('nlayers', [1,... | StarcoderdataPython |
3377165 | <reponame>bertrandboudaud/imagegraph
from . import IGCreateImage
def get():
return IGCreateImage.IGCreateImage()
| StarcoderdataPython |
178482 | from django import forms
from dal import autocomplete
from .models import Punchline, Song
class SongAdminForm(forms.ModelForm):
class Meta:
model = Song
fields = '__all__'
widgets = {
'album': autocomplete.ModelSelect2(url='admin:album-autocomplete'),
}
class Punch... | StarcoderdataPython |
1646930 | <reponame>ivandksun/tencentcloud-cli-intl-en
# -*- coding: utf-8 -*-
DESC = "ckafka-2019-08-19"
INFO = {
"DescribeRoute": {
"params": [
{
"name": "InstanceId",
"desc": "Unique instance ID"
}
],
"desc": "This API is used to view route information."
},
"DescribeGroupInfo": {
... | StarcoderdataPython |
3397307 | import torch
from torch import nn
import segmentation_models_pytorch as smp
from multitask_lightning.models.model import UnetClipped
class PredictionPipeline(nn.Module):
def __init__(self, threshold: float):
super(PredictionPipeline, self).__init__()
self.threshold = nn.Threshold(threshold, 0)
... | StarcoderdataPython |
3266841 | <gh_stars>10-100
DTC_GROUP = {"P": "00", "C": "01", "B": "10", "U": "11"}
DTC_TYPE = {"0": "00", "1": "01", "2": "10", "3": "11"}
DTC_LENGTH = 5
BIG_ENDIAN = "big"
UDS_DTC_HIGH_BYTE = 0x01
UDS_DTC_DEFAULT_STATUS = 0x2F
def encode_obd_dtcs(dtcs):
dtcs_bytes = bytearray()
for dtc in dtcs:
if is_dtc... | StarcoderdataPython |
3381729 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from .. import _utilities
import typing
# Export this package's modules as members:
from ._enums import *
from .assessment import *
from .get_assessmen... | StarcoderdataPython |
1716071 | import os
import json
import copy
import asyncio
import datetime
try:
# python2
import __builtin__
except ImportError:
# python3
import builtins as __builtin__
import discord
from discord.ext import tasks
from dotenv import load_dotenv
# load sensitive info
load_dotenv()
TOKEN = os.getenv('DISCORD_TOK... | StarcoderdataPython |
3218805 | <filename>pandapower/networks/simple_pandapower_test_networks.py
# -*- coding: utf-8 -*-
# Copyright (c) 2016 by University of Kassel and Fraunhofer Institute for Wind Energy and Energy
# System Technology (IWES), Kassel. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be fo... | StarcoderdataPython |
4806444 | <reponame>lidongyv/Reppoint-Tracking
from .builder import build_dataset
from .coco import CocoDataset
from .kitti import KittiDataset
from .custom import CustomDataset
from .loader import DistributedGroupSampler, GroupSampler, build_dataloader
from .registry import DATASETS
__all__ = [
'CustomDataset', 'CocoDatase... | StarcoderdataPython |
1764363 | <reponame>prakashtanaji/DSAndAlgo<gh_stars>1-10
import queue
import sys
class Node:
val = 0
left = 0
right = 0
def __init__(self, _val):
self.val = _val
self.left = None
self.right = None
root = Node(1)
root.left = Node(2)
root.right = Node(3)
root.left.left = Node(4)
root.lef... | StarcoderdataPython |
167231 | import os
import json
import urlparse
from redis import StrictRedis
from markdown2 import markdown
import requests
import bleach
from flask import Flask, render_template, make_response, abort
app = Flask(__name__)
HEROKU = 'HEROKU' in os.environ
if HEROKU:
urlparse.uses_netloc.append('redis')
redis_url = ur... | StarcoderdataPython |
25826 | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
app = Flask(__name__)
app.config[
'SQLALCHEMY_DATABASE_URI'] = 'postgres://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
db = SQLAlchemy(app)
migrate = Migrate(app, db)
manage... | StarcoderdataPython |
3316380 | <reponame>ModelFlow/modelflow
class ISRU_Storages:
name = "ISRU_Storages"
params = []
states = [
{
"key": "isru_liquid_h2o",
"label": "",
"units": "kg",
"private": False,
"value": 0,
"confidence": 0,
"notes": "",
... | StarcoderdataPython |
98166 | """This module provides the :py:class:`typespec_ctypes` class.
It is used to map the C types found in the 'dwf.h' header file to specific *ctypes* types.
"""
import ctypes
class typespec_ctypes:
"""Map the type specifications from :py:mod:`pydwf.core.auxiliary.dwf_function_signatures` to *ctypes* types."""
... | StarcoderdataPython |
1637322 | #!/usr/bin/env python2
import sys
import datetime
if len(sys.argv) != 4:
print "%s YEAR COPYYEAR NUMDAYS" % sys.argv[0]
sys.exit(0)
YEAR = int(sys.argv[1])
COPYYEAR = int(sys.argv[2])
DAY_COUNT = int(sys.argv[3])
description = """abcdefghijklmnopqrstuvwqyz.?{}-abcdefghijklmnopqrstuvwqyz.?{}abcdefghijklmnopqr... | StarcoderdataPython |
1715189 | from collections import Counter, namedtuple
Point = namedtuple("Point", ["x", "y"])
Line = namedtuple("Line", ["p1", "p2"])
def read_input(path):
with open(path, "r") as f:
data = f.read()
data = data.splitlines()
return data
def parse_line(line):
splitted = line.split(" -> ")
first =... | StarcoderdataPython |
7272 | def sysrc(value):
"""Call sysrc.
CLI Example:
.. code-block:: bash
salt '*' freebsd_common.sysrc sshd_enable=YES
salt '*' freebsd_common.sysrc static_routes
"""
return __salt__['cmd.run_all']("sysrc %s" % value)
| StarcoderdataPython |
106687 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Дано предложение. Определить порядковые номера
# первой пары одинаковых соседних символов.
# Если таких символов нет,
# то должно быть напечатано соответствующее сообщение.
if __name__ == '__main__':
line = input("Введите предложение ")
fo... | StarcoderdataPython |
1628301 | <reponame>Azurealistic/Winter
# Advent of Code 2021 - Day: 18
# Imports (Always imports data based on the folder and file name)
from functools import reduce
import itertools
import math
from aocd import data, submit
import ast
# Recursivelly add two lists together with left or right bias
def recursive_addition(ll, num... | StarcoderdataPython |
1600261 | <reponame>DATEXIS/SentEval-k8s
# -*- coding: UTF-8 -*-
from __future__ import absolute_import, division, unicode_literals
import datetime
import json
import os
import re
import sys
import time
from collections import defaultdict
from enum import Enum
import numpy as np
import logging
# Set PATHs
import requests
imp... | StarcoderdataPython |
1763437 | <filename>back/found/models.py
from django.db import models
from imagekit.models import ProcessedImageField
from imagekit.processors import ResizeToFill
from datetime import datetime
from django_extensions.db.models import TimeStampedModel
from django.contrib.auth import get_user_model
User = get_user_model()
def fo... | StarcoderdataPython |
1790098 | <filename>binterpret.py
#!/usr/bin/env python
from __future__ import print_function
import sys
import argparse
DEFAULT = 8
#Argv voodoo so Kivy does not take over the world of arguments
argv = sys.argv[1:]
sys.argv = sys.argv[0]
parser = argparse.ArgumentParser(description='Read a QRcode as binary data')
#Convertin... | StarcoderdataPython |
11903 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import time
import json
import os
import math
import scribus
import simplebin
import inspect
from collections import defaultdict
PWD = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
def pwd(path):
return os.path.join(PWD, path);
DATA_FILE = pwd... | StarcoderdataPython |
1655632 | <reponame>lgbouma/cdips
"""
Contents:
get_exoplanetarchive_planetarysystems
given_source_ids_get_tic8_data
"""
import os
import numpy as np
from astroquery.utils.tap.core import TapPlus
from cdips.utils.gaiaqueries import (
make_votable_given_source_ids, given_votable_get_df
)
CACHEDIR = os.path.join(
... | StarcoderdataPython |
1625418 | #
# Copyright (C) 2004-2006 Rational Discovery LLC
#
# @@ All Rights Reserved @@
# This file is part of the RDKit.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the RDKit source tree.
#
class ExcludedVolume(object):
def __init__... | StarcoderdataPython |
3338060 | import jivago
from jivago.templating.rendered_view import RenderedView
from jivago.wsgi.annotations import Resource
from jivago.wsgi.methods import GET
@Resource("/")
class RootResource(object):
@GET
def root_message(self) -> RenderedView:
return RenderedView("home.html", {"version": jivago.__version... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.