id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
3575155 | from functools import lru_cache
from .base import ErConnector
from .customfield import get_custom_field_by_key
from .candidate import delete_candidate_custom_field_rest
gender_choices = [(0, 'Male'), (1, 'Female'), (3, 'Other'), (4, 'Decline') ]
# not in api, convenience #
gender_pronoun_choices = ['he/him/his','she/... | StarcoderdataPython |
9742322 | """"
This class will plot all waveforms that have been recorded. It reads the created pulses for each event
and plot the waveforms in a single plot
"""
import matplotlib as plt
import pax.plugins.plotting.Plotting
class ShowWaveforms(pax.PlotBase):
def PlotAllChannels(self, event):
fig, ax = plt.subplot... | StarcoderdataPython |
11391567 | <reponame>bkktimber/gluon-nlp<filename>tests/unittest/test_models.py
# coding: utf-8
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses thi... | StarcoderdataPython |
9755230 | <filename>chapter-8/code/pre-built-vision-ai.py
from google.cloud import vision
from google.cloud import translate_v2 as translate
# TODO: Change to your gcs bucket
GCS_BUCKET = "packt-data-eng-on-gcp-data-bucket"
GCS_URI = "gs://{}/chapter-8/chapter-8-example-text.jpg".format(GCS_BUCKET)
def detect_text(GCS_URI : st... | StarcoderdataPython |
11219253 | <reponame>sunbelbd/PaddleEBM
import os
import numpy as np
import scipy.io
from .builder import DATASETS
from .base_dataset import BaseDataset
@DATASETS.register()
class VoxelDataSet(BaseDataset):
"""Import voxel from mat files.
"""
def __init__(self, dataroot, data_size=100000, resolution=64, mode="train"... | StarcoderdataPython |
3574967 | '''
Reading file of graph & displaying by networkx
Created in 1. Oct. 2018 by JuneTech
'''
import json
import networkx as nx
def read_json_file(filename):
'''
Reads json file & returns networkx graph instance
'''
with open(filename) as f:
js_graph = json.load(f)
return nx.readwrite.json_gra... | StarcoderdataPython |
1631233 | <filename>tests/test_agent_genome.py
from ..nss.enviroments.Enviroment import Enviroment
from ..nss.agents.Agent import Agent
from ..nss.worlds.World import World
import itertools
import time
import copy
import numpy as np
def test_genome():
world = World(10,10)
np.random.seed(0)
env = Enviroment((100,10... | StarcoderdataPython |
1988452 | <gh_stars>0
#homework 11 main
import homework_11
from homework_11 import Student
from homework_11 import Course
from homework_11 import Enrollment
from homework_11 import Gradebook
student_record = homework_11.Gradebook()
keep_going = 'y'
while keep_going == 'y':
enrollment_id = int(input("please inp... | StarcoderdataPython |
11227518 | from FieldData import FieldData
import numpy as np
from math import sqrt
# fields = FieldData('U')
#
# U = fields.readFieldsData()['U']
#
# ccx, ccy, ccz, cc = fields.readCellCenterCoordinates()
#
# meshSize, cellSizeMin, ccx3D, ccy3D, ccz3D = fields.getMeshInfo(ccx, ccy, ccz)
#
# Uslice, ccSlice, sliceDim = fields.cr... | StarcoderdataPython |
1808928 | # -*- coding: utf-8 -*-
import numpy as np
import csv
###########
### I/O ###
###########
def find_path(file_name, directory="data", file_type=".csv"):
"""
input:
file name
file direcrtory
file type
find path for a file
if directory is not find, create a new one.
"""
im... | StarcoderdataPython |
132 | <filename>examples/first_char_last_column.py
#!/usr/bin/env python3
"""
For the last column, print only the first character.
Usage:
$ printf "100,200\n0,\n" | python3 first_char_last_column.py
Should print "100,2\n0,"
"""
import csv
from sys import stdin, stdout
def main():
reader = csv.reader(stdin)
w... | StarcoderdataPython |
3345426 | import openpyxl
import pandas as pd
REQUIRED_COLUMNS = ['<NAME>', 'Name', 'M/F', 'Field of Study', 'Nationality']
teaming_columns = ['1st', '2nd', 'Partner']
# Source: https://sashat.me/2017/01/11/list-of-20-simple-distinct-colors/
_colors = ['#e6194B', '#3cb44b', '#ffe119', '#4363d8', '#f58231', '#911eb4',
... | StarcoderdataPython |
6594608 | <reponame>TheaperDeng/anomalib<gh_stars>0
from pytorch_lightning import Trainer, seed_everything
from anomalib.config import get_configurable_parameters
from anomalib.core.callbacks import get_callbacks
from anomalib.data import get_datamodule
from anomalib.models import get_model
from tests.helpers.dataset import get... | StarcoderdataPython |
349450 | import socket
def ServerOnPort(Number_Port, Protocol):
ServiceName = socket.getservbyport(Number_Port, Protocol)
print("[+] port number %d : %s"%(Number_Port, ServiceName)) | StarcoderdataPython |
4886256 | <filename>timing.py
'''
Post-processing script that implements pause / gap transcription in terms
of both beats and absolute timing.
Part of the Gailbot-3 development project.
Developed by:
<NAME>
Tufts University
Human Interaction Lab at Tufts
Initial development: 6/6/19
'''
import sys,os
fro... | StarcoderdataPython |
6494456 |
def read_file_to_list(filename):
"""Read file to List"""
list = []
file = open(filename, "r")
for line in file:
policy , password = line.split(':')
range, character = policy.split(' ')
fromRange, toRange = range.split('-')
list.append(( int(fromRange), int(toRange), c... | StarcoderdataPython |
9721125 | <gh_stars>0
from builtins import object
import os.path
import threading
import time
class NightFilenameGen(object):
def __init__(self, rootDir='.',
seqnoFile='nextSeqno',
namesFunc=None,
filePrefix='TEST', fileSuffix="fits",
filePattern="%(filePr... | StarcoderdataPython |
187042 | # Algoritmos y Complejidad
# Profesor: <NAME>
# Alumno: <NAME>
import datetime as time
import numpy as np
from matplotlib import pyplot as plt
import AlgoritmosOrdenacion as sort
# Configuaracion
inicio = 0 # Tamano inicial del arreglo
aumento = 1 # Aumento del tamano del arreglo
tamMax = 1000001 # T... | StarcoderdataPython |
6550114 | <gh_stars>1-10
import click
from neoload_cli_lib import user_data
@click.command()
def cli():
"""Log out remove configuration file"""
user_data.do_logout()
print("logout successfully")
| StarcoderdataPython |
5000704 | import typing
import torch
from .base_trainer import BaseTrainer
from fba import logger, utils
class Trainer(BaseTrainer):
def __init__(
self,
generator: torch.nn.Module,
discriminator: torch.nn.Module,
EMA_generator: torch.nn.Module,
D_optimizer: torc... | StarcoderdataPython |
6575016 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
import django.db.models.deletion
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_US... | StarcoderdataPython |
4866644 | <filename>app/database/test.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import psycopg2
import sys
con = None
try:
con = psycopg2.connect("host='localhost' dbname='testdb' user='pythonspot' password='password'")
cur = con.cursor()
cur.execute("SELECT * FROM Products")
while True:
r... | StarcoderdataPython |
8193295 | import logging
import pandas as pd
from data.dataset import Metric
def match_jobs_to_node(jobs: pd.DataFrame, nodes: pd.DataFrame):
"""Match job information to node performance information and return a dataframe that contains the union of
the previous columns.
"""
all_job_nodes = jobs[Metric.HOST_N... | StarcoderdataPython |
5117615 | <filename>Scrapers/wiredReviewsScraper.py
import requests, time, csv, sqlite3
from bs4 import BeautifulSoup
from sqlite3 import Error
# Wired review object generated from web scrape
class WiredReview:
def __init__(self, phoneName, url):
self.phoneName = phoneName
self.url = url
... | StarcoderdataPython |
4990440 | from .passive_components import Filter
from .active_components import Amplifier
VALID_PASSIVE = [
'Filter',
'Attenuator',
'Mixer',
'Coupler',
'Tap',
'Splitter',
]
VALID_ACTIVE = [
'Amplifier',
'ActiveMixer',
'Switch',
]
VALID_COMPONENTS = VALID_PASSIVE + VALID_ACTIVE
def compone... | StarcoderdataPython |
11274040 |
class ProductCategoryMixin(object):
pass
class ProductMixin(object):
pass
class ProductDiscountMixin(object):
pass
class DiscountMixin(object):
pass
| StarcoderdataPython |
8082376 | import cv2
img = cv2.imread('/home/zhihaohe/Pictures/1.png')
cv2.imshow('a', img)
cv2.waitKey(0)
| StarcoderdataPython |
4854493 | #!/usr/bin/python
import re
from datetime import datetime
import ply.lex as lex
# ------------------------------------------------------------
# query_lexer.py
#
# tokenizer for log query expression
# ------------------------------------------------------------
class QueryLexer:
reserved = {
'in':'IN',
# ... | StarcoderdataPython |
11327056 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ik_links', '0005_auto_20170511_1909'),
]
operations = [
migrations.AddField(
model_name='authorlink',
... | StarcoderdataPython |
4989721 | import csv
import logging
import os
import pathlib
import re
import struct
import uuid
from contextlib import contextmanager
from operator import attrgetter
from os.path import commonprefix
from urllib.parse import unquote, urlsplit
from zipfile import ZipFile
import ijson
import jsonref
from django.conf import settin... | StarcoderdataPython |
109954 | <gh_stars>0
import os
import numpy as np
path = os.path.dirname(os.path.realpath(__file__))
def bingo(numbers:list, boards:list, play2loose:bool=False):
def play(boards, number):
for b in range(len(boards)):
for r in range(5):
for c in range(5):
if boards[b]... | StarcoderdataPython |
1654418 | import fimfic
import pprint
import json
session = fimfic.Session()
session.enable_mature()
session.infodump()
print("-------------")
URLs = [
"http://www.fimfiction.net/bookshelf/1364962/xeno",
"https://www.fimfiction.net/bookshelf/683004/favourites?view_mode=1",
]
#"https://www.fimfiction.net/bookshelf/6830... | StarcoderdataPython |
3329412 | <filename>python/get_results_v2.py
'''
Fire this sweet script in the directory of the measurement you want to have a look at
and get a bunch of nice videos back.
python get_results.py reference_frame [startframe endframe]
'''
__author__ = 'jhaux'
import cv2
import numpy as np
import os # getting the files
... | StarcoderdataPython |
3430496 | <reponame>FrancojFerrante/NLP-Labo<filename>.venv/Lib/site-packages/tools/google.py
# coding: utf-8
"""
Google parser.
Generic search algorithm:
With some query:
For page in 1...9999:
Build url for given query and page
Request the url
If captcha found:
S... | StarcoderdataPython |
3535350 | <reponame>Nasdaq/flask-data-pipes
import os
from urllib.parse import quote_plus as urlquote
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
DEBUG = False
USE_SIGNALS = True
BASE_DIR = basedir
DATA = os.getenv('DATA_DIR', os.path.join(BASE_DIR, 'appdata'))
DATA_FORMAT ... | StarcoderdataPython |
310807 | #author: akshitac8
from typing import no_type_check_decorator
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.optim as optim
import numpy as np
import util
from sklearn.preprocessing import MinMaxScaler
import sys
import copy
import pdb
class CLASSIFIER:
# train_Y is interger
... | StarcoderdataPython |
3385472 | <filename>test_hstore_field/models.py
from django.contrib import admin
from django.contrib.gis.admin import OSMGeoAdmin
from django.contrib.gis.db import models
from hstore_field import fields
class Item (models.Model):
name = models.CharField(max_length=64)
data = fields.HStoreField()
admin.site.register(Ite... | StarcoderdataPython |
1859467 | # -*- coding: utf-8 -*-
#! /usr/bin/python
"""
The imas-compatibility module of tofu
"""
import warnings
import traceback
import itertools as itt
try:
try:
from tofu.imas2tofu._core import *
from tofu.imas2tofu._mat2ids2calc import *
except Exception:
from ._core import *
from ... | StarcoderdataPython |
3491449 | <filename>examples/benchmark_tfmodel_ort.py
# SPDX-License-Identifier: Apache-2.0
"""
The following code compares the speed of tensorflow against onnxruntime
with a model downloaded from Tensorflow Hub.
"""
import time
import numpy
from tqdm import tqdm
import tensorflow_hub as hub
import onnxruntime as ort
def gene... | StarcoderdataPython |
3244086 | <reponame>ranjeethmahankali/galproject<gh_stars>1-10
import pygalfunc as pgf
import pygalview as pgv
pgv.set2dMode(True)
minpt = pgf.var_vec3((-1., -1., 0.))
maxpt = pgf.var_vec3((1., 1., 0.))
box = pgf.box3(minpt, maxpt)
npts = pgv.slideri32("Point count", 5, 50, 25)
cloud = pgf.randomPointsInBox(box, npts)
circ, ... | StarcoderdataPython |
8121392 | <reponame>jmshnds/eventstore_grpc
"""Reset projections."""
from eventstore_grpc.proto import projections_pb2, projections_pb2_grpc
def reset_projection(
stub: projections_pb2_grpc.ProjectionsStub, name: str, write_checkpoint: bool = True, **kwargs
) -> projections_pb2.ResetResp:
"""Resets a projection."""
... | StarcoderdataPython |
11255718 | """Integration tests for client library"""
from hil.flaskapp import app
from hil.client.base import ClientBase, FailedAPICallException
from hil.errors import BadArgumentError
from hil.client.client import Client
from hil.test_common import config_testsuite, config_merge, \
fresh_database, fail_on_log_warnings, serv... | StarcoderdataPython |
8135213 | #!/usr/bin/env python3.6
import random
from credential import Credential
from user import User
##credential
def create_credential(fname,lname,uname,pnumber,email,password):
'''
Function to create new credentials
'''
new_credential = Credential(fname,lname,uname,pnumber,email,password)
return new_... | StarcoderdataPython |
8023866 | from functools import reduce
def is_palindrome(n):
l = list(map(int, str(n)))
l2 = l[::-1]
def cheng(x, y):
return x * 10 + y
n1 = reduce(cheng, l2)
return n == n1
# 测试:
output = filter(is_palindrome, range(1, 1000))
print('1~1000:', list(output))
if list(filter(is_palindrome, range(1,... | StarcoderdataPython |
9799515 | #
# Copyright (C) 2012-2014 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distr... | StarcoderdataPython |
3583278 | #!/usr/bin/env python
from __future__ import print_function
from keras.losses import binary_crossentropy, sparse_categorical_crossentropy
from keras.losses import categorical_crossentropy, mean_squared_error
from keras.optimizers import SGD, Adam, Adadelta, Adagrad
from keras.optimizers import Adamax, RMSprop, Nadam
... | StarcoderdataPython |
6654866 | import bpy
import sys
width = 800
height = 600
n = 0
seed = 0
argv = sys.argv
argv = argv[argv.index("--") + 1:] # get all args after "--"
for scene in bpy.data.scenes:
scene.render.resolution_x = width
scene.render.resolution_y = height
scene.cycles.seed = seed
scene.render.filepath = argv[0]
... | StarcoderdataPython |
1939275 | <reponame>ankur-gupta/rain
from rain.module_three.submodule_one import function_three
from rain.module_three.submodule_two import function_four
| StarcoderdataPython |
3201841 | import pygame as pg
from highscore.highscore import *
from objects.chickenwindmil import *
from objects.ammo import *
from objects.predator import *
from objects.signpost import *
from objects.chickenforeground import *
from objects.trunk import *
from objects.pumpkin import *
from objects.plane import *
from objects... | StarcoderdataPython |
5024367 | """
This code is attributed to <NAME> (@kayzliu), <NAME> (@YingtongDou)
and UIC BDSC Lab
DGFraud-TF2 (A Deep Graph-based Toolbox for Fraud Detection in TensorFlow 2.X)
https://github.com/safe-graph/DGFraud-TF2
"""
import argparse
import numpy as np
import collections
from sklearn.metrics import accuracy_score
from tqd... | StarcoderdataPython |
5131902 | from django.core.checks import Critical, Warning, run_checks
from django.test import SimpleTestCase, override_settings
class AdminURLCheck(SimpleTestCase):
@override_settings(MYMONEY={"ADMIN_BASE_URL": ''})
def test_deploy_critical(self):
errors = self.get_filtered_msgs(
run_checks(includ... | StarcoderdataPython |
1704869 | <filename>python_lessons/MtMk_Test_Files/SublimeText_Test.py
print("Hallo neuer User.")
myString = input("Bitte gebe deinen Namen ein: ")
print("Hallo neuer User, dein Name ist " + myString)
print("-------------------------------------")
| StarcoderdataPython |
11218677 | n, k, x = map(int, input().split())
rangers = list(map(int, input().split()))
for i in range(min(k, 8 + (k & 3))):
rangers.sort()
rangers = [rangers[i] if (i & 1) else rangers[i] ^ x for i in range(n)]
print(rangers)
rangers.sort()
print(rangers[-1], rangers[0]) | StarcoderdataPython |
4831080 | from evaluate import get_env, get_state_action_size, evaluate
from policy import NeuroevoPolicy
from argparse import ArgumentParser
import logging
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument('-e', '--env', help='environment', default='small', type=str)
parser.add_argument('--re... | StarcoderdataPython |
125725 | <filename>Python/Algorithms/selection_sort.py
def selection_sort(arr):
for num in range(0, len(arr)):
min_position = num
for i in range(num, len(arr)):
if arr[i] < arr[min_position]:
min_position = i
temp = arr[num]
arr[num] = arr[min_position]
arr[min_position] = temp
arr = [6, 3, 8, 5, 2, 7, 4, 1]... | StarcoderdataPython |
1791363 | <gh_stars>10-100
import unittest
from pygsti.forwardsims.mapforwardsim import MapForwardSimulator
import pygsti
from pygsti.modelpacks import smq1Q_XY
from ..testutils import BaseTestCase
class LayoutTestCase(BaseTestCase):
def setUp(self):
super(LayoutTestCase, self).setUp()
self.circuits = py... | StarcoderdataPython |
155185 | <filename>tally_ho/libs/models/enums/clearance_resolution.py
from django_enumfield import enum
from django.utils.translation import ugettext_lazy as _
class ClearanceResolution(enum.Enum):
EMPTY = 0
PENDING_FIELD_INPUT = 1
PASS_TO_ADMINISTRATOR = 2
RESET_TO_PREINTAKE = 3
labels = {
EMPTY:... | StarcoderdataPython |
6447559 | import os
# Non-Flask, SQLAlchemy, lib stuff, just for our use!
basedir = os.path.abspath(os.path.dirname(__file__))
# General settings
debug = True
host = '0.0.0.0'
port = 5000
# Path to stat files. Default value MUST be changed.
STATS_DIR = os.path.join(basedir, 'test-statfiles')
# This is where files get moved to... | StarcoderdataPython |
6695491 | #!/usr/bin/env python3
'''
$ wget https://github.com/PheWAS/PheWAS/blob/master/data/phemap.rda
$ wget https://github.com/PheWAS/PheWAS/blob/master/data/pheinfo.rda
$ r
> load('phemap.rda')
> load('pheinfo.rda')
> write.csv(phemap, 'phemap.csv', row.names=F)
> write.csv(pheinfo, 'pheinfo.csv', row.names=F)
# found thi... | StarcoderdataPython |
8176791 | <filename>services/fuse/tests/test_token_expiry.py
import apiclient
import arvados
import arvados_fuse
import logging
import mock
import multiprocessing
import os
import re
import sys
import time
import unittest
from .integration_test import IntegrationTest
logger = logging.getLogger('arvados.arv-mount')
class Token... | StarcoderdataPython |
6516268 | #!python
import string
# Hint: Use these string constants to ignore capitalization and/or punctuation
# string.ascii_lowercase is 'abcdefghijklmnopqrstuvwxyz'
# string.ascii_uppercase is 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
# string.ascii_letters is ascii_lowercase + ascii_uppercase
def is_palindrome(text):
"""A string ... | StarcoderdataPython |
4903054 | from pathlib import Path
from fhir.resources.codesystem import CodeSystem
from oops_fhir.utils import CodeSystemConcept
__all__ = ["v3CodingRationale"]
_resource = CodeSystem.parse_file(Path(__file__).with_suffix(".json"))
class v3CodingRationale:
"""
v3 Code System CodingRationale
Identifies how t... | StarcoderdataPython |
1747211 | <filename>twitter_api_v2/TwitterAPI.py
import json
import logging
from logging import Logger
from typing import Dict, List, Optional
import requests
from requests.models import Response
from twitter_api_v2 import Media, Poll, Tweet, User
logger: Logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
c... | StarcoderdataPython |
144416 | import copy, os
import tensorflow as tf
import numpy as np
from lib.tf_ops import shape_list, spacial_shape_list, tf_tensor_stats, tf_norm2, tf_angle_between
from lib.util import load_numpy
from .renderer import Renderer
from .transform import GridTransform
from .vector import GridShape, Vector3
import logging
... | StarcoderdataPython |
330492 | from . import config
from lxml import etree
from lxml.builder import E
class Request(object):
def __init__(self, type):
self.tree = (
E.request({'type': type},
E.type_os(config.type_os),
E.client_version(config.client_version)
)
)
self.form = {}
def add_members(self, members):
for key, value i... | StarcoderdataPython |
125701 | from threading import Thread
from time import sleep
def tf(arg):
for i in range(arg):
print "running"
sleep(1)
if __name__ == "__main__":
thread = Thread(target = tf, args = (5, ))
thread.start()
# parallel
for i in range(6):
print "continuing"
sleep(1)
thread.... | StarcoderdataPython |
8000455 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import panflute as pf
import subprocess
from subprocess import PIPE
import os.path as p
import os
import sys
import io
os.chdir(p.dirname(p.dirname(__file__)))
in1 = '$1-1$'
out1 = '$1+1markdown$'
out1err = 'panflute: data_dir={dd} sys_path={sp}'
in1a = ... | StarcoderdataPython |
1722984 | <filename>salt/modules/django.py
import os
def _get_django_admin(bin_env):
if not bin_env:
da = 'django-admin.py'
else:
# try to get pip bin from env
if os.path.exists(os.path.join(bin_env, 'bin', 'django-admin.py')):
da = os.path.join(bin_env, 'bin', 'django-admin.py')
... | StarcoderdataPython |
9749922 | from __future__ import absolute_import
from __future__ import division
from builtins import range
from past.utils import old_div
import time
import numpy as np
from pomdpy.util import console
from pomdpy.action_selection import ucb_action
from .belief_tree_solver import BeliefTreeSolver
module = "pomcp"
class POMCP(... | StarcoderdataPython |
4802682 | def is_palindromic(s):
ss = s[::-1]
return s == ss
inf = 100000000
upper = 100004
ans = 0
for start in range(1, upper):
cur = 0
yes = 0
for i in range(start, upper):
if cur > 0:
yes = 1
cur += i * i
if cur >= inf:
break
if yes and is_palindromic(str(cur)):
ans += cur
print(ans)
#2906969179 | StarcoderdataPython |
4942060 | import logging
from pgevents import data_access, event_stream, constants
from pgevents.utils import timestamps
LOGGER = logging.getLogger(__name__)
def always_continue(app):
return True
class App:
def __init__(self, dsn, channel, interval=5, migration_locations=None):
self.dsn = dsn
self.c... | StarcoderdataPython |
5095930 | from django.urls import path
from .views import ProfileViewSet
profile = ProfileViewSet.as_view({
'get': 'retrieve',
'patch': 'update'
})
profile_list = ProfileViewSet.as_view({
'get':'list'
})
urlpatterns = [
path('profile/<int:pk>/', profile, name="profile"),
path('profile/', profile_list, na... | StarcoderdataPython |
1927166 | <filename>infobip_channels/email/models/body/update_tracking_events.py
from typing import Optional
from pydantic import StrictBool
from infobip_channels.core.models import MessageBodyBase
class UpdateTrackingEventsMessageBody(MessageBodyBase):
open: Optional[StrictBool] = None
clicks: Optional[StrictBool] =... | StarcoderdataPython |
1791144 | # -*- coding:utf-8 -*-
"""
-------------------------------------------------------------------------------
Project Name : ESEP
File Name : base.py
Start Date : 2022-03-25 07:45
... | StarcoderdataPython |
3248880 | <reponame>JumpingYang001/tornadis
from tornado.ioloop import IOLoop
from tornado.web import RequestHandler, Application, url
import tornado.gen
import tornadis
import logging
logging.basicConfig(level=logging.WARNING)
POOL = tornadis.ClientPool(max_size=15)
class HelloHandler(RequestHandler):
@tornado.gen.corou... | StarcoderdataPython |
3253859 | from .base import FileOutputTemplate, FileOutput
from .collection import FileOutputCollectionTemplate, FileOutputCollection
from .copy import CopyFileOutputTemplate, CopyFileOutput
from .general import FileOutputType, load_output_template
from .tag import TagFileOutputTemplate, TagFileOutput
| StarcoderdataPython |
9704315 | #!/usr/bin/env python
#coding:utf-8
L=['Michael', 'Sarah', 'Tracy']
r=[]
n=3
for i in range(n):
r.append(L[i])
print r
print L[0:3]
print L[-1:]
print L[-2:-1]
print L[-2:]
L=range(100)
print L
print L[-10:]
T=(0,1,2,3,4,5)
print T[-3:]
print 'ABCDEFG'[:3]
| StarcoderdataPython |
8118317 | <gh_stars>1000+
import json
from django.core import mail
from django.test.utils import override_settings
from hc.api.models import Channel, Check
from hc.test import BaseTestCase
class EditEmailTestCase(BaseTestCase):
def setUp(self):
super().setUp()
self.check = Check.objects.create(project=se... | StarcoderdataPython |
256431 | <reponame>smk4664/nautobot-plugin-ansible-runner<filename>ansible_runner/tests/__init__.py
"""Unit tests for ansible_runner plugin."""
| StarcoderdataPython |
248956 | # ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.3'
# jupytext_version: 0.8.6
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
import numpy as np
from numpy import dot
from numpy.lin... | StarcoderdataPython |
1845411 | #!/bin/env python
"""
The MIT License
Copyright (c) 2010 The Chicago Tribune & Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the ... | StarcoderdataPython |
4811034 | <gh_stars>0
from rest_framework import serializers
from web.datasets.models import CityCouncilAgenda
class CityCouncilAgendaSerializer(serializers.ModelSerializer):
class Meta:
model = CityCouncilAgenda
fields = "__all__"
| StarcoderdataPython |
5047978 | from setuptools import setup
import os
setup(
name='pygraphblas',
version='5.1.5.1',
description='GraphBLAS Python bindings.',
author='<NAME>',
packages=['pygraphblas'],
setup_requires=["pytest-runner"],
install_requires=["suitesparse-graphblas", "numba", "scipy", "contextvars"],
)
| StarcoderdataPython |
399666 | <reponame>leonardogian/CANA<filename>cana/datasets/bools.py
# -*- coding: utf-8 -*-
"""
Boolean Nodes
=================================
Commonly used boolean node functions.
"""
# Copyright (C) 2017 by
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# All rights reserved.
# MIT license.
from .. boolean_network import... | StarcoderdataPython |
1689669 | import iyzipay
options = {
'base_url': iyzipay.base_url
}
api_test = iyzipay.ApiTest().retrieve(options)
print(api_test.body)
| StarcoderdataPython |
329864 | <gh_stars>0
"""
Edge Examples
"""
import sys, os
thisPath = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.abspath(os.path.join(thisPath,"..")))
from ExampleBuilders.ExampleBuilder import ExampleBuilder
from Core.IdSet import IdSet
import Core.ExampleUtils as ExampleUtils
from FeatureBuilders.Multi... | StarcoderdataPython |
4934030 | <gh_stars>0
# import torch
# import torch.nn as nn
# from torch.nn import functional as F
# import copy
# import math
##### Variables to set for RCERM #####
queue_sz=7 # the memory module/ queue size
# tau = 0.05 # temperature parameter in the objective
# momentum = 0.999 # theta in momentum encoding step
train_queue... | StarcoderdataPython |
3250216 | <gh_stars>0
import random
class Queue:
def __init__(self):
self.__queue = []
self.__len_queue = 0
def enqueue(self, e):
self.__queue.append(e)
self.__len_queue += 1
def dequeue(self):
if not self.empty():
self.__queue.pop(0)
self.__len_queu... | StarcoderdataPython |
11232148 | <filename>tagcloud/__init__.py
import os
import string
from tagcloud.lang.counter import get_tag_counts, sum_tag_counts
from tagcloud.font_size_mappers import linear_mapper, logarithmic_mapper
import codecs
def html_links_from_tags(tags, data_weight = 'dataWeight', top = 0):
'''Creates a bunch of html links with... | StarcoderdataPython |
252363 | <gh_stars>1-10
from wagtail.core import blocks
from wagtail.core.blocks import RichTextBlock, PageChooserBlock
from wagtail.core.rich_text import expand_db_html
from wagtail.images.blocks import ImageChooserBlock
from falmer.content.serializers import WagtailImageSerializer
from falmer.content.utils import get_public_... | StarcoderdataPython |
247616 | from pathlib import Path
from fhir.resources.codesystem import CodeSystem
from oops_fhir.utils import CodeSystemConcept
__all__ = ["v3ContainerSeparator"]
_resource = CodeSystem.parse_file(Path(__file__).with_suffix(".json"))
class v3ContainerSeparator:
"""
v3 Code System ContainerSeparator
A mater... | StarcoderdataPython |
11311438 | <gh_stars>10-100
from __future__ import division, absolute_import, print_function
import time
from integration_test import *
class ScanRecordTimeoutTestCase(IntegrationTest):
def testCase(self, badge, logger):
badge.start_recording(timeout_minutes=1)
badge.start_scanning(timeout_minutes=1)
status = badge.get_s... | StarcoderdataPython |
11234959 | <gh_stars>1000+
# For django 1.x
class View:
pass
| StarcoderdataPython |
148980 | """Provide XBlock urls"""
from django.conf.urls import url
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from workbench import views
admin.autodiscover()
urlpatterns = [
url(r'^$', views.index, name='workbench_index'),
url(
r'^scenario/(?P<sce... | StarcoderdataPython |
1723333 | from typing import Optional
from .data import AttributesModel
class SshKeyModel(AttributesModel):
name: Optional[str]
value: Optional[str]
| StarcoderdataPython |
4822991 | from zerver.context_processors import get_zulip_version_name
from zerver.lib.test_classes import ZulipTestCase
class TestContextProcessors(ZulipTestCase):
def test_get_zulip_version_name(self) -> None:
self.assertEqual(get_zulip_version_name("4.0-dev+git"), "Zulip 4.0-dev")
self.assertEqual(get_zu... | StarcoderdataPython |
3507665 | """
Tree evaluation and rollback
"""
from smart_choice.decisiontree import DecisionTree
from smart_choice.examples import stguide, stbook, oil_tree_example
from tests.capsys import check_capsys
def test_stguide_fig_5_6a(capsys):
"""Fig. 5.6 (a) --- Evaluation of terminal nodes"""
nodes = stguide()
tree... | StarcoderdataPython |
3538056 | # Copyright 2019-2019 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fil... | StarcoderdataPython |
6422013 | <gh_stars>0
from django.contrib import admin
# Register your models here.
from unesco.models import Site, Category, State,Iso,Region
admin.site.register(Site)
admin.site.register(Category)
admin.site.register(State)
admin.site.register(Iso)
admin.site.register(Region)
| StarcoderdataPython |
111731 | <reponame>bkmrk/bkmrk<filename>bkmrk/__init__.py<gh_stars>1-10
from flask import Flask
from flask_bootstrap import Bootstrap
from flask_login import LoginManager
from flask_mail import Mail
from flask_migrate import Migrate
from flask_moment import Moment
from flask_sqlalchemy import SQLAlchemy
from .config import Con... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.