id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
87775
<filename>drawing_challenge_bot/challenge_poster.py import logging from datetime import datetime from typing import List from nio import AsyncClient from praw import Reddit from praw.reddit import Submission from drawing_challenge_bot.chat_functions import send_text_to_room from drawing_challenge_bot.config import Co...
StarcoderdataPython
1602983
from typing import List from contextlib import closing from flask import g class Pipeline: """Pipeline config""" def __init__(self, id : int = 0, name : str = "", description : str = "", setts : str = "{}"): self.id = id self.name = name ...
StarcoderdataPython
161118
# Ejercicio 6 # Al realizar una consulta en un registro hemos obtenido una cadena de texto corrupta al revés. # Al parecer contiene el nombre de un alumno y la nota de un exámen. # ¿Cómo podríamos formatear la cadena y conseguir una estructura como la siguiente? # Nombre Apellido ha sacado un Nota de nota. cadena = "ze...
StarcoderdataPython
142942
# This file was automatically generated by SWIG (http://www.swig.org). # Version 3.0.12 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. from sys import version_info as _swig_python_version_info if _swig_python_version_info >= (2, 7, 0): def swig_im...
StarcoderdataPython
1654986
<reponame>mpillar/codeeval import sys # Determined by the input/output samples. mapping = { 'a': 'y', 'b': 'h', 'c': 'e', 'd': 's', 'e': 'o', 'f': 'c', 'g': 'v', # guess 'h': 'x', # guess 'i': 'd', 'j': 'u', 'k': 'i', 'l': 'g', 'm': 'l', 'n': 'b', 'o': 'k', ...
StarcoderdataPython
1761617
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Nov 16 17:13:22 2019 @author: atekawade Task: Run 3D segmenter on an arbitrarily sized CT dataset. Algorithm Description: run_segmenter.py is optimized for minimal use of disk r/w actions, when datasets are smaller or you have lots of RAM. As a thumb-r...
StarcoderdataPython
1624706
import math from collections import OrderedDict from functools import partial import torch.nn as nn import torch from torch.nn import Module as Module from src.models.tresnet.layers.anti_aliasing import AntiAliasDownsampleLayer from .layers.avg_pool import FastGlobalAvgPool2d from src.models.tresnet.layers....
StarcoderdataPython
1701846
import asyncio import datetime import enum import logging import unittest import os from unittest import mock import pyemit.emit as e from pyemit.remote import Remote from tests.helper import async_test logger = logging.getLogger(__name__) logging.basicConfig(level=logging.INFO) _received_test_decorator_msgs = 0 ...
StarcoderdataPython
1653601
# Program do obliczenia wartości lokaty z roczną kapitalizacją initial_value = 2000 # To też jest komentarz percentage = 5 years = 7 # Wartość lokaty obliczana zgodnie z wzorem na procent składany final_value = initial_value * (1 + percentage / 100) ** years print("Po", years, "latach Twoja lokata będzie warta", fi...
StarcoderdataPython
3211362
import bw2data as bd import bw2calc as bc import bw2io as bi import numpy as np from pathlib import Path from gsa_framework.utils import read_pickle, write_pickle from consumption_model_ch.consumption_fus import get_archetypes_scores_per_sector import plotly.graph_objects as go from plotly.subplots import make_subplots...
StarcoderdataPython
3387641
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('timetable', '0001_initial'), ] operations = [ migrations.CreateModel( name='LecturerA', fields=[ ('id', model...
StarcoderdataPython
151945
from tgbot import plugintest, pluginbase from tgbot.botapi import Message from sample_plugin import TestPlugin import threading import time class IssuesTest(plugintest.PluginTestCase): def setUp(self): self.plugin = TestPlugin() self.bot = self.fake_bot('', plugins=[self.plugin]) def test_us...
StarcoderdataPython
1784401
class TrainSchedule: def __init__(self, basic_record): self.basic_record = basic_record self.origin_record = None self.intermediate_records = [] self.termination_record = None def add_record(self, record): transaction_type = record['type'] if transaction_type ==...
StarcoderdataPython
1682152
<reponame>ourobouros/scrapers from .paste import Pastebin from .paste import Pastie # from .paste import Site from .paste import Slexy
StarcoderdataPython
94042
#!/usr/bin/env python # -*- coding: utf-8 -*- """Generates one ISO14443-A anti-collision process "by-hand" """ from __future__ import print_function import nfc MAX_FRAME_LEN = 264 abtRawUid = bytes(12) abtAtqa = bytes(2) abtAts = bytes(MAX_FRAME_LEN) szAts = 0 szCL = 1 quiet_output = False force_rats = False timed...
StarcoderdataPython
3252877
import re import sys from functools import reduce, partial from itertools import dropwhile, groupby, chain class Token: def __init__(self, name, value=None, start=None, end=None, pos=None): self.name = name self.value = value self.start = start self.end = end self.pos = pos ...
StarcoderdataPython
3298992
<gh_stars>0 from django.contrib import admin from .models import Category, Tag, Article admin.site.register(Category) admin.site.register(Tag) class ArticleAdmin(admin.ModelAdmin): list_display = ('user', 'title','public','cover_page','in_home') list_filter = ('user','tag','category','public','cover_page','in...
StarcoderdataPython
3322249
<gh_stars>0 # -*- coding:utf-8 -*- import logging import random import mxnet as mx import numpy as np logging.getLogger().setLevel(logging.DEBUG) n_simple = 1000 batch_size = 1 learning_rate = 0.1 n_epoch = 1 train_in = [[random.uniform(0, 1) for c in range(2)] for n in range(n_simple)] train_out = [0 for n in range...
StarcoderdataPython
4804796
<gh_stars>1-10 __version__ = '1.0.0-rc.1' __author__ = '<NAME>, <NAME>, <NAME>, <NAME>' import argparse import pandas as pd import torch from rate_severity_of_toxic_comments.model import create_model from rate_severity_of_toxic_comments.utilities import parse_config, process_config DEFAULT_CONFIG_FILE_PATH = 'con...
StarcoderdataPython
77782
<gh_stars>1-10 from coffea.nanoevents.schemas import BaseSchema from coffea.nanoevents.schemas import zip_forms, nest_jagged_forms class DummySchema(BaseSchema): mixins = { 'Electron': "PtEtaPhiMLorentzVector", 'Muon': 'PtEtaPhiMLorentzVector', 'Jet': 'PtEtaPhiELorentzVector', 'Subjet': 'PtEt...
StarcoderdataPython
3213875
<filename>Coursework/classUndoStack.py<gh_stars>1-10 class MyStack(): def __init__(self): self.size = 5 self.stack = [0 for i in range(self.size)] self.front = -1 self.inStack = 0 def add(self,item): if self.front != self.size-1: if self.inStack < 5:...
StarcoderdataPython
29553
<gh_stars>0 #!/usr/bin/env python3 """Utilities for dealing with .strings files""" import re from typing import List, Match, Optional, TextIO, Tuple, Union from dotstrings.dot_strings_entry import DotStringsEntry _ENTRY_REGEX = r'^"(.+)"\s?=\s?"(.*)";$' _ENTRY_PATTERN = re.compile(_ENTRY_REGEX) _NS_ENTRY_REGEX = ...
StarcoderdataPython
84758
<reponame>AshtonIzmev/covid-19-pandemic-simulation import random import psutil import ray from scenario.helper.scenario import get_zero_stats, get_zero_stats_variant from simulator.constants.keys import nrun_key, nday_key, nvariant_key from simulator.helper.plot import print_progress_bar from scenario.helper.progress...
StarcoderdataPython
153966
# Imports from __future__ import print_function import numpy as np from sklearn.preprocessing import StandardScaler from sklearn.linear_model import Ridge, Lasso, SGDRegressor, ElasticNet, LinearRegression from sklearn.multioutput import MultiOutputRegressor from sklearn.metrics import mean_squared_error import matplot...
StarcoderdataPython
108736
from typing import List def solution1(data: List[str]) -> str: # https://codeforces.com/blog/entry/72593 a = 1 b = 0 m = 10007 for instruction in data: if instruction == "deal into new stack": a *= -1 b *= -1 b -= 1 elif "cut" in instruction: ...
StarcoderdataPython
1718726
<gh_stars>0 class Solution: def isValidBST(self, root: Optional[TreeNode]) -> bool: inorder = self.dfs(root) return inorder == list(sorted(set(inorder))) def dfs(self, node): if not node: return [] return self.dfs(node.left) + [node.val] + self.dfs(node.right)
StarcoderdataPython
4827872
<reponame>jacobolofsson/xmlformatter import io import os import unittest import xmlformatter import shutil class TestXmlFormatter(unittest.TestCase): def readfile(self, path): fh = io.open(path, "rb") text = fh.read() fh.close() return text def test_pretty(self): self.formatter = xmlformatter.Formatter(...
StarcoderdataPython
3384247
""" Package for JobMatch. """
StarcoderdataPython
178066
<reponame>mariecpereira/Extracao-de-Caracteristicas-Corpo-Caloso<filename>deliver/functions_will/differ.py # -*- encoding: utf-8 -*- def differ(a,b): return a-b
StarcoderdataPython
137708
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
StarcoderdataPython
3392372
from __future__ import unicode_literals from django_social.facebook.api import get_user_photo class FacebookConnection(object): """ Represents a facebook user connection. :param user_id: the user id for the connection (related to the specific social connection type) :param name: name of the ...
StarcoderdataPython
63825
from denoising_diffusion_pytorch.denoising_diffusion_pytorch import GaussianDiffusion, Unet, Trainer, Dataset_traj, cycle, num_to_groups
StarcoderdataPython
195266
from aws_cdk.aws_ec2 import SubnetType from aws_cdk import ( aws_ec2 as ec2, aws_autoscaling as autoscaling, aws_elasticloadbalancingv2 as elbv2, core ) class ASGStack(core.Stack): def __init__(self, scope: core.Construct, id: str, props, **kwargs) -> None: super().__init__(scope, id,...
StarcoderdataPython
1690262
import os,sys import numpy as np import pandas as pd from matplotlib import pyplot as plt from analysis import subset_probas import plotly.graph_objects as go fewlabels = ['Applause', 'Bird vocalization, bird call, bird song', 'Caw', 'Bee, wasp, etc.', 'Wind noise (microphone)','Rain','Vehicle','Silence'] def aver...
StarcoderdataPython
54254
ffrom sympy import * # import MatrixCiphers from MatrixCiphers import * from Cryptoalpha import * print("-"*50) print("Testing Hill Codes") code1 = Cryptoalpha("ABCDEFGHIJKLMNOPQRSTUVWXYZ!' ") plaintext = "Don't Mine at Night!" E = Matrix([[4,19],[13,10]]) ciphertext = encrypt(E, plaintext, code1) print("'%s' encodes ...
StarcoderdataPython
3297347
import os import sys import json import groupy from groupy import Group, attachments # Bot groupy.config.KEY_LOCATION = "/.groupy.key" # from urllib.parse import urlencode # from urllib.request import Request, urlopen from flask import Flask, request app = Flask(__name__) gID = 2336797 @app.ro...
StarcoderdataPython
160630
<gh_stars>0 from sklearn.model_selection import cross_val_score from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split from sklearn.neighbors import KNeighborsClassifier import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt # 加载数据 iris = load_iris() X = iris.data ...
StarcoderdataPython
101405
<filename>handybelt/pdf2img/__main__.py from pdf2image import convert_from_path import argparse import os import imageio import numpy as np import subprocess from cleartempfiles.__main__ import cleartempfiles from crop.__main__ import crop def main(**kwargs): filename = kwargs['filename'] dpi = kwargs['dpi'] ...
StarcoderdataPython
23832
<gh_stars>0 """Top-level package for z2z Metadata analysis.""" __author__ = """Isthmus // <NAME>""" __email__ = '<EMAIL>' __version__ = '0.0.1'
StarcoderdataPython
98156
# Copyright 2021, 2022 IBM Corporation # # 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 ...
StarcoderdataPython
3397429
import csv import sys with open(str(sys.argv[1])) as fin: reader = csv.DictReader(fin) output = 'No,Latitude,Longitude,Speed,Date,Time\n' # iterate and write rows based on condition for row in reader: if (row['Speed'] != ''): if float(row['Speed']) < int(sys.argv[2]): output += row['No'] + ',' + row['Lat...
StarcoderdataPython
101227
<reponame>achalpatel/thenewboston-python from thenewboston.accounts.manage import create_account from thenewboston.verify_keys.verify_key import encode_verify_key def random_encoded_account_number(): signing_key, account_number = create_account() return encode_verify_key(verify_key=account_number)
StarcoderdataPython
1657329
<reponame>PapStatMechMat/SeaPy<filename>Tutorials/predict.py import tensorflow as tf import numpy as np import os,glob,cv2 import sys,argparse parser = argparse.ArgumentParser() parser.add_argument("--filepath",help="image file path for prediction purposes...") parser.add_argument("--trainpath",help="directory where t...
StarcoderdataPython
3311902
<filename>h5sh/commands/base.py # -*- coding: utf-8 -*- """Registry of available commands.""" from __future__ import (division, absolute_import, print_function, ) #-----------------------------------------------------------------------------# from .miniargparse import MiniArgParser, MiniSystemExit class Command(obj...
StarcoderdataPython
184318
<filename>psm/lake/sensor_carbonate.py import numpy def carb_sensor(LST, d18Ow, isoflag = -1, model = 'ONeil'): ''' SENSOR SUB-MODEL for Carbonate Proxy Data:Calculation of carbonate isotopic ratio based on background d18O_w and temp. INPUTS: LST: LAKE SURFACE TEMPERATURE (C) d18Ow: d18O of lake wat...
StarcoderdataPython
1787318
<filename>9/9B.py j = open('input.txt').read().strip() r = 0 def css(s): if "(" not in s: return len(s) r = 0 while "(" in s: r += s.find("(") s = s[s.find("("):] m = s[1:s.find(")")].split("x") s = s[s.find(")") + 1:] r += css(s[:int(m[0])]) * int(m[1]) ...
StarcoderdataPython
126544
from django.db import models from django.core.exceptions import ValidationError from django.utils.text import slugify from django.utils.translation import gettext_lazy as _ import os from ecommerce.utils import BaseModel from accounts.models import User from store.managers import CategoryManager, TagManager class St...
StarcoderdataPython
3335003
import bitstring def revbits8(n): return int('{:08b}'.format(n)[::-1], 2) def revbits4(n): return int('{:04b}'.format(n)[::-1], 2) def revnib(n): return ((n & 0xF) << 4) | ((n >> 4) & 0xF) def munge(n): return (revbits4(n & 0xF) << 4) | revbits4((n >> 4) & 0xF) def getbits_bin(f): return bitstr...
StarcoderdataPython
1646060
<filename>instrumentserver/testing/dummy_instruments/rf.py import numpy as np from scipy import constants from qcodes import Instrument, ParameterWithSetpoints, find_or_create_instrument from qcodes.utils import validators class ResonatorResponse(Instrument): """A dummy instrument that generates the response of...
StarcoderdataPython
34544
<filename>mediawikiapi/config.py import requests from datetime import timedelta from .language import Language class Config(object): """ Contains global configuration """ DEFAULT_USER_AGENT = 'mediawikiapi (https://github.com/lehinevych/MediaWikiAPI/)' DONATE_URL = 'https://donate.wikimedia.org/w/index.php?...
StarcoderdataPython
1726007
# Copyright 2022 The Symanto Research Team Authors. # # 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...
StarcoderdataPython
1629520
<reponame>Olegt0rr/aioYouTrack from collections import defaultdict from xml.etree import cElementTree async def parse_xml(xml_data) -> dict: """ Parses data from string xml to Element Tree Then convert data to dict and return :param xml_data: :return: """ element_tree = cElementTree.XML(x...
StarcoderdataPython
3251058
<reponame>ylsung/VL_adapter import torch.backends.cudnn as cudnn import torch.multiprocessing as mp import torch.distributed as dist from torch.nn.parallel import DistributedDataParallel as DDP import os import collections from pathlib import Path from packaging import version import numpy as np from tqdm import tqdm...
StarcoderdataPython
3566
from __future__ import absolute_import, division, print_function from builtins import (bytes, str, open, super, range, zip, round, input, int, pow, object, map, zip) __author__ = "<NAME>" import numpy as np from astropy import wcs from bokeh.layouts import row, widgetbox,gridplot from bokeh...
StarcoderdataPython
51309
<reponame>c43721/Algorithms<filename>python/search/bfs.py<gh_stars>0 queue = [] visited = [] def bfs(visited, graph, start, target): visited.append(start) queue.append(start) while queue: cur = queue.pop(0) if cur == target: break for child in graph[cur]: i...
StarcoderdataPython
83390
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # Name: common/decorators.py # Purpose: Decorators for functions # # Authors: <NAME> # <NAME> # # Copyright: Copyright © 2009-2015 <NAME> and the music21 Project # License: BS...
StarcoderdataPython
1616962
<filename>extract_cnut.py import codecs import os import game from hacktools import common def run(): infolder = "data/extract/data/Rom/event/script/" outfile = "data/cnut_output.txt" common.logMessage("Extracting CNUT to", outfile, "...") with codecs.open(outfile, "w", "utf-8") as out: files...
StarcoderdataPython
3226150
<gh_stars>0 from cosivina.base import * elementSpec = [] class Element(object): ''' Base class for elements. ''' def __init__(self, label): self.label = label self.parameters = {} self.components = {} self.defaultOutputComponent = '' self.inputElementLabels = [] ...
StarcoderdataPython
4832732
<reponame>borissimkin/moneykeeper-bot import datetime import telegram from telegram import Update, ReplyKeyboardRemove, ReplyKeyboardMarkup from telegram.ext import CallbackContext, MessageHandler, CommandHandler, ConversationHandler, Filters from bot import bot, config, session from bot.buttons import Buttons from b...
StarcoderdataPython
3320767
<filename>blcalc/solver.py """ Apply appropriate method based on data provided """ from enum import Enum from .assembly import AssemblyType from .footing import FootingType, FootingData from .material import MaterialData from .methods.terzaghi import Terzaghi from .methods.meyerhof import Meyerhof from .methods.hansen...
StarcoderdataPython
192192
<filename>mindapp/urls.py<gh_stars>1-10 from django.urls import path from . import views urlpatterns = [ path('',views.index, name="index"), path('level',views.answer, name="situation"), path('leaderboard',views.leaderboard,name="leaderboard"), path('rules',views.rules,name="rules"), path('logout',...
StarcoderdataPython
1608642
<reponame>ahmednofal/grr #!/usr/bin/env python """Library for client code signing.""" from __future__ import absolute_import from __future__ import unicode_literals import io import logging import os import platform import subprocess import tempfile # pexpect cannot be installed on windows, and this code is only des...
StarcoderdataPython
116502
<filename>adventofcode2018/15.py class Player: def __init__(self, type_): self.hp = 200 self.type = type_ def combat_simulation(f): map = [] players = [] for line in f.readlines(): row = [] for c in line.strip(): if c == '#': row.append(Fal...
StarcoderdataPython
87370
<filename>hatfieldcmr/ingest/__init__.py from .name import format_object_name from .push import AbstractStorageClientWrapper #from .gcs import GCSClientWrapper from .local import LocalStorageWrapper from .ingest_exception import IngestException
StarcoderdataPython
3377721
<filename>Plugins/GUI/File_Viewer_Window/__init__.py<gh_stars>10-100 ''' Widget(s) for viewing generated tables holding x4 data, and editing the contents. ''' # Top import for qt. from .File_Text_Brower import File_Text_Brower from .File_Viewer_Window import File_Viewer_Window
StarcoderdataPython
1632844
<gh_stars>10-100 import paramiko import time from typing import List class BaseSSH: def __init__(self, ip: str, username: str, password: str) -> None: self.ip = ip self.username = username self.password = password self._MAX_READ = 10000 client = paramiko.SSHClient() ...
StarcoderdataPython
1621419
import sqlite3 import sys import random def ran(): return str(random.randint(0, 1000000)) def rand_vals(): return [(ran(), ran(), ran(), ran()) for i in xrange(10000)] def execmany(): db = sqlite3.connect('test.db') c = db.cursor() c.executemany('''INSERT INTO execmany(name, phone, email, passwo...
StarcoderdataPython
197743
<gh_stars>0 import requests from bs4 import BeautifulSoup import pprint res = requests.get('https://news.ycombinator.com/newest') soup = BeautifulSoup(res.text, 'html.parser') links = soup.select('.storylink') subtext = soup.select('.subtext') def sorted_hn(hnlist) : return sorted(hnlist, key = lambda k : k['poin...
StarcoderdataPython
118301
import scrapy # Se importan los items definidos from formula1.items import Formula1FastestLapItem class FormulaOneFastestLapsSpider(scrapy.Spider): # Nombre del spider name = 'formula-one-fastest-laps' # Dominios permitidos allowed_domains = ['https://www.formula1.com/en/results.html'] # URL por ...
StarcoderdataPython
1773802
<reponame>jkpubsrc/python-module-jk-infodatatree import datetime import time import jk_utils ################################################################################################################################ #### Data converters ###################################################################...
StarcoderdataPython
1604632
<reponame>baliyanvinay/Python-Interview-Preparation<gh_stars>1-10 # Provided that you have two eggs, find out the how many steps are required to get the floor that breaks the egg # Given: Two eggs and hidden floor number that breaks the egg def egg_threshold(total_floor, egg_break_floor): ''' Algorithm in acti...
StarcoderdataPython
3273800
from django.contrib import admin from .models import news admin.site.register(news) # Register your models here.
StarcoderdataPython
168018
# Author: <NAME> # Date: 5/21/2019 # Reference Formula: https://anomaly.io/understand-auto-cross-correlation-normalized-shift/ # Referrence Video: https://www.youtube.com/watch?v=ngEC3sXeUb4 import math from scipy.signal import fftconvolve import numpy as np # It implements the normalized, and standard correlation a...
StarcoderdataPython
55579
# MIT License # Copyright (c) 2017 MassChallenge, Inc. import swapper from accelerator_abstract.models import BasePartnerApplicationInterest class PartnerApplicationInterest(BasePartnerApplicationInterest): class Meta(BasePartnerApplicationInterest.Meta): swappable = swapper.swappable_setting( ...
StarcoderdataPython
4822035
import argparse import pandas as pd import plotly.express as px from rsi import rsi from utils import extract_close_prices_and_volumes def parse_args(): parser = argparse.ArgumentParser("Calculate RSI for given candles") parser.add_argument('candles', type=str, help='path to candles ...
StarcoderdataPython
130857
<gh_stars>0 import os import pytest from scope_plot import cli pytest_plugins = ["pytester"] FIXTURES_DIR = os.path.join( os.path.dirname(os.path.realpath(__file__)), "..", "__fixtures") @pytest.fixture def run(testdir): def do_run(*args): args = ["scope_plot", "--debug"] + list(args) retur...
StarcoderdataPython
77904
<gh_stars>1-10 import time, datetime, sys import ops.db import ops.project def ensureMarkerTable(dbHandle=None): if (dbHandle is None): dbHandle = ops.db.Database(db=ops.db.TARGET_DB, isolation_level=None) curs = dbHandle.connection.cursor() else: curs = dbHandle.cursor() try: ...
StarcoderdataPython
1759150
<filename>supervised/nnMultiClass/predict.py import numpy as np def sigmoid(z): """computes the sigmoid of z.""" g = (1 + np.exp(-z))**-1 return g def predict(Theta1, Theta2, X): """ outputs the predicted label of X given the trained weights of a neural network (Theta1, Theta2) """ # Usefu...
StarcoderdataPython
1647819
<gh_stars>0 from django.apps import AppConfig class ZarrinpalConfig(AppConfig): name = 'zarrinpal'
StarcoderdataPython
3213033
<filename>pferd.py<gh_stars>10-100 # File used by pyinstaller to create the executable from PFERD.__main__ import main if __name__ == "__main__": main()
StarcoderdataPython
3299953
<reponame>anteater/anteater<filename>anteater/src/project_scan.py #!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################## # Copyright (c) 2017 <NAME> <<EMAIL>> # # All rights reserved. This program and the accompanying materials # are made available u...
StarcoderdataPython
3378801
import numpy as np import chainer import os import glob from chainer import cuda, optimizers, serializers, Variable import cv2 from .datasets_base import datasets_base class mnist_train(datasets_base): def __init__(self, path=None, img_size=64): self.train, _ = chainer.datasets.get_mnist(withlabel=False, ...
StarcoderdataPython
3387421
<reponame>alcaides/lag-structure-sleep<filename>scripts/lags/plot_components_individuales.py<gh_stars>0 # -*- coding: cp1252 -*- from sys import * from random import uniform from random import randint from random import Random import time from soma import aims import os import pickle import anatomist.direct.api as ana ...
StarcoderdataPython
197887
<gh_stars>0 # This module is from mx/DateTime/LazyModule.py and is # distributed under the terms of the eGenix.com Public License Agreement # https://www.egenix.com/products/eGenix.com-Public-License-1.1.0.pdf """ Helper to enable simple lazy module import. 'Lazy' means the actual import is deferred until a...
StarcoderdataPython
42000
<reponame>BburnN123/bpcs import itertools import numpy as np from .logger import log def xor_lists(a, b): assert len(a) == len(b) return [x ^ y for x,y in zip(a,b)] def arr_map(arr, fcn): """ arr is a bit-planed numpy array returns arr with fcn applied to each pixel in arr where pixel is ...
StarcoderdataPython
136998
<filename>ariadne_server/classes/user/lock_funds.py import json from time import time from .abstract_user_method import AbstractMethod from context import REDIS #TODO determine if should be switched in to sql db #TODO determine if this file is deprecated with use of postgres lock class LockFunds(AbstractMethod): ...
StarcoderdataPython
14185
from __future__ import absolute_import, unicode_literals import unittest from fluent.runtime import FluentBundle from fluent.runtime.errors import FluentCyclicReferenceError, FluentReferenceError from ..utils import dedent_ftl class TestPlaceables(unittest.TestCase): def setUp(self): self.ctx = FluentB...
StarcoderdataPython
1718388
from django.test import TestCase from django.contrib.auth.models import User from django.urls import reverse from csvexport import apps, settings from csvexport.actions import ModelNode from csvexport.forms import CSVFieldsForm from csvexport.forms import CSVFormatForm from csvexport.forms import UniqueForm from ..m...
StarcoderdataPython
1626589
<gh_stars>0 # No shebang line, this module is meant to be imported # # Copyright 2014 <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 ...
StarcoderdataPython
154329
""" converts a GEDCOM file into a JSON file for use in Topographic Attribute Maps (https://github.com/rpreiner/tam) this is just a proof of concept and might contain serious mistakes and problems """ import argparse import json import re __author__ = "<NAME>" def add_child(parentId, childId, idsWithNodes, nodesWithF...
StarcoderdataPython
1610910
<gh_stars>1-10 # Copyright 2018 The Exoplanet ML Authors. # # 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 ...
StarcoderdataPython
1625124
<reponame>RaoOfPhysics/scivision from scivision.koala import get_koala_log, koala @koala def _dummy_fn(x, *, Y: str = "test"): """A dummy function.""" return def test_koala_logging(): """Test that koala logging is functional by executing a dummy function decorated with the `@koala` logging decorator...
StarcoderdataPython
1624374
from django.contrib.auth.models import Group, Permission from django.contrib.contenttypes.models import ContentType from django.contrib import messages from django.core.urlresolvers import reverse from django.shortcuts import get_object_or_404, redirect, render_to_response from django.template.response import Temp...
StarcoderdataPython
3376438
#!/usr/bin/env python import re import sys tablen = 4 if len(sys.argv) == 3: tablen = int(sys.argv[2]) with open(sys.argv[1], 'r') as f: lines = f.readlines() for line in lines: matches = re.findall(r'(^#{1,6}) (.*)', line) if matches: h_level = len(matches[0][0]) h_title = matches[0...
StarcoderdataPython
1655729
from enum import Enum from functools import wraps from typing import Callable, Optional import pytorch_lightning class TrainerState(Enum): """ State which is set in the :class:`~pytorch_lightning.trainer.trainer.Trainer` to indicate what is currently or was executed. """ INITIALIZING = 'INITIALIZING' ...
StarcoderdataPython
3261809
<reponame>pisceswolf96/5G-planning-using-a-GA<filename>files/crossover/single_arithmetic_crossover.py<gh_stars>10-100 import numpy as np def single_arithmetic_crossover(plan1, plan2, alpha): """Apply single arithmetic crossover Args: plan1: (plan objs) first plan. plan2: (plan objs) second pl...
StarcoderdataPython
1647238
import json import importlib from bottle import route, request, run @route('/json_input', method='POST') def json_input(): j = request.json print("j: ", j) result = j['output'] = { 'the number': 46 } result = serve(j) return result @route('/help') def help(): return ''' <p> ...
StarcoderdataPython
1684051
""" File : MSOutputStreamer.py Description: MSOutputStreamer.py class is a simple wrapper for the Output data placement service in WMCore MicroServices. """ # futures from __future__ import division, print_function import json # from itertools import islice # from collections import deque class MSOutputStrea...
StarcoderdataPython
152465
#!/usr/bin/python # coding=utf-8 # # This script reformats a list of leaked names produced by ithitools option "-E". # The script takes three parameters: # $1: the file produced by ithitools # $2: the file on which the formatted list of leaked named will be written # $3: the list of top names import codecs import sys ...
StarcoderdataPython
3385330
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Dec 10 23:57:14 2020 @author: <NAME> """ """ 1. Face detection from loaded Pictures """ import cv2 #Load input image, resize it and change it to grayscale mode original_img = cv2.imread('ayo2.jpg',1) img = cv2.resize(original_img, (0,0), fx=0.2, fy ...
StarcoderdataPython