id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
6599821 | __version__ = "0.0.b45"
from .core import BaseHMF
from .parallel import WriterProcessManager
from .hmf import HMF
from .hmf import open_file
from .hmf import is_hmf_directory
from .utils import write_memmap
from .utils import read_memmap
__all__ = [
"BaseHMF",
"WriterProcessManager",
"HMF",
"open_file",
"is_hmf... | StarcoderdataPython |
9647170 | <filename>utils/data_utils.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
Creates a ResNeXt Model as defined in:
<NAME>., <NAME>., <NAME>., <NAME>., & <NAME>. (2016).
Aggregated residual transformations for deep neural networks.
arXiv preprint arXiv:1611.05431.
"""
__author__ = "<NAME>"
__email__ = "<EMAIL>"
import os... | StarcoderdataPython |
5140797 | <filename>news/views.py
import base64
from datetime import datetime
from django.shortcuts import render, redirect, get_object_or_404
from django.core.urlresolvers import reverse
from django.core.exceptions import PermissionDenied
from django.views.generic.edit import FormView
from django.db.models import Q
from django... | StarcoderdataPython |
11314886 | <reponame>rsumner33/PTVS
foo + bar = 1
foo() = 1
None = 1
2 = 1
(foo for foo in bar) = 1
foo, bar += 1
def f():
(yield foo) = 1
| StarcoderdataPython |
11298227 | #!/usr/bin/env python3
import sys
import subprocess
def exec_raw(command: str):
print(f'exec_raw: {command}', file=sys.stderr, flush=True)
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
process.wait()
if process.returncode != 0:
raise RuntimeError(f'command failed with... | StarcoderdataPython |
6538745 | import pandas as pd
import numpy as np
from scipy import stats
UIM = pd.DataFrame(np.zeros(5000,1000))
IIM = pd.DataFrame(np.zeros(1000,1000))
UUM = pd.DataFrame(np.zeros(5000,5000))
top_n = 20
labels = pd.DataFrame(np.zeros(1000))
def initI(uid):
#Returns a list of item indices in UIM st. UIM(uid, i) = 0
con... | StarcoderdataPython |
3398897 | import os
from sqla_wrapper import SQLAlchemy
db = SQLAlchemy(
os.getenv("DATABASE_URL", "sqlite:///localhost.sqlite"))
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
email = db.Column(db.String, unique=True)
password = db.Column(db.String)
session_token = db.Column(db.String)... | StarcoderdataPython |
4829943 | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by... | StarcoderdataPython |
5004078 | import django.dispatch
refresh_select_choices = django.dispatch.Signal(providing_args=["choice_family"])
def inherit_support_receiver(signal, **kwargs):
"""
A decorator for connecting receivers to signals. Used by passing in the
signal (or list of signals) and keyword arguments to connect::
@rece... | StarcoderdataPython |
4821339 | <reponame>Dundee/python-sqlpuzzle<filename>tests/queryparts/test_values.py
# pylint: disable=redefined-outer-name,invalid-name
import decimal
import pytest
import sqlpuzzle
from sqlpuzzle._queryparts import Values
@pytest.fixture
def values():
return Values()
def test_is_not_set(values):
assert not value... | StarcoderdataPython |
3369926 | import sys
import logging
from web3 import Web3
from erasure.settings import (
LOG_STDOUT,
LOG_FORMAT,
LOG_LEVEL,
)
logger = logging.getLogger(__name__)
def setup_logging():
"""
Add logging format to logger used for debugging and info
"""
handler = logging.StreamHandler(
sys.stdo... | StarcoderdataPython |
6675326 | <filename>otcextensions/osclient/sdrs/v1/job.py
# 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 l... | StarcoderdataPython |
11257304 | import unittest
from tools.hanabi_table import HanabiTable
from tools.hanabi_hand import HanabiHand
from tools.hanabi_card import HanabiCard, HanabiColor
from tools.hanabi_deck import HanabiVariant
def diagnose(table):
print("Player 0")
print(table.info_for_player(1)["hands"][0])
print("Player 1")
prin... | StarcoderdataPython |
6419519 | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 9 13:22:07 2018
Updated on Thu May 9
@author: Kiranraj(kjogleka), Himanshu(hsardana), Komal(kpanzade), Avinash (avshukla)
"""
import warnings
warnings.filterwarnings(action='ignore', module='.*paramiko.*')
import subprocess
import paramiko
import threading
im... | StarcoderdataPython |
11249192 | from django.conf.urls.static import static
from django.conf.urls import include, url
from django.conf import settings
from django.contrib import admin
import profiles.urls
import accounts.urls
from . import views
import gethistoryfile.urls
from gethistoryfile.views import ActivitiesView
from gethistoryfile import urls ... | StarcoderdataPython |
6509716 | <reponame>sisobus/pynetdicom3
"""Unit tests for the DIMSE Message classes."""
from io import BytesIO
import logging
import pytest
from pydicom.dataset import Dataset
from pydicom.uid import UID
from pynetdicom3.dimse_messages import (
C_STORE_RQ, C_STORE_RSP, DIMSEMessage, C_ECHO_RQ, C_ECHO_RSP, C_FIND_RQ,
... | StarcoderdataPython |
9656111 | <reponame>ravitejavalluri/catapult
"""Integration tests for uploading and downloading to GCS.
These tests exercise most of the corner cases for upload/download of
files in apitools, via GCS. There are no performance tests here yet.
"""
import json
import os
import unittest
import six
import apitools.base.py as apit... | StarcoderdataPython |
1736334 | <gh_stars>0
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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 appli... | StarcoderdataPython |
6438537 | <gh_stars>0
import spacy
nlp = spacy.load("en_core_web_sm")
import random
class QuestionAsker:
'''
Class to ask questions about sentences---basically to reverse them into questions.
'''
def __init__(self):
#self.sents = []
self.questions = []
self.question_types = [self.getVerbQuestion,self.getAdjQuestio... | StarcoderdataPython |
3524213 | # MODULES
import pygame, sys
import numpy as np
import random
import time
# initializes pygame
pygame.init()
# ---------
# CONSTANTS
# ---------
# rgb: red green blue
RED = (255, 0, 0)
BG_COLOR = (231, 225, 232)
LINE_COLOR = (0, 0, 0)
CIRCLE_COLOR = (239, 231, 200)
CROSS_COLOR = (66, 66, 66)
class BoardGame():
... | StarcoderdataPython |
3374457 | import re
try:
# Block it from trying to import something which should not be on the python sys.path
# https://github.com/hktonylee/SublimeNumberKing/issues/4
import expand_region_handler
import utils
except:
from . import utils
def expand_to_symbols(string, selection_start, selection_end):
opening_symbol... | StarcoderdataPython |
5071975 | """
Copyright 2020 <NAME>.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distribute... | StarcoderdataPython |
12829077 | <reponame>real-digital/esque
class StreamEvent:
"""
An event that happened on a stream.
Check :attr:`StreamEvent.partition` to see which partition this event occurred on.
If the value is equal to :attr:`StreamEvent.ALL_PARTITIONS` then this is a global event that refers to all
partitions or it is an... | StarcoderdataPython |
5133430 | <gh_stars>1-10
"""This module provides facilities for logging and exporting information relevant to a model."""
import csv
import _pickle as cPickle
import datetime
import logging
import os
import numpy as np
from . import gaussian_process
from . import util
OUTPUT_PATH = '../results/'
CONFIG_FILE_NAME = 'config.csv... | StarcoderdataPython |
11335651 | # This is the entry to the project, what a CLI user of Python will call
# Used for getting more easily defined CLI args
import argparse
# Used for printing the Python working directory
from os import getcwd, getpid
# Used to get memory information
from psutil import Process
from difflens.util.compareMode import Compa... | StarcoderdataPython |
329143 | <filename>kdsphere/kdsphere.py
import numpy as np
from scipy.spatial import cKDTree, KDTree
from .utils import spherical_to_cartesian
class KDSphere(object):
"""KD Tree for Spherical Data, built on scipy's cKDTree
Parameters
----------
data : array_like, shape (N, 2)
(lon, lat) pairs measure... | StarcoderdataPython |
3316355 | <gh_stars>1-10
"""
A Python class with all of the attriubutes of a planet (2D).
(C) <NAME> 2015
"""
class planet:
name = ''
hasRing = False
color = (255, 255, 255) #default to white
#inital position
x = 0
y = 0
radius = 200 #radius of orbit
speed = 2 #default rate of change of angle
angle = 0 #initial angle to... | StarcoderdataPython |
1734471 | <filename>PracticaPersonal/PracticaCadenas/CadenasEjemplos.py
#Creador <NAME>
#Fecha 27/06/2016
#version de python 3.5
print ('*'*30) #multiplicacion de cadenas
''' Este es un comentario para varias lineas '''
# Este es un comentario para una sola linea
print ("Hola mundo") #Cadena con comilla doble
print ('Hol... | StarcoderdataPython |
9756621 | from selenium.webdriver.support.ui import Select
class ContactHelper:
def __init__(self, app):
self.app = app
def add_new_contact(self, contact):
wd = self.app.wd
# Нажимаем кнопку "Добавить контакт"
wd.find_element_by_link_text("add new").click()
# Заполняем поля
... | StarcoderdataPython |
6644563 | # -*- coding: utf-8 -*-
import sys
import asyncio
from game import Game
from base_board import Player
from agent import AutonomousAgent
from abc import ABCMeta, abstractmethod
from move import Move, InvalidMove, PlayerResigned
class ConnectionException(Exception):
"""Could not connect."""
pass
class Game... | StarcoderdataPython |
3483431 | # -*- coding: utf-8 -*-
import numpy as np
import matplotlib as mpl
mpl.use( 'TkAgg' )
font = {'family' : 'Arial',
'weight' : 'bold',
'size' : 8}
mpl.rc('font', **font)
import matplotlib.pyplot as plt
import matplotlib.image as img
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, Navi... | StarcoderdataPython |
6427629 | <filename>circus/commands/sendsignal.py
import signal
from circus.commands.base import Command
from circus.exc import ArgumentError, MessageError
from circus.py3compat import string_types
class Signal(Command):
"""\
Send a signal
=============
This command allows you to send a signal to ... | StarcoderdataPython |
3205386 | <gh_stars>1-10
from django.shortcuts import render
# Create your views here.
from django.http import HttpResponse
import json
import CloudJudge.info as info
FrontMessageCode = info.getFrontMessage()
def getFrontMessageCode(request):
if request.method == "GET":
return HttpResponse(json.dumps(FrontMessage... | StarcoderdataPython |
3494600 | <filename>colcon_devtools/verb/extension_points.py
# Copyright 2016-2018 <NAME>
# Licensed under the Apache License, Version 2.0
from colcon_core.entry_point import EXTENSION_POINT_GROUP_NAME
from colcon_core.entry_point import get_entry_points
from colcon_core.entry_point import load_entry_point
from colcon_core.plug... | StarcoderdataPython |
1652870 | <filename>skeeter.py<gh_stars>1-10
import elasticsearch
import requests, json, yaml, datetime, time, re
from bs4 import BeautifulSoup
requests.packages.urllib3.disable_warnings()
config = 'sites.yaml'
yamldir = 'sites/'
sites_config = yamldir + config
sites = yaml.load(file(sites_config, 'r'))
index_name = sites['ind... | StarcoderdataPython |
9755858 | import sys
import os
import argparse
current_path = os.getcwd()
sys.path.append(current_path) # /plant-record/ ディレクトリをパスに追加
import segmentation as seg
def parse_args():
parser = argparse.ArgumentParser(description='Inference Segmentation Model')
parser.add_argument('--image-path', default='C:/Users/Junya/Down... | StarcoderdataPython |
3454760 | <filename>Offline/main.py
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.utils import shuffle
from sklearn.metrics import mean_squared_error, r2_score, mean_absolute_error
from Offline.Utils import *
from Offline.Parties import System, User, MLE, MLEClear
# ... | StarcoderdataPython |
6467646 | """
mlp_plot.py: Creates plots for the results of the random MLP simulation.
You must first run the program mlp_test.py to generate the results pickle
file, randmlp_sim.pkl.
"""
# Load the packages
import numpy as np
import matplotlib.pyplot as plt
import pickle
import matplotlib
import argparse
parser = argparse.... | StarcoderdataPython |
3417955 | <reponame>dennis-l/tolteca<gh_stars>1-10
#! /usr/bin/env python
from tollan.utils.log import get_logger
from tollan.utils.fmt import pformat_dict
from dasha.web.extensions.ipc import ipc
from dasha.web.extensions.celery import get_celery_app
from .kidsviewdata import KidsViewData
class SharedKidsViewData(object):
... | StarcoderdataPython |
3368935 | """Eurotronic devices."""
import logging
import zigpy.types as types
from zigpy.quirks import CustomCluster
from zigpy.zcl import foundation
from zigpy.zcl.clusters.hvac import Thermostat
EUROTRONIC = "Eurotronic"
THERMOSTAT_CHANNEL = "thermostat"
MANUFACTURER = 0x1037 # 4151
OCCUPIED_HEATING_SETPOINT_ATTR = 0x... | StarcoderdataPython |
1937884 | <reponame>swipswaps/mix-demo-client-azstaticwebapps<gh_stars>1-10
"""
Copyright 2021-present, Nuance, Inc.
All rights reserved.
This source code is licensed under the Apache-2.0 license found in
the LICENSE.md file in the root directory of this source tree.
"""
import logging
import json
import azure.functions as fun... | StarcoderdataPython |
8187039 | # -*- coding: utf-8 -*-
"""
@author: P.Foulquier
"""
import numpy
import re
spec=['']
spec=open("spec_file.txt").read() #Read spec file
a=str(spec)
x = [_.start() for _ in re.finditer('#S', a)] #Locate the start of the scan name
y = [_.start() for _ in re.finditer('#D', a)] #Locate the end of th... | StarcoderdataPython |
1945397 | import sys
#--------------------------------------------------------------------------------------------------
class Clad:
#----------------------------------------------------------------------------------------------
# constructor: self is a 'clad' object created in B1B,
# indx is the axial index... | StarcoderdataPython |
3228856 | <reponame>ScottHull/Masters-Thesis-Code
import os
from math import sqrt, pi, exp
import numpy as np
import matplotlib as mpl; mpl.use("Qt5Agg")
import matplotlib.pyplot as plt
def accelerationGravity(depth, meltDensity):
G = 6.67408 * 10**(-11) # m3 kg-1 s-2
earthMass = 5.972 * 10**(24) # kg
# Rearth = 63... | StarcoderdataPython |
11206467 | #==============================================================#
#Type de variable
a = 12 ---> integer(int)
b = "Salut" ---> String(str)
c = [12,1,7,"salut","toto"] ---> liste
#==============================================================#
#Instruction de base
print... | StarcoderdataPython |
3382431 | TOKEN = "<KEY>"
DB_USER = 'user'
DB_PASSWORD = '<PASSWORD>'
DB_NAME = 'bot' | StarcoderdataPython |
264035 | <filename>nipype/pipeline/plugins/base.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Common graph operations for execution."""
import sys
from copy import deepcopy
from glob import glob
import os
import s... | StarcoderdataPython |
6655246 | # -*- coding: utf-8 -*-
"""
Created on Tue Sep 3 09:16:41 2019
@author: admin
"""
from functions import clean_string
import stats
import numpy as np
import pandas as pd
class ADA:
def __init__(self, df, depth = 'all'):
self.df = df
self.depth = depth
#self.columns = dict()
... | StarcoderdataPython |
1943062 | <filename>lessons/migrations/0004_flashcard_is_bordered.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-05-05 17:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lessons', '0003_flashcardlesson_i... | StarcoderdataPython |
1632490 | nome = input('Qual é o seu nome? ')
print('Olá \033[35m{}\033[m, é um grande prazer te conhecer!'.format(nome))
| StarcoderdataPython |
283385 | # -*- coding:utf-8 -*-
import os
import yaml
def getData(funcname, file):
PATH = os.getcwd() + os.sep
with open(PATH + 'Data/' + file + '.yaml', 'r', encoding="utf8") as f:
data = yaml.load(f, Loader=yaml.FullLoader)
# 1 先将我们获取到的所有数据都存放在一个变量当中
tmpdata = data[funcname]
# 2 所以此时我们需要使用循环走进... | StarcoderdataPython |
3408137 | <filename>src/Trapalyzer/measurement.py
from abc import ABC
import numpy as np
from sympy import symbols
from PartSegCore.algorithm_describe_base import AlgorithmProperty
from PartSegCore.analysis import measurement_calculation
from PartSegCore.analysis.measurement_base import AreaType, Leaf, MeasurementMethodBase, P... | StarcoderdataPython |
3412725 | <reponame>br5555/Deep_learning_HW
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed May 30 01:03:00 2018
@author: branko
"""
import tensorflow as tf
import numpy as np
class onelayer_RNN:
def __init__(self, n_steps, n_inputs, n_neurons, n_outputs, learning_rate):
self.learning_rate =... | StarcoderdataPython |
11223021 | #!/usr/bin/env python3
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A tool for tagging an updater metainstaller.
For example:
python3 chrome/updater/tools/tag.py --certificate_tag=certificate_tag.exe... | StarcoderdataPython |
3529949 | from mediapipe.python.solutions import face_mesh, drawing_utils, drawing_styles
import open3d as o3d
import open3d.visualization.rendering as rendering
import cv2
class Drawing():
def draw_landmark_point(landmark, image, color = (255, 0, 0), radius = 5):
try:
image_rows, image_cols, _ ... | StarcoderdataPython |
9696245 | <gh_stars>1-10
# (c) Copyright [2018-2022] Micro Focus or one of its affiliates.
# 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 requir... | StarcoderdataPython |
6679806 | <gh_stars>0
def sqrt(number):
"""
Calculate the floored square root of a number
Args:
number(int): Number to find the floored squared root
Returns:
int: Floored Square Root
"""
if number < 0:
return -1
if number == 0:
return 0
if number == 1:
... | StarcoderdataPython |
3265837 | from rubygems_utils import RubyGemsTestUtils
class RubyGemsTestrubygems_chef_utils(RubyGemsTestUtils):
def test_gem_list_rubygems_chef_utils(self):
self.gem_is_installed("chef-utils")
def test_load_chef_utils(self):
self.gem_is_loadable("chef-utils")
| StarcoderdataPython |
6494567 | from pydantic import BaseModel, Field
feature_names = [
'iron_feed',
'starch_flow',
'amina_flow',
'ore_pulp_flow',
'ore_pulp_ph',
'ore_pulp_density',
'flotation_column_01_air_flow',
'flotation_column_02_air_flow',
'flotation_column_04_air_flow',
'flotation_column_05_air_flow',
... | StarcoderdataPython |
9628104 | # debug global method
def debug(msg, prefix=""):
print("\033[45m DEBUG: \033[00m", end="")
if prefix:
print("\033[41m", prefix, "\033[00m", end="")
print("\033[91m", msg, "\033[00m")
| StarcoderdataPython |
1946441 | <filename>00_Code/01_LeetCode/86_PartitionList.py<gh_stars>1-10
"""
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.
You should preserve the original relative order of the nodes in each of the two partitions.
For example,
Given 1->4->3->2->5... | StarcoderdataPython |
18343 | import os
indentSize=1 #size of the indent
class calcs():
def __init__(self):
self.indent=0
self.txt=[] #text for each line
def clear(self):
self.txt.clear()
self.indent=0
def addCalcs(self,calc):
s=[' ' * self.indent+ t for t in calc.txt]
self.txt += s
... | StarcoderdataPython |
3201174 | <filename>data_replication/tasks.py
# -*- coding: utf-8 -*-
"""tasks.py: Django data_replication"""
import logging
from celery import shared_task
from .backends.base import ImproperlyConfiguredException
from .backends.mongo import MongoRequest
from .backends.splunk import SplunkRequest
__author__ = '<NAME>'
__date_... | StarcoderdataPython |
11295949 | <filename>BindingSitesFromFragments/commands/bsff_new.py
#!/usr/bin/env python3
import os
def new_project(args):
"""
Generate a new project.
This command will generate a new working directory for your target ligand named <chemical_id>. You can name your project
anything, but the first three characters... | StarcoderdataPython |
1762084 | <gh_stars>0
filename = 'guests.txt'
with open(filename, 'a') as file_object:
for i in range(1,5):
name = input("Enter Name: ")
message = "Hello, " + name.title() + " Welcome to XXX Hotel. \n"
guest = file_object.write(message)
| StarcoderdataPython |
3454113 | <reponame>Joselacerdajunior/digital-processing-of-automotive-plates
from lib.myLib import *
import os
nameImages = [
'img1.jpg',
'img2.jpg',
'img3.jpg',
'img4.jpg'
]
platesInDataBase = ["EWK-7037", "RIO2A18"]
plates = ["", "", "", ""]
authorization = ["", "", "", ""]
image = ""
height = [ ... | StarcoderdataPython |
8138650 | import darwin.dataset # noqa
import darwin.exceptions # noqa
from .client import Client # noqa
from .team import Team # noqa
__version__ = "0.6.13"
| StarcoderdataPython |
3203185 | <gh_stars>0
from collections import defaultdict
from typing import Dict, Iterator, TypeVar, Any, Union, Optional
from typing_extensions import Literal
from .interface import ISpy, SupportsRendering
T = TypeVar("T", bound=ISpy)
class Spy:
selected_fields: Dict[str, ISpy]
is_subquery: bool
where: Optional... | StarcoderdataPython |
9656979 | <filename>train.py
import os
import warnings
import hydra
import pytorch_lightning as pl
import torch
from omegaconf import DictConfig, OmegaConf
from pytorch_lightning.callbacks import ModelCheckpoint, EarlyStopping
from utils.utils import set_seed, load_obj, save_model_code
warnings.filterwarnings('ignore')
def ... | StarcoderdataPython |
6512421 | #! /usr/bin/env python3
import time
import sys
import os
import subprocess
from subprocess import call
def callWithShell(cmd):
process = subprocess.Popen(cmd,shell=True)
process.wait()
startAllTime = time.time()
print("\n*** Sync Files ### \n")
sys.stdout.flush()
callWithShell("python /UxASDev/OpenUxAS/doc... | StarcoderdataPython |
3240175 | <gh_stars>1-10
from django.contrib import admin
from .models import Usuario
# admin.site.register(Usuario)
@admin.register(Usuario)
class UsuarioAdmin(admin.ModelAdmin):
list_display = ('nome', 'email')
search_fields = ('nome', 'email')
readonly_fields = ('senha',)
| StarcoderdataPython |
6528143 | def generate_excluded():
excluded = ['AmpiFire']
return excluded
def generate_linked_in():
linked_in_keywords = {'Microsoft': 'microsoft'
}
locations = {'worldwide': 'Worldwide'}
query = 'https://www.linkedin.com/jobs/search?keywords={}&location={}'
linked_in... | StarcoderdataPython |
1960539 | <reponame>windowssocket/py_leetcode
class Solution(object):
def reverseBetween(self, head, m: int, n: int):
if not head:
return head
dummy = ListNode(0)
dummy.next = head
curr = dummy
for _ in range(m - 1):
if curr.next:
curr = curr... | StarcoderdataPython |
11384582 | <gh_stars>0
from django.urls import path
from .views import (CocktailCreateApiView,
CocktailretriveAPiView,
CocktailListAPiView)
urlpatterns = [
path('create/',CocktailCreateApiView.as_view(), name='create_cocktail'),
path('retrieve/',CocktailretriveAPiView.as_view(), ... | StarcoderdataPython |
8008813 | #
# GRPC Server for NK Shapelet Classifier
#
# Uses GRPC service config in protos/grapevine.proto
#
from flask import Flask, request
import time
import pandas as pd
import numpy as np
import configparser
from Sloth.classify import Shapelets
from Sloth.preprocess import events_to_rates
from tslearn.preprocessing im... | StarcoderdataPython |
218266 | import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), "./"))
sys.path.append(os.path.join(os.path.dirname(__file__), "../"))
sys.path.append(os.path.join(os.path.dirname(__file__), "../../"))
import xmlrunner
import unittest
from bin import example
class examplteMultTest(unittest.TestCase):
... | StarcoderdataPython |
1967705 | <filename>mafia/misc/utils.py
class Misc:
STATES_STRING_SEPARATOR = "----------------------------------------"
CATEGORY_CHANNEL_MAFIA = "Mafia Private Channels"
TRIAL_INNOCENT = "Innocent"
TRIAL_GUILTY = "Guilty"
class Timers:
TIMER_SELECT_NICKNAME = 1
#TIMER_SELECT_NICKNAME = 30
TIMER_D... | StarcoderdataPython |
12811670 | <reponame>AlpacaDB/backlight
import pandas as pd
import numpy as np
from backlight.datasource.marketdata import MarketData
from backlight.labelizer.common import LabelType, TernaryDirection
from backlight.labelizer.labelizer import Labelizer, Label
class StaticNeutralLabelizer(Labelizer):
"""Generates session-aw... | StarcoderdataPython |
6541460 | #!/usr/bin/env python3
# encoding: utf-8
import torch
from torch.optim import lr_scheduler
def make_optimizer_double(config, model1, model2):
lr = float(config['lr'])
print('initial learning rate is ', lr)
optimizer = torch.optim.Adam([
{'params': model1.parameters()},
{'params': model2.parameters(... | StarcoderdataPython |
3222294 | import datetime
def _get_duration_components(duration):
days = duration.days
seconds = duration.seconds
microseconds = duration.microseconds
minutes = seconds // 60
seconds = seconds % 60
hours = minutes // 60
minutes = minutes % 60
return days, hours, minutes, seconds, microseconds... | StarcoderdataPython |
5087812 | import tempfile
import shutil
import os
magic = b'polytaxis00'
size_size = 10
size_limit = 10 ** size_size
sep = b'='
sep2 = b'\n'
unsized_mark = b'<<<<\n'
def _encode_part(text):
return ''.join({
'=': '\\=',
'\n': '\\\n',
'\\': '\\\\',
}.get(char, char) for char in text).encode('utf... | StarcoderdataPython |
8146663 | """Train a model based on the given config."""
import argparse
import importlib.metadata
import logging
import pathlib
import uuid
import jsons
import pytorch_lightning as pl
import torch
from mitorch.builders import DataLoaderBuilder
from mitorch.common import MiModel, TrainingConfig, StandardLogger, MongoDBLogger
fro... | StarcoderdataPython |
5192611 | import warnings
warnings.simplefilter("ignore", category=FutureWarning)
from pmaf.database._metakit import DatabaseBackboneMetabase
from pmaf.database._manager import DatabaseStorageManager
from pmaf.internal._shared import get_rank_upto
from pmaf.database._shared._common import to_mode
import numpy as np
import panda... | StarcoderdataPython |
6589217 | <reponame>ProjectMeniscus/cloudcafe
import json
from cafe.engine.models.base import \
AutoMarshallingModel, AutoMarshallingListModel
class Member(AutoMarshallingModel):
def __init__(self, member_id=None, shared_images=None, can_share=None):
self.member_id = member_id
self.shared_images = share... | StarcoderdataPython |
11300139 | # encoding: utf-8
# module PySide.QtCore
# from C:\Python27\lib\site-packages\PySide\QtCore.pyd
# by generator 1.147
# no doc
# imports
import Shiboken as __Shiboken
from QAbstractItemModel import QAbstractItemModel
class QAbstractTableModel(QAbstractItemModel):
# no doc
def dropMimeData(self, *args, **kwar... | StarcoderdataPython |
3483455 | <reponame>cds95/crypto-champions
import brownie
def test_train_invalid_hero_id(accounts, crypto_champions, fund_contract_with_link, get_seed):
with brownie.reverts("dev: Given id is not valid."):
crypto_champions.trainHero(0, 7777777777777777777777777777777, {"from": accounts[0]})
def test_train_uniniti... | StarcoderdataPython |
1981431 | <reponame>SuviVappula/apartment-application-service<filename>application_form/api/serializers.py
from rest_framework import serializers
from application_form.models import HasoApplication, HitasApplication
from application_form.services import (
create_or_update_apartments_and_priorities,
get_or_create_apartme... | StarcoderdataPython |
1906514 | <reponame>KevinKecc/caffe2
# Copyright (c) 2016-present, Facebook, Inc.
#
# 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 ... | StarcoderdataPython |
362994 | import json
import os
import praw
from typing import Generator
from random import randrange
env = {
'username': os.environ["REDDITNAME"],
'password': os.environ.get("PASSWORD",""), # for testing purposes, password is blank...
'id': os.environ["APPID"],
'secret': os.environ["APPSECRET"],
'app-name':... | StarcoderdataPython |
9754164 | <gh_stars>0
"""Default settings for django-notifs project."""
from django.conf import settings
NOTIFICATIONS_PAGINATE_BY = getattr(settings, 'NOTIFICATIONS_PAGINATE_BY', 15)
NOTIFICATIONS_USE_WEBSOCKET = getattr(
settings, 'NOTIFICATIONS_USE_WEBSOCKET', False
)
NOTIFICATIONS_RABBIT_MQ_URL = getattr(
settin... | StarcoderdataPython |
1767232 | """Test the frigate binary sensor."""
from __future__ import annotations
import asyncio
import copy
from datetime import timedelta
from http import HTTPStatus
import logging
from typing import Any
from unittest.mock import AsyncMock, MagicMock, patch
import aiohttp
from aiohttp import hdrs, web
from aiohttp.web_excep... | StarcoderdataPython |
6414209 | <gh_stars>0
def Inverte_Elementos(lista: list):
lista[0], lista[-1] = lista[-1], lista[0]
return lista
l = [0, 1,2,3,4,5,6]
print(Inverte_Elementos(l)) | StarcoderdataPython |
11272512 | <reponame>bmcmenamin/model_wrangler<gh_stars>0
"""End to end testing on autoencoders
"""
# pylint: disable=C0103
# pylint: disable=C0325
# pylint: disable=E1101
import numpy as np
from scipy.stats import zscore
from model_wrangler.model_wrangler import ModelWrangler
from model_wrangler.dataset_managers import Datase... | StarcoderdataPython |
1822758 | <gh_stars>0
# Re-compute sfrs using new method from Av, useful for galaxies with lower limits of SFR_CORR
from astropy.io import ascii
import pandas as pd
import numpy as np
import initialize_mosdef_dirs as imd
from cosmology_calcs import flux_to_luminosity
import matplotlib.pyplot as plt
def convert_ha_to_sfr():
... | StarcoderdataPython |
12826795 | <filename>moto/cloudwatch/models.py
from moto.core import BaseBackend
import boto.ec2.cloudwatch
import datetime
class Dimension(object):
def __init__(self, name, value):
self.name = name
self.value = value
class FakeAlarm(object):
def __init__(self, name, namespace, metric_name, comparison_... | StarcoderdataPython |
1827074 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import unittest
from derrick.detectors.image.golang import GolangVersionDetector
class GolangTestCase(unittest.TestCase):
def test_golang_detector(self):
gr = GolangVersionDetector()
v... | StarcoderdataPython |
304459 | """
Contains classes for instance based selectors.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .cluster_based_selector import ClusterBasedWCSelector
import pandas as pd
import numpy as np
class InstanceBasedWCSelector(Clu... | StarcoderdataPython |
1705443 | #!/usr/bin/env python3
import rospy
from std_msgs.msg import String
def callback(message):
rospy.loginfo("get message! [%s]", message.data)
rospy.init_node('listener')
sub = rospy.Subscriber('chatter', String, callback)
rospy.spin()
| StarcoderdataPython |
1845753 | """Test that all event classes are well-formed."""
from unittest import TestCase
import inspect
from ..base import Event
class TestNamed(TestCase):
"""Verify that all event classes are named."""
def test_has_name(self):
"""All event classes must have a ``NAME`` attribute."""
for klass in Eve... | StarcoderdataPython |
11298582 | """
Loop object for holding field-aligned coordinates and quantities
"""
import numpy as np
from scipy.interpolate import splprep, splev, interp1d
import astropy.units as u
from astropy.coordinates import SkyCoord
from sunpy.coordinates import HeliographicStonyhurst
import sunpy.sun.constants as sun_const
import zarr
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.